1. wxMSW seems to work (please test and send your bug reports!)

2. accelerators in the menus a la GTK (actually slightly better) implemented
3. wxSplitter now uses events (and so the code which was broken by recent changes
   works again)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2504 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-05-19 00:53:27 +00:00
parent f0492f7d97
commit 42e69d6b43
62 changed files with 4317 additions and 4037 deletions

View File

@@ -398,8 +398,6 @@ public:
if ( x ) *x = m_userScaleX;
if ( y ) *y = m_userScaleY;
}
void SetSystemScale(double x, double y)
{ SetUserScale(x, y); }
virtual void SetUserScale(double x, double y) = 0;
virtual void GetLogicalScale(double *x, double *y)

View File

@@ -202,6 +202,12 @@
typedef unsigned char wxByte;
typedef short int WXTYPE;
// special care should be taken with this type under Windows where the real
// window id is unsigned, so we must always do the cast before comparing them
// (or else they would be always different!). Usign wxGetWindowId() which does
// the cast itself is recommended. Note that this type can't be unsigned
// because -1 is a valid (and largely used) value for window id.
typedef int wxWindowID;
// Macro to cut down on compiler warnings.

View File

@@ -19,8 +19,9 @@
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/gdicmn.h"
#if wxUSE_THREADS
#include "wx/thread.h"
#include "wx/thread.h"
#endif
/*
@@ -217,6 +218,11 @@ const wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED = wxEVT_FIRST + 802;
const wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING = wxEVT_FIRST + 803;
#endif
/* Splitter events */
const wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED = wxEVT_FIRST + 850;
const wxEventType wxEVT_COMMAND_SPLITTER_DOUBLECLICKED = wxEVT_FIRST + 851;
const wxEventType wxEVT_COMMAND_SPLITTER_UNSPLIT = wxEVT_FIRST + 852;
const wxEventType wxEVT_USER_FIRST = wxEVT_FIRST + 2000;
/* Compatibility */
@@ -307,13 +313,12 @@ public:
void CopyObject(wxObject& object_dest) const;
public:
bool m_skipped;
wxObject* m_eventObject;
char* m_eventHandle; // Handle of an underlying windowing system event
wxEventType m_eventType;
long m_timeStamp;
int m_id;
wxObject* m_callbackUserData;
bool m_skipped;
// optimization: instead of using costly IsKindOf() we keep a flag telling
// whether we're a command event (by far the most common case)
@@ -1166,7 +1171,7 @@ protected:
wxEVT_NAVIGATION_KEY
*/
// must derive from command event to be propagated to the parent
class WXDLLEXPORT wxNavigationKeyEvent : public wxCommandEvent
class WXDLLEXPORT wxNavigationKeyEvent : public wxCommandEvent
{
DECLARE_DYNAMIC_CLASS(wxNavigationKeyEvent)
@@ -1188,10 +1193,38 @@ public:
void SetCurrentFocus(wxWindow *win) { m_clientData = (void *)win; }
};
// Window creation/destruction events: the first is sent as soon as window is
// created (i.e. the underlying GUI object exists), but when the C++ object is
// fully initialized (so virtual functions may be called). The second,
// wxEVT_DESTROY, is sent right before the window is destroyed - again, it's
// still safe to call virtual functions at this moment
/*
wxEVT_CREATE
wxEVT_DESTROY
*/
class WXDLLEXPORT wxWindowCreateEvent : public wxEvent
{
DECLARE_DYNAMIC_CLASS(wxWindowCreateEvent)
public:
wxWindowCreateEvent(wxWindow *win = NULL);
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
};
class WXDLLEXPORT wxWindowDestroyEvent : public wxEvent
{
DECLARE_DYNAMIC_CLASS(wxWindowDestroyEvent)
public:
wxWindowDestroyEvent(wxWindow *win = NULL);
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
};
/* TODO
wxEVT_POWER,
wxEVT_CREATE,
wxEVT_DESTROY,
wxEVT_MOUSE_CAPTURE_CHANGED,
wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95)
// wxEVT_FONT_CHANGED, // WM_FONTCHANGE: roll into wxEVT_SETTING_CHANGED, but remember to propagate
@@ -1242,6 +1275,7 @@ public:
void SetEvtHandlerEnabled(bool en) { m_enabled = en; }
bool GetEvtHandlerEnabled() const { return m_enabled; }
#if WXWIN_COMPATIBILITY_2
virtual void OnCommand(wxWindow& WXUNUSED(win),
wxCommandEvent& WXUNUSED(event))
{
@@ -1252,6 +1286,7 @@ public:
// Default behaviour
virtual long Default()
{ return GetNextHandler() ? GetNextHandler()->Default() : 0; };
#endif // WXWIN_COMPATIBILITY_2
#if WXWIN_COMPATIBILITY
virtual bool OnClose();
@@ -1295,7 +1330,7 @@ protected:
wxEvtHandler* m_previousHandler;
bool m_enabled; // Is event handler enabled?
wxList* m_dynamicEvents;
wxList* m_pendingEvents;
wxList* m_pendingEvents;
#if wxUSE_THREADS
wxCriticalSection* m_eventsLocker;
#endif
@@ -1388,6 +1423,8 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
#define EVT_NAVIGATION_KEY(func) { wxEVT_NAVIGATION_KEY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNavigationKeyEventFunction) & func, (wxObject *) NULL },
#define EVT_PALETTE_CHANGED(func) { wxEVT_PALETTE_CHANGED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxPaletteChangedEventFunction) & func, (wxObject *) NULL },
#define EVT_QUERY_NEW_PALETTE(func) { wxEVT_QUERY_NEW_PALETTE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxQueryNewPaletteEventFunction) & func, (wxObject *) NULL },
#define EVT_WINDOW_CREATE(func) { wxEVT_CREATE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxQueryNewPaletteEventFunction) & func, (wxObject *) NULL },
#define EVT_WINDOW_DESTROY(func) { wxEVT_DESTROY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxQueryNewPaletteEventFunction) & func, (wxObject *) NULL },
// Mouse events
#define EVT_LEFT_DOWN(func) { wxEVT_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL },

View File

@@ -13,27 +13,35 @@
#define __SPLITTERH_G__
#ifdef __GNUG__
#pragma interface "splitter.h"
#pragma interface "splitter.h"
#endif
#include "wx/defs.h"
#include "wx/window.h"
#include "wx/string.h"
#include "wx/window.h" // base class declaration
#define WXSPLITTER_VERSION 1.0
class WXDLLEXPORT wxSplitterEvent;
#define wxSPLIT_HORIZONTAL 1
#define wxSPLIT_VERTICAL 2
// ---------------------------------------------------------------------------
// splitter constants
// ---------------------------------------------------------------------------
#define wxSPLIT_DRAG_NONE 0
#define wxSPLIT_DRAG_DRAGGING 1
#define wxSPLIT_DRAG_LEFT_DOWN 2
enum
{
wxSPLIT_HORIZONTAL = 1,
wxSPLIT_VERTICAL
};
/*
* wxSplitterWindow maintains one or two panes, with
* an optional vertical or horizontal split which
* can be used with the mouse or programmatically.
*/
enum
{
wxSPLIT_DRAG_NONE,
wxSPLIT_DRAG_DRAGGING,
wxSPLIT_DRAG_LEFT_DOWN
};
// ---------------------------------------------------------------------------
// wxSplitterWindow maintains one or two panes, with
// an optional vertical or horizontal split which
// can be used with the mouse or programmatically.
// ---------------------------------------------------------------------------
// TODO:
// 1) Perhaps make the borders sensitive to dragging in order to create a split.
@@ -114,7 +122,7 @@ public:
int GetBorderSize() const { return m_borderSize; }
// Set the sash position
void SetSashPosition(int position, bool redaw = TRUE);
void SetSashPosition(int position, bool redraw = TRUE);
// Gets the sash position
int GetSashPosition() const { return m_sashPosition; }
@@ -127,17 +135,18 @@ public:
// FALSE from here to prevent the change from taking place.
// Repositions sash to minimum position if pane would be too small.
// newSashPosition here is always positive or zero.
virtual bool OnSashPositionChange(int& newSashPosition);
virtual bool OnSashPositionChange(int WXUNUSED(newSashPosition))
{ return TRUE; }
// If the sash is moved to an extreme position, a subwindow
// is removed from the splitter window, and the app is
// notified. The app should delete or hide the window.
virtual void OnUnsplit(wxWindow *removed) { removed->Show(FALSE); }
virtual void OnUnsplit(wxWindow *WXUNUSED(removed)) { }
// Called when the sash is double-clicked.
// The default behaviour is to remove the sash if the
// minimum pane size is zero.
virtual void OnDoubleClickSash(int x, int y);
virtual void OnDoubleClickSash(int WXUNUSED(x), int WXUNUSED(y)) { }
////////////////////////////////////////////////////////////////////////////
// Implementation
@@ -170,6 +179,13 @@ public:
void InitColours();
protected:
// our event handlers
void OnSashPosChanged(wxSplitterEvent& event);
void OnDoubleClick(wxSplitterEvent& event);
void OnUnsplitEvent(wxSplitterEvent& event);
void SendUnsplitEvent(wxWindow *winRemoved);
int m_splitMode;
wxWindow* m_windowOne;
wxWindow* m_windowTwo;
@@ -197,4 +213,109 @@ private:
DECLARE_EVENT_TABLE()
};
// ----------------------------------------------------------------------------
// event class and macros
// ----------------------------------------------------------------------------
// we reuse the same class for all splitter event types because this is the
// usual wxWin convention, but the three event types have different kind of
// data associated with them, so the accessors can be only used if the real
// event type matches with the one for which the accessors make sense
class WXDLLEXPORT wxSplitterEvent : public wxCommandEvent
{
public:
wxSplitterEvent(wxEventType type = wxEVT_NULL,
wxSplitterWindow *splitter = (wxSplitterWindow *)NULL)
: wxCommandEvent(type)
{
SetEventObject(splitter);
}
// SASH_POS_CHANGED methods
// setting the sash position to -1 prevents the change from taking place at
// all
void SetSashPosition(int pos)
{
wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED );
m_data.pos = pos;
}
int GetSashPosition() const
{
wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED );
return m_data.pos;
}
// UNSPLIT event methods
wxWindow *GetWindowBeingRemoved() const
{
wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_UNSPLIT );
return m_data.win;
}
// DCLICK event methods
int GetX() const
{
wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_DOUBLECLICKED );
return m_data.pt.x;
}
int GetY() const
{
wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_DOUBLECLICKED );
return m_data.pt.y;
}
private:
friend wxSplitterWindow;
// data for the different types of event
union
{
int pos; // position for SASH_POS_CHANGED event
wxWindow *win; // window being removed for UNSPLIT event
struct
{
int x, y;
} pt; // position of double click for DCLICK event
} m_data;
DECLARE_DYNAMIC_CLASS(wxSplitterEvent)
};
typedef void (wxEvtHandler::*wxSplitterEventFunction)(wxSplitterEvent&);
#define EVT_SPLITTER_SASH_POS_CHANGED(id, fn) \
{ \
wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, \
id, \
-1, \
(wxObjectEventFunction)(wxEventFunction)(wxSplitterEventFunction) &fn, \
NULL \
},
#define EVT_SPLITTER_DCLICK(id, fn) \
{ \
wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, \
id, \
-1, \
(wxObjectEventFunction)(wxEventFunction)(wxSplitterEventFunction) &fn, \
NULL \
},
#define EVT_SPLITTER_UNSPLIT(id, fn) \
{ \
wxEVT_COMMAND_SPLITTER_UNSPLIT, \
id, \
-1, \
(wxObjectEventFunction)(wxEventFunction)(wxSplitterEventFunction) &fn, \
NULL \
},
#endif // __SPLITTERH_G__

View File

@@ -431,11 +431,23 @@ extern void WXDLLEXPORT wxLog##level(arg1, const wxChar *szFormat, ...)
#endif
#ifdef __WXDEBUG__
#define wxLogApiError(api, rc) \
wxLogDebug(_T("At %s(%d) '%s' failed with error %lx (%s)."), \
__TFILE__, __LINE__, api, \
rc, wxSysErrorMsg(rc))
#define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode())
// make life easier for people using VC++ IDE: clicking on the message
// will take us immediately to the place of the failed API
#ifdef __VISUALC__
#define wxLogApiError(api, rc) \
wxLogDebug(_T("%s(%d): '%s' failed with error 0x%08lx (%s)."), \
__TFILE__, __LINE__, api, \
rc, wxSysErrorMsg(rc))
#else // !VC++
#define wxLogApiError(api, rc) \
wxLogDebug(_T("In file %s at line %d: '%s' failed with " \
"error 0x%08lx (%s)."), \
__TFILE__, __LINE__, api, \
rc, wxSysErrorMsg(rc))
#endif // VC++/!VC++
#define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode())
#else //!debug
inline void wxLogApiError(const wxChar *, long) { }
inline void wxLogLastError(const wxChar *) { }

View File

@@ -26,8 +26,8 @@ class WXDLLEXPORT wxApp ;
class WXDLLEXPORT wxKeyEvent;
class WXDLLEXPORT wxLog;
#define wxPRINT_WINDOWS 1
#define wxPRINT_POSTSCRIPT 2
static const int wxPRINT_WINDOWS = 1;
static const int wxPRINT_POSTSCRIPT = 2;
WXDLLEXPORT_DATA(extern wxApp*) wxTheApp;
@@ -72,30 +72,30 @@ class WXDLLEXPORT wxApp: public wxEvtHandler
// to do anything which might provoke a nested exception!
virtual void OnFatalException() { }
inline void SetPrintMode(int mode) { m_printMode = mode; }
inline int GetPrintMode() const { return m_printMode; }
void SetPrintMode(int mode) { m_printMode = mode; }
int GetPrintMode() const { return m_printMode; }
inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; }
void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; }
inline const wxString& GetAppName() const {
const wxString& GetAppName() const {
if (m_appName != _T(""))
return m_appName;
else return m_className;
}
inline void SetAppName(const wxString& name) { m_appName = name; };
inline wxString GetClassName() const { return m_className; }
inline void SetClassName(const wxString& name) { m_className = name; }
void SetAppName(const wxString& name) { m_appName = name; };
wxString GetClassName() const { return m_className; }
void SetClassName(const wxString& name) { m_className = name; }
void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; }
const wxString& GetVendorName() const { return m_vendorName; }
wxWindow *GetTopWindow() const ;
inline void SetTopWindow(wxWindow *win) { m_topWindow = win; }
void SetTopWindow(wxWindow *win) { m_topWindow = win; }
inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; }
inline bool GetWantDebugOutput() { return m_wantDebugOutput; }
void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; }
bool GetWantDebugOutput() { return m_wantDebugOutput; }
// Send idle event to all top-level windows.
// Returns TRUE if more idle time is requested.
@@ -105,14 +105,13 @@ class WXDLLEXPORT wxApp: public wxEvtHandler
// Returns TRUE if more idle time is requested.
bool SendIdleEvents(wxWindow* win);
inline void SetAuto3D(bool flag) { m_auto3D = flag; }
inline bool GetAuto3D() const { return m_auto3D; }
void SetAuto3D(bool flag) { m_auto3D = flag; }
bool GetAuto3D() const { return m_auto3D; }
// Creates a log object
virtual wxLog* CreateLogTarget();
public:
// void (*work_proc)(wxApp*app); // work procedure;
int argc;
char ** argv;
@@ -127,7 +126,7 @@ protected:
int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
bool m_auto3D ; // Always use 3D controls, except
// where overriden
static wxAppInitializerFunction m_appInitFn;
static wxAppInitializerFunction m_appInitFn;
/* Windows-specific wxApp definitions */
@@ -150,7 +149,6 @@ public:
int GetComCtl32Version() const;
public:
static long sm_lastMessageTime;
int m_nCmdShow;
protected:

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CONTROL_H_
@@ -29,15 +29,26 @@ public:
virtual ~wxControl();
// Simulates an event
virtual void Command(wxCommandEvent& WXUNUSED(event)) { }
bool Command(wxCommandEvent& event) { return ProcessCommand(event); }
// Calls the callback and appropriate event handlers
virtual void ProcessCommand(wxCommandEvent& event);
bool ProcessCommand(wxCommandEvent& event);
virtual void SetClientSize(int width, int height);
virtual void SetClientSize(const wxSize& sz) { wxWindow::SetClientSize(sz); }
// Places item in centre of panel - so can't be used BEFORE panel->Fit()
void Centre(int direction = wxHORIZONTAL);
virtual void SetLabel(const wxString& label);
virtual wxString GetLabel() const;
// MSW-specific
#ifdef __WIN95__
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
#endif // Win95
// For ownerdraw items
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
wxList& GetSubcontrols() { return m_subControls; }
void OnEraseBackground(wxEraseEvent& event);
#if WXWIN_COMPATIBILITY
virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { }
@@ -47,51 +58,32 @@ public:
inline virtual void SetButtonFont(const wxFont& font);
inline wxFont& GetLabelFont() const;
inline wxFont& GetButtonFont() const;
#endif
// Places item in centre of panel - so can't be used BEFORE panel->Fit()
void Centre(int direction = wxHORIZONTAL);
// Adds callback
inline void Callback(const wxFunction function);
// MSW-specific
#ifdef __WIN95__
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
#endif // Win95
// For ownerdraw items
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
wxFunction GetCallback() { return m_callback; }
wxList& GetSubcontrols() { return m_subControls; }
void OnEraseBackground(wxEraseEvent& event);
protected:
wxFunction m_callback; // Callback associated with the window
// MSW implementation
wxList m_subControls; // For controls like radiobuttons which are really composite
#endif // WXWIN_COMPATIBILITY
protected:
// For controls like radiobuttons which are really composite
wxList m_subControls;
private:
DECLARE_EVENT_TABLE()
};
// Adds callback
inline void wxControl::Callback(const wxFunction function)
{
m_callback = function;
};
#if WXWIN_COMPATIBILITY
inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
inline wxFont& wxControl::GetLabelFont() const { return GetFont() ; }
inline wxFont& wxControl::GetButtonFont() const { return GetFont() ; }
inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); }
inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); }
#endif
#endif // WXWIN_COMPATIBILITY
#endif
// _WX_CONTROL_H_

View File

@@ -167,67 +167,5 @@ protected:
WXHPALETTE m_oldPalette;
};
// Logical to device
// Absolute
#define XLOG2DEV(x) (x)
#define YLOG2DEV(y) (y)
// Relative
#define XLOG2DEVREL(x) (x)
#define YLOG2DEVREL(y) (y)
// Device to logical
// Absolute
#define XDEV2LOG(x) (x)
#define YDEV2LOG(y) (y)
// Relative
#define XDEV2LOGREL(x) (x)
#define YDEV2LOGREL(y) (y)
/*
* Have the same macros as for XView but not for every operation:
* just for calculating window/viewport extent (a better way of scaling).
*/
// Logical to device
// Absolute
#define MS_XLOG2DEV(x) LogicalToDevice(x)
#define MS_YLOG2DEV(y) LogicalToDevice(y)
// Relative
#define MS_XLOG2DEVREL(x) LogicalToDeviceXRel(x)
#define MS_YLOG2DEVREL(y) LogicalToDeviceYRel(y)
// Device to logical
// Absolute
#define MS_XDEV2LOG(x) DeviceToLogicalX(x)
#define MS_YDEV2LOG(y) DeviceToLogicalY(y)
// Relative
#define MS_XDEV2LOGREL(x) DeviceToLogicalXRel(x)
#define MS_YDEV2LOGREL(y) DeviceToLogicalYRel(y)
#define MM_POINTS 9
#define MM_METRIC 10
// Conversion
#define METRIC_CONVERSION_CONSTANT 0.0393700787
// Scaling factors for various unit conversions
#define mm2inches (METRIC_CONVERSION_CONSTANT)
#define inches2mm (1/METRIC_CONVERSION_CONSTANT)
#define mm2twips (METRIC_CONVERSION_CONSTANT*1440)
#define twips2mm (1/(METRIC_CONVERSION_CONSTANT*1440))
#define mm2pt (METRIC_CONVERSION_CONSTANT*72)
#define pt2mm (1/(METRIC_CONVERSION_CONSTANT*72))
#define wx_round(a) (int)((a)+.5)
#endif
// _WX_DC_H_

View File

@@ -110,6 +110,8 @@ public:
// implementation
// --------------
long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);

View File

@@ -13,7 +13,7 @@
#define _WX_FRAME_H_
#ifdef __GNUG__
#pragma interface "frame.h"
#pragma interface "frame.h"
#endif
#include "wx/window.h"
@@ -30,7 +30,7 @@ class WXDLLEXPORT wxStatusBar;
class WXDLLEXPORT wxFrame : public wxWindow
{
DECLARE_DYNAMIC_CLASS(wxFrame)
DECLARE_DYNAMIC_CLASS(wxFrame)
public:
wxFrame();
@@ -70,17 +70,13 @@ public:
// Set menu bar
void SetMenuBar(wxMenuBar *menu_bar);
virtual wxMenuBar *GetMenuBar() const ;
// Set title
void SetTitle(const wxString& title);
wxString GetTitle() const ;
void Centre(int direction = wxBOTH);
virtual wxMenuBar *GetMenuBar() const;
// Call this to simulate a menu command
virtual void Command(int id);
virtual void ProcessCommand(int id);
bool Command(int id) { ProcessCommand(id); }
// process menu command: returns TRUE if processed
bool ProcessCommand(int id);
// Set icon
virtual void SetIcon(const wxIcon& icon);
@@ -123,16 +119,13 @@ public:
static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
static bool UsesNativeStatusBar() { return m_useNativeStatusBar; };
// Fit frame around subwindows
virtual void Fit();
// Iconize
virtual void Iconize(bool iconize);
virtual bool IsIconized() const ;
virtual bool IsIconized() const;
// Is it maximized?
virtual bool IsMaximized() const ;
virtual bool IsMaximized() const;
// Compatibility
bool Iconized() const { return IsIconized(); }
@@ -147,7 +140,7 @@ public:
void DoMenuUpdates();
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
WXHMENU GetWinMenu() const ;
WXHMENU GetWinMenu() const { return m_hMenu; }
// Returns the origin of client area (may be different from (0,0) if the
// frame has a toolbar)
@@ -155,19 +148,15 @@ public:
// Implementation only from here
// event handlers
bool MSWOnPaint();
WXHICON MSWOnQueryDragIcon();
bool MSWOnSize(int x, int y, WXUINT flag);
bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
bool MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
bool MSWProcessMessage(WXMSG *msg);
bool MSWTranslateMessage(WXMSG *msg);
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);
bool MSWCreate(int id, wxWindow *parent, const char *wclass,
wxWindow *wx_win, const char *title,
int x, int y, int width, int height, long style);
bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu);
// tooltip management
#if wxUSE_TOOLTIPS
WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
@@ -177,17 +166,24 @@ public:
protected:
// override base class virtuals
virtual void DoGetClientSize(int *width, int *height) const;
virtual void DoGetSize(int *width, int *height) const ;
virtual void DoGetPosition(int *x, int *y) const ;
virtual void DoGetSize(int *width, int *height) const;
virtual void DoGetPosition(int *x, int *y) const;
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
virtual void DoSetClientSize(int width, int height);
// a plug in for MDI frame classes which need to do something special when
// the menubar is set
virtual void InternalSetMenuBar();
// propagate our state change to all child frames
void IconizeChildFrames(bool bIconize);
// we add menu bar accel processing
bool MSWTranslateMessage(WXMSG* pMsg);
// window proc for the frames
long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
@@ -196,7 +192,7 @@ protected:
wxIcon m_icon;
bool m_iconized;
WXHICON m_defaultIcon;
wxToolBar * m_frameToolBar ;
wxToolBar * m_frameToolBar;
static bool m_useNativeStatusBar;

View File

@@ -407,16 +407,6 @@ class WXDLLEXPORT wxListCtrl: public wxControl
// data is arbitrary data to be passed to the sort function.
bool SortItems(wxListCtrlCompare fn, long data);
/* Why should we need this function? Leave for now.
* WE NEED IT because item data may have changed,
* but the display needs refreshing (in string callback mode)
// Updates an item. If the list control has the wxLI_AUTO_ARRANGE style,
// the items will be rearranged.
bool Update(long item);
*/
void Command(wxCommandEvent& event) { ProcessCommand(event); };
// IMPLEMENTATION
virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);

View File

@@ -58,17 +58,15 @@ public:
// accessors
// ---------
void SetMenuBar(wxMenuBar *menu_bar);
// Get the active MDI child window (Windows only)
wxMDIChildFrame *GetActiveChild() const ;
wxMDIChildFrame *GetActiveChild() const;
// Get the client window
wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
// Create the client window class (don't Create the window,
// just return a new class)
virtual wxMDIClientWindow *OnCreateClient(void) ;
virtual wxMDIClientWindow *OnCreateClient(void);
WXHMENU GetWindowMenu() const { return m_windowMenu; }
@@ -87,25 +85,25 @@ public:
void OnSysColourChanged(wxSysColourChangedEvent& event);
void OnSize(wxSizeEvent& event);
void OnActivate(wxActivateEvent& event);
virtual bool MSWOnActivate(int state, bool minimized, WXHWND activate);
virtual bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
bool HandleActivate(int state, bool minimized, WXHWND activate);
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
// override window proc for MDI-specific message processing
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual long MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM);
virtual bool MSWProcessMessage(WXMSG* msg);
virtual bool MSWTranslateMessage(WXMSG* msg);
protected:
virtual void InternalSetMenuBar();
wxMDIClientWindow * m_clientWindow;
wxMDIChildFrame * m_currentChild;
WXHMENU m_windowMenu;
// TRUE if MDI Frame is intercepting commands, not child
bool m_parentFrameActive;
bool m_parentFrameActive;
private:
friend class WXDLLEXPORT wxMDIChildFrame;
@@ -144,9 +142,6 @@ public:
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr);
// Set menu bar
void SetMenuBar(wxMenuBar *menu_bar);
// MDI operations
virtual void Maximize();
virtual void Restore();
@@ -154,21 +149,24 @@ public:
// Handlers
bool MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
bool MSWOnSize(int x, int y, WXUINT);
bool MSWOnWindowPosChanging(void *lpPos);
bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
bool MSWProcessMessage(WXMSG *msg);
bool MSWTranslateMessage(WXMSG *msg);
void MSWDestroyWindow();
bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
bool HandleSize(int x, int y, WXUINT);
bool HandleWindowPosChanging(void *lpPos);
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
virtual long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
virtual long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
virtual bool MSWTranslateMessage(WXMSG *msg);
virtual void MSWDestroyWindow();
// Implementation
bool ResetWindowStyle(void *vrect);
protected:
virtual void DoGetPosition(int *x, int *y) const ;
virtual void DoGetPosition(int *x, int *y) const;
virtual void DoSetClientSize(int width, int height);
virtual void InternalSetMenuBar();
};
// ---------------------------------------------------------------------------
@@ -180,14 +178,14 @@ class WXDLLEXPORT wxMDIClientWindow : public wxWindow
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
public:
wxMDIClientWindow();
wxMDIClientWindow() { Init(); }
wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
{
Init();
CreateClient(parent, style);
}
~wxMDIClientWindow();
// Note: this is virtual, to allow overridden behaviour.
virtual bool CreateClient(wxMDIParentFrame *parent,
long style = wxVSCROLL | wxHSCROLL);
@@ -195,13 +193,9 @@ public:
// Explicitly call default scroll behaviour
void OnScroll(wxScrollEvent& event);
// Window procedure
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
// Calls an appropriate default window procedure
virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
protected:
void Init() { m_scrollX = m_scrollY = 0; }
int m_scrollX, m_scrollY;
private:

View File

@@ -103,20 +103,12 @@ public:
// menu or associated window will be used.
void UpdateUI(wxEvtHandler* source = (wxEvtHandler*)NULL);
void ProcessCommand(wxCommandEvent& event);
bool ProcessCommand(wxCommandEvent& event);
virtual void SetParent(wxEvtHandler *parent) { m_parent = parent; }
void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
wxEvtHandler *GetEventHandler() const { return m_eventHandler; }
#ifdef WXWIN_COMPATIBILITY
void Callback(const wxFunction func) { m_callback = func; }
// compatibility: these functions are deprecated
bool Enabled(int id) const { return IsEnabled(id); }
bool Checked(int id) const { return IsChecked(id); }
#endif // WXWIN_COMPATIBILITY
// IMPLEMENTATION
bool MSWCommand(WXUINT param, WXWORD id);
@@ -133,6 +125,20 @@ public:
void Attach(wxMenuBar *menubar);
void Detach();
size_t GetAccelCount() const { return m_accelKeyCodes.GetCount(); }
size_t CopyAccels(wxAcceleratorEntry *accels) const;
#ifdef WXWIN_COMPATIBILITY
void Callback(const wxFunction func) { m_callback = func; }
// compatibility: these functions are deprecated
bool Enabled(int id) const { return IsEnabled(id); }
bool Checked(int id) const { return IsChecked(id); }
private:
wxFunction m_callback;
#endif // WXWIN_COMPATIBILITY
private:
bool m_doBreak;
@@ -142,7 +148,6 @@ private:
// Might be better to have a flag saying whether it's deleteable or not.
WXHMENU m_savehMenu ; // Used for Enable() on popup
WXHMENU m_hMenu;
wxFunction m_callback;
int m_noItems;
wxString m_title;
@@ -153,6 +158,9 @@ private:
wxEvtHandler * m_eventHandler;
wxWindow *m_pInvokingWindow;
void* m_clientData;
// the accelerators data
wxArrayInt m_accelKeyCodes, m_accelFlags, m_accelIds;
};
// ----------------------------------------------------------------------------
@@ -235,12 +243,10 @@ public:
// get the frame we live in
wxFrame *GetFrame() const { return m_menuBarFrame; }
// attach to a frame
void Attach(wxFrame *frame)
{
wxASSERT_MSG( !m_menuBarFrame, _T("menubar already attached!") );
void Attach(wxFrame *frame);
m_menuBarFrame = frame;
}
// get the accel table for the menus
const wxAcceleratorTable& GetAccelTable() const { return m_accelTable; }
// get the menu handle
WXHMENU GetHMenu() const { return m_hMenu; }
@@ -258,6 +264,9 @@ protected:
wxString *m_titles;
wxFrame *m_menuBarFrame;
WXHMENU m_hMenu;
// the accelerator table for all accelerators in all our menus
wxAcceleratorTable m_accelTable;
};
#endif // _WX_MENU_H_

View File

@@ -172,15 +172,13 @@ public:
// callbacks
// ---------
void OnSize(wxSizeEvent& event);
void OnWindowCreate(wxWindowCreateEvent& event);
void OnSelChange(wxNotebookEvent& event);
void OnSetFocus(wxFocusEvent& event);
void OnNavigationKey(wxNavigationKeyEvent& event);
void OnEraseBackground(wxEraseEvent& event);
// base class virtuals
// -------------------
virtual void Command(wxCommandEvent& event);
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
virtual void SetConstraintSizes(bool recurse = TRUE);
virtual bool DoPhase(int nPhase);

View File

@@ -16,8 +16,28 @@
#include <windows.h>
// undefine conflicting symbols which were defined in windows.h
#include "wx/msw/winundef.h"
class WXDLLEXPORT wxFont;
// ---------------------------------------------------------------------------
// private constants
// ---------------------------------------------------------------------------
// Conversion
static const double METRIC_CONVERSION_CONSTANT = 0.0393700787;
// Scaling factors for various unit conversions
static const double mm2inches = (METRIC_CONVERSION_CONSTANT);
static const double inches2mm = (1/METRIC_CONVERSION_CONSTANT);
static const double mm2twips = (METRIC_CONVERSION_CONSTANT*1440);
static const double twips2mm = (1/(METRIC_CONVERSION_CONSTANT*1440));
static const double mm2pt = (METRIC_CONVERSION_CONSTANT*72);
static const double pt2mm = (1/(METRIC_CONVERSION_CONSTANT*72));
// ---------------------------------------------------------------------------
// standard icons from the resources
// ---------------------------------------------------------------------------
@@ -178,7 +198,9 @@ extern LONG APIENTRY _EXPORT
#endif // USE_DBWIN32
// ---------------------------------------------------------------------------
// macros to make casting between WXFOO and FOO a bit easier
// macros to make casting between WXFOO and FOO a bit easier: the GetFoo()
// returns Foo cast to the Windows type for oruselves, while GetFoosFoo() takes
// an argument which should be a pointer to wxFoo (is this really clear?)
// ---------------------------------------------------------------------------
#define GetHwnd() ((HWND)GetHWND())
@@ -186,8 +208,11 @@ extern LONG APIENTRY _EXPORT
#define GetHdc() ((HDC)GetHDC())
#define GetHicon() ((HICON)GetHICON())
#define GetIconHicon(icon) ((HICON)(icon).GetHICON())
#define GetHaccel() ((HACCEL)GetHACCEL())
#define GetTableHaccel(table) ((HACCEL)((table)->GetHACCEL()))
#define GetTableHaccel(table) ((HACCEL)((table).GetHACCEL()))
// ---------------------------------------------------------------------------
// global data
@@ -226,8 +251,9 @@ WXDLLEXPORT extern wxString wxGetWindowText(WXHWND hWnd);
// get the window class name
WXDLLEXPORT extern wxString wxGetWindowClass(WXHWND hWnd);
// get the window id
WXDLLEXPORT extern wxWindowID wxGetWindowId(WXHWND hWnd);
// get the window id (should be unsigned, hence this is not wxWindowID which
// is, for mainly historical reasons, signed)
WXDLLEXPORT extern WXWORD wxGetWindowId(WXHWND hWnd);
// Does this window style specify any border?
inline bool wxStyleHasBorder(long style)

View File

@@ -73,8 +73,6 @@ public:
// Operations
////////////////////////////////////////////////////////////////////////////
void Command(wxCommandEvent& event) { ProcessCommand(event); };
// IMPLEMENTATION
virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual bool MSWOnScroll(int orientation, WXWORD wParam,

View File

@@ -63,9 +63,6 @@ public:
virtual bool AcceptsFocus() const { return FALSE; }
// IMPLEMENTATION
virtual void Command(wxCommandEvent& WXUNUSED(event)) { }
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) { }
#ifdef __WIN16__
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);

View File

@@ -45,9 +45,6 @@ public:
long style = 0,
const wxString& name = wxStaticBoxNameStr);
virtual void Command(wxCommandEvent& WXUNUSED(event)) { }
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) { }
void OnEraseBackground(wxEraseEvent& event);
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);

View File

@@ -47,16 +47,12 @@ public:
// accessors
void SetLabel(const wxString& label);
// operations
virtual void Command(wxCommandEvent& WXUNUSED(event)) { }
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) { }
// overriden base class virtuals
virtual bool AcceptsFocus() const { return FALSE; }
// callbacks
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
protected:

View File

@@ -113,17 +113,8 @@ class WXDLLEXPORT wxTabCtrl: public wxControl
// Insert an item
bool InsertItem(int item, const wxString& text, int imageId = -1, void* data = NULL);
// Implementation
// Implementation
// Call default behaviour
void OnPaint(wxPaintEvent& event) { Default() ; }
void OnSize(wxSizeEvent& event) { Default() ; }
void OnMouseEvent(wxMouseEvent& event) { Default() ; }
void OnKillFocus(wxFocusEvent& event) { Default() ; }
void Command(wxCommandEvent& event);
virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
// Responds to colour changes

View File

@@ -29,24 +29,21 @@ class WXDLLEXPORT wxToolBar95: public wxToolBarBase
* Public interface
*/
wxToolBar95(void);
wxToolBar95();
inline wxToolBar95(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
wxToolBar95(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxNO_BORDER|wxTB_HORIZONTAL,
const wxString& name = wxToolBarNameStr)
{
Create(parent, id, pos, size, style, name);
}
~wxToolBar95(void);
~wxToolBar95();
bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxNO_BORDER|wxTB_HORIZONTAL,
const wxString& name = wxToolBarNameStr);
// Call default behaviour
void OnPaint(wxPaintEvent& WXUNUSED(event)) { Default() ; }
void OnSize(wxSizeEvent& WXUNUSED(event)) { Default() ; }
void OnKillFocus(wxFocusEvent& WXUNUSED(event)) { Default() ; }
void OnMouseEvent(wxMouseEvent& event);
// Handle wxToolBar95 events
@@ -62,21 +59,21 @@ class WXDLLEXPORT wxToolBar95: public wxToolBarBase
void SetToolBitmapSize(const wxSize& size);
void EnableTool(int toolIndex, bool enable); // additional drawing on enabling
void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on
void ClearTools(void);
void ClearTools();
// The button size is bigger than the bitmap size
wxSize GetToolSize(void) const;
wxSize GetToolSize() const;
wxSize GetMaxSize(void) const;
wxSize GetMaxSize() const;
void GetSize(int *w, int *y) const;
virtual bool GetToolState(int toolIndex) const;
// Add all the buttons: required for Win95.
virtual bool CreateTools(void);
virtual bool CreateTools();
virtual void SetRows(int nRows);
virtual void LayoutButtons(void) {}
virtual void LayoutButtons() {}
// The post-tool-addition call
bool Realize() { return CreateTools(); };

View File

@@ -152,7 +152,6 @@ public:
// ---------
void OnDropFiles(wxDropFilesEvent& event);
void OnChar(wxKeyEvent& event); // Process 'enter' if required
void OnEraseBackground(wxEraseEvent& event);
void OnCut(wxCommandEvent& event);
void OnCopy(wxCommandEvent& event);

View File

@@ -447,7 +447,6 @@ public:
// implementation
// --------------
void Command(wxCommandEvent& event) { ProcessCommand(event); };
virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);

View File

@@ -20,14 +20,7 @@
#pragma interface "window.h"
#endif
// windows.h #defines the following identifiers which are also used in wxWin
#ifdef GetCharWidth
#undef GetCharWidth
#endif
#ifdef FindWindow
#undef FindWindow
#endif
#include "wx/msw/winundef.h"
// VZ: apparently some version of Windows send extra mouse move messages after
// a mouse click. My tests under NT 4.0 and 95 didn't show it so I'm
@@ -84,6 +77,9 @@ public:
const wxString& name = wxPanelNameStr);
// implement base class pure virtuals
virtual void SetTitle( const wxString& title);
virtual wxString GetTitle() const;
virtual void Raise();
virtual void Lower();
@@ -145,6 +141,14 @@ public:
virtual void SetScrollPage(int orient, int page, bool refresh = TRUE);
virtual int OldGetScrollRange(int orient) const;
virtual int GetScrollPage(int orient) const;
// event handlers
// Handle a control command
virtual void OnCommand(wxWindow& win, wxCommandEvent& event);
// Override to define new behaviour for default action (e.g. double
// clicking on a listbox)
virtual void OnDefaultAction(wxControl * WXUNUSED(initiatingItem)) { }
#endif // WXWIN_COMPATIBILITY
// caret manipulation (MSW only)
@@ -155,20 +159,12 @@ public:
virtual void SetCaretPos(int x, int y);
virtual void GetCaretPos(int *x, int *y) const;
// event handlers (FIXME: shouldn't they be inside WXWIN_COMPATIBILITY?)
// Handle a control command
virtual void OnCommand(wxWindow& win, wxCommandEvent& event);
// Override to define new behaviour for default action (e.g. double
// clicking on a listbox)
virtual void OnDefaultAction(wxControl *initiatingItem);
// Native resource loading (implemented in src/msw/nativdlg.cpp)
// FIXME: should they really be all virtual?
virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id);
virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name);
virtual wxWindow* GetWindowChild1(wxWindowID id);
virtual wxWindow* GetWindowChild(wxWindowID id);
wxWindow* GetWindowChild1(wxWindowID id);
wxWindow* GetWindowChild(wxWindowID id);
// implementation from now on
// --------------------------
@@ -206,14 +202,12 @@ public:
// Windows subclassing
void SubclassWin(WXHWND hWnd);
void UnsubclassWin();
virtual bool MSWCommand(WXUINT param, WXWORD id);
WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; }
void MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; }
virtual wxWindow *FindItem(int id) const;
virtual wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const ;
virtual void PreDelete(WXHDC dc); // Allows system cleanup
wxWindow *FindItem(int id) const;
wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const;
// Make a Windows extended style from the given wxWindows window style
virtual WXDWORD MakeExtendedStyle(long style, bool eliminateBorders = TRUE);
@@ -223,8 +217,6 @@ public:
// MSW only: TRUE if this control is part of the main control
virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; };
wxObject *GetChild(int number) const ;
// returns TRUE if the window has been created
bool MSWCreate(int id,
wxWindow *parent,
@@ -235,9 +227,12 @@ public:
WXDWORD style,
const char *dialog_template = NULL,
WXDWORD exendedStyle = 0);
virtual bool MSWCommand(WXUINT param, WXWORD id);
// Actually defined in wx_canvs.cc since requires wxCanvas declaration
virtual void MSWDeviceToLogical(float *x, float *y) const ;
#if WXWIN_COMPATIBILITY
wxObject *GetChild(int number) const;
virtual void MSWDeviceToLogical(float *x, float *y) const;
#endif // WXWIN_COMPATIBILITY
// Create an appropriate wxWindow from a HWND
virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd);
@@ -248,33 +243,68 @@ public:
// Setup background and foreground colours correctly
virtual void SetupColours();
// ------------------------------------------------------------------------
// helpers for message handlers: these perform the same function as the
// message crackers from <windowsx.h> - they unpack WPARAM and LPARAM into
// the correct parameters
// ------------------------------------------------------------------------
void UnpackCommand(WXWPARAM wParam, WXLPARAM lParam,
WXWORD *id, WXHWND *hwnd, WXWORD *cmd);
void UnpackActivate(WXWPARAM wParam, WXLPARAM lParam,
WXWORD *state, WXWORD *minimized, WXHWND *hwnd);
void UnpackScroll(WXWPARAM wParam, WXLPARAM lParam,
WXWORD *code, WXWORD *pos, WXHWND *hwnd);
void UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam,
WXWORD *nCtlColor, WXHDC *hdc, WXHWND *hwnd);
void UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam,
WXWORD *item, WXWORD *flags, WXHMENU *hmenu);
// ------------------------------------------------------------------------
// internal handlers for MSW messages: all handlers return a boolen value:
// TRUE means that the handler processed the event and FALSE that it didn't
// ------------------------------------------------------------------------
// TODO: all this should go away, overriding MSWWindowProc() is enough to
// implement this functionality
virtual bool MSWOnCreate(WXLPCREATESTRUCT cs, bool *mayCreate);
virtual bool MSWOnPaint();
virtual bool MSWOnEraseBkgnd(WXHDC pDC);
virtual bool MSWOnSize(int x, int y, WXUINT flag);
// there are several cases where we have virtual functions for Windows
// message processing: this is because these messages often require to be
// processed in a different manner in the derived classes. For all other
// messages, however, we do *not* have corresponding MSWOnXXX() function
// and if the derived class wants to process them, it should override
// MSWWindowProc() directly.
virtual bool MSWOnQueryDragIcon(WXHICON *hIcon);
virtual bool MSWOnWindowPosChanging(void *lpPos);
// both horizontal and vertical
// scroll event (both horizontal and vertical)
virtual bool MSWOnScroll(int orientation, WXWORD nSBCode,
WXWORD pos, WXHWND control);
virtual bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
virtual bool MSWOnSysCommand(WXWPARAM wParam, WXLPARAM lParam);
// child control notifications
#ifdef __WIN95__
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
#endif // __WIN95__
virtual bool MSWOnCtlColor(WXHBRUSH *hBrush,
// owner-drawn controls need to process these messages
virtual bool MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *item);
virtual bool MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *item);
// the rest are not virtual
bool HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate);
bool HandleInitDialog(WXHWND hWndFocus);
bool HandleDestroy();
bool HandlePaint();
bool HandleEraseBkgnd(WXHDC pDC);
bool HandleMinimize();
bool HandleMaximize();
bool HandleSize(int x, int y, WXUINT flag);
bool HandleGetMinMaxInfo(void *mmInfo);
bool HandleShow(bool show, int status);
bool HandleActivate(int flag, bool minimized, WXHWND activate);
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
bool HandleSysCommand(WXWPARAM wParam, WXLPARAM lParam);
bool HandleCtlColor(WXHBRUSH *hBrush,
WXHDC hdc,
WXHWND hWnd,
WXUINT nCtlColor,
@@ -282,31 +312,28 @@ public:
WXWPARAM wParam,
WXLPARAM lParam);
virtual bool MSWOnPaletteChanged(WXHWND hWndPalChange);
virtual bool MSWOnQueryNewPalette();
bool HandlePaletteChanged(WXHWND hWndPalChange);
bool HandleQueryNewPalette();
bool HandleSysColorChange();
virtual bool MSWOnQueryEndSession(long logOff, bool *mayEnd);
virtual bool MSWOnEndSession(bool endSession, long logOff);
bool HandleQueryEndSession(long logOff, bool *mayEnd);
bool HandleEndSession(bool endSession, long logOff);
virtual bool MSWOnDestroy();
virtual bool MSWOnSetFocus(WXHWND wnd);
virtual bool MSWOnKillFocus(WXHWND wnd);
virtual bool MSWOnDropFiles(WXWPARAM wParam);
virtual bool MSWOnInitDialog(WXHWND hWndFocus);
virtual bool MSWOnShow(bool show, int status);
bool HandleSetFocus(WXHWND wnd);
bool HandleKillFocus(WXHWND wnd);
virtual bool MSWOnMouseEvent(WXUINT msg, int x, int y, WXUINT flags);
virtual bool MSWOnMouseMove(int x, int y, WXUINT flags);
bool HandleDropFiles(WXWPARAM wParam);
virtual bool MSWOnChar(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE);
virtual bool MSWOnKeyDown(WXWORD wParam, WXLPARAM lParam);
virtual bool MSWOnKeyUp(WXWORD wParam, WXLPARAM lParam);
bool HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags);
bool HandleMouseMove(int x, int y, WXUINT flags);
virtual bool MSWOnActivate(int flag, bool minimized, WXHWND activate);
virtual bool MSWOnMDIActivate(long flag, WXHWND activate, WXHWND deactivate);
bool HandleChar(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE);
bool HandleKeyDown(WXWORD wParam, WXLPARAM lParam);
bool HandleKeyUp(WXWORD wParam, WXLPARAM lParam);
virtual bool MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *item);
virtual bool MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *item);
bool HandleQueryDragIcon(WXHICON *hIcon);
bool HandleSetCursor(WXHWND hWnd, short nHitTest, int mouseMsg);
// Window procedure
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);

View File

@@ -73,7 +73,9 @@ BEGIN
POPUP "&Window"
BEGIN
MENUITEM "&Cascade", 4002
MENUITEM "&Tile", 4001
MENUITEM "Tile &Horizontally", 4001
MENUITEM "Tile &Vertically", 4005
MENUITEM "", -1
MENUITEM "&Arrange Icons", 4003
MENUITEM "&Next", 4004
END

View File

@@ -156,7 +156,8 @@ public:
// label is just the same as the title (but for, e.g., buttons it
// makes more sense to speak about labels)
virtual wxString GetLabel() const { return GetTitle(); }
void SetLabel(const wxString& label) { SetTitle(label); }
wxString GetLabel() const { return GetTitle(); }
// the window name is used for ressource setting in X, it is not the
// same as the window title/label