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