]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/gizmos/multicell.h
bump date on 'easter egg' dialog.
[wxWidgets.git] / contrib / include / wx / gizmos / multicell.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: multicell.h
3 // Purpose: provide two new classes for layout, wxMultiCellSizer and wxMultiCellCanvas
4 // Author: Jonathan Bayer
5 // Modified by:
6 // Created:
7 // RCS-ID: $Id:
8 // Copyright: (c) Jonathan Bayer
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // This was inspired by the gbsizer class written by Alex Andruschak
13
14
15 #ifndef __WX_MULTICELL_H__
16 #define __WX_MULTICELL_H__
17
18 #ifdef __GNUG__
19 #pragma interface "multicell.h"
20 #endif
21
22 // ----------------------------------------------------------------------------
23 // headers
24 // ----------------------------------------------------------------------------
25 // The classes are derived from wxSizer
26 #include "wx/sizer.h"
27
28
29 // ----------------------------------------------------------------------------
30 // constants
31 // ----------------------------------------------------------------------------
32 enum wxResizable
33 {
34 wxNOT_RESIZABLE = 0x00,
35 wxHORIZENTAL_RESIZABLE = 0x01,
36 wxVERTICAL_RESIZABLE = 0x10,
37 wxRESIZABLE = 0x11
38 };
39
40 //---------------------------------------------------------------------------
41 // classes
42 //---------------------------------------------------------------------------
43
44 //---------------------------------------------------------------------------
45 // wxMultiCellItemHandle
46 //---------------------------------------------------------------------------
47
48 class WXDLLEXPORT wxMultiCellItemHandle: public wxObject
49 {
50 DECLARE_CLASS(wxMultiCellItemHandle);
51 protected:
52 int m_column;
53 int m_row;
54 int m_width;
55 int m_height;
56 wxResizable m_style;
57 wxSize m_fixedSize;
58 int m_alignment;
59 wxSize m_weight;
60
61 public:
62 wxMultiCellItemHandle( int row, int column, int height = 1, int width = 1, wxSize size = wxDefaultSize, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT);
63 wxMultiCellItemHandle( int row, int column, wxSize size, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT);
64 wxMultiCellItemHandle( int row, int column, wxResizable style, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT);
65 wxMultiCellItemHandle( int row, int column, int align);
66 int GetColumn();
67 int GetRow();
68 int GetWidth();
69 int GetHeight();
70 wxResizable GetStyle();
71 wxSize GetLocalSize();
72 int GetAlignment();
73 wxSize GetWeight();
74
75 private:
76 void Initialize( int row, int column, int height = 1, int width = 1, wxSize size = wxDefaultSize, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT);
77
78 };
79
80 //---------------------------------------------------------------------------
81 // wxMultiCellSizer
82 //---------------------------------------------------------------------------
83
84 class WXDLLEXPORT wxMultiCellSizer : virtual public wxSizer
85 {
86 DECLARE_CLASS(wxMultiCellSizer);
87
88 protected:
89 wxSize m_cell_count;
90
91 public:
92 wxMultiCellSizer(wxSize & size);
93 wxMultiCellSizer(int rows, int cols);
94 ~wxMultiCellSizer();
95
96 virtual void RecalcSizes();
97 virtual wxSize CalcMin();
98 bool SetDefaultCellSize(wxSize size);
99 bool SetColumnWidth(int column, int colSize = 5, bool expandable = FALSE);
100 bool SetRowHeight(int row, int rowSize = 5, bool expandable = FALSE);
101 bool EnableGridLines(wxWindow *win);
102 bool SetGridPen(wxPen *pen);
103 void OnPaint(wxDC& dc);
104
105 private:
106 void GetMinimums();
107 int Sum(int *array, int x);
108
109 private:
110 int *m_maxHeight;
111 int *m_maxWidth;
112 int *m_rowStretch;
113 int *m_colStretch;
114 wxSize **m_weights;
115 wxSize **m_minSizes;
116 int m_maxWeights;
117 wxSize m_defaultCellSize;
118 wxWindow *m_win; // usually used for debugging
119 wxPen *m_pen;
120
121 void DrawGridLines(wxDC& dc);
122 void Initialize(wxSize size);
123 };
124
125
126 // wxCell is used internally, so we don't need to declare it here
127
128 class wxCell;
129
130 //---------------------------------------------------------------------------
131 // wxMultiCellCanvas
132 //---------------------------------------------------------------------------
133
134 class wxMultiCellCanvas : public wxFlexGridSizer
135 {
136 public:
137 wxMultiCellCanvas(wxWindow *parent, int numRows = 2, int numCols = 2);
138 void Add(wxWindow *win, unsigned int row, unsigned int col);
139
140 void Resize(int numRows, int numCols);
141 int MaxRows()
142 {
143 return m_maxRows;
144 };
145 int MaxCols()
146 {
147 return m_maxCols;
148 };
149 void CalculateConstraints();
150 void SetMinCellSize(const wxSize size)
151 {
152 m_minCellSize = size;
153 };
154
155 private:
156 wxWindow *m_parent;
157 unsigned int m_maxRows, m_maxCols;
158
159 wxSize m_minCellSize;
160 wxCell **m_cells;
161 };
162
163 #endif
164
165
166
167 /*** End of File ***/