]> git.saurik.com Git - wxWidgets.git/blob - include/wx/sizer.h
Added defines to allow altered tab placement under gcc-2.95
[wxWidgets.git] / include / wx / sizer.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: sizer.h
3 // Purpose: provide wxSizer class for layouting
4 // Author: Robert Roebling and Robin Dunn
5 // Modified by:
6 // Created:
7 // RCS-ID: $Id$
8 // Copyright: (c) Robin Dunn, Dirk Holtwick and Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __WXSIZER_H__
13 #define __WXSIZER_H__
14
15 #ifdef __GNUG__
16 #pragma interface "sizer.h"
17 #endif
18
19 #include "wx/defs.h"
20
21 #include "wx/window.h"
22 #include "wx/frame.h"
23 #include "wx/dialog.h"
24
25 //---------------------------------------------------------------------------
26 // classes
27 //---------------------------------------------------------------------------
28
29 class wxStaticBox;
30
31 class wxSizerItem;
32 class wxSizer;
33 class wxBoxSizer;
34 class wxStaticBoxSizer;
35
36 //---------------------------------------------------------------------------
37 // wxSizerItem
38 //---------------------------------------------------------------------------
39
40 class WXDLLEXPORT wxSizerItem: public wxObject
41 {
42 DECLARE_CLASS(wxSizerItem);
43 public:
44 // spacer
45 wxSizerItem( int width, int height, int option, int flag, int border, wxObject* userData);
46
47 // window
48 wxSizerItem( wxWindow *window, int option, int flag, int border, wxObject* userData );
49
50 // subsizer
51 wxSizerItem( wxSizer *sizer, int option, int flag, int border, wxObject* userData );
52
53 ~wxSizerItem();
54
55 virtual wxSize GetSize();
56 virtual wxSize CalcMin();
57 virtual void SetDimension( wxPoint pos, wxSize size );
58
59 bool IsWindow();
60 bool IsSizer();
61 bool IsSpacer();
62
63 wxWindow *GetWindow() const
64 { return m_window; }
65 wxSizer *GetSizer() const
66 { return m_sizer; }
67 int GetOption() const
68 { return m_option; }
69 int GetFlag() const
70 { return m_flag; }
71 int GetBorder() const
72 { return m_border; }
73 wxObject* GetUserData()
74 { return m_userData; }
75
76 protected:
77 wxWindow *m_window;
78 wxSizer *m_sizer;
79 wxSize m_size;
80 wxSize m_minSize;
81 int m_option;
82 int m_border;
83 int m_flag;
84 wxObject *m_userData;
85 };
86
87 //---------------------------------------------------------------------------
88 // wxSizer
89 //---------------------------------------------------------------------------
90
91 class WXDLLEXPORT wxSizer: public wxObject
92 {
93 DECLARE_CLASS(wxSizer);
94 public:
95 wxSizer();
96 ~wxSizer();
97
98 virtual void Add( wxWindow *window, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
99 virtual void Add( wxSizer *sizer, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
100 virtual void Add( int width, int height, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
101
102 virtual void Prepend( wxWindow *window, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
103 virtual void Prepend( wxSizer *sizer, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
104 virtual void Prepend( int width, int height, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
105
106 virtual bool Remove( wxWindow *window );
107 virtual bool Remove( wxSizer *sizer );
108 virtual bool Remove( int pos );
109
110 void SetDimension( int x, int y, int width, int height );
111
112 wxSize GetSize()
113 { return m_size; }
114 wxPoint GetPosition()
115 { return m_position; }
116 wxSize GetMinSize()
117 { return CalcMin(); }
118
119 virtual void RecalcSizes() = 0;
120 virtual wxSize CalcMin() = 0;
121
122 virtual void Layout();
123
124 void Fit( wxWindow *window );
125 void SetSizeHints( wxWindow *window );
126
127 wxList& GetChildren()
128 { return m_children; }
129
130 protected:
131 wxSize m_size;
132 wxPoint m_position;
133 wxList m_children;
134
135 wxSize GetMinWindowSize( wxWindow *window );
136 };
137
138 //---------------------------------------------------------------------------
139 // wxBoxSizer
140 //---------------------------------------------------------------------------
141
142 class WXDLLEXPORT wxBoxSizer: public wxSizer
143 {
144 DECLARE_CLASS(wxBoxSizer);
145 public:
146 wxBoxSizer( int orient );
147
148 void RecalcSizes();
149 wxSize CalcMin();
150
151 int GetOrientation()
152 { return m_orient; }
153
154 protected:
155 int m_orient;
156 int m_stretchable;
157 int m_minWidth;
158 int m_minHeight;
159 int m_fixedWidth;
160 int m_fixedHeight;
161 };
162
163 //---------------------------------------------------------------------------
164 // wxStaticBoxSizer
165 //---------------------------------------------------------------------------
166
167 class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer
168 {
169 DECLARE_CLASS(wxStaticBoxSizer);
170 public:
171 wxStaticBoxSizer( wxStaticBox *box, int orient );
172
173 void RecalcSizes();
174 wxSize CalcMin();
175
176 wxStaticBox *GetStaticBox()
177 { return m_staticBox; }
178
179 protected:
180 wxStaticBox *m_staticBox;
181 };
182
183 #endif
184 // __WXSIZER_H__