]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/drawerg.h
Source cleaning: whitespaces, tabs, -1/wxID_ANY, TRUE/true, FALSE/false.
[wxWidgets.git] / include / wx / generic / drawerg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: drawerg.h
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.
7 // Author: Ryan Norton
8 // Modified by:
9 // Created: 2004-26-09
10 // RCS-ID: $Id$
11 // Copyright: (c) Ryan Norton
12 // Licence: wxWindows licence
13 /////////////////////////////////////////////////////////////////////////////
14
15 #ifndef _WX_DRAWERG_H_
16 #define _WX_DRAWERG_H_
17
18 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
19 #pragma interface "drawerg.h"
20 #endif
21
22 #include "wx/toplevel.h"
23
24 class WXDLLEXPORT wxGenericDrawerWindow : public wxTopLevelWindow
25 {
26 DECLARE_DYNAMIC_CLASS(wxGenericDrawerWindow)
27
28 public:
29
30 wxGenericDrawerWindow();
31
32 wxGenericDrawerWindow(wxWindow* parent,
33 wxWindowID id,
34 const wxString& title,
35 wxSize size = wxDefaultSize,
36 wxDirection edge = wxLEFT,
37 const wxString& name = wxT("drawerwindow"))
38 {
39 this->Create(parent, id, title, size, edge, name);
40 }
41
42 ~wxGenericDrawerWindow();
43
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,
48 wxWindowID id,
49 const wxString& title,
50 wxSize size = wxDefaultSize,
51 wxDirection edge = wxLEFT,
52 const wxString& name = wxFrameNameStr);
53
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); }
56 bool IsOpen() const;
57
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
62
63 protected:
64 bool m_bOpen;
65 wxDirection m_nCurrentEdge;
66 wxDirection m_nPreferredEdge;
67 int m_nOpenOffset;
68 class wxGenericDrawerTimer* m_pTimer;
69 friend class wxGenericDrawerTimer;
70 wxSize m_LastParentSize;
71
72 void OnDrawerFocus(class wxFocusEvent& evt);
73 void OnDrawerMove(class wxMoveEvent& evt);
74 void OnDrawerSize(class wxSizeEvent& evt);
75
76 void DoDrawerPosition();
77 void DoDrawerSize();
78 };
79
80 #endif // _WX_DRAWERG_H_