Commit | Line | Data |
---|---|---|
8cf73271 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: frame.h | |
3 | // Purpose: wxFrame class | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Stefan Csomor | |
65571936 | 9 | // Licence: wxWindows licence |
8cf73271 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_FRAME_H_ | |
13 | #define _WX_FRAME_H_ | |
14 | ||
15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
16 | #pragma interface "frame.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/window.h" | |
20 | #include "wx/toolbar.h" | |
21 | #include "wx/accel.h" | |
22 | #include "wx/icon.h" | |
23 | ||
24 | WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr; | |
25 | WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr; | |
26 | ||
27 | class WXDLLEXPORT wxMenuBar; | |
28 | class WXDLLEXPORT wxStatusBar; | |
29 | class WXDLLEXPORT wxMacToolTip ; | |
30 | ||
31 | class WXDLLEXPORT wxFrame: public wxFrameBase | |
32 | { | |
33 | public: | |
34 | // construction | |
35 | wxFrame() { Init(); } | |
36 | wxFrame(wxWindow *parent, | |
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 | ||
57 | virtual ~wxFrame(); | |
58 | ||
59 | // implementation only from now on | |
60 | // ------------------------------- | |
61 | ||
62 | // override some more virtuals | |
63 | virtual bool Enable(bool enable = TRUE) ; | |
64 | ||
8cf73271 SC |
65 | // event handlers |
66 | void OnActivate(wxActivateEvent& event); | |
67 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
68 | ||
69 | // Toolbar | |
70 | #if wxUSE_TOOLBAR | |
71 | virtual wxToolBar* CreateToolBar(long style = -1, | |
72 | wxWindowID id = -1, | |
73 | const wxString& name = wxToolBarNameStr); | |
74 | ||
75 | virtual void PositionToolBar(); | |
76 | #endif // wxUSE_TOOLBAR | |
77 | ||
78 | // Status bar | |
79 | #if wxUSE_STATUSBAR | |
80 | virtual wxStatusBar* OnCreateStatusBar(int number = 1, | |
81 | long style = wxST_SIZEGRIP, | |
82 | wxWindowID id = 0, | |
83 | const wxString& name = wxStatusLineNameStr); | |
84 | ||
85 | virtual void PositionStatusBar(); | |
86 | #endif // wxUSE_STATUSBAR | |
87 | ||
88 | // tooltip management | |
89 | #if wxUSE_TOOLTIPS | |
90 | wxMacToolTip* GetToolTipCtrl() const { return m_hwndToolTip; } | |
91 | void SetToolTipCtrl(wxMacToolTip *tt) { m_hwndToolTip = tt; } | |
92 | wxMacToolTip* m_hwndToolTip ; | |
93 | #endif // tooltips | |
94 | ||
95 | // called by wxWindow whenever it gets focus | |
96 | void SetLastFocus(wxWindow *win) { m_winLastFocused = win; } | |
97 | wxWindow *GetLastFocus() const { return m_winLastFocused; } | |
98 | ||
99 | protected: | |
100 | // common part of all ctors | |
101 | void Init(); | |
102 | ||
103 | // override base class virtuals | |
104 | virtual void DoGetClientSize(int *width, int *height) const; | |
105 | virtual void DoSetClientSize(int width, int height); | |
106 | ||
107 | virtual void DetachMenuBar(); | |
108 | virtual void AttachMenuBar(wxMenuBar *menubar); | |
109 | ||
110 | protected: | |
111 | // the last focused child: we restore focus to it on activation | |
112 | wxWindow *m_winLastFocused; | |
113 | ||
114 | private: | |
115 | DECLARE_EVENT_TABLE() | |
116 | DECLARE_DYNAMIC_CLASS(wxFrame) | |
117 | }; | |
118 | ||
119 | #endif | |
120 | // _WX_FRAME_H_ |