wxSizer::Add/Insert now returns pointer to wxSizerItem added and wxSizerItem contains access to its area [Patch #1042571 with minimal tweaks]

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30391 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba 2004-11-09 18:33:00 +00:00
parent 48023e151f
commit 56eee37fc8
8 changed files with 256 additions and 209 deletions

View File

@ -165,6 +165,8 @@ INCOMPATIBLE CHANGES SINCE 2.4.x
variable any more (the compiler might warn you about this)
- wxListItem::m_data is now of type wxUIntPtr, not long, for compatibility
with 64 bit systems
- wxSizer::Add/Insert returns pointer to wxSizerItem just added so conditions
writeen with if(Add(..)==true) will not work. Use if(Add(..)) instead.
DEPRECATED METHODS SINCE 2.4.x
@ -232,6 +234,8 @@ All (GUI):
- recursive wxSizer::GetItem returns item of given window, sizer or nth index
- wxLayoutConstraints now use best size, not current size, for AsIs() condition
- wxSizer::Add/Insert etc. now returns pointer to wxSizerItem just added and this
item remembers its wxRect area (Brian A. Vanderburg II)
Unix:

View File

@ -29,16 +29,16 @@ rows and columns.
\membersection{wxGridBagSizer::Add}\label{wxgridbagsizeradd}
\func{bool}{Add}{\param{wxWindow* }{window}, \param{const wxGBPosition\& }{pos}, \param{const wxGBSpan\& }{span = wxDefaultSpan}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{wxSizerItem*}{Add}{\param{wxWindow* }{window}, \param{const wxGBPosition\& }{pos}, \param{const wxGBSpan\& }{span = wxDefaultSpan}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{bool}{Add}{\param{wxSizer* }{sizer}, \param{const wxGBPosition\& }{pos}, \param{const wxGBSpan\& }{span = wxDefaultSpan}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{wxSizerItem*}{Add}{\param{wxSizer* }{sizer}, \param{const wxGBPosition\& }{pos}, \param{const wxGBSpan\& }{span = wxDefaultSpan}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{bool}{Add}{\param{int }{width}, \param{int }{height}, \param{const wxGBPosition\& }{pos}, \param{const wxGBSpan\& }{span = wxDefaultSpan}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{wxSizerItem*}{Add}{\param{int }{width}, \param{int }{height}, \param{const wxGBPosition\& }{pos}, \param{const wxGBSpan\& }{span = wxDefaultSpan}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{bool}{Add}{\param{wxGBSizerItem* }{item}}
\func{wxSizerItem*}{Add}{\param{wxGBSizerItem* }{item}}
The Add methods return true if the item was successfully placed at the
given position, false if something was already there.
The Add methods return a valid pointer if the item was successfully placed at the
given position, NULL if something was already there.
\membersection{wxGridBagSizer::CalcMin}\label{wxgridbagsizercalcmin}

View File

@ -62,11 +62,11 @@ The destructor.
\membersection{wxSizer::Add}\label{wxsizeradd}
\func{void}{Add}{\param{wxWindow* }{window}, \param{int }{proportion = 0},\param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{wxSizerItem*}{Add}{\param{wxWindow* }{window}, \param{int }{proportion = 0},\param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{void}{Add}{\param{wxSizer* }{sizer}, \param{int }{proportion = 0}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{wxSizerItem*}{Add}{\param{wxSizer* }{sizer}, \param{int }{proportion = 0}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{void}{Add}{\param{int }{width}, \param{int }{height}, \param{int }{proportion = 0}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{wxSizerItem*}{Add}{\param{int }{width}, \param{int }{height}, \param{int }{proportion = 0}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
Appends a child to the sizer. wxSizer itself is an abstract class, but the parameters are
equivalent in the derived classes that you will instantiate to use it so they are described
@ -145,7 +145,7 @@ complex than the {\it proportion} and {\it flag} will allow for.}
\membersection{wxSizer::AddSpacer}\label{wxsizeraddspacer}
\func{void}{AddSpacer}{\param{int }{size}}
\func{wxSizerItem*}{AddSpacer}{\param{int }{size}}
Adds non-stretchable space to the sizer. More readable way of calling
\helpref{Add}{wxsizeradd}(size, size, 0).
@ -153,7 +153,7 @@ Adds non-stretchable space to the sizer. More readable way of calling
\membersection{wxSizer::AddStretchSpacer}\label{wxsizeraddstretchspacer}
\func{void}{AddStretchSpacer}{\param{int }{prop = 1}}
\func{wxSizerItem*}{AddStretchSpacer}{\param{int }{prop = 1}}
Adds stretchable space to the sizer. More readable way of calling
\helpref{Add}{wxsizeradd}(0, 0, prop).
@ -254,11 +254,11 @@ size of all the children and their borders or the minimal size set by
\membersection{wxSizer::Insert}\label{wxsizerinsert}
\func{void}{Insert}{\param{size\_t }{index}, \param{wxWindow* }{window}, \param{int }{proportion = 0},\param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{wxSizerItem*}{Insert}{\param{size\_t }{index}, \param{wxWindow* }{window}, \param{int }{proportion = 0},\param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{void}{Insert}{\param{size\_t }{index}, \param{wxSizer* }{sizer}, \param{int }{proportion = 0}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{wxSizerItem*}{Insert}{\param{size\_t }{index}, \param{wxSizer* }{sizer}, \param{int }{proportion = 0}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{void}{Insert}{\param{size\_t }{index}, \param{int }{width}, \param{int }{height}, \param{int }{proportion = 0}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{wxSizerItem*}{Insert}{\param{size\_t }{index}, \param{int }{width}, \param{int }{height}, \param{int }{proportion = 0}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
Insert a child into the sizer before any existing item at {\it index}.
@ -269,7 +269,7 @@ See \helpref{wxSizer::Add}{wxsizeradd} for the meaning of the other parameters.
\membersection{wxSizer::InsertSpacer}\label{wxsizerinsertspacer}
\func{void}{InsertSpacer}{\param{size\_t }{index}, \param{int }{size}}
\func{wxSizerItem*}{InsertSpacer}{\param{size\_t }{index}, \param{int }{size}}
Inserts non-stretchable space to the sizer. More readable way of calling
\helpref{Insert}{wxsizerinsert}(size, size, 0).
@ -277,7 +277,7 @@ Inserts non-stretchable space to the sizer. More readable way of calling
\membersection{wxSizer::InsertStretchSpacer}\label{wxsizerinsertstretchspacer}
\func{void}{InsertStretchSpacer}{\param{size\_t }{index}, \param{int }{prop = 1}}
\func{wxSizerItem*}{InsertStretchSpacer}{\param{size\_t }{index}, \param{int }{prop = 1}}
Inserts stretchable space to the sizer. More readable way of calling
\helpref{Insert}{wxsizerinsert}(0, 0, prop).
@ -294,11 +294,11 @@ the current dimension.
\membersection{wxSizer::Prepend}\label{wxsizerprepend}
\func{void}{Prepend}{\param{wxWindow* }{window}, \param{int }{proportion = 0}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{wxSizerItem*}{Prepend}{\param{wxWindow* }{window}, \param{int }{proportion = 0}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{void}{Prepend}{\param{wxSizer* }{sizer}, \param{int }{proportion = 0}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{wxSizerItem*}{Prepend}{\param{wxSizer* }{sizer}, \param{int }{proportion = 0}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
\func{void}{Prepend}{\param{int }{width}, \param{int }{height}, \param{int }{proportion = 0}, \param{int }{flag = 0}, \param{int }{border= 0}, \param{wxObject* }{userData = NULL}}
\func{wxSizerItem*}{Prepend}{\param{int }{width}, \param{int }{height}, \param{int }{proportion = 0}, \param{int }{flag = 0}, \param{int }{border= 0}, \param{wxObject* }{userData = NULL}}
Same as \helpref{wxSizer::Add}{wxsizeradd}, but prepends the items to the beginning of the
list of items (windows, subsizers or spaces) owned by this sizer.
@ -306,7 +306,7 @@ list of items (windows, subsizers or spaces) owned by this sizer.
\membersection{wxSizer::PrependSpacer}\label{wxsizerprependspacer}
\func{void}{PrependSpacer}{\param{int }{size}}
\func{wxSizerItem*}{PrependSpacer}{\param{int }{size}}
Prepends non-stretchable space to the sizer. More readable way of calling
\helpref{Prepend}{wxsizerprepend}(size, size, 0).
@ -314,7 +314,7 @@ Prepends non-stretchable space to the sizer. More readable way of calling
\membersection{wxSizer::PrependStretchSpacer}\label{wxsizerprependstretchspacer}
\func{void}{PrepentStretchSpacer}{\param{int }{prop = 1}}
\func{wxSizerItem*}{PrependStretchSpacer}{\param{int }{prop = 1}}
Prepends stretchable space to the sizer. More readable way of calling
\helpref{Prepend}{wxsizerprepend}(0, 0, prop).

View File

@ -104,6 +104,12 @@ Get the proportion item attribute.
Get the ration item attribute.
\membersection{wxSizerItem::GetRect}\label{wxsizeritemgetrect}
\func{wxRect}{GetRect}{\void}
Get the rectangle of the item on the parent window.
\membersection{wxSizerItem::GetSize}\label{wxsizeritemgetsize}
\constfunc{wxSize}{GetSize}{\void}

View File

@ -176,26 +176,26 @@ public:
// The Add methods return true if the item was successfully placed at the
// given position, false if something was already there.
bool Add( wxWindow *window,
const wxGBPosition& pos,
const wxGBSpan& span = wxDefaultSpan,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
bool Add( wxSizer *sizer,
const wxGBPosition& pos,
const wxGBSpan& span = wxDefaultSpan,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
bool Add( int width,
int height,
const wxGBPosition& pos,
const wxGBSpan& span = wxDefaultSpan,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
bool Add( wxGBSizerItem *item );
wxSizerItem* Add( wxWindow *window,
const wxGBPosition& pos,
const wxGBSpan& span = wxDefaultSpan,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
wxSizerItem* Add( wxSizer *sizer,
const wxGBPosition& pos,
const wxGBSpan& span = wxDefaultSpan,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
wxSizerItem* Add( int width,
int height,
const wxGBPosition& pos,
const wxGBSpan& span = wxDefaultSpan,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
wxSizerItem* Add( wxGBSizerItem *item );
// Get/Set the size used for cells in the grid with no item.
@ -270,22 +270,22 @@ public:
// The Add base class virtuals should not be used with this class, but
// we'll try to make them automatically select a location for the item
// anyway.
virtual void Add( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual void Add( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual void Add( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Add( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Add( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Add( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
// The Insert and Prepend base class virtuals that are not appropriate for
// this class and should not be used. Their implementation in this class
// simply fails.
virtual void Add( wxSizerItem *item );
virtual void Insert( size_t index, wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual void Insert( size_t index, wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual void Insert( size_t index, int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual void Insert( size_t index, wxSizerItem *item );
virtual void Prepend( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual void Prepend( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual void Prepend( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual void Prepend( wxSizerItem *item );
virtual wxSizerItem* Add( wxSizerItem *item );
virtual wxSizerItem* Insert( size_t index, wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Insert( size_t index, wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Insert( size_t index, int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Insert( size_t index, wxSizerItem *item );
virtual wxSizerItem* Prepend( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Prepend( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Prepend( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Prepend( wxSizerItem *item );
protected:

View File

@ -182,6 +182,8 @@ public:
float GetRatio() const
{ return m_ratio; }
virtual wxRect GetRect() { return m_zoneRect; }
bool IsWindow() const;
bool IsSizer() const;
bool IsSpacer() const;
@ -241,6 +243,7 @@ protected:
int m_proportion;
int m_border;
int m_flag;
wxRect m_zoneRect; // Rectangle for window or item (not including borders)
// If true, then this item is considered in the layout
// calculation. Otherwise, it is skipped over.
@ -273,81 +276,81 @@ public:
// methods for adding elements to the sizer: there are Add/Insert/Prepend
// overloads for each of window/sizer/spacer/wxSizerItem
inline void Add( wxWindow *window,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline void Add( wxSizer *sizer,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline void Add( int width,
int height,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline void Add( wxWindow *window, const wxSizerFlags& flags );
inline void Add( wxSizer *sizer, const wxSizerFlags& flags );
inline void Add( wxSizerItem *item );
inline wxSizerItem* Add( wxWindow *window,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline wxSizerItem* Add( wxSizer *sizer,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline wxSizerItem* Add( int width,
int height,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline wxSizerItem* Add( wxWindow *window, const wxSizerFlags& flags );
inline wxSizerItem* Add( wxSizer *sizer, const wxSizerFlags& flags );
inline wxSizerItem* Add( wxSizerItem *item );
inline void AddSpacer(int size);
inline void AddStretchSpacer(int prop = 1);
inline wxSizerItem* AddSpacer(int size);
inline wxSizerItem* AddStretchSpacer(int prop = 1);
inline void Insert( size_t index,
wxWindow *window,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline void Insert( size_t index,
wxSizer *sizer,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline void Insert( size_t index,
int width,
int height,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline void Insert( size_t index,
wxWindow *window,
const wxSizerFlags& flags );
inline void Insert( size_t index,
wxSizer *sizer,
const wxSizerFlags& flags );
virtual void Insert( size_t index, wxSizerItem *item );
inline wxSizerItem* Insert( size_t index,
wxWindow *window,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline wxSizerItem* Insert( size_t index,
wxSizer *sizer,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline wxSizerItem* Insert( size_t index,
int width,
int height,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline wxSizerItem* Insert( size_t index,
wxWindow *window,
const wxSizerFlags& flags );
inline wxSizerItem* Insert( size_t index,
wxSizer *sizer,
const wxSizerFlags& flags );
virtual wxSizerItem* Insert( size_t index, wxSizerItem *item );
inline void InsertSpacer(size_t index, int size);
inline void InsertStretchSpacer(size_t index, int prop = 1);
inline wxSizerItem* InsertSpacer(size_t index, int size);
inline wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1);
inline void Prepend( wxWindow *window,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline void Prepend( wxSizer *sizer,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline void Prepend( int width,
int height,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline void Prepend( wxWindow *window, const wxSizerFlags& flags );
inline void Prepend( wxSizer *sizer, const wxSizerFlags& flags );
inline void Prepend( wxSizerItem *item );
inline wxSizerItem* Prepend( wxWindow *window,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline wxSizerItem* Prepend( wxSizer *sizer,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline wxSizerItem* Prepend( int width,
int height,
int proportion = 0,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
inline wxSizerItem* Prepend( wxWindow *window, const wxSizerFlags& flags );
inline wxSizerItem* Prepend( wxSizer *sizer, const wxSizerFlags& flags );
inline wxSizerItem* Prepend( wxSizerItem *item );
inline void PrependSpacer(int size);
inline void PrependStretchSpacer(int prop = 1);
inline wxSizerItem* PrependSpacer(int size);
inline wxSizerItem* PrependStretchSpacer(int prop = 1);
// Deprecated in 2.6 since historically it does not delete the window,
@ -704,103 +707,103 @@ private:
// inline functions implementation
// ----------------------------------------------------------------------------
inline void
inline wxSizerItem*
wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
{
Add( new wxSizerItem( window, proportion, flag, border, userData ) );
return Add( new wxSizerItem( window, proportion, flag, border, userData ) );
}
inline void
inline wxSizerItem*
wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData )
{
Add( new wxSizerItem( sizer, proportion, flag, border, userData ) );
return Add( new wxSizerItem( sizer, proportion, flag, border, userData ) );
}
inline void
inline wxSizerItem*
wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData )
{
Add( new wxSizerItem( width, height, proportion, flag, border, userData ) );
return Add( new wxSizerItem( width, height, proportion, flag, border, userData ) );
}
inline void
inline wxSizerItem*
wxSizer::Add( wxWindow *window, const wxSizerFlags& flags )
{
Add( new wxSizerItem(window, flags) );
return Add( new wxSizerItem(window, flags) );
}
inline void
inline wxSizerItem*
wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags )
{
Add( new wxSizerItem(sizer, flags) );
return Add( new wxSizerItem(sizer, flags) );
}
inline void
inline wxSizerItem*
wxSizer::Add( wxSizerItem *item )
{
Insert( m_children.GetCount(), item );
return Insert( m_children.GetCount(), item );
}
inline void
inline wxSizerItem*
wxSizer::AddSpacer(int size)
{
Add(size, size);
return Add(size, size);
}
inline void
inline wxSizerItem*
wxSizer::AddStretchSpacer(int prop)
{
Add(0, 0, prop);
return Add(0, 0, prop);
}
inline void
inline wxSizerItem*
wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
{
Prepend( new wxSizerItem( window, proportion, flag, border, userData ) );
return Prepend( new wxSizerItem( window, proportion, flag, border, userData ) );
}
inline void
inline wxSizerItem*
wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData )
{
Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) );
return Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) );
}
inline void
inline wxSizerItem*
wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData )
{
Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) );
return Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) );
}
inline void
inline wxSizerItem*
wxSizer::Prepend( wxSizerItem *item )
{
Insert( 0, item );
return Insert( 0, item );
}
inline void
inline wxSizerItem*
wxSizer::PrependSpacer(int size)
{
Prepend(size, size);
return Prepend(size, size);
}
inline void
inline wxSizerItem*
wxSizer::PrependStretchSpacer(int prop)
{
Prepend(0, 0, prop);
return Prepend(0, 0, prop);
}
inline void
inline wxSizerItem*
wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags )
{
Prepend( new wxSizerItem(window, flags) );
return Prepend( new wxSizerItem(window, flags) );
}
inline void
inline wxSizerItem*
wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags )
{
Prepend( new wxSizerItem(sizer, flags) );
return Prepend( new wxSizerItem(sizer, flags) );
}
inline void
inline wxSizerItem*
wxSizer::Insert( size_t index,
wxWindow *window,
int proportion,
@ -808,10 +811,10 @@ wxSizer::Insert( size_t index,
int border,
wxObject* userData )
{
Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) );
return Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) );
}
inline void
inline wxSizerItem*
wxSizer::Insert( size_t index,
wxSizer *sizer,
int proportion,
@ -819,10 +822,10 @@ wxSizer::Insert( size_t index,
int border,
wxObject* userData )
{
Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) );
return Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) );
}
inline void
inline wxSizerItem*
wxSizer::Insert( size_t index,
int width,
int height,
@ -831,31 +834,31 @@ wxSizer::Insert( size_t index,
int border,
wxObject* userData )
{
Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) );
return Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) );
}
inline void
inline wxSizerItem*
wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags )
{
Insert( index, new wxSizerItem(window, flags) );
return Insert( index, new wxSizerItem(window, flags) );
}
inline void
inline wxSizerItem*
wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags )
{
Insert( index, new wxSizerItem(sizer, flags) );
return Insert( index, new wxSizerItem(sizer, flags) );
}
inline void
inline wxSizerItem*
wxSizer::InsertSpacer(size_t index, int size)
{
Insert(index, size, size);
return Insert(index, size, size);
}
inline void
inline wxSizerItem*
wxSizer::InsertStretchSpacer(size_t index, int prop)
{
Insert(index, 0, 0, prop);
return Insert(index, 0, 0, prop);
}

View File

@ -182,58 +182,58 @@ wxGridBagSizer::wxGridBagSizer(int vgap, int hgap )
}
bool wxGridBagSizer::Add( wxWindow *window,
const wxGBPosition& pos, const wxGBSpan& span,
int flag, int border, wxObject* userData )
wxSizerItem* wxGridBagSizer::Add( wxWindow *window,
const wxGBPosition& pos, const wxGBSpan& span,
int flag, int border, wxObject* userData )
{
wxGBSizerItem* item = new wxGBSizerItem(window, pos, span, flag, border, userData);
if ( Add(item) )
return true;
return item;
else
{
delete item;
return false;
return (wxSizerItem*)NULL;
}
}
bool wxGridBagSizer::Add( wxSizer *sizer,
wxSizerItem* wxGridBagSizer::Add( wxSizer *sizer,
const wxGBPosition& pos, const wxGBSpan& span,
int flag, int border, wxObject* userData )
{
wxGBSizerItem* item = new wxGBSizerItem(sizer, pos, span, flag, border, userData);
if ( Add(item) )
return true;
return item;
else
{
delete item;
return false;
return (wxSizerItem*)NULL;
}
}
bool wxGridBagSizer::Add( int width, int height,
wxSizerItem* wxGridBagSizer::Add( int width, int height,
const wxGBPosition& pos, const wxGBSpan& span,
int flag, int border, wxObject* userData )
{
wxGBSizerItem* item = new wxGBSizerItem(width, height, pos, span, flag, border, userData);
if ( Add(item) )
return true;
return item;
else
{
delete item;
return false;
return (wxSizerItem*)NULL;
}
}
bool wxGridBagSizer::Add( wxGBSizerItem *item )
wxSizerItem* wxGridBagSizer::Add( wxGBSizerItem *item )
{
wxCHECK_MSG( !CheckForIntersection(item), false,
wxCHECK_MSG( !CheckForIntersection(item), NULL,
wxT("An item is already at that position") );
m_children.Append(item);
item->SetGBSizer(this);
if ( item->GetWindow() )
item->GetWindow()->SetContainingSizer( this );
return true;
return item;
}
@ -613,19 +613,19 @@ wxGBPosition wxGridBagSizer::FindEmptyCell()
// we'll try to make them automatically select a location for the item
// anyway.
void wxGridBagSizer::Add( wxWindow *window, int, int flag, int border, wxObject* userData )
wxSizerItem* wxGridBagSizer::Add( wxWindow *window, int, int flag, int border, wxObject* userData )
{
Add(window, FindEmptyCell(), wxDefaultSpan, flag, border, userData);
return Add(window, FindEmptyCell(), wxDefaultSpan, flag, border, userData);
}
void wxGridBagSizer::Add( wxSizer *sizer, int, int flag, int border, wxObject* userData )
wxSizerItem* wxGridBagSizer::Add( wxSizer *sizer, int, int flag, int border, wxObject* userData )
{
Add(sizer, FindEmptyCell(), wxDefaultSpan, flag, border, userData);
return Add(sizer, FindEmptyCell(), wxDefaultSpan, flag, border, userData);
}
void wxGridBagSizer::Add( int width, int height, int, int flag, int border, wxObject* userData )
wxSizerItem* wxGridBagSizer::Add( int width, int height, int, int flag, int border, wxObject* userData )
{
Add(width, height, FindEmptyCell(), wxDefaultSpan, flag, border, userData);
return Add(width, height, FindEmptyCell(), wxDefaultSpan, flag, border, userData);
}
@ -634,33 +634,60 @@ void wxGridBagSizer::Add( int width, int height, int, int flag, int border, wxOb
// this class and should not be used. Their implementation in this class
// simply fails.
void wxGridBagSizer::Add( wxSizerItem * )
{ wxFAIL_MSG(wxT("Invalid Add form called.")); }
wxSizerItem* wxGridBagSizer::Add( wxSizerItem * )
{
wxFAIL_MSG(wxT("Invalid Add form called."));
return (wxSizerItem*)NULL;
}
void wxGridBagSizer::Prepend( wxWindow *, int, int, int, wxObject* )
{ wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer.")); }
wxSizerItem* wxGridBagSizer::Prepend( wxWindow *, int, int, int, wxObject* )
{
wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer."));
return (wxSizerItem*)NULL;
}
void wxGridBagSizer::Prepend( wxSizer *, int, int, int, wxObject* )
{ wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer.")); }
wxSizerItem* wxGridBagSizer::Prepend( wxSizer *, int, int, int, wxObject* )
{
wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer."));
return (wxSizerItem*)NULL;
}
void wxGridBagSizer::Prepend( int, int, int, int, int, wxObject* )
{ wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer.")); }
wxSizerItem* wxGridBagSizer::Prepend( int, int, int, int, int, wxObject* )
{
wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer."));
return (wxSizerItem*)NULL;
}
void wxGridBagSizer::Prepend( wxSizerItem * )
{ wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer.")); }
wxSizerItem* wxGridBagSizer::Prepend( wxSizerItem * )
{
wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer."));
return (wxSizerItem*)NULL;
}
void wxGridBagSizer::Insert( size_t, wxWindow *, int, int, int, wxObject* )
{ wxFAIL_MSG(wxT("Insert should not be used with wxGridBagSizer.")); }
wxSizerItem* wxGridBagSizer::Insert( size_t, wxWindow *, int, int, int, wxObject* )
{
wxFAIL_MSG(wxT("Insert should not be used with wxGridBagSizer."));
return (wxSizerItem*)NULL;
}
void wxGridBagSizer::Insert( size_t, wxSizer *, int, int, int, wxObject* )
{ wxFAIL_MSG(wxT("Insert should not be used with wxGridBagSizer.")); }
wxSizerItem* wxGridBagSizer::Insert( size_t, wxSizer *, int, int, int, wxObject* )
{
wxFAIL_MSG(wxT("Insert should not be used with wxGridBagSizer."));
return (wxSizerItem*)NULL;
}
void wxGridBagSizer::Insert( size_t, int, int, int, int, int, wxObject* )
{ wxFAIL_MSG(wxT("Insert should not be used with wxGridBagSizer.")); }
wxSizerItem* wxGridBagSizer::Insert( size_t, int, int, int, int, int, wxObject* )
{
wxFAIL_MSG(wxT("Insert should not be used with wxGridBagSizer."));
return (wxSizerItem*)NULL;
}
void wxGridBagSizer::Insert( size_t, wxSizerItem * )
{ wxFAIL_MSG(wxT("Insert should not be used with wxGridBagSizer.")); }
wxSizerItem* wxGridBagSizer::Insert( size_t, wxSizerItem * )
{
wxFAIL_MSG(wxT("Insert should not be used with wxGridBagSizer."));
return (wxSizerItem*)NULL;
}
//---------------------------------------------------------------------------

View File

@ -89,6 +89,7 @@ void wxSizerItem::Init()
m_sizer = NULL;
m_show = true;
m_userData = NULL;
m_zoneRect = wxRect( 0, 0, 0, 0 );
}
void wxSizerItem::Init(const wxSizerFlags& flags)
@ -108,6 +109,7 @@ wxSizerItem::wxSizerItem( int width, int height, int proportion, int flag, int b
, m_proportion( proportion )
, m_border( border )
, m_flag( flag )
, m_zoneRect( 0, 0, 0, 0 )
, m_show( true )
, m_userData( userData )
{
@ -120,6 +122,7 @@ wxSizerItem::wxSizerItem( wxWindow *window, int proportion, int flag, int border
, m_proportion( proportion )
, m_border( border )
, m_flag( flag )
, m_zoneRect( 0, 0, 0, 0 )
, m_show( true )
, m_userData( userData )
{
@ -139,6 +142,7 @@ wxSizerItem::wxSizerItem( wxSizer *sizer, int proportion, int flag, int border,
, m_proportion( proportion )
, m_border( border )
, m_flag( flag )
, m_zoneRect( 0, 0, 0, 0 )
, m_show( true )
, m_ratio( 0.0 )
, m_userData( userData )
@ -287,6 +291,7 @@ void wxSizerItem::SetDimension( wxPoint pos, wxSize size )
if (IsSizer())
m_sizer->SetDimension( pos.x, pos.y, size.x, size.y );
m_zoneRect = wxRect(pos, size);
if (IsWindow())
m_window->SetSize( pos.x, pos.y, size.x, size.y, wxSIZE_ALLOW_MINUS_ONE );
@ -357,12 +362,14 @@ wxSizer::~wxSizer()
WX_CLEAR_LIST(wxSizerItemList, m_children);
}
void wxSizer::Insert( size_t index, wxSizerItem *item )
wxSizerItem* wxSizer::Insert( size_t index, wxSizerItem *item )
{
m_children.Insert( index, item );
if( item->GetWindow() )
item->GetWindow()->SetContainingSizer( this );
return item;
}
bool wxSizer::Remove( wxWindow *window )
@ -1582,7 +1589,7 @@ static void GetStaticBoxBorders( wxStaticBox *box,
#else
#ifdef __WXGTK__
if ( box->GetLabel().IsEmpty() )
if ( box->GetLabel().empty() )
*borderTop = 5;
else
#endif // __WXGTK__