]> git.saurik.com Git - wxWidgets.git/blob - include/wx/sizer.h
use global hwndTT
[wxWidgets.git] / include / wx / sizer.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: sizer.h
3 // Purpose: provide wxSizer class for layounting
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 public:
43 // spacer
44 wxSizerItem( int width, int height, int option, int flag, int border );
45
46 // window
47 wxSizerItem( wxWindow *window, int option, int flag, int border );
48
49 // subsizer
50 wxSizerItem( wxSizer *sizer, int option, int flag, int border );
51
52 virtual wxSize GetSize();
53 virtual wxSize CalcMin();
54 virtual void SetDimension( wxPoint pos, wxSize size );
55
56 bool IsWindow();
57 bool IsSizer();
58 bool IsSpacer();
59
60 wxWindow *GetWindow() const
61 { return m_window; }
62 wxSizer *GetSizer() const
63 { return m_sizer; }
64 int GetOption() const
65 { return m_option; }
66 int GetFlag() const
67 { return m_flag; }
68 int GetBorder() const
69 { return m_border; }
70
71 protected:
72 wxWindow *m_window;
73 wxSizer *m_sizer;
74 wxSize m_size;
75 wxSize m_minSize;
76 int m_option;
77 int m_border;
78 int m_flag;
79 };
80
81 //---------------------------------------------------------------------------
82 // wxSizer
83 //---------------------------------------------------------------------------
84
85 class WXDLLEXPORT wxSizer: public wxObject
86 {
87 public:
88 wxSizer();
89 ~wxSizer();
90
91 virtual void Add( wxWindow *window, int option = 0, int flag = 0, int border = 0 );
92 virtual void Add( wxSizer *sizer, int option = 0, int flag = 0, int border = 0 );
93 virtual void Add( int width, int height, int option = 0, int flag = 0, int border = 0 );
94
95 virtual void Prepend( wxWindow *window, int option = 0, int flag = 0, int border = 0 );
96 virtual void Prepend( wxSizer *sizer, int option = 0, int flag = 0, int border = 0 );
97 virtual void Prepend( int width, int height, int option = 0, int flag = 0, int border = 0 );
98
99 virtual bool Remove( wxWindow *window );
100 virtual bool Remove( wxSizer *sizer );
101 virtual bool Remove( int pos );
102
103 void SetDimension( int x, int y, int width, int height );
104
105 wxSize GetSize()
106 { return m_size; }
107 wxPoint GetPosition()
108 { return m_position; }
109 wxSize GetMinSize()
110 { return CalcMin(); }
111
112 virtual void RecalcSizes() = 0;
113 virtual wxSize CalcMin() = 0;
114
115 virtual void Layout();
116
117 void Fit( wxWindow *window );
118 void SetSizeHints( wxWindow *window );
119
120 protected:
121 wxSize m_size;
122 wxPoint m_position;
123 wxList m_children;
124
125 wxSize GetMinWindowSize( wxWindow *window );
126 };
127
128 //---------------------------------------------------------------------------
129 // wxBoxSizer
130 //---------------------------------------------------------------------------
131
132 class WXDLLEXPORT wxBoxSizer: public wxSizer
133 {
134 public:
135 wxBoxSizer( int orient );
136
137 void RecalcSizes();
138 wxSize CalcMin();
139
140 int GetOrientation()
141 { return m_orient; }
142
143 protected:
144 int m_orient;
145 int m_stretchable;
146 int m_minWidth;
147 int m_minHeight;
148 int m_fixedWidth;
149 int m_fixedHeight;
150 };
151
152 //---------------------------------------------------------------------------
153 // wxStaticBoxSizer
154 //---------------------------------------------------------------------------
155
156 class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer
157 {
158 public:
159 wxStaticBoxSizer( wxStaticBox *box, int orient );
160
161 void RecalcSizes();
162 wxSize CalcMin();
163
164 wxStaticBox *GetStaticBox()
165 { return m_staticBox; }
166
167 protected:
168 wxStaticBox *m_staticBox;
169 };
170
171 #endif
172 // __WXSIZER_H__