// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "windowbase.h"
#endif
EVT_MIDDLE_DOWN(wxWindowBase::OnMiddleClick)
#if wxUSE_HELP
- EVT_HELP(-1, wxWindowBase::OnHelp)
+ EVT_HELP(wxID_ANY, wxWindowBase::OnHelp)
#endif // wxUSE_HELP
END_EVENT_TABLE()
// ----------------------------------------------------------------------------
// the default initialization
-void wxWindowBase::InitBase()
+wxWindowBase::wxWindowBase()
{
// no window yet, no parent nor children
m_parent = (wxWindow *)NULL;
- m_windowId = -1;
- m_children.DeleteContents( FALSE ); // don't auto delete node data
+ m_windowId = wxID_ANY;
// no constraints on the minimal window size
m_minWidth =
m_maxHeight = -1;
// window is created enabled but it's not visible yet
- m_isShown = FALSE;
- m_isEnabled = TRUE;
+ m_isShown = false;
+ m_isEnabled = true;
// the default event handler is just this window
m_eventHandler = this;
// the colours/fonts are default for now
m_hasBgCol =
m_hasFgCol =
- m_hasFont = FALSE;
-
- m_isBeingDeleted = FALSE;
+ m_hasFont = false;
+
+ m_isBeingDeleted = false;
// no style bits
m_exStyle =
m_windowStyle = 0;
- // an optimization for the event processing: checking this flag is much
- // faster than using IsKindOf(CLASSINFO(wxWindow))
- m_isWindow = TRUE;
-
#if wxUSE_CONSTRAINTS
// no constraints whatsoever
m_constraints = (wxLayoutConstraints *) NULL;
m_windowSizer = (wxSizer *) NULL;
m_containingSizer = (wxSizer *) NULL;
- m_autoLayout = FALSE;
+ m_autoLayout = false;
#if wxUSE_DRAG_AND_DROP
m_dropTarget = (wxDropTarget *)NULL;
#endif // wxUSE_CARET
#if wxUSE_PALETTE
- m_hasCustomPalette = FALSE;
+ m_hasCustomPalette = false;
#endif // wxUSE_PALETTE
#if wxUSE_ACCESSIBILITY
m_maxVirtualHeight = -1;
// Whether we're using the current theme for this window (wxGTK only for now)
- m_themeEnabled = FALSE;
+ m_themeEnabled = false;
}
// common part of window creation process
const wxPoint& WXUNUSED(pos),
const wxSize& WXUNUSED(size),
long style,
- const wxValidator& validator,
+ const wxValidator& wxVALIDATOR_PARAM(validator),
const wxString& name)
{
- // m_isWindow is set to TRUE in wxWindowBase::Init() as well as many other
- // member variables - check that it has been called (will catch the case
- // when a new ctor is added which doesn't call InitWindow)
- wxASSERT_MSG( m_isWindow, wxT("Init() must have been called before!") );
-
#if wxUSE_STATBOX
// wxGTK doesn't allow to create controls with static box as the parent so
// this will result in a crash when the program is ported to wxGTK so warn
SetExtraStyle(GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY);
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
// Just in case we've loaded a top-level window via LoadNativeDialog but
// we weren't a dialog class
- wxTopLevelWindows.DeleteObject(this);
+ wxTopLevelWindows.DeleteObject((wxWindow*)this);
wxASSERT_MSG( GetChildren().GetCount() == 0, wxT("children not destroyed") );
+ // reset the dangling pointer our parent window may keep to us
+ if ( m_parent )
+ {
+ if ( m_parent->GetDefaultItem() == this )
+ {
+ m_parent->SetDefaultItem(NULL);
+ }
+
+ m_parent->RemoveChild(this);
+ }
+
#if wxUSE_CARET
- if ( m_caret )
- delete m_caret;
+ delete m_caret;
#endif // wxUSE_CARET
#if wxUSE_VALIDATORS
- if ( m_windowValidator )
- delete m_windowValidator;
+ delete m_windowValidator;
#endif // wxUSE_VALIDATORS
#if wxUSE_CONSTRAINTS
delete m_constraints;
m_constraints = NULL;
}
-
#endif // wxUSE_CONSTRAINTS
if ( m_containingSizer )
m_containingSizer->Detach( (wxWindow*)this );
- if ( m_windowSizer )
- delete m_windowSizer;
+ delete m_windowSizer;
#if wxUSE_DRAG_AND_DROP
- if ( m_dropTarget )
- delete m_dropTarget;
+ delete m_dropTarget;
#endif // wxUSE_DRAG_AND_DROP
#if wxUSE_TOOLTIPS
- if ( m_tooltip )
- delete m_tooltip;
+ delete m_tooltip;
#endif // wxUSE_TOOLTIPS
#if wxUSE_ACCESSIBILITY
- if ( m_accessible )
- delete m_accessible;
+ delete m_accessible;
#endif
-
- // reset the dangling pointer our parent window may keep to us
- if ( m_parent && m_parent->GetDefaultItem() == this )
- {
- m_parent->SetDefaultItem(NULL);
- }
}
bool wxWindowBase::Destroy()
{
delete this;
- return TRUE;
+ return true;
}
bool wxWindowBase::Close(bool force)
{
wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId);
event.SetEventObject(this);
-#if WXWIN_COMPATIBILITY
- event.SetForce(force);
-#endif // WXWIN_COMPATIBILITY
event.SetCanVeto(!force);
- // return FALSE if window wasn't closed because the application vetoed the
+ // return false if window wasn't closed because the application vetoed the
// close event
return GetEventHandler()->ProcessEvent(event) && !event.GetVeto();
}
bool wxWindowBase::DestroyChildren()
{
- wxWindowList::Node *node;
+ wxWindowList::compatibility_iterator node;
for ( ;; )
{
// we iterate until the list becomes empty
wxWindow *child = node->GetData();
- 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()") );
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
int maxX = 0,
maxY = 0;
- for ( wxWindowList::Node *node = GetChildren().GetFirst();
+ for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node;
node = node->GetNext() )
{
int maxX = 0,
maxY = 0;
- for ( wxWindowList::Node *node = GetChildren().GetFirst();
+ for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node;
node = node->GetNext() )
{
{
m_isShown = show;
- return TRUE;
+ return true;
}
else
{
- return FALSE;
+ return false;
}
}
{
m_isEnabled = enable;
- return TRUE;
+ return true;
}
else
{
- return FALSE;
+ return false;
}
}
// ----------------------------------------------------------------------------
bool wxWindowBase::IsTopLevel() const
{
- return FALSE;
+ return false;
}
// ----------------------------------------------------------------------------
// 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
- wxASSERT_MSG( !GetChildren().Find(child), _T("AddChild() called twice") );
+ wxASSERT_MSG( !GetChildren().Find((wxWindow*)child), _T("AddChild() called twice") );
- GetChildren().Append(child);
+ GetChildren().Append((wxWindow*)child);
child->SetParent(this);
}
{
wxCHECK_RET( child, wxT("can't remove a NULL child") );
- GetChildren().DeleteObject(child);
- child->SetParent((wxWindow *)NULL);
+ GetChildren().DeleteObject((wxWindow *)child);
+ child->SetParent(NULL);
}
bool wxWindowBase::Reparent(wxWindowBase *newParent)
if ( newParent == oldParent )
{
// nothing done
- return FALSE;
+ return false;
}
// unlink this window from the existing parent.
}
else
{
- wxTopLevelWindows.DeleteObject(this);
+ wxTopLevelWindows.DeleteObject((wxWindow *)this);
}
// add it to the new one
}
else
{
- wxTopLevelWindows.Append(this);
+ wxTopLevelWindows.Append((wxWindow *)this);
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
bool wxWindowBase::RemoveEventHandler(wxEvtHandler *handler)
{
- wxCHECK_MSG( handler, FALSE, _T("RemoveEventHandler(NULL) called") );
+ wxCHECK_MSG( handler, false, _T("RemoveEventHandler(NULL) called") );
wxEvtHandler *handlerPrev = NULL,
*handlerCur = GetEventHandler();
{
handlerNext->SetPreviousHandler ( handlerPrev );
}
+
handler->SetNextHandler(NULL);
+ handler->SetPreviousHandler(NULL);
- return TRUE;
+ return true;
}
handlerPrev = handlerCur;
wxFAIL_MSG( _T("where has the event handler gone?") );
- return FALSE;
+ return false;
}
// ----------------------------------------------------------------------------
bool wxWindowBase::SetBackgroundColour( const wxColour &colour )
{
if ( !colour.Ok() || (colour == m_backgroundColour) )
- return FALSE;
+ return false;
m_backgroundColour = colour;
- m_hasBgCol = TRUE;
+ m_hasBgCol = true;
- return TRUE;
+ return true;
}
bool wxWindowBase::SetForegroundColour( const wxColour &colour )
{
if ( !colour.Ok() || (colour == m_foregroundColour) )
- return FALSE;
+ return false;
m_foregroundColour = colour;
- m_hasFgCol = TRUE;
+ m_hasFgCol = true;
- return TRUE;
+ return true;
}
bool wxWindowBase::SetCursor(const wxCursor& cursor)
if ( m_cursor == cursor )
{
// no change
- return FALSE;
+ return false;
}
m_cursor = cursor;
- return TRUE;
+ return true;
}
bool wxWindowBase::SetFont(const wxFont& font)
if ( fontOk == m_font )
{
// no change
- return FALSE;
+ return false;
}
m_font = fontOk;
- m_hasFont = TRUE;
+ m_hasFont = true;
- return TRUE;
+ return true;
}
#if wxUSE_PALETTE
void wxWindowBase::SetPalette(const wxPalette& pal)
{
- m_hasCustomPalette = TRUE;
+ m_hasCustomPalette = true;
m_palette = pal;
// VZ: can anyone explain me what do we do here?
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
// ----------------------------------------------------------------------------
return (wxWindow *)this;
wxWindowBase *res = (wxWindow *)NULL;
- wxWindowList::Node *node;
+ wxWindowList::compatibility_iterator node;
for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() )
{
wxWindowBase *child = node->GetData();
return (wxWindow *)this;
wxWindowBase *res = (wxWindow *)NULL;
- wxWindowList::Node *node;
+ wxWindowList::compatibility_iterator node;
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
- for ( wxWindowList::Node * node = parent->GetChildren().GetFirst();
+ for ( wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst();
node;
node = node->GetNext() )
{
}
// start at very top of wx's windows
- for ( wxWindowList::Node * node = wxTopLevelWindows.GetFirst();
+ for ( wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
node;
node = node->GetNext() )
{
// Disable all other windows
if ( IsTopLevel() )
{
- wxWindowList::Node *node = wxTopLevelWindows.GetFirst();
+ wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
while (node)
{
wxWindow *win = node->GetData();
#if wxUSE_VALIDATORS
bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0;
- wxWindowList::Node *node;
+ wxWindowList::compatibility_iterator node;
for ( node = m_children.GetFirst(); node; node = node->GetNext() )
{
wxWindowBase *child = node->GetData();
wxValidator *validator = child->GetValidator();
if ( validator && !validator->Validate((wxWindow *)this) )
{
- return FALSE;
+ return false;
}
if ( recurse && !child->Validate() )
{
- return FALSE;
+ return false;
}
}
#endif // wxUSE_VALIDATORS
- return TRUE;
+ return true;
}
bool wxWindowBase::TransferDataToWindow()
#if wxUSE_VALIDATORS
bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0;
- wxWindowList::Node *node;
+ wxWindowList::compatibility_iterator node;
for ( node = m_children.GetFirst(); node; node = node->GetNext() )
{
wxWindowBase *child = node->GetData();
wxLog::FlushActive();
#endif // wxUSE_LOG
- return FALSE;
+ return false;
}
if ( recurse )
if ( !child->TransferDataToWindow() )
{
// warning already given
- return FALSE;
+ return false;
}
}
}
#endif // wxUSE_VALIDATORS
- return TRUE;
+ return true;
}
bool wxWindowBase::TransferDataFromWindow()
#if wxUSE_VALIDATORS
bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0;
- wxWindowList::Node *node;
+ wxWindowList::compatibility_iterator node;
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
- return FALSE;
+ return false;
}
if ( recurse )
if ( !child->TransferDataFromWindow() )
{
// warning already given
- return FALSE;
+ return false;
}
}
}
#endif // wxUSE_VALIDATORS
- return TRUE;
+ return true;
}
void wxWindowBase::InitDialog()
{
if ( !m_constraintsInvolvedIn )
m_constraintsInvolvedIn = new wxWindowList;
- 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 )
- m_constraintsInvolvedIn->DeleteObject(otherWin);
+ m_constraintsInvolvedIn->DeleteObject((wxWindow *)otherWin);
}
// Reset any constraints that mention this window
{
if ( m_constraintsInvolvedIn )
{
- wxWindowList::Node *node = m_constraintsInvolvedIn->GetFirst();
+ wxWindowList::compatibility_iterator node = m_constraintsInvolvedIn->GetFirst();
while (node)
{
wxWindow *win = node->GetData();
constr->centreY.ResetIfWin(this);
}
- wxWindowList::Node *next = node->GetNext();
- delete node;
+ wxWindowList::compatibility_iterator next = node->GetNext();
+ m_constraintsInvolvedIn->Erase(node);
node = next;
}
void wxWindowBase::SetSizer(wxSizer *sizer, bool deleteOld)
{
+ if ( sizer == m_windowSizer)
+ return;
+
if ( deleteOld )
delete m_windowSizer;
}
#endif
- return TRUE;
+ return true;
}
#if wxUSE_CONSTRAINTS
// Layout grand children
DoPhase(2);
- return TRUE;
+ return true;
}
// Do a phase of evaluating child constraints
int noChanges = 0;
// loop over all children setting their constraints
- for ( wxWindowList::Node *node = GetChildren().GetFirst();
+ for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node;
node = node->GetNext() )
{
}
}
- return TRUE;
+ return true;
}
void wxWindowBase::ResetConstraints()
wxLayoutConstraints *constr = GetConstraints();
if ( constr )
{
- 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);
}
- wxWindowList::Node *node = GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while (node)
{
wxWindow *win = node->GetData();
if ( recurse )
{
- wxWindowList::Node *node = GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while (node)
{
wxWindow *win = node->GetData();
if ( x != -1 )
{
constr->left.SetValue(x);
- constr->left.SetDone(TRUE);
+ constr->left.SetDone(true);
}
if ( y != -1 )
{
constr->top.SetValue(y);
- constr->top.SetDone(TRUE);
+ constr->top.SetDone(true);
}
if ( w != -1 )
{
constr->width.SetValue(w);
- constr->width.SetDone(TRUE);
+ constr->width.SetDone(true);
}
if ( h != -1 )
{
constr->height.SetValue(h);
- constr->height.SetDone(TRUE);
+ constr->height.SetDone(true);
}
}
}
if ( x != -1 )
{
constr->left.SetValue(x);
- constr->left.SetDone(TRUE);
+ constr->left.SetDone(true);
}
if ( y != -1 )
{
constr->top.SetValue(y);
- constr->top.SetDone(TRUE);
+ constr->top.SetDone(true);
}
}
}
// do Update UI processing for child controls
// ----------------------------------------------------------------------------
-// TODO: should this be implemented for the child window rather
-// than the parent? Then you can override it e.g. for wxCheckBox
-// to do the Right Thing rather than having to assume a fixed number
-// of control classes.
-void wxWindowBase::UpdateWindowUI()
+void wxWindowBase::UpdateWindowUI(long flags)
{
-#if wxUSE_CONTROLS
wxUpdateUIEvent event(GetId());
event.m_eventObject = this;
if ( GetEventHandler()->ProcessEvent(event) )
{
- if ( event.GetSetEnabled() )
- Enable(event.GetEnabled());
+ DoUpdateWindowUI(event);
+ }
- if ( event.GetSetText() )
+ if (flags & wxUPDATE_UI_RECURSE)
+ {
+ wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
+ while (node)
{
- wxControl *control = wxDynamicCastThis(wxControl);
- if ( control )
- {
-#if wxUSE_TEXTCTRL
- wxTextCtrl *text = wxDynamicCast(control, wxTextCtrl);
- if ( text )
- {
- if ( event.GetText() != text->GetValue() )
- text->SetValue(event.GetText());
- }
- else
-#endif // wxUSE_TEXTCTRL
- {
- if ( event.GetText() != control->GetLabel() )
- control->SetLabel(event.GetText());
- }
- }
+ wxWindow* child = (wxWindow*) node->GetData();
+ child->UpdateWindowUI(flags);
+ node = node->GetNext();
}
+ }
+}
+// do the window-specific processing after processing the update event
+// TODO: take specific knowledge out of this function and
+// put in each control's base class. Unfortunately we don't
+// yet have base implementation files for wxCheckBox and wxRadioButton.
+void wxWindowBase::DoUpdateWindowUI(wxUpdateUIEvent& event)
+{
+ if ( event.GetSetEnabled() )
+ Enable(event.GetEnabled());
+
+#if wxUSE_CONTROLS
+ if ( event.GetSetText() )
+ {
+ wxControl *control = wxDynamicCastThis(wxControl);
+ if ( control )
+ {
+ if ( event.GetText() != control->GetLabel() )
+ control->SetLabel(event.GetText());
+ }
#if wxUSE_CHECKBOX
wxCheckBox *checkbox = wxDynamicCastThis(wxCheckBox);
if ( checkbox )
}
#endif // wxUSE_RADIOBTN
}
-#endif // wxUSE_CONTROLS
+#endif
+}
+
+#if 0
+// call internal idle recursively
+// may be obsolete (wait until OnIdle scheme stabilises)
+void wxWindowBase::ProcessInternalIdle()
+{
+ OnInternalIdle();
+
+ wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
+ while (node)
+ {
+ wxWindow *child = node->GetData();
+ child->ProcessInternalIdle();
+ node = node->GetNext();
+ }
}
+#endif
// ----------------------------------------------------------------------------
// dialog units translations
// propagate the colour change event to the subwindows
void wxWindowBase::OnSysColourChanged(wxSysColourChangedEvent& event)
{
- wxWindowList::Node *node = GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( node )
{
// Only propagate to non-top-level windows
}
}
-// the default action is to populate dialog with data when it's created
+// the default action is to populate dialog with data when it's created,
+// and nudge the UI into displaying itself correctly in case
+// we've turned the wxUpdateUIEvents frequency down low.
void wxWindowBase::OnInitDialog( wxInitDialogEvent &WXUNUSED(event) )
{
TransferDataToWindow();
+
+ // Update the UI at this point
+ UpdateWindowUI(wxUPDATE_UI_RECURSE);
}
// process Ctrl-Alt-mclick
#endif
+#if !wxUSE_STL
// ----------------------------------------------------------------------------
// list classes implementation
// ----------------------------------------------------------------------------
{
delete (wxWindow *)GetData();
}
+#endif
// ----------------------------------------------------------------------------
// borders
// ----------------------------------------------------------------------------
-wxBorder wxWindowBase::GetBorder() const
+wxBorder wxWindowBase::GetBorder(long flags) const
{
- wxBorder border = (wxBorder)(m_windowStyle & wxBORDER_MASK);
+ wxBorder border = (wxBorder)(flags & wxBORDER_MASK);
if ( border == wxBORDER_DEFAULT )
{
border = GetDefaultBorder();
//else: stack is empty, no previous capture
wxLogTrace(_T("mousecapture"),
- _T("After ReleaseMouse() mouse is captured by %p"),
- GetCapture());
+ (const wxChar *) _T("After ReleaseMouse() mouse is captured by %p"),
+ GetCapture());
}
+#if wxUSE_HOTKEY
+
+bool
+wxWindowBase::RegisterHotKey(int WXUNUSED(hotkeyId),
+ int WXUNUSED(modifiers),
+ int WXUNUSED(keycode))
+{
+ // not implemented
+ return false;
+}
+
+bool wxWindowBase::UnregisterHotKey(int WXUNUSED(hotkeyId))
+{
+ // not implemented
+ return false;
+}
+
+#endif // wxUSE_HOTKEY
void wxWindowBase::SendDestroyEvent()
{
GetEventHandler()->ProcessEvent(event);
}
+// ----------------------------------------------------------------------------
+// event processing
+// ----------------------------------------------------------------------------
+
+bool wxWindowBase::TryValidator(wxEvent& wxVALIDATOR_PARAM(event))
+{
+#if wxUSE_VALIDATORS
+ // Can only use the validator of the window which
+ // is receiving the event
+ if ( event.GetEventObject() == this )
+ {
+ wxValidator *validator = GetValidator();
+ if ( validator && validator->ProcessEvent(event) )
+ {
+ return true;
+ }
+ }
+#endif // wxUSE_VALIDATORS
+
+ return false;
+}
+
+bool wxWindowBase::TryParent(wxEvent& event)
+{
+ // 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
+ // from the dialog controls in the parent frame which rarely, if ever,
+ // makes sense
+ if ( !(GetExtraStyle() & wxWS_EX_BLOCK_EVENTS) )
+ {
+ wxWindow *parent = GetParent();
+ if ( parent && !parent->IsBeingDeleted() )
+ {
+ wxPropagateOnce propagateOnce(event);
+
+ return parent->GetEventHandler()->ProcessEvent(event);
+ }
+ }
+ }
+
+ return wxEvtHandler::TryParent(event);
+}
+
// ----------------------------------------------------------------------------
// global functions
// ----------------------------------------------------------------------------
// 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))
{
wxASSERT( GetWindow() != NULL );
if (!GetWindow())
{
if (elementId <= (int) GetWindow()->GetChildren().GetCount())
{
- win = (wxWindow*) GetWindow()->GetChildren().Nth(elementId-1)->GetData();
+ win = GetWindow()->GetChildren().Item(elementId-1)->GetData();
}
else
return wxACC_FAIL;
// Navigates from fromId to toId/toObject.
wxAccStatus wxWindowAccessible::Navigate(wxNavDir navDir, int fromId,
- int* toId, wxAccessible** toObject)
+ int* WXUNUSED(toId), wxAccessible** toObject)
{
wxASSERT( GetWindow() != NULL );
if (!GetWindow())
case wxNAVDIR_DOWN:
case wxNAVDIR_NEXT:
{
- wxWindowList::Node *node = NULL;
+ wxWindowList::compatibility_iterator node =
+ wxWindowList::compatibility_iterator();
if (fromId == 0)
{
// Can't navigate to sibling of this window
else
{
if (fromId <= (int) GetWindow()->GetChildren().GetCount())
- node = (wxWindowList::Node*) GetWindow()->GetChildren().Nth(fromId-1);
+ node = GetWindow()->GetChildren().Item(fromId-1);
}
if (node && node->GetNext())
{
- wxWindow* nextWindow = (wxWindow*) node->GetNext()->Data();
+ wxWindow* nextWindow = node->GetNext()->GetData();
*toObject = nextWindow->GetOrCreateAccessible();
return wxACC_OK;
}
case wxNAVDIR_UP:
case wxNAVDIR_PREVIOUS:
{
- wxWindowList::Node *node = NULL;
+ wxWindowList::compatibility_iterator node =
+ wxWindowList::compatibility_iterator();
if (fromId == 0)
{
// Can't navigate to sibling of this window
else
{
if (fromId <= (int) GetWindow()->GetChildren().GetCount())
- node = (wxWindowList::Node*) GetWindow()->GetChildren().Nth(fromId-1);
+ node = GetWindow()->GetChildren().Item(fromId-1);
}
if (node && node->GetPrevious())
{
- wxWindow* previousWindow = (wxWindow*) node->GetPrevious()->Data();
+ wxWindow* previousWindow = node->GetPrevious()->GetData();
*toObject = previousWindow->GetOrCreateAccessible();
return wxACC_OK;
}
title = ((wxButton*) GetWindow())->GetLabel();
else
title = GetWindow()->GetName();
-
+
if (!title.IsEmpty())
{
*name = title;
if (childId > (int) GetWindow()->GetChildren().GetCount())
return wxACC_FAIL;
- wxWindow* childWindow = (wxWindow*) GetWindow()->GetChildren().Nth(childId-1)->GetData();
+ wxWindow* childWindow = GetWindow()->GetChildren().Item(childId-1)->GetData();
*child = childWindow->GetOrCreateAccessible();
if (*child)
return wxACC_OK;
// 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).
-wxAccStatus wxWindowAccessible::DoDefaultAction(int childId)
+wxAccStatus wxWindowAccessible::DoDefaultAction(int WXUNUSED(childId))
{
wxASSERT( GetWindow() != NULL );
if (!GetWindow())
// 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."
-wxAccStatus wxWindowAccessible::GetDefaultAction(int childId, wxString* actionName)
+wxAccStatus wxWindowAccessible::GetDefaultAction(int WXUNUSED(childId), wxString* WXUNUSED(actionName))
{
wxASSERT( GetWindow() != NULL );
if (!GetWindow())
}
// Returns the description for this object or a child.
-wxAccStatus wxWindowAccessible::GetDescription(int childId, wxString* description)
+wxAccStatus wxWindowAccessible::GetDescription(int WXUNUSED(childId), wxString* description)
{
wxASSERT( GetWindow() != NULL );
if (!GetWindow())
}
// Returns help text for this object or a child, similar to tooltip text.
-wxAccStatus wxWindowAccessible::GetHelpText(int childId, wxString* helpText)
+wxAccStatus wxWindowAccessible::GetHelpText(int WXUNUSED(childId), wxString* helpText)
{
wxASSERT( GetWindow() != NULL );
if (!GetWindow())
// Returns the keyboard shortcut for this object or child.
// Return e.g. ALT+K
-wxAccStatus wxWindowAccessible::GetKeyboardShortcut(int childId, wxString* shortcut)
+wxAccStatus wxWindowAccessible::GetKeyboardShortcut(int WXUNUSED(childId), wxString* WXUNUSED(shortcut))
{
wxASSERT( GetWindow() != NULL );
if (!GetWindow())
*role = wxROLE_SYSTEM_CLIENT;
return wxACC_OK;
+ #if 0
return wxACC_NOT_IMPLEMENTED;
+ #endif
}
// Returns a state constant.
*state = 0;
return wxACC_OK;
+ #if 0
return wxACC_NOT_IMPLEMENTED;
+ #endif
}
// Returns a localized string representing the value for the object
// or child.
-wxAccStatus wxWindowAccessible::GetValue(int childId, wxString* strValue)
+wxAccStatus wxWindowAccessible::GetValue(int WXUNUSED(childId), wxString* WXUNUSED(strValue))
{
wxASSERT( GetWindow() != NULL );
if (!GetWindow())
}
// Selects the object or child.
-wxAccStatus wxWindowAccessible::Select(int childId, wxAccSelectionFlags selectFlags)
+wxAccStatus wxWindowAccessible::Select(int WXUNUSED(childId), wxAccSelectionFlags WXUNUSED(selectFlags))
{
wxASSERT( GetWindow() != NULL );
if (!GetWindow())
// 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'.
-wxAccStatus wxWindowAccessible::GetFocus(int* childId, wxAccessible** child)
+wxAccStatus wxWindowAccessible::GetFocus(int* WXUNUSED(childId), wxAccessible** WXUNUSED(child))
{
wxASSERT( GetWindow() != NULL );
if (!GetWindow())
// - 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
-wxAccStatus wxWindowAccessible::GetSelections(wxVariant* selections)
+wxAccStatus wxWindowAccessible::GetSelections(wxVariant* WXUNUSED(selections))
{
wxASSERT( GetWindow() != NULL );
if (!GetWindow())