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

@@ -0,0 +1,49 @@
\section{\class{wxSplitterEvent}}\label{wxsplitterevent}
This class represents the events generated by a splitter control.
\wxheading{Derived from}
\helpref{wxCommandEvent}{wxcommandevent}\\
\helpref{wxEvent}{wxevent}\\
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/splitter.h>
\wxheading{Event table macros}
To process a splitter event, use these event handler macros to direct input to member
functions that take a wxSplitterEvent argument.
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_SPLITTER\_SASH\_POS\_CHANGED(id, func)}
{The sash position was changed. May be used to prevent the change from
taking place. Processes wxEVT\_COMMAND\_SPLITTER\_SASH\_POS\_CHANGED event.}
\twocolitem{{\bf EVT\_SPLITTER\_UNSPLIT(id, func)}}
{The splitter has been just unsplit. Processes wxEVT\_COMMAND\_SPLITTER\_UNSPLIT
event.}
\twocolitem{{\bf EVT\_SPLITTER\_DOUBLECLICKED(id, func)}}
{The sash was double clicked. The default behaviour is to unsplit the
window when this happens (unless the minimum pane size has been set to a
value greater than zero). Processes wxEVT\_COMMAND\_SPLITTER\_DOUBLECLICKED
event}
\end{twocollist}%
\wxheading{See also}
\helpref{wxSplitterWindow}{wxsplitterwindow}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxSplitterEvent::wxSplitterEvent}\label{wxsplittereventconstr}
\func{}{wxSplitterEvent}{\param{wxEventType}{ eventType = wxEVT\_NULL},
\param{wxSplitterWindow *}{ splitter = NULL}}
Constructor. Used internally by wxWindows only.
% TODO

View File

@@ -28,6 +28,31 @@ See also \helpref{window styles overview}{windowstyles}.
<wx/splitter.h> <wx/splitter.h>
\wxheading{Event handling}
To process input from a splitter control, use the following event handler
macros to direct input to member functions that take a
\helpref{wxSplitterEvent}{wxsplitterevent} argument.
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_SPLITTER\_SASH\_POS\_CHANGED(id, func)}
{The sash position was changed. May be used to prevent the change from
taking place. Processes wxEVT\_COMMAND\_SPLITTER\_SASH\_POS\_CHANGED event.}
\twocolitem{{\bf EVT\_SPLITTER\_UNSPLIT(id, func)}}
{The splitter has been just unsplit. Processes wxEVT\_COMMAND\_SPLITTER\_UNSPLIT
event.}
\twocolitem{{\bf EVT\_SPLITTER\_DOUBLECLICKED(id, func)}}
{The sash was double clicked. The default behaviour is to unsplit the
window when this happens (unless the minimum pane size has been set to a
value greater than zero). Processes wxEVT\_COMMAND\_SPLITTER\_DOUBLECLICKED
event}
\end{twocollist}%
\wxheading{See also}
\helpref{wxSplitterEvent}{wxsplitterevent}
\latexignore{\rtfignore{\wxheading{Members}}} \latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxSplitterWindow::wxSplitterWindow}\label{wxsplitterwindowconstr} \membersection{wxSplitterWindow::wxSplitterWindow}\label{wxsplitterwindowconstr}

View File

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

View File

@@ -202,6 +202,12 @@
typedef unsigned char wxByte; typedef unsigned char wxByte;
typedef short int WXTYPE; 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; typedef int wxWindowID;
// Macro to cut down on compiler warnings. // Macro to cut down on compiler warnings.

View File

@@ -19,6 +19,7 @@
#include "wx/defs.h" #include "wx/defs.h"
#include "wx/object.h" #include "wx/object.h"
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#if wxUSE_THREADS #if wxUSE_THREADS
#include "wx/thread.h" #include "wx/thread.h"
#endif #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; const wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING = wxEVT_FIRST + 803;
#endif #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; const wxEventType wxEVT_USER_FIRST = wxEVT_FIRST + 2000;
/* Compatibility */ /* Compatibility */
@@ -307,13 +313,12 @@ public:
void CopyObject(wxObject& object_dest) const; void CopyObject(wxObject& object_dest) const;
public: public:
bool m_skipped;
wxObject* m_eventObject; wxObject* m_eventObject;
char* m_eventHandle; // Handle of an underlying windowing system event
wxEventType m_eventType; wxEventType m_eventType;
long m_timeStamp; long m_timeStamp;
int m_id; int m_id;
wxObject* m_callbackUserData; wxObject* m_callbackUserData;
bool m_skipped;
// optimization: instead of using costly IsKindOf() we keep a flag telling // optimization: instead of using costly IsKindOf() we keep a flag telling
// whether we're a command event (by far the most common case) // whether we're a command event (by far the most common case)
@@ -1188,10 +1193,38 @@ public:
void SetCurrentFocus(wxWindow *win) { m_clientData = (void *)win; } 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 /* TODO
wxEVT_POWER, wxEVT_POWER,
wxEVT_CREATE,
wxEVT_DESTROY,
wxEVT_MOUSE_CAPTURE_CHANGED, wxEVT_MOUSE_CAPTURE_CHANGED,
wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95) wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95)
// wxEVT_FONT_CHANGED, // WM_FONTCHANGE: roll into wxEVT_SETTING_CHANGED, but remember to propagate // 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; } void SetEvtHandlerEnabled(bool en) { m_enabled = en; }
bool GetEvtHandlerEnabled() const { return m_enabled; } bool GetEvtHandlerEnabled() const { return m_enabled; }
#if WXWIN_COMPATIBILITY_2
virtual void OnCommand(wxWindow& WXUNUSED(win), virtual void OnCommand(wxWindow& WXUNUSED(win),
wxCommandEvent& WXUNUSED(event)) wxCommandEvent& WXUNUSED(event))
{ {
@@ -1252,6 +1286,7 @@ public:
// Default behaviour // Default behaviour
virtual long Default() virtual long Default()
{ return GetNextHandler() ? GetNextHandler()->Default() : 0; }; { return GetNextHandler() ? GetNextHandler()->Default() : 0; };
#endif // WXWIN_COMPATIBILITY_2
#if WXWIN_COMPATIBILITY #if WXWIN_COMPATIBILITY
virtual bool OnClose(); virtual bool OnClose();
@@ -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_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_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_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 // Mouse events
#define EVT_LEFT_DOWN(func) { wxEVT_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL }, #define EVT_LEFT_DOWN(func) { wxEVT_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL },

View File

@@ -16,24 +16,32 @@
#pragma interface "splitter.h" #pragma interface "splitter.h"
#endif #endif
#include "wx/defs.h" #include "wx/window.h" // base class declaration
#include "wx/window.h"
#include "wx/string.h"
#define WXSPLITTER_VERSION 1.0 class WXDLLEXPORT wxSplitterEvent;
#define wxSPLIT_HORIZONTAL 1 // ---------------------------------------------------------------------------
#define wxSPLIT_VERTICAL 2 // splitter constants
// ---------------------------------------------------------------------------
#define wxSPLIT_DRAG_NONE 0 enum
#define wxSPLIT_DRAG_DRAGGING 1 {
#define wxSPLIT_DRAG_LEFT_DOWN 2 wxSPLIT_HORIZONTAL = 1,
wxSPLIT_VERTICAL
};
/* enum
* wxSplitterWindow maintains one or two panes, with {
* an optional vertical or horizontal split which wxSPLIT_DRAG_NONE,
* can be used with the mouse or programmatically. 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: // TODO:
// 1) Perhaps make the borders sensitive to dragging in order to create a split. // 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; } int GetBorderSize() const { return m_borderSize; }
// Set the sash position // Set the sash position
void SetSashPosition(int position, bool redaw = TRUE); void SetSashPosition(int position, bool redraw = TRUE);
// Gets the sash position // Gets the sash position
int GetSashPosition() const { return m_sashPosition; } int GetSashPosition() const { return m_sashPosition; }
@@ -127,17 +135,18 @@ public:
// FALSE from here to prevent the change from taking place. // FALSE from here to prevent the change from taking place.
// Repositions sash to minimum position if pane would be too small. // Repositions sash to minimum position if pane would be too small.
// newSashPosition here is always positive or zero. // 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 // If the sash is moved to an extreme position, a subwindow
// is removed from the splitter window, and the app is // is removed from the splitter window, and the app is
// notified. The app should delete or hide the window. // 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. // Called when the sash is double-clicked.
// The default behaviour is to remove the sash if the // The default behaviour is to remove the sash if the
// minimum pane size is zero. // minimum pane size is zero.
virtual void OnDoubleClickSash(int x, int y); virtual void OnDoubleClickSash(int WXUNUSED(x), int WXUNUSED(y)) { }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Implementation // Implementation
@@ -170,6 +179,13 @@ public:
void InitColours(); void InitColours();
protected: protected:
// our event handlers
void OnSashPosChanged(wxSplitterEvent& event);
void OnDoubleClick(wxSplitterEvent& event);
void OnUnsplitEvent(wxSplitterEvent& event);
void SendUnsplitEvent(wxWindow *winRemoved);
int m_splitMode; int m_splitMode;
wxWindow* m_windowOne; wxWindow* m_windowOne;
wxWindow* m_windowTwo; wxWindow* m_windowTwo;
@@ -197,4 +213,109 @@ private:
DECLARE_EVENT_TABLE() 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__ #endif // __SPLITTERH_G__

View File

@@ -431,11 +431,23 @@ extern void WXDLLEXPORT wxLog##level(arg1, const wxChar *szFormat, ...)
#endif #endif
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
// 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) \ #define wxLogApiError(api, rc) \
wxLogDebug(_T("At %s(%d) '%s' failed with error %lx (%s)."), \ wxLogDebug(_T("%s(%d): '%s' failed with error 0x%08lx (%s)."), \
__TFILE__, __LINE__, api, \ __TFILE__, __LINE__, api, \
rc, wxSysErrorMsg(rc)) 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()) #define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode())
#else //!debug #else //!debug
inline void wxLogApiError(const wxChar *, long) { } inline void wxLogApiError(const wxChar *, long) { }
inline void wxLogLastError(const wxChar *) { } inline void wxLogLastError(const wxChar *) { }

View File

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

View File

@@ -29,15 +29,26 @@ public:
virtual ~wxControl(); virtual ~wxControl();
// Simulates an event // Simulates an event
virtual void Command(wxCommandEvent& WXUNUSED(event)) { } bool Command(wxCommandEvent& event) { return ProcessCommand(event); }
// Calls the callback and appropriate event handlers // Calls the callback and appropriate event handlers
virtual void ProcessCommand(wxCommandEvent& event); bool ProcessCommand(wxCommandEvent& event);
virtual void SetClientSize(int width, int height); // Places item in centre of panel - so can't be used BEFORE panel->Fit()
virtual void SetClientSize(const wxSize& sz) { wxWindow::SetClientSize(sz); } void Centre(int direction = wxHORIZONTAL);
virtual void SetLabel(const wxString& label); // MSW-specific
virtual wxString GetLabel() const; #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 #if WXWIN_COMPATIBILITY
virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { } virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { }
@@ -47,51 +58,32 @@ public:
inline virtual void SetButtonFont(const wxFont& font); inline virtual void SetButtonFont(const wxFont& font);
inline wxFont& GetLabelFont() const; inline wxFont& GetLabelFont() const;
inline wxFont& GetButtonFont() 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 // Adds callback
inline void Callback(const wxFunction function); 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; } wxFunction GetCallback() { return m_callback; }
wxList& GetSubcontrols() { return m_subControls; }
void OnEraseBackground(wxEraseEvent& event);
protected: protected:
wxFunction m_callback; // Callback associated with the window wxFunction m_callback; // Callback associated with the window
#endif // WXWIN_COMPATIBILITY
// MSW implementation protected:
wxList m_subControls; // For controls like radiobuttons which are really composite // For controls like radiobuttons which are really composite
wxList m_subControls;
private: private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
// Adds callback
inline void wxControl::Callback(const wxFunction function)
{
m_callback = function;
};
#if WXWIN_COMPATIBILITY #if WXWIN_COMPATIBILITY
inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
inline wxFont& wxControl::GetLabelFont() const { return GetFont() ; } inline wxFont& wxControl::GetLabelFont() const { return GetFont() ; }
inline wxFont& wxControl::GetButtonFont() const { return GetFont() ; } inline wxFont& wxControl::GetButtonFont() const { return GetFont() ; }
inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); } inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); }
inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); } inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); }
#endif #endif // WXWIN_COMPATIBILITY
#endif #endif
// _WX_CONTROL_H_ // _WX_CONTROL_H_

View File

@@ -167,67 +167,5 @@ protected:
WXHPALETTE m_oldPalette; 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 #endif
// _WX_DC_H_ // _WX_DC_H_

View File

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

View File

@@ -72,15 +72,11 @@ public:
void SetMenuBar(wxMenuBar *menu_bar); void SetMenuBar(wxMenuBar *menu_bar);
virtual wxMenuBar *GetMenuBar() const; virtual wxMenuBar *GetMenuBar() const;
// Set title
void SetTitle(const wxString& title);
wxString GetTitle() const ;
void Centre(int direction = wxBOTH);
// Call this to simulate a menu command // Call this to simulate a menu command
virtual void Command(int id); bool Command(int id) { ProcessCommand(id); }
virtual void ProcessCommand(int id);
// process menu command: returns TRUE if processed
bool ProcessCommand(int id);
// Set icon // Set icon
virtual void SetIcon(const wxIcon& icon); virtual void SetIcon(const wxIcon& icon);
@@ -123,9 +119,6 @@ public:
static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; }; static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
static bool UsesNativeStatusBar() { return m_useNativeStatusBar; }; static bool UsesNativeStatusBar() { return m_useNativeStatusBar; };
// Fit frame around subwindows
virtual void Fit();
// Iconize // Iconize
virtual void Iconize(bool iconize); virtual void Iconize(bool iconize);
@@ -147,7 +140,7 @@ public:
void DoMenuUpdates(); void DoMenuUpdates();
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin); 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 // Returns the origin of client area (may be different from (0,0) if the
// frame has a toolbar) // frame has a toolbar)
@@ -155,19 +148,15 @@ public:
// Implementation only from here // Implementation only from here
// event handlers // event handlers
bool MSWOnPaint(); bool HandlePaint();
WXHICON MSWOnQueryDragIcon(); bool HandleSize(int x, int y, WXUINT flag);
bool MSWOnSize(int x, int y, WXUINT flag); bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control); bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu);
bool MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
bool MSWProcessMessage(WXMSG *msg);
bool MSWTranslateMessage(WXMSG *msg);
bool MSWCreate(int id, wxWindow *parent, const char *wclass, bool MSWCreate(int id, wxWindow *parent, const char *wclass,
wxWindow *wx_win, const char *title, wxWindow *wx_win, const char *title,
int x, int y, int width, int height, long style); int x, int y, int width, int height, long style);
bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu);
// tooltip management // tooltip management
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
@@ -185,9 +174,16 @@ protected:
int sizeFlags = wxSIZE_AUTO); int sizeFlags = wxSIZE_AUTO);
virtual void DoSetClientSize(int width, int height); 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 // propagate our state change to all child frames
void IconizeChildFrames(bool bIconize); void IconizeChildFrames(bool bIconize);
// we add menu bar accel processing
bool MSWTranslateMessage(WXMSG* pMsg);
// window proc for the frames // window proc for the frames
long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);

View File

@@ -407,16 +407,6 @@ class WXDLLEXPORT wxListCtrl: public wxControl
// data is arbitrary data to be passed to the sort function. // data is arbitrary data to be passed to the sort function.
bool SortItems(wxListCtrlCompare fn, long data); 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 // IMPLEMENTATION
virtual bool MSWCommand(WXUINT param, WXWORD id); virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);

View File

@@ -58,8 +58,6 @@ public:
// accessors // accessors
// --------- // ---------
void SetMenuBar(wxMenuBar *menu_bar);
// Get the active MDI child window (Windows only) // Get the active MDI child window (Windows only)
wxMDIChildFrame *GetActiveChild() const; wxMDIChildFrame *GetActiveChild() const;
@@ -87,19 +85,19 @@ public:
void OnSysColourChanged(wxSysColourChangedEvent& event); void OnSysColourChanged(wxSysColourChangedEvent& event);
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
void OnActivate(wxActivateEvent& event);
virtual bool MSWOnActivate(int state, bool minimized, WXHWND activate); bool HandleActivate(int state, bool minimized, WXHWND activate);
virtual bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control); bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
// override window proc for MDI-specific message processing // override window proc for MDI-specific message processing
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual long MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM); virtual long MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM);
virtual bool MSWProcessMessage(WXMSG* msg);
virtual bool MSWTranslateMessage(WXMSG* msg); virtual bool MSWTranslateMessage(WXMSG* msg);
protected: protected:
virtual void InternalSetMenuBar();
wxMDIClientWindow * m_clientWindow; wxMDIClientWindow * m_clientWindow;
wxMDIChildFrame * m_currentChild; wxMDIChildFrame * m_currentChild;
WXHMENU m_windowMenu; WXHMENU m_windowMenu;
@@ -144,9 +142,6 @@ public:
long style = wxDEFAULT_FRAME_STYLE, long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr); const wxString& name = wxFrameNameStr);
// Set menu bar
void SetMenuBar(wxMenuBar *menu_bar);
// MDI operations // MDI operations
virtual void Maximize(); virtual void Maximize();
virtual void Restore(); virtual void Restore();
@@ -154,14 +149,16 @@ public:
// Handlers // Handlers
bool MSWOnMDIActivate(long bActivate, WXHWND, WXHWND); bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
bool MSWOnSize(int x, int y, WXUINT); bool HandleSize(int x, int y, WXUINT);
bool MSWOnWindowPosChanging(void *lpPos); bool HandleWindowPosChanging(void *lpPos);
bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control); bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
bool MSWProcessMessage(WXMSG *msg); virtual long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
bool MSWTranslateMessage(WXMSG *msg); virtual long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
void MSWDestroyWindow(); virtual bool MSWTranslateMessage(WXMSG *msg);
virtual void MSWDestroyWindow();
// Implementation // Implementation
bool ResetWindowStyle(void *vrect); bool ResetWindowStyle(void *vrect);
@@ -169,6 +166,7 @@ public:
protected: 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 DoSetClientSize(int width, int height);
virtual void InternalSetMenuBar();
}; };
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -180,14 +178,14 @@ class WXDLLEXPORT wxMDIClientWindow : public wxWindow
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
public: public:
wxMDIClientWindow(); wxMDIClientWindow() { Init(); }
wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
{ {
Init();
CreateClient(parent, style); CreateClient(parent, style);
} }
~wxMDIClientWindow();
// Note: this is virtual, to allow overridden behaviour. // Note: this is virtual, to allow overridden behaviour.
virtual bool CreateClient(wxMDIParentFrame *parent, virtual bool CreateClient(wxMDIParentFrame *parent,
long style = wxVSCROLL | wxHSCROLL); long style = wxVSCROLL | wxHSCROLL);
@@ -195,13 +193,9 @@ public:
// Explicitly call default scroll behaviour // Explicitly call default scroll behaviour
void OnScroll(wxScrollEvent& event); 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: protected:
void Init() { m_scrollX = m_scrollY = 0; }
int m_scrollX, m_scrollY; int m_scrollX, m_scrollY;
private: private:

View File

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

View File

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

View File

@@ -16,8 +16,28 @@
#include <windows.h> #include <windows.h>
// undefine conflicting symbols which were defined in windows.h
#include "wx/msw/winundef.h"
class WXDLLEXPORT wxFont; 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 // standard icons from the resources
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -178,7 +198,9 @@ extern LONG APIENTRY _EXPORT
#endif // USE_DBWIN32 #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()) #define GetHwnd() ((HWND)GetHWND())
@@ -186,8 +208,11 @@ extern LONG APIENTRY _EXPORT
#define GetHdc() ((HDC)GetHDC()) #define GetHdc() ((HDC)GetHDC())
#define GetHicon() ((HICON)GetHICON())
#define GetIconHicon(icon) ((HICON)(icon).GetHICON())
#define GetHaccel() ((HACCEL)GetHACCEL()) #define GetHaccel() ((HACCEL)GetHACCEL())
#define GetTableHaccel(table) ((HACCEL)((table)->GetHACCEL())) #define GetTableHaccel(table) ((HACCEL)((table).GetHACCEL()))
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// global data // global data
@@ -226,8 +251,9 @@ WXDLLEXPORT extern wxString wxGetWindowText(WXHWND hWnd);
// get the window class name // get the window class name
WXDLLEXPORT extern wxString wxGetWindowClass(WXHWND hWnd); WXDLLEXPORT extern wxString wxGetWindowClass(WXHWND hWnd);
// get the window id // get the window id (should be unsigned, hence this is not wxWindowID which
WXDLLEXPORT extern wxWindowID wxGetWindowId(WXHWND hWnd); // is, for mainly historical reasons, signed)
WXDLLEXPORT extern WXWORD wxGetWindowId(WXHWND hWnd);
// Does this window style specify any border? // Does this window style specify any border?
inline bool wxStyleHasBorder(long style) inline bool wxStyleHasBorder(long style)

View File

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

View File

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

View File

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

View File

@@ -47,10 +47,6 @@ public:
// accessors // accessors
void SetLabel(const wxString& label); void SetLabel(const wxString& label);
// operations
virtual void Command(wxCommandEvent& WXUNUSED(event)) { }
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) { }
// overriden base class virtuals // overriden base class virtuals
virtual bool AcceptsFocus() const { return FALSE; } virtual bool AcceptsFocus() const { return FALSE; }

View File

@@ -115,15 +115,6 @@ class WXDLLEXPORT wxTabCtrl: public wxControl
// 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); virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
// Responds to colour changes // Responds to colour changes

View File

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

View File

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

View File

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

View File

@@ -20,14 +20,7 @@
#pragma interface "window.h" #pragma interface "window.h"
#endif #endif
// windows.h #defines the following identifiers which are also used in wxWin #include "wx/msw/winundef.h"
#ifdef GetCharWidth
#undef GetCharWidth
#endif
#ifdef FindWindow
#undef FindWindow
#endif
// VZ: apparently some version of Windows send extra mouse move messages after // 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 // 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); const wxString& name = wxPanelNameStr);
// implement base class pure virtuals // implement base class pure virtuals
virtual void SetTitle( const wxString& title);
virtual wxString GetTitle() const;
virtual void Raise(); virtual void Raise();
virtual void Lower(); virtual void Lower();
@@ -145,6 +141,14 @@ public:
virtual void SetScrollPage(int orient, int page, bool refresh = TRUE); virtual void SetScrollPage(int orient, int page, bool refresh = TRUE);
virtual int OldGetScrollRange(int orient) const; virtual int OldGetScrollRange(int orient) const;
virtual int GetScrollPage(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 #endif // WXWIN_COMPATIBILITY
// caret manipulation (MSW only) // caret manipulation (MSW only)
@@ -155,20 +159,12 @@ public:
virtual void SetCaretPos(int x, int y); virtual void SetCaretPos(int x, int y);
virtual void GetCaretPos(int *x, int *y) const; 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) // Native resource loading (implemented in src/msw/nativdlg.cpp)
// FIXME: should they really be all virtual? // FIXME: should they really be all virtual?
virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id); virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id);
virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name); virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name);
virtual wxWindow* GetWindowChild1(wxWindowID id); wxWindow* GetWindowChild1(wxWindowID id);
virtual wxWindow* GetWindowChild(wxWindowID id); wxWindow* GetWindowChild(wxWindowID id);
// implementation from now on // implementation from now on
// -------------------------- // --------------------------
@@ -206,14 +202,12 @@ public:
// Windows subclassing // Windows subclassing
void SubclassWin(WXHWND hWnd); void SubclassWin(WXHWND hWnd);
void UnsubclassWin(); void UnsubclassWin();
virtual bool MSWCommand(WXUINT param, WXWORD id);
WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; } WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; }
void MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; } void MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; }
virtual wxWindow *FindItem(int id) const; wxWindow *FindItem(int id) const;
virtual wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const ; wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const;
virtual void PreDelete(WXHDC dc); // Allows system cleanup
// Make a Windows extended style from the given wxWindows window style // Make a Windows extended style from the given wxWindows window style
virtual WXDWORD MakeExtendedStyle(long style, bool eliminateBorders = TRUE); 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 // MSW only: TRUE if this control is part of the main control
virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; }; virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; };
wxObject *GetChild(int number) const ;
// returns TRUE if the window has been created // returns TRUE if the window has been created
bool MSWCreate(int id, bool MSWCreate(int id,
wxWindow *parent, wxWindow *parent,
@@ -235,9 +227,12 @@ public:
WXDWORD style, WXDWORD style,
const char *dialog_template = NULL, const char *dialog_template = NULL,
WXDWORD exendedStyle = 0); WXDWORD exendedStyle = 0);
virtual bool MSWCommand(WXUINT param, WXWORD id);
// Actually defined in wx_canvs.cc since requires wxCanvas declaration #if WXWIN_COMPATIBILITY
wxObject *GetChild(int number) const;
virtual void MSWDeviceToLogical(float *x, float *y) const; virtual void MSWDeviceToLogical(float *x, float *y) const;
#endif // WXWIN_COMPATIBILITY
// Create an appropriate wxWindow from a HWND // Create an appropriate wxWindow from a HWND
virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd); virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd);
@@ -248,33 +243,68 @@ public:
// Setup background and foreground colours correctly // Setup background and foreground colours correctly
virtual void SetupColours(); 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: // 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 // 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 // there are several cases where we have virtual functions for Windows
// implement this functionality // message processing: this is because these messages often require to be
virtual bool MSWOnCreate(WXLPCREATESTRUCT cs, bool *mayCreate); // processed in a different manner in the derived classes. For all other
virtual bool MSWOnPaint(); // messages, however, we do *not* have corresponding MSWOnXXX() function
virtual bool MSWOnEraseBkgnd(WXHDC pDC); // and if the derived class wants to process them, it should override
virtual bool MSWOnSize(int x, int y, WXUINT flag); // MSWWindowProc() directly.
virtual bool MSWOnQueryDragIcon(WXHICON *hIcon); // scroll event (both horizontal and vertical)
virtual bool MSWOnWindowPosChanging(void *lpPos);
// both horizontal and vertical
virtual bool MSWOnScroll(int orientation, WXWORD nSBCode, virtual bool MSWOnScroll(int orientation, WXWORD nSBCode,
WXWORD pos, WXHWND control); WXWORD pos, WXHWND control);
virtual bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control); // child control notifications
virtual bool MSWOnSysCommand(WXWPARAM wParam, WXLPARAM lParam);
#ifdef __WIN95__ #ifdef __WIN95__
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
#endif // __WIN95__ #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, WXHDC hdc,
WXHWND hWnd, WXHWND hWnd,
WXUINT nCtlColor, WXUINT nCtlColor,
@@ -282,31 +312,28 @@ public:
WXWPARAM wParam, WXWPARAM wParam,
WXLPARAM lParam); WXLPARAM lParam);
virtual bool MSWOnPaletteChanged(WXHWND hWndPalChange); bool HandlePaletteChanged(WXHWND hWndPalChange);
virtual bool MSWOnQueryNewPalette(); bool HandleQueryNewPalette();
bool HandleSysColorChange();
virtual bool MSWOnQueryEndSession(long logOff, bool *mayEnd); bool HandleQueryEndSession(long logOff, bool *mayEnd);
virtual bool MSWOnEndSession(bool endSession, long logOff); bool HandleEndSession(bool endSession, long logOff);
virtual bool MSWOnDestroy(); bool HandleSetFocus(WXHWND wnd);
virtual bool MSWOnSetFocus(WXHWND wnd); bool HandleKillFocus(WXHWND wnd);
virtual bool MSWOnKillFocus(WXHWND wnd);
virtual bool MSWOnDropFiles(WXWPARAM wParam);
virtual bool MSWOnInitDialog(WXHWND hWndFocus);
virtual bool MSWOnShow(bool show, int status);
virtual bool MSWOnMouseEvent(WXUINT msg, int x, int y, WXUINT flags); bool HandleDropFiles(WXWPARAM wParam);
virtual bool MSWOnMouseMove(int x, int y, WXUINT flags);
virtual bool MSWOnChar(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE); bool HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags);
virtual bool MSWOnKeyDown(WXWORD wParam, WXLPARAM lParam); bool HandleMouseMove(int x, int y, WXUINT flags);
virtual bool MSWOnKeyUp(WXWORD wParam, WXLPARAM lParam);
virtual bool MSWOnActivate(int flag, bool minimized, WXHWND activate); bool HandleChar(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE);
virtual bool MSWOnMDIActivate(long flag, WXHWND activate, WXHWND deactivate); bool HandleKeyDown(WXWORD wParam, WXLPARAM lParam);
bool HandleKeyUp(WXWORD wParam, WXLPARAM lParam);
virtual bool MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *item); bool HandleQueryDragIcon(WXHICON *hIcon);
virtual bool MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *item);
bool HandleSetCursor(WXHWND hWnd, short nHitTest, int mouseMsg);
// Window procedure // Window procedure
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);

View File

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

View File

@@ -156,7 +156,8 @@ public:
// label is just the same as the title (but for, e.g., buttons it // label is just the same as the title (but for, e.g., buttons it
// makes more sense to speak about labels) // 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 // the window name is used for ressource setting in X, it is not the
// same as the window title/label // same as the window title/label

View File

@@ -60,6 +60,8 @@
IMPLEMENT_DYNAMIC_CLASS(wxNavigationKeyEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxNavigationKeyEvent, wxCommandEvent)
IMPLEMENT_DYNAMIC_CLASS(wxPaletteChangedEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxPaletteChangedEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxQueryNewPaletteEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxQueryNewPaletteEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxWindowCreateEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxWindowDestroyEvent, wxEvent)
const wxEventTable *wxEvtHandler::GetEventTable() const const wxEventTable *wxEvtHandler::GetEventTable() const
{ return &wxEvtHandler::sm_eventTable; } { return &wxEvtHandler::sm_eventTable; }
@@ -91,7 +93,6 @@ wxEvent::wxEvent(int theId)
{ {
m_eventType = wxEVT_NULL; m_eventType = wxEVT_NULL;
m_eventObject = (wxObject *) NULL; m_eventObject = (wxObject *) NULL;
m_eventHandle = (char *) NULL;
m_timeStamp = 0; m_timeStamp = 0;
m_id = theId; m_id = theId;
m_skipped = FALSE; m_skipped = FALSE;
@@ -106,7 +107,6 @@ void wxEvent::CopyObject(wxObject& object_dest) const
obj->m_eventType = m_eventType; obj->m_eventType = m_eventType;
obj->m_eventObject = m_eventObject; obj->m_eventObject = m_eventObject;
obj->m_eventHandle = m_eventHandle;
obj->m_timeStamp = m_timeStamp; obj->m_timeStamp = m_timeStamp;
obj->m_id = m_id; obj->m_id = m_id;
obj->m_skipped = m_skipped; obj->m_skipped = m_skipped;
@@ -467,6 +467,18 @@ void wxQueryNewPaletteEvent::CopyObject(wxObject& obj_d) const
obj->m_paletteRealized = m_paletteRealized; obj->m_paletteRealized = m_paletteRealized;
} }
wxWindowCreateEvent::wxWindowCreateEvent(wxWindow *win)
: wxEvent(wxEVT_CREATE)
{
SetEventObject(win);
}
wxWindowDestroyEvent::wxWindowDestroyEvent(wxWindow *win)
: wxEvent(wxEVT_DESTROY)
{
SetEventObject(win);
}
/* /*
* Event handler * Event handler
*/ */

View File

@@ -57,7 +57,7 @@
// static data // static data
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
int wxWindowBase::ms_lastControlId = -2; int wxWindowBase::ms_lastControlId = -200;
IMPLEMENT_ABSTRACT_CLASS(wxWindowBase, wxEvtHandler) IMPLEMENT_ABSTRACT_CLASS(wxWindowBase, wxEvtHandler)
@@ -309,6 +309,14 @@ void wxWindowBase::Fit()
while ( node ) while ( node )
{ {
wxWindow *win = node->GetData(); wxWindow *win = node->GetData();
if ( win->IsKindOf(CLASSINFO(wxFrame)) ||
win->IsKindOf(CLASSINFO(wxDialog)) )
{
// dialogs and frames line in different top level windows - don't
// deal with them here
continue;
}
int wx, wy, ww, wh; int wx, wy, ww, wh;
win->GetPosition(&wx, &wy); win->GetPosition(&wx, &wy);
win->GetSize(&ww, &wh); win->GetSize(&ww, &wh);

View File

@@ -24,7 +24,6 @@
#include "wx/wx.h" #include "wx/wx.h"
#endif #endif
#include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include "wx/string.h" #include "wx/string.h"
@@ -33,11 +32,16 @@
#if !USE_SHARED_LIBRARY #if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow) IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow)
IMPLEMENT_DYNAMIC_CLASS(wxSplitterEvent, wxCommandEvent)
BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow) BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow)
EVT_PAINT(wxSplitterWindow::OnPaint) EVT_PAINT(wxSplitterWindow::OnPaint)
EVT_SIZE(wxSplitterWindow::OnSize) EVT_SIZE(wxSplitterWindow::OnSize)
EVT_MOUSE_EVENTS(wxSplitterWindow::OnMouseEvent) EVT_MOUSE_EVENTS(wxSplitterWindow::OnMouseEvent)
EVT_SPLITTER_SASH_POS_CHANGED(-1, wxSplitterWindow::OnSashPosChanged)
EVT_SPLITTER_DCLICK(-1, wxSplitterWindow::OnDoubleClick)
EVT_SPLITTER_UNSPLIT(-1, wxSplitterWindow::OnUnsplitEvent)
END_EVENT_TABLE() END_EVENT_TABLE()
#endif #endif
@@ -195,8 +199,18 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
int new_sash_position = int new_sash_position =
(int) ( m_splitMode == wxSPLIT_VERTICAL ? x : y ); (int) ( m_splitMode == wxSPLIT_VERTICAL ? x : y );
if ( !OnSashPositionChange(new_sash_position) ) wxSplitterEvent eventSplitter(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED,
this);
eventSplitter.m_data.pos = new_sash_position;
if ( GetEventHandler()->ProcessEvent(eventSplitter) )
{
new_sash_position = eventSplitter.GetSashPosition();
if ( new_sash_position == -1 )
{
// change not allowed
return; return;
}
}
if ( new_sash_position == 0 ) if ( new_sash_position == 0 )
{ {
@@ -204,7 +218,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
wxWindow *removedWindow = m_windowOne; wxWindow *removedWindow = m_windowOne;
m_windowOne = m_windowTwo; m_windowOne = m_windowTwo;
m_windowTwo = (wxWindow *) NULL; m_windowTwo = (wxWindow *) NULL;
OnUnsplit(removedWindow); SendUnsplitEvent(removedWindow);
m_sashPosition = 0; m_sashPosition = 0;
} }
else if ( new_sash_position == window_size ) else if ( new_sash_position == window_size )
@@ -212,13 +226,14 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
// We remove the second window from the view // We remove the second window from the view
wxWindow *removedWindow = m_windowTwo; wxWindow *removedWindow = m_windowTwo;
m_windowTwo = (wxWindow *) NULL; m_windowTwo = (wxWindow *) NULL;
OnUnsplit(removedWindow); SendUnsplitEvent(removedWindow);
m_sashPosition = 0; m_sashPosition = 0;
} }
else else
{ {
m_sashPosition = new_sash_position; m_sashPosition = new_sash_position;
} }
SizeWindows(); SizeWindows();
} // left up && dragging } // left up && dragging
else if (event.Moving() && !event.Dragging()) else if (event.Moving() && !event.Dragging())
@@ -241,7 +256,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
// where else do we unset the cursor? // where else do we unset the cursor?
SetCursor(* wxSTANDARD_CURSOR); SetCursor(* wxSTANDARD_CURSOR);
} }
#endif #endif // __WXGTK__
} }
else if (event.Dragging() && (m_dragMode == wxSPLIT_DRAG_DRAGGING)) else if (event.Dragging() && (m_dragMode == wxSPLIT_DRAG_DRAGGING))
{ {
@@ -256,7 +271,12 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
} }
else if ( event.LeftDClick() ) else if ( event.LeftDClick() )
{ {
OnDoubleClickSash(x, y); wxSplitterEvent eventSplitter(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED,
this);
eventSplitter.m_data.pt.x = x;
eventSplitter.m_data.pt.y = y;
(void)GetEventHandler()->ProcessEvent(eventSplitter);
} }
} }
@@ -614,7 +634,7 @@ bool wxSplitterWindow::Unsplit(wxWindow *toRemove)
return FALSE; return FALSE;
} }
OnUnsplit(win); SendUnsplitEvent(win);
m_sashPosition = 0; m_sashPosition = 0;
SizeWindows(); SizeWindows();
@@ -657,56 +677,6 @@ void wxSplitterWindow::SetSashPosition(int position, bool redraw)
} }
} }
bool wxSplitterWindow::OnSashPositionChange(int& newSashPosition)
{
// If within UNSPLIT_THRESHOLD from edge, set to edge to cause closure.
const int UNSPLIT_THRESHOLD = 4;
if (newSashPosition <= UNSPLIT_THRESHOLD) // threshold top / left check
{
newSashPosition = 0;
return TRUE;
}
// Obtain relevant window dimension for bottom / right threshold check
int w, h;
GetClientSize(&w, &h);
int window_size = (m_splitMode == wxSPLIT_VERTICAL) ? w : h ;
if ( newSashPosition >= window_size - UNSPLIT_THRESHOLD )
{
newSashPosition = window_size;
return TRUE;
}
// If resultant pane would be too small, enlarge it.
// Check upper / left pane
if ( newSashPosition < m_minimumPaneSize )
newSashPosition = m_minimumPaneSize; // NB: don't return just yet
// Check lower / right pane (check even if sash was just adjusted)
if ( newSashPosition > window_size - m_minimumPaneSize )
newSashPosition = window_size - m_minimumPaneSize;
// If the result is out of bounds it means minimum size is too big, so
// split window in half as best compromise.
if (newSashPosition < 0 || newSashPosition > window_size)
newSashPosition = window_size / 2;
return TRUE;
}
// Called when the sash is double-clicked.
// The default behaviour is to remove the sash if the
// minimum pane size is zero.
void wxSplitterWindow::OnDoubleClickSash(int WXUNUSED(x), int WXUNUSED(y) )
{
if ( GetMinimumPaneSize() == 0 )
{
Unsplit();
}
}
// Initialize colours // Initialize colours
void wxSplitterWindow::InitColours() void wxSplitterWindow::InitColours()
{ {
@@ -744,3 +714,84 @@ void wxSplitterWindow::InitColours()
#endif // Win32/!Win32 #endif // Win32/!Win32
} }
void wxSplitterWindow::SendUnsplitEvent(wxWindow *winRemoved)
{
wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_UNSPLIT, this);
event.m_data.win = winRemoved;
(void)GetEventHandler()->ProcessEvent(event);
}
// ---------------------------------------------------------------------------
// splitter event handlers
// ---------------------------------------------------------------------------
void wxSplitterWindow::OnSashPosChanged(wxSplitterEvent& event)
{
// If within UNSPLIT_THRESHOLD from edge, set to edge to cause closure.
const int UNSPLIT_THRESHOLD = 4;
int newSashPosition = event.GetSashPosition();
// Obtain relevant window dimension for bottom / right threshold check
int w, h;
GetClientSize(&w, &h);
int window_size = (m_splitMode == wxSPLIT_VERTICAL) ? w : h ;
if ( newSashPosition <= UNSPLIT_THRESHOLD )
{
// threshold top / left check
newSashPosition = 0;
}
else if ( newSashPosition >= window_size - UNSPLIT_THRESHOLD )
{
// threshold bottom/right check
newSashPosition = window_size;
}
// If resultant pane would be too small, enlarge it.
// Check upper / left pane
if ( newSashPosition < m_minimumPaneSize )
newSashPosition = m_minimumPaneSize;
// Check lower / right pane (check even if sash was just adjusted)
if ( newSashPosition > window_size - m_minimumPaneSize )
newSashPosition = window_size - m_minimumPaneSize;
// If the result is out of bounds it means minimum size is too big,
// so split window in half as best compromise.
if ( newSashPosition < 0 || newSashPosition > window_size )
newSashPosition = window_size / 2;
// for compatibility, call the virtual function
if ( !OnSashPositionChange(newSashPosition) )
{
newSashPosition = -1;
}
event.SetSashPosition(newSashPosition);
}
// Called when the sash is double-clicked. The default behaviour is to remove
// the sash if the minimum pane size is zero.
void wxSplitterWindow::OnDoubleClick(wxSplitterEvent& event)
{
// for compatibility, call the virtual function
OnDoubleClickSash(event.GetX(), event.GetY());
if ( GetMinimumPaneSize() == 0 )
{
Unsplit();
}
}
void wxSplitterWindow::OnUnsplitEvent(wxSplitterEvent& event)
{
wxWindow *win = event.GetWindowBeingRemoved();
// for compatibility, call the virtual function
OnUnsplit(win);
win->Show(FALSE);
}

View File

@@ -30,10 +30,6 @@
#include "wx/msw/private.h" #include "wx/msw/private.h"
#ifdef LoadAccelerators
#undef LoadAccelerators
#endif
#if !USE_SHARED_LIBRARIES #if !USE_SHARED_LIBRARIES
IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)
#endif #endif

View File

@@ -100,7 +100,7 @@ extern void wxSetKeyboardHook(bool doIt);
extern wxCursor *g_globalCursor; extern wxCursor *g_globalCursor;
HINSTANCE wxhInstance = 0; HINSTANCE wxhInstance = 0;
static MSG s_currentMsg; MSG s_currentMsg;
wxApp *wxTheApp = NULL; wxApp *wxTheApp = NULL;
// FIXME why not const? and not static? // FIXME why not const? and not static?
@@ -150,8 +150,6 @@ LRESULT APIENTRY wxWndProc(HWND, UINT, WPARAM, LPARAM);
END_EVENT_TABLE() END_EVENT_TABLE()
#endif #endif
long wxApp::sm_lastMessageTime = 0;
//// Initialize //// Initialize
bool wxApp::Initialize() bool wxApp::Initialize()
{ {
@@ -169,7 +167,8 @@ bool wxApp::Initialize()
wxGetResource("wxWindows", "OsVersion", &wxOsVersion); wxGetResource("wxWindows", "OsVersion", &wxOsVersion);
#endif #endif
// I'm annoyed ... I don't know where to put this and I don't want to create // a module for that as it's part of the core. // I'm annoyed ... I don't know where to put this and I don't want to
// create a module for that as it's part of the core.
#if wxUSE_THREADS #if wxUSE_THREADS
wxPendingEvents = new wxList(); wxPendingEvents = new wxList();
wxPendingEventsLocker = new wxCriticalSection(); wxPendingEventsLocker = new wxCriticalSection();
@@ -205,18 +204,6 @@ bool wxApp::Initialize()
int iMsg = 96; int iMsg = 96;
while (!SetMessageQueue(iMsg) && (iMsg -= 8)); while (!SetMessageQueue(iMsg) && (iMsg -= 8));
/*
DWORD dwOleVer;
dwOleVer = CoBuildVersion();
// check the OLE library version
if (rmm != HIWORD(dwOleVer))
{
wxMessageBox("Incorrect version of OLE libraries.");
return FALSE;
}
*/
#if wxUSE_OLE #if wxUSE_OLE
// we need to initialize OLE library // we need to initialize OLE library
if ( FAILED(::OleInitialize(NULL)) ) if ( FAILED(::OleInitialize(NULL)) )
@@ -271,24 +258,26 @@ bool wxApp::Initialize()
return TRUE; return TRUE;
} }
//// RegisterWindowClasses // ---------------------------------------------------------------------------
// RegisterWindowClasses
// ---------------------------------------------------------------------------
bool wxApp::RegisterWindowClasses() bool wxApp::RegisterWindowClasses()
{ {
/////////////////////////////////////////////////////////////////////// WNDCLASS wndclass;
// Register the frame window class.
WNDCLASS wndclass; // Structure used to register Windows class.
// the fields which are common to all classes
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
wndclass.lpfnWndProc = (WNDPROC)wxWndProc; wndclass.lpfnWndProc = (WNDPROC)wxWndProc;
wndclass.cbClsExtra = 0; wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = sizeof( DWORD ); // was 4 wndclass.cbWndExtra = sizeof( DWORD ); // what is this DWORD used for?
wndclass.hInstance = wxhInstance; wndclass.hInstance = wxhInstance;
wndclass.hIcon = (HICON) NULL; // wxSTD_FRAME_ICON; wndclass.hIcon = (HICON) NULL;
wndclass.hCursor = LoadCursor( (HINSTANCE) NULL, IDC_ARROW ); wndclass.hCursor = ::LoadCursor((HINSTANCE)NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE+1) ;
// wndclass.hbrBackground = GetStockObject( WHITE_BRUSH );
wndclass.lpszMenuName = NULL; wndclass.lpszMenuName = NULL;
// Register the frame window class.
wndclass.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1);
#ifdef _MULTIPLE_INSTANCES #ifdef _MULTIPLE_INSTANCES
sprintf( wxFrameClassName,"wxFrameClass%d", wxhInstance ); sprintf( wxFrameClassName,"wxFrameClass%d", wxhInstance );
#endif #endif
@@ -296,106 +285,61 @@ bool wxApp::RegisterWindowClasses()
if ( !RegisterClass(&wndclass) ) if ( !RegisterClass(&wndclass) )
{ {
// wxFatalError("Can't register Frame Window class"); wxLogLastError("RegisterClass(frame)");
return FALSE;
} }
///////////////////////////////////////////////////////////////////////
// Register the MDI frame window class. // Register the MDI frame window class.
WNDCLASS wndclass1; // Structure used to register Windows class. wndclass.hbrBackground = (HBRUSH)NULL; // paint MDI frame ourselves
wndclass.lpszClassName = wxMDIFrameClassName;
wndclass1.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS ; if ( !RegisterClass(&wndclass) )
wndclass1.lpfnWndProc = (WNDPROC)wxWndProc;
wndclass1.cbClsExtra = 0;
wndclass1.cbWndExtra = sizeof( DWORD ); // was 4
wndclass1.hInstance = wxhInstance;
wndclass1.hIcon = (HICON) NULL; // wxSTD_MDIPARENTFRAME_ICON;
wndclass1.hCursor = LoadCursor( (HINSTANCE) NULL, IDC_ARROW );
// wndclass1.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE+1) ;
wndclass1.hbrBackground = (HBRUSH) NULL;
wndclass1.lpszMenuName = NULL;
wndclass1.lpszClassName = wxMDIFrameClassName;
if (!RegisterClass( &wndclass1 ))
{ {
// wxFatalError("Can't register MDI Frame window class"); wxLogLastError("RegisterClass(MDI parent)");
// return FALSE;
return FALSE;
} }
///////////////////////////////////////////////////////////////////////
// Register the MDI child frame window class. // Register the MDI child frame window class.
WNDCLASS wndclass4; // Structure used to register Windows class. wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wndclass.lpszClassName = wxMDIChildFrameClassName;
wndclass4.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS ; if ( !RegisterClass(&wndclass) )
wndclass4.lpfnWndProc = (WNDPROC)wxWndProc;
wndclass4.cbClsExtra = 0;
wndclass4.cbWndExtra = sizeof( DWORD ); // was 4
wndclass4.hInstance = wxhInstance;
wndclass4.hIcon = (HICON) NULL; // wxSTD_MDICHILDFRAME_ICON;
wndclass4.hCursor = LoadCursor( (HINSTANCE) NULL, IDC_ARROW );
// TODO: perhaps this should be NULL so that Windows doesn't
// paint the background itself (would OnEraseBackground duplicate
// this?)
wndclass4.hbrBackground = (HBRUSH)(COLOR_WINDOW+1) ;
// wndclass4.hbrBackground = NULL;
wndclass4.lpszMenuName = NULL;
wndclass4.lpszClassName = wxMDIChildFrameClassName;
if (!RegisterClass( &wndclass4 ))
{ {
// wxFatalError("Can't register MDI child frame window class"); wxLogLastError("RegisterClass(MDI child)");
// return FALSE;
return FALSE;
} }
///////////////////////////////////////////////////////////////////////
// Register the panel window class. // Register the panel window class.
WNDCLASS wndclass2; // Structure used to register Windows class. wndclass.hbrBackground = (HBRUSH) GetStockObject( LTGRAY_BRUSH );
memset(&wndclass2, 0, sizeof(WNDCLASS)); // start with NULL defaults wndclass.lpszClassName = wxPanelClassName;
wndclass2.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS ;
wndclass2.lpfnWndProc = (WNDPROC)wxWndProc; if ( !RegisterClass(&wndclass) )
wndclass2.cbClsExtra = 0;
wndclass2.cbWndExtra = sizeof( DWORD ); // was 4
wndclass2.hInstance = wxhInstance;
wndclass2.hIcon = (HICON) NULL;
wndclass2.hCursor = LoadCursor( (HINSTANCE) NULL, IDC_ARROW );
// wndclass2.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1) ;
wndclass2.hbrBackground = (HBRUSH) GetStockObject( LTGRAY_BRUSH );
wndclass2.lpszMenuName = NULL;
wndclass2.lpszClassName = wxPanelClassName;
if (!RegisterClass( &wndclass2 ))
{ {
// wxFatalError("Can't register Panel Window class"); wxLogLastError("RegisterClass(panel)");
// return FALSE;
return FALSE;
} }
///////////////////////////////////////////////////////////////////////
// Register the canvas and textsubwindow class name // Register the canvas and textsubwindow class name
WNDCLASS wndclass3; // Structure used to register Windows class. wndclass.hbrBackground = (HBRUSH)NULL;
memset(&wndclass3, 0, sizeof(WNDCLASS)); // start with NULL defaults wndclass.lpszClassName = wxCanvasClassName;
// Use CS_OWNDC to avoid messing about restoring the context
// for every graphic operation. if ( !RegisterClass(&wndclass) )
// wndclass3.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC | CS_DBLCLKS ;
// wxWin 2.0
wndclass3.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS ;
wndclass3.lpfnWndProc = (WNDPROC)wxWndProc;
wndclass3.cbClsExtra = 0;
wndclass3.cbWndExtra = sizeof( DWORD ); // was 4
wndclass3.hInstance = wxhInstance;
wndclass3.hIcon = (HICON) NULL;
wndclass3.hCursor = LoadCursor( (HINSTANCE) NULL, IDC_ARROW );
// wndclass3.hbrBackground = (HBRUSH)(COLOR_WINDOW+1) ;
wndclass3.hbrBackground = (HBRUSH) NULL;
wndclass3.lpszMenuName = NULL;
wndclass3.lpszClassName = wxCanvasClassName;
if (!RegisterClass( &wndclass3))
{ {
// wxFatalError("Can't register Canvas class"); wxLogLastError("RegisterClass(canvas)");
// return FALSE;
return FALSE;
} }
return TRUE; return TRUE;
} }
//// Convert Windows to argc, argv style // ---------------------------------------------------------------------------
// Convert Windows to argc, argv style
// ---------------------------------------------------------------------------
void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine) void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine)
{ {
@@ -759,16 +703,11 @@ wxApp::wxApp()
{ {
m_topWindow = NULL; m_topWindow = NULL;
wxTheApp = this; wxTheApp = this;
m_className = "";
m_wantDebugOutput = TRUE; m_wantDebugOutput = TRUE;
m_appName = "";
argc = 0; argc = 0;
argv = NULL; argv = NULL;
#ifdef __WXMSW__
m_printMode = wxPRINT_WINDOWS; m_printMode = wxPRINT_WINDOWS;
#else
m_printMode = wxPRINT_POSTSCRIPT;
#endif
m_exitOnFrameDelete = TRUE; m_exitOnFrameDelete = TRUE;
m_auto3D = TRUE; m_auto3D = TRUE;
} }
@@ -875,7 +814,6 @@ bool wxApp::DoMessage()
if ( !ProcessMessage((WXMSG *)&s_currentMsg) ) if ( !ProcessMessage((WXMSG *)&s_currentMsg) )
{ {
::TranslateMessage(&s_currentMsg); ::TranslateMessage(&s_currentMsg);
wxApp::sm_lastMessageTime = s_currentMsg.time; /* MATTHEW: timeStamp impl. */
::DispatchMessage(&s_currentMsg); ::DispatchMessage(&s_currentMsg);
} }
} }

View File

@@ -72,20 +72,25 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
if ( height == -1 && bitmap.Ok()) if ( height == -1 && bitmap.Ok())
height = bitmap.GetHeight() + 2*m_marginY; height = bitmap.GetHeight() + 2*m_marginY;
HWND wx_button = m_hWnd = (WXHWND)CreateWindowEx
CreateWindowEx(0, "BUTTON", "", BS_OWNERDRAW | WS_TABSTOP | WS_CHILD, (
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, 0,
wxGetInstance(), NULL); "BUTTON",
"",
m_hWnd = (WXHWND)wx_button; WS_VISIBLE | WS_TABSTOP | WS_CHILD | BS_OWNERDRAW ,
0, 0, 0, 0,
GetWinHwnd(parent),
(HMENU)m_windowId,
wxGetInstance(),
NULL
);
// Subclass again for purposes of dialog editing mode // Subclass again for purposes of dialog editing mode
SubclassWin((WXHWND)wx_button); SubclassWin(m_hWnd);
SetFont(parent->GetFont()) ; SetFont(parent->GetFont()) ;
SetSize(x, y, width, height); SetSize(x, y, width, height);
ShowWindow(wx_button, SW_SHOW);
return TRUE; return TRUE;
} }
@@ -101,9 +106,6 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item)
long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE); long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE);
if (style & BS_BITMAP) if (style & BS_BITMAP)
{ {
// Should we call Default() here?
// Default();
// Let default procedure draw the bitmap, which is defined // Let default procedure draw the bitmap, which is defined
// in the Windows resource. // in the Windows resource.
return FALSE; return FALSE;

View File

@@ -72,21 +72,25 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
else else
m_windowId = id; m_windowId = id;
DWORD exStyle = MakeExtendedStyle(m_windowStyle); m_hWnd = (WXHWND)CreateWindowEx
HWND wx_button = (
CreateWindowEx(exStyle, "BUTTON", label, BS_PUSHBUTTON | WS_TABSTOP | WS_CHILD, MakeExtendedStyle(m_windowStyle),
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, "BUTTON",
wxGetInstance(), NULL); label,
WS_VISIBLE | WS_TABSTOP | WS_CHILD,
m_hWnd = (WXHWND)wx_button; 0, 0, 0, 0,
GetWinHwnd(parent),
(HMENU)m_windowId,
wxGetInstance(),
NULL
);
// Subclass again for purposes of dialog editing mode // Subclass again for purposes of dialog editing mode
SubclassWin((WXHWND)wx_button); SubclassWin(m_hWnd);
SetFont(parent->GetFont()); SetFont(parent->GetFont());
SetSize(x, y, width, height); SetSize(x, y, width, height);
ShowWindow(wx_button, SW_SHOW);
return TRUE; return TRUE;
} }

View File

@@ -313,7 +313,7 @@ long wxChoice::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
// with x = 65535 and y = 65535. // with x = 65535 and y = 65535.
// Filter out this nonsense. // Filter out this nonsense.
if (x == 65535 && y == 65535) if (x == 65535 && y == 65535)
return Default(); return 0;
break; break;
} }
} }

View File

@@ -34,11 +34,6 @@
#include <commctrl.h> #include <commctrl.h>
#endif #endif
#ifdef GetCharWidth
#undef GetCharWidth
#undef GetWindowProc
#endif
#if !USE_SHARED_LIBRARY #if !USE_SHARED_LIBRARY
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow) IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
@@ -48,15 +43,17 @@ END_EVENT_TABLE()
#endif #endif
// Item members // Item members
wxControl::wxControl(void) wxControl::wxControl()
{ {
m_backgroundColour = *wxWHITE; m_backgroundColour = *wxWHITE;
m_foregroundColour = *wxBLACK; m_foregroundColour = *wxBLACK;
#if WXWIN_COMPATIBILITY
m_callback = 0; m_callback = 0;
// m_windowCursor = wxNullCursor; // To avoid the standard cursor being used #endif // WXWIN_COMPATIBILITY
} }
wxControl::~wxControl(void) wxControl::~wxControl()
{ {
m_isBeingDeleted = TRUE; m_isBeingDeleted = TRUE;
@@ -70,53 +67,19 @@ wxControl::~wxControl(void)
} }
} }
void wxControl::SetLabel(const wxString& label) bool wxControl::ProcessCommand(wxCommandEvent& event)
{ {
if (GetHWND()) #if WXWIN_COMPATIBILITY
SetWindowText((HWND) GetHWND(), (const char *)label); if ( m_callback )
{
(void)(*m_callback)(this, event);
return TRUE;
} }
else
#endif // WXWIN_COMPATIBILITY
wxString wxControl::GetLabel(void) const return GetEventHandler()->ProcessEvent(event);
{
wxBuffer[0] = 0;
if (GetHWND())
{
int len = GetWindowText((HWND)GetHWND(), wxBuffer, 256);
wxBuffer[len] = 0;
}
return wxString(wxBuffer);
}
// Call this repeatedly for several wnds to find the overall size
// of the widget.
// Call it initially with -1 for all values in rect.
// Keep calling for other widgets, and rect will be modified
// to calculate largest bounding rectangle.
void wxFindMaxSize(WXHWND wnd, RECT *rect)
{
int left = rect->left;
int right = rect->right;
int top = rect->top;
int bottom = rect->bottom;
GetWindowRect((HWND) wnd, rect);
if (left < 0)
return;
if (left < rect->left)
rect->left = left;
if (right > rect->right)
rect->right = right;
if (top < rect->top)
rect->top = top;
if (bottom > rect->bottom)
rect->bottom = bottom;
} }
#ifdef __WIN95__ #ifdef __WIN95__
@@ -168,22 +131,6 @@ bool wxControl::MSWOnNotify(int idCtrl,
} }
#endif // Win95 #endif // Win95
void wxControl::ProcessCommand (wxCommandEvent & event)
{
// Tries:
// 1) A callback function (to become obsolete)
// 2) OnCommand, starting at this window and working up parent hierarchy
// 3) OnCommand then calls ProcessEvent to search the event tables.
if (m_callback)
{
(void) (*(m_callback)) (*this, event);
}
else
{
GetEventHandler()->OnCommand(*this, event);
}
}
void wxControl::OnEraseBackground(wxEraseEvent& event) void wxControl::OnEraseBackground(wxEraseEvent& event)
{ {
// In general, you don't want to erase the background of a control, // In general, you don't want to erase the background of a control,
@@ -194,7 +141,9 @@ void wxControl::OnEraseBackground(wxEraseEvent& event)
RECT rect; RECT rect;
::GetClientRect((HWND) GetHWND(), &rect); ::GetClientRect((HWND) GetHWND(), &rect);
HBRUSH hBrush = ::CreateSolidBrush(PALETTERGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue())); HBRUSH hBrush = ::CreateSolidBrush(PALETTERGB(GetBackgroundColour().Red(),
GetBackgroundColour().Green(),
GetBackgroundColour().Blue()));
int mode = ::SetMapMode((HDC) event.GetDC()->GetHDC(), MM_TEXT); int mode = ::SetMapMode((HDC) event.GetDC()->GetHDC(), MM_TEXT);
::FillRect ((HDC) event.GetDC()->GetHDC(), &rect, hBrush); ::FillRect ((HDC) event.GetDC()->GetHDC(), &rect, hBrush);
@@ -202,36 +151,37 @@ void wxControl::OnEraseBackground(wxEraseEvent& event)
::SetMapMode((HDC) event.GetDC()->GetHDC(), mode); ::SetMapMode((HDC) event.GetDC()->GetHDC(), mode);
} }
void wxControl::SetClientSize (int width, int height) // ---------------------------------------------------------------------------
{ // global functions
SetSize (-1, -1, width, height); // ---------------------------------------------------------------------------
}
void wxControl::Centre (int direction) // Call this repeatedly for several wnds to find the overall size
// of the widget.
// Call it initially with -1 for all values in rect.
// Keep calling for other widgets, and rect will be modified
// to calculate largest bounding rectangle.
void wxFindMaxSize(WXHWND wnd, RECT *rect)
{ {
int x, y, width, height, panel_width, panel_height, new_x, new_y; int left = rect->left;
int right = rect->right;
int top = rect->top;
int bottom = rect->bottom;
wxWindow *parent = (wxWindow *) GetParent (); GetWindowRect((HWND) wnd, rect);
if (!parent)
if (left < 0)
return; return;
parent->GetClientSize (&panel_width, &panel_height); if (left < rect->left)
GetSize (&width, &height); rect->left = left;
GetPosition (&x, &y);
new_x = x; if (right > rect->right)
new_y = y; rect->right = right;
if (direction & wxHORIZONTAL) if (top < rect->top)
new_x = (int) ((panel_width - width) / 2); rect->top = top;
if (direction & wxVERTICAL) if (bottom > rect->bottom)
new_y = (int) ((panel_height - height) / 2); rect->bottom = bottom;
SetSize (new_x, new_y, width, height);
int temp_x, temp_y;
GetPosition (&temp_x, &temp_y);
GetPosition (&temp_x, &temp_y);
} }

View File

@@ -669,7 +669,6 @@ END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
EVT_CHAR(wxTextCtrl::OnChar) EVT_CHAR(wxTextCtrl::OnChar)
EVT_DROP_FILES(wxTextCtrl::OnDropFiles) EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
END_EVENT_TABLE() END_EVENT_TABLE()
#ifdef __WXMSW__ #ifdef __WXMSW__

View File

@@ -52,18 +52,6 @@
#include <print.h> #include <print.h>
#endif #endif
#ifdef DrawText
#undef DrawText
#endif
#ifdef GetCharWidth
#undef GetCharWidth
#endif
#ifdef StartDoc
#undef StartDoc
#endif
#if !USE_SHARED_LIBRARY #if !USE_SHARED_LIBRARY
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
#endif #endif
@@ -72,14 +60,63 @@
// constants // constants
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
#define VIEWPORT_EXTENT 1000 static const int VIEWPORT_EXTENT = 1000;
static const int MM_POINTS = 9;
static const int MM_METRIC = 10;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// macros // macros
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// 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 YSCALE(y) (yorigin - (y)) #define YSCALE(y) (yorigin - (y))
#define wx_round(a) (int)((a)+.5)
// =========================================================================== // ===========================================================================
// implementation // implementation
// =========================================================================== // ===========================================================================

View File

@@ -27,7 +27,7 @@
#include "wx/log.h" #include "wx/log.h"
#include "math.h" #include "math.h"
#include <windows.h> #include "wx/msw/private.h"
#if wxUSE_COMMON_DIALOGS #if wxUSE_COMMON_DIALOGS
#include <commdlg.h> #include <commdlg.h>
@@ -37,18 +37,6 @@
#include <print.h> #include <print.h>
#endif #endif
#ifdef DrawText
#undef DrawText
#endif
#ifdef GetCharWidth
#undef GetCharWidth
#endif
#ifdef StartDoc
#undef StartDoc
#endif
#if !USE_SHARED_LIBRARY #if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxPrinterDC, wxDC) IMPLEMENT_CLASS(wxPrinterDC, wxDC)
#endif #endif

View File

@@ -627,3 +627,27 @@ void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
Refresh(); Refresh();
#endif #endif
} }
// ---------------------------------------------------------------------------
// dialog window proc
// ---------------------------------------------------------------------------
long wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
long rc = 0;
bool processed = FALSE;
switch ( message )
{
case WM_CLOSE:
// if we can't close, tell the system that we processed the
// message - otherwise it would close us
processed = !Close();
break;
}
if ( !processed )
rc = wxWindow::MSWWindowProc(message, wParam, lParam);
return rc;
}

View File

@@ -37,10 +37,6 @@
#include "wx/menuitem.h" #include "wx/menuitem.h"
#include "wx/log.h" #include "wx/log.h"
#ifdef LoadAccelerators
#undef LoadAccelerators
#endif
#if wxUSE_NATIVE_STATUSBAR #if wxUSE_NATIVE_STATUSBAR
#include <wx/msw/statbr95.h> #include <wx/msw/statbr95.h>
#endif #endif
@@ -94,7 +90,6 @@ bool wxFrame::Create(wxWindow *parent,
wxTopLevelWindows.Append(this); wxTopLevelWindows.Append(this);
SetName(name); SetName(name);
// m_modalShowing = FALSE;
m_windowStyle = style; m_windowStyle = style;
m_frameMenuBar = NULL; m_frameMenuBar = NULL;
m_frameToolBar = NULL ; m_frameToolBar = NULL ;
@@ -163,16 +158,11 @@ wxFrame::~wxFrame()
::BringWindowToTop((HWND) GetParent()->GetHWND()); ::BringWindowToTop((HWND) GetParent()->GetHWND());
} }
WXHMENU wxFrame::GetWinMenu() const
{
return m_hMenu;
}
// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc. // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
void wxFrame::DoGetClientSize(int *x, int *y) const void wxFrame::DoGetClientSize(int *x, int *y) const
{ {
RECT rect; RECT rect;
::GetClientRect((HWND) GetHWND(), &rect); ::GetClientRect(GetHwnd(), &rect);
if ( GetStatusBar() ) if ( GetStatusBar() )
{ {
@@ -193,7 +183,7 @@ void wxFrame::DoGetClientSize(int *x, int *y) const
// to wxWindows) // to wxWindows)
void wxFrame::DoSetClientSize(int width, int height) void wxFrame::DoSetClientSize(int width, int height)
{ {
HWND hWnd = (HWND) GetHWND(); HWND hWnd = GetHwnd();
RECT rect; RECT rect;
::GetClientRect(hWnd, &rect); ::GetClientRect(hWnd, &rect);
@@ -232,7 +222,7 @@ void wxFrame::DoSetClientSize(int width, int height)
void wxFrame::DoGetSize(int *width, int *height) const void wxFrame::DoGetSize(int *width, int *height) const
{ {
RECT rect; RECT rect;
GetWindowRect((HWND) GetHWND(), &rect); GetWindowRect(GetHwnd(), &rect);
*width = rect.right - rect.left; *width = rect.right - rect.left;
*height = rect.bottom - rect.top; *height = rect.bottom - rect.top;
} }
@@ -240,7 +230,7 @@ void wxFrame::DoGetSize(int *width, int *height) const
void wxFrame::DoGetPosition(int *x, int *y) const void wxFrame::DoGetPosition(int *x, int *y) const
{ {
RECT rect; RECT rect;
GetWindowRect((HWND) GetHWND(), &rect); GetWindowRect(GetHwnd(), &rect);
POINT point; POINT point;
point.x = rect.left; point.x = rect.left;
point.y = rect.top; point.y = rect.top;
@@ -268,7 +258,7 @@ void wxFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags)
if (width == -1) w1 = ww ; if (width == -1) w1 = ww ;
if (height==-1) h1 = hh ; if (height==-1) h1 = hh ;
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, (BOOL)TRUE); MoveWindow(GetHwnd(), x1, y1, w1, h1, (BOOL)TRUE);
wxSizeEvent event(wxSize(width, height), m_windowId); wxSizeEvent event(wxSize(width, height), m_windowId);
event.SetEventObject( this ); event.SetEventObject( this );
@@ -295,10 +285,10 @@ bool wxFrame::Show(bool show)
} }
} }
ShowWindow((HWND) GetHWND(), (BOOL)cshow); ShowWindow(GetHwnd(), (BOOL)cshow);
if (show) if (show)
{ {
BringWindowToTop((HWND) GetHWND()); BringWindowToTop(GetHwnd());
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_windowId); wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_windowId);
event.SetEventObject( this ); event.SetEventObject( this );
@@ -317,7 +307,7 @@ void wxFrame::Iconize(bool iconize)
cshow = SW_MINIMIZE; cshow = SW_MINIMIZE;
else else
cshow = SW_RESTORE; cshow = SW_RESTORE;
ShowWindow((HWND) GetHWND(), (BOOL)cshow); ShowWindow(GetHwnd(), (BOOL)cshow);
m_iconized = iconize; m_iconized = iconize;
} }
@@ -330,31 +320,20 @@ void wxFrame::Maximize(bool maximize)
cshow = SW_MAXIMIZE; cshow = SW_MAXIMIZE;
else else
cshow = SW_RESTORE; cshow = SW_RESTORE;
ShowWindow((HWND) GetHWND(), cshow); ShowWindow(GetHwnd(), cshow);
m_iconized = FALSE; m_iconized = FALSE;
} }
bool wxFrame::IsIconized() const bool wxFrame::IsIconized() const
{ {
((wxFrame *)this)->m_iconized = (::IsIconic((HWND) GetHWND()) != 0); ((wxFrame *)this)->m_iconized = (::IsIconic(GetHwnd()) != 0);
return m_iconized; return m_iconized;
} }
// Is it maximized? // Is it maximized?
bool wxFrame::IsMaximized() const bool wxFrame::IsMaximized() const
{ {
return (::IsZoomed((HWND) GetHWND()) != 0) ; return (::IsZoomed(GetHwnd()) != 0) ;
}
void wxFrame::SetTitle(const wxString& title)
{
SetWindowText((HWND) GetHWND(), (const char *)title);
}
wxString wxFrame::GetTitle() const
{
GetWindowText((HWND) GetHWND(), wxBuffer, 1000);
return wxString(wxBuffer);
} }
void wxFrame::SetIcon(const wxIcon& icon) void wxFrame::SetIcon(const wxIcon& icon)
@@ -362,7 +341,7 @@ void wxFrame::SetIcon(const wxIcon& icon)
m_icon = icon; m_icon = icon;
#if defined(__WIN95__) #if defined(__WIN95__)
if ( m_icon.Ok() ) if ( m_icon.Ok() )
SendMessage((HWND) GetHWND(), WM_SETICON, SendMessage(GetHwnd(), WM_SETICON,
(WPARAM)TRUE, (LPARAM)(HICON) m_icon.GetHICON()); (WPARAM)TRUE, (LPARAM)(HICON) m_icon.GetHICON());
#endif #endif
} }
@@ -470,64 +449,18 @@ void wxFrame::SetMenuBar(wxMenuBar *menu_bar)
if ( !m_hMenu ) if ( !m_hMenu )
return; return;
if ( !::SetMenu((HWND)GetHWND(), (HMENU)m_hMenu) ) InternalSetMenuBar();
{
wxLogLastError("SetMenu");
}
m_frameMenuBar = menu_bar; m_frameMenuBar = menu_bar;
menu_bar->Attach(this); menu_bar->Attach(this);
} }
#if 0 void wxFrame::InternalSetMenuBar()
bool wxFrame::LoadAccelerators(const wxString& table)
{ {
m_acceleratorTable = (WXHANDLE) if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) )
#ifdef __WIN32__ {
#ifdef UNICODE wxLogLastError("SetMenu");
::LoadAcceleratorsW(wxGetInstance(), (const char *)table);
#else
::LoadAcceleratorsA(wxGetInstance(), (const char *)table);
#endif
#else
::LoadAccelerators(wxGetInstance(), (const char *)table);
#endif
// The above is necessary because LoadAccelerators is a macro
// which we have undefed earlier in the file to avoid confusion
// with wxFrame::LoadAccelerators. Ugh!
return (m_acceleratorTable != (WXHANDLE) NULL);
} }
#endif
void wxFrame::Fit()
{
// Work out max. size
wxNode *node = GetChildren().First();
int max_width = 0;
int max_height = 0;
while (node)
{
// Find a child that's a subwindow, but not a dialog box.
wxWindow *win = (wxWindow *)node->Data();
if (!win->IsKindOf(CLASSINFO(wxFrame)) &&
!win->IsKindOf(CLASSINFO(wxDialog)))
{
int width, height;
int x, y;
win->GetSize(&width, &height);
win->GetPosition(&x, &y);
if ((x + width) > max_width)
max_width = x + width;
if ((y + height) > max_height)
max_height = y + height;
}
node = node->Next();
}
SetClientSize(max_width, max_height);
} }
// Responds to colour changes, and passes event on to children. // Responds to colour changes, and passes event on to children.
@@ -618,162 +551,11 @@ bool wxFrame::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *
// Seems to be necessary if we use WS_POPUP // Seems to be necessary if we use WS_POPUP
// style instead of WS_OVERLAPPED // style instead of WS_OVERLAPPED
if (width > -1 && height > -1) if (width > -1 && height > -1)
::PostMessage((HWND) GetHWND(), WM_SIZE, SIZE_RESTORED, MAKELPARAM(width, height)); ::PostMessage(GetHwnd(), WM_SIZE, SIZE_RESTORED, MAKELPARAM(width, height));
return TRUE; return TRUE;
} }
bool wxFrame::MSWOnPaint()
{
RECT rect;
if (GetUpdateRect((HWND) GetHWND(), &rect, FALSE))
{
if (m_iconized)
{
HICON the_icon;
if (m_icon.Ok())
the_icon = (HICON) m_icon.GetHICON();
else
the_icon = (HICON) m_defaultIcon;
PAINTSTRUCT ps;
// Hold a pointer to the dc so long as the OnPaint() message
// is being processed
HDC cdc = BeginPaint((HWND) GetHWND(), &ps);
// Erase background before painting or we get white background
this->MSWDefWindowProc(WM_ICONERASEBKGND,(WORD)(LONG) ps.hdc,0L);
if (the_icon)
{
RECT rect;
::GetClientRect((HWND) GetHWND(), &rect);
int icon_width = 32;
int icon_height = 32;
int icon_x = (int)((rect.right - icon_width)/2);
int icon_y = (int)((rect.bottom - icon_height)/2);
DrawIcon(cdc, icon_x, icon_y, the_icon);
}
EndPaint((HWND) GetHWND(), &ps);
}
else
{
wxPaintEvent event(m_windowId);
event.m_eventObject = this;
if (!GetEventHandler()->ProcessEvent(event))
Default();
}
return 0;
}
return 1;
}
WXHICON wxFrame::MSWOnQueryDragIcon()
{
if (m_icon.Ok() && (m_icon.GetHICON() != 0))
return m_icon.GetHICON();
else
return m_defaultIcon;
}
bool wxFrame::MSWOnSize(int x, int y, WXUINT id)
{
bool processed = FALSE;
switch ( id )
{
case SIZENORMAL:
// only do it it if we were iconized before, otherwise resizing the
// parent frame has a curious side effect of bringing it under it's
// children
if ( !m_iconized )
break;
// restore all child frames too
IconizeChildFrames(FALSE);
// fall through
case SIZEFULLSCREEN:
m_iconized = FALSE;
break;
case SIZEICONIC:
// iconize all child frames too
IconizeChildFrames(TRUE);
m_iconized = TRUE;
break;
}
if ( !m_iconized )
{
// forward WM_SIZE to status bar control
#if wxUSE_NATIVE_STATUSBAR
if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
{
wxSizeEvent event(wxSize(x, y), m_frameStatusBar->GetId());
event.SetEventObject( m_frameStatusBar );
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
}
#endif // wxUSE_NATIVE_STATUSBAR
PositionStatusBar();
PositionToolBar();
wxSizeEvent event(wxSize(x, y), m_windowId);
event.SetEventObject( this );
processed = GetEventHandler()->ProcessEvent(event);
}
return processed;
}
bool wxFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
{
if (cmd == 0 || cmd == 1 ) // Can be either a menu command or an accelerator.
{
// In case it's e.g. a toolbar.
wxWindow *win = wxFindWinFromHandle(control);
if (win)
return win->MSWCommand(cmd, id);
if (wxCurrentPopupMenu)
{
wxMenu *popupMenu = wxCurrentPopupMenu;
wxCurrentPopupMenu = NULL;
if (popupMenu->MSWCommand(cmd, id))
return TRUE;
}
if (GetMenuBar() && GetMenuBar()->FindItemForId(id))
{
ProcessCommand(id);
return TRUE;
}
else
return FALSE;
}
else
return wxWindow::MSWOnCommand(id, cmd, control);
}
bool wxFrame::MSWProcessMessage(WXMSG* pMsg)
{
return FALSE;
}
bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
{
if (m_acceleratorTable.Ok() &&
::TranslateAccelerator((HWND) GetHWND(), (HACCEL) m_acceleratorTable.GetHACCEL(), (MSG *)pMsg))
return TRUE;
return FALSE;
}
// Default resizing behaviour - if only ONE subwindow, resize to client // Default resizing behaviour - if only ONE subwindow, resize to client
// rectangle size // rectangle size
void wxFrame::OnSize(wxSizeEvent& event) void wxFrame::OnSize(wxSizeEvent& event)
@@ -835,7 +617,7 @@ void wxFrame::OnActivate(wxActivateEvent& event)
// The default implementation for the close window event. // The default implementation for the close window event.
void wxFrame::OnCloseWindow(wxCloseEvent& event) void wxFrame::OnCloseWindow(wxCloseEvent& event)
{ {
this->Destroy(); Destroy();
} }
// Destroy the window (delayed, if a managed window) // Destroy the window (delayed, if a managed window)
@@ -871,53 +653,26 @@ wxMenuBar *wxFrame::GetMenuBar() const
return m_frameMenuBar; return m_frameMenuBar;
} }
void wxFrame::Centre(int direction) bool wxFrame::ProcessCommand(int id)
{ {
int display_width, display_height, width, height, x, y; wxMenuBar *bar = GetMenuBar() ;
wxDisplaySize(&display_width, &display_height); if ( !bar )
return FALSE;
GetSize(&width, &height); wxMenuItem *item = bar->FindItemForId(id);
GetPosition(&x, &y); if ( !item )
return FALSE;
if (direction & wxHORIZONTAL) if ( item->IsCheckable() )
x = (int)((display_width - width)/2); {
if (direction & wxVERTICAL) bar->Check(id, !bar->IsChecked(id)) ;
y = (int)((display_height - height)/2);
SetSize(x, y, width, height);
} }
// Call this to simulate a menu command
void wxFrame::Command(int id)
{
ProcessCommand(id);
}
void wxFrame::ProcessCommand(int id)
{
wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id); wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id);
commandEvent.SetInt( id ); commandEvent.SetInt( id );
commandEvent.SetEventObject( this ); commandEvent.SetEventObject( this );
wxMenuBar *bar = GetMenuBar() ; return GetEventHandler()->ProcessEvent(commandEvent);
if (!bar)
return;
wxMenuItem *item = bar->FindItemForId(id) ;
if (item && item->IsCheckable())
{
bar->Check(id,!bar->Checked(id)) ;
}
/*
// Process events starting with the window with the focus, if any.
wxWindow* focusWin = wxFindFocusDescendant(this);
wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler();
*/
wxEvtHandler* evtHandler = GetEventHandler();
evtHandler->ProcessEvent(commandEvent);
} }
// Checks if there is a toolbar, and returns the first free client position // Checks if there is a toolbar, and returns the first free client position
@@ -991,7 +746,7 @@ wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& n
void wxFrame::PositionToolBar() void wxFrame::PositionToolBar()
{ {
RECT rect; RECT rect;
::GetClientRect((HWND) GetHWND(), &rect); ::GetClientRect(GetHwnd(), &rect);
if ( GetStatusBar() ) if ( GetStatusBar() )
{ {
@@ -1037,9 +792,170 @@ void wxFrame::IconizeChildFrames(bool bIconize)
} }
// =========================================================================== // ===========================================================================
// our private (non virtual) message handlers // message processing
// =========================================================================== // ===========================================================================
// ---------------------------------------------------------------------------
// preprocessing
// ---------------------------------------------------------------------------
bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
{
if ( wxWindow::MSWTranslateMessage(pMsg) )
return TRUE;
// try the menu bar accels
wxMenuBar *menuBar = GetMenuBar();
if ( !menuBar )
return FALSE;
const wxAcceleratorTable& acceleratorTable = menuBar->GetAccelTable();
return acceleratorTable.Ok() &&
::TranslateAccelerator(GetHwnd(),
GetTableHaccel(acceleratorTable),
(MSG *)pMsg);
}
// ---------------------------------------------------------------------------
// our private (non virtual) message handlers
// ---------------------------------------------------------------------------
bool wxFrame::HandlePaint()
{
RECT rect;
if ( GetUpdateRect(GetHwnd(), &rect, FALSE) )
{
if ( m_iconized )
{
HICON hIcon = m_icon.Ok() ? GetIconHicon(m_icon)
: (HICON)m_defaultIcon;
// Hold a pointer to the dc so long as the OnPaint() message
// is being processed
PAINTSTRUCT ps;
HDC hdc = ::BeginPaint(GetHwnd(), &ps);
// Erase background before painting or we get white background
MSWDefWindowProc(WM_ICONERASEBKGND, (WORD)(LONG)ps.hdc, 0L);
if ( hIcon )
{
RECT rect;
::GetClientRect(GetHwnd(), &rect);
// FIXME: why hardcoded?
static const int icon_width = 32;
static const int icon_height = 32;
int icon_x = (int)((rect.right - icon_width)/2);
int icon_y = (int)((rect.bottom - icon_height)/2);
::DrawIcon(hdc, icon_x, icon_y, hIcon);
}
::EndPaint(GetHwnd(), &ps);
return TRUE;
}
else
{
wxPaintEvent event(m_windowId);
event.m_eventObject = this;
return GetEventHandler()->ProcessEvent(event);
}
}
else
{
// nothing to paint - processed
return TRUE;
}
}
bool wxFrame::HandleSize(int x, int y, WXUINT id)
{
bool processed = FALSE;
switch ( id )
{
case SIZENORMAL:
// only do it it if we were iconized before, otherwise resizing the
// parent frame has a curious side effect of bringing it under it's
// children
if ( !m_iconized )
break;
// restore all child frames too
IconizeChildFrames(FALSE);
// fall through
case SIZEFULLSCREEN:
m_iconized = FALSE;
break;
case SIZEICONIC:
// iconize all child frames too
IconizeChildFrames(TRUE);
m_iconized = TRUE;
break;
}
if ( !m_iconized )
{
// forward WM_SIZE to status bar control
#if wxUSE_NATIVE_STATUSBAR
if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
{
wxSizeEvent event(wxSize(x, y), m_frameStatusBar->GetId());
event.SetEventObject( m_frameStatusBar );
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
}
#endif // wxUSE_NATIVE_STATUSBAR
PositionStatusBar();
PositionToolBar();
wxSizeEvent event(wxSize(x, y), m_windowId);
event.SetEventObject( this );
processed = GetEventHandler()->ProcessEvent(event);
}
return processed;
}
bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
{
if ( control )
{
// In case it's e.g. a toolbar.
wxWindow *win = wxFindWinFromHandle(control);
if ( win )
return win->MSWCommand(cmd, id);
}
// handle here commands from menus and accelerators
if ( cmd == 0 || cmd == 1 )
{
if ( wxCurrentPopupMenu )
{
wxMenu *popupMenu = wxCurrentPopupMenu;
wxCurrentPopupMenu = NULL;
return popupMenu->MSWCommand(cmd, id);
}
if ( ProcessCommand(id) )
{
return TRUE;
}
}
return FALSE;
}
bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu) bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu)
{ {
int item; int item;
@@ -1074,19 +990,49 @@ long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
switch ( message ) switch ( message )
{ {
case WM_CLOSE:
// if we can't close, tell the system that we processed the
// message - otherwise it would close us
processed = !Close();
break;
case WM_COMMAND:
{
WORD id, cmd;
WXHWND hwnd;
UnpackCommand((WXWPARAM)wParam, (WXLPARAM)lParam,
&id, &hwnd, &cmd);
processed = HandleCommand(id, cmd, (WXHWND)hwnd);
}
break;
case WM_MENUSELECT: case WM_MENUSELECT:
{ {
WORD item = (WORD)wParam; WXWORD item, flags;
#ifdef __WIN32__ WXHMENU hmenu;
WORD flags = HIWORD(wParam); UnpackMenuSelect(wParam, lParam, &item, &flags, &hmenu);
HMENU sysmenu = (HMENU)lParam;
#else processed = HandleMenuSelect(item, flags, hmenu);
WORD flags = LOWORD(lParam);
HMENU sysmenu = (HMENU)HIWORD(lParam);
#endif
processed = HandleMenuSelect(item, flags, (WXHMENU)sysmenu);
} }
break; break;
case WM_PAINT:
processed = HandlePaint();
break;
case WM_QUERYDRAGICON:
{
HICON hIcon = m_icon.Ok() ? GetIconHicon(m_icon)
: (HICON)(m_defaultIcon);
rc = (long)hIcon;
processed = rc != 0;
}
break;
case WM_SIZE:
processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam);
break;
} }
if ( !processed ) if ( !processed )

View File

@@ -39,10 +39,6 @@
#endif #endif
#endif #endif
#ifdef GetCharWidth
#undef GetCharWidth
#endif
#if wxUSE_OWNER_DRAWN #if wxUSE_OWNER_DRAWN
#include "wx/ownerdrw.h" #include "wx/ownerdrw.h"
#endif #endif
@@ -165,7 +161,8 @@ bool wxListBox::Create(wxWindow *parent,
int height = size.y; int height = size.y;
m_windowStyle = style; m_windowStyle = style;
DWORD wstyle = WS_VSCROLL | WS_TABSTOP | LBS_NOTIFY | LBS_HASSTRINGS; DWORD wstyle = WS_VISIBLE | WS_VSCROLL | WS_TABSTOP |
LBS_NOTIFY | LBS_HASSTRINGS;
if (m_windowStyle & wxLB_MULTIPLE) if (m_windowStyle & wxLB_MULTIPLE)
wstyle |= LBS_MULTIPLESEL; wstyle |= LBS_MULTIPLESEL;
else if (m_windowStyle & wxLB_EXTENDED) else if (m_windowStyle & wxLB_EXTENDED)

File diff suppressed because it is too large Load Diff

View File

@@ -145,6 +145,67 @@ void wxMenu::Append(wxMenuItem *pItem)
{ {
wxCHECK_RET( pItem != NULL, "can't append NULL item to the menu" ); wxCHECK_RET( pItem != NULL, "can't append NULL item to the menu" );
// check for accelerators: they are given after '\t'
wxString label = pItem->GetName();
int posTab = label.Find('\t');
if ( posTab != wxNOT_FOUND ) {
// parse the accelerator string
int keyCode = 0;
int accelFlags = wxACCEL_NORMAL;
wxString current;
for ( size_t n = (size_t)posTab + 1; n < label.Len(); n++ ) {
if ( (label[n] == '+') || (label[n] == '-') ) {
if ( current == _("ctrl") )
accelFlags |= wxACCEL_CTRL;
else if ( current == _("alt") )
accelFlags |= wxACCEL_ALT;
else if ( current == _("shift") )
accelFlags |= wxACCEL_SHIFT;
else {
wxLogDebug(_T("Unknown accel modifier: '%s'"),
current.c_str());
}
current.Empty();
}
else {
current += wxTolower(label[n]);
}
}
if ( current.IsEmpty() ) {
wxLogDebug(_T("No accel key found, accel string ignored."));
}
else {
if ( current.Len() == 1 ) {
// it's a letter
keyCode = wxToupper(current[0]);
}
else {
// it should be a function key
if ( current[0] == 'f' && isdigit(current[1]) &&
(current.Len() == 2 ||
(current.Len() == 3 && isdigit(current[2]))) ) {
int n;
sscanf(current.c_str() + 1, "%d", &n);
keyCode = VK_F1 + n - 1;
}
else {
wxLogDebug(_T("Unreckognized accel key '%s', accel "
"string ignored."), current.c_str());
}
}
}
if ( keyCode ) {
// do add an entry
m_accelKeyCodes.Add(keyCode);
m_accelFlags.Add(accelFlags);
m_accelIds.Add(pItem->GetId());
}
}
UINT flags = 0; UINT flags = 0;
// if "Break" has just been called, insert a menu break before this item // if "Break" has just been called, insert a menu break before this item
@@ -190,13 +251,7 @@ void wxMenu::Append(wxMenuItem *pItem)
{ {
// menu is just a normal string (passed in data parameter) // menu is just a normal string (passed in data parameter)
flags |= MF_STRING; flags |= MF_STRING;
pData = pItem->GetName(); pData = label;
}
// visually select the menu title
if ( id == idMenuTitle )
{
// TODO use SetMenuItemInfo(MFS_DEFAULT) to put it in bold face
} }
if ( !::AppendMenu(GetHMENU(), flags, id, pData) ) if ( !::AppendMenu(GetHMENU(), flags, id, pData) )
@@ -205,6 +260,22 @@ void wxMenu::Append(wxMenuItem *pItem)
} }
else else
{ {
#ifdef __WIN32__
if ( id == idMenuTitle )
{
// visually select the menu title
MENUITEMINFO mii;
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_STATE;
mii.fState = MFS_DEFAULT;
if ( !SetMenuItemInfo(GetHMENU(), (unsigned)id, FALSE, &mii) )
{
wxLogLastError("SetMenuItemInfo");
}
}
#endif // __WIN32__
m_menuItems.Append(pItem); m_menuItems.Append(pItem);
m_noItems++; m_noItems++;
} }
@@ -272,6 +343,23 @@ void wxMenu::Delete(int id)
delete item; delete item;
} }
// ---------------------------------------------------------------------------
// accelerator helpers
// ---------------------------------------------------------------------------
// create the wxAcceleratorEntries for our accels and put them into provided
// array - return the number of accels we have
size_t wxMenu::CopyAccels(wxAcceleratorEntry *accels) const
{
size_t count = GetAccelCount();
for ( size_t n = 0; n < count; n++ )
{
(*accels++).Set(m_accelFlags[n], m_accelKeyCodes[n], m_accelIds[n]);
}
return count;
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// wxMenu functions implemented in wxMenuItem // wxMenu functions implemented in wxMenuItem
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -395,7 +483,7 @@ void wxMenu::SetTitle(const wxString& label)
} }
} }
#ifndef __WIN16__ #ifdef __WIN32__
// put the title string in bold face // put the title string in bold face
if ( !m_title.IsEmpty() ) if ( !m_title.IsEmpty() )
{ {
@@ -438,7 +526,7 @@ bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id)
return TRUE; return TRUE;
} }
void wxMenu::ProcessCommand(wxCommandEvent & event) bool wxMenu::ProcessCommand(wxCommandEvent & event)
{ {
bool processed = FALSE; bool processed = FALSE;
@@ -462,6 +550,8 @@ void wxMenu::ProcessCommand(wxCommandEvent & event)
wxWindow *win = GetInvokingWindow(); wxWindow *win = GetInvokingWindow();
if ( !processed && win ) if ( !processed && win )
processed = win->GetEventHandler()->ProcessEvent(event); processed = win->GetEventHandler()->ProcessEvent(event);
return processed;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -917,6 +1007,34 @@ void wxMenuBar::Delete(wxMenu * menu, int i)
} }
} }
void wxMenuBar::Attach(wxFrame *frame)
{
wxASSERT_MSG( !m_menuBarFrame, _T("menubar already attached!") );
m_menuBarFrame = frame;
// create the accel table - we consider that the toolbar construction is
// finished
size_t nAccelCount = 0;
int i;
for ( i = 0; i < m_menuCount; i++ )
{
nAccelCount += m_menus[i]->GetAccelCount();
}
wxAcceleratorEntry *accelEntries = new wxAcceleratorEntry[nAccelCount];
nAccelCount = 0;
for ( i = 0; i < m_menuCount; i++ )
{
nAccelCount += m_menus[i]->CopyAccels(&accelEntries[nAccelCount]);
}
m_accelTable = wxAcceleratorTable(nAccelCount, accelEntries);
delete [] accelEntries;
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// wxMenuBar searching for menu items // wxMenuBar searching for menu items
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -40,15 +40,7 @@
#include "wx/menuitem.h" #include "wx/menuitem.h"
#include "wx/log.h" #include "wx/log.h"
#include <windows.h> #include "wx/msw/private.h"
#ifdef GetClassInfo
#undef GetClassInfo
#endif
#ifdef GetClassName
#undef GetClassName
#endif
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// convenience macro // convenience macro

View File

@@ -202,10 +202,14 @@ void wxMetafileDC::GetTextExtent(const wxString& string, long *x, long *y,
ReleaseDC(NULL, dc); ReleaseDC(NULL, dc);
*x = XDEV2LOGREL(sizeRect.cx); if ( x )
*y = YDEV2LOGREL(sizeRect.cy); *x = sizeRect.cx;
if (descent) *descent = tm.tmDescent; if ( y )
if (externalLeading) *externalLeading = tm.tmExternalLeading; *y = sizeRect.cy;
if ( descent )
*descent = tm.tmDescent;
if ( externalLeading )
*externalLeading = tm.tmExternalLeading;
} }
wxMetafile *wxMetafileDC::Close(void) wxMetafile *wxMetafileDC::Close(void)

View File

@@ -68,9 +68,10 @@
BEGIN_EVENT_TABLE(wxNotebook, wxControl) BEGIN_EVENT_TABLE(wxNotebook, wxControl)
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange) EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
EVT_SIZE(wxNotebook::OnSize) EVT_WINDOW_CREATE(wxNotebook::OnWindowCreate)
EVT_ERASE_BACKGROUND(wxNotebook::OnEraseBackground)
EVT_SET_FOCUS(wxNotebook::OnSetFocus) EVT_SET_FOCUS(wxNotebook::OnSetFocus)
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey) EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -164,7 +165,6 @@ bool wxNotebook::Create(wxWindow *parent,
} }
// Not all compilers recognise SetWindowFont // Not all compilers recognise SetWindowFont
// SetWindowFont((HWND)m_hwnd, ::GetStockObject(DEFAULT_GUI_FONT), FALSE);
::SendMessage((HWND) m_hwnd, WM_SETFONT, ::SendMessage((HWND) m_hwnd, WM_SETFONT,
(WPARAM)::GetStockObject(DEFAULT_GUI_FONT),TRUE); (WPARAM)::GetStockObject(DEFAULT_GUI_FONT),TRUE);
@@ -272,6 +272,14 @@ void wxNotebook::SetImageList(wxImageList* imageList)
TabCtrl_SetImageList(m_hwnd, (HIMAGELIST)imageList->GetHIMAGELIST()); TabCtrl_SetImageList(m_hwnd, (HIMAGELIST)imageList->GetHIMAGELIST());
} }
// Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
// style.
void wxNotebook::SetTabSize(const wxSize& sz)
{
::SendMessage(GetHwnd(), TCM_SETITEMSIZE, 0, MAKELPARAM(sz.x, sz.y));
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxNotebook operations // wxNotebook operations
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -371,9 +379,12 @@ bool wxNotebook::InsertPage(int nPage,
m_nSelection = 0; m_nSelection = 0;
// don't show pages by default (we'll need to adjust their size first) // don't show pages by default (we'll need to adjust their size first)
HWND hwnd = (HWND)pPage->GetHWND(); HWND hwnd = GetWinHwnd(pPage);
SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_VISIBLE); SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_VISIBLE);
// this updates internal flag too - otherwise it will get out of sync
pPage->Show(FALSE);
return TRUE; return TRUE;
} }
@@ -381,7 +392,7 @@ bool wxNotebook::InsertPage(int nPage,
// wxNotebook callbacks // wxNotebook callbacks
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxNotebook::OnSize(wxSizeEvent& event) void wxNotebook::OnWindowCreate(wxWindowCreateEvent& event)
{ {
// make sure the current page is shown and has focus (it's useful because all // make sure the current page is shown and has focus (it's useful because all
// pages are created invisible initially) // pages are created invisible initially)
@@ -459,11 +470,6 @@ bool wxNotebook::DoPhase(int /* nPhase */)
return TRUE; return TRUE;
} }
void wxNotebook::Command(wxCommandEvent& event)
{
wxFAIL_MSG("wxNotebook::Command not implemented");
}
bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result) bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result)
{ {
wxNotebookEvent event(wxEVT_NULL, m_windowId); wxNotebookEvent event(wxEVT_NULL, m_windowId);
@@ -538,16 +544,3 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
m_nSelection = nSel; m_nSelection = nSel;
s_bInsideChangePage = FALSE; s_bInsideChangePage = FALSE;
} }
void wxNotebook::OnEraseBackground(wxEraseEvent& event)
{
Default();
}
// Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
// style.
void wxNotebook::SetTabSize(const wxSize& sz)
{
::SendMessage((HWND) GetHWND(), TCM_SETITEMSIZE, 0, MAKELPARAM(sz.x, sz.y));
}

View File

@@ -21,17 +21,16 @@
#endif #endif
#include "wx/log.h" #include "wx/log.h"
#include "wx/msw/ole/automtn.h"
#include <windows.h>
#include <ole2ver.h>
#include <oleauto.h>
#include <math.h> #include <math.h>
#include <time.h> #include <time.h>
#ifdef GetObject #include "wx/msw/ole/automtn.h"
#undef GetObject
#endif #include "wx/msw/private.h"
#include <ole2ver.h>
#include <oleauto.h>
// wrapper around BSTR type (by Vadim Zeitlin) // wrapper around BSTR type (by Vadim Zeitlin)

View File

@@ -31,11 +31,7 @@
#include "wx/ownerdrw.h" #include "wx/ownerdrw.h"
#include "wx/menuitem.h" #include "wx/menuitem.h"
#include <windows.h> #include "wx/msw/private.h"
#ifdef DrawText
#undef DrawText
#endif
// ============================================================================ // ============================================================================
// implementation of wxOwnerDrawn class // implementation of wxOwnerDrawn class

View File

@@ -37,18 +37,15 @@
#endif #endif
#include <stdlib.h> #include <stdlib.h>
#include <windows.h>
#include "wx/msw/private.h"
#include <commdlg.h> #include <commdlg.h>
#ifndef __WIN32__ #ifndef __WIN32__
#include <print.h> #include <print.h>
#endif #endif
// Clash with Windows header files
#ifdef StartDoc
#undef StartDoc
#endif
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// wxWin macros // wxWin macros
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -44,13 +44,10 @@
#include "wx/msw/private.h" #include "wx/msw/private.h"
#include <stdlib.h> #include <stdlib.h>
#include <windows.h>
#include <commdlg.h>
// Clash with Windows header files #include "wx/msw/private.h"
#ifdef StartDoc
#undef StartDoc #include <commdlg.h>
#endif
#ifndef __WIN32__ #ifndef __WIN32__
#include <print.h> #include <print.h>

View File

@@ -52,16 +52,16 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hWnd,
UINT message, UINT message,
WPARAM wParam, WPARAM wParam,
LPARAM lParam); LPARAM lParam);
#endif
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// global vars // global vars
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// the pointer to standard radio button wnd proc // the pointer to standard radio button wnd proc
// static WNDPROC s_wndprocRadioBtn = (WNDPROC)NULL;
static WXFARPROC s_wndprocRadioBtn = (WXFARPROC)NULL; static WXFARPROC s_wndprocRadioBtn = (WXFARPROC)NULL;
#endif // __WIN32__
// =========================================================================== // ===========================================================================
// implementation // implementation
// =========================================================================== // ===========================================================================
@@ -94,9 +94,9 @@ int wxRadioBox::GetNumHor() const
} }
} }
bool wxRadioBox::MSWCommand(WXUINT param, WXWORD id) bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id)
{ {
if ( param == BN_CLICKED ) if ( cmd == BN_CLICKED )
{ {
int selectedButton = -1; int selectedButton = -1;
@@ -192,12 +192,6 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
bool want3D; bool want3D;
WXDWORD exStyle = Determine3DEffects(0, &want3D); WXDWORD exStyle = Determine3DEffects(0, &want3D);
// Even with extended styles, need to combine with WS_BORDER
// for them to look right.
/*
if ( want3D || wxStyleHasBorder(m_windowStyle) )
msStyle |= WS_BORDER;
*/
HWND hwndParent = (HWND)parent->GetHWND(); HWND hwndParent = (HWND)parent->GetHWND();
@@ -249,6 +243,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
NULL); NULL);
m_radioButtons[i] = (WXHWND)hwndBtn; m_radioButtons[i] = (WXHWND)hwndBtn;
SubclassRadioButton((WXHWND)hwndBtn); SubclassRadioButton((WXHWND)hwndBtn);
wxFont& font = GetFont(); wxFont& font = GetFont();
@@ -258,7 +253,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
(WPARAM)font.GetResourceHandle(), 0L); (WPARAM)font.GetResourceHandle(), 0L);
} }
m_subControls.Append((wxObject *)newId); m_subControls.Append((wxObject *)(WXWORD)newId);
} }
// Create a dummy radio control to end the group. // Create a dummy radio control to end the group.
@@ -281,29 +276,21 @@ wxRadioBox::~wxRadioBox()
{ {
int i; int i;
for (i = 0; i < m_noItems; i++) for (i = 0; i < m_noItems; i++)
DestroyWindow((HWND) m_radioButtons[i]); ::DestroyWindow((HWND)m_radioButtons[i]);
delete[] m_radioButtons; delete[] m_radioButtons;
} }
if (m_radioWidth) if (m_radioWidth)
delete[] m_radioWidth; delete[] m_radioWidth;
if (m_radioHeight) if (m_radioHeight)
delete[] m_radioHeight; delete[] m_radioHeight;
if (m_hWnd)
::DestroyWindow((HWND) m_hWnd);
m_hWnd = 0;
} }
wxString wxRadioBox::GetLabel(int item) const
{
GetWindowText((HWND)m_radioButtons[item], wxBuffer, 300);
return wxString(wxBuffer);
}
void wxRadioBox::SetLabel(int item, const wxString& label) void wxRadioBox::SetLabel(int item, const wxString& label)
{ {
m_radioWidth[item] = m_radioHeight[item] = -1; m_radioWidth[item] = m_radioHeight[item] = -1;
SetWindowText((HWND)m_radioButtons[item], (const char *)label); SetWindowText((HWND)m_radioButtons[item], label.c_str());
} }
void wxRadioBox::SetLabel(int item, wxBitmap *bitmap) void wxRadioBox::SetLabel(int item, wxBitmap *bitmap)
@@ -312,18 +299,18 @@ void wxRadioBox::SetLabel(int item, wxBitmap *bitmap)
m_radioWidth[item] = bitmap->GetWidth() + FB_MARGIN; m_radioWidth[item] = bitmap->GetWidth() + FB_MARGIN;
m_radioHeight[item] = bitmap->GetHeight() + FB_MARGIN; m_radioHeight[item] = bitmap->GetHeight() + FB_MARGIN;
*/ */
wxFAIL_MSG("not implemented");
} }
int wxRadioBox::FindString(const wxString& s) const int wxRadioBox::FindString(const wxString& s) const
{ {
int i; for (int i = 0; i < m_noItems; i++)
for (i = 0; i < m_noItems; i++)
{ {
GetWindowText((HWND) m_radioButtons[i], wxBuffer, 1000); if ( s == wxGetWindowText(m_radioButtons[i]) )
if (s == wxBuffer)
return i; return i;
} }
return -1;
return wxNOT_FOUND;
} }
void wxRadioBox::SetSelection(int N) void wxRadioBox::SetSelection(int N)
@@ -536,22 +523,6 @@ void wxRadioBox::GetPosition(int *x, int *y) const
*y = point.y; *y = point.y;
} }
wxString wxRadioBox::GetLabel() const
{
if (m_hWnd)
{
GetWindowText((HWND) m_hWnd, wxBuffer, 300);
return wxString(wxBuffer);
}
else return wxString("");
}
void wxRadioBox::SetLabel(const wxString& label)
{
if (m_hWnd)
SetWindowText((HWND) m_hWnd, label);
}
void wxRadioBox::SetFocus() void wxRadioBox::SetFocus()
{ {
if (m_noItems > 0) if (m_noItems > 0)
@@ -566,26 +537,24 @@ void wxRadioBox::SetFocus()
bool wxRadioBox::Show(bool show) bool wxRadioBox::Show(bool show)
{ {
m_isShown = show; if ( !wxControl::Show(show) )
int cshow; return FALSE;
if (show)
cshow = SW_SHOW; int nCmdShow = show ? SW_SHOW : SW_HIDE;
else for ( int i = 0; i < m_noItems; i++ )
cshow = SW_HIDE; {
if (m_hWnd) ::ShowWindow((HWND)m_radioButtons[i], nCmdShow);
ShowWindow((HWND) m_hWnd, cshow); }
int i;
for (i = 0; i < m_noItems; i++)
ShowWindow((HWND) m_radioButtons[i], cshow);
return TRUE; return TRUE;
} }
// Enable a specific button // Enable a specific button
void wxRadioBox::Enable(int item, bool enable) void wxRadioBox::Enable(int item, bool enable)
{ {
if (item<0) wxCHECK_RET( item >= 0 && item < m_noItems,
wxWindow::Enable(enable); _T("invalid item in wxRadioBox::Enable()") );
else if (item < m_noItems)
::EnableWindow((HWND) m_radioButtons[item], enable); ::EnableWindow((HWND) m_radioButtons[item], enable);
} }
@@ -595,8 +564,7 @@ bool wxRadioBox::Enable(bool enable)
if ( !wxControl::Enable(enable) ) if ( !wxControl::Enable(enable) )
return FALSE; return FALSE;
int i; for (int i = 0; i < m_noItems; i++)
for (i = 0; i < m_noItems; i++)
::EnableWindow((HWND) m_radioButtons[i], enable); ::EnableWindow((HWND) m_radioButtons[i], enable);
return TRUE; return TRUE;
@@ -605,17 +573,10 @@ bool wxRadioBox::Enable(bool enable)
// Show a specific button // Show a specific button
void wxRadioBox::Show(int item, bool show) void wxRadioBox::Show(int item, bool show)
{ {
if (item<0) wxCHECK_RET( item >= 0 && item < m_noItems,
wxRadioBox::Show(show); _T("invalid item in wxRadioBox::Show()") );
else if (item < m_noItems)
{ ::ShowWindow((HWND)m_radioButtons[item], show ? SW_SHOW : SW_HIDE);
int cshow;
if (show)
cshow = SW_SHOW;
else
cshow = SW_HIDE;
ShowWindow((HWND) m_radioButtons[item], cshow);
}
} }
WXHBRUSH wxRadioBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, WXHBRUSH wxRadioBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
@@ -639,9 +600,6 @@ WXHBRUSH wxRadioBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID); wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID);
// Note that this will be cleaned up in wxApp::OnIdle, if backgroundBrush
// has a zero usage count.
// backgroundBrush->RealizeResource();
return (WXHBRUSH) backgroundBrush->GetResourceHandle(); return (WXHBRUSH) backgroundBrush->GetResourceHandle();
} }
@@ -672,8 +630,11 @@ bool wxRadioBox::ContainsHWND(WXHWND hWnd) const
{ {
int i; int i;
for (i = 0; i < Number(); i++) for (i = 0; i < Number(); i++)
{
if (GetRadioButtons()[i] == hWnd) if (GetRadioButtons()[i] == hWnd)
return TRUE; return TRUE;
}
return FALSE; return FALSE;
} }
@@ -683,9 +644,14 @@ void wxRadioBox::Command (wxCommandEvent & event)
ProcessCommand (event); ProcessCommand (event);
} }
long wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) long wxRadioBox::MSWWindowProc(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
{ {
if (nMsg == WM_NCHITTEST) long rc = 0;
bool processed = FALSE;
switch ( msg )
{
case WM_NCHITTEST:
{ {
int xPos = LOWORD(lParam); // horizontal position of cursor int xPos = LOWORD(lParam); // horizontal position of cursor
int yPos = HIWORD(lParam); // vertical position of cursor int yPos = HIWORD(lParam); // vertical position of cursor
@@ -695,24 +661,32 @@ long wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
// Make sure you can drag by the top of the groupbox, but let // Make sure you can drag by the top of the groupbox, but let
// other (enclosed) controls get mouse events also // other (enclosed) controls get mouse events also
if ( yPos < 10 ) if ( yPos < 10 )
return (long)HTCLIENT; {
rc = HTCLIENT;
processed = TRUE;
}
}
break;
} }
return wxControl::MSWWindowProc(nMsg, wParam, lParam); if ( !processed )
rc = wxControl::MSWWindowProc(msg, wParam, lParam);
return rc;
} }
void wxRadioBox::SubclassRadioButton(WXHWND hWndBtn) void wxRadioBox::SubclassRadioButton(WXHWND hWndBtn)
{ {
#ifdef __WIN32__
HWND hwndBtn = (HWND)hWndBtn; HWND hwndBtn = (HWND)hWndBtn;
if ( !s_wndprocRadioBtn ) if ( !s_wndprocRadioBtn )
s_wndprocRadioBtn = (WXFARPROC)::GetWindowLong(hwndBtn, GWL_WNDPROC); s_wndprocRadioBtn = (WXFARPROC)::GetWindowLong(hwndBtn, GWL_WNDPROC);
// No GWL_USERDATA in Win16, so omit this subclassing. // No GWL_USERDATA in Win16, so omit this subclassing.
#ifdef __WIN32__
::SetWindowLong(hwndBtn, GWL_WNDPROC, (long)wxRadioBtnWndProc); ::SetWindowLong(hwndBtn, GWL_WNDPROC, (long)wxRadioBtnWndProc);
::SetWindowLong(hwndBtn, GWL_USERDATA, (long)this); ::SetWindowLong(hwndBtn, GWL_USERDATA, (long)this);
#endif #endif // __WIN32__
} }
void wxRadioBox::SendNotificationEvent() void wxRadioBox::SendNotificationEvent()
@@ -797,5 +771,6 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
else else
return 0; return 0;
} }
#endif
#endif // __WIN32__

View File

@@ -206,7 +206,9 @@ void wxStaticBox::OnEraseBackground(wxEraseEvent& event)
::SetMapMode((HDC) event.GetDC()->GetHDC(), mode); ::SetMapMode((HDC) event.GetDC()->GetHDC(), mode);
} }
else else
Default(); {
event.Skip();
}
} }
long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)

View File

@@ -33,21 +33,13 @@
#include "wx/generic/statusbr.h" #include "wx/generic/statusbr.h"
#include "wx/msw/statbr95.h" #include "wx/msw/statbr95.h"
#include <windows.h> #include "wx/msw/private.h"
#include <windowsx.h> #include <windowsx.h>
#if !defined(__GNUWIN32__) || defined(__TWIN32__) #if !defined(__GNUWIN32__) || defined(__TWIN32__)
#include <commctrl.h> #include <commctrl.h>
#endif #endif
#ifdef GetClassInfo
#undef GetClassInfo
#endif
#ifdef GetClassName
#undef GetClassName
#endif
#if wxUSE_NATIVE_STATUSBAR #if wxUSE_NATIVE_STATUSBAR
#if !USE_SHARED_LIBRARY #if !USE_SHARED_LIBRARY

View File

@@ -52,10 +52,6 @@
IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl) IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl)
BEGIN_EVENT_TABLE(wxTabCtrl, wxControl) BEGIN_EVENT_TABLE(wxTabCtrl, wxControl)
EVT_SIZE(wxTabCtrl::OnSize)
EVT_PAINT(wxTabCtrl::OnPaint)
EVT_KILL_FOCUS(wxTabCtrl::OnKillFocus)
EVT_MOUSE_EVENTS(wxTabCtrl::OnMouseEvent)
EVT_SYS_COLOUR_CHANGED(wxTabCtrl::OnSysColourChanged) EVT_SYS_COLOUR_CHANGED(wxTabCtrl::OnSysColourChanged)
END_EVENT_TABLE() END_EVENT_TABLE()
#endif #endif
@@ -139,15 +135,6 @@ wxTabCtrl::~wxTabCtrl()
UnsubclassWin(); UnsubclassWin();
} }
void wxTabCtrl::Command(wxCommandEvent& event)
{
}
bool wxTabCtrl::MSWCommand(WXUINT cmd, WXWORD id)
{
return FALSE;
}
bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
{ {
wxTabEvent event(wxEVT_NULL, m_windowId); wxTabEvent event(wxEVT_NULL, m_windowId);
@@ -185,12 +172,8 @@ bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
void wxTabCtrl::OnSysColourChanged(wxSysColourChangedEvent& event) void wxTabCtrl::OnSysColourChanged(wxSysColourChangedEvent& event)
{ {
m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)), m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE))); GetGValue(GetSysColor(COLOR_BTNFACE)),
GetBValue(GetSysColor(COLOR_BTNFACE)));
// Remap the buttons
// CreateTools();
Default();
Refresh(); Refresh();

View File

@@ -77,10 +77,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxToolBar95, wxToolBarBase)
#endif #endif
BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase) BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase)
EVT_SIZE(wxToolBar95::OnSize)
EVT_PAINT(wxToolBar95::OnPaint)
EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent) EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent)
EVT_KILL_FOCUS(wxToolBar95::OnKillFocus)
EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged) EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged)
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -527,8 +524,6 @@ void wxToolBar95::OnSysColourChanged(wxSysColourChangedEvent& event)
// Remap the buttons // Remap the buttons
CreateTools(); CreateTools();
Default();
Refresh(); Refresh();
// Propagate the event to the non-top-level children // Propagate the event to the non-top-level children
@@ -545,7 +540,7 @@ void wxToolBar95::OnMouseEvent(wxMouseEvent& event)
} }
else else
{ {
Default(); event.Skip();
} }
} }

View File

@@ -74,7 +74,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
EVT_CHAR(wxTextCtrl::OnChar) EVT_CHAR(wxTextCtrl::OnChar)
EVT_DROP_FILES(wxTextCtrl::OnDropFiles) EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
EVT_MENU(wxID_CUT, wxTextCtrl::OnCut) EVT_MENU(wxID_CUT, wxTextCtrl::OnCut)
EVT_MENU(wxID_COPY, wxTextCtrl::OnCopy) EVT_MENU(wxID_COPY, wxTextCtrl::OnCopy)
@@ -1111,8 +1110,9 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
// don't just call event.Skip() because this will cause TABs and ENTERs // don't just call event.Skip() because this will cause TABs and ENTERs
// be passed upwards and we don't always want this - instead process it // be passed upwards and we don't always want this - instead process it
// right here // right here
Default();
// event.Skip(); // FIXME
event.Skip();
} }
long wxTextCtrl::MSWGetDlgCode() long wxTextCtrl::MSWGetDlgCode()
@@ -1135,27 +1135,6 @@ long wxTextCtrl::MSWGetDlgCode()
return lRc; return lRc;
} }
void wxTextCtrl::OnEraseBackground(wxEraseEvent& event)
{
if ( m_windowStyle & wxTE_MULTILINE )
{
// No flicker - only problem is we probably can't change the background
Default();
/*
RECT rect;
::GetClientRect((HWND) GetHWND(), &rect);
HBRUSH hBrush = ::CreateSolidBrush(PALETTERGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
int mode = ::SetMapMode((HDC) event.GetDC()->GetHDC(), MM_TEXT);
::FillRect ((HDC) event.GetDC()->GetHDC(), &rect, hBrush);
::DeleteObject(hBrush);
::SetMapMode((HDC) event.GetDC()->GetHDC(), mode);
*/
}
// wxWindow::OnEraseBackground(event);
}
bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
{ {
/* /*

View File

@@ -48,22 +48,6 @@
#include <commctrl.h> #include <commctrl.h>
#endif #endif
#ifdef GetFirstChild
#undef GetFirstChild
#endif
#ifdef GetNextChild
#undef GetNextChild
#endif
#ifdef GetNextSibling
#undef GetNextSibling
#endif
#ifdef GetClassInfo
#undef GetClassInfo
#endif
// Bug in headers, sometimes // Bug in headers, sometimes
#ifndef TVIS_FOCUSED #ifndef TVIS_FOCUSED
#define TVIS_FOCUSED 0x0001 #define TVIS_FOCUSED 0x0001

View File

@@ -853,12 +853,12 @@ wxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd)
return str; return str;
} }
wxWindowID WXDLLEXPORT wxGetWindowId(WXHWND hWnd) WXWORD WXDLLEXPORT wxGetWindowId(WXHWND hWnd)
{ {
#ifndef __WIN32__ #ifndef __WIN32__
return (wxWindowID)GetWindowWord((HWND)hWnd, GWW_ID); return GetWindowWord((HWND)hWnd, GWW_ID);
#else // Win32 #else // Win32
return (wxWindowID)GetWindowLong((HWND)hWnd, GWL_ID); return GetWindowLong((HWND)hWnd, GWL_ID);
#endif // Win16/32 #endif // Win16/32
} }

File diff suppressed because it is too large Load Diff