zipstrm link fix

added sizer.h/cpp which don't even compile yet


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3315 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 1999-08-08 13:58:24 +00:00
parent 6001e347ba
commit 5279a24d25
4 changed files with 243 additions and 2 deletions

109
include/wx/sizer.h Normal file
View File

@ -0,0 +1,109 @@
/////////////////////////////////////////////////////////////////////////////
// Name: sizer.h
// Purpose: provide wxSizer class for layounting
// 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
//---------------------------------------------------------------------------
class wxSizerItem;
class wxSizer;
class wxBoxSizer;
//---------------------------------------------------------------------------
// wxSizerItem
//---------------------------------------------------------------------------
class WXDLLEXPORT wxSizerItem: wxObject
{
public:
// spacer
wxSizerItem( int width, int height, int option )
// window
wxSizerItem( wxWindow *window, int option );
// subsizer
wxSizerItem( wxSizer *sizer, int option );
virtual wxSize GetMinSize();
bool IsWindow();
bool IsSizer();
bool IsSpacer();
wxWindow *GetWindow() const
{ return m_window; }
wxSizer *GetSizer() const
{ return m_sizer; }
int GetOption() const
{ return m_option; }
private:
wxWindow *m_window;
wxSizer *m_sizer;
wxSize m_minSize;
int m_option;
}
//---------------------------------------------------------------------------
// wxSizer
//---------------------------------------------------------------------------
class WXDLLEXPORT wxSizer: wxObject
{
public:
wxSizer()
~wxSizer()
virtual void Add( wxWindow *window, int option = 0 );
virtual void Add( wxSizer *sizer, int option = 0 );
virtual void Add( int width, int height, int option = 0 );
void SetDimension( int x, int y, int width, int height )
{ DoSetDimension( x, y, width, height ); }
wxSize GetSize()
{ return m_size; }
wxPoint GetPosition()
{ return m_position; }
wxSize GetMinSize()
{ return CalcMin(); }
virtual void RecalcSizes() = 0;
virtual wxSize CalcMin() = 0;
void Fit( wxWindow *window );
void SetSizeHints( wxWindow *window );
private:
wxSize m_size;
wxPoint m_position;
wxList m_children;
wxSize GetMinWindowSize( wxWindow *window );
virtual void DoSetDimension( int x, int y, int width, int height );
}
#endif
// __WXSIZER_H__

View File

@ -10,7 +10,7 @@
#define __ZIPSTREAM_H__
#ifdef __GNUG__
#pragma interface
#pragma interface "zipstrm.h"
#endif
#include "wx/defs.h"

132
src/common/sizer.cpp Normal file
View File

@ -0,0 +1,132 @@
/////////////////////////////////////////////////////////////////////////////
// Name: sizer.cpp
// Purpose: provide wxSizer class for layounting
// 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 __WXSIZERS_H__
#define __WXSIZERS_H__
#ifdef __GNUG__
#pragma interface "sizers.h"
#endif
#include "wx/sizer.h"
//---------------------------------------------------------------------------
// wxSizerItem
//---------------------------------------------------------------------------
wxSizerItem::wxSizerItem( int width, int height, int option )
{
m_window = (wxWindow *) NULL;
m_sizer = (wxSizer *) NULL;
m_minSize.x = width;
m_minSize.h = height;
m_option = option;
}
wxSizerItem::wxSizerItem( wxWindow *window, int option )
{
m_window = window;
m_sizer = (wxSizer *) NULL;
m_minSize = window->GetSize();
m_option = option;
}
wxSizerItem::wxSizerItem( wxSizer *sizer, int option )
{
m_window = (wxWindow *) NULL;
m_sizer = sizer;
m_minSize.x = -1;
m_minSize.h = -1;
m_option = option;
}
wxSize wxSizerItem::GetMinSize()
{
if (IsSizer())
return m_sizer->GetMinSize();
else
return m_minSize;
}
bool wxSizerItem::IsWindow()
{
return (m_window != NULL);
}
bool wxSizerItem::IsSizer()
{
return (m_sizer != NULL);
}
bool wxSizerItem::IsSpacer()
{
return (m_window == NULL) && (m_sizer == NULL);
}
//---------------------------------------------------------------------------
// wxSizer
//---------------------------------------------------------------------------
wxSizer::wxSizer()
{
m_children.DeleteContents( TRUE );
}
wxSizer::~wxSizer()
{
}
void wxSizer::Add( wxWindow *window, int option )
{
m_children.Append( new wxSizerItem( window, option ) );
}
void wxSizer::Add( wxSizer *sizer, int option )
{
m_children.Append( new wxSizerItem( sizer, option ) );
}
void wxSizer::Add( int width, int height, int option )
{
m_children.Append( new wxSizerItem( width, height, option ) );
}
void wxSizer::Fit( wxWindow *window );
{
window->SetSize( GetMinWindowSize( window ) );
}
void wxSizer::SetSizeHints( wxWindow *window );
{
wxSize size( GetMinWindowSize( window ) );
window->SetSizeHints( size.x, size.y );
}
wxSize wxSizer::GetMinWindowSize( wxWindow *window )
{
wxSize min( GetMinSize() );
wxSize size( window->GetSize() );
wxSize client_size( window->GetClientSize() );
return wxSize( min.x+size.x-client_size.x, min.y+size.y-client_size.y );
}
void wxSizer::DoSetDimension( int x, int y, int width, int height )
{
m_position.x = x;
m_position.y = y;
m_size.x = width;
m_size.y = height;
RecalcSizes();
}
#endif
// __SIZERS_H__

View File

@ -7,7 +7,7 @@
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "zipstream.h"
#pragma implementation "zipstrm.h"
#endif
// For compilers that support precompilation, includes "wx.h".