]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/frame.h
Removal of previous wxValidtor code for wxOS2
[wxWidgets.git] / include / wx / mac / frame.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: frame.h
3 // Purpose: wxFrame 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 wxFrame: public wxWindow {
32
33 DECLARE_DYNAMIC_CLASS(wxFrame)
34
35 public:
36 wxFrame();
37 inline wxFrame(wxWindow *parent,
38 wxWindowID id,
39 const wxString& title,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 long style = wxDEFAULT_FRAME_STYLE,
43 const wxString& name = wxFrameNameStr)
44 {
45 Create(parent, id, title, pos, size, style, name);
46 }
47
48 ~wxFrame();
49
50 bool Create(wxWindow *parent,
51 wxWindowID id,
52 const wxString& title,
53 const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize,
55 long style = wxDEFAULT_FRAME_STYLE,
56 const wxString& name = wxFrameNameStr);
57
58 virtual bool Destroy();
59
60 void OnSize(wxSizeEvent& event);
61 void OnMenuHighlight(wxMenuEvent& event);
62 void OnActivate(wxActivateEvent& event);
63 void OnIdle(wxIdleEvent& event);
64 void OnCloseWindow(wxCloseEvent& event);
65
66 // Set menu bar
67 void SetMenuBar(wxMenuBar *menu_bar);
68 virtual wxMenuBar *GetMenuBar() const ;
69
70 // Call this to simulate a menu command
71 virtual void Command(int id);
72 virtual void ProcessCommand(int id);
73
74 // Set icon
75 virtual void SetIcon(const wxIcon& icon);
76
77 // Create status line
78 virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,
79 const wxString& name = "statusBar");
80 inline wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
81 virtual void PositionStatusBar();
82 virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID id,
83 const wxString& name);
84
85 #if wxUSE_TOOLBAR
86
87 // Create toolbar
88 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr);
89 virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
90 // If made known to the frame, the frame will manage it automatically.
91 virtual inline void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
92 virtual inline wxToolBar *GetToolBar() const { return m_frameToolBar; }
93 virtual void PositionToolBar();
94
95 #endif
96
97 // Set status line text
98 virtual void SetStatusText(const wxString& text, int number = 0);
99
100 // Set status line widths
101 virtual void SetStatusWidths(int n, const int widths_field[]);
102
103 // Hint to tell framework which status bar to use
104 // TODO: should this go into a wxFrameworkSettings class perhaps?
105 static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
106 static bool UsesNativeStatusBar() { return m_useNativeStatusBar; };
107
108 // Fit frame around subwindows
109 virtual void Fit();
110
111 // Iconize
112 virtual void Iconize(bool iconize);
113
114 virtual bool IsIconized() const ;
115
116 // Compatibility
117 inline bool Iconized() const { return IsIconized(); }
118
119 // Is the frame maximized?
120 virtual bool IsMaximized(void) const ;
121
122 virtual void Maximize(bool maximize);
123
124 // Responds to colour changes
125 void OnSysColourChanged(wxSysColourChangedEvent& event);
126
127 // Query app for menu item updates (called from OnIdle)
128 // Query app for menu item updates (called from OnIdle)
129 void DoMenuUpdates();
130 void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
131
132 // Checks if there is a toolbar, and returns the first free client position
133 virtual wxPoint GetClientAreaOrigin() const;
134 virtual void DoGetClientSize(int *x, int *y) const ;
135 virtual void DoSetClientSize(int clientwidth, int clientheight) ;
136
137 // tooltip management
138 #if wxUSE_TOOLTIPS
139 wxMacToolTip* GetToolTipCtrl() const { return m_hwndToolTip; }
140 void SetToolTipCtrl(wxMacToolTip *tt) { m_hwndToolTip = tt; }
141 wxMacToolTip* m_hwndToolTip ;
142 #endif // tooltips
143
144 protected:
145 wxMenuBar * m_frameMenuBar;
146 wxStatusBar * m_frameStatusBar;
147 wxIcon m_icon;
148 bool m_iconized;
149 static bool m_useNativeStatusBar;
150 #if wxUSE_TOOLBAR
151 wxToolBar * m_frameToolBar ;
152 #endif
153
154 DECLARE_EVENT_TABLE()
155 };
156
157 #endif
158 // _WX_FRAME_H_