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