]>
Commit | Line | Data |
---|---|---|
0dbd6262 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: frame.h | |
0d53fc34 | 3 | // Purpose: wxFrame class |
a31a5f85 | 4 | // Author: Stefan Csomor |
0dbd6262 | 5 | // Modified by: |
a31a5f85 | 6 | // Created: 1998-01-01 |
0dbd6262 | 7 | // RCS-ID: $Id$ |
a31a5f85 | 8 | // Copyright: (c) Stefan Csomor |
a7b51bc8 | 9 | // Licence: wxWindows licence |
0dbd6262 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_FRAME_H_ | |
13 | #define _WX_FRAME_H_ | |
14 | ||
af49c4b8 | 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
0dbd6262 SC |
16 | #pragma interface "frame.h" |
17 | #endif | |
18 | ||
19 | #include "wx/window.h" | |
20 | #include "wx/toolbar.h" | |
21 | #include "wx/accel.h" | |
519cb848 | 22 | #include "wx/icon.h" |
0dbd6262 | 23 | |
c4e41ce3 SC |
24 | WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr; |
25 | WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr; | |
0dbd6262 SC |
26 | |
27 | class WXDLLEXPORT wxMenuBar; | |
28 | class WXDLLEXPORT wxStatusBar; | |
519cb848 | 29 | class WXDLLEXPORT wxMacToolTip ; |
0dbd6262 | 30 | |
551a6c64 SC |
31 | class WXDLLEXPORT wxFrame: public wxFrameBase |
32 | { | |
0dbd6262 | 33 | public: |
05adb9d2 | 34 | // construction |
0d53fc34 VS |
35 | wxFrame() { Init(); } |
36 | wxFrame(wxWindow *parent, | |
05adb9d2 SC |
37 | wxWindowID id, |
38 | const wxString& title, | |
39 | const wxPoint& pos = wxDefaultPosition, | |
40 | const wxSize& size = wxDefaultSize, | |
41 | long style = wxDEFAULT_FRAME_STYLE, | |
42 | const wxString& name = wxFrameNameStr) | |
43 | { | |
44 | Init(); | |
45 | ||
46 | Create(parent, id, title, pos, size, style, name); | |
47 | } | |
48 | ||
49 | bool Create(wxWindow *parent, | |
50 | wxWindowID id, | |
51 | const wxString& title, | |
52 | const wxPoint& pos = wxDefaultPosition, | |
53 | const wxSize& size = wxDefaultSize, | |
54 | long style = wxDEFAULT_FRAME_STYLE, | |
55 | const wxString& name = wxFrameNameStr); | |
56 | ||
0d53fc34 | 57 | virtual ~wxFrame(); |
05adb9d2 | 58 | |
05adb9d2 SC |
59 | // implementation only from now on |
60 | // ------------------------------- | |
61 | ||
62 | // override some more virtuals | |
a7b51bc8 | 63 | virtual bool Enable(bool enable = TRUE) ; |
05adb9d2 SC |
64 | |
65 | // get the origin of the client area (which may be different from (0, 0) | |
66 | // if the frame has a toolbar) in client coordinates | |
67 | virtual wxPoint GetClientAreaOrigin() const; | |
68 | ||
69 | // event handlers | |
70 | void OnActivate(wxActivateEvent& event); | |
71 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
72 | ||
73 | // Toolbar | |
519cb848 | 74 | #if wxUSE_TOOLBAR |
05adb9d2 SC |
75 | virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT, |
76 | wxWindowID id = -1, | |
77 | const wxString& name = wxToolBarNameStr); | |
519cb848 | 78 | |
05adb9d2 SC |
79 | virtual void PositionToolBar(); |
80 | #endif // wxUSE_TOOLBAR | |
519cb848 | 81 | |
05adb9d2 SC |
82 | // Status bar |
83 | #if wxUSE_STATUSBAR | |
84 | virtual wxStatusBar* OnCreateStatusBar(int number = 1, | |
85 | long style = wxST_SIZEGRIP, | |
86 | wxWindowID id = 0, | |
87 | const wxString& name = wxStatusLineNameStr); | |
0dbd6262 | 88 | |
05adb9d2 | 89 | virtual void PositionStatusBar(); |
0dbd6262 SC |
90 | |
91 | // Hint to tell framework which status bar to use | |
92 | // TODO: should this go into a wxFrameworkSettings class perhaps? | |
93 | static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; }; | |
94 | static bool UsesNativeStatusBar() { return m_useNativeStatusBar; }; | |
05adb9d2 | 95 | #endif // wxUSE_STATUSBAR |
0dbd6262 | 96 | |
05adb9d2 | 97 | // tooltip management |
519cb848 SC |
98 | #if wxUSE_TOOLTIPS |
99 | wxMacToolTip* GetToolTipCtrl() const { return m_hwndToolTip; } | |
e7549107 SC |
100 | void SetToolTipCtrl(wxMacToolTip *tt) { m_hwndToolTip = tt; } |
101 | wxMacToolTip* m_hwndToolTip ; | |
519cb848 | 102 | #endif // tooltips |
0dbd6262 | 103 | |
b821344e SC |
104 | // called by wxWindow whenever it gets focus |
105 | void SetLastFocus(wxWindow *win) { m_winLastFocused = win; } | |
106 | wxWindow *GetLastFocus() const { return m_winLastFocused; } | |
107 | ||
0dbd6262 | 108 | protected: |
05adb9d2 SC |
109 | // common part of all ctors |
110 | void Init(); | |
111 | ||
112 | // override base class virtuals | |
113 | virtual void DoGetClientSize(int *width, int *height) const; | |
114 | virtual void DoSetClientSize(int width, int height); | |
115 | ||
2b5f62a0 VZ |
116 | virtual void DetachMenuBar(); |
117 | virtual void AttachMenuBar(wxMenuBar *menubar); | |
118 | ||
05adb9d2 | 119 | protected: |
05adb9d2 SC |
120 | #if wxUSE_STATUSBAR |
121 | static bool m_useNativeStatusBar; | |
122 | #endif // wxUSE_STATUSBAR | |
7810c95b SC |
123 | // the last focused child: we restore focus to it on activation |
124 | wxWindow *m_winLastFocused; | |
0dbd6262 | 125 | |
05adb9d2 SC |
126 | private: |
127 | DECLARE_EVENT_TABLE() | |
0d53fc34 | 128 | DECLARE_DYNAMIC_CLASS(wxFrame) |
0dbd6262 SC |
129 | }; |
130 | ||
131 | #endif | |
132 | // _WX_FRAME_H_ |