Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXMatrix.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * M a t r i x C o n t a i n e r W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXMatrix.h,v 1.19 2006/01/22 17:58:06 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXMATRIX_H
25 #define FXMATRIX_H
26 
27 #ifndef FXPACKER_H
28 #include "FXPacker.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /// Matrix packing options
35 enum {
36  MATRIX_BY_ROWS = 0, /// Fixed number of rows, add columns as needed
37  MATRIX_BY_COLUMNS = 0x00020000 /// Fixed number of columns, adding rows as needed
38  };
39 
40 
41 
42 /**
43 * The Matrix layout manager automatically arranges its child windows
44 * in rows and columns. If the matrix style is MATRIX_BY_ROWS, then
45 * the matrix will have the given number of rows and the number of columns
46 * grows as more child windows are added; if the matrix style is MATRIX_BY_COLUMNS,
47 * then the number of columns is fixed and the number of rows grows as more children
48 * are added.
49 * If all children in a row (column) have the LAYOUT_FILL_ROW (LAYOUT_FILL_COLUMN)
50 * hint set, then the row (column) will be stretchable as the matrix layout manager
51 * itself is resized. If more than one row (column) is stretchable, the space is
52 * apportioned to each stretchable row (column) proportionally.
53 * Within each cell of the matrix, all other layout hints are observed.
54 * For example, a child having LAYOUT_CENTER_Y and LAYOUT_FILL_X hints will
55 * be centered in the Y-direction, while being stretched in the X-direction.
56 * Empty cells can be obtained by simply placing a borderless FXFrame widget
57 * as a space-holder.
58 */
59 class FXAPI FXMatrix : public FXPacker {
61 protected:
62  FXint num;
63 protected:
64  FXMatrix(){}
65 private:
66  FXMatrix(const FXMatrix&);
67  FXMatrix &operator=(const FXMatrix&);
68 public:
69  long onFocusUp(FXObject*,FXSelector,void*);
70  long onFocusDown(FXObject*,FXSelector,void*);
71  long onFocusLeft(FXObject*,FXSelector,void*);
72  long onFocusRight(FXObject*,FXSelector,void*);
73 public:
74 
75  /// Construct a matrix layout manager with n rows or columns
77 
78  /// Perform layout
79  virtual void layout();
80 
81  /// Return default width
82  virtual FXint getDefaultWidth();
83 
84  /// Return default height
85  virtual FXint getDefaultHeight();
86 
87  /// Obtain the child placed at a certain row and column
88  FXWindow* childAtRowCol(FXint r,FXint c) const;
89 
90  /// Return the row in which the given child is placed
91  FXint rowOfChild(const FXWindow* child) const;
92 
93  /// Return the column in which the given child is placed
94  FXint colOfChild(const FXWindow* child) const;
95 
96  /// Change the matrix style
97  void setMatrixStyle(FXuint ph);
98 
99  /// Return the current matrix style
100  FXuint getMatrixStyle() const;
101 
102  /// Change the number of rows
103  void setNumRows(FXint nr);
104 
105  /// Return the number of rows
106  FXint getNumRows() const;
107 
108  /// Change the number of columns
109  void setNumColumns(FXint nc);
110 
111  /// Return the number of columns
112  FXint getNumColumns() const;
113  };
114 
115 }
116 
117 #endif
Fixed number of rows, add columns as needed.
Definition: FXMatrix.h:39
Fixed number of columns, adding rows as needed.
Definition: FXMatrix.h:40
Base class for all windows.
Definition: FXWindow.h:115
The Matrix layout manager automatically arranges its child windows in rows and columns.
Definition: FXMatrix.h:66
unsigned int FXuint
Definition: fxdefs.h:396
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
Base composite.
Definition: FXComposite.h:35
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:397
Packer is a layout manager which automatically places child windows inside its area against the left...
Definition: FXPacker.h:58
Definition: FXPacker.h:38
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92

Copyright © 1997-2005 Jeroen van der Zijp