From: Robert Roebling Date: Sun, 8 Aug 1999 13:58:24 +0000 (+0000) Subject: zipstrm link fix X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5279a24d25b1d865212c838bb25546f79a9106df 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 --- diff --git a/include/wx/sizer.h b/include/wx/sizer.h new file mode 100644 index 0000000000..417cb9d981 --- /dev/null +++ b/include/wx/sizer.h @@ -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__ diff --git a/include/wx/zipstrm.h b/include/wx/zipstrm.h index ad1e680b32..1c4be27845 100644 --- a/include/wx/zipstrm.h +++ b/include/wx/zipstrm.h @@ -10,7 +10,7 @@ #define __ZIPSTREAM_H__ #ifdef __GNUG__ -#pragma interface +#pragma interface "zipstrm.h" #endif #include "wx/defs.h" diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp new file mode 100644 index 0000000000..541fcf3fb2 --- /dev/null +++ b/src/common/sizer.cpp @@ -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__ diff --git a/src/common/zipstrm.cpp b/src/common/zipstrm.cpp index d334dd8c58..70e700e651 100644 --- a/src/common/zipstrm.cpp +++ b/src/common/zipstrm.cpp @@ -7,7 +7,7 @@ ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ -#pragma implementation "zipstream.h" +#pragma implementation "zipstrm.h" #endif // For compilers that support precompilation, includes "wx.h".