1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1999-11-16 21:31:40 +00:00
|
|
|
// Name: wx/msw/frame.h
|
1998-05-20 14:12:05 +00:00
|
|
|
// 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 21:59:48 +00:00
|
|
|
// Licence: wxWindows license
|
1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 23:52:45 +00:00
|
|
|
#ifndef _WX_FRAME_H_
|
|
|
|
#define _WX_FRAME_H_
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1999-05-19 00:53:27 +00:00
|
|
|
#pragma interface "frame.h"
|
1998-05-20 14:12:05 +00:00
|
|
|
#endif
|
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
class WXDLLEXPORT wxFrame : public wxFrameBase
|
1999-01-31 23:38:10 +00:00
|
|
|
{
|
1998-05-20 14:12:05 +00:00
|
|
|
public:
|
1999-11-16 21:31:40 +00:00
|
|
|
// construction
|
|
|
|
wxFrame() { Init(); }
|
1999-01-31 23:38:10 +00:00
|
|
|
wxFrame(wxWindow *parent,
|
1999-11-16 21:31:40 +00:00
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE,
|
|
|
|
const wxString& name = wxFrameNameStr)
|
1999-01-31 23:38:10 +00:00
|
|
|
{
|
1999-11-16 21:31:40 +00:00
|
|
|
Init();
|
|
|
|
|
1999-01-31 23:38:10 +00:00
|
|
|
Create(parent, id, title, pos, size, style, name);
|
|
|
|
}
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-01-31 23:38:10 +00: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 21:59:48 +00:00
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
virtual ~wxFrame();
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
// implement base class pure virtuals
|
|
|
|
virtual void Maximize(bool maximize = TRUE);
|
|
|
|
virtual bool IsMaximized() const;
|
|
|
|
virtual void Iconize(bool iconize = TRUE);
|
|
|
|
virtual bool IsIconized() const;
|
|
|
|
virtual void Restore();
|
|
|
|
virtual void SetMenuBar(wxMenuBar *menubar);
|
|
|
|
virtual void SetIcon(const wxIcon& icon);
|
2000-02-08 19:14:50 +00:00
|
|
|
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
|
|
|
virtual bool IsFullScreen() const { return m_fsIsShowing; };
|
1999-05-19 00:53:27 +00:00
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
// override some more virtuals
|
|
|
|
virtual bool Show(bool show = TRUE);
|
1999-06-08 07:01:10 +00:00
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
// event handlers
|
|
|
|
void OnActivate(wxActivateEvent& event);
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-01-31 23:38:10 +00:00
|
|
|
// Toolbar
|
1999-06-13 22:54:04 +00:00
|
|
|
#if wxUSE_TOOLBAR
|
1999-01-31 23:38:10 +00:00
|
|
|
virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
|
|
|
|
wxWindowID id = -1,
|
|
|
|
const wxString& name = wxToolBarNameStr);
|
|
|
|
|
|
|
|
virtual void PositionToolBar();
|
1999-06-13 22:54:04 +00:00
|
|
|
#endif // wxUSE_TOOLBAR
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-01-31 23:38:10 +00:00
|
|
|
// Status bar
|
1999-11-16 21:31:40 +00:00
|
|
|
#if wxUSE_STATUSBAR
|
|
|
|
virtual wxStatusBar* OnCreateStatusBar(int number = 1,
|
|
|
|
long style = wxST_SIZEGRIP,
|
|
|
|
wxWindowID id = 0,
|
|
|
|
const wxString& name = wxStatusLineNameStr);
|
1999-01-31 23:38:10 +00:00
|
|
|
|
|
|
|
virtual void PositionStatusBar();
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
// Hint to tell framework which status bar to use: the default is to use
|
|
|
|
// native one for the platforms which support it (Win32), the generic one
|
|
|
|
// otherwise
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-01-31 23:38:10 +00:00
|
|
|
// TODO: should this go into a wxFrameworkSettings class perhaps?
|
1999-11-16 21:31:40 +00:00
|
|
|
static void UseNativeStatusBar(bool useNative)
|
|
|
|
{ m_useNativeStatusBar = useNative; };
|
|
|
|
static bool UsesNativeStatusBar()
|
|
|
|
{ return m_useNativeStatusBar; };
|
1999-06-13 22:54:04 +00:00
|
|
|
#endif // wxUSE_STATUSBAR
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
WXHMENU GetWinMenu() const { return m_hMenu; }
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
// event handlers
|
1999-05-19 00:53:27 +00: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-06-14 14:20:58 +00:00
|
|
|
bool MSWCreate(int id, wxWindow *parent, const wxChar *wclass,
|
|
|
|
wxWindow *wx_win, const wxChar *title,
|
1998-07-04 15:17:59 +00:00
|
|
|
int x, int y, int width, int height, long style);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
// tooltip management
|
1999-01-31 23:38:10 +00:00
|
|
|
#if wxUSE_TOOLTIPS
|
1999-05-13 21:21:04 +00:00
|
|
|
WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
|
|
|
|
void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
|
1999-01-31 23:38:10 +00:00
|
|
|
#endif // tooltips
|
|
|
|
|
2001-03-31 18:43:54 +00:00
|
|
|
// a MSW only function which sends a size event to the window using its
|
|
|
|
// current size - this has an effect of refreshing the window layout
|
|
|
|
void SendSizeEvent();
|
|
|
|
|
1998-05-20 14:12:05 +00:00
|
|
|
protected:
|
1999-11-16 21:31:40 +00:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
// common part of Iconize(), Maximize() and Restore()
|
|
|
|
void DoShowWindow(int nShowCmd);
|
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// override base class virtuals
|
|
|
|
virtual void DoGetClientSize(int *width, int *height) const;
|
1999-05-19 00:53:27 +00:00
|
|
|
virtual void DoGetSize(int *width, int *height) const;
|
|
|
|
virtual void DoGetPosition(int *x, int *y) const;
|
1999-05-13 21:21:04 +00:00
|
|
|
|
|
|
|
virtual void DoSetClientSize(int width, int height);
|
1999-05-10 00:42:57 +00:00
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
// helper
|
|
|
|
void DetachMenuBar();
|
|
|
|
|
1999-05-19 00:53:27 +00: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 23:38:10 +00:00
|
|
|
// propagate our state change to all child frames
|
|
|
|
void IconizeChildFrames(bool bIconize);
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
// we add menu bar accel processing
|
|
|
|
bool MSWTranslateMessage(WXMSG* pMsg);
|
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// window proc for the frames
|
|
|
|
long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
2000-11-25 23:13:29 +00:00
|
|
|
|
|
|
|
virtual bool IsMDIChild() const { return FALSE; }
|
1999-05-13 21:21:04 +00:00
|
|
|
|
1999-01-31 23:38:10 +00:00
|
|
|
bool m_iconized;
|
|
|
|
WXHICON m_defaultIcon;
|
1999-06-13 22:54:04 +00:00
|
|
|
|
|
|
|
#if wxUSE_STATUSBAR
|
1999-01-31 23:38:10 +00:00
|
|
|
static bool m_useNativeStatusBar;
|
1999-06-13 22:54:04 +00:00
|
|
|
#endif // wxUSE_STATUSBAR
|
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
// the last focused child: we restore focus to it on activation
|
|
|
|
wxWindow *m_winLastFocused;
|
|
|
|
|
2000-02-08 19:14:50 +00:00
|
|
|
// Data to save/restore when calling ShowFullScreen
|
|
|
|
long m_fsStyle; // Passed to ShowFullScreen
|
|
|
|
wxRect m_fsOldSize;
|
|
|
|
long m_fsOldWindowStyle;
|
|
|
|
int m_fsStatusBarFields; // 0 for no status bar
|
|
|
|
int m_fsStatusBarHeight;
|
|
|
|
int m_fsToolBarHeight;
|
|
|
|
// WXHMENU m_fsMenu;
|
|
|
|
bool m_fsIsMaximized;
|
|
|
|
bool m_fsIsShowing;
|
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
private:
|
1999-01-31 23:38:10 +00:00
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
WXHWND m_hwndToolTip;
|
|
|
|
#endif // tooltips
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
1999-11-16 21:31:40 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxFrame)
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 23:52:45 +00:00
|
|
|
// _WX_FRAME_H_
|