1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: frame.h
|
|
|
|
// Purpose: wxFrame class
|
1999-10-07 00:44:22 -04:00
|
|
|
// Author: David Webster
|
1999-07-29 01:11:30 -04:00
|
|
|
// Modified by:
|
1999-10-27 18:47:04 -04:00
|
|
|
// Created: 10/27/99
|
1999-07-29 01:11:30 -04:00
|
|
|
// RCS-ID: $Id$
|
1999-10-07 00:44:22 -04:00
|
|
|
// Copyright: (c) David Webster
|
1999-10-27 18:47:04 -04:00
|
|
|
// Licence: wxWindows license
|
1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_FRAME_H_
|
|
|
|
#define _WX_FRAME_H_
|
|
|
|
|
2000-02-27 23:40:52 -05:00
|
|
|
//
|
|
|
|
// Get the default resource ID's for frames
|
|
|
|
//
|
|
|
|
#include "wx/os2/wxOs2.h"
|
|
|
|
|
2001-10-19 16:35:05 -04:00
|
|
|
class WXDLLEXPORT wxFrame : public wxFrameBase
|
1999-10-24 22:41:20 -04:00
|
|
|
{
|
1999-08-02 00:44:01 -04:00
|
|
|
public:
|
1999-11-19 17:36:55 -05:00
|
|
|
// construction
|
2001-10-19 16:35:05 -04:00
|
|
|
wxFrame() { Init(); }
|
|
|
|
wxFrame( wxWindow* pParent
|
2001-07-06 17:45:11 -04:00
|
|
|
,wxWindowID vId
|
|
|
|
,const wxString& rsTitle
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,long lStyle = wxDEFAULT_FRAME_STYLE
|
|
|
|
,const wxString& rsName = wxFrameNameStr
|
|
|
|
)
|
1999-10-07 00:44:22 -04:00
|
|
|
{
|
1999-11-19 17:36:55 -05:00
|
|
|
Init();
|
|
|
|
|
2000-02-16 16:51:58 -05:00
|
|
|
Create(pParent, vId, rsTitle, rPos, rSize, lStyle, rsName);
|
1999-10-07 00:44:22 -04:00
|
|
|
}
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2000-02-16 16:51:58 -05:00
|
|
|
bool Create( wxWindow* pParent
|
|
|
|
,wxWindowID vId
|
|
|
|
,const wxString& rsTitle
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,long lStyle = wxDEFAULT_FRAME_STYLE
|
|
|
|
,const wxString& rsName = wxFrameNameStr
|
|
|
|
);
|
1999-10-07 00:44:22 -04:00
|
|
|
|
2001-10-19 16:35:05 -04:00
|
|
|
virtual ~wxFrame();
|
1999-10-07 00:44:22 -04:00
|
|
|
|
1999-11-19 17:36:55 -05:00
|
|
|
// implement base class pure virtuals
|
2000-02-16 16:51:58 -05:00
|
|
|
virtual void Maximize(bool bMaximize = TRUE);
|
|
|
|
virtual bool IsMaximized(void) const;
|
|
|
|
virtual void Iconize(bool bIconize = TRUE);
|
|
|
|
virtual bool IsIconized(void) const;
|
|
|
|
virtual void Restore(void);
|
2001-10-17 18:25:56 -04:00
|
|
|
#if wxUSE_MENUS_NATIVE
|
2000-02-16 16:51:58 -05:00
|
|
|
virtual void SetMenuBar(wxMenuBar* pMenubar);
|
2001-10-17 18:25:56 -04:00
|
|
|
#endif
|
2000-02-16 16:51:58 -05:00
|
|
|
virtual void SetIcon(const wxIcon& rIcon);
|
|
|
|
virtual bool ShowFullScreen( bool bShow
|
|
|
|
,long lStyle = wxFULLSCREEN_ALL
|
|
|
|
);
|
2000-02-21 00:12:34 -05:00
|
|
|
virtual bool IsFullScreen(void) const { return m_bFsIsShowing; };
|
2000-02-16 16:51:58 -05:00
|
|
|
|
1999-10-07 00:44:22 -04:00
|
|
|
|
1999-11-19 17:36:55 -05:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
1999-10-07 00:44:22 -04:00
|
|
|
|
2001-10-22 01:11:09 -04:00
|
|
|
void AlterChildPos(void);
|
1999-11-19 17:36:55 -05:00
|
|
|
// override some more virtuals
|
2000-02-16 16:51:58 -05:00
|
|
|
virtual bool Show(bool bShow = TRUE);
|
1999-10-07 00:44:22 -04:00
|
|
|
|
1999-11-19 17:36:55 -05:00
|
|
|
// event handlers
|
2000-02-16 16:51:58 -05:00
|
|
|
void OnActivate(wxActivateEvent& rEvent);
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
|
1999-10-07 00:44:22 -04:00
|
|
|
|
|
|
|
// Toolbar
|
|
|
|
#if wxUSE_TOOLBAR
|
2000-02-16 16:51:58 -05:00
|
|
|
virtual wxToolBar* CreateToolBar( long lStyle = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT
|
|
|
|
,wxWindowID vId = -1
|
|
|
|
,const wxString& rsName = wxToolBarNameStr
|
|
|
|
);
|
1999-10-07 00:44:22 -04:00
|
|
|
|
2000-02-16 16:51:58 -05:00
|
|
|
virtual void PositionToolBar(void);
|
1999-10-07 00:44:22 -04:00
|
|
|
#endif // wxUSE_TOOLBAR
|
|
|
|
|
|
|
|
// Status bar
|
1999-11-19 17:36:55 -05:00
|
|
|
#if wxUSE_STATUSBAR
|
2000-02-16 16:51:58 -05:00
|
|
|
virtual wxStatusBar* OnCreateStatusBar( int nNumber = 1
|
|
|
|
,long lStyle = wxST_SIZEGRIP
|
|
|
|
,wxWindowID vId = 0
|
|
|
|
,const wxString& rsName = wxStatusLineNameStr
|
|
|
|
);
|
|
|
|
virtual void PositionStatusBar(void);
|
1999-10-07 00:44:22 -04:00
|
|
|
|
1999-11-19 17:36:55 -05: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-10-07 00:44:22 -04:00
|
|
|
|
|
|
|
// TODO: should this go into a wxFrameworkSettings class perhaps?
|
2000-02-16 16:51:58 -05:00
|
|
|
static void UseNativeStatusBar(bool bUseNative)
|
2000-02-17 18:31:03 -05:00
|
|
|
{ m_bUseNativeStatusBar = bUseNative; };
|
1999-11-19 17:36:55 -05:00
|
|
|
static bool UsesNativeStatusBar()
|
2000-02-17 18:31:03 -05:00
|
|
|
{ return m_bUseNativeStatusBar; };
|
1999-10-07 00:44:22 -04:00
|
|
|
#endif // wxUSE_STATUSBAR
|
|
|
|
|
|
|
|
WXHMENU GetWinMenu() const { return m_hMenu; }
|
|
|
|
|
|
|
|
// Returns the origin of client area (may be different from (0,0) if the
|
|
|
|
// frame has a toolbar)
|
|
|
|
virtual wxPoint GetClientAreaOrigin() const;
|
|
|
|
|
1999-11-19 17:36:55 -05:00
|
|
|
// event handlers
|
2000-02-16 16:51:58 -05:00
|
|
|
bool HandlePaint(void);
|
|
|
|
bool HandleSize( int nX
|
|
|
|
,int nY
|
|
|
|
,WXUINT uFlag
|
|
|
|
);
|
|
|
|
bool HandleCommand( WXWORD wId
|
|
|
|
,WXWORD wCmd
|
|
|
|
,WXHWND wControl
|
|
|
|
);
|
|
|
|
bool HandleMenuSelect( WXWORD wItem
|
|
|
|
,WXWORD wFlags
|
|
|
|
,WXHMENU hMenu
|
|
|
|
);
|
|
|
|
|
|
|
|
bool OS2Create( int nId
|
|
|
|
,wxWindow* pParent
|
|
|
|
,const wxChar* zWclass
|
|
|
|
,wxWindow* pWxWin
|
|
|
|
,const wxChar* zTitle
|
|
|
|
,int nX
|
|
|
|
,int nY
|
|
|
|
,int nWidth
|
|
|
|
,int nHeight
|
|
|
|
,long nStyle
|
|
|
|
);
|
1999-10-07 00:44:22 -04:00
|
|
|
|
1999-11-19 17:36:55 -05:00
|
|
|
// tooltip management
|
1999-10-07 00:44:22 -04:00
|
|
|
#if wxUSE_TOOLTIPS
|
2000-02-21 00:12:34 -05:00
|
|
|
WXHWND GetToolTipCtrl(void) const { return m_hWndToolTip; }
|
|
|
|
void SetToolTipCtrl(WXHWND hHwndTT) { m_hWndToolTip = hHwndTT; }
|
1999-10-07 00:44:22 -04:00
|
|
|
#endif // tooltips
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2001-05-29 14:59:17 -04:00
|
|
|
//
|
|
|
|
// Called by wxWindow whenever it gets focus
|
|
|
|
//
|
|
|
|
void SetLastFocus(wxWindow* pWin) { m_pWinLastFocused = pWin; }
|
|
|
|
wxWindow *GetLastFocus(void) const { return m_pWinLastFocused; }
|
|
|
|
|
2000-10-01 22:45:47 -04:00
|
|
|
void SetClient(WXHWND c_Hwnd);
|
|
|
|
void SetClient(wxWindow* c_Window);
|
|
|
|
wxWindow *GetClient();
|
2000-11-20 00:18:32 -05:00
|
|
|
HWND GetFrame(void) const { return m_hFrame; }
|
2000-10-01 22:45:47 -04:00
|
|
|
|
2000-11-17 01:01:48 -05:00
|
|
|
friend MRESULT EXPENTRY wxFrameWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
|
|
|
|
friend MRESULT EXPENTRY wxFrameMainWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
|
|
|
|
|
1999-07-29 01:11:30 -04:00
|
|
|
protected:
|
1999-11-19 17:36:55 -05:00
|
|
|
// common part of all ctors
|
2000-02-16 16:51:58 -05:00
|
|
|
void Init(void);
|
1999-11-19 17:36:55 -05:00
|
|
|
|
|
|
|
// common part of Iconize(), Maximize() and Restore()
|
2000-02-16 16:51:58 -05:00
|
|
|
void DoShowWindow(int nShowCmd);
|
1999-11-19 17:36:55 -05:00
|
|
|
|
1999-10-07 00:44:22 -04:00
|
|
|
// override base class virtuals
|
2000-02-16 16:51:58 -05:00
|
|
|
virtual void DoGetClientSize( int* pWidth
|
|
|
|
,int* pHeight
|
|
|
|
) const;
|
|
|
|
virtual void DoGetSize( int* pWidth
|
|
|
|
,int* pHeight
|
|
|
|
) const;
|
|
|
|
virtual void DoGetPosition( int* pX
|
|
|
|
,int* pY
|
|
|
|
) const;
|
|
|
|
virtual void DoSetClientSize( int nWidth
|
|
|
|
,int nWeight
|
|
|
|
);
|
1999-10-24 11:57:35 -04:00
|
|
|
|
2001-10-17 18:25:56 -04:00
|
|
|
#if wxUSE_MENUS_NATIVE
|
1999-11-19 17:36:55 -05:00
|
|
|
// helper
|
2000-02-16 16:51:58 -05:00
|
|
|
void DetachMenuBar(void);
|
2001-07-13 13:41:54 -04:00
|
|
|
// perform MSW-specific action when menubar is changed
|
|
|
|
virtual void AttachMenuBar(wxMenuBar* pMenubar);
|
1999-10-07 00:44:22 -04:00
|
|
|
// a plug in for MDI frame classes which need to do something special when
|
|
|
|
// the menubar is set
|
2000-02-16 16:51:58 -05:00
|
|
|
virtual void InternalSetMenuBar(void);
|
2001-07-13 13:41:54 -04:00
|
|
|
#endif
|
1999-10-07 00:44:22 -04:00
|
|
|
// propagate our state change to all child frames
|
|
|
|
void IconizeChildFrames(bool bIconize);
|
|
|
|
|
|
|
|
// we add menu bar accel processing
|
|
|
|
bool OS2TranslateMessage(WXMSG* pMsg);
|
|
|
|
|
|
|
|
// window proc for the frames
|
2000-02-16 16:51:58 -05:00
|
|
|
MRESULT OS2WindowProc( WXUINT uMessage
|
|
|
|
,WXWPARAM wParam
|
|
|
|
,WXLPARAM lParam
|
|
|
|
);
|
1999-10-07 00:44:22 -04:00
|
|
|
|
2000-02-16 16:51:58 -05:00
|
|
|
bool m_bIconized;
|
|
|
|
WXHICON m_hDefaultIcon;
|
1999-10-07 00:44:22 -04:00
|
|
|
|
|
|
|
#if wxUSE_STATUSBAR
|
2000-02-16 16:51:58 -05:00
|
|
|
static bool m_bUseNativeStatusBar;
|
1999-10-07 00:44:22 -04:00
|
|
|
#endif // wxUSE_STATUSBAR
|
|
|
|
|
2000-02-16 16:51:58 -05:00
|
|
|
// Data to save/restore when calling ShowFullScreen
|
|
|
|
long m_lFsStyle; // Passed to ShowFullScreen
|
|
|
|
wxRect m_vFsOldSize;
|
|
|
|
long m_lFsOldWindowStyle;
|
|
|
|
int m_nFsStatusBarFields; // 0 for no status bar
|
|
|
|
int m_nFsStatusBarHeight;
|
|
|
|
int m_nFsToolBarHeight;
|
|
|
|
bool m_bFsIsMaximized;
|
|
|
|
bool m_bFsIsShowing;
|
2001-11-16 13:40:45 -05:00
|
|
|
bool m_bWasMinimized;
|
2000-08-21 07:08:33 -04:00
|
|
|
bool m_bIsShown;
|
|
|
|
wxWindow* m_pWinLastFocused;
|
2000-02-16 16:51:58 -05:00
|
|
|
|
1999-10-07 00:44:22 -04:00
|
|
|
private:
|
|
|
|
#if wxUSE_TOOLTIPS
|
2000-02-17 18:31:03 -05:00
|
|
|
WXHWND m_hWndToolTip;
|
1999-10-07 00:44:22 -04:00
|
|
|
#endif // tooltips
|
|
|
|
|
2000-03-22 18:22:48 -05:00
|
|
|
//
|
2000-11-17 01:01:48 -05:00
|
|
|
// Handles to child windows of the Frame, and the frame itself,
|
|
|
|
// that we don't have child objects for (m_hWnd in wxWindow is the
|
|
|
|
// handle of the Frame's client window!
|
2000-03-22 18:22:48 -05:00
|
|
|
//
|
2000-11-17 01:01:48 -05:00
|
|
|
WXHWND m_hFrame;
|
2000-03-22 18:22:48 -05:00
|
|
|
WXHWND m_hTitleBar;
|
|
|
|
WXHWND m_hHScroll;
|
|
|
|
WXHWND m_hVScroll;
|
|
|
|
|
|
|
|
//
|
2000-07-15 15:51:35 -04:00
|
|
|
// Swp structures for various client data
|
2000-03-22 18:22:48 -05:00
|
|
|
// DW: Better off in attached RefData?
|
|
|
|
//
|
|
|
|
SWP m_vSwp;
|
|
|
|
SWP m_vSwpClient;
|
|
|
|
SWP m_vSwpTitleBar;
|
|
|
|
SWP m_vSwpMenuBar;
|
|
|
|
SWP m_vSwpHScroll;
|
|
|
|
SWP m_vSwpVScroll;
|
|
|
|
SWP m_vSwpStatusBar;
|
|
|
|
SWP m_vSwpToolBar;
|
|
|
|
|
1999-10-07 00:44:22 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
2001-10-19 16:35:05 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxFrame)
|
1999-07-29 01:11:30 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_FRAME_H_
|
1999-10-07 00:44:22 -04:00
|
|
|
|