Fixed an accidental name clash, and added back a wxCHECK

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24463 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-11-07 20:52:35 +00:00
parent 6c1ad2a8e6
commit 3ff632ce66
2 changed files with 15 additions and 13 deletions

View File

@@ -148,14 +148,14 @@ public:
void GetEndPos(int& row, int& col); void GetEndPos(int& row, int& col);
wxGridBagSizer* GetSizer() const { return m_sizer; } wxGridBagSizer* GetGBSizer() const { return m_gbsizer; }
void SetSizer(wxGridBagSizer* sizer) { m_sizer = sizer; } void SetGBSizer(wxGridBagSizer* sizer) { m_gbsizer = sizer; }
protected: protected:
wxGBPosition m_pos; wxGBPosition m_pos;
wxGBSpan m_span; wxGBSpan m_span;
wxGridBagSizer* m_sizer; wxGridBagSizer* m_gbsizer; // so SetPos/SetSpan can check for intersects
private: private:

View File

@@ -46,7 +46,7 @@ wxGBSizerItem::wxGBSizerItem( int width,
: wxSizerItem(width, height, 0, flag, border, userData), : wxSizerItem(width, height, 0, flag, border, userData),
m_pos(pos), m_pos(pos),
m_span(span), m_span(span),
m_sizer(NULL) m_gbsizer(NULL)
{ {
} }
@@ -60,7 +60,7 @@ wxGBSizerItem::wxGBSizerItem( wxWindow *window,
: wxSizerItem(window, 0, flag, border, userData), : wxSizerItem(window, 0, flag, border, userData),
m_pos(pos), m_pos(pos),
m_span(span), m_span(span),
m_sizer(NULL) m_gbsizer(NULL)
{ {
} }
@@ -74,7 +74,7 @@ wxGBSizerItem::wxGBSizerItem( wxSizer *sizer,
: wxSizerItem(sizer, 0, flag, border, userData), : wxSizerItem(sizer, 0, flag, border, userData),
m_pos(pos), m_pos(pos),
m_span(span), m_span(span),
m_sizer(NULL) m_gbsizer(NULL)
{ {
} }
@@ -82,7 +82,7 @@ wxGBSizerItem::wxGBSizerItem()
: wxSizerItem(), : wxSizerItem(),
m_pos(-1,-1), m_pos(-1,-1),
m_span(-1,-1), m_span(-1,-1),
m_sizer(NULL) m_gbsizer(NULL)
{ {
} }
@@ -104,9 +104,9 @@ void wxGBSizerItem::GetSpan(int& rowspan, int& colspan) const
bool wxGBSizerItem::SetPos( const wxGBPosition& pos ) bool wxGBSizerItem::SetPos( const wxGBPosition& pos )
{ {
if (m_sizer) if (m_gbsizer)
{ {
wxCHECK_MSG( !m_sizer->CheckForIntersection(pos, m_span, this), false, wxCHECK_MSG( !m_gbsizer->CheckForIntersection(pos, m_span, this), false,
wxT("An item is already at that position") ); wxT("An item is already at that position") );
} }
m_pos = pos; m_pos = pos;
@@ -115,9 +115,9 @@ bool wxGBSizerItem::SetPos( const wxGBPosition& pos )
bool wxGBSizerItem::SetSpan( const wxGBSpan& span ) bool wxGBSizerItem::SetSpan( const wxGBSpan& span )
{ {
if (m_sizer) if (m_gbsizer)
{ {
wxCHECK_MSG( !m_sizer->CheckForIntersection(m_pos, span, this), false, wxCHECK_MSG( !m_gbsizer->CheckForIntersection(m_pos, span, this), false,
wxT("An item is already at that position") ); wxT("An item is already at that position") );
} }
m_span = span; m_span = span;
@@ -226,8 +226,10 @@ bool wxGridBagSizer::Add( int width, int height,
bool wxGridBagSizer::Add( wxGBSizerItem *item ) bool wxGridBagSizer::Add( wxGBSizerItem *item )
{ {
m_children.Append(item); wxCHECK_MSG( !CheckForIntersection(item), false,
item->SetSizer(this); wxT("An item is already at that position") );
m_children.Append(item);
item->SetGBSizer(this);
if ( item->GetWindow() ) if ( item->GetWindow() )
item->GetWindow()->SetContainingSizer( this ); item->GetWindow()->SetContainingSizer( this );