1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: frame.h
|
|
|
|
// Purpose: wxFrame class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart and Markus Holzem
|
1999-02-14 16:59:48 -05:00
|
|
|
// Licence: wxWindows license
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_FRAME_H_
|
|
|
|
#define _WX_FRAME_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1999-05-18 20:53:27 -04:00
|
|
|
#pragma interface "frame.h"
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/window.h"
|
1998-07-27 05:47:57 -04:00
|
|
|
#include "wx/toolbar.h"
|
1998-07-31 09:01:34 -04:00
|
|
|
#include "wx/msw/accel.h"
|
1999-05-09 20:42:57 -04:00
|
|
|
#include "wx/icon.h"
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-04-19 13:47:19 -04:00
|
|
|
WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
|
|
|
|
WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr;
|
|
|
|
WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
class WXDLLEXPORT wxMenuBar;
|
|
|
|
class WXDLLEXPORT wxStatusBar;
|
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
class WXDLLEXPORT wxFrame : public wxWindow
|
|
|
|
{
|
1999-05-18 20:53:27 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxFrame)
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
public:
|
1999-01-31 18:38:10 -05:00
|
|
|
wxFrame();
|
|
|
|
wxFrame(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE,
|
|
|
|
const wxString& name = wxFrameNameStr)
|
|
|
|
{
|
|
|
|
Create(parent, id, title, pos, size, style, name);
|
|
|
|
}
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
~wxFrame();
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE,
|
|
|
|
const wxString& name = wxFrameNameStr);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
virtual bool Destroy();
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-02-26 17:22:13 -05:00
|
|
|
virtual void ClientToScreen(int *x, int *y) const;
|
1999-01-31 18:38:10 -05:00
|
|
|
virtual void ScreenToClient(int *x, int *y) const;
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
void OnSize(wxSizeEvent& event);
|
|
|
|
void OnMenuHighlight(wxMenuEvent& event);
|
|
|
|
void OnActivate(wxActivateEvent& event);
|
|
|
|
void OnIdle(wxIdleEvent& event);
|
|
|
|
void OnCloseWindow(wxCloseEvent& event);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
bool Show(bool show);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Set menu bar
|
|
|
|
void SetMenuBar(wxMenuBar *menu_bar);
|
1999-05-18 20:53:27 -04:00
|
|
|
virtual wxMenuBar *GetMenuBar() const;
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Call this to simulate a menu command
|
1999-05-19 00:41:23 -04:00
|
|
|
bool Command(int id) { return ProcessCommand(id); }
|
1999-05-18 20:53:27 -04:00
|
|
|
|
|
|
|
// process menu command: returns TRUE if processed
|
|
|
|
bool ProcessCommand(int id);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-06-08 03:01:10 -04:00
|
|
|
// make the window modal (all other windows unresponsive)
|
|
|
|
virtual void MakeModal(bool modal = TRUE);
|
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Set icon
|
|
|
|
virtual void SetIcon(const wxIcon& icon);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Toolbar
|
1999-06-13 18:54:04 -04:00
|
|
|
#if wxUSE_TOOLBAR
|
1999-01-31 18:38:10 -05:00
|
|
|
virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
|
|
|
|
wxWindowID id = -1,
|
|
|
|
const wxString& name = wxToolBarNameStr);
|
|
|
|
|
|
|
|
virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
|
|
|
|
|
|
|
|
virtual void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
|
|
|
|
virtual wxToolBar *GetToolBar() const { return m_frameToolBar; }
|
|
|
|
|
|
|
|
virtual void PositionToolBar();
|
1999-06-13 18:54:04 -04:00
|
|
|
#endif // wxUSE_TOOLBAR
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-06-13 18:54:04 -04:00
|
|
|
#if wxUSE_STATUSBAR
|
1999-01-31 18:38:10 -05:00
|
|
|
// Status bar
|
|
|
|
virtual wxStatusBar* CreateStatusBar(int number = 1,
|
|
|
|
long style = wxST_SIZEGRIP,
|
|
|
|
wxWindowID id = 0,
|
|
|
|
const wxString& name = wxStatusLineNameStr);
|
|
|
|
|
|
|
|
wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
|
|
|
|
void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; }
|
|
|
|
|
|
|
|
virtual void PositionStatusBar();
|
|
|
|
virtual wxStatusBar *OnCreateStatusBar(int number,
|
|
|
|
long style,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& name);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Set status line text
|
|
|
|
virtual void SetStatusText(const wxString& text, int number = 0);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Set status line widths
|
|
|
|
virtual void SetStatusWidths(int n, const int widths_field[]);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Hint to tell framework which status bar to use
|
|
|
|
// TODO: should this go into a wxFrameworkSettings class perhaps?
|
|
|
|
static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
|
|
|
|
static bool UsesNativeStatusBar() { return m_useNativeStatusBar; };
|
1999-06-13 18:54:04 -04:00
|
|
|
#endif // wxUSE_STATUSBAR
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Iconize
|
|
|
|
virtual void Iconize(bool iconize);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-05-18 20:53:27 -04:00
|
|
|
virtual bool IsIconized() const;
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Is it maximized?
|
1999-05-18 20:53:27 -04:00
|
|
|
virtual bool IsMaximized() const;
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Compatibility
|
|
|
|
bool Iconized() const { return IsIconized(); }
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
virtual void Maximize(bool maximize);
|
|
|
|
// virtual bool LoadAccelerators(const wxString& table);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Responds to colour changes
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Query app for menu item updates (called from OnIdle)
|
|
|
|
void DoMenuUpdates();
|
1999-04-07 17:33:22 -04:00
|
|
|
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-05-18 20:53:27 -04:00
|
|
|
WXHMENU GetWinMenu() const { return m_hMenu; }
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Returns the origin of client area (may be different from (0,0) if the
|
|
|
|
// frame has a toolbar)
|
|
|
|
virtual wxPoint GetClientAreaOrigin() const;
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Implementation only from here
|
|
|
|
// event handlers
|
1999-05-18 20:53:27 -04:00
|
|
|
bool HandlePaint();
|
|
|
|
bool HandleSize(int x, int y, WXUINT flag);
|
|
|
|
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
|
|
|
bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu);
|
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
bool MSWCreate(int id, wxWindow *parent, const char *wclass,
|
1999-01-31 18:38:10 -05:00
|
|
|
wxWindow *wx_win, const char *title,
|
1998-07-04 11:17:59 -04:00
|
|
|
int x, int y, int width, int height, long style);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-02-14 16:59:48 -05:00
|
|
|
// tooltip management
|
1999-01-31 18:38:10 -05:00
|
|
|
#if wxUSE_TOOLTIPS
|
1999-05-13 17:21:04 -04:00
|
|
|
WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
|
|
|
|
void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
|
1999-01-31 18:38:10 -05:00
|
|
|
#endif // tooltips
|
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
protected:
|
1999-05-13 17:21:04 -04:00
|
|
|
// override base class virtuals
|
|
|
|
virtual void DoGetClientSize(int *width, int *height) const;
|
1999-05-18 20:53:27 -04:00
|
|
|
virtual void DoGetSize(int *width, int *height) const;
|
|
|
|
virtual void DoGetPosition(int *x, int *y) const;
|
1999-05-13 17:21:04 -04:00
|
|
|
|
|
|
|
virtual void DoSetSize(int x, int y,
|
|
|
|
int width, int height,
|
|
|
|
int sizeFlags = wxSIZE_AUTO);
|
|
|
|
virtual void DoSetClientSize(int width, int height);
|
1999-05-09 20:42:57 -04:00
|
|
|
|
1999-05-18 20:53:27 -04:00
|
|
|
// a plug in for MDI frame classes which need to do something special when
|
|
|
|
// the menubar is set
|
|
|
|
virtual void InternalSetMenuBar();
|
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// propagate our state change to all child frames
|
|
|
|
void IconizeChildFrames(bool bIconize);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-05-18 20:53:27 -04:00
|
|
|
// we add menu bar accel processing
|
|
|
|
bool MSWTranslateMessage(WXMSG* pMsg);
|
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// window proc for the frames
|
|
|
|
long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
wxMenuBar * m_frameMenuBar;
|
|
|
|
wxIcon m_icon;
|
|
|
|
bool m_iconized;
|
|
|
|
WXHICON m_defaultIcon;
|
1999-06-13 18:54:04 -04:00
|
|
|
|
|
|
|
#if wxUSE_STATUSBAR
|
|
|
|
wxStatusBar * m_frameStatusBar;
|
1999-01-31 18:38:10 -05:00
|
|
|
|
|
|
|
static bool m_useNativeStatusBar;
|
1999-06-13 18:54:04 -04:00
|
|
|
#endif // wxUSE_STATUSBAR
|
|
|
|
|
|
|
|
#if wxUSE_TOOLBAR
|
|
|
|
wxToolBar * m_frameToolBar;
|
|
|
|
#endif // wxUSE_TOOLBAR
|
1999-01-31 18:38:10 -05:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
private:
|
1999-01-31 18:38:10 -05:00
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
WXHWND m_hwndToolTip;
|
|
|
|
#endif // tooltips
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_FRAME_H_
|