// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "windowbase.h"
#endif
const wxPoint& WXUNUSED(pos),
const wxSize& WXUNUSED(size),
long style,
- const wxValidator& validator,
+ const wxValidator& wxVALIDATOR_PARAM(validator),
const wxString& name)
{
#if wxUSE_STATBOX
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()
{
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
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),
{
handlerNext->SetPreviousHandler ( handlerPrev );
}
+
handler->SetNextHandler(NULL);
+ handler->SetPreviousHandler(NULL);
return TRUE;
}
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
// ----------------------------------------------------------------------------
// event processing
// ----------------------------------------------------------------------------
-#if wxUSE_VALIDATORS
-
-bool wxWindowBase::TryValidator(wxEvent& event)
+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;
+ return true;
}
}
+#endif // wxUSE_VALIDATORS
- return FALSE;
+ return false;
}
-#endif // wxUSE_VALIDATORS
-
bool wxWindowBase::TryParent(wxEvent& event)
{
// carry on up the parent-child hierarchy if the propgation count hasn't
// 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::compatibility_iterator node = NULL;
+ wxWindowList::compatibility_iterator node =
+ wxWindowList::compatibility_iterator();
if (fromId == 0)
{
// Can't navigate to sibling of this window
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::compatibility_iterator node = NULL;
+ wxWindowList::compatibility_iterator node =
+ wxWindowList::compatibility_iterator();
if (fromId == 0)
{
// Can't navigate to sibling of this window
if (node && node->GetPrevious())
{
- wxWindow* previousWindow = (wxWindow*) node->GetPrevious()->Data();
+ wxWindow* previousWindow = node->GetPrevious()->GetData();
*toObject = previousWindow->GetOrCreateAccessible();
return wxACC_OK;
}
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())