]> git.saurik.com Git - wxWidgets.git/blame - include/wx/sizer.h
Renamed GtkMyFixed to GtkPizza,
[wxWidgets.git] / include / wx / sizer.h
CommitLineData
5279a24d
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: sizer.h
0c0d686f 3// Purpose: provide wxSizer class for layouting
5279a24d
RR
4// Author: Robert Roebling and Robin Dunn
5// Modified by:
0c0d686f 6// Created:
5279a24d
RR
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
29class wxStaticBox;
30
3417c2cd
RR
31class wxSizerItem;
32class wxSizer;
92afa2b1 33class wxBoxSizer;
27ea1d8a 34class wxStaticBoxSizer;
5279a24d
RR
35
36//---------------------------------------------------------------------------
3417c2cd 37// wxSizerItem
5279a24d
RR
38//---------------------------------------------------------------------------
39
3417c2cd 40class WXDLLEXPORT wxSizerItem: public wxObject
5279a24d 41{
0c0d686f 42 DECLARE_CLASS(wxSizerItem);
5279a24d
RR
43public:
44 // spacer
0c0d686f 45 wxSizerItem( int width, int height, int option, int flag, int border, wxObject* userData);
5279a24d
RR
46
47 // window
0c0d686f 48 wxSizerItem( wxWindow *window, int option, int flag, int border, wxObject* userData );
5279a24d
RR
49
50 // subsizer
0c0d686f
RD
51 wxSizerItem( wxSizer *sizer, int option, int flag, int border, wxObject* userData );
52
53 ~wxSizerItem();
5279a24d 54
c62ac5b6
RR
55 virtual wxSize GetSize();
56 virtual wxSize CalcMin();
57 virtual void SetDimension( wxPoint pos, wxSize size );
0c0d686f 58
5279a24d 59 bool IsWindow();
3417c2cd 60 bool IsSizer();
5279a24d 61 bool IsSpacer();
0c0d686f
RD
62
63 wxWindow *GetWindow() const
5279a24d 64 { return m_window; }
0c0d686f 65 wxSizer *GetSizer() const
5279a24d
RR
66 { return m_sizer; }
67 int GetOption() const
68 { return m_option; }
d597fcb7
RR
69 int GetFlag() const
70 { return m_flag; }
71 int GetBorder() const
72 { return m_border; }
0c0d686f
RD
73 wxObject* GetUserData()
74 { return m_userData; }
75
c62ac5b6 76protected:
5279a24d 77 wxWindow *m_window;
3417c2cd 78 wxSizer *m_sizer;
d597fcb7 79 wxSize m_size;
5279a24d
RR
80 wxSize m_minSize;
81 int m_option;
d597fcb7
RR
82 int m_border;
83 int m_flag;
0c0d686f 84 wxObject *m_userData;
c62ac5b6 85};
5279a24d
RR
86
87//---------------------------------------------------------------------------
3417c2cd 88// wxSizer
5279a24d
RR
89//---------------------------------------------------------------------------
90
3417c2cd 91class WXDLLEXPORT wxSizer: public wxObject
5279a24d 92{
0c0d686f 93 DECLARE_CLASS(wxSizer);
5279a24d 94public:
3417c2cd
RR
95 wxSizer();
96 ~wxSizer();
0c0d686f
RD
97
98 virtual void Add( wxWindow *window, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
99 virtual void Add( wxSizer *sizer, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
100 virtual void Add( int width, int height, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
101
102 virtual void Prepend( wxWindow *window, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
103 virtual void Prepend( wxSizer *sizer, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
104 virtual void Prepend( int width, int height, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
105
42b4e99e
RR
106 virtual bool Remove( wxWindow *window );
107 virtual bool Remove( wxSizer *sizer );
108 virtual bool Remove( int pos );
0c0d686f 109
c62ac5b6 110 void SetDimension( int x, int y, int width, int height );
0c0d686f 111
5279a24d
RR
112 wxSize GetSize()
113 { return m_size; }
114 wxPoint GetPosition()
115 { return m_position; }
116 wxSize GetMinSize()
117 { return CalcMin(); }
c62ac5b6 118
5279a24d
RR
119 virtual void RecalcSizes() = 0;
120 virtual wxSize CalcMin() = 0;
0c0d686f 121
c62ac5b6 122 virtual void Layout();
5279a24d
RR
123
124 void Fit( wxWindow *window );
125 void SetSizeHints( wxWindow *window );
0c0d686f
RD
126
127 wxList& GetChildren()
128 { return m_children; }
129
c62ac5b6 130protected:
5279a24d
RR
131 wxSize m_size;
132 wxPoint m_position;
133 wxList m_children;
0c0d686f 134
5279a24d 135 wxSize GetMinWindowSize( wxWindow *window );
c62ac5b6
RR
136};
137
138//---------------------------------------------------------------------------
92afa2b1 139// wxBoxSizer
c62ac5b6
RR
140//---------------------------------------------------------------------------
141
92afa2b1 142class WXDLLEXPORT wxBoxSizer: public wxSizer
61d514bb 143{
0c0d686f 144 DECLARE_CLASS(wxBoxSizer);
61d514bb 145public:
92afa2b1 146 wxBoxSizer( int orient );
0c0d686f 147
61d514bb
RR
148 void RecalcSizes();
149 wxSize CalcMin();
0c0d686f 150
61d514bb
RR
151 int GetOrientation()
152 { return m_orient; }
0c0d686f 153
61d514bb
RR
154protected:
155 int m_orient;
156 int m_stretchable;
157 int m_minWidth;
158 int m_minHeight;
159 int m_fixedWidth;
160 int m_fixedHeight;
161};
0c0d686f 162
27ea1d8a
RR
163//---------------------------------------------------------------------------
164// wxStaticBoxSizer
165//---------------------------------------------------------------------------
166
167class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer
168{
0c0d686f 169 DECLARE_CLASS(wxStaticBoxSizer);
27ea1d8a
RR
170public:
171 wxStaticBoxSizer( wxStaticBox *box, int orient );
0c0d686f 172
27ea1d8a
RR
173 void RecalcSizes();
174 wxSize CalcMin();
0c0d686f 175
27ea1d8a
RR
176 wxStaticBox *GetStaticBox()
177 { return m_staticBox; }
0c0d686f 178
27ea1d8a
RR
179protected:
180 wxStaticBox *m_staticBox;
181};
182
5279a24d
RR
183#endif
184 // __WXSIZER_H__