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__
|
|
|
|
#pragma interface "frame.h"
|
|
|
|
#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"
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
|
1998-07-27 05:47:57 -04:00
|
|
|
WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
|
1998-12-28 07:35:49 -05:00
|
|
|
WXDLLEXPORT_DATA(extern const char*) 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
|
|
|
|
{
|
|
|
|
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-01-31 18:38:10 -05:00
|
|
|
void GetClientSize(int *width, int *height) const;
|
|
|
|
void GetSize(int *width, int *height) const ;
|
|
|
|
void GetPosition(int *x, int *y) const ;
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-02-26 17:22:13 -05:00
|
|
|
wxSize GetSize() const { return wxWindow::GetSize(); }
|
|
|
|
wxPoint GetPosition() const { return wxWindow::GetPosition(); }
|
|
|
|
wxSize GetClientSize() const { return wxWindow::GetClientSize(); }
|
|
|
|
wxRect GetClientRect() const { return wxWindow::GetClientRect(); }
|
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);
|
|
|
|
virtual wxMenuBar *GetMenuBar() const ;
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Set title
|
|
|
|
void SetTitle(const wxString& title);
|
|
|
|
wxString GetTitle() const ;
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
void Centre(int direction = wxBOTH);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Call this to simulate a menu command
|
|
|
|
virtual void Command(int id);
|
|
|
|
virtual void ProcessCommand(int id);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
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
|
|
|
|
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-02-14 16:59:48 -05:00
|
|
|
|
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-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Fit frame around subwindows
|
|
|
|
virtual void Fit();
|
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-01-31 18:38:10 -05:00
|
|
|
virtual bool IsIconized() const ;
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
// Is it maximized?
|
|
|
|
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-01-31 18:38:10 -05:00
|
|
|
WXHMENU GetWinMenu() const ;
|
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
|
|
|
|
bool MSWOnPaint();
|
|
|
|
WXHICON MSWOnQueryDragIcon();
|
|
|
|
void MSWOnSize(int x, int y, WXUINT flag);
|
|
|
|
bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
|
|
|
bool MSWOnClose();
|
|
|
|
void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
|
|
|
|
bool MSWProcessMessage(WXMSG *msg);
|
|
|
|
bool MSWTranslateMessage(WXMSG *msg);
|
|
|
|
void MSWCreate(int id, wxWindow *parent, const char *wclass,
|
|
|
|
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-02-14 16:59:48 -05: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-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-01-31 18:38:10 -05:00
|
|
|
wxMenuBar * m_frameMenuBar;
|
|
|
|
wxStatusBar * m_frameStatusBar;
|
|
|
|
wxIcon m_icon;
|
|
|
|
bool m_iconized;
|
|
|
|
WXHICON m_defaultIcon;
|
|
|
|
wxToolBar * m_frameToolBar ;
|
|
|
|
|
|
|
|
static bool m_useNativeStatusBar;
|
|
|
|
|
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
WXHWND m_hwndToolTip;
|
|
|
|
#endif // tooltips
|
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
virtual void DoSetSize(int x, int y,
|
|
|
|
int width, int height,
|
|
|
|
int sizeFlags = wxSIZE_AUTO);
|
|
|
|
virtual void DoSetClientSize(int width, int height);
|
|
|
|
|
1999-01-31 18:38:10 -05:00
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_FRAME_H_
|