Improved const correctness.
Clear wxWindow containing sizer on Remove( index ). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18714 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -68,11 +68,11 @@ public:
|
|||||||
void DetachSizer()
|
void DetachSizer()
|
||||||
{ m_sizer = 0; }
|
{ m_sizer = 0; }
|
||||||
|
|
||||||
virtual wxSize GetSize();
|
virtual wxSize GetSize() const;
|
||||||
virtual wxSize CalcMin();
|
virtual wxSize CalcMin();
|
||||||
virtual void SetDimension( wxPoint pos, wxSize size );
|
virtual void SetDimension( wxPoint pos, wxSize size );
|
||||||
|
|
||||||
wxSize GetMinSize()
|
wxSize GetMinSize() const
|
||||||
{ return m_minSize; }
|
{ return m_minSize; }
|
||||||
void SetInitSize( int x, int y )
|
void SetInitSize( int x, int y )
|
||||||
{ m_minSize.x = x; m_minSize.y = y; }
|
{ m_minSize.x = x; m_minSize.y = y; }
|
||||||
@@ -88,9 +88,9 @@ public:
|
|||||||
float GetRatio() const
|
float GetRatio() const
|
||||||
{ return m_ratio; }
|
{ return m_ratio; }
|
||||||
|
|
||||||
bool IsWindow();
|
bool IsWindow() const;
|
||||||
bool IsSizer();
|
bool IsSizer() const;
|
||||||
bool IsSpacer();
|
bool IsSpacer() const;
|
||||||
|
|
||||||
// Deprecated in 2.6, use {G,S}etProportion instead.
|
// Deprecated in 2.6, use {G,S}etProportion instead.
|
||||||
wxDEPRECATED( void SetOption( int option ) );
|
wxDEPRECATED( void SetOption( int option ) );
|
||||||
@@ -126,9 +126,9 @@ public:
|
|||||||
bool IsShown() const
|
bool IsShown() const
|
||||||
{ return m_show; }
|
{ return m_show; }
|
||||||
|
|
||||||
wxObject* GetUserData()
|
wxObject* GetUserData() const
|
||||||
{ return m_userData; }
|
{ return m_userData; }
|
||||||
wxPoint GetPosition()
|
wxPoint GetPosition() const
|
||||||
{ return m_pos; }
|
{ return m_pos; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -152,7 +152,8 @@ protected:
|
|||||||
|
|
||||||
wxObject *m_userData;
|
wxObject *m_userData;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxSizerItem);
|
private:
|
||||||
|
DECLARE_CLASS(wxSizerItem);
|
||||||
DECLARE_NO_COPY_CLASS(wxSizerItem)
|
DECLARE_NO_COPY_CLASS(wxSizerItem)
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -263,9 +264,9 @@ public:
|
|||||||
bool SetItemMinSize( size_t index, wxSize size )
|
bool SetItemMinSize( size_t index, wxSize size )
|
||||||
{ return DoSetItemMinSize( index, size.x, size.y ); }
|
{ return DoSetItemMinSize( index, size.x, size.y ); }
|
||||||
|
|
||||||
wxSize GetSize()
|
wxSize GetSize() const
|
||||||
{ return m_size; }
|
{ return m_size; }
|
||||||
wxPoint GetPosition()
|
wxPoint GetPosition() const
|
||||||
{ return m_position; }
|
{ return m_position; }
|
||||||
|
|
||||||
/* Calculate the minimal size or return m_minSize if bigger. */
|
/* Calculate the minimal size or return m_minSize if bigger. */
|
||||||
@@ -299,9 +300,9 @@ public:
|
|||||||
void Hide( size_t index )
|
void Hide( size_t index )
|
||||||
{ Show( index, false ); }
|
{ Show( index, false ); }
|
||||||
|
|
||||||
bool IsShown( wxWindow *window );
|
bool IsShown( wxWindow *window ) const;
|
||||||
bool IsShown( wxSizer *sizer );
|
bool IsShown( wxSizer *sizer ) const;
|
||||||
bool IsShown( size_t index );
|
bool IsShown( size_t index ) const;
|
||||||
|
|
||||||
// Recursively call wxWindow::Show () on all sizer items.
|
// Recursively call wxWindow::Show () on all sizer items.
|
||||||
void ShowItems (bool show);
|
void ShowItems (bool show);
|
||||||
@@ -312,9 +313,9 @@ protected:
|
|||||||
wxPoint m_position;
|
wxPoint m_position;
|
||||||
wxSizerItemList m_children;
|
wxSizerItemList m_children;
|
||||||
|
|
||||||
wxSize GetMaxWindowSize( wxWindow *window );
|
wxSize GetMaxWindowSize( wxWindow *window ) const;
|
||||||
wxSize GetMinWindowSize( wxWindow *window );
|
wxSize GetMinWindowSize( wxWindow *window );
|
||||||
wxSize GetMaxClientSize( wxWindow *window );
|
wxSize GetMaxClientSize( wxWindow *window ) const;
|
||||||
wxSize GetMinClientSize( wxWindow *window );
|
wxSize GetMinClientSize( wxWindow *window );
|
||||||
wxSize FitSize( wxWindow *window );
|
wxSize FitSize( wxWindow *window );
|
||||||
wxSize VirtualFitSize( wxWindow *window );
|
wxSize VirtualFitSize( wxWindow *window );
|
||||||
@@ -324,7 +325,8 @@ protected:
|
|||||||
virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height );
|
virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height );
|
||||||
virtual bool DoSetItemMinSize( size_t index, int width, int height );
|
virtual bool DoSetItemMinSize( size_t index, int width, int height );
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxSizer);
|
private:
|
||||||
|
DECLARE_CLASS(wxSizer);
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -344,10 +346,10 @@ public:
|
|||||||
void SetRows( int rows ) { m_rows = rows; }
|
void SetRows( int rows ) { m_rows = rows; }
|
||||||
void SetVGap( int gap ) { m_vgap = gap; }
|
void SetVGap( int gap ) { m_vgap = gap; }
|
||||||
void SetHGap( int gap ) { m_hgap = gap; }
|
void SetHGap( int gap ) { m_hgap = gap; }
|
||||||
int GetCols() { return m_cols; }
|
int GetCols() const { return m_cols; }
|
||||||
int GetRows() { return m_rows; }
|
int GetRows() const { return m_rows; }
|
||||||
int GetVGap() { return m_vgap; }
|
int GetVGap() const { return m_vgap; }
|
||||||
int GetHGap() { return m_hgap; }
|
int GetHGap() const { return m_hgap; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_rows;
|
int m_rows;
|
||||||
@@ -360,7 +362,8 @@ protected:
|
|||||||
|
|
||||||
void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h );
|
void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h );
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxGridSizer);
|
private:
|
||||||
|
DECLARE_CLASS(wxGridSizer);
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -390,7 +393,8 @@ protected:
|
|||||||
|
|
||||||
void CreateArrays();
|
void CreateArrays();
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxFlexGridSizer);
|
private:
|
||||||
|
DECLARE_CLASS(wxFlexGridSizer);
|
||||||
DECLARE_NO_COPY_CLASS(wxFlexGridSizer)
|
DECLARE_NO_COPY_CLASS(wxFlexGridSizer)
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -406,7 +410,7 @@ public:
|
|||||||
void RecalcSizes();
|
void RecalcSizes();
|
||||||
wxSize CalcMin();
|
wxSize CalcMin();
|
||||||
|
|
||||||
int GetOrientation()
|
int GetOrientation() const
|
||||||
{ return m_orient; }
|
{ return m_orient; }
|
||||||
|
|
||||||
void SetOrientation(int orient)
|
void SetOrientation(int orient)
|
||||||
@@ -420,7 +424,8 @@ protected:
|
|||||||
int m_fixedWidth;
|
int m_fixedWidth;
|
||||||
int m_fixedHeight;
|
int m_fixedHeight;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxBoxSizer);
|
private:
|
||||||
|
DECLARE_CLASS(wxBoxSizer);
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -439,13 +444,14 @@ public:
|
|||||||
void RecalcSizes();
|
void RecalcSizes();
|
||||||
wxSize CalcMin();
|
wxSize CalcMin();
|
||||||
|
|
||||||
wxStaticBox *GetStaticBox()
|
wxStaticBox *GetStaticBox() const
|
||||||
{ return m_staticBox; }
|
{ return m_staticBox; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxStaticBox *m_staticBox;
|
wxStaticBox *m_staticBox;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxStaticBoxSizer);
|
private:
|
||||||
|
DECLARE_CLASS(wxStaticBoxSizer);
|
||||||
DECLARE_NO_COPY_CLASS(wxStaticBoxSizer)
|
DECLARE_NO_COPY_CLASS(wxStaticBoxSizer)
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -467,13 +473,14 @@ public:
|
|||||||
void RecalcSizes();
|
void RecalcSizes();
|
||||||
wxSize CalcMin();
|
wxSize CalcMin();
|
||||||
|
|
||||||
wxNotebook *GetNotebook()
|
wxNotebook *GetNotebook() const
|
||||||
{ return m_notebook; }
|
{ return m_notebook; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxNotebook *m_notebook;
|
wxNotebook *m_notebook;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxNotebookSizer);
|
private:
|
||||||
|
DECLARE_CLASS(wxNotebookSizer);
|
||||||
DECLARE_NO_COPY_CLASS(wxNotebookSizer)
|
DECLARE_NO_COPY_CLASS(wxNotebookSizer)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -29,16 +29,16 @@
|
|||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxSizerItem, wxObject)
|
IMPLEMENT_CLASS(wxSizerItem, wxObject)
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxSizer, wxObject)
|
IMPLEMENT_CLASS(wxSizer, wxObject)
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxGridSizer, wxSizer)
|
IMPLEMENT_CLASS(wxGridSizer, wxSizer)
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxFlexGridSizer, wxGridSizer)
|
IMPLEMENT_CLASS(wxFlexGridSizer, wxGridSizer)
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxBoxSizer, wxSizer)
|
IMPLEMENT_CLASS(wxBoxSizer, wxSizer)
|
||||||
#if wxUSE_STATBOX
|
#if wxUSE_STATBOX
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxStaticBoxSizer, wxBoxSizer)
|
IMPLEMENT_CLASS(wxStaticBoxSizer, wxBoxSizer)
|
||||||
#endif
|
#endif
|
||||||
#if wxUSE_NOTEBOOK
|
#if wxUSE_NOTEBOOK
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxNotebookSizer, wxSizer)
|
IMPLEMENT_CLASS(wxNotebookSizer, wxSizer)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WX_DEFINE_EXPORTED_LIST( wxSizerItemList );
|
WX_DEFINE_EXPORTED_LIST( wxSizerItemList );
|
||||||
@@ -101,7 +101,7 @@ wxSizerItem::~wxSizerItem()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxSize wxSizerItem::GetSize()
|
wxSize wxSizerItem::GetSize() const
|
||||||
{
|
{
|
||||||
wxSize ret;
|
wxSize ret;
|
||||||
if (IsSizer())
|
if (IsSizer())
|
||||||
@@ -232,17 +232,17 @@ void wxSizerItem::DeleteWindows()
|
|||||||
m_sizer->DeleteWindows();
|
m_sizer->DeleteWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSizerItem::IsWindow()
|
bool wxSizerItem::IsWindow() const
|
||||||
{
|
{
|
||||||
return (m_window != NULL);
|
return (m_window != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSizerItem::IsSizer()
|
bool wxSizerItem::IsSizer() const
|
||||||
{
|
{
|
||||||
return (m_sizer != NULL);
|
return (m_sizer != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSizerItem::IsSpacer()
|
bool wxSizerItem::IsSpacer() const
|
||||||
{
|
{
|
||||||
return (m_window == NULL) && (m_sizer == NULL);
|
return (m_window == NULL) && (m_sizer == NULL);
|
||||||
}
|
}
|
||||||
@@ -409,6 +409,11 @@ bool wxSizer::Remove( size_t index )
|
|||||||
|
|
||||||
wxCHECK_MSG( node, false, _T("Failed to find child node") );
|
wxCHECK_MSG( node, false, _T("Failed to find child node") );
|
||||||
|
|
||||||
|
wxSizerItem *item = node->GetData();
|
||||||
|
|
||||||
|
if( item->IsWindow() )
|
||||||
|
item->GetWindow()->SetContainingSizer( NULL );
|
||||||
|
|
||||||
return m_children.DeleteNode( node );
|
return m_children.DeleteNode( node );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,7 +467,12 @@ bool wxSizer::Detach( size_t index )
|
|||||||
|
|
||||||
wxCHECK_MSG( node, false, _T("Failed to find child node") );
|
wxCHECK_MSG( node, false, _T("Failed to find child node") );
|
||||||
|
|
||||||
node->GetData()->DetachSizer();
|
wxSizerItem *item = node->GetData();
|
||||||
|
|
||||||
|
if( item->IsSizer() )
|
||||||
|
item->DetachSizer();
|
||||||
|
else if( item->IsWindow() )
|
||||||
|
item->GetWindow()->SetContainingSizer( NULL );
|
||||||
|
|
||||||
return m_children.DeleteNode( node );
|
return m_children.DeleteNode( node );
|
||||||
}
|
}
|
||||||
@@ -556,7 +566,7 @@ void wxSizer::SetVirtualSizeHints( wxWindow *window )
|
|||||||
window->GetMaxHeight() );
|
window->GetMaxHeight() );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxSizer::GetMaxWindowSize( wxWindow *window )
|
wxSize wxSizer::GetMaxWindowSize( wxWindow *window ) const
|
||||||
{
|
{
|
||||||
return window->GetMaxSize();
|
return window->GetMaxSize();
|
||||||
}
|
}
|
||||||
@@ -587,7 +597,7 @@ wxSize wxSizer::FitSize( wxWindow *window )
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxSizer::GetMaxClientSize( wxWindow *window )
|
wxSize wxSizer::GetMaxClientSize( wxWindow *window ) const
|
||||||
{
|
{
|
||||||
wxSize maxSize( window->GetMaxSize() );
|
wxSize maxSize( window->GetMaxSize() );
|
||||||
|
|
||||||
@@ -798,7 +808,7 @@ void wxSizer::ShowItems( bool show )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSizer::IsShown( wxWindow *window )
|
bool wxSizer::IsShown( wxWindow *window ) const
|
||||||
{
|
{
|
||||||
wxSizerItemList::Node *node = m_children.GetFirst();
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -817,7 +827,7 @@ bool wxSizer::IsShown( wxWindow *window )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSizer::IsShown( wxSizer *sizer )
|
bool wxSizer::IsShown( wxSizer *sizer ) const
|
||||||
{
|
{
|
||||||
wxSizerItemList::Node *node = m_children.GetFirst();
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -836,7 +846,7 @@ bool wxSizer::IsShown( wxSizer *sizer )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSizer::IsShown( size_t index )
|
bool wxSizer::IsShown( size_t index ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( index < m_children.GetCount(),
|
wxCHECK_MSG( index < m_children.GetCount(),
|
||||||
false,
|
false,
|
||||||
|
Reference in New Issue
Block a user