1999-08-08 09:58:24 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: sizer.h
|
1999-08-08 12:45:57 -04:00
|
|
|
// Purpose: provide wxNewSizer class for layounting
|
1999-08-08 09:58:24 -04:00
|
|
|
// Author: Robert Roebling and Robin Dunn
|
|
|
|
// Modified by:
|
|
|
|
// Created:
|
|
|
|
// 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-08 12:45:57 -04:00
|
|
|
class wxNewSizerItem;
|
|
|
|
class wxNewSizer;
|
1999-08-08 17:09:59 -04:00
|
|
|
class wxBorderNewSizer;
|
1999-08-08 12:45:57 -04:00
|
|
|
class wxBoxNewSizer;
|
1999-08-08 09:58:24 -04:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
1999-08-08 12:45:57 -04:00
|
|
|
// wxNewSizerItem
|
1999-08-08 09:58:24 -04:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
1999-08-08 12:45:57 -04:00
|
|
|
class WXDLLEXPORT wxNewSizerItem: public wxObject
|
1999-08-08 09:58:24 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// spacer
|
1999-08-08 12:45:57 -04:00
|
|
|
wxNewSizerItem( int width, int height, int option );
|
1999-08-08 09:58:24 -04:00
|
|
|
|
|
|
|
// window
|
1999-08-08 12:45:57 -04:00
|
|
|
wxNewSizerItem( wxWindow *window, int option );
|
1999-08-08 09:58:24 -04:00
|
|
|
|
|
|
|
// subsizer
|
1999-08-08 12:45:57 -04:00
|
|
|
wxNewSizerItem( wxNewSizer *sizer, int option );
|
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-08-08 09:58:24 -04:00
|
|
|
|
|
|
|
bool IsWindow();
|
1999-08-08 12:45:57 -04:00
|
|
|
bool IsNewSizer();
|
1999-08-08 09:58:24 -04:00
|
|
|
bool IsSpacer();
|
|
|
|
|
|
|
|
wxWindow *GetWindow() const
|
|
|
|
{ return m_window; }
|
1999-08-08 12:45:57 -04:00
|
|
|
wxNewSizer *GetNewSizer() const
|
1999-08-08 09:58:24 -04:00
|
|
|
{ return m_sizer; }
|
|
|
|
int GetOption() const
|
|
|
|
{ return m_option; }
|
|
|
|
|
1999-08-08 12:45:57 -04:00
|
|
|
protected:
|
1999-08-08 09:58:24 -04:00
|
|
|
wxWindow *m_window;
|
1999-08-08 12:45:57 -04:00
|
|
|
wxNewSizer *m_sizer;
|
1999-08-08 09:58:24 -04:00
|
|
|
wxSize m_minSize;
|
|
|
|
int m_option;
|
1999-08-08 12:45:57 -04:00
|
|
|
};
|
1999-08-08 09:58:24 -04:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
1999-08-08 12:45:57 -04:00
|
|
|
// wxNewSizer
|
1999-08-08 09:58:24 -04:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
1999-08-08 12:45:57 -04:00
|
|
|
class WXDLLEXPORT wxNewSizer: public wxObject
|
1999-08-08 09:58:24 -04:00
|
|
|
{
|
|
|
|
public:
|
1999-08-08 12:45:57 -04:00
|
|
|
wxNewSizer();
|
|
|
|
~wxNewSizer();
|
1999-08-08 09:58:24 -04:00
|
|
|
|
|
|
|
virtual void Add( wxWindow *window, int option = 0 );
|
1999-08-08 12:45:57 -04:00
|
|
|
virtual void Add( wxNewSizer *sizer, int option = 0 );
|
1999-08-08 09:58:24 -04:00
|
|
|
virtual void Add( int width, int height, int option = 0 );
|
|
|
|
|
1999-08-08 12:45:57 -04:00
|
|
|
void SetDimension( int x, int y, int width, int height );
|
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-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-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;
|
|
|
|
|
|
|
|
wxSize GetMinWindowSize( wxWindow *window );
|
1999-08-08 12:45:57 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// wxBorderNewSizer
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#define wxWEST wxLEFT
|
|
|
|
#define wxEAST wxRIGHT
|
|
|
|
#define wxNORTH wxUP
|
|
|
|
#define wxSOUTH wxDOWN
|
|
|
|
#define wxALL_DIRECTIONS (wxNORTH | wxSOUTH | wxEAST | wxWEST)
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxBorderNewSizer: public wxNewSizer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxBorderNewSizer( int sides = wxALL_DIRECTIONS );
|
|
|
|
|
|
|
|
virtual void Add( wxWindow *window, int option = 10 );
|
|
|
|
virtual void Add( wxNewSizer *sizer, int option = 10 );
|
|
|
|
virtual void Add( int width, int height, int option = 10 );
|
|
|
|
|
|
|
|
void RecalcSizes();
|
|
|
|
wxSize CalcMin();
|
|
|
|
|
|
|
|
int GetSides()
|
|
|
|
{ return m_sides; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_sides;
|
|
|
|
};
|
|
|
|
|
1999-08-08 17:09:59 -04:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// wxBoxNewSizer
|
|
|
|
//---------------------------------------------------------------------------
|
1999-08-08 09:58:24 -04:00
|
|
|
|
1999-08-08 17:09:59 -04:00
|
|
|
class WXDLLEXPORT wxBoxNewSizer: public wxNewSizer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxBoxNewSizer( int orient );
|
|
|
|
|
|
|
|
void RecalcSizes();
|
|
|
|
wxSize CalcMin();
|
|
|
|
|
|
|
|
int GetOrientation()
|
|
|
|
{ return m_orient; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_orient;
|
|
|
|
int m_stretchable;
|
|
|
|
int m_minWidth;
|
|
|
|
int m_minHeight;
|
|
|
|
int m_fixedWidth;
|
|
|
|
int m_fixedHeight;
|
|
|
|
};
|
|
|
|
|
1999-08-08 09:58:24 -04:00
|
|
|
#endif
|
|
|
|
// __WXSIZER_H__
|