]> git.saurik.com Git - wxWidgets.git/blame - contrib/include/wx/gizmos/multicell.h
mark slider as being transparent, otherwise it has ugly solid grey background when...
[wxWidgets.git] / contrib / include / wx / gizmos / multicell.h
CommitLineData
58580a7e
JS
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:
118cc185 7// RCS-ID: $Id$
58580a7e
JS
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
ab7ce33c 18#if defined(__GNUG__) && !defined(__APPLE__)
a2d49353 19 #pragma interface "multicell.h"
58580a7e
JS
20#endif
21
936a13b5 22#include "wx/gizmos/gizmos.h"
086ab766 23
58580a7e
JS
24// ----------------------------------------------------------------------------
25// headers
26// ----------------------------------------------------------------------------
27// The classes are derived from wxSizer
28#include "wx/sizer.h"
29
30
31// ----------------------------------------------------------------------------
32// constants
33// ----------------------------------------------------------------------------
34enum wxResizable
35{
a2d49353
WS
36 wxNOT_RESIZABLE = 0x00,
37 wxHORIZONTAL_RESIZABLE = 0x01,
38 wxVERTICAL_RESIZABLE = 0x10,
39 wxRESIZABLE = 0x11
58580a7e
JS
40};
41
42//---------------------------------------------------------------------------
43// classes
44//---------------------------------------------------------------------------
45
46//---------------------------------------------------------------------------
47// wxMultiCellItemHandle
48//---------------------------------------------------------------------------
49
936a13b5 50class WXDLLIMPEXP_GIZMOS wxMultiCellItemHandle: public wxObject
58580a7e 51{
fde63257 52 DECLARE_CLASS(wxMultiCellItemHandle)
58580a7e 53protected:
a2d49353
WS
54 int m_column;
55 int m_row;
56 int m_width;
57 int m_height;
58 wxResizable m_style;
59 wxSize m_fixedSize;
60 int m_alignment;
61 wxSize m_weight;
58580a7e
JS
62
63public:
a2d49353
WS
64 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);
65 wxMultiCellItemHandle( int row, int column, wxSize size, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT);
66 wxMultiCellItemHandle( int row, int column, wxResizable style, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT);
a2d49353
WS
67 int GetColumn();
68 int GetRow();
69 int GetWidth();
70 int GetHeight();
71 wxResizable GetStyle();
72 wxSize GetLocalSize();
73 int GetAlignment();
74 wxSize GetWeight();
58580a7e
JS
75
76private:
a2d49353 77 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);
58580a7e
JS
78
79};
80
81//---------------------------------------------------------------------------
82// wxMultiCellSizer
83//---------------------------------------------------------------------------
84
936a13b5 85class WXDLLIMPEXP_GIZMOS wxMultiCellSizer : virtual public wxSizer
58580a7e 86{
fde63257 87 DECLARE_CLASS(wxMultiCellSizer)
58580a7e
JS
88
89protected:
a2d49353 90 wxSize m_cell_count;
58580a7e
JS
91
92public:
a2d49353
WS
93 wxMultiCellSizer(wxSize & size);
94 wxMultiCellSizer(int rows, int cols);
95 ~wxMultiCellSizer();
96
97 virtual void RecalcSizes();
98 virtual wxSize CalcMin();
99 bool SetDefaultCellSize(wxSize size);
100 bool SetColumnWidth(int column, int colSize = 5, bool expandable = false);
101 bool SetRowHeight(int row, int rowSize = 5, bool expandable = false);
102 bool EnableGridLines(wxWindow *win);
103 bool SetGridPen(wxPen *pen);
104 void OnPaint(wxDC& dc);
58580a7e
JS
105
106private:
a2d49353
WS
107 void GetMinimums();
108 int Sum(int *array, int x);
58580a7e
JS
109
110private:
a2d49353
WS
111 int *m_maxHeight;
112 int *m_maxWidth;
113 int *m_rowStretch;
114 int *m_colStretch;
115 wxSize **m_weights;
116 wxSize **m_minSizes;
117 int m_maxWeights;
118 wxSize m_defaultCellSize;
119 wxWindow *m_win; // usually used for debugging
120 wxPen *m_pen;
121
122 void DrawGridLines(wxDC& dc);
123 void Initialize(wxSize size);
58580a7e
JS
124};
125
126
127// wxCell is used internally, so we don't need to declare it here
128
129class wxCell;
130
131//---------------------------------------------------------------------------
132// wxMultiCellCanvas
133//---------------------------------------------------------------------------
134
936a13b5 135class WXDLLIMPEXP_GIZMOS wxMultiCellCanvas : public wxFlexGridSizer
58580a7e
JS
136{
137public:
a2d49353
WS
138 wxMultiCellCanvas(wxWindow *parent, int numRows = 2, int numCols = 2);
139 void Add(wxWindow *win, unsigned int row, unsigned int col);
140
141 void Resize(int numRows, int numCols);
142 int MaxRows()
143 {
144 return m_maxRows;
145 };
146 int MaxCols()
147 {
148 return m_maxCols;
149 };
150 void CalculateConstraints();
151 void SetMinCellSize(const wxSize size)
152 {
153 m_minCellSize = size;
154 };
58580a7e 155
ba597ca8
JS
156 /* These are to hide Add() method of parents and to avoid Borland warning about hiding virtual functions */
157 void Add( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL )
158 { wxFlexGridSizer::Add( window, proportion, flag, border, userData); }
159 void Add( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL )
160 { wxFlexGridSizer::Add( sizer, proportion, flag, border, userData); }
161 void Add( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL )
162 { wxFlexGridSizer::Add( width, height, proportion, flag, border, userData); }
163 void Add( wxSizerItem *item )
164 { wxFlexGridSizer::Add( item); }
165
58580a7e 166private:
a2d49353
WS
167 wxWindow *m_parent;
168 unsigned int m_maxRows, m_maxCols;
58580a7e 169
a2d49353
WS
170 wxSize m_minCellSize;
171 wxCell **m_cells;
58580a7e
JS
172};
173
174#endif
175
176
177
178/*** End of File ***/