Deprecated wxSizer::Remove( wxWindow* ), s/Remove/Detach/ in most places.
Made wxSizer child list typesafe. I've not added the wxList implicit conversion kludge yet, let's see who complains first perhaps.. Deprecated wxSizer::{G,S}etOption in favour of {G,S}etProportion in line with the parameter name change in the docs. Added {G,S}etSpacer consistent with the accessors for windows/sizers. Made all wxSizer index parameters size_t -- we support no sensible interpretation for negative indexes in them. Hopefully this will cause no real problems, but code doing (eg. Remove( 0 )) will need to change to use 0u to resolve the ambiguity with overloaded members. This is probably a Good Thing though, ymmv. s/FALSE/false/g ; s/TRUE/true/g ; s/wxASSERT/wxASSERT_MSG/g in sizer.{cpp,h} Fixed (I hope) the brokenness in wxSizer::Show -- I have no code to test this yet, so it's a blind change, but spacers should now be hidden correctly instead of ignored, and it should be properly reversable over multiple calls now too. removed pointless private scoping around DECLARE_CLASS macros. Replace 0's I added previously with NULL -- not like that will end the email thread either.. Added Add( wxSizerItem * ) & co. There are probably a couple of other places we can usefully do something like this too. Stopped short of refactoring everything to raise some issues about sizer method recursion on -dev. Updated wxSizer docs some more, they are still incomplete but getting better. wrapped KeyCode in wxDEPRECATED, converted all (gtk build) instances to GetKeyCode. There may be a few left for other ports. Fixed a couple of other random compile warnings along the way. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18616 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
db50ec5a50
commit
12a3f2275c
@ -380,7 +380,7 @@ void MMBoardFrame::CloseVideoWindow()
|
|||||||
if (!m_video_window)
|
if (!m_video_window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_sizer->Remove(m_video_window);
|
m_sizer->Detach( m_video_window );
|
||||||
delete m_video_window;
|
delete m_video_window;
|
||||||
m_video_window = NULL;
|
m_video_window = NULL;
|
||||||
|
|
||||||
|
@ -172,8 +172,8 @@ void cbGCUpdatesMgr::UpdateNow()
|
|||||||
// number of bars, that were changed in the current row
|
// number of bars, that were changed in the current row
|
||||||
int nBars = 0;
|
int nBars = 0;
|
||||||
|
|
||||||
wxRect r1 = pRow->mUMgrData.mPrevBounds;
|
//wxRect r1 = pRow->mUMgrData.mPrevBounds;
|
||||||
wxRect r2 = pRow->mBoundsInParent;
|
//wxRect r2 = pRow->mBoundsInParent;
|
||||||
|
|
||||||
if ( WasChanged( pRow->mUMgrData, pRow->mBoundsInParent ) )
|
if ( WasChanged( pRow->mUMgrData, pRow->mBoundsInParent ) )
|
||||||
|
|
||||||
|
@ -296,11 +296,10 @@ void wxMultiCellSizer::RecalcSizes()
|
|||||||
wxPoint c_point;
|
wxPoint c_point;
|
||||||
wxSize c_size;
|
wxSize c_size;
|
||||||
|
|
||||||
wxNode *current;
|
wxSizerItemList::Node *current = m_children.GetFirst();
|
||||||
current = m_children.GetFirst();
|
|
||||||
while (current != NULL)
|
while (current != NULL)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*) current->Data();
|
wxSizerItem *item = current->GetData();
|
||||||
|
|
||||||
wxMultiCellItemHandle *rect;
|
wxMultiCellItemHandle *rect;
|
||||||
if (item != NULL &&
|
if (item != NULL &&
|
||||||
@ -372,7 +371,7 @@ void wxMultiCellSizer::RecalcSizes()
|
|||||||
}
|
}
|
||||||
item->SetDimension(c_point, c_size);
|
item->SetDimension(c_point, c_size);
|
||||||
}
|
}
|
||||||
current = current->Next();
|
current = current->GetNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@ -404,10 +403,10 @@ void wxMultiCellSizer :: GetMinimums()
|
|||||||
m_weights[x]->SetWidth(0);
|
m_weights[x]->SetWidth(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxNode *node = m_children.GetFirst();
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*) node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
wxMultiCellItemHandle *rect;
|
wxMultiCellItemHandle *rect;
|
||||||
if (item != NULL &&
|
if (item != NULL &&
|
||||||
(rect = (wxMultiCellItemHandle *)item->GetUserData()) != NULL)
|
(rect = (wxMultiCellItemHandle *)item->GetUserData()) != NULL)
|
||||||
@ -506,7 +505,7 @@ void wxMultiCellSizer :: GetMinimums()
|
|||||||
m_maxWidth[col] = wxMax(m_maxWidth[col], m_defaultCellSize.GetWidth());
|
m_maxWidth[col] = wxMax(m_maxWidth[col], m_defaultCellSize.GetWidth());
|
||||||
m_weights[col]->SetWidth(wxMax(m_weights[col]->GetWidth(), rect->GetWeight().GetWidth()));
|
m_weights[col]->SetWidth(wxMax(m_weights[col]->GetWidth(), rect->GetWeight().GetWidth()));
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // wxMultiCellSizer :: GetMinimums
|
} // wxMultiCellSizer :: GetMinimums
|
||||||
|
@ -128,19 +128,14 @@ Here, the sizer will do the actual calculation of its children minimal sizes.
|
|||||||
|
|
||||||
\func{bool}{Detach}{\param{wxSizer* }{sizer}}
|
\func{bool}{Detach}{\param{wxSizer* }{sizer}}
|
||||||
|
|
||||||
\func{bool}{Detach}{\param{int }{nth}}
|
\func{bool}{Detach}{\param{size\_t }{index}}
|
||||||
|
|
||||||
Detach a child from the sizer without destroying it. {\it window} is the window to be
|
Detach a child from the sizer without destroying it. {\it window} is the window to be
|
||||||
detached, {\it sizer} is the equivalent sizer and {\it nth} is the position of
|
detached, {\it sizer} is the equivalent sizer and {\it index} is the position of
|
||||||
the child in the sizer, typically 0 for the first item. This method does not
|
the child in the sizer, typically 0 for the first item. This method does not
|
||||||
cause any layout or resizing to take place, call \helpref{wxSizer::Layout}{wxsizerlayout}
|
cause any layout or resizing to take place, call \helpref{wxSizer::Layout}{wxsizerlayout}
|
||||||
to update the layout "on screen" after detaching a child from the sizer.
|
to update the layout "on screen" after detaching a child from the sizer.
|
||||||
|
|
||||||
{\bf NB:} Detaching a wxWindow from a wxSizer is equivalent to Removing it. There is
|
|
||||||
currently no wxSizer method that will detach and destroy a window automatically.
|
|
||||||
You must either act to destroy it yourself, or allow its parent to destroy it in the
|
|
||||||
normal course of events.
|
|
||||||
|
|
||||||
Returns TRUE if the child item was found and detached, FALSE otherwise.
|
Returns TRUE if the child item was found and detached, FALSE otherwise.
|
||||||
|
|
||||||
\wxheading{See also}
|
\wxheading{See also}
|
||||||
@ -191,15 +186,15 @@ size of all the children and their borders or the minimal size set by
|
|||||||
|
|
||||||
\membersection{wxSizer::Insert}\label{wxsizerinsert}
|
\membersection{wxSizer::Insert}\label{wxsizerinsert}
|
||||||
|
|
||||||
\func{void}{Insert}{\param{int }{before}, \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{wxWindow* }{window}, \param{int }{proportion = 0},\param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
|
||||||
|
|
||||||
\func{void}{Insert}{\param{int }{before}, \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{wxSizer* }{sizer}, \param{int }{proportion = 0}, \param{int }{flag = 0}, \param{int }{border = 0}, \param{wxObject* }{userData = NULL}}
|
||||||
|
|
||||||
\func{void}{Insert}{\param{int }{before}, \param{int }{width}, \param{int }{height}, \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}}
|
||||||
|
|
||||||
Insert a child into the sizer.
|
Insert a child into the sizer before any existing item at {\it index}.
|
||||||
|
|
||||||
\docparam{before}{The position this child should assume in the sizer.}
|
\docparam{index}{The position this child should assume in the sizer.}
|
||||||
|
|
||||||
See \helpref{wxSizer::Add}{wxsizeradd} for the meaning of the other parameters.
|
See \helpref{wxSizer::Add}{wxsizeradd} for the meaning of the other parameters.
|
||||||
|
|
||||||
@ -236,16 +231,18 @@ and sizes.
|
|||||||
|
|
||||||
\func{bool}{Remove}{\param{wxSizer* }{sizer}}
|
\func{bool}{Remove}{\param{wxSizer* }{sizer}}
|
||||||
|
|
||||||
\func{bool}{Remove}{\param{int }{nth}}
|
\func{bool}{Remove}{\param{size\_t }{index}}
|
||||||
|
|
||||||
Removes a child from the sizer. {\it window} is the window to be removed, {\it sizer} is the
|
Removes a child from the sizer and destroys it. {\it sizer} is the wxSizer to be removed,
|
||||||
equivalent sizer and {\it nth} is the position of the child in the sizer, typically 0 for
|
{\it index} is the position of the child in the sizer, typically 0 for the first item.
|
||||||
the first item. This method does not cause any layout or resizing to take place, call
|
This method does not cause any layout or resizing to take place, call
|
||||||
\helpref{wxSizer::Layout}{wxsizerlayout} to update the layout "on screen" after removing a
|
\helpref{wxSizer::Layout}{wxsizerlayout} to update the layout "on screen" after removing a
|
||||||
child from the sizer.
|
child from the sizer.
|
||||||
|
|
||||||
{\bf NB:} wxWindows are not deleted by Remove, but wxSizers are. To remove a sizer without
|
{\bf NB:} The method taking a wxWindow* parameter is deprecated. For historical reasons
|
||||||
deleting it, use \helpref{wxSizer::Detach}{wxsizerdetach} instead.
|
it does not destroy the window as would usually be expected from Remove. You should use
|
||||||
|
\helpref{wxSizer::Detach}{wxsizerdetach} in new code instead. There is currently no wxSizer
|
||||||
|
method that will both detach and destroy a wxWindow item.
|
||||||
|
|
||||||
Returns TRUE if the child item was found and removed, FALSE otherwise.
|
Returns TRUE if the child item was found and removed, FALSE otherwise.
|
||||||
|
|
||||||
@ -275,7 +272,7 @@ bigger.
|
|||||||
|
|
||||||
\func{void}{SetItemMinSize}{\param{wxSizer* }{sizer}, \param{int}{ width}, \param{int}{ height}}
|
\func{void}{SetItemMinSize}{\param{wxSizer* }{sizer}, \param{int}{ width}, \param{int}{ height}}
|
||||||
|
|
||||||
\func{void}{SetItemMinSize}{\param{int}{ pos}, \param{int}{ width}, \param{int}{ height}}
|
\func{void}{SetItemMinSize}{\param{size\_t }{index}, \param{int}{ width}, \param{int}{ height}}
|
||||||
|
|
||||||
Set an item's minimum size by window, sizer, or position. The item will be found recursively
|
Set an item's minimum size by window, sizer, or position. The item will be found recursively
|
||||||
in the sizer's descendants. This function enables an application to set the size of an item
|
in the sizer's descendants. This function enables an application to set the size of an item
|
||||||
@ -307,6 +304,8 @@ minimal size. For windows with managed scrollbars this will set them appropriate
|
|||||||
|
|
||||||
\func{void}{Show}{\param{wxSizer* }{sizer}, \param{bool }{show = TRUE}}
|
\func{void}{Show}{\param{wxSizer* }{sizer}, \param{bool }{show = TRUE}}
|
||||||
|
|
||||||
Shows or hides a window or sizer. To make a sizer item disappear or
|
\func{void}{Show}{\param{size\_t }{index}, \param{bool }{show = TRUE}}
|
||||||
reappear, use Show() followed by Layout().
|
|
||||||
|
Shows or hides the {\it window}, {\it sizer}, or item at {\it index}.
|
||||||
|
To make a sizer item disappear or reappear, use Show() followed by Layout().
|
||||||
|
|
||||||
|
@ -863,8 +863,8 @@ public:
|
|||||||
// Get Y position
|
// Get Y position
|
||||||
wxCoord GetY() const { return m_y; }
|
wxCoord GetY() const { return m_y; }
|
||||||
|
|
||||||
// deprecated
|
// deprecated, Use GetKeyCode instead.
|
||||||
long KeyCode() const { return m_keyCode; }
|
wxDEPRECATED( long KeyCode() const );
|
||||||
|
|
||||||
virtual wxEvent *Clone() const { return new wxKeyEvent(*this); }
|
virtual wxEvent *Clone() const { return new wxKeyEvent(*this); }
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
// Created:
|
// Created:
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Robin Dunn, Dirk Holtwick and Robert Roebling
|
// Copyright: (c) Robin Dunn, Dirk Holtwick and Robert Roebling
|
||||||
|
// (c) 2003, Ron Lee
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -38,13 +39,26 @@ class WXDLLEXPORT wxSizerItem: public wxObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// spacer
|
// spacer
|
||||||
wxSizerItem( int width, int height, int option, int flag, int border, wxObject* userData);
|
wxSizerItem( int width,
|
||||||
|
int height,
|
||||||
|
int proportion,
|
||||||
|
int flag,
|
||||||
|
int border,
|
||||||
|
wxObject* userData);
|
||||||
|
|
||||||
// window
|
// window
|
||||||
wxSizerItem( wxWindow *window, int option, int flag, int border, wxObject* userData );
|
wxSizerItem( wxWindow *window,
|
||||||
|
int proportion,
|
||||||
|
int flag,
|
||||||
|
int border,
|
||||||
|
wxObject* userData );
|
||||||
|
|
||||||
// subsizer
|
// subsizer
|
||||||
wxSizerItem( wxSizer *sizer, int option, int flag, int border, wxObject* userData );
|
wxSizerItem( wxSizer *sizer,
|
||||||
|
int proportion,
|
||||||
|
int flag,
|
||||||
|
int border,
|
||||||
|
wxObject* userData );
|
||||||
|
|
||||||
~wxSizerItem();
|
~wxSizerItem();
|
||||||
|
|
||||||
@ -60,6 +74,8 @@ public:
|
|||||||
|
|
||||||
wxSize GetMinSize()
|
wxSize GetMinSize()
|
||||||
{ return m_minSize; }
|
{ return m_minSize; }
|
||||||
|
void SetInitSize( int x, int y )
|
||||||
|
{ m_minSize.x = x; m_minSize.y = y; }
|
||||||
|
|
||||||
void SetRatio( int width, int height )
|
void SetRatio( int width, int height )
|
||||||
// if either of dimensions is zero, ratio is assumed to be 1
|
// if either of dimensions is zero, ratio is assumed to be 1
|
||||||
@ -76,16 +92,22 @@ public:
|
|||||||
bool IsSizer();
|
bool IsSizer();
|
||||||
bool IsSpacer();
|
bool IsSpacer();
|
||||||
|
|
||||||
void SetInitSize( int x, int y )
|
// Deprecated in 2.6, use {G,S}etProportion instead.
|
||||||
{ m_minSize.x = x; m_minSize.y = y; }
|
wxDEPRECATED( void SetOption( int option ) );
|
||||||
void SetOption( int option )
|
wxDEPRECATED( int GetOption() const );
|
||||||
{ m_option = option; }
|
|
||||||
|
void SetProportion( int proportion )
|
||||||
|
{ m_proportion = proportion; }
|
||||||
|
int GetProportion() const
|
||||||
|
{ return m_proportion; }
|
||||||
void SetFlag( int flag )
|
void SetFlag( int flag )
|
||||||
{ m_flag = flag; }
|
{ m_flag = flag; }
|
||||||
|
int GetFlag() const
|
||||||
|
{ return m_flag; }
|
||||||
void SetBorder( int border )
|
void SetBorder( int border )
|
||||||
{ m_border = border; }
|
{ m_border = border; }
|
||||||
void Show ( bool show )
|
int GetBorder() const
|
||||||
{ m_show = show; }
|
{ return m_border; }
|
||||||
|
|
||||||
wxWindow *GetWindow() const
|
wxWindow *GetWindow() const
|
||||||
{ return m_window; }
|
{ return m_window; }
|
||||||
@ -95,14 +117,15 @@ public:
|
|||||||
{ return m_sizer; }
|
{ return m_sizer; }
|
||||||
void SetSizer( wxSizer *sizer )
|
void SetSizer( wxSizer *sizer )
|
||||||
{ m_sizer = sizer; }
|
{ m_sizer = sizer; }
|
||||||
int GetOption() const
|
const wxSize &GetSpacer() const
|
||||||
{ return m_option; }
|
{ return m_size; }
|
||||||
int GetFlag() const
|
void SetSpacer( const wxSize &size )
|
||||||
{ return m_flag; }
|
{ m_size = size; m_minSize = size; }
|
||||||
int GetBorder() const
|
|
||||||
{ return m_border; }
|
void Show ( bool show );
|
||||||
bool IsShown() const
|
bool IsShown() const
|
||||||
{ return m_show; }
|
{ return m_show; }
|
||||||
|
|
||||||
wxObject* GetUserData()
|
wxObject* GetUserData()
|
||||||
{ return m_userData; }
|
{ return m_userData; }
|
||||||
wxPoint GetPosition()
|
wxPoint GetPosition()
|
||||||
@ -114,25 +137,28 @@ protected:
|
|||||||
wxSize m_size;
|
wxSize m_size;
|
||||||
wxPoint m_pos;
|
wxPoint m_pos;
|
||||||
wxSize m_minSize;
|
wxSize m_minSize;
|
||||||
int m_option;
|
int m_proportion;
|
||||||
int m_border;
|
int m_border;
|
||||||
int m_flag;
|
int m_flag;
|
||||||
|
|
||||||
// If TRUE, then this item is considered in the layout
|
// If true, then this item is considered in the layout
|
||||||
// calculation. Otherwise, it is skipped over.
|
// calculation. Otherwise, it is skipped over.
|
||||||
bool m_show;
|
bool m_show;
|
||||||
// als: aspect ratio can always be calculated from m_size,
|
|
||||||
|
// Aspect ratio can always be calculated from m_size,
|
||||||
// but this would cause precision loss when the window
|
// but this would cause precision loss when the window
|
||||||
// is shrinked. it is safer to preserve initial value.
|
// is shrunk. It is safer to preserve the initial value.
|
||||||
float m_ratio;
|
float m_ratio;
|
||||||
|
|
||||||
wxObject *m_userData;
|
wxObject *m_userData;
|
||||||
|
|
||||||
private:
|
DECLARE_DYNAMIC_CLASS(wxSizerItem);
|
||||||
DECLARE_CLASS(wxSizerItem);
|
|
||||||
DECLARE_NO_COPY_CLASS(wxSizerItem)
|
DECLARE_NO_COPY_CLASS(wxSizerItem)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList );
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// wxSizer
|
// wxSizer
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@ -144,30 +170,75 @@ public:
|
|||||||
~wxSizer();
|
~wxSizer();
|
||||||
|
|
||||||
/* These should be called Append() really. */
|
/* These should be called Append() really. */
|
||||||
virtual void Add( wxWindow *window, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
|
virtual void Add( wxWindow *window,
|
||||||
virtual void Add( wxSizer *sizer, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
|
int proportion = 0,
|
||||||
virtual void Add( int width, int height, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
|
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 void Add( wxSizerItem *item );
|
||||||
|
|
||||||
virtual void Insert( int before, wxWindow *window, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
|
virtual void Insert( size_t index,
|
||||||
virtual void Insert( int before, wxSizer *sizer, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
|
wxWindow *window,
|
||||||
virtual void Insert( int before, int width, int height, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
|
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 option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
|
virtual void Prepend( wxWindow *window,
|
||||||
virtual void Prepend( wxSizer *sizer, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
|
int proportion = 0,
|
||||||
virtual void Prepend( int width, int height, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
|
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 );
|
||||||
|
|
||||||
// Remove will delete a sizer, but not a window.
|
// Deprecated in 2.6 since historically it does not delete the window,
|
||||||
virtual bool Remove( wxWindow *window );
|
// use Detach instead.
|
||||||
|
wxDEPRECATED( virtual bool Remove( wxWindow *window ) );
|
||||||
virtual bool Remove( wxSizer *sizer );
|
virtual bool Remove( wxSizer *sizer );
|
||||||
virtual bool Remove( int pos );
|
virtual bool Remove( size_t index );
|
||||||
|
|
||||||
// Detach will never destroy a sizer or window.
|
virtual bool Detach( wxWindow *window );
|
||||||
virtual bool Detach( wxWindow *window )
|
|
||||||
{ return Remove( window ); }
|
|
||||||
virtual bool Detach( wxSizer *sizer );
|
virtual bool Detach( wxSizer *sizer );
|
||||||
virtual bool Detach( int pos );
|
virtual bool Detach( size_t index );
|
||||||
|
|
||||||
virtual void Clear( bool delete_windows=FALSE );
|
virtual void Clear( bool delete_windows=false );
|
||||||
virtual void DeleteWindows();
|
virtual void DeleteWindows();
|
||||||
|
|
||||||
void SetMinSize( int width, int height )
|
void SetMinSize( int width, int height )
|
||||||
@ -187,10 +258,10 @@ public:
|
|||||||
bool SetItemMinSize( wxSizer *sizer, wxSize size )
|
bool SetItemMinSize( wxSizer *sizer, wxSize size )
|
||||||
{ return DoSetItemMinSize( sizer, size.x, size.y ); }
|
{ return DoSetItemMinSize( sizer, size.x, size.y ); }
|
||||||
|
|
||||||
bool SetItemMinSize( int pos, int width, int height )
|
bool SetItemMinSize( size_t index, int width, int height )
|
||||||
{ return DoSetItemMinSize( pos, width, height ); }
|
{ return DoSetItemMinSize( index, width, height ); }
|
||||||
bool SetItemMinSize( int pos, wxSize size )
|
bool SetItemMinSize( size_t index, wxSize size )
|
||||||
{ return DoSetItemMinSize( pos, size.x, size.y ); }
|
{ return DoSetItemMinSize( index, size.x, size.y ); }
|
||||||
|
|
||||||
wxSize GetSize()
|
wxSize GetSize()
|
||||||
{ return m_size; }
|
{ return m_size; }
|
||||||
@ -210,22 +281,27 @@ public:
|
|||||||
void SetSizeHints( wxWindow *window );
|
void SetSizeHints( wxWindow *window );
|
||||||
void SetVirtualSizeHints( wxWindow *window );
|
void SetVirtualSizeHints( wxWindow *window );
|
||||||
|
|
||||||
wxList& GetChildren()
|
wxSizerItemList& GetChildren()
|
||||||
{ return m_children; }
|
{ return m_children; }
|
||||||
|
|
||||||
void SetDimension( int x, int y, int width, int height );
|
void SetDimension( int x, int y, int width, int height );
|
||||||
|
|
||||||
// Manage whether individual windows or sub-sizers are considered
|
// Manage whether individual scene items are considered
|
||||||
// in the layout calculations or not.
|
// in the layout calculations or not.
|
||||||
void Show( wxWindow *window, bool show = TRUE );
|
void Show( wxWindow *window, bool show = true );
|
||||||
void Hide( wxWindow *window )
|
void Show( wxSizer *sizer, bool show = true );
|
||||||
{ Show (window, FALSE); }
|
void Show( size_t index, bool show = true );
|
||||||
void Show( wxSizer *sizer, bool show = TRUE );
|
|
||||||
void Hide( wxSizer *sizer )
|
void Hide( wxSizer *sizer )
|
||||||
{ Show (sizer, FALSE); }
|
{ Show( sizer, false ); }
|
||||||
|
void Hide( wxWindow *window )
|
||||||
|
{ Show( window, false ); }
|
||||||
|
void Hide( size_t index )
|
||||||
|
{ Show( index, false ); }
|
||||||
|
|
||||||
bool IsShown( wxWindow *window );
|
bool IsShown( wxWindow *window );
|
||||||
bool IsShown( wxSizer *sizer );
|
bool IsShown( wxSizer *sizer );
|
||||||
|
bool IsShown( size_t index );
|
||||||
|
|
||||||
// Recursively call wxWindow::Show () on all sizer items.
|
// Recursively call wxWindow::Show () on all sizer items.
|
||||||
void ShowItems (bool show);
|
void ShowItems (bool show);
|
||||||
@ -234,7 +310,7 @@ protected:
|
|||||||
wxSize m_size;
|
wxSize m_size;
|
||||||
wxSize m_minSize;
|
wxSize m_minSize;
|
||||||
wxPoint m_position;
|
wxPoint m_position;
|
||||||
wxList m_children;
|
wxSizerItemList m_children;
|
||||||
|
|
||||||
wxSize GetMaxWindowSize( wxWindow *window );
|
wxSize GetMaxWindowSize( wxWindow *window );
|
||||||
wxSize GetMinWindowSize( wxWindow *window );
|
wxSize GetMinWindowSize( wxWindow *window );
|
||||||
@ -246,10 +322,9 @@ protected:
|
|||||||
virtual void DoSetMinSize( int width, int height );
|
virtual void DoSetMinSize( int width, int height );
|
||||||
virtual bool DoSetItemMinSize( wxWindow *window, int width, int height );
|
virtual bool DoSetItemMinSize( wxWindow *window, int width, int height );
|
||||||
virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height );
|
virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height );
|
||||||
virtual bool DoSetItemMinSize( int pos, int width, int height );
|
virtual bool DoSetItemMinSize( size_t index, int width, int height );
|
||||||
|
|
||||||
private:
|
DECLARE_DYNAMIC_CLASS(wxSizer);
|
||||||
DECLARE_CLASS(wxSizer);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@ -285,8 +360,7 @@ 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 );
|
||||||
|
|
||||||
private:
|
DECLARE_DYNAMIC_CLASS(wxGridSizer);
|
||||||
DECLARE_CLASS(wxGridSizer);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@ -316,8 +390,7 @@ protected:
|
|||||||
|
|
||||||
void CreateArrays();
|
void CreateArrays();
|
||||||
|
|
||||||
private:
|
DECLARE_DYNAMIC_CLASS(wxFlexGridSizer);
|
||||||
DECLARE_CLASS(wxFlexGridSizer);
|
|
||||||
DECLARE_NO_COPY_CLASS(wxFlexGridSizer)
|
DECLARE_NO_COPY_CLASS(wxFlexGridSizer)
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -347,8 +420,7 @@ protected:
|
|||||||
int m_fixedWidth;
|
int m_fixedWidth;
|
||||||
int m_fixedHeight;
|
int m_fixedHeight;
|
||||||
|
|
||||||
private:
|
DECLARE_DYNAMIC_CLASS(wxBoxSizer);
|
||||||
DECLARE_CLASS(wxBoxSizer);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@ -373,8 +445,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
wxStaticBox *m_staticBox;
|
wxStaticBox *m_staticBox;
|
||||||
|
|
||||||
private:
|
DECLARE_DYNAMIC_CLASS(wxStaticBoxSizer);
|
||||||
DECLARE_CLASS(wxStaticBoxSizer);
|
|
||||||
DECLARE_NO_COPY_CLASS(wxStaticBoxSizer)
|
DECLARE_NO_COPY_CLASS(wxStaticBoxSizer)
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -402,8 +473,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
wxNotebook *m_notebook;
|
wxNotebook *m_notebook;
|
||||||
|
|
||||||
private:
|
DECLARE_DYNAMIC_CLASS(wxNotebookSizer);
|
||||||
DECLARE_CLASS(wxNotebookSizer);
|
|
||||||
DECLARE_NO_COPY_CLASS(wxNotebookSizer)
|
DECLARE_NO_COPY_CLASS(wxNotebookSizer)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ void CheckListBoxFrame::OnToggleSelection(wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
wxSizer *sizer = m_panel->GetSizer();
|
wxSizer *sizer = m_panel->GetSizer();
|
||||||
|
|
||||||
sizer->Remove(m_pListBox);
|
sizer->Detach( m_pListBox );
|
||||||
delete m_pListBox;
|
delete m_pListBox;
|
||||||
|
|
||||||
CreateCheckListbox(event.IsChecked() ? wxLB_EXTENDED : 0);
|
CreateCheckListbox(event.IsChecked() ? wxLB_EXTENDED : 0);
|
||||||
|
@ -78,7 +78,7 @@ ScanCodeCtrl::ScanCodeCtrl( wxWindow* parent, wxWindowID id, int code,
|
|||||||
|
|
||||||
void ScanCodeCtrl::OnKeyDown( wxKeyEvent& event )
|
void ScanCodeCtrl::OnKeyDown( wxKeyEvent& event )
|
||||||
{ wxString buf;
|
{ wxString buf;
|
||||||
buf.Printf( "0x%04x", event.KeyCode() );
|
buf.Printf( "0x%04x", event.GetKeyCode() );
|
||||||
SetValue( buf );
|
SetValue( buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ void *MyThread::Entry()
|
|||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
|
|
||||||
text.Printf(wxT("Thread 0x%x started (priority = %u).\n"),
|
text.Printf(wxT("Thread 0x%lx started (priority = %u).\n"),
|
||||||
GetId(), GetPriority());
|
GetId(), GetPriority());
|
||||||
WriteText(text);
|
WriteText(text);
|
||||||
// wxLogMessage(text); -- test wxLog thread safeness
|
// wxLogMessage(text); -- test wxLog thread safeness
|
||||||
@ -234,14 +234,14 @@ void *MyThread::Entry()
|
|||||||
if ( TestDestroy() )
|
if ( TestDestroy() )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
text.Printf(wxT("[%u] Thread 0x%x here.\n"), m_count, GetId());
|
text.Printf(wxT("[%u] Thread 0x%lx here.\n"), m_count, GetId());
|
||||||
WriteText(text);
|
WriteText(text);
|
||||||
|
|
||||||
// wxSleep() can't be called from non-GUI thread!
|
// wxSleep() can't be called from non-GUI thread!
|
||||||
wxThread::Sleep(1000);
|
wxThread::Sleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
text.Printf(wxT("Thread 0x%x finished.\n"), GetId());
|
text.Printf(wxT("Thread 0x%lx finished.\n"), GetId());
|
||||||
WriteText(text);
|
WriteText(text);
|
||||||
// wxLogMessage(text); -- test wxLog thread safeness
|
// wxLogMessage(text); -- test wxLog thread safeness
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ void ButtonWidgetsPage::CreateButton()
|
|||||||
size_t count = m_sizerButton->GetChildren().GetCount();
|
size_t count = m_sizerButton->GetChildren().GetCount();
|
||||||
for ( size_t n = 0; n < count; n++ )
|
for ( size_t n = 0; n < count; n++ )
|
||||||
{
|
{
|
||||||
m_sizerButton->Remove(0);
|
m_sizerButton->Remove( 0u );
|
||||||
}
|
}
|
||||||
|
|
||||||
delete m_button;
|
delete m_button;
|
||||||
|
@ -340,7 +340,7 @@ void ComboboxWidgetsPage::CreateCombo()
|
|||||||
items.Add(m_combobox->GetString(n));
|
items.Add(m_combobox->GetString(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sizerCombo->Remove(m_combobox);
|
m_sizerCombo->Detach( m_combobox );
|
||||||
delete m_combobox;
|
delete m_combobox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ void GaugeWidgetsPage::CreateGauge()
|
|||||||
{
|
{
|
||||||
val = m_gauge->GetValue();
|
val = m_gauge->GetValue();
|
||||||
|
|
||||||
m_sizerGauge->Remove(m_gauge);
|
m_sizerGauge->Detach( m_gauge );
|
||||||
delete m_gauge;
|
delete m_gauge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ void ListboxWidgetsPage::CreateLbox()
|
|||||||
items.Add(m_lbox->GetString(n));
|
items.Add(m_lbox->GetString(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sizerLbox->Remove(m_lbox);
|
m_sizerLbox->Detach( m_lbox );
|
||||||
delete m_lbox;
|
delete m_lbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ void NotebookWidgetsPage::CreateNotebook()
|
|||||||
notebook->GetPageImage(n));
|
notebook->GetPageImage(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sizerNotebook->Remove(notebook);
|
m_sizerNotebook->Detach( notebook );
|
||||||
delete notebook;
|
delete notebook;
|
||||||
|
|
||||||
// restore selection
|
// restore selection
|
||||||
|
@ -288,7 +288,7 @@ void RadioWidgetsPage::CreateRadio()
|
|||||||
{
|
{
|
||||||
sel = m_radio->GetSelection();
|
sel = m_radio->GetSelection();
|
||||||
|
|
||||||
m_sizerRadio->Remove(m_radio);
|
m_sizerRadio->Detach( m_radio );
|
||||||
|
|
||||||
delete m_radio;
|
delete m_radio;
|
||||||
}
|
}
|
||||||
|
@ -315,13 +315,13 @@ void SliderWidgetsPage::CreateSlider()
|
|||||||
val = valOld;
|
val = valOld;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sizerSlider->Remove(m_slider);
|
m_sizerSlider->Detach( m_slider );
|
||||||
|
|
||||||
if ( m_sizerSlider->GetChildren().GetCount() )
|
if ( m_sizerSlider->GetChildren().GetCount() )
|
||||||
{
|
{
|
||||||
// we have 2 spacers, remove them too
|
// we have 2 spacers, remove them too
|
||||||
m_sizerSlider->Remove((int)0);
|
m_sizerSlider->Remove( 0u );
|
||||||
m_sizerSlider->Remove((int)0);
|
m_sizerSlider->Remove( 0u );
|
||||||
}
|
}
|
||||||
|
|
||||||
delete m_slider;
|
delete m_slider;
|
||||||
|
@ -285,13 +285,13 @@ void SpinBtnWidgetsPage::CreateSpin()
|
|||||||
val = valOld;
|
val = valOld;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sizerSpin->Remove(m_spinbtn);
|
m_sizerSpin->Detach( m_spinbtn );
|
||||||
m_sizerSpin->Remove(m_spinctrl);
|
m_sizerSpin->Detach( m_spinctrl );
|
||||||
|
|
||||||
// there are 3 spacers left
|
// there are 3 spacers left
|
||||||
m_sizerSpin->Remove((int)0);
|
m_sizerSpin->Remove( 0u );
|
||||||
m_sizerSpin->Remove((int)0);
|
m_sizerSpin->Remove( 0u );
|
||||||
m_sizerSpin->Remove((int)0);
|
m_sizerSpin->Remove( 0u );
|
||||||
|
|
||||||
delete m_spinbtn;
|
delete m_spinbtn;
|
||||||
delete m_spinctrl;
|
delete m_spinctrl;
|
||||||
|
@ -542,7 +542,7 @@ void TextWidgetsPage::CreateText()
|
|||||||
{
|
{
|
||||||
valueOld = m_text->GetValue();
|
valueOld = m_text->GetValue();
|
||||||
|
|
||||||
m_sizerText->Remove(m_text);
|
m_sizerText->Detach( m_text );
|
||||||
delete m_text;
|
delete m_text;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -571,6 +571,11 @@ wxKeyEvent::wxKeyEvent(const wxKeyEvent& evt)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long wxKeyEvent::KeyCode() const
|
||||||
|
{
|
||||||
|
return m_keyCode;
|
||||||
|
}
|
||||||
|
|
||||||
wxWindowCreateEvent::wxWindowCreateEvent(wxWindow *win)
|
wxWindowCreateEvent::wxWindowCreateEvent(wxWindow *win)
|
||||||
{
|
{
|
||||||
SetEventType(wxEVT_CREATE);
|
SetEventType(wxEVT_CREATE);
|
||||||
|
@ -285,7 +285,7 @@ void wxPreviewControlBar::OnPrint(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void wxPreviewControlBar::OnChar(wxKeyEvent &event)
|
void wxPreviewControlBar::OnChar(wxKeyEvent &event)
|
||||||
{
|
{
|
||||||
switch(event.KeyCode())
|
switch(event.GetKeyCode())
|
||||||
{
|
{
|
||||||
case WXK_NEXT:
|
case WXK_NEXT:
|
||||||
OnNext(); break;
|
OnNext(); break;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
// Created:
|
// Created:
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Robin Dunn, Dirk Holtwick and Robert Roebling
|
// Copyright: (c) Robin Dunn, Dirk Holtwick and Robert Roebling
|
||||||
|
// (c) 2003, Ron Lee
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -24,6 +25,7 @@
|
|||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/statbox.h"
|
#include "wx/statbox.h"
|
||||||
#include "wx/notebook.h"
|
#include "wx/notebook.h"
|
||||||
|
#include <wx/listimpl.cpp>
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -39,32 +41,35 @@ IMPLEMENT_ABSTRACT_CLASS(wxStaticBoxSizer, wxBoxSizer)
|
|||||||
IMPLEMENT_ABSTRACT_CLASS(wxNotebookSizer, wxSizer)
|
IMPLEMENT_ABSTRACT_CLASS(wxNotebookSizer, wxSizer)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
WX_DEFINE_EXPORTED_LIST( wxSizerItemList );
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// wxSizerItem
|
// wxSizerItem
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
wxSizerItem::wxSizerItem( int width, int height, int option, int flag, int border, wxObject* userData )
|
wxSizerItem::wxSizerItem( int width, int height, int proportion, int flag, int border, wxObject* userData )
|
||||||
: m_window( 0 )
|
: m_window( NULL )
|
||||||
, m_sizer( 0 )
|
, m_sizer( NULL )
|
||||||
, m_size( wxSize( width, height ) ) // size is set directly
|
, m_size( wxSize( width, height ) ) // size is set directly
|
||||||
, m_minSize( m_size ) // minimal size is the initial size
|
, m_minSize( m_size ) // minimal size is the initial size
|
||||||
, m_option( option )
|
, m_proportion( proportion )
|
||||||
, m_border( border )
|
, m_border( border )
|
||||||
, m_flag( flag )
|
, m_flag( flag )
|
||||||
, m_show( TRUE ) // Cannot be changed
|
, m_show( true )
|
||||||
, m_userData( userData )
|
, m_userData( userData )
|
||||||
{
|
{
|
||||||
SetRatio( m_size );
|
SetRatio( m_size );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSizerItem::wxSizerItem( wxWindow *window, int option, int flag, int border, wxObject* userData )
|
wxSizerItem::wxSizerItem( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
|
||||||
: m_window( window )
|
: m_window( window )
|
||||||
, m_sizer( 0 )
|
, m_sizer( NULL )
|
||||||
, m_minSize( window->GetSize() ) // minimal size is the initial size
|
, m_minSize( window->GetSize() ) // minimal size is the initial size
|
||||||
, m_option( option )
|
, m_proportion( proportion )
|
||||||
, m_border( border )
|
, m_border( border )
|
||||||
, m_flag( flag )
|
, m_flag( flag )
|
||||||
, m_show( TRUE )
|
, m_show( true )
|
||||||
, m_userData( userData )
|
, m_userData( userData )
|
||||||
{
|
{
|
||||||
// aspect ratio calculated from initial size
|
// aspect ratio calculated from initial size
|
||||||
@ -73,14 +78,14 @@ wxSizerItem::wxSizerItem( wxWindow *window, int option, int flag, int border, wx
|
|||||||
// m_size is calculated later
|
// m_size is calculated later
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSizerItem::wxSizerItem( wxSizer *sizer, int option, int flag, int border, wxObject* userData )
|
wxSizerItem::wxSizerItem( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData )
|
||||||
: m_window( 0 )
|
: m_window( NULL )
|
||||||
, m_sizer( sizer )
|
, m_sizer( sizer )
|
||||||
, m_option( option )
|
, m_proportion( proportion )
|
||||||
, m_border( border )
|
, m_border( border )
|
||||||
, m_flag( flag )
|
, m_flag( flag )
|
||||||
, m_show( TRUE )
|
, m_show( true )
|
||||||
, m_ratio( 0 )
|
, m_ratio( 0.0 )
|
||||||
, m_userData( userData )
|
, m_userData( userData )
|
||||||
{
|
{
|
||||||
// m_minSize is calculated later
|
// m_minSize is calculated later
|
||||||
@ -242,15 +247,37 @@ bool wxSizerItem::IsSpacer()
|
|||||||
return (m_window == NULL) && (m_sizer == NULL);
|
return (m_window == NULL) && (m_sizer == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxSizerItem::Show( bool show )
|
||||||
|
{
|
||||||
|
m_show = show;
|
||||||
|
|
||||||
|
if( IsWindow() )
|
||||||
|
m_window->Show( show );
|
||||||
|
else if( IsSizer() )
|
||||||
|
m_sizer->ShowItems( show );
|
||||||
|
|
||||||
|
// ... nothing else to do to hide/show spacers
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSizerItem::SetOption( int option )
|
||||||
|
{
|
||||||
|
SetProportion( option );
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxSizerItem::GetOption() const
|
||||||
|
{
|
||||||
|
return GetProportion();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// wxSizer
|
// wxSizer
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
wxSizer::wxSizer()
|
wxSizer::wxSizer()
|
||||||
|
: m_minSize( wxSize( 0, 0 ) )
|
||||||
{
|
{
|
||||||
m_children.DeleteContents( TRUE );
|
m_children.DeleteContents( true );
|
||||||
m_minSize.x = 0;
|
|
||||||
m_minSize.y = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSizer::~wxSizer()
|
wxSizer::~wxSizer()
|
||||||
@ -258,148 +285,199 @@ wxSizer::~wxSizer()
|
|||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSizer::Add( wxWindow *window, int option, int flag, int border, wxObject* userData )
|
void wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
|
||||||
{
|
{
|
||||||
m_children.Append( new wxSizerItem( window, option, flag, border, userData ) );
|
m_children.Append( new wxSizerItem( window, proportion, flag, border, userData ) );
|
||||||
window->SetContainingSizer(this);
|
window->SetContainingSizer( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSizer::Add( wxSizer *sizer, int option, int flag, int border, wxObject* userData )
|
void wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData )
|
||||||
{
|
{
|
||||||
m_children.Append( new wxSizerItem( sizer, option, flag, border, userData ) );
|
m_children.Append( new wxSizerItem( sizer, proportion, flag, border, userData ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSizer::Add( int width, int height, int option, int flag, int border, wxObject* userData )
|
void wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData )
|
||||||
{
|
{
|
||||||
m_children.Append( new wxSizerItem( width, height, option, flag, border, userData ) );
|
m_children.Append( new wxSizerItem( width, height, proportion, flag, border, userData ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSizer::Prepend( wxWindow *window, int option, int flag, int border, wxObject* userData )
|
void wxSizer::Add( wxSizerItem *item )
|
||||||
{
|
{
|
||||||
m_children.Insert( new wxSizerItem( window, option, flag, border, userData ) );
|
m_children.Append( item );
|
||||||
window->SetContainingSizer(this);
|
|
||||||
|
if( item->GetWindow() )
|
||||||
|
item->GetWindow()->SetContainingSizer( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSizer::Prepend( wxSizer *sizer, int option, int flag, int border, wxObject* userData )
|
void wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
|
||||||
{
|
{
|
||||||
m_children.Insert( new wxSizerItem( sizer, option, flag, border, userData ) );
|
m_children.Insert( new wxSizerItem( window, proportion, flag, border, userData ) );
|
||||||
|
window->SetContainingSizer( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSizer::Prepend( int width, int height, int option, int flag, int border, wxObject* userData )
|
void wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData )
|
||||||
{
|
{
|
||||||
m_children.Insert( new wxSizerItem( width, height, option, flag, border, userData ) );
|
m_children.Insert( new wxSizerItem( sizer, proportion, flag, border, userData ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSizer::Insert( int before, wxWindow *window, int option, int flag, int border, wxObject* userData )
|
void wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData )
|
||||||
{
|
{
|
||||||
m_children.Insert( before, new wxSizerItem( window, option, flag, border, userData ) );
|
m_children.Insert( new wxSizerItem( width, height, proportion, flag, border, userData ) );
|
||||||
window->SetContainingSizer(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSizer::Insert( int before, wxSizer *sizer, int option, int flag, int border, wxObject* userData )
|
void wxSizer::Prepend( wxSizerItem *item )
|
||||||
{
|
{
|
||||||
m_children.Insert( before, new wxSizerItem( sizer, option, flag, border, userData ) );
|
m_children.Insert( item );
|
||||||
|
|
||||||
|
if( item->GetWindow() )
|
||||||
|
item->GetWindow()->SetContainingSizer( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSizer::Insert( int before, int width, int height, int option, int flag, int border, wxObject* userData )
|
void wxSizer::Insert( size_t index,
|
||||||
|
wxWindow *window,
|
||||||
|
int proportion,
|
||||||
|
int flag,
|
||||||
|
int border,
|
||||||
|
wxObject* userData )
|
||||||
{
|
{
|
||||||
m_children.Insert( before, new wxSizerItem( width, height, option, flag, border, userData ) );
|
m_children.Insert( index,
|
||||||
|
new wxSizerItem( window, proportion, flag, border, userData ) );
|
||||||
|
window->SetContainingSizer( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSizer::Insert( size_t index,
|
||||||
|
wxSizer *sizer,
|
||||||
|
int proportion,
|
||||||
|
int flag,
|
||||||
|
int border,
|
||||||
|
wxObject* userData )
|
||||||
|
{
|
||||||
|
m_children.Insert( index,
|
||||||
|
new wxSizerItem( sizer, proportion, flag, border, userData ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSizer::Insert( size_t index,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int proportion,
|
||||||
|
int flag,
|
||||||
|
int border,
|
||||||
|
wxObject* userData )
|
||||||
|
{
|
||||||
|
m_children.Insert( index,
|
||||||
|
new wxSizerItem( width, height, proportion, flag, border, userData ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSizer::Insert( size_t index, wxSizerItem *item )
|
||||||
|
{
|
||||||
|
m_children.Insert( index, item );
|
||||||
|
|
||||||
|
if( item->GetWindow() )
|
||||||
|
item->GetWindow()->SetContainingSizer( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSizer::Remove( wxWindow *window )
|
bool wxSizer::Remove( wxWindow *window )
|
||||||
{
|
{
|
||||||
wxASSERT( window );
|
return Detach( window );
|
||||||
|
|
||||||
wxNode *node = m_children.First();
|
|
||||||
while (node)
|
|
||||||
{
|
|
||||||
wxSizerItem *item = (wxSizerItem*)node->Data();
|
|
||||||
if (item->GetWindow() == window)
|
|
||||||
{
|
|
||||||
item->GetWindow()->SetContainingSizer(NULL);
|
|
||||||
m_children.DeleteNode( node );
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
node = node->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSizer::Remove( wxSizer *sizer )
|
bool wxSizer::Remove( wxSizer *sizer )
|
||||||
{
|
{
|
||||||
wxASSERT( sizer );
|
wxASSERT_MSG( sizer, _T("Removing NULL sizer") );
|
||||||
|
|
||||||
wxNode *node = m_children.First();
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*)node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
|
|
||||||
if (item->GetSizer() == sizer)
|
if (item->GetSizer() == sizer)
|
||||||
{
|
return m_children.DeleteNode( node );
|
||||||
m_children.DeleteNode( node );
|
|
||||||
return TRUE;
|
node = node->GetNext();
|
||||||
}
|
|
||||||
node = node->Next();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSizer::Remove( int pos )
|
bool wxSizer::Remove( size_t index )
|
||||||
{
|
{
|
||||||
if ((size_t)pos >= m_children.GetCount())
|
wxCHECK_MSG( index < m_children.GetCount(),
|
||||||
return FALSE;
|
false,
|
||||||
wxNode *node = m_children.Nth( pos );
|
_T("Remove index is out of range") );
|
||||||
if (!node) return FALSE;
|
|
||||||
|
|
||||||
m_children.DeleteNode( node );
|
wxSizerItemList::Node *node = m_children.Item( index );
|
||||||
|
|
||||||
return TRUE;
|
wxCHECK_MSG( node, false, _T("Failed to find child node") );
|
||||||
|
|
||||||
|
return m_children.DeleteNode( node );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSizer::Detach( wxSizer *sizer )
|
bool wxSizer::Detach( wxSizer *sizer )
|
||||||
{
|
{
|
||||||
wxASSERT( sizer );
|
wxASSERT_MSG( sizer, _T("Detaching NULL sizer") );
|
||||||
|
|
||||||
wxNode *node = m_children.First();
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*)node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
|
|
||||||
if (item->GetSizer() == sizer)
|
if (item->GetSizer() == sizer)
|
||||||
{
|
{
|
||||||
item->DetachSizer();
|
item->DetachSizer();
|
||||||
m_children.DeleteNode( node );
|
return m_children.DeleteNode( node );
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSizer::Detach( int pos )
|
bool wxSizer::Detach( wxWindow *window )
|
||||||
{
|
{
|
||||||
if ((size_t)pos >= m_children.GetCount())
|
wxASSERT_MSG( window, _T("Detaching NULL window") );
|
||||||
return FALSE;
|
|
||||||
wxNode *node = m_children.Nth( pos );
|
|
||||||
if (!node) return FALSE;
|
|
||||||
|
|
||||||
( (wxSizerItem*)node->Data() )->DetachSizer();
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
m_children.DeleteNode( node );
|
while (node)
|
||||||
|
{
|
||||||
|
wxSizerItem *item = node->GetData();
|
||||||
|
|
||||||
return TRUE;
|
if (item->GetWindow() == window)
|
||||||
|
{
|
||||||
|
item->GetWindow()->SetContainingSizer( NULL );
|
||||||
|
return m_children.DeleteNode( node );
|
||||||
|
}
|
||||||
|
node = node->GetNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxSizer::Detach( size_t index )
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( index < m_children.GetCount(),
|
||||||
|
false,
|
||||||
|
_T("Detach index is out of range") );
|
||||||
|
|
||||||
|
wxSizerItemList::Node *node = m_children.Item( index );
|
||||||
|
|
||||||
|
wxCHECK_MSG( node, false, _T("Failed to find child node") );
|
||||||
|
|
||||||
|
node->GetData()->DetachSizer();
|
||||||
|
|
||||||
|
return m_children.DeleteNode( node );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSizer::Clear( bool delete_windows )
|
void wxSizer::Clear( bool delete_windows )
|
||||||
{
|
{
|
||||||
// First clear the ContainingSizer pointers
|
// First clear the ContainingSizer pointers
|
||||||
wxNode *node = m_children.First();
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*)node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
|
|
||||||
if (item->IsWindow())
|
if (item->IsWindow())
|
||||||
item->GetWindow()->SetContainingSizer(NULL);
|
item->GetWindow()->SetContainingSizer( NULL );
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy the windows if needed
|
// Destroy the windows if needed
|
||||||
@ -412,12 +490,13 @@ void wxSizer::Clear( bool delete_windows )
|
|||||||
|
|
||||||
void wxSizer::DeleteWindows()
|
void wxSizer::DeleteWindows()
|
||||||
{
|
{
|
||||||
wxNode *node = m_children.First();
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*)node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
|
|
||||||
item->DeleteWindows();
|
item->DeleteWindows();
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,6 +566,7 @@ wxSize wxSizer::GetMinWindowSize( wxWindow *window )
|
|||||||
wxSize minSize( GetMinSize() );
|
wxSize minSize( GetMinSize() );
|
||||||
wxSize size( window->GetSize() );
|
wxSize size( window->GetSize() );
|
||||||
wxSize client_size( window->GetClientSize() );
|
wxSize client_size( window->GetClientSize() );
|
||||||
|
|
||||||
return wxSize( minSize.x+size.x-client_size.x,
|
return wxSize( minSize.x+size.x-client_size.x,
|
||||||
minSize.y+size.y-client_size.y );
|
minSize.y+size.y-client_size.y );
|
||||||
}
|
}
|
||||||
@ -568,80 +648,88 @@ void wxSizer::DoSetMinSize( int width, int height )
|
|||||||
|
|
||||||
bool wxSizer::DoSetItemMinSize( wxWindow *window, int width, int height )
|
bool wxSizer::DoSetItemMinSize( wxWindow *window, int width, int height )
|
||||||
{
|
{
|
||||||
wxASSERT( window );
|
wxASSERT_MSG( window, _T("SetMinSize for NULL window") );
|
||||||
|
|
||||||
wxNode *node = m_children.First();
|
// Is it our immediate child?
|
||||||
|
|
||||||
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*)node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
|
|
||||||
if (item->GetWindow() == window)
|
if (item->GetWindow() == window)
|
||||||
{
|
{
|
||||||
item->SetInitSize( width, height );
|
item->SetInitSize( width, height );
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
node = m_children.First();
|
// No? Search any subsizers we own then
|
||||||
|
|
||||||
|
node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*)node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
if (item->GetSizer())
|
|
||||||
{
|
if ( item->GetSizer() &&
|
||||||
// It's a sizer, so lets search recursively.
|
item->GetSizer()->DoSetItemMinSize( window, width, height ) )
|
||||||
if (item->GetSizer()->DoSetItemMinSize( window, width, height ))
|
|
||||||
{
|
{
|
||||||
// A child sizer found the requested windw, exit.
|
// A child sizer found the requested windw, exit.
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
node = node->GetNext();
|
||||||
node = node->Next();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSizer::DoSetItemMinSize( wxSizer *sizer, int width, int height )
|
bool wxSizer::DoSetItemMinSize( wxSizer *sizer, int width, int height )
|
||||||
{
|
{
|
||||||
wxASSERT( sizer );
|
wxASSERT_MSG( sizer, _T("SetMinSize for NULL sizer") );
|
||||||
|
|
||||||
wxNode *node = m_children.First();
|
// Is it our immediate child?
|
||||||
|
|
||||||
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*)node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
|
|
||||||
if (item->GetSizer() == sizer)
|
if (item->GetSizer() == sizer)
|
||||||
{
|
{
|
||||||
item->GetSizer()->DoSetMinSize( width, height );
|
item->GetSizer()->DoSetMinSize( width, height );
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
node = m_children.First();
|
// No? Search any subsizers we own then
|
||||||
|
|
||||||
|
node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*)node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
if (item->GetSizer())
|
|
||||||
|
if ( item->GetSizer() &&
|
||||||
|
item->GetSizer()->DoSetItemMinSize( sizer, width, height ) )
|
||||||
{
|
{
|
||||||
// It's a sizer, so lets search recursively.
|
// A child found the requested sizer, exit.
|
||||||
if (item->GetSizer()->DoSetItemMinSize( sizer, width, height ))
|
return true;
|
||||||
{
|
|
||||||
// A child sizer found the requested windw, exit.
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
node = node->GetNext();
|
||||||
node = node->Next();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSizer::DoSetItemMinSize( int pos, int width, int height )
|
bool wxSizer::DoSetItemMinSize( size_t index, int width, int height )
|
||||||
{
|
{
|
||||||
wxNode *node = m_children.Nth( pos );
|
wxSizerItemList::Node *node = m_children.Item( index );
|
||||||
if (!node) return FALSE;
|
|
||||||
|
wxCHECK_MSG( node, false, _T("Failed to find child node") );
|
||||||
|
|
||||||
|
wxSizerItem *item = node->GetData();
|
||||||
|
|
||||||
wxSizerItem *item = (wxSizerItem*) node->Data();
|
|
||||||
if (item->GetSizer())
|
if (item->GetSizer())
|
||||||
{
|
{
|
||||||
// Sizers contains the minimal size in them, if not calculated ...
|
// Sizers contains the minimal size in them, if not calculated ...
|
||||||
@ -653,111 +741,129 @@ bool wxSizer::DoSetItemMinSize( int pos, int width, int height )
|
|||||||
item->SetInitSize( width, height );
|
item->SetInitSize( width, height );
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSizer::Show(wxWindow *window, bool show)
|
void wxSizer::Show( wxWindow *window, bool show )
|
||||||
{
|
{
|
||||||
wxNode *node = m_children.GetFirst();
|
wxASSERT_MSG( window, _T("Show for NULL window") );
|
||||||
|
|
||||||
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*) node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
|
|
||||||
if (item->IsWindow() && item->GetWindow() == window)
|
if (item->GetWindow() == window)
|
||||||
{
|
{
|
||||||
item->Show(show);
|
item->Show( show );
|
||||||
window->Show(show);
|
break;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSizer::Show(wxSizer *sizer, bool show)
|
void wxSizer::Show( wxSizer *sizer, bool show )
|
||||||
{
|
{
|
||||||
wxNode *node = m_children.GetFirst();
|
wxASSERT_MSG( sizer, _T("Show for NULL sizer") );
|
||||||
|
|
||||||
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*) node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
|
|
||||||
if (item->IsSizer() && item->GetSizer() == sizer)
|
if (item->GetSizer() == sizer)
|
||||||
{
|
{
|
||||||
item->Show(show);
|
item->Show( show );
|
||||||
sizer->ShowItems(show);
|
break;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSizer::ShowItems (bool show)
|
void wxSizer::Show( size_t index, bool show )
|
||||||
{
|
{
|
||||||
wxNode *node = m_children.GetFirst();
|
wxCHECK_RET( index < m_children.GetCount(),
|
||||||
|
_T("Show index is out of range") );
|
||||||
|
|
||||||
|
m_children.Item( index )->GetData()->Show( show );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSizer::ShowItems( bool show )
|
||||||
|
{
|
||||||
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*) node->Data();
|
node->GetData()->Show( show );
|
||||||
|
node = node->GetNext();
|
||||||
if (item->IsWindow())
|
|
||||||
item->GetWindow()->Show (show);
|
|
||||||
else if (item->IsSizer())
|
|
||||||
item->GetSizer()->ShowItems (show);
|
|
||||||
|
|
||||||
node = node->Next();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSizer::IsShown (wxWindow *window)
|
bool wxSizer::IsShown( wxWindow *window )
|
||||||
{
|
{
|
||||||
wxNode *node = m_children.GetFirst();
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*) node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
|
|
||||||
if (item->IsWindow() && item->GetWindow() == window)
|
if (item->GetWindow() == window)
|
||||||
{
|
{
|
||||||
return item->IsShown();
|
return item->IsShown();
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
wxFAIL_MSG( _T("IsShown failed to find sizer item") );
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSizer::IsShown (wxSizer *sizer)
|
bool wxSizer::IsShown( wxSizer *sizer )
|
||||||
{
|
{
|
||||||
wxNode *node = m_children.GetFirst();
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*) node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
|
|
||||||
if (item->IsSizer() && item->GetSizer() == sizer)
|
if (item->GetSizer() == sizer)
|
||||||
{
|
{
|
||||||
return item->IsShown();
|
return item->IsShown();
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
wxFAIL_MSG( _T("IsShown failed to find sizer item") );
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxSizer::IsShown( size_t index )
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( index < m_children.GetCount(),
|
||||||
|
false,
|
||||||
|
_T("IsShown index is out of range") );
|
||||||
|
|
||||||
|
return m_children.Item( index )->GetData()->IsShown();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// wxGridSizer
|
// wxGridSizer
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
wxGridSizer::wxGridSizer( int rows, int cols, int vgap, int hgap )
|
wxGridSizer::wxGridSizer( int rows, int cols, int vgap, int hgap )
|
||||||
|
: m_rows( rows )
|
||||||
|
, m_cols( cols )
|
||||||
|
, m_vgap( vgap )
|
||||||
|
, m_hgap( hgap )
|
||||||
{
|
{
|
||||||
m_rows = rows;
|
|
||||||
m_cols = cols;
|
|
||||||
m_vgap = vgap;
|
|
||||||
m_hgap = hgap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGridSizer::wxGridSizer( int cols, int vgap, int hgap )
|
wxGridSizer::wxGridSizer( int cols, int vgap, int hgap )
|
||||||
|
: m_rows( 0 )
|
||||||
|
, m_cols( cols )
|
||||||
|
, m_vgap( vgap )
|
||||||
|
, m_hgap( hgap )
|
||||||
{
|
{
|
||||||
m_rows = 0;
|
|
||||||
m_cols = cols;
|
|
||||||
m_vgap = vgap;
|
|
||||||
m_hgap = hgap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxGridSizer::CalcRowsCols(int& nrows, int& ncols) const
|
int wxGridSizer::CalcRowsCols(int& nrows, int& ncols) const
|
||||||
@ -807,10 +913,11 @@ void wxGridSizer::RecalcSizes()
|
|||||||
int i = r * ncols + c;
|
int i = r * ncols + c;
|
||||||
if (i < nitems)
|
if (i < nitems)
|
||||||
{
|
{
|
||||||
wxNode *node = m_children.Nth( i );
|
wxSizerItemList::Node *node = m_children.Item( i );
|
||||||
wxASSERT( node );
|
|
||||||
|
|
||||||
SetItemBounds( (wxSizerItem*) node->Data(), x, y, w, h);
|
wxASSERT_MSG( node, _T("Failed to find SizerItemList node") );
|
||||||
|
|
||||||
|
SetItemBounds( node->GetData(), x, y, w, h);
|
||||||
}
|
}
|
||||||
y = y + h + m_vgap;
|
y = y + h + m_vgap;
|
||||||
}
|
}
|
||||||
@ -828,19 +935,20 @@ wxSize wxGridSizer::CalcMin()
|
|||||||
int w = 0;
|
int w = 0;
|
||||||
int h = 0;
|
int h = 0;
|
||||||
|
|
||||||
wxNode *node = m_children.First();
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*)node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
wxSize sz( item->CalcMin() );
|
wxSize sz( item->CalcMin() );
|
||||||
|
|
||||||
w = wxMax( w, sz.x );
|
w = wxMax( w, sz.x );
|
||||||
h = wxMax( h, sz.y );
|
h = wxMax( h, sz.y );
|
||||||
|
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxSize(ncols * w + (ncols-1) * m_hgap,
|
return wxSize( ncols * w + (ncols-1) * m_hgap,
|
||||||
nrows * h + (nrows-1) * m_vgap);
|
nrows * h + (nrows-1) * m_vgap );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGridSizer::SetItemBounds( wxSizerItem *item, int x, int y, int w, int h )
|
void wxGridSizer::SetItemBounds( wxSizerItem *item, int x, int y, int w, int h )
|
||||||
@ -883,16 +991,16 @@ void wxGridSizer::SetItemBounds( wxSizerItem *item, int x, int y, int w, int h )
|
|||||||
|
|
||||||
wxFlexGridSizer::wxFlexGridSizer( int rows, int cols, int vgap, int hgap )
|
wxFlexGridSizer::wxFlexGridSizer( int rows, int cols, int vgap, int hgap )
|
||||||
: wxGridSizer( rows, cols, vgap, hgap )
|
: wxGridSizer( rows, cols, vgap, hgap )
|
||||||
|
, m_rowHeights( NULL )
|
||||||
|
, m_colWidths( NULL )
|
||||||
{
|
{
|
||||||
m_rowHeights = (int*) NULL;
|
|
||||||
m_colWidths = (int*) NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFlexGridSizer::wxFlexGridSizer( int cols, int vgap, int hgap )
|
wxFlexGridSizer::wxFlexGridSizer( int cols, int vgap, int hgap )
|
||||||
: wxGridSizer( cols, vgap, hgap )
|
: wxGridSizer( cols, vgap, hgap )
|
||||||
|
, m_rowHeights( NULL )
|
||||||
|
, m_colWidths( NULL )
|
||||||
{
|
{
|
||||||
m_rowHeights = (int*) NULL;
|
|
||||||
m_colWidths = (int*) NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFlexGridSizer::~wxFlexGridSizer()
|
wxFlexGridSizer::~wxFlexGridSizer()
|
||||||
@ -979,13 +1087,14 @@ void wxFlexGridSizer::RecalcSizes()
|
|||||||
int i = r * ncols + c;
|
int i = r * ncols + c;
|
||||||
if (i < nitems)
|
if (i < nitems)
|
||||||
{
|
{
|
||||||
wxNode *node = m_children.Nth( i );
|
wxSizerItemList::Node *node = m_children.Item( i );
|
||||||
wxASSERT( node );
|
|
||||||
|
wxASSERT_MSG( node, _T("Failed to find node") );
|
||||||
|
|
||||||
int w = wxMax( 0, wxMin( m_colWidths[c], sz.x - x ) );
|
int w = wxMax( 0, wxMin( m_colWidths[c], sz.x - x ) );
|
||||||
int h = wxMax( 0, wxMin( m_rowHeights[r], sz.y - y ) );
|
int h = wxMax( 0, wxMin( m_rowHeights[r], sz.y - y ) );
|
||||||
|
|
||||||
SetItemBounds( (wxSizerItem*) node->Data(), x, y, w, h);
|
SetItemBounds( node->GetData(), x, y, w, h);
|
||||||
}
|
}
|
||||||
y = y + m_rowHeights[r] + m_vgap;
|
y = y + m_rowHeights[r] + m_vgap;
|
||||||
}
|
}
|
||||||
@ -1002,17 +1111,19 @@ wxSize wxFlexGridSizer::CalcMin()
|
|||||||
CreateArrays();
|
CreateArrays();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
wxNode *node = m_children.First();
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
|
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*)node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
wxSize sz( item->CalcMin() );
|
wxSize sz( item->CalcMin() );
|
||||||
int row = i / ncols;
|
int row = i / ncols;
|
||||||
int col = i % ncols;
|
int col = i % ncols;
|
||||||
|
|
||||||
m_rowHeights[ row ] = wxMax( sz.y, m_rowHeights[ row ] );
|
m_rowHeights[ row ] = wxMax( sz.y, m_rowHeights[ row ] );
|
||||||
m_colWidths[ col ] = wxMax( sz.x, m_colWidths[ col ] );
|
m_colWidths[ col ] = wxMax( sz.x, m_colWidths[ col ] );
|
||||||
|
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1051,8 +1162,8 @@ void wxFlexGridSizer::RemoveGrowableCol( size_t WXUNUSED(idx) )
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
wxBoxSizer::wxBoxSizer( int orient )
|
wxBoxSizer::wxBoxSizer( int orient )
|
||||||
|
: m_orient( orient )
|
||||||
{
|
{
|
||||||
m_orient = orient;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBoxSizer::RecalcSizes()
|
void wxBoxSizer::RecalcSizes()
|
||||||
@ -1078,22 +1189,23 @@ void wxBoxSizer::RecalcSizes()
|
|||||||
|
|
||||||
wxPoint pt( m_position );
|
wxPoint pt( m_position );
|
||||||
|
|
||||||
wxNode *node = m_children.GetFirst();
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*) node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
|
|
||||||
if (item->IsShown())
|
if (item->IsShown())
|
||||||
{
|
{
|
||||||
int weight = 1;
|
int weight = 1;
|
||||||
if (item->GetOption())
|
if (item->GetProportion())
|
||||||
weight = item->GetOption();
|
weight = item->GetProportion();
|
||||||
|
|
||||||
wxSize size( item->CalcMin() );
|
wxSize size( item->CalcMin() );
|
||||||
|
|
||||||
if (m_orient == wxVERTICAL)
|
if (m_orient == wxVERTICAL)
|
||||||
{
|
{
|
||||||
wxCoord height = size.y;
|
wxCoord height = size.y;
|
||||||
if (item->GetOption())
|
if (item->GetProportion())
|
||||||
{
|
{
|
||||||
height = (delta * weight) + extra;
|
height = (delta * weight) + extra;
|
||||||
extra = 0; // only the first item will get the remainder as extra size
|
extra = 0; // only the first item will get the remainder as extra size
|
||||||
@ -1118,7 +1230,7 @@ void wxBoxSizer::RecalcSizes()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxCoord width = size.x;
|
wxCoord width = size.x;
|
||||||
if (item->GetOption())
|
if (item->GetProportion())
|
||||||
{
|
{
|
||||||
width = (delta * weight) + extra;
|
width = (delta * weight) + extra;
|
||||||
extra = 0; // only the first item will get the remainder as extra size
|
extra = 0; // only the first item will get the remainder as extra size
|
||||||
@ -1142,7 +1254,7 @@ void wxBoxSizer::RecalcSizes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1159,13 +1271,15 @@ wxSize wxBoxSizer::CalcMin()
|
|||||||
|
|
||||||
// Find how long each stretch unit needs to be
|
// Find how long each stretch unit needs to be
|
||||||
int stretchSize = 1;
|
int stretchSize = 1;
|
||||||
wxNode *node = m_children.GetFirst();
|
wxSizerItemList::Node *node = m_children.GetFirst();
|
||||||
|
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*) node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
if (item->IsShown() && item->GetOption() != 0)
|
|
||||||
|
if (item->IsShown() && item->GetProportion() != 0)
|
||||||
{
|
{
|
||||||
int stretch = item->GetOption();
|
int stretch = item->GetProportion();
|
||||||
wxSize size( item->CalcMin() );
|
wxSize size( item->CalcMin() );
|
||||||
int sizePerStretch;
|
int sizePerStretch;
|
||||||
// Integer division rounded up is (a + b - 1) / b
|
// Integer division rounded up is (a + b - 1) / b
|
||||||
@ -1176,24 +1290,26 @@ wxSize wxBoxSizer::CalcMin()
|
|||||||
if (sizePerStretch > stretchSize)
|
if (sizePerStretch > stretchSize)
|
||||||
stretchSize = sizePerStretch;
|
stretchSize = sizePerStretch;
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate overall minimum size
|
// Calculate overall minimum size
|
||||||
node = m_children.GetFirst();
|
node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxSizerItem *item = (wxSizerItem*) node->Data();
|
wxSizerItem *item = node->GetData();
|
||||||
|
|
||||||
if (item->IsShown())
|
if (item->IsShown())
|
||||||
{
|
{
|
||||||
m_stretchable += item->GetOption();
|
m_stretchable += item->GetProportion();
|
||||||
|
|
||||||
wxSize size( item->CalcMin() );
|
wxSize size( item->CalcMin() );
|
||||||
if (item->GetOption() != 0)
|
if (item->GetProportion() != 0)
|
||||||
{
|
{
|
||||||
if (m_orient == wxHORIZONTAL)
|
if (m_orient == wxHORIZONTAL)
|
||||||
size.x = stretchSize * item->GetOption();
|
size.x = stretchSize * item->GetProportion();
|
||||||
else
|
else
|
||||||
size.y = stretchSize * item->GetOption();
|
size.y = stretchSize * item->GetProportion();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_orient == wxHORIZONTAL)
|
if (m_orient == wxHORIZONTAL)
|
||||||
@ -1207,7 +1323,7 @@ wxSize wxBoxSizer::CalcMin()
|
|||||||
m_minWidth = wxMax( m_minWidth, size.x );
|
m_minWidth = wxMax( m_minWidth, size.x );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->GetOption() == 0)
|
if (item->GetProportion() == 0)
|
||||||
{
|
{
|
||||||
if (m_orient == wxVERTICAL)
|
if (m_orient == wxVERTICAL)
|
||||||
{
|
{
|
||||||
@ -1221,7 +1337,7 @@ wxSize wxBoxSizer::CalcMin()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxSize( m_minWidth, m_minHeight );
|
return wxSize( m_minWidth, m_minHeight );
|
||||||
@ -1235,14 +1351,14 @@ wxSize wxBoxSizer::CalcMin()
|
|||||||
|
|
||||||
wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox *box, int orient )
|
wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox *box, int orient )
|
||||||
: wxBoxSizer( orient )
|
: wxBoxSizer( orient )
|
||||||
|
, m_staticBox( box )
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( box, wxT("wxStaticBoxSizer needs a static box") );
|
wxASSERT_MSG( box, wxT("wxStaticBoxSizer needs a static box") );
|
||||||
|
|
||||||
m_staticBox = box;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GetStaticBoxBorders(wxStaticBox *box,
|
static void GetStaticBoxBorders( wxStaticBox *box,
|
||||||
int *borderTop, int *borderOther)
|
int *borderTop,
|
||||||
|
int *borderOther)
|
||||||
{
|
{
|
||||||
// this has to be done platform by platform as there is no way to
|
// this has to be done platform by platform as there is no way to
|
||||||
// guess the thickness of a wxStaticBox border
|
// guess the thickness of a wxStaticBox border
|
||||||
@ -1297,10 +1413,9 @@ wxSize wxStaticBoxSizer::CalcMin()
|
|||||||
#if wxUSE_NOTEBOOK
|
#if wxUSE_NOTEBOOK
|
||||||
|
|
||||||
wxNotebookSizer::wxNotebookSizer( wxNotebook *nb )
|
wxNotebookSizer::wxNotebookSizer( wxNotebook *nb )
|
||||||
|
: m_notebook( nb )
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( nb, wxT("wxNotebookSizer needs a notebook") );
|
wxASSERT_MSG( nb, wxT("wxNotebookSizer needs a notebook") );
|
||||||
|
|
||||||
m_notebook = nb;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxNotebookSizer::RecalcSizes()
|
void wxNotebookSizer::RecalcSizes()
|
||||||
|
@ -269,7 +269,7 @@ void wxTextValidator::OnChar(wxKeyEvent& event)
|
|||||||
|
|
||||||
if ( m_validatorWindow )
|
if ( m_validatorWindow )
|
||||||
{
|
{
|
||||||
int keyCode = (int)event.KeyCode();
|
int keyCode = event.GetKeyCode();
|
||||||
|
|
||||||
// we don't filter special keys and Delete
|
// we don't filter special keys and Delete
|
||||||
if (
|
if (
|
||||||
|
@ -274,7 +274,7 @@ wxWindowBase::~wxWindowBase()
|
|||||||
#endif // wxUSE_CONSTRAINTS
|
#endif // wxUSE_CONSTRAINTS
|
||||||
|
|
||||||
if ( m_containingSizer )
|
if ( m_containingSizer )
|
||||||
m_containingSizer->Remove((wxWindow*)this);
|
m_containingSizer->Detach( (wxWindow*)this );
|
||||||
|
|
||||||
if ( m_windowSizer )
|
if ( m_windowSizer )
|
||||||
delete m_windowSizer;
|
delete m_windowSizer;
|
||||||
|
@ -1571,7 +1571,7 @@ void wxCalendarCtrl::OnYearChange(wxCommandEvent& event)
|
|||||||
void wxCalendarCtrl::OnChar(wxKeyEvent& event)
|
void wxCalendarCtrl::OnChar(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
wxDateTime target;
|
wxDateTime target;
|
||||||
switch ( event.KeyCode() )
|
switch ( event.GetKeyCode() )
|
||||||
{
|
{
|
||||||
case _T('+'):
|
case _T('+'):
|
||||||
case WXK_ADD:
|
case WXK_ADD:
|
||||||
|
@ -923,7 +923,7 @@ void wxGridCellNumberEditor::StartingKey(wxKeyEvent& event)
|
|||||||
{
|
{
|
||||||
if ( !HasRange() )
|
if ( !HasRange() )
|
||||||
{
|
{
|
||||||
int keycode = (int) event.KeyCode();
|
int keycode = event.GetKeyCode();
|
||||||
if ( isdigit(keycode) || keycode == '+' || keycode == '-'
|
if ( isdigit(keycode) || keycode == '+' || keycode == '-'
|
||||||
|| keycode == WXK_NUMPAD0
|
|| keycode == WXK_NUMPAD0
|
||||||
|| keycode == WXK_NUMPAD1
|
|| keycode == WXK_NUMPAD1
|
||||||
@ -1063,7 +1063,7 @@ void wxGridCellFloatEditor::Reset()
|
|||||||
|
|
||||||
void wxGridCellFloatEditor::StartingKey(wxKeyEvent& event)
|
void wxGridCellFloatEditor::StartingKey(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
int keycode = (int)event.KeyCode();
|
int keycode = event.GetKeyCode();
|
||||||
if ( isdigit(keycode) || keycode == '+' || keycode == '-' || keycode == '.'
|
if ( isdigit(keycode) || keycode == '+' || keycode == '-' || keycode == '.'
|
||||||
|| keycode == WXK_NUMPAD0
|
|| keycode == WXK_NUMPAD0
|
||||||
|| keycode == WXK_NUMPAD1
|
|| keycode == WXK_NUMPAD1
|
||||||
@ -1495,7 +1495,7 @@ wxString wxGridCellChoiceEditor::GetValue() const
|
|||||||
|
|
||||||
void wxGridCellEditorEvtHandler::OnKeyDown(wxKeyEvent& event)
|
void wxGridCellEditorEvtHandler::OnKeyDown(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
switch ( event.KeyCode() )
|
switch ( event.GetKeyCode() )
|
||||||
{
|
{
|
||||||
case WXK_ESCAPE:
|
case WXK_ESCAPE:
|
||||||
m_editor->Reset();
|
m_editor->Reset();
|
||||||
@ -1520,7 +1520,7 @@ void wxGridCellEditorEvtHandler::OnKeyDown(wxKeyEvent& event)
|
|||||||
|
|
||||||
void wxGridCellEditorEvtHandler::OnChar(wxKeyEvent& event)
|
void wxGridCellEditorEvtHandler::OnChar(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
switch ( event.KeyCode() )
|
switch ( event.GetKeyCode() )
|
||||||
{
|
{
|
||||||
case WXK_ESCAPE:
|
case WXK_ESCAPE:
|
||||||
case WXK_TAB:
|
case WXK_TAB:
|
||||||
@ -6082,7 +6082,7 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
|
|||||||
|
|
||||||
// try local handlers
|
// try local handlers
|
||||||
//
|
//
|
||||||
switch ( event.KeyCode() )
|
switch ( event.GetKeyCode() )
|
||||||
{
|
{
|
||||||
case WXK_UP:
|
case WXK_UP:
|
||||||
if ( event.ControlDown() )
|
if ( event.ControlDown() )
|
||||||
@ -6247,7 +6247,7 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
|
|||||||
|
|
||||||
// <F2> is special and will always start editing, for
|
// <F2> is special and will always start editing, for
|
||||||
// other keys - ask the editor itself
|
// other keys - ask the editor itself
|
||||||
if ( (event.KeyCode() == WXK_F2 && !event.HasModifiers())
|
if ( (event.GetKeyCode() == WXK_F2 && !event.HasModifiers())
|
||||||
|| editor->IsAcceptedKey(event) )
|
|| editor->IsAcceptedKey(event) )
|
||||||
{
|
{
|
||||||
// ensure cell is visble
|
// ensure cell is visble
|
||||||
@ -6285,7 +6285,7 @@ void wxGrid::OnKeyUp( wxKeyEvent& event )
|
|||||||
{
|
{
|
||||||
// try local handlers
|
// try local handlers
|
||||||
//
|
//
|
||||||
if ( event.KeyCode() == WXK_SHIFT )
|
if ( event.GetKeyCode() == WXK_SHIFT )
|
||||||
{
|
{
|
||||||
if ( m_selectingTopLeft != wxGridNoCellCoords &&
|
if ( m_selectingTopLeft != wxGridNoCellCoords &&
|
||||||
m_selectingBottomRight != wxGridNoCellCoords )
|
m_selectingBottomRight != wxGridNoCellCoords )
|
||||||
|
@ -3408,7 +3408,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
|
|||||||
wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() );
|
wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() );
|
||||||
le.m_itemIndex = m_current;
|
le.m_itemIndex = m_current;
|
||||||
GetLine(m_current)->GetItem( 0, le.m_item );
|
GetLine(m_current)->GetItem( 0, le.m_item );
|
||||||
le.m_code = (int)event.KeyCode();
|
le.m_code = event.GetKeyCode();
|
||||||
le.SetEventObject( parent );
|
le.SetEventObject( parent );
|
||||||
parent->GetEventHandler()->ProcessEvent( le );
|
parent->GetEventHandler()->ProcessEvent( le );
|
||||||
}
|
}
|
||||||
@ -3425,7 +3425,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
|
|||||||
ke.SetEventObject( parent );
|
ke.SetEventObject( parent );
|
||||||
if (parent->GetEventHandler()->ProcessEvent( ke )) return;
|
if (parent->GetEventHandler()->ProcessEvent( ke )) return;
|
||||||
|
|
||||||
if (event.KeyCode() == WXK_TAB)
|
if (event.GetKeyCode() == WXK_TAB)
|
||||||
{
|
{
|
||||||
wxNavigationKeyEvent nevent;
|
wxNavigationKeyEvent nevent;
|
||||||
nevent.SetWindowChange( event.ControlDown() );
|
nevent.SetWindowChange( event.ControlDown() );
|
||||||
@ -3443,7 +3443,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (event.KeyCode())
|
switch (event.GetKeyCode())
|
||||||
{
|
{
|
||||||
case WXK_UP:
|
case WXK_UP:
|
||||||
if ( m_current > 0 )
|
if ( m_current > 0 )
|
||||||
|
@ -998,14 +998,14 @@ void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
m_btnDetails->SetLabel(ms_details + EXPAND_SUFFIX);
|
m_btnDetails->SetLabel(ms_details + EXPAND_SUFFIX);
|
||||||
|
|
||||||
sizer->Remove(m_listctrl);
|
sizer->Detach( m_listctrl );
|
||||||
|
|
||||||
#if wxUSE_STATLINE
|
#if wxUSE_STATLINE
|
||||||
sizer->Remove(m_statline);
|
sizer->Detach( m_statline );
|
||||||
#endif // wxUSE_STATLINE
|
#endif // wxUSE_STATLINE
|
||||||
|
|
||||||
#if wxUSE_FILE
|
#if wxUSE_FILE
|
||||||
sizer->Remove(m_btnSave);
|
sizer->Detach( m_btnSave );
|
||||||
#endif // wxUSE_FILE
|
#endif // wxUSE_FILE
|
||||||
}
|
}
|
||||||
else // show details now
|
else // show details now
|
||||||
|
@ -542,7 +542,7 @@ void wxPropertyListView::ShowListBoxControl(bool show)
|
|||||||
if (show)
|
if (show)
|
||||||
m_middleSizer->Prepend( m_valueList, 0, wxTOP|wxLEFT|wxRIGHT | wxEXPAND, 3 );
|
m_middleSizer->Prepend( m_valueList, 0, wxTOP|wxLEFT|wxRIGHT | wxEXPAND, 3 );
|
||||||
else
|
else
|
||||||
m_middleSizer->Remove( 0 );
|
m_middleSizer->Remove( 0u );
|
||||||
|
|
||||||
m_propertyWindow->Layout();
|
m_propertyWindow->Layout();
|
||||||
}
|
}
|
||||||
|
@ -2529,7 +2529,7 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
|
|||||||
// home : go to root
|
// home : go to root
|
||||||
// end : go to last item without opening parents
|
// end : go to last item without opening parents
|
||||||
// alnum : start or continue searching for the item with this prefix
|
// alnum : start or continue searching for the item with this prefix
|
||||||
int keyCode = event.KeyCode();
|
int keyCode = event.GetKeyCode();
|
||||||
switch ( keyCode )
|
switch ( keyCode )
|
||||||
{
|
{
|
||||||
case '+':
|
case '+':
|
||||||
|
@ -614,7 +614,7 @@ void wxComboBox::SetEditable( bool editable )
|
|||||||
|
|
||||||
void wxComboBox::OnChar( wxKeyEvent &event )
|
void wxComboBox::OnChar( wxKeyEvent &event )
|
||||||
{
|
{
|
||||||
if ( event.KeyCode() == WXK_RETURN )
|
if ( event.GetKeyCode() == WXK_RETURN )
|
||||||
{
|
{
|
||||||
wxString value = GetValue();
|
wxString value = GetValue();
|
||||||
|
|
||||||
|
@ -895,7 +895,7 @@ void wxScrolledWindow::OnChar(wxKeyEvent& event)
|
|||||||
yScrollOld = GetScrollPos(wxVERTICAL);
|
yScrollOld = GetScrollPos(wxVERTICAL);
|
||||||
|
|
||||||
int dsty;
|
int dsty;
|
||||||
switch ( event.KeyCode() )
|
switch ( event.GetKeyCode() )
|
||||||
{
|
{
|
||||||
case WXK_PAGEUP:
|
case WXK_PAGEUP:
|
||||||
case WXK_PRIOR:
|
case WXK_PRIOR:
|
||||||
|
@ -255,7 +255,7 @@ void wxSpinCtrl::OnChar( wxKeyEvent &event )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, wxT("invalid spin ctrl") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid spin ctrl") );
|
||||||
|
|
||||||
if (event.KeyCode() == WXK_RETURN)
|
if (event.GetKeyCode() == WXK_RETURN)
|
||||||
{
|
{
|
||||||
wxWindow *top_frame = m_parent;
|
wxWindow *top_frame = m_parent;
|
||||||
while (top_frame->GetParent() && !(top_frame->GetParent()->IsTopLevel()))
|
while (top_frame->GetParent() && !(top_frame->GetParent()->IsTopLevel()))
|
||||||
|
@ -1175,7 +1175,7 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
|
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
|
||||||
|
|
||||||
if ((key_event.KeyCode() == WXK_RETURN) && (m_windowStyle & wxPROCESS_ENTER))
|
if ((key_event.GetKeyCode() == WXK_RETURN) && (m_windowStyle & wxPROCESS_ENTER))
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
|
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
@ -1183,7 +1183,7 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
|
|||||||
if (GetEventHandler()->ProcessEvent(event)) return;
|
if (GetEventHandler()->ProcessEvent(event)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((key_event.KeyCode() == WXK_RETURN) && !(m_windowStyle & wxTE_MULTILINE))
|
if ((key_event.GetKeyCode() == WXK_RETURN) && !(m_windowStyle & wxTE_MULTILINE))
|
||||||
{
|
{
|
||||||
// This will invoke the dialog default action, such
|
// This will invoke the dialog default action, such
|
||||||
// as the clicking the default button.
|
// as the clicking the default button.
|
||||||
|
@ -614,7 +614,7 @@ void wxComboBox::SetEditable( bool editable )
|
|||||||
|
|
||||||
void wxComboBox::OnChar( wxKeyEvent &event )
|
void wxComboBox::OnChar( wxKeyEvent &event )
|
||||||
{
|
{
|
||||||
if ( event.KeyCode() == WXK_RETURN )
|
if ( event.GetKeyCode() == WXK_RETURN )
|
||||||
{
|
{
|
||||||
wxString value = GetValue();
|
wxString value = GetValue();
|
||||||
|
|
||||||
|
@ -895,7 +895,7 @@ void wxScrolledWindow::OnChar(wxKeyEvent& event)
|
|||||||
yScrollOld = GetScrollPos(wxVERTICAL);
|
yScrollOld = GetScrollPos(wxVERTICAL);
|
||||||
|
|
||||||
int dsty;
|
int dsty;
|
||||||
switch ( event.KeyCode() )
|
switch ( event.GetKeyCode() )
|
||||||
{
|
{
|
||||||
case WXK_PAGEUP:
|
case WXK_PAGEUP:
|
||||||
case WXK_PRIOR:
|
case WXK_PRIOR:
|
||||||
|
@ -255,7 +255,7 @@ void wxSpinCtrl::OnChar( wxKeyEvent &event )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, wxT("invalid spin ctrl") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid spin ctrl") );
|
||||||
|
|
||||||
if (event.KeyCode() == WXK_RETURN)
|
if (event.GetKeyCode() == WXK_RETURN)
|
||||||
{
|
{
|
||||||
wxWindow *top_frame = m_parent;
|
wxWindow *top_frame = m_parent;
|
||||||
while (top_frame->GetParent() && !(top_frame->GetParent()->IsTopLevel()))
|
while (top_frame->GetParent() && !(top_frame->GetParent()->IsTopLevel()))
|
||||||
|
@ -1175,7 +1175,7 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
|
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
|
||||||
|
|
||||||
if ((key_event.KeyCode() == WXK_RETURN) && (m_windowStyle & wxPROCESS_ENTER))
|
if ((key_event.GetKeyCode() == WXK_RETURN) && (m_windowStyle & wxPROCESS_ENTER))
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
|
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
@ -1183,7 +1183,7 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
|
|||||||
if (GetEventHandler()->ProcessEvent(event)) return;
|
if (GetEventHandler()->ProcessEvent(event)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((key_event.KeyCode() == WXK_RETURN) && !(m_windowStyle & wxTE_MULTILINE))
|
if ((key_event.GetKeyCode() == WXK_RETURN) && !(m_windowStyle & wxTE_MULTILINE))
|
||||||
{
|
{
|
||||||
// This will invoke the dialog default action, such
|
// This will invoke the dialog default action, such
|
||||||
// as the clicking the default button.
|
// as the clicking the default button.
|
||||||
|
Loading…
Reference in New Issue
Block a user