wxMac: wxUniversal integration steps
[wxWidgets.git] / include / wx / mac / frame.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: frame.h
3 // Purpose: wxFrameMac class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FRAME_H_
13 #define _WX_FRAME_H_
14
15 #ifdef __GNUG__
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 char*) wxFrameNameStr;
25 WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
26
27 class WXDLLEXPORT wxMenuBar;
28 class WXDLLEXPORT wxStatusBar;
29 class WXDLLEXPORT wxMacToolTip ;
30
31 class WXDLLEXPORT wxFrameMac: public wxFrameBase {
32
33 DECLARE_DYNAMIC_CLASS(wxFrameMac)
34
35 public:
36 // construction
37 wxFrameMac() { Init(); }
38 wxFrameMac(wxWindow *parent,
39 wxWindowID id,
40 const wxString& title,
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize,
43 long style = wxDEFAULT_FRAME_STYLE,
44 const wxString& name = wxFrameNameStr)
45 {
46 Init();
47
48 Create(parent, id, title, pos, size, style, name);
49 }
50
51 bool Create(wxWindow *parent,
52 wxWindowID id,
53 const wxString& title,
54 const wxPoint& pos = wxDefaultPosition,
55 const wxSize& size = wxDefaultSize,
56 long style = wxDEFAULT_FRAME_STYLE,
57 const wxString& name = wxFrameNameStr);
58
59 virtual ~wxFrameMac();
60
61 // implement base class pure virtuals
62 virtual void Maximize(bool maximize = TRUE);
63 virtual bool IsMaximized() const;
64 virtual void Iconize(bool iconize = TRUE);
65 virtual bool IsIconized() const;
66 virtual void Restore();
67 virtual void SetMenuBar(wxMenuBar *menubar);
68 virtual void SetIcon(const wxIcon& icon);
69
70 // implementation only from now on
71 // -------------------------------
72
73 // override some more virtuals
74 virtual bool Enable(bool enable) ;
75
76 // get the origin of the client area (which may be different from (0, 0)
77 // if the frame has a toolbar) in client coordinates
78 virtual wxPoint GetClientAreaOrigin() const;
79
80 // event handlers
81 void OnActivate(wxActivateEvent& event);
82 void OnSysColourChanged(wxSysColourChangedEvent& event);
83
84 // Toolbar
85 #if wxUSE_TOOLBAR
86 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
87 wxWindowID id = -1,
88 const wxString& name = wxToolBarNameStr);
89
90 virtual void PositionToolBar();
91 #endif // wxUSE_TOOLBAR
92
93 // Status bar
94 #if wxUSE_STATUSBAR
95 virtual wxStatusBar* OnCreateStatusBar(int number = 1,
96 long style = wxST_SIZEGRIP,
97 wxWindowID id = 0,
98 const wxString& name = wxStatusLineNameStr);
99
100 virtual void PositionStatusBar();
101
102 // Hint to tell framework which status bar to use
103 // TODO: should this go into a wxFrameworkSettings class perhaps?
104 static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
105 static bool UsesNativeStatusBar() { return m_useNativeStatusBar; };
106 #endif // wxUSE_STATUSBAR
107
108 // tooltip management
109 #if wxUSE_TOOLTIPS
110 wxMacToolTip* GetToolTipCtrl() const { return m_hwndToolTip; }
111 void SetToolTipCtrl(wxMacToolTip *tt) { m_hwndToolTip = tt; }
112 wxMacToolTip* m_hwndToolTip ;
113 #endif // tooltips
114
115 protected:
116 // common part of all ctors
117 void Init();
118
119 // override base class virtuals
120 virtual void DoGetClientSize(int *width, int *height) const;
121 virtual void DoSetClientSize(int width, int height);
122
123 protected:
124 bool m_iconized;
125 #if wxUSE_STATUSBAR
126 static bool m_useNativeStatusBar;
127 #endif // wxUSE_STATUSBAR
128 // the last focused child: we restore focus to it on activation
129 wxWindow *m_winLastFocused;
130
131 private:
132 DECLARE_EVENT_TABLE()
133 };
134
135 #endif
136 // _WX_FRAME_H_