1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: provide two new classes for layout, wxMultiCellSizer and wxMultiCellCanvas
4 // Author: Jonathan Bayer
8 // Copyright: (c) Jonathan Bayer
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // This was inspired by the gbsizer class written by Alex Andruschak
15 #ifndef __WX_MULTICELL_H__
16 #define __WX_MULTICELL_H__
19 #pragma interface "multicell.h"
24 #define GIZMODLLEXPORT WXDLLEXPORT
26 #define GIZMODLLEXPORT
30 // ----------------------------------------------------------------------------
32 // ----------------------------------------------------------------------------
33 // The classes are derived from wxSizer
37 // ----------------------------------------------------------------------------
39 // ----------------------------------------------------------------------------
42 wxNOT_RESIZABLE
= 0x00,
43 wxHORIZENTAL_RESIZABLE
= 0x01,
44 wxVERTICAL_RESIZABLE
= 0x10,
48 //---------------------------------------------------------------------------
50 //---------------------------------------------------------------------------
52 //---------------------------------------------------------------------------
53 // wxMultiCellItemHandle
54 //---------------------------------------------------------------------------
56 class GIZMODLLEXPORT wxMultiCellItemHandle
: public wxObject
58 DECLARE_CLASS(wxMultiCellItemHandle
);
70 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
);
71 wxMultiCellItemHandle( int row
, int column
, wxSize size
, wxResizable style
= wxNOT_RESIZABLE
, wxSize weight
= wxSize(1,1), int align
= wxALIGN_NOT
);
72 wxMultiCellItemHandle( int row
, int column
, wxResizable style
, wxSize weight
= wxSize(1,1), int align
= wxALIGN_NOT
);
73 wxMultiCellItemHandle( int row
, int column
, int align
);
78 wxResizable
GetStyle();
79 wxSize
GetLocalSize();
84 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
);
88 //---------------------------------------------------------------------------
90 //---------------------------------------------------------------------------
92 class GIZMODLLEXPORT wxMultiCellSizer
: virtual public wxSizer
94 DECLARE_CLASS(wxMultiCellSizer
);
100 wxMultiCellSizer(wxSize
& size
);
101 wxMultiCellSizer(int rows
, int cols
);
104 virtual void RecalcSizes();
105 virtual wxSize
CalcMin();
106 bool SetDefaultCellSize(wxSize size
);
107 bool SetColumnWidth(int column
, int colSize
= 5, bool expandable
= FALSE
);
108 bool SetRowHeight(int row
, int rowSize
= 5, bool expandable
= FALSE
);
109 bool EnableGridLines(wxWindow
*win
);
110 bool SetGridPen(wxPen
*pen
);
111 void OnPaint(wxDC
& dc
);
115 int Sum(int *array
, int x
);
125 wxSize m_defaultCellSize
;
126 wxWindow
*m_win
; // usually used for debugging
129 void DrawGridLines(wxDC
& dc
);
130 void Initialize(wxSize size
);
134 // wxCell is used internally, so we don't need to declare it here
138 //---------------------------------------------------------------------------
140 //---------------------------------------------------------------------------
142 class GIZMODLLEXPORT wxMultiCellCanvas
: public wxFlexGridSizer
145 wxMultiCellCanvas(wxWindow
*parent
, int numRows
= 2, int numCols
= 2);
146 void Add(wxWindow
*win
, unsigned int row
, unsigned int col
);
148 void Resize(int numRows
, int numCols
);
157 void CalculateConstraints();
158 void SetMinCellSize(const wxSize size
)
160 m_minCellSize
= size
;
165 unsigned int m_maxRows
, m_maxCols
;
167 wxSize m_minCellSize
;
175 /*** End of File ***/