zipstrm link fix
[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 wxSizerItem;
30 class wxSizer;
31 class wxBoxSizer;
32
33 //---------------------------------------------------------------------------
34 // wxSizerItem
35 //---------------------------------------------------------------------------
36
37 class WXDLLEXPORT wxSizerItem: wxObject
38 {
39 public:
40 // spacer
41 wxSizerItem( int width, int height, int option )
42
43 // window
44 wxSizerItem( wxWindow *window, int option );
45
46 // subsizer
47 wxSizerItem( wxSizer *sizer, int option );
48
49 virtual wxSize GetMinSize();
50
51 bool IsWindow();
52 bool IsSizer();
53 bool IsSpacer();
54
55 wxWindow *GetWindow() const
56 { return m_window; }
57 wxSizer *GetSizer() const
58 { return m_sizer; }
59 int GetOption() const
60 { return m_option; }
61
62 private:
63 wxWindow *m_window;
64 wxSizer *m_sizer;
65 wxSize m_minSize;
66 int m_option;
67 }
68
69 //---------------------------------------------------------------------------
70 // wxSizer
71 //---------------------------------------------------------------------------
72
73 class WXDLLEXPORT wxSizer: wxObject
74 {
75 public:
76 wxSizer()
77 ~wxSizer()
78
79 virtual void Add( wxWindow *window, int option = 0 );
80 virtual void Add( wxSizer *sizer, int option = 0 );
81 virtual void Add( int width, int height, int option = 0 );
82
83 void SetDimension( int x, int y, int width, int height )
84 { DoSetDimension( x, y, width, height ); }
85
86 wxSize GetSize()
87 { return m_size; }
88 wxPoint GetPosition()
89 { return m_position; }
90 wxSize GetMinSize()
91 { return CalcMin(); }
92
93 virtual void RecalcSizes() = 0;
94 virtual wxSize CalcMin() = 0;
95
96 void Fit( wxWindow *window );
97 void SetSizeHints( wxWindow *window );
98
99 private:
100 wxSize m_size;
101 wxPoint m_position;
102 wxList m_children;
103
104 wxSize GetMinWindowSize( wxWindow *window );
105 virtual void DoSetDimension( int x, int y, int width, int height );
106 }
107
108 #endif
109 // __WXSIZER_H__