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