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