]>
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 | |
c62ac5b6 | 95 | void SetDimension( int x, int y, int width, int height ); |
5279a24d RR |
96 | |
97 | wxSize GetSize() | |
98 | { return m_size; } | |
99 | wxPoint GetPosition() | |
100 | { return m_position; } | |
101 | wxSize GetMinSize() | |
102 | { return CalcMin(); } | |
c62ac5b6 | 103 | |
5279a24d RR |
104 | virtual void RecalcSizes() = 0; |
105 | virtual wxSize CalcMin() = 0; | |
c62ac5b6 RR |
106 | |
107 | virtual void Layout(); | |
5279a24d RR |
108 | |
109 | void Fit( wxWindow *window ); | |
110 | void SetSizeHints( wxWindow *window ); | |
111 | ||
c62ac5b6 | 112 | protected: |
5279a24d RR |
113 | wxSize m_size; |
114 | wxPoint m_position; | |
115 | wxList m_children; | |
116 | ||
117 | wxSize GetMinWindowSize( wxWindow *window ); | |
c62ac5b6 RR |
118 | }; |
119 | ||
120 | //--------------------------------------------------------------------------- | |
92afa2b1 | 121 | // wxBoxSizer |
c62ac5b6 RR |
122 | //--------------------------------------------------------------------------- |
123 | ||
92afa2b1 | 124 | class WXDLLEXPORT wxBoxSizer: public wxSizer |
61d514bb RR |
125 | { |
126 | public: | |
92afa2b1 | 127 | wxBoxSizer( int orient ); |
61d514bb RR |
128 | |
129 | void RecalcSizes(); | |
130 | wxSize CalcMin(); | |
131 | ||
132 | int GetOrientation() | |
133 | { return m_orient; } | |
134 | ||
135 | protected: | |
136 | int m_orient; | |
137 | int m_stretchable; | |
138 | int m_minWidth; | |
139 | int m_minHeight; | |
140 | int m_fixedWidth; | |
141 | int m_fixedHeight; | |
142 | }; | |
143 | ||
27ea1d8a RR |
144 | //--------------------------------------------------------------------------- |
145 | // wxStaticBoxSizer | |
146 | //--------------------------------------------------------------------------- | |
147 | ||
148 | class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer | |
149 | { | |
150 | public: | |
151 | wxStaticBoxSizer( wxStaticBox *box, int orient ); | |
152 | ||
153 | void RecalcSizes(); | |
154 | wxSize CalcMin(); | |
155 | ||
156 | wxStaticBox *GetStaticBox() | |
157 | { return m_staticBox; } | |
158 | ||
159 | protected: | |
160 | wxStaticBox *m_staticBox; | |
161 | }; | |
162 | ||
5279a24d RR |
163 | #endif |
164 | // __WXSIZER_H__ |