]>
Commit | Line | Data |
---|---|---|
5279a24d RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: sizer.h | |
3417c2cd | 3 | // Purpose: provide wxSizer class for layounting |
5279a24d RR |
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 | ||
27ea1d8a RR |
29 | class wxStaticBox; |
30 | ||
3417c2cd RR |
31 | class wxSizerItem; |
32 | class wxSizer; | |
92afa2b1 | 33 | class wxBoxSizer; |
27ea1d8a | 34 | class wxStaticBoxSizer; |
5279a24d RR |
35 | |
36 | //--------------------------------------------------------------------------- | |
3417c2cd | 37 | // wxSizerItem |
5279a24d RR |
38 | //--------------------------------------------------------------------------- |
39 | ||
3417c2cd | 40 | class WXDLLEXPORT wxSizerItem: public wxObject |
5279a24d RR |
41 | { |
42 | public: | |
43 | // spacer | |
3417c2cd | 44 | wxSizerItem( int width, int height, int option, int flag, int border ); |
5279a24d RR |
45 | |
46 | // window | |
3417c2cd | 47 | wxSizerItem( wxWindow *window, int option, int flag, int border ); |
5279a24d RR |
48 | |
49 | // subsizer | |
3417c2cd | 50 | wxSizerItem( wxSizer *sizer, int option, int flag, int border ); |
5279a24d | 51 | |
c62ac5b6 RR |
52 | virtual wxSize GetSize(); |
53 | virtual wxSize CalcMin(); | |
54 | virtual void SetDimension( wxPoint pos, wxSize size ); | |
5279a24d RR |
55 | |
56 | bool IsWindow(); | |
3417c2cd | 57 | bool IsSizer(); |
5279a24d RR |
58 | bool IsSpacer(); |
59 | ||
60 | wxWindow *GetWindow() const | |
61 | { return m_window; } | |
3417c2cd | 62 | wxSizer *GetSizer() const |
5279a24d RR |
63 | { return m_sizer; } |
64 | int GetOption() const | |
65 | { return m_option; } | |
d597fcb7 RR |
66 | int GetFlag() const |
67 | { return m_flag; } | |
68 | int GetBorder() const | |
69 | { return m_border; } | |
5279a24d | 70 | |
c62ac5b6 | 71 | protected: |
5279a24d | 72 | wxWindow *m_window; |
3417c2cd | 73 | wxSizer *m_sizer; |
d597fcb7 | 74 | wxSize m_size; |
5279a24d RR |
75 | wxSize m_minSize; |
76 | int m_option; | |
d597fcb7 RR |
77 | int m_border; |
78 | int m_flag; | |
c62ac5b6 | 79 | }; |
5279a24d RR |
80 | |
81 | //--------------------------------------------------------------------------- | |
3417c2cd | 82 | // wxSizer |
5279a24d RR |
83 | //--------------------------------------------------------------------------- |
84 | ||
3417c2cd | 85 | class WXDLLEXPORT wxSizer: public wxObject |
5279a24d RR |
86 | { |
87 | public: | |
3417c2cd RR |
88 | wxSizer(); |
89 | ~wxSizer(); | |
5279a24d | 90 | |
d597fcb7 | 91 | virtual void Add( wxWindow *window, int option = 0, int flag = 0, int border = 0 ); |
3417c2cd | 92 | virtual void Add( wxSizer *sizer, int option = 0, int flag = 0, int border = 0 ); |
d597fcb7 | 93 | virtual void Add( int width, int height, int option = 0, int flag = 0, int border = 0 ); |
5279a24d | 94 | |
42b4e99e RR |
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 | ||
c62ac5b6 | 103 | void SetDimension( int x, int y, int width, int height ); |
5279a24d RR |
104 | |
105 | wxSize GetSize() | |
106 | { return m_size; } | |
107 | wxPoint GetPosition() | |
108 | { return m_position; } | |
109 | wxSize GetMinSize() | |
110 | { return CalcMin(); } | |
c62ac5b6 | 111 | |
5279a24d RR |
112 | virtual void RecalcSizes() = 0; |
113 | virtual wxSize CalcMin() = 0; | |
c62ac5b6 RR |
114 | |
115 | virtual void Layout(); | |
5279a24d RR |
116 | |
117 | void Fit( wxWindow *window ); | |
118 | void SetSizeHints( wxWindow *window ); | |
119 | ||
c62ac5b6 | 120 | protected: |
5279a24d RR |
121 | wxSize m_size; |
122 | wxPoint m_position; | |
123 | wxList m_children; | |
124 | ||
125 | wxSize GetMinWindowSize( wxWindow *window ); | |
c62ac5b6 RR |
126 | }; |
127 | ||
128 | //--------------------------------------------------------------------------- | |
92afa2b1 | 129 | // wxBoxSizer |
c62ac5b6 RR |
130 | //--------------------------------------------------------------------------- |
131 | ||
92afa2b1 | 132 | class WXDLLEXPORT wxBoxSizer: public wxSizer |
61d514bb RR |
133 | { |
134 | public: | |
92afa2b1 | 135 | wxBoxSizer( int orient ); |
61d514bb RR |
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 | ||
27ea1d8a RR |
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 | ||
5279a24d RR |
171 | #endif |
172 | // __WXSIZER_H__ |