1999-08-08 09:58:24 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: sizer.h
|
1999-09-19 23:12:49 -04:00
|
|
|
// Purpose: provide wxSizer class for layouting
|
1999-08-08 09:58:24 -04:00
|
|
|
// Author: Robert Roebling and Robin Dunn
|
|
|
|
// Modified by:
|
1999-09-19 23:12:49 -04:00
|
|
|
// Created:
|
1999-08-08 09:58:24 -04:00
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Robin Dunn, Dirk Holtwick and Robert Roebling
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __WXSIZER_H__
|
|
|
|
#define __WXSIZER_H__
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "sizer.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
|
|
|
|
#include "wx/window.h"
|
|
|
|
#include "wx/frame.h"
|
|
|
|
#include "wx/dialog.h"
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
1999-08-13 13:32:30 -04:00
|
|
|
class wxStaticBox;
|
|
|
|
|
1999-08-09 13:00:51 -04:00
|
|
|
class wxSizerItem;
|
|
|
|
class wxSizer;
|
1999-08-11 07:53:40 -04:00
|
|
|
class wxBoxSizer;
|
1999-08-13 13:32:30 -04:00
|
|
|
class wxStaticBoxSizer;
|
1999-08-08 09:58:24 -04:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
1999-08-09 13:00:51 -04:00
|
|
|
// wxSizerItem
|
1999-08-08 09:58:24 -04:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
1999-08-09 13:00:51 -04:00
|
|
|
class WXDLLEXPORT wxSizerItem: public wxObject
|
1999-08-08 09:58:24 -04:00
|
|
|
{
|
1999-09-19 23:12:49 -04:00
|
|
|
DECLARE_CLASS(wxSizerItem);
|
1999-08-08 09:58:24 -04:00
|
|
|
public:
|
|
|
|
// spacer
|
1999-09-19 23:12:49 -04:00
|
|
|
wxSizerItem( int width, int height, int option, int flag, int border, wxObject* userData);
|
1999-08-08 09:58:24 -04:00
|
|
|
|
|
|
|
// window
|
1999-09-19 23:12:49 -04:00
|
|
|
wxSizerItem( wxWindow *window, int option, int flag, int border, wxObject* userData );
|
1999-08-08 09:58:24 -04:00
|
|
|
|
|
|
|
// subsizer
|
1999-09-19 23:12:49 -04:00
|
|
|
wxSizerItem( wxSizer *sizer, int option, int flag, int border, wxObject* userData );
|
|
|
|
|
|
|
|
~wxSizerItem();
|
1999-08-08 09:58:24 -04:00
|
|
|
|
1999-08-08 12:45:57 -04:00
|
|
|
virtual wxSize GetSize();
|
|
|
|
virtual wxSize CalcMin();
|
|
|
|
virtual void SetDimension( wxPoint pos, wxSize size );
|
1999-09-19 23:12:49 -04:00
|
|
|
|
1999-08-08 09:58:24 -04:00
|
|
|
bool IsWindow();
|
1999-08-09 13:00:51 -04:00
|
|
|
bool IsSizer();
|
1999-08-08 09:58:24 -04:00
|
|
|
bool IsSpacer();
|
1999-09-19 23:12:49 -04:00
|
|
|
|
|
|
|
wxWindow *GetWindow() const
|
1999-08-08 09:58:24 -04:00
|
|
|
{ return m_window; }
|
1999-09-19 23:12:49 -04:00
|
|
|
wxSizer *GetSizer() const
|
1999-08-08 09:58:24 -04:00
|
|
|
{ return m_sizer; }
|
|
|
|
int GetOption() const
|
|
|
|
{ return m_option; }
|
1999-08-09 07:27:37 -04:00
|
|
|
int GetFlag() const
|
|
|
|
{ return m_flag; }
|
|
|
|
int GetBorder() const
|
|
|
|
{ return m_border; }
|
1999-09-19 23:12:49 -04:00
|
|
|
wxObject* GetUserData()
|
|
|
|
{ return m_userData; }
|
|
|
|
|
1999-08-08 12:45:57 -04:00
|
|
|
protected:
|
1999-08-08 09:58:24 -04:00
|
|
|
wxWindow *m_window;
|
1999-08-09 13:00:51 -04:00
|
|
|
wxSizer *m_sizer;
|
1999-08-09 07:27:37 -04:00
|
|
|
wxSize m_size;
|
1999-08-08 09:58:24 -04:00
|
|
|
wxSize m_minSize;
|
|
|
|
int m_option;
|
1999-08-09 07:27:37 -04:00
|
|
|
int m_border;
|
|
|
|
int m_flag;
|
1999-09-19 23:12:49 -04:00
|
|
|
wxObject *m_userData;
|
1999-08-08 12:45:57 -04:00
|
|
|
};
|
1999-08-08 09:58:24 -04:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
1999-08-09 13:00:51 -04:00
|
|
|
// wxSizer
|
1999-08-08 09:58:24 -04:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
1999-08-09 13:00:51 -04:00
|
|
|
class WXDLLEXPORT wxSizer: public wxObject
|
1999-08-08 09:58:24 -04:00
|
|
|
{
|
1999-09-19 23:12:49 -04:00
|
|
|
DECLARE_CLASS(wxSizer);
|
1999-08-08 09:58:24 -04:00
|
|
|
public:
|
1999-08-09 13:00:51 -04:00
|
|
|
wxSizer();
|
|
|
|
~wxSizer();
|
1999-09-19 23:12:49 -04:00
|
|
|
|
|
|
|
virtual void Add( wxWindow *window, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
|
|
|
|
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 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 );
|
|
|
|
|
1999-08-16 16:17:48 -04:00
|
|
|
virtual bool Remove( wxWindow *window );
|
|
|
|
virtual bool Remove( wxSizer *sizer );
|
|
|
|
virtual bool Remove( int pos );
|
1999-09-19 23:12:49 -04:00
|
|
|
|
1999-08-08 12:45:57 -04:00
|
|
|
void SetDimension( int x, int y, int width, int height );
|
1999-09-19 23:12:49 -04:00
|
|
|
|
1999-08-08 09:58:24 -04:00
|
|
|
wxSize GetSize()
|
|
|
|
{ return m_size; }
|
|
|
|
wxPoint GetPosition()
|
|
|
|
{ return m_position; }
|
|
|
|
wxSize GetMinSize()
|
|
|
|
{ return CalcMin(); }
|
1999-08-08 12:45:57 -04:00
|
|
|
|
1999-08-08 09:58:24 -04:00
|
|
|
virtual void RecalcSizes() = 0;
|
|
|
|
virtual wxSize CalcMin() = 0;
|
1999-09-19 23:12:49 -04:00
|
|
|
|
1999-08-08 12:45:57 -04:00
|
|
|
virtual void Layout();
|
1999-08-08 09:58:24 -04:00
|
|
|
|
|
|
|
void Fit( wxWindow *window );
|
|
|
|
void SetSizeHints( wxWindow *window );
|
1999-09-19 23:12:49 -04:00
|
|
|
|
|
|
|
wxList& GetChildren()
|
|
|
|
{ return m_children; }
|
|
|
|
|
1999-08-08 12:45:57 -04:00
|
|
|
protected:
|
1999-08-08 09:58:24 -04:00
|
|
|
wxSize m_size;
|
|
|
|
wxPoint m_position;
|
|
|
|
wxList m_children;
|
1999-09-19 23:12:49 -04:00
|
|
|
|
1999-08-08 09:58:24 -04:00
|
|
|
wxSize GetMinWindowSize( wxWindow *window );
|
1999-08-08 12:45:57 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
1999-08-11 07:53:40 -04:00
|
|
|
// wxBoxSizer
|
1999-08-08 12:45:57 -04:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
1999-08-11 07:53:40 -04:00
|
|
|
class WXDLLEXPORT wxBoxSizer: public wxSizer
|
1999-08-08 17:09:59 -04:00
|
|
|
{
|
1999-09-19 23:12:49 -04:00
|
|
|
DECLARE_CLASS(wxBoxSizer);
|
1999-08-08 17:09:59 -04:00
|
|
|
public:
|
1999-08-11 07:53:40 -04:00
|
|
|
wxBoxSizer( int orient );
|
1999-09-19 23:12:49 -04:00
|
|
|
|
1999-08-08 17:09:59 -04:00
|
|
|
void RecalcSizes();
|
|
|
|
wxSize CalcMin();
|
1999-09-19 23:12:49 -04:00
|
|
|
|
1999-08-08 17:09:59 -04:00
|
|
|
int GetOrientation()
|
|
|
|
{ return m_orient; }
|
1999-09-19 23:12:49 -04:00
|
|
|
|
1999-08-08 17:09:59 -04:00
|
|
|
protected:
|
|
|
|
int m_orient;
|
|
|
|
int m_stretchable;
|
|
|
|
int m_minWidth;
|
|
|
|
int m_minHeight;
|
|
|
|
int m_fixedWidth;
|
|
|
|
int m_fixedHeight;
|
|
|
|
};
|
1999-09-19 23:12:49 -04:00
|
|
|
|
1999-08-13 13:32:30 -04:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// wxStaticBoxSizer
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer
|
|
|
|
{
|
1999-09-19 23:12:49 -04:00
|
|
|
DECLARE_CLASS(wxStaticBoxSizer);
|
1999-08-13 13:32:30 -04:00
|
|
|
public:
|
|
|
|
wxStaticBoxSizer( wxStaticBox *box, int orient );
|
1999-09-19 23:12:49 -04:00
|
|
|
|
1999-08-13 13:32:30 -04:00
|
|
|
void RecalcSizes();
|
|
|
|
wxSize CalcMin();
|
1999-09-19 23:12:49 -04:00
|
|
|
|
1999-08-13 13:32:30 -04:00
|
|
|
wxStaticBox *GetStaticBox()
|
|
|
|
{ return m_staticBox; }
|
1999-09-19 23:12:49 -04:00
|
|
|
|
1999-08-13 13:32:30 -04:00
|
|
|
protected:
|
|
|
|
wxStaticBox *m_staticBox;
|
|
|
|
};
|
|
|
|
|
1999-08-08 09:58:24 -04:00
|
|
|
#endif
|
|
|
|
// __WXSIZER_H__
|