// ----------------------------------------------------------------------------
// the default initialization
// ----------------------------------------------------------------------------
// the default initialization
{
// no window yet, no parent nor children
m_parent = (wxWindow *)NULL;
{
// no window yet, no parent nor children
m_parent = (wxWindow *)NULL;
const wxPoint& WXUNUSED(pos),
const wxSize& WXUNUSED(size),
long style,
const wxPoint& WXUNUSED(pos),
const wxSize& WXUNUSED(size),
long style,
// Just in case we've loaded a top-level window via LoadNativeDialog but
// we weren't a dialog class
// Just in case we've loaded a top-level window via LoadNativeDialog but
// we weren't a dialog class
}
bool wxWindowBase::Close(bool force)
{
wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId);
event.SetEventObject(this);
}
bool wxWindowBase::Close(bool force)
{
wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId);
event.SetEventObject(this);
// close event
return GetEventHandler()->ProcessEvent(event) && !event.GetVeto();
}
bool wxWindowBase::DestroyChildren()
{
// close event
return GetEventHandler()->ProcessEvent(event) && !event.GetVeto();
}
bool wxWindowBase::DestroyChildren()
{
- wxASSERT_MSG( child, wxT("children list contains empty nodes") );
-
- child->Show(FALSE);
+ // note that we really want to call delete and not ->Destroy() here
+ // because we want to delete the child immediately, before we are
+ // deleted, and delayed deletion would result in problems as our (top
+ // level) child could outlive its parent
delete child;
wxASSERT_MSG( !GetChildren().Find(child),
wxT("child didn't remove itself using RemoveChild()") );
}
delete child;
wxASSERT_MSG( !GetChildren().Find(child),
wxT("child didn't remove itself using RemoveChild()") );
}
// this should never happen and it will lead to a crash later if it does
// because RemoveChild() will remove only one node from the children list
// and the other(s) one(s) will be left with dangling pointers in them
// this should never happen and it will lead to a crash later if it does
// because RemoveChild() will remove only one node from the children list
// and the other(s) one(s) will be left with dangling pointers in them
wxEvtHandler *handlerPrev = NULL,
*handlerCur = GetEventHandler();
wxEvtHandler *handlerPrev = NULL,
*handlerCur = GetEventHandler();
bool wxWindowBase::SetBackgroundColour( const wxColour &colour )
{
if ( !colour.Ok() || (colour == m_backgroundColour) )
bool wxWindowBase::SetBackgroundColour( const wxColour &colour )
{
if ( !colour.Ok() || (colour == m_backgroundColour) )
}
bool wxWindowBase::SetForegroundColour( const wxColour &colour )
{
if ( !colour.Ok() || (colour == m_foregroundColour) )
}
bool wxWindowBase::SetForegroundColour( const wxColour &colour )
{
if ( !colour.Ok() || (colour == m_foregroundColour) )
return m_updateRegion.Contains(x, y, w, h) != wxOutRegion;
}
return m_updateRegion.Contains(x, y, w, h) != wxOutRegion;
}
+void wxWindowBase::ClearBackground()
+{
+ // wxGTK uses its own version, no need to add never used code
+#ifndef __WXGTK__
+ wxClientDC dc((wxWindow *)this);
+ wxBrush brush(GetBackgroundColour(), wxSOLID);
+ dc.SetBackground(brush);
+ dc.Clear();
+#endif // __WXGTK__
+}
+
// ----------------------------------------------------------------------------
// find child window by id or name
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// find child window by id or name
// ----------------------------------------------------------------------------
for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() )
{
wxWindowBase *child = node->GetData();
for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() )
{
wxWindowBase *child = node->GetData();
for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() )
{
wxWindow *child = node->GetData();
for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() )
{
wxWindow *child = node->GetData();
return (wxWindow *)parent;
// It wasn't, so check all its children
return (wxWindow *)parent;
// It wasn't, so check all its children
for ( node = m_children.GetFirst(); node; node = node->GetNext() )
{
wxWindowBase *child = node->GetData();
wxValidator *validator = child->GetValidator();
if ( validator && !validator->Validate((wxWindow *)this) )
{
for ( node = m_children.GetFirst(); node; node = node->GetNext() )
{
wxWindowBase *child = node->GetData();
wxValidator *validator = child->GetValidator();
if ( validator && !validator->Validate((wxWindow *)this) )
{
for ( node = m_children.GetFirst(); node; node = node->GetNext() )
{
wxWindowBase *child = node->GetData();
for ( node = m_children.GetFirst(); node; node = node->GetNext() )
{
wxWindowBase *child = node->GetData();
for ( node = m_children.GetFirst(); node; node = node->GetNext() )
{
wxWindow *child = node->GetData();
for ( node = m_children.GetFirst(); node; node = node->GetNext() )
{
wxWindow *child = node->GetData();
// nop warning here because the application is supposed to give
// one itself - we don't know here what might have gone wrongly
// nop warning here because the application is supposed to give
// one itself - we don't know here what might have gone wrongly
- if ( !m_constraintsInvolvedIn->Find(otherWin) )
- m_constraintsInvolvedIn->Append(otherWin);
+ if ( !m_constraintsInvolvedIn->Find((wxWindow *)otherWin) )
+ m_constraintsInvolvedIn->Append((wxWindow *)otherWin);
}
// REMOVE back-pointer to other windows we're involved with.
void wxWindowBase::RemoveConstraintReference(wxWindowBase *otherWin)
{
if ( m_constraintsInvolvedIn )
}
// REMOVE back-pointer to other windows we're involved with.
void wxWindowBase::RemoveConstraintReference(wxWindowBase *otherWin)
{
if ( m_constraintsInvolvedIn )
- constr->left.SetDone(FALSE);
- constr->top.SetDone(FALSE);
- constr->right.SetDone(FALSE);
- constr->bottom.SetDone(FALSE);
- constr->width.SetDone(FALSE);
- constr->height.SetDone(FALSE);
- constr->centreX.SetDone(FALSE);
- constr->centreY.SetDone(FALSE);
+ constr->left.SetDone(false);
+ constr->top.SetDone(false);
+ constr->right.SetDone(false);
+ constr->bottom.SetDone(false);
+ constr->width.SetDone(false);
+ constr->height.SetDone(false);
+ constr->centreX.SetDone(false);
+ constr->centreY.SetDone(false);
// ----------------------------------------------------------------------------
// dialog units translations
// ----------------------------------------------------------------------------
// dialog units translations
// propagate the colour change event to the subwindows
void wxWindowBase::OnSysColourChanged(wxSysColourChangedEvent& event)
{
// propagate the colour change event to the subwindows
void wxWindowBase::OnSysColourChanged(wxSysColourChangedEvent& event)
{
// ----------------------------------------------------------------------------
// list classes implementation
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// list classes implementation
// ----------------------------------------------------------------------------
//else: stack is empty, no previous capture
wxLogTrace(_T("mousecapture"),
//else: stack is empty, no previous capture
wxLogTrace(_T("mousecapture"),
// Can only use the validator of the window which
// is receiving the event
if ( event.GetEventObject() == this )
// Can only use the validator of the window which
// is receiving the event
if ( event.GetEventObject() == this )
- // Carry on up the parent-child hierarchy, but only if event is a command
- // event: it wouldn't make sense for a parent to receive a child's size
- // event, for example
- if ( event.IsCommandEvent() )
+ // carry on up the parent-child hierarchy if the propgation count hasn't
+ // reached zero yet
+ if ( event.ShouldPropagate() )
{
// honour the requests to stop propagation at this window: this is
// used by the dialogs, for example, to prevent processing the events
{
// honour the requests to stop propagation at this window: this is
// used by the dialogs, for example, to prevent processing the events
// Can return either a child object, or an integer
// representing the child element, starting from 1.
// Can return either a child object, or an integer
// representing the child element, starting from 1.
-wxAccStatus wxWindowAccessible::HitTest(const wxPoint& pt, int* childId, wxAccessible** childObject)
+wxAccStatus wxWindowAccessible::HitTest(const wxPoint& WXUNUSED(pt), int* WXUNUSED(childId), wxAccessible** WXUNUSED(childObject))
// Navigates from fromId to toId/toObject.
wxAccStatus wxWindowAccessible::Navigate(wxNavDir navDir, int fromId,
// Navigates from fromId to toId/toObject.
wxAccStatus wxWindowAccessible::Navigate(wxNavDir navDir, int fromId,
// or > 0 (the action for a child).
// Return wxACC_NOT_SUPPORTED if there is no default action for this
// window (e.g. an edit control).
// or > 0 (the action for a child).
// Return wxACC_NOT_SUPPORTED if there is no default action for this
// window (e.g. an edit control).
// The retrieved string describes the action that is performed on an object,
// not what the object does as a result. For example, a toolbar button that prints
// a document has a default action of "Press" rather than "Prints the current document."
// The retrieved string describes the action that is performed on an object,
// not what the object does as a result. For example, a toolbar button that prints
// a document has a default action of "Press" rather than "Prints the current document."
// If childId is 0 and child is NULL, no object in
// this subhierarchy has the focus.
// If this object has the focus, child should be 'this'.
// If childId is 0 and child is NULL, no object in
// this subhierarchy has the focus.
// If this object has the focus, child should be 'this'.
// - an integer representing the selected child element,
// or 0 if this object is selected (GetType() == wxT("long")
// - a "void*" pointer to a wxAccessible child object
// - an integer representing the selected child element,
// or 0 if this object is selected (GetType() == wxT("long")
// - a "void*" pointer to a wxAccessible child object