make wxFrame a wxControlContainer too, so that it behaves in the same way as wxDialog
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46452 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -13,7 +13,6 @@
|
|||||||
#define _WX_DIALOG_H_BASE_
|
#define _WX_DIALOG_H_BASE_
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
#include "wx/containr.h"
|
|
||||||
#include "wx/toplevel.h"
|
#include "wx/toplevel.h"
|
||||||
|
|
||||||
class WXDLLEXPORT wxSizer;
|
class WXDLLEXPORT wxSizer;
|
||||||
@@ -141,7 +140,6 @@ private:
|
|||||||
|
|
||||||
DECLARE_NO_COPY_CLASS(wxDialogBase)
|
DECLARE_NO_COPY_CLASS(wxDialogBase)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
WX_DECLARE_CONTROL_CONTAINER();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -190,6 +190,10 @@ protected:
|
|||||||
|
|
||||||
// test whether this window makes part of the frame
|
// test whether this window makes part of the frame
|
||||||
virtual bool IsOneOfBars(const wxWindow *win) const;
|
virtual bool IsOneOfBars(const wxWindow *win) const;
|
||||||
|
virtual bool IsClientAreaChild(const wxWindow *child) const
|
||||||
|
{
|
||||||
|
return !IsOneOfBars(child) && wxTopLevelWindow::IsClientAreaChild(child);
|
||||||
|
}
|
||||||
|
|
||||||
#if wxUSE_MENUS
|
#if wxUSE_MENUS
|
||||||
// override to update menu bar position when the frame size changes
|
// override to update menu bar position when the frame size changes
|
||||||
|
@@ -214,8 +214,13 @@ public:
|
|||||||
// returns true if the grandchildren need to be clipped to the children's content area
|
// returns true if the grandchildren need to be clipped to the children's content area
|
||||||
// (e.g., splitter windows)
|
// (e.g., splitter windows)
|
||||||
virtual bool MacClipGrandChildren() const { return false ; }
|
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) ;
|
virtual void MacInstallEventHandler(WXWidget native) ;
|
||||||
void MacPostControlCreate(const wxPoint& pos, const wxSize& size) ;
|
void MacPostControlCreate(const wxPoint& pos, const wxSize& size) ;
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "wx/nonownedwnd.h"
|
#include "wx/nonownedwnd.h"
|
||||||
#include "wx/iconbndl.h"
|
#include "wx/iconbndl.h"
|
||||||
|
#include "wx/containr.h"
|
||||||
|
|
||||||
// the default names for various classes
|
// the default names for various classes
|
||||||
extern WXDLLEXPORT_DATA(const wxChar) wxFrameNameStr[];
|
extern WXDLLEXPORT_DATA(const wxChar) wxFrameNameStr[];
|
||||||
@@ -206,9 +207,6 @@ public:
|
|||||||
// reverts to the "permanent" default as soon as this temporary default
|
// reverts to the "permanent" default as soon as this temporary default
|
||||||
// item loses focus
|
// item loses focus
|
||||||
|
|
||||||
// used to reset default if pointing to removed child
|
|
||||||
virtual void RemoveChild(wxWindowBase *child);
|
|
||||||
|
|
||||||
// get the default item, temporary or permanent
|
// get the default item, temporary or permanent
|
||||||
wxWindow *GetDefaultItem() const
|
wxWindow *GetDefaultItem() const
|
||||||
{ return m_winTmpDefault ? m_winTmpDefault : m_winDefault; }
|
{ return m_winTmpDefault ? m_winTmpDefault : m_winDefault; }
|
||||||
@@ -306,6 +304,7 @@ protected:
|
|||||||
|
|
||||||
DECLARE_NO_COPY_CLASS(wxTopLevelWindowBase)
|
DECLARE_NO_COPY_CLASS(wxTopLevelWindowBase)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
WX_DECLARE_CONTROL_CONTAINER();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -190,6 +190,16 @@ public:
|
|||||||
// should we use the standard control colours or not?
|
// should we use the standard control colours or not?
|
||||||
virtual bool ShouldInheritColours() const { return false; }
|
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:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
@@ -641,6 +641,11 @@ public:
|
|||||||
virtual void AddChild( wxWindowBase *child );
|
virtual void AddChild( wxWindowBase *child );
|
||||||
virtual void RemoveChild( 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
|
||||||
// -------------------
|
// -------------------
|
||||||
|
|
||||||
|
@@ -75,10 +75,8 @@ bool wxControlContainerBase::ShouldAcceptFocus() const
|
|||||||
wxWindow *child = node->GetData();
|
wxWindow *child = node->GetData();
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
if ( !m_winParent->IsClientAreaChild(child) )
|
||||||
if ( m_winParent->MacIsWindowScrollbar( child ) )
|
|
||||||
continue;
|
continue;
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( child->CanAcceptFocus() )
|
if ( child->CanAcceptFocus() )
|
||||||
return false;
|
return false;
|
||||||
@@ -658,10 +656,9 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused)
|
|||||||
wxWindow *child = node->GetData();
|
wxWindow *child = node->GetData();
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
// skip special windows:
|
||||||
if ( child->GetParent()->MacIsWindowScrollbar( child ) )
|
if ( !win->IsClientAreaChild(child) )
|
||||||
continue;
|
continue;
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( child->CanAcceptFocusFromKeyboard() && !child->IsTopLevel() )
|
if ( child->CanAcceptFocusFromKeyboard() && !child->IsTopLevel() )
|
||||||
{
|
{
|
||||||
|
@@ -52,12 +52,8 @@ BEGIN_EVENT_TABLE(wxDialogBase, wxTopLevelWindow)
|
|||||||
EVT_CLOSE(wxDialogBase::OnCloseWindow)
|
EVT_CLOSE(wxDialogBase::OnCloseWindow)
|
||||||
|
|
||||||
EVT_CHAR_HOOK(wxDialogBase::OnCharHook)
|
EVT_CHAR_HOOK(wxDialogBase::OnCharHook)
|
||||||
|
|
||||||
WX_EVENT_TABLE_CONTROL_CONTAINER(wxDialogBase)
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
WX_DELEGATE_TO_CONTROL_CONTAINER(wxDialogBase, wxTopLevelWindow)
|
|
||||||
|
|
||||||
void wxDialogBase::Init()
|
void wxDialogBase::Init()
|
||||||
{
|
{
|
||||||
m_returnCode = 0;
|
m_returnCode = 0;
|
||||||
@@ -68,8 +64,6 @@ void wxDialogBase::Init()
|
|||||||
// dialog controls from reaching the parent frame which is usually
|
// dialog controls from reaching the parent frame which is usually
|
||||||
// undesirable and can lead to unexpected and hard to find bugs
|
// undesirable and can lead to unexpected and hard to find bugs
|
||||||
SetExtraStyle(GetExtraStyle() | wxWS_EX_BLOCK_EVENTS);
|
SetExtraStyle(GetExtraStyle() | wxWS_EX_BLOCK_EVENTS);
|
||||||
|
|
||||||
WX_INIT_CONTROL_CONTAINER();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper of GetParentForModalDialog()
|
// helper of GetParentForModalDialog()
|
||||||
|
@@ -40,8 +40,11 @@ BEGIN_EVENT_TABLE(wxTopLevelWindowBase, wxWindow)
|
|||||||
EVT_CLOSE(wxTopLevelWindowBase::OnCloseWindow)
|
EVT_CLOSE(wxTopLevelWindowBase::OnCloseWindow)
|
||||||
EVT_SIZE(wxTopLevelWindowBase::OnSize)
|
EVT_SIZE(wxTopLevelWindowBase::OnSize)
|
||||||
EVT_WINDOW_DESTROY(wxTopLevelWindowBase::OnChildDestroy)
|
EVT_WINDOW_DESTROY(wxTopLevelWindowBase::OnChildDestroy)
|
||||||
|
WX_EVENT_TABLE_CONTROL_CONTAINER(wxTopLevelWindowBase)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
WX_DELEGATE_TO_CONTROL_CONTAINER(wxTopLevelWindowBase, wxWindow)
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -58,10 +61,14 @@ wxTopLevelWindowBase::wxTopLevelWindowBase()
|
|||||||
m_isShown = false;
|
m_isShown = false;
|
||||||
m_winDefault = NULL;
|
m_winDefault = NULL;
|
||||||
m_winTmpDefault = 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
|
// don't let wxTheApp keep any stale pointers to us
|
||||||
if ( wxTheApp && wxTheApp->GetTopWindow() == this )
|
if ( wxTheApp && wxTheApp->GetTopWindow() == this )
|
||||||
wxTheApp->SetTopWindow(NULL);
|
wxTheApp->SetTopWindow(NULL);
|
||||||
@@ -412,14 +419,3 @@ void wxTopLevelWindowBase::RequestUserAttention(int WXUNUSED(flags))
|
|||||||
// it's probably better than do nothing, isn't it?
|
// it's probably better than do nothing, isn't it?
|
||||||
Raise();
|
Raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTopLevelWindowBase::RemoveChild(wxWindowBase *child)
|
|
||||||
{
|
|
||||||
if ( child == m_winDefault )
|
|
||||||
m_winDefault = NULL;
|
|
||||||
|
|
||||||
if ( child == m_winTmpDefault )
|
|
||||||
m_winTmpDefault = NULL;
|
|
||||||
|
|
||||||
wxWindow::RemoveChild(child);
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user