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"
22 // ----------------------------------------------------------------------------
24 // ----------------------------------------------------------------------------
25 // The classes are derived from wxSizer
29 // ----------------------------------------------------------------------------
31 // ----------------------------------------------------------------------------
34 wxNOT_RESIZABLE
= 0x00,
35 wxHORIZENTAL_RESIZABLE
= 0x01,
36 wxVERTICAL_RESIZABLE
= 0x10,
40 //---------------------------------------------------------------------------
42 //---------------------------------------------------------------------------
44 //---------------------------------------------------------------------------
45 // wxMultiCellItemHandle
46 //---------------------------------------------------------------------------
48 class WXDLLEXPORT wxMultiCellItemHandle
: public wxObject
50 DECLARE_CLASS(wxMultiCellItemHandle
);
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
);
70 wxResizable
GetStyle();
71 wxSize
GetLocalSize();
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
);
80 //---------------------------------------------------------------------------
82 //---------------------------------------------------------------------------
84 class WXDLLEXPORT wxMultiCellSizer
: virtual public wxSizer
86 DECLARE_CLASS(wxMultiCellSizer
);
92 wxMultiCellSizer(wxSize
& size
);
93 wxMultiCellSizer(int rows
, int cols
);
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
);
107 int Sum(int *array
, int x
);
117 wxSize m_defaultCellSize
;
118 wxWindow
*m_win
; // usually used for debugging
121 void DrawGridLines(wxDC
& dc
);
122 void Initialize(wxSize size
);
126 // wxCell is used internally, so we don't need to declare it here
130 //---------------------------------------------------------------------------
132 //---------------------------------------------------------------------------
134 class wxMultiCellCanvas
: public wxFlexGridSizer
137 wxMultiCellCanvas(wxWindow
*parent
, int numRows
= 2, int numCols
= 2);
138 void Add(wxWindow
*win
, unsigned int row
, unsigned int col
);
140 void Resize(int numRows
, int numCols
);
149 void CalculateConstraints();
150 void SetMinCellSize(const wxSize size
)
152 m_minCellSize
= size
;
157 unsigned int m_maxRows
, m_maxCols
;
159 wxSize m_minCellSize
;
167 /*** End of File ***/