git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46452
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#define _WX_DIALOG_H_BASE_
#include "wx/defs.h"
#define _WX_DIALOG_H_BASE_
#include "wx/defs.h"
-#include "wx/containr.h"
#include "wx/toplevel.h"
class WXDLLEXPORT wxSizer;
#include "wx/toplevel.h"
class WXDLLEXPORT wxSizer;
DECLARE_NO_COPY_CLASS(wxDialogBase)
DECLARE_EVENT_TABLE()
DECLARE_NO_COPY_CLASS(wxDialogBase)
DECLARE_EVENT_TABLE()
- WX_DECLARE_CONTROL_CONTAINER();
// test whether this window makes part of the frame
virtual bool IsOneOfBars(const wxWindow *win) const;
// test whether this window makes part of the frame
virtual bool IsOneOfBars(const wxWindow *win) const;
+ virtual bool IsClientAreaChild(const wxWindow *child) const
+ {
+ return !IsOneOfBars(child) && wxTopLevelWindow::IsClientAreaChild(child);
+ }
#if wxUSE_MENUS
// override to update menu bar position when the frame size changes
#if wxUSE_MENUS
// override to update menu bar position when the frame size changes
// returns true if the grandchildren need to be clipped to the children's content area
// (e.g., splitter windows)
virtual bool MacClipGrandChildren() const { return false ; }
// returns true if the grandchildren need to be clipped to the children's content area
// (e.g., splitter windows)
virtual bool MacClipGrandChildren() const { return false ; }
- bool MacIsWindowScrollbar( const wxWindow* sb )
+ bool MacIsWindowScrollbar( const wxWindow* sb ) const
{ return ((wxWindow*)m_hScrollBar == sb || (wxWindow*)m_vScrollBar == sb) ; }
{ return ((wxWindow*)m_hScrollBar == sb || (wxWindow*)m_vScrollBar == sb) ; }
+ virtual bool IsClientAreaChild(const wxWindow *child) const
+ {
+ return !MacIsWindowScrollbar(child) &&
+ wxWindowBase::IsClientAreaChild(child);
+ }
virtual void MacInstallEventHandler(WXWidget native) ;
void MacPostControlCreate(const wxPoint& pos, const wxSize& size) ;
virtual void MacInstallEventHandler(WXWidget native) ;
void MacPostControlCreate(const wxPoint& pos, const wxSize& size) ;
#include "wx/nonownedwnd.h"
#include "wx/iconbndl.h"
#include "wx/nonownedwnd.h"
#include "wx/iconbndl.h"
+#include "wx/containr.h"
// the default names for various classes
extern WXDLLEXPORT_DATA(const wxChar) wxFrameNameStr[];
// the default names for various classes
extern WXDLLEXPORT_DATA(const wxChar) wxFrameNameStr[];
// reverts to the "permanent" default as soon as this temporary default
// item loses focus
// reverts to the "permanent" default as soon as this temporary default
// item loses focus
- // used to reset default if pointing to removed child
- virtual void RemoveChild(wxWindowBase *child);
-
// get the default item, temporary or permanent
wxWindow *GetDefaultItem() const
{ return m_winTmpDefault ? m_winTmpDefault : m_winDefault; }
// get the default item, temporary or permanent
wxWindow *GetDefaultItem() const
{ return m_winTmpDefault ? m_winTmpDefault : m_winDefault; }
DECLARE_NO_COPY_CLASS(wxTopLevelWindowBase)
DECLARE_EVENT_TABLE()
DECLARE_NO_COPY_CLASS(wxTopLevelWindowBase)
DECLARE_EVENT_TABLE()
+ WX_DECLARE_CONTROL_CONTAINER();
// should we use the standard control colours or not?
virtual bool ShouldInheritColours() const { return false; }
// should we use the standard control colours or not?
virtual bool ShouldInheritColours() const { return false; }
+ virtual bool IsClientAreaChild(const wxWindow *child) const
+ {
+#if wxUSE_SCROLLBAR
+ if ( child == (wxWindow*)m_scrollbarHorz ||
+ child == (wxWindow*)m_scrollbarVert )
+ return false;
+#endif
+ return wxWindowNative::IsClientAreaChild(child);
+ }
+
protected:
// common part of all ctors
void Init();
protected:
// common part of all ctors
void Init();
virtual void AddChild( wxWindowBase *child );
virtual void RemoveChild( wxWindowBase *child );
virtual void AddChild( wxWindowBase *child );
virtual void RemoveChild( wxWindowBase *child );
+ // returns true if the child is in the client area of the window, i.e. is
+ // not scrollbar, toolbar etc.
+ virtual bool IsClientAreaChild(const wxWindow *WXUNUSED(child)) const
+ { return true; }
+
// looking for windows
// -------------------
// looking for windows
// -------------------
wxWindow *child = node->GetData();
node = node->GetNext();
wxWindow *child = node->GetData();
node = node->GetNext();
-#ifdef __WXMAC__
- if ( m_winParent->MacIsWindowScrollbar( child ) )
+ if ( !m_winParent->IsClientAreaChild(child) )
if ( child->CanAcceptFocus() )
return false;
if ( child->CanAcceptFocus() )
return false;
wxWindow *child = node->GetData();
node = node->GetNext();
wxWindow *child = node->GetData();
node = node->GetNext();
-#ifdef __WXMAC__
- if ( child->GetParent()->MacIsWindowScrollbar( child ) )
+ // skip special windows:
+ if ( !win->IsClientAreaChild(child) )
if ( child->CanAcceptFocusFromKeyboard() && !child->IsTopLevel() )
{
#ifdef __WXMSW__
if ( child->CanAcceptFocusFromKeyboard() && !child->IsTopLevel() )
{
#ifdef __WXMSW__
EVT_CLOSE(wxDialogBase::OnCloseWindow)
EVT_CHAR_HOOK(wxDialogBase::OnCharHook)
EVT_CLOSE(wxDialogBase::OnCloseWindow)
EVT_CHAR_HOOK(wxDialogBase::OnCharHook)
-
- WX_EVENT_TABLE_CONTROL_CONTAINER(wxDialogBase)
-WX_DELEGATE_TO_CONTROL_CONTAINER(wxDialogBase, wxTopLevelWindow)
-
void wxDialogBase::Init()
{
m_returnCode = 0;
void wxDialogBase::Init()
{
m_returnCode = 0;
// dialog controls from reaching the parent frame which is usually
// undesirable and can lead to unexpected and hard to find bugs
SetExtraStyle(GetExtraStyle() | wxWS_EX_BLOCK_EVENTS);
// dialog controls from reaching the parent frame which is usually
// undesirable and can lead to unexpected and hard to find bugs
SetExtraStyle(GetExtraStyle() | wxWS_EX_BLOCK_EVENTS);
-
- WX_INIT_CONTROL_CONTAINER();
}
// helper of GetParentForModalDialog()
}
// helper of GetParentForModalDialog()
EVT_CLOSE(wxTopLevelWindowBase::OnCloseWindow)
EVT_SIZE(wxTopLevelWindowBase::OnSize)
EVT_WINDOW_DESTROY(wxTopLevelWindowBase::OnChildDestroy)
EVT_CLOSE(wxTopLevelWindowBase::OnCloseWindow)
EVT_SIZE(wxTopLevelWindowBase::OnSize)
EVT_WINDOW_DESTROY(wxTopLevelWindowBase::OnChildDestroy)
+ WX_EVENT_TABLE_CONTROL_CONTAINER(wxTopLevelWindowBase)
+WX_DELEGATE_TO_CONTROL_CONTAINER(wxTopLevelWindowBase, wxWindow)
+
// ============================================================================
// implementation
// ============================================================================
// ============================================================================
// implementation
// ============================================================================
m_isShown = false;
m_winDefault = NULL;
m_winTmpDefault = NULL;
m_isShown = false;
m_winDefault = NULL;
m_winTmpDefault = NULL;
+
+ WX_INIT_CONTROL_CONTAINER();
}
wxTopLevelWindowBase::~wxTopLevelWindowBase()
{
}
wxTopLevelWindowBase::~wxTopLevelWindowBase()
{
+ m_winDefault = m_winTmpDefault = NULL;
+
// don't let wxTheApp keep any stale pointers to us
if ( wxTheApp && wxTheApp->GetTopWindow() == this )
wxTheApp->SetTopWindow(NULL);
// don't let wxTheApp keep any stale pointers to us
if ( wxTheApp && wxTheApp->GetTopWindow() == this )
wxTheApp->SetTopWindow(NULL);
// it's probably better than do nothing, isn't it?
Raise();
}
// it's probably better than do nothing, isn't it?
Raise();
}
-
-void wxTopLevelWindowBase::RemoveChild(wxWindowBase *child)
-{
- if ( child == m_winDefault )
- m_winDefault = NULL;
-
- if ( child == m_winTmpDefault )
- m_winTmpDefault = NULL;
-
- wxWindow::RemoveChild(child);
-}