]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/frame.h
2nd attempt at MDI in wxMotif, using wxNotebook this time (still some probs).
[wxWidgets.git] / include / wx / msw / frame.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: frame.h
3// Purpose: wxFrame class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_FRAME_H_
13#define _WX_FRAME_H_
2bda0e17
KB
14
15#ifdef __GNUG__
16#pragma interface "frame.h"
17#endif
18
19#include "wx/window.h"
81d66cf3 20#include "wx/toolbar.h"
57a7b7c1 21#include "wx/msw/accel.h"
2bda0e17
KB
22
23WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
81d66cf3 24WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
2bda0e17
KB
25
26class WXDLLEXPORT wxMenuBar;
27class WXDLLEXPORT wxStatusBar;
28
29class WXDLLEXPORT wxFrame: public wxWindow {
30
31 DECLARE_DYNAMIC_CLASS(wxFrame)
32
33public:
34 wxFrame(void);
35 inline wxFrame(wxWindow *parent,
debe6624 36 wxWindowID id,
2bda0e17
KB
37 const wxString& title,
38 const wxPoint& pos = wxDefaultPosition,
39 const wxSize& size = wxDefaultSize,
debe6624 40 long style = wxDEFAULT_FRAME_STYLE,
2bda0e17
KB
41 const wxString& name = wxFrameNameStr)
42 {
43 Create(parent, id, title, pos, size, style, name);
44 }
45
46 ~wxFrame(void);
47
48 bool Create(wxWindow *parent,
debe6624 49 wxWindowID id,
2bda0e17
KB
50 const wxString& title,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
debe6624 53 long style = wxDEFAULT_FRAME_STYLE,
2bda0e17
KB
54 const wxString& name = wxFrameNameStr);
55
2bda0e17 56 virtual bool Destroy(void);
debe6624 57 void SetClientSize(int width, int height);
2bda0e17
KB
58 void GetClientSize(int *width, int *height) const;
59
60 void GetSize(int *width, int *height) const ;
61 void GetPosition(int *x, int *y) const ;
debe6624 62 void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
87d1e11f
JS
63 void ClientToScreen(int *x, int *y) const;
64 void ScreenToClient(int *x, int *y) const;
2bda0e17 65
9123006f
JS
66 virtual bool OnClose(void);
67
2bda0e17
KB
68 void OnSize(wxSizeEvent& event);
69 void OnMenuHighlight(wxMenuEvent& event);
70 void OnActivate(wxActivateEvent& event);
71 void OnIdle(wxIdleEvent& event);
72 void OnCloseWindow(wxCloseEvent& event);
73
debe6624 74 bool Show(bool show);
2bda0e17
KB
75
76 // Set menu bar
77 void SetMenuBar(wxMenuBar *menu_bar);
78 virtual wxMenuBar *GetMenuBar(void) const ;
79
80 // Set title
81 void SetTitle(const wxString& title);
82 wxString GetTitle(void) const ;
83
debe6624 84 void Centre(int direction = wxBOTH);
2bda0e17
KB
85
86 // Call this to simulate a menu command
87 virtual void Command(int id);
88 virtual void ProcessCommand(int id);
89
90 // Set icon
91 virtual void SetIcon(const wxIcon& icon);
92
93 // Create status line
81d66cf3
JS
94 virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,
95 const wxString& name = "statusBar");
2bda0e17 96 inline wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
d1c74ca9 97 inline void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; }
81d66cf3
JS
98 virtual void PositionStatusBar(void);
99 virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID id,
100 const wxString& name);
101
102 // Create toolbar
103 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr);
104 virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
105 // If made known to the frame, the frame will manage it automatically.
106 virtual inline void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
107 virtual inline wxToolBar *GetToolBar(void) const { return m_frameToolBar; }
108 virtual void PositionToolBar(void);
2bda0e17
KB
109
110 // Set status line text
debe6624 111 virtual void SetStatusText(const wxString& text, int number = 0);
2bda0e17
KB
112
113 // Set status line widths
8b9518ee 114 virtual void SetStatusWidths(int n, const int widths_field[]);
2bda0e17
KB
115
116 // Hint to tell framework which status bar to use
117 // TODO: should this go into a wxFrameworkSettings class perhaps?
118 static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
119 static bool UsesNativeStatusBar(void) { return m_useNativeStatusBar; };
120
121 // Fit frame around subwindows
122 virtual void Fit(void);
123
124 // Iconize
debe6624 125 virtual void Iconize(bool iconize);
2bda0e17
KB
126
127 virtual bool IsIconized(void) const ;
128
129 // Compatibility
130 inline bool Iconized(void) const { return IsIconized(); }
131
debe6624 132 virtual void Maximize(bool maximize);
57a7b7c1
JS
133// virtual bool LoadAccelerators(const wxString& table);
134
81d66cf3
JS
135 // Responds to colour changes
136 void OnSysColourChanged(wxSysColourChangedEvent& event);
2bda0e17
KB
137
138 // Query app for menu item updates (called from OnIdle)
139 void DoMenuUpdates(void);
140 void DoMenuUpdates(wxMenu* menu);
141
142 WXHMENU GetWinMenu(void) const ;
143
81d66cf3
JS
144 // Checks if there is a toolbar, and returns the first free client position
145 virtual wxPoint GetClientAreaOrigin() const;
2bda0e17
KB
146
147 // Handlers
148 bool MSWOnPaint(void);
149 WXHICON MSWOnQueryDragIcon(void);
debe6624
JS
150 void MSWOnSize(int x, int y, WXUINT flag);
151 bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
2bda0e17 152 bool MSWOnClose(void);
debe6624 153 void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
2bda0e17 154 bool MSWProcessMessage(WXMSG *msg);
57a7b7c1 155 bool MSWTranslateMessage(WXMSG *msg);
debe6624
JS
156 void MSWCreate(int id, wxWindow *parent, const char *WXUNUSED(wclass), wxWindow *wx_win, const char *title,
157 int x, int y, int width, int height, long style);
2bda0e17
KB
158
159protected:
d2aef312
VZ
160 // propagate our state change to all child frames
161 void IconizeChildFrames(bool bIconize);
162
2bda0e17
KB
163 wxMenuBar * m_frameMenuBar;
164 wxStatusBar * m_frameStatusBar;
165 wxIcon m_icon;
166 bool m_iconized;
167 WXHICON m_defaultIcon;
168 static bool m_useNativeStatusBar;
81d66cf3 169 wxToolBar * m_frameToolBar ;
2bda0e17
KB
170
171 DECLARE_EVENT_TABLE()
172};
173
174#endif
bbcdf8bc 175 // _WX_FRAME_H_