1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Generic Drawer child window class.
4 // Drawer windows appear under their parent window and
5 // behave like a drawer, opening and closing to reveal
6 // content that does not need to be visible at all times.
11 // Copyright: (c) Ryan Norton
12 // Licence: wxWindows licence
13 /////////////////////////////////////////////////////////////////////////////
15 #ifndef _WX_DRAWERG_H_
16 #define _WX_DRAWERG_H_
18 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
19 #pragma interface "drawerg.h"
22 #include "wx/toplevel.h"
24 class WXDLLEXPORT wxGenericDrawerWindow
: public wxTopLevelWindow
26 DECLARE_DYNAMIC_CLASS(wxGenericDrawerWindow
)
30 wxGenericDrawerWindow();
32 wxGenericDrawerWindow(wxWindow
* parent
,
34 const wxString
& title
,
35 wxSize size
= wxDefaultSize
,
36 wxDirection edge
= wxLEFT
,
37 const wxString
& name
= wxT("drawerwindow"))
39 this->Create(parent
, id
, title
, size
, edge
, name
);
42 ~wxGenericDrawerWindow();
44 // Create a drawer window.
45 // If parent is NULL, create as a tool window.
46 // If parent is not NULL, then wxTopLevelWindow::Attach this window to parent.
47 bool Create(wxWindow
*parent
,
49 const wxString
& title
,
50 wxSize size
= wxDefaultSize
,
51 wxDirection edge
= wxLEFT
,
52 const wxString
& name
= wxFrameNameStr
);
54 bool Open(const bool& show
= true); // open or close the drawer, possibility for async param, i.e. animate
55 bool Close() { return this->Open(false); }
58 // Set the edge of the parent where the drawer attaches.
59 bool SetPreferredEdge(const wxDirection
& edge
);
60 wxDirection
GetPreferredEdge() const;
61 wxDirection
GetCurrentEdge() const; // not necessarily the preferred, due to screen constraints
65 wxDirection m_nCurrentEdge
;
66 wxDirection m_nPreferredEdge
;
68 class wxGenericDrawerTimer
* m_pTimer
;
69 friend class wxGenericDrawerTimer
;
70 wxSize m_LastParentSize
;
72 void OnDrawerFocus(class wxFocusEvent
& evt
);
73 void OnDrawerMove(class wxMoveEvent
& evt
);
74 void OnDrawerSize(class wxSizeEvent
& evt
);
76 void DoDrawerPosition();
80 #endif // _WX_DRAWERG_H_