X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0c0d686fe5693f29d86f068a81abdcfeab63dc7f..44141a18c31bd78facb88230783aeb6c935cafc7:/include/wx/sizer.h diff --git a/include/wx/sizer.h b/include/wx/sizer.h index c94ebfee71..091a17db79 100644 --- a/include/wx/sizer.h +++ b/include/wx/sizer.h @@ -27,6 +27,7 @@ //--------------------------------------------------------------------------- class wxStaticBox; +class wxNotebook; class wxSizerItem; class wxSizer; @@ -56,9 +57,27 @@ public: virtual wxSize CalcMin(); virtual void SetDimension( wxPoint pos, wxSize size ); + void SetRatio( int width, int height ) + // if either of dimensions is zero, ratio is assumed to be 1 + // to avoid "divide by zero" errors + { m_ratio = (width && height) ? ((float) width / (float) height) : 1; } + void SetRatio( wxSize size ) + { m_ratio = (size.x && size.y) ? ((float) size.x / (float) size.y) : 1; } + void SetRatio( float ratio ) { m_ratio = ratio; } + float GetRatio() const { return m_ratio; } + bool IsWindow(); bool IsSizer(); bool IsSpacer(); + + void SetInitSize( int x, int y ) + { m_minSize.x = x; m_minSize.y = y; } + void SetOption( int option ) + { m_option = option; } + void SetFlag( int flag ) + { m_flag = flag; } + void SetBorder( int border ) + { m_border = border; } wxWindow *GetWindow() const { return m_window; } @@ -81,6 +100,10 @@ protected: int m_option; int m_border; int m_flag; + // als: aspect ratio can always be calculated from m_size, + // but this would cause precision loss when the window + // is shrinked. it is safer to preserve initial value. + float m_ratio; wxObject *m_userData; }; @@ -99,6 +122,10 @@ public: virtual void Add( wxSizer *sizer, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); virtual void Add( int width, int height, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual void Insert( int before, wxWindow *window, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual void Insert( int before, wxSizer *sizer, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual void Insert( int before, int width, int height, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual void Prepend( wxWindow *window, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); virtual void Prepend( wxSizer *sizer, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); virtual void Prepend( int width, int height, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); @@ -180,5 +207,30 @@ protected: wxStaticBox *m_staticBox; }; +//--------------------------------------------------------------------------- +// wxNotebookSizer +//--------------------------------------------------------------------------- + +#if wxUSE_NOTEBOOK + +class WXDLLEXPORT wxNotebookSizer: public wxSizer +{ + DECLARE_CLASS(wxNotebookSizer); +public: + wxNotebookSizer( wxNotebook *nb ); + + void RecalcSizes(); + wxSize CalcMin(); + + wxNotebook *GetNotebook() + { return m_notebook; } + +protected: + wxNotebook *m_notebook; +}; + +#endif + + #endif // __WXSIZER_H__