1. slightly changed how wxControlContainer is used

2. use it now for wxSplitterWindow too
3. don't compile wxIdleEvent in !wxUSE_GUI mode (why was it done?)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11301 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-08-06 12:55:04 +00:00
parent a86253375b
commit 6b55490abd
8 changed files with 62 additions and 51 deletions

View File

@@ -80,13 +80,17 @@ extern bool wxSetFocusToChild(wxWindow *win, wxWindow **child);
// declare the methods to be forwarded
#define WX_DECLARE_CONTROL_CONTAINER() \
public: \
void OnNavigationKey(wxNavigationKeyEvent& event); \
void OnFocus(wxFocusEvent& event); \
virtual void OnChildFocus(wxChildFocusEvent& event); \
virtual void SetFocus(); \
virtual void RemoveChild(wxWindowBase *child); \
virtual wxWindow *GetDefaultItem() const; \
virtual wxWindow *SetDefaultItem(wxWindow *child) \
virtual wxWindow *SetDefaultItem(wxWindow *child); \
\
protected: \
wxControlContainer m_container
// implement the event table entries for wxControlContainer
#define WX_EVENT_TABLE_CONTROL_CONTAINER(classname) \
@@ -95,43 +99,43 @@ extern bool wxSetFocusToChild(wxWindow *win, wxWindow **child);
EVT_NAVIGATION_KEY(classname::OnNavigationKey)
// implement the methods forwarding to the wxControlContainer
#define WX_DELEGATE_TO_CONTROL_CONTAINER(classname, container) \
#define WX_DELEGATE_TO_CONTROL_CONTAINER(classname) \
wxWindow *classname::SetDefaultItem(wxWindow *child) \
{ \
return container->SetDefaultItem(child); \
return m_container.SetDefaultItem(child); \
} \
\
wxWindow *classname::GetDefaultItem() const \
{ \
return container->GetDefaultItem(); \
return m_container.GetDefaultItem(); \
} \
\
void classname::OnNavigationKey( wxNavigationKeyEvent& event ) \
{ \
container->HandleOnNavigationKey(event); \
m_container.HandleOnNavigationKey(event); \
} \
\
void classname::RemoveChild(wxWindowBase *child) \
{ \
container->HandleOnWindowDestroy(child); \
m_container.HandleOnWindowDestroy(child); \
\
wxWindow::RemoveChild(child); \
} \
\
void classname::SetFocus() \
{ \
if ( !container->DoSetFocus() ) \
if ( !m_container.DoSetFocus() ) \
wxWindow::SetFocus(); \
} \
\
void classname::OnChildFocus(wxChildFocusEvent& event) \
{ \
container->SetLastFocus(event.GetWindow()); \
m_container.SetLastFocus(event.GetWindow()); \
} \
\
void classname::OnFocus(wxFocusEvent& event) \
{ \
container->HandleOnFocus(event); \
m_container.HandleOnFocus(event); \
}

View File

@@ -1512,8 +1512,6 @@ private:
DECLARE_DYNAMIC_CLASS(wxContextMenuEvent)
};
#endif // wxUSE_GUI
// Idle event
/*
wxEVT_IDLE
@@ -1536,6 +1534,8 @@ protected:
bool m_requestMore;
};
#endif // wxUSE_GUI
/* TODO
wxEVT_POWER,
wxEVT_MOUSE_CAPTURE_CHANGED,

View File

@@ -23,7 +23,6 @@
#include "wx/window.h"
#include "wx/containr.h"
class WXDLLEXPORT wxButton;
class WXDLLEXPORT wxControlContainer;
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
@@ -35,7 +34,7 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
class WXDLLEXPORT wxPanel : public wxWindow
{
public:
wxPanel() { Init(); }
wxPanel() : m_container(this) { Init(); }
// Old-style constructor (no default values for coordinates to avoid
// ambiguity with the new one)
@@ -43,6 +42,7 @@ public:
int x, int y, int width, int height,
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
const wxString& name = wxPanelNameStr)
: m_container(this)
{
Init();
@@ -56,6 +56,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
const wxString& name = wxPanelNameStr)
: m_container(this)
{
Init();
@@ -90,9 +91,6 @@ protected:
// common part of all ctors
void Init();
// the object which implements the TAB traversal logic
wxControlContainer *m_container;
private:
DECLARE_DYNAMIC_CLASS(wxPanel)
DECLARE_EVENT_TABLE()

View File

@@ -37,6 +37,8 @@ enum
wxSPLIT_DRAG_LEFT_DOWN
};
class WXDLLEXPORT wxControlContainer;
// ---------------------------------------------------------------------------
// wxSplitterWindow maintains one or two panes, with
// an optional vertical or horizontal split which
@@ -60,7 +62,7 @@ public:
// Public API
// Default constructor
wxSplitterWindow()
wxSplitterWindow() : m_container(this)
{
Init();
}
@@ -71,12 +73,13 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxSP_3D,
const wxString& name = "splitter")
: m_container(this)
{
Init();
Create(parent, id, pos, size, style, name);
}
~wxSplitterWindow();
virtual ~wxSplitterWindow();
bool Create(wxWindow *parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
@@ -209,9 +212,9 @@ protected:
void SendUnsplitEvent(wxWindow *winRemoved);
protected:
// common part of all ctors
void Init();
int m_splitMode;
bool m_permitUnsplitAlways;
bool m_needUpdating; // when in live mode, set this to TRUE to resize children in idle
@@ -237,6 +240,8 @@ protected:
wxPen* m_facePen;
private:
WX_DECLARE_CONTROL_CONTAINER();
DECLARE_DYNAMIC_CLASS(wxSplitterWindow)
DECLARE_EVENT_TABLE()
};