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>
\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}}}
\membersection{wxSplitterWindow::wxSplitterWindow}\label{wxsplitterwindowconstr}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -57,7 +57,7 @@
// static data
// ----------------------------------------------------------------------------
int wxWindowBase::ms_lastControlId = -2;
int wxWindowBase::ms_lastControlId = -200;
IMPLEMENT_ABSTRACT_CLASS(wxWindowBase, wxEvtHandler)
@ -309,6 +309,14 @@ void wxWindowBase::Fit()
while ( node )
{
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;
win->GetPosition(&wx, &wy);
win->GetSize(&ww, &wh);

View File

@ -24,7 +24,6 @@
#include "wx/wx.h"
#endif
#include <math.h>
#include <stdlib.h>
#include "wx/string.h"
@ -33,11 +32,16 @@
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow)
IMPLEMENT_DYNAMIC_CLASS(wxSplitterEvent, wxCommandEvent)
BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow)
EVT_PAINT(wxSplitterWindow::OnPaint)
EVT_SIZE(wxSplitterWindow::OnSize)
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()
#endif
@ -195,8 +199,18 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
int new_sash_position =
(int) ( m_splitMode == wxSPLIT_VERTICAL ? x : y );
if ( !OnSashPositionChange(new_sash_position) )
return;
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;
}
}
if ( new_sash_position == 0 )
{
@ -204,7 +218,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
wxWindow *removedWindow = m_windowOne;
m_windowOne = m_windowTwo;
m_windowTwo = (wxWindow *) NULL;
OnUnsplit(removedWindow);
SendUnsplitEvent(removedWindow);
m_sashPosition = 0;
}
else if ( new_sash_position == window_size )
@ -212,13 +226,14 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
// We remove the second window from the view
wxWindow *removedWindow = m_windowTwo;
m_windowTwo = (wxWindow *) NULL;
OnUnsplit(removedWindow);
SendUnsplitEvent(removedWindow);
m_sashPosition = 0;
}
else
{
m_sashPosition = new_sash_position;
}
SizeWindows();
} // left up && dragging
else if (event.Moving() && !event.Dragging())
@ -237,11 +252,11 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
}
#ifdef __WXGTK__
else
{
// where else do we unset the cursor?
{
// where else do we unset the cursor?
SetCursor(* wxSTANDARD_CURSOR);
}
#endif
}
#endif // __WXGTK__
}
else if (event.Dragging() && (m_dragMode == wxSPLIT_DRAG_DRAGGING))
{
@ -256,7 +271,12 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
}
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;
}
OnUnsplit(win);
SendUnsplitEvent(win);
m_sashPosition = 0;
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
void wxSplitterWindow::InitColours()
{
@ -744,3 +714,84 @@ void wxSplitterWindow::InitColours()
#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"
#ifdef LoadAccelerators
#undef LoadAccelerators
#endif
#if !USE_SHARED_LIBRARIES
IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)
#endif

View File

@ -100,7 +100,7 @@ extern void wxSetKeyboardHook(bool doIt);
extern wxCursor *g_globalCursor;
HINSTANCE wxhInstance = 0;
static MSG s_currentMsg;
MSG s_currentMsg;
wxApp *wxTheApp = NULL;
// FIXME why not const? and not static?
@ -150,8 +150,6 @@ LRESULT APIENTRY wxWndProc(HWND, UINT, WPARAM, LPARAM);
END_EVENT_TABLE()
#endif
long wxApp::sm_lastMessageTime = 0;
//// Initialize
bool wxApp::Initialize()
{
@ -169,7 +167,8 @@ bool wxApp::Initialize()
wxGetResource("wxWindows", "OsVersion", &wxOsVersion);
#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
wxPendingEvents = new wxList();
wxPendingEventsLocker = new wxCriticalSection();
@ -205,18 +204,6 @@ bool wxApp::Initialize()
int iMsg = 96;
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
// we need to initialize OLE library
if ( FAILED(::OleInitialize(NULL)) )
@ -244,11 +231,11 @@ bool wxApp::Initialize()
// Create the brush for disabling bitmap buttons
LOGBRUSH lb ;
LOGBRUSH lb;
lb.lbStyle = BS_PATTERN;
lb.lbHatch = (int)LoadBitmap( wxhInstance, "wxDISABLE_BUTTON_BITMAP" ) ;
wxDisableButtonBrush = ::CreateBrushIndirect( & lb ) ;
::DeleteObject( (HGDIOBJ)lb.lbHatch ) ;
lb.lbHatch = (int)LoadBitmap( wxhInstance, "wxDISABLE_BUTTON_BITMAP" );
wxDisableButtonBrush = ::CreateBrushIndirect( & lb );
::DeleteObject( (HGDIOBJ)lb.lbHatch );
#if wxUSE_PENWINDOWS
wxRegisterPenWin();
@ -271,131 +258,88 @@ bool wxApp::Initialize()
return TRUE;
}
//// RegisterWindowClasses
// ---------------------------------------------------------------------------
// RegisterWindowClasses
// ---------------------------------------------------------------------------
bool wxApp::RegisterWindowClasses()
{
///////////////////////////////////////////////////////////////////////
// Register the frame window class.
WNDCLASS wndclass; // Structure used to register Windows class.
WNDCLASS wndclass;
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS ;
// the fields which are common to all classes
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
wndclass.lpfnWndProc = (WNDPROC)wxWndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = sizeof( DWORD ); // was 4
wndclass.cbWndExtra = sizeof( DWORD ); // what is this DWORD used for?
wndclass.hInstance = wxhInstance;
wndclass.hIcon = (HICON) NULL; // wxSTD_FRAME_ICON;
wndclass.hCursor = LoadCursor( (HINSTANCE) NULL, IDC_ARROW );
wndclass.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE+1) ;
// wndclass.hbrBackground = GetStockObject( WHITE_BRUSH );
wndclass.hIcon = (HICON) NULL;
wndclass.hCursor = ::LoadCursor((HINSTANCE)NULL, IDC_ARROW);
wndclass.lpszMenuName = NULL;
// Register the frame window class.
wndclass.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1);
#ifdef _MULTIPLE_INSTANCES
sprintf( wxFrameClassName,"wxFrameClass%d", wxhInstance );
#endif
wndclass.lpszClassName = wxFrameClassName;
if (!RegisterClass( &wndclass ))
if ( !RegisterClass(&wndclass) )
{
// wxFatalError("Can't register Frame Window class");
wxLogLastError("RegisterClass(frame)");
return FALSE;
}
///////////////////////////////////////////////////////////////////////
// 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 ;
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 ))
if ( !RegisterClass(&wndclass) )
{
// wxFatalError("Can't register MDI Frame window class");
// return FALSE;
wxLogLastError("RegisterClass(MDI parent)");
return FALSE;
}
///////////////////////////////////////////////////////////////////////
// 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 ;
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 ))
if ( !RegisterClass(&wndclass) )
{
// wxFatalError("Can't register MDI child frame window class");
// return FALSE;
wxLogLastError("RegisterClass(MDI child)");
return FALSE;
}
///////////////////////////////////////////////////////////////////////
// Register the panel window class.
WNDCLASS wndclass2; // Structure used to register Windows class.
memset(&wndclass2, 0, sizeof(WNDCLASS)); // start with NULL defaults
wndclass2.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS ;
wndclass2.lpfnWndProc = (WNDPROC)wxWndProc;
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 ))
wndclass.hbrBackground = (HBRUSH) GetStockObject( LTGRAY_BRUSH );
wndclass.lpszClassName = wxPanelClassName;
if ( !RegisterClass(&wndclass) )
{
// wxFatalError("Can't register Panel Window class");
// return FALSE;
wxLogLastError("RegisterClass(panel)");
return FALSE;
}
///////////////////////////////////////////////////////////////////////
// Register the canvas and textsubwindow class name
WNDCLASS wndclass3; // Structure used to register Windows class.
memset(&wndclass3, 0, sizeof(WNDCLASS)); // start with NULL defaults
// Use CS_OWNDC to avoid messing about restoring the context
// for every graphic operation.
// 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))
wndclass.hbrBackground = (HBRUSH)NULL;
wndclass.lpszClassName = wxCanvasClassName;
if ( !RegisterClass(&wndclass) )
{
// wxFatalError("Can't register Canvas class");
// return FALSE;
wxLogLastError("RegisterClass(canvas)");
return FALSE;
}
return TRUE;
}
//// Convert Windows to argc, argv style
// ---------------------------------------------------------------------------
// Convert Windows to argc, argv style
// ---------------------------------------------------------------------------
void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine)
{
@ -499,7 +443,7 @@ void wxApp::CleanUp()
delete g_globalCursor;
g_globalCursor = NULL;
wxDeleteStockObjects() ;
wxDeleteStockObjects();
// Destroy all GDI lists, etc.
wxDeleteStockLists();
@ -544,7 +488,7 @@ void wxApp::CleanUp()
DestroyIcon(wxDEFAULT_MDIPARENTFRAME_ICON);
if ( wxDisableButtonBrush )
::DeleteObject( wxDisableButtonBrush ) ;
::DeleteObject( wxDisableButtonBrush );
#if wxUSE_OLE
::OleUninitialize();
@ -555,7 +499,7 @@ void wxApp::CleanUp()
#endif
if (wxWinHandleList)
delete wxWinHandleList ;
delete wxWinHandleList;
// GL: 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.
@ -646,7 +590,7 @@ int wxEntry(WXHINSTANCE hInstance,
// GUI-specific initialisation. In fact on Windows we don't have any,
// but this call is provided for compatibility across platforms.
wxTheApp->OnInitGui() ;
wxTheApp->OnInitGui();
int retValue = 0;
@ -759,16 +703,11 @@ wxApp::wxApp()
{
m_topWindow = NULL;
wxTheApp = this;
m_className = "";
m_wantDebugOutput = TRUE ;
m_appName = "";
m_wantDebugOutput = TRUE;
argc = 0;
argv = NULL;
#ifdef __WXMSW__
m_printMode = wxPRINT_WINDOWS;
#else
m_printMode = wxPRINT_POSTSCRIPT;
#endif
m_exitOnFrameDelete = TRUE;
m_auto3D = TRUE;
}
@ -875,7 +814,6 @@ bool wxApp::DoMessage()
if ( !ProcessMessage((WXMSG *)&s_currentMsg) )
{
::TranslateMessage(&s_currentMsg);
wxApp::sm_lastMessageTime = s_currentMsg.time; /* MATTHEW: timeStamp impl. */
::DispatchMessage(&s_currentMsg);
}
}
@ -955,7 +893,7 @@ void wxApp::ExitMainLoop()
bool wxApp::Pending()
{
return (::PeekMessage(&s_currentMsg, 0, 0, 0, PM_NOREMOVE) != 0) ;
return (::PeekMessage(&s_currentMsg, 0, 0, 0, PM_NOREMOVE) != 0);
}
void wxApp::Dispatch()
@ -1064,7 +1002,7 @@ bool wxApp::SendIdleEvents(wxWindow* win)
node = node->Next();
}
return needMore ;
return needMore;
}
void wxApp::DeletePendingObjects()

View File

@ -72,20 +72,25 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
if ( height == -1 && bitmap.Ok())
height = bitmap.GetHeight() + 2*m_marginY;
HWND wx_button =
CreateWindowEx(0, "BUTTON", "", BS_OWNERDRAW | WS_TABSTOP | WS_CHILD,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
wxGetInstance(), NULL);
m_hWnd = (WXHWND)wx_button;
m_hWnd = (WXHWND)CreateWindowEx
(
0,
"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
SubclassWin((WXHWND)wx_button);
SubclassWin(m_hWnd);
SetFont(parent->GetFont()) ;
SetSize(x, y, width, height);
ShowWindow(wx_button, SW_SHOW);
return TRUE;
}
@ -101,9 +106,6 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item)
long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE);
if (style & BS_BITMAP)
{
// Should we call Default() here?
// Default();
// Let default procedure draw the bitmap, which is defined
// in the Windows resource.
return FALSE;
@ -114,33 +116,33 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item)
wxBitmap* bitmap = &m_buttonBitmap;
UINT state = lpDIS->itemState;
if ((state & ODS_SELECTED) && m_buttonBitmapSelected.Ok())
bitmap = &m_buttonBitmapSelected;
else if ((state & ODS_FOCUS) && m_buttonBitmapFocus.Ok())
bitmap = &m_buttonBitmapFocus;
else if ((state & ODS_DISABLED) && m_buttonBitmapDisabled.Ok())
bitmap = &m_buttonBitmapDisabled;
UINT state = lpDIS->itemState;
if ((state & ODS_SELECTED) && m_buttonBitmapSelected.Ok())
bitmap = &m_buttonBitmapSelected;
else if ((state & ODS_FOCUS) && m_buttonBitmapFocus.Ok())
bitmap = &m_buttonBitmapFocus;
else if ((state & ODS_DISABLED) && m_buttonBitmapDisabled.Ok())
bitmap = &m_buttonBitmapDisabled;
if ( !bitmap->Ok() )
return FALSE;
if ( !bitmap->Ok() )
return FALSE;
HDC hDC = lpDIS->hDC;
HDC memDC = ::CreateCompatibleDC(hDC);
HDC hDC = lpDIS->hDC;
HDC memDC = ::CreateCompatibleDC(hDC);
HBITMAP old = (HBITMAP) ::SelectObject(memDC, (HBITMAP) bitmap->GetHBITMAP());
HBITMAP old = (HBITMAP) ::SelectObject(memDC, (HBITMAP) bitmap->GetHBITMAP());
if (!old)
return FALSE;
if (!old)
return FALSE;
int x = lpDIS->rcItem.left;
int y = lpDIS->rcItem.top;
int width = lpDIS->rcItem.right - x;
int height = lpDIS->rcItem.bottom - y;
int x = lpDIS->rcItem.left;
int y = lpDIS->rcItem.top;
int width = lpDIS->rcItem.right - x;
int height = lpDIS->rcItem.bottom - y;
// Draw the face, if auto-drawing
if ( GetWindowStyleFlag() & wxBU_AUTODRAW )
DrawFace((WXHDC) hDC, lpDIS->rcItem.left, lpDIS->rcItem.top, lpDIS->rcItem.right, lpDIS->rcItem.bottom,
// Draw the face, if auto-drawing
if ( GetWindowStyleFlag() & wxBU_AUTODRAW )
DrawFace((WXHDC) hDC, lpDIS->rcItem.left, lpDIS->rcItem.top, lpDIS->rcItem.right, lpDIS->rcItem.bottom,
((state & ODS_SELECTED) == ODS_SELECTED));
// Centre the bitmap in the control area

View File

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

View File

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

View File

@ -34,11 +34,6 @@
#include <commctrl.h>
#endif
#ifdef GetCharWidth
#undef GetCharWidth
#undef GetWindowProc
#endif
#if !USE_SHARED_LIBRARY
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
@ -48,75 +43,43 @@ END_EVENT_TABLE()
#endif
// Item members
wxControl::wxControl(void)
wxControl::wxControl()
{
m_backgroundColour = *wxWHITE;
m_foregroundColour = *wxBLACK;
#if WXWIN_COMPATIBILITY
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;
// If we delete an item, we should initialize the parent panel,
// because it could now be invalid.
wxWindow *parent = (wxWindow *)GetParent();
if (parent)
{
if (parent->GetDefaultItem() == (wxButton*) this)
parent->SetDefaultItem(NULL);
}
}
void wxControl::SetLabel(const wxString& label)
{
if (GetHWND())
SetWindowText((HWND) GetHWND(), (const char *)label);
}
wxString wxControl::GetLabel(void) const
{
wxBuffer[0] = 0;
if (GetHWND())
// If we delete an item, we should initialize the parent panel,
// because it could now be invalid.
wxWindow *parent = (wxWindow *)GetParent();
if (parent)
{
int len = GetWindowText((HWND)GetHWND(), wxBuffer, 256);
wxBuffer[len] = 0;
if (parent->GetDefaultItem() == (wxButton*) this)
parent->SetDefaultItem(NULL);
}
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)
bool wxControl::ProcessCommand(wxCommandEvent& event)
{
int left = rect->left;
int right = rect->right;
int top = rect->top;
int bottom = rect->bottom;
#if WXWIN_COMPATIBILITY
if ( m_callback )
{
(void)(*m_callback)(this, event);
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;
return TRUE;
}
else
#endif // WXWIN_COMPATIBILITY
return GetEventHandler()->ProcessEvent(event);
}
#ifdef __WIN95__
@ -168,70 +131,57 @@ bool wxControl::MSWOnNotify(int idCtrl,
}
#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)
{
// In general, you don't want to erase the background of a control,
// or you'll get a flicker.
// TODO: move this 'null' function into each control that
// might flicker.
// In general, you don't want to erase the background of a control,
// or you'll get a flicker.
// TODO: move this 'null' function into each control that
// might flicker.
RECT rect;
::GetClientRect((HWND) GetHWND(), &rect);
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);
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);
::FillRect ((HDC) event.GetDC()->GetHDC(), &rect, hBrush);
::DeleteObject(hBrush);
::SetMapMode((HDC) event.GetDC()->GetHDC(), mode);
}
void wxControl::SetClientSize (int width, int height)
// ---------------------------------------------------------------------------
// global functions
// ---------------------------------------------------------------------------
// 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)
{
SetSize (-1, -1, width, height);
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;
}
void wxControl::Centre (int direction)
{
int x, y, width, height, panel_width, panel_height, new_x, new_y;
wxWindow *parent = (wxWindow *) GetParent ();
if (!parent)
return;
parent->GetClientSize (&panel_width, &panel_height);
GetSize (&width, &height);
GetPosition (&x, &y);
new_x = x;
new_y = y;
if (direction & wxHORIZONTAL)
new_x = (int) ((panel_width - width) / 2);
if (direction & wxVERTICAL)
new_y = (int) ((panel_height - height) / 2);
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)
EVT_CHAR(wxTextCtrl::OnChar)
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
END_EVENT_TABLE()
#ifdef __WXMSW__

View File

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

View File

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

View File

@ -627,3 +627,27 @@ void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
Refresh();
#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/log.h"
#ifdef LoadAccelerators
#undef LoadAccelerators
#endif
#if wxUSE_NATIVE_STATUSBAR
#include <wx/msw/statbr95.h>
#endif
@ -94,7 +90,6 @@ bool wxFrame::Create(wxWindow *parent,
wxTopLevelWindows.Append(this);
SetName(name);
// m_modalShowing = FALSE;
m_windowStyle = style;
m_frameMenuBar = NULL;
m_frameToolBar = NULL ;
@ -163,16 +158,11 @@ wxFrame::~wxFrame()
::BringWindowToTop((HWND) GetParent()->GetHWND());
}
WXHMENU wxFrame::GetWinMenu() const
{
return m_hMenu;
}
// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
void wxFrame::DoGetClientSize(int *x, int *y) const
{
RECT rect;
::GetClientRect((HWND) GetHWND(), &rect);
::GetClientRect(GetHwnd(), &rect);
if ( GetStatusBar() )
{
@ -193,7 +183,7 @@ void wxFrame::DoGetClientSize(int *x, int *y) const
// to wxWindows)
void wxFrame::DoSetClientSize(int width, int height)
{
HWND hWnd = (HWND) GetHWND();
HWND hWnd = GetHwnd();
RECT rect;
::GetClientRect(hWnd, &rect);
@ -232,7 +222,7 @@ void wxFrame::DoSetClientSize(int width, int height)
void wxFrame::DoGetSize(int *width, int *height) const
{
RECT rect;
GetWindowRect((HWND) GetHWND(), &rect);
GetWindowRect(GetHwnd(), &rect);
*width = rect.right - rect.left;
*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
{
RECT rect;
GetWindowRect((HWND) GetHWND(), &rect);
GetWindowRect(GetHwnd(), &rect);
POINT point;
point.x = rect.left;
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 (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);
event.SetEventObject( this );
@ -295,10 +285,10 @@ bool wxFrame::Show(bool show)
}
}
ShowWindow((HWND) GetHWND(), (BOOL)cshow);
ShowWindow(GetHwnd(), (BOOL)cshow);
if (show)
{
BringWindowToTop((HWND) GetHWND());
BringWindowToTop(GetHwnd());
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_windowId);
event.SetEventObject( this );
@ -317,7 +307,7 @@ void wxFrame::Iconize(bool iconize)
cshow = SW_MINIMIZE;
else
cshow = SW_RESTORE;
ShowWindow((HWND) GetHWND(), (BOOL)cshow);
ShowWindow(GetHwnd(), (BOOL)cshow);
m_iconized = iconize;
}
@ -330,31 +320,20 @@ void wxFrame::Maximize(bool maximize)
cshow = SW_MAXIMIZE;
else
cshow = SW_RESTORE;
ShowWindow((HWND) GetHWND(), cshow);
ShowWindow(GetHwnd(), cshow);
m_iconized = FALSE;
}
bool wxFrame::IsIconized() const
{
((wxFrame *)this)->m_iconized = (::IsIconic((HWND) GetHWND()) != 0);
((wxFrame *)this)->m_iconized = (::IsIconic(GetHwnd()) != 0);
return m_iconized;
}
// Is it maximized?
bool wxFrame::IsMaximized() const
{
return (::IsZoomed((HWND) 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);
return (::IsZoomed(GetHwnd()) != 0) ;
}
void wxFrame::SetIcon(const wxIcon& icon)
@ -362,7 +341,7 @@ void wxFrame::SetIcon(const wxIcon& icon)
m_icon = icon;
#if defined(__WIN95__)
if ( m_icon.Ok() )
SendMessage((HWND) GetHWND(), WM_SETICON,
SendMessage(GetHwnd(), WM_SETICON,
(WPARAM)TRUE, (LPARAM)(HICON) m_icon.GetHICON());
#endif
}
@ -470,64 +449,18 @@ void wxFrame::SetMenuBar(wxMenuBar *menu_bar)
if ( !m_hMenu )
return;
if ( !::SetMenu((HWND)GetHWND(), (HMENU)m_hMenu) )
{
wxLogLastError("SetMenu");
}
InternalSetMenuBar();
m_frameMenuBar = menu_bar;
menu_bar->Attach(this);
}
#if 0
bool wxFrame::LoadAccelerators(const wxString& table)
void wxFrame::InternalSetMenuBar()
{
m_acceleratorTable = (WXHANDLE)
#ifdef __WIN32__
#ifdef UNICODE
::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)))
if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) )
{
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;
wxLogLastError("SetMenu");
}
node = node->Next();
}
SetClientSize(max_width, max_height);
}
// 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
// style instead of WS_OVERLAPPED
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;
}
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
// rectangle size
void wxFrame::OnSize(wxSizeEvent& event)
@ -835,7 +617,7 @@ void wxFrame::OnActivate(wxActivateEvent& event)
// The default implementation for the close window event.
void wxFrame::OnCloseWindow(wxCloseEvent& event)
{
this->Destroy();
Destroy();
}
// Destroy the window (delayed, if a managed window)
@ -871,53 +653,26 @@ wxMenuBar *wxFrame::GetMenuBar() const
return m_frameMenuBar;
}
void wxFrame::Centre(int direction)
bool wxFrame::ProcessCommand(int id)
{
int display_width, display_height, width, height, x, y;
wxDisplaySize(&display_width, &display_height);
wxMenuBar *bar = GetMenuBar() ;
if ( !bar )
return FALSE;
GetSize(&width, &height);
GetPosition(&x, &y);
wxMenuItem *item = bar->FindItemForId(id);
if ( !item )
return FALSE;
if (direction & wxHORIZONTAL)
x = (int)((display_width - width)/2);
if (direction & wxVERTICAL)
y = (int)((display_height - height)/2);
if ( item->IsCheckable() )
{
bar->Check(id, !bar->IsChecked(id)) ;
}
SetSize(x, y, width, height);
}
wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id);
commandEvent.SetInt( id );
commandEvent.SetEventObject( this );
// 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);
commandEvent.SetInt( id );
commandEvent.SetEventObject( this );
wxMenuBar *bar = GetMenuBar() ;
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);
return GetEventHandler()->ProcessEvent(commandEvent);
}
// Checks if there is a toolbar, and returns the first free client position
@ -968,7 +723,7 @@ void wxFrame::ClientToScreen(int *x, int *y) const
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
"recreating toolbar in wxFrame" );
"recreating toolbar in wxFrame" );
wxToolBar* toolBar = OnCreateToolBar(style, id, name);
if (toolBar)
@ -991,7 +746,7 @@ wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& n
void wxFrame::PositionToolBar()
{
RECT rect;
::GetClientRect((HWND) GetHWND(), &rect);
::GetClientRect(GetHwnd(), &rect);
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)
{
int item;
@ -1074,19 +990,49 @@ long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
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:
{
WORD item = (WORD)wParam;
#ifdef __WIN32__
WORD flags = HIWORD(wParam);
HMENU sysmenu = (HMENU)lParam;
#else
WORD flags = LOWORD(lParam);
HMENU sysmenu = (HMENU)HIWORD(lParam);
#endif
processed = HandleMenuSelect(item, flags, (WXHMENU)sysmenu);
WXWORD item, flags;
WXHMENU hmenu;
UnpackMenuSelect(wParam, lParam, &item, &flags, &hmenu);
processed = HandleMenuSelect(item, flags, hmenu);
}
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 )

View File

@ -39,10 +39,6 @@
#endif
#endif
#ifdef GetCharWidth
#undef GetCharWidth
#endif
#if wxUSE_OWNER_DRAWN
#include "wx/ownerdrw.h"
#endif
@ -165,7 +161,8 @@ bool wxListBox::Create(wxWindow *parent,
int height = size.y;
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)
wstyle |= LBS_MULTIPLESEL;
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" );
// 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;
// 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)
flags |= MF_STRING;
pData = pItem->GetName();
}
// visually select the menu title
if ( id == idMenuTitle )
{
// TODO use SetMenuItemInfo(MFS_DEFAULT) to put it in bold face
pData = label;
}
if ( !::AppendMenu(GetHMENU(), flags, id, pData) )
@ -205,6 +260,22 @@ void wxMenu::Append(wxMenuItem *pItem)
}
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_noItems++;
}
@ -272,6 +343,23 @@ void wxMenu::Delete(int id)
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
// ---------------------------------------------------------------------------
@ -395,7 +483,7 @@ void wxMenu::SetTitle(const wxString& label)
}
}
#ifndef __WIN16__
#ifdef __WIN32__
// put the title string in bold face
if ( !m_title.IsEmpty() )
{
@ -438,7 +526,7 @@ bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id)
return TRUE;
}
void wxMenu::ProcessCommand(wxCommandEvent & event)
bool wxMenu::ProcessCommand(wxCommandEvent & event)
{
bool processed = FALSE;
@ -462,6 +550,8 @@ void wxMenu::ProcessCommand(wxCommandEvent & event)
wxWindow *win = GetInvokingWindow();
if ( !processed && win )
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
// ---------------------------------------------------------------------------

View File

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

View File

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

View File

@ -68,9 +68,10 @@
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
EVT_SIZE(wxNotebook::OnSize)
EVT_ERASE_BACKGROUND(wxNotebook::OnEraseBackground)
EVT_WINDOW_CREATE(wxNotebook::OnWindowCreate)
EVT_SET_FOCUS(wxNotebook::OnSetFocus)
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
END_EVENT_TABLE()
@ -164,7 +165,6 @@ bool wxNotebook::Create(wxWindow *parent,
}
// Not all compilers recognise SetWindowFont
// SetWindowFont((HWND)m_hwnd, ::GetStockObject(DEFAULT_GUI_FONT), FALSE);
::SendMessage((HWND) m_hwnd, WM_SETFONT,
(WPARAM)::GetStockObject(DEFAULT_GUI_FONT),TRUE);
@ -272,6 +272,14 @@ void wxNotebook::SetImageList(wxImageList* imageList)
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
// ----------------------------------------------------------------------------
@ -371,9 +379,12 @@ bool wxNotebook::InsertPage(int nPage,
m_nSelection = 0;
// 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);
// this updates internal flag too - otherwise it will get out of sync
pPage->Show(FALSE);
return TRUE;
}
@ -381,7 +392,7 @@ bool wxNotebook::InsertPage(int nPage,
// 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
// pages are created invisible initially)
@ -459,11 +470,6 @@ bool wxNotebook::DoPhase(int /* nPhase */)
return TRUE;
}
void wxNotebook::Command(wxCommandEvent& event)
{
wxFAIL_MSG("wxNotebook::Command not implemented");
}
bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result)
{
wxNotebookEvent event(wxEVT_NULL, m_windowId);
@ -538,16 +544,3 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
m_nSelection = nSel;
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
#include "wx/log.h"
#include "wx/msw/ole/automtn.h"
#include <windows.h>
#include <ole2ver.h>
#include <oleauto.h>
#include <math.h>
#include <time.h>
#ifdef GetObject
#undef GetObject
#endif
#include "wx/msw/ole/automtn.h"
#include "wx/msw/private.h"
#include <ole2ver.h>
#include <oleauto.h>
// wrapper around BSTR type (by Vadim Zeitlin)

View File

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

View File

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

View File

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

View File

@ -52,16 +52,16 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hWnd,
UINT message,
WPARAM wParam,
LPARAM lParam);
#endif
// ---------------------------------------------------------------------------
// global vars
// ---------------------------------------------------------------------------
// the pointer to standard radio button wnd proc
// static WNDPROC s_wndprocRadioBtn = (WNDPROC)NULL;
static WXFARPROC s_wndprocRadioBtn = (WXFARPROC)NULL;
#endif // __WIN32__
// ===========================================================================
// 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;
@ -192,12 +192,6 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
bool 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();
@ -249,6 +243,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
NULL);
m_radioButtons[i] = (WXHWND)hwndBtn;
SubclassRadioButton((WXHWND)hwndBtn);
wxFont& font = GetFont();
@ -258,7 +253,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
(WPARAM)font.GetResourceHandle(), 0L);
}
m_subControls.Append((wxObject *)newId);
m_subControls.Append((wxObject *)(WXWORD)newId);
}
// Create a dummy radio control to end the group.
@ -281,29 +276,21 @@ wxRadioBox::~wxRadioBox()
{
int i;
for (i = 0; i < m_noItems; i++)
DestroyWindow((HWND) m_radioButtons[i]);
::DestroyWindow((HWND)m_radioButtons[i]);
delete[] m_radioButtons;
}
if (m_radioWidth)
delete[] m_radioWidth;
if (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)
{
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)
@ -312,18 +299,18 @@ void wxRadioBox::SetLabel(int item, wxBitmap *bitmap)
m_radioWidth[item] = bitmap->GetWidth() + FB_MARGIN;
m_radioHeight[item] = bitmap->GetHeight() + FB_MARGIN;
*/
wxFAIL_MSG("not implemented");
}
int wxRadioBox::FindString(const wxString& s) const
{
int i;
for (i = 0; i < m_noItems; i++)
for (int i = 0; i < m_noItems; i++)
{
GetWindowText((HWND) m_radioButtons[i], wxBuffer, 1000);
if (s == wxBuffer)
if ( s == wxGetWindowText(m_radioButtons[i]) )
return i;
}
return -1;
return wxNOT_FOUND;
}
void wxRadioBox::SetSelection(int N)
@ -536,22 +523,6 @@ void wxRadioBox::GetPosition(int *x, int *y) const
*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()
{
if (m_noItems > 0)
@ -566,27 +537,25 @@ void wxRadioBox::SetFocus()
bool wxRadioBox::Show(bool show)
{
m_isShown = show;
int cshow;
if (show)
cshow = SW_SHOW;
else
cshow = SW_HIDE;
if (m_hWnd)
ShowWindow((HWND) m_hWnd, cshow);
int i;
for (i = 0; i < m_noItems; i++)
ShowWindow((HWND) m_radioButtons[i], cshow);
if ( !wxControl::Show(show) )
return FALSE;
int nCmdShow = show ? SW_SHOW : SW_HIDE;
for ( int i = 0; i < m_noItems; i++ )
{
::ShowWindow((HWND)m_radioButtons[i], nCmdShow);
}
return TRUE;
}
// Enable a specific button
void wxRadioBox::Enable(int item, bool enable)
{
if (item<0)
wxWindow::Enable(enable);
else if (item < m_noItems)
::EnableWindow((HWND) m_radioButtons[item], enable);
wxCHECK_RET( item >= 0 && item < m_noItems,
_T("invalid item in wxRadioBox::Enable()") );
::EnableWindow((HWND) m_radioButtons[item], enable);
}
// Enable all controls
@ -595,8 +564,7 @@ bool wxRadioBox::Enable(bool enable)
if ( !wxControl::Enable(enable) )
return FALSE;
int i;
for (i = 0; i < m_noItems; i++)
for (int i = 0; i < m_noItems; i++)
::EnableWindow((HWND) m_radioButtons[i], enable);
return TRUE;
@ -605,17 +573,10 @@ bool wxRadioBox::Enable(bool enable)
// Show a specific button
void wxRadioBox::Show(int item, bool show)
{
if (item<0)
wxRadioBox::Show(show);
else if (item < m_noItems)
{
int cshow;
if (show)
cshow = SW_SHOW;
else
cshow = SW_HIDE;
ShowWindow((HWND) m_radioButtons[item], cshow);
}
wxCHECK_RET( item >= 0 && item < m_noItems,
_T("invalid item in wxRadioBox::Show()") );
::ShowWindow((HWND)m_radioButtons[item], show ? SW_SHOW : SW_HIDE);
}
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);
// Note that this will be cleaned up in wxApp::OnIdle, if backgroundBrush
// has a zero usage count.
// backgroundBrush->RealizeResource();
return (WXHBRUSH) backgroundBrush->GetResourceHandle();
}
@ -672,8 +630,11 @@ bool wxRadioBox::ContainsHWND(WXHWND hWnd) const
{
int i;
for (i = 0; i < Number(); i++)
{
if (GetRadioButtons()[i] == hWnd)
return TRUE;
}
return FALSE;
}
@ -683,36 +644,49 @@ void wxRadioBox::Command (wxCommandEvent & 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 )
{
int xPos = LOWORD(lParam); // horizontal position of cursor
int yPos = HIWORD(lParam); // vertical position of cursor
case WM_NCHITTEST:
{
int xPos = LOWORD(lParam); // horizontal position of cursor
int yPos = HIWORD(lParam); // vertical position of cursor
ScreenToClient(&xPos, &yPos);
ScreenToClient(&xPos, &yPos);
// Make sure you can drag by the top of the groupbox, but let
// other (enclosed) controls get mouse events also
if (yPos < 10)
return (long)HTCLIENT;
// Make sure you can drag by the top of the groupbox, but let
// other (enclosed) controls get mouse events also
if ( yPos < 10 )
{
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)
{
#ifdef __WIN32__
HWND hwndBtn = (HWND)hWndBtn;
if ( !s_wndprocRadioBtn )
s_wndprocRadioBtn = (WXFARPROC)::GetWindowLong(hwndBtn, GWL_WNDPROC);
// No GWL_USERDATA in Win16, so omit this subclassing.
#ifdef __WIN32__
::SetWindowLong(hwndBtn, GWL_WNDPROC, (long)wxRadioBtnWndProc);
::SetWindowLong(hwndBtn, GWL_USERDATA, (long)this);
#endif
#endif // __WIN32__
}
void wxRadioBox::SendNotificationEvent()
@ -797,5 +771,6 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
else
return 0;
}
#endif
#endif // __WIN32__

View File

@ -6,7 +6,7 @@
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@ -32,7 +32,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
END_EVENT_TABLE()
#endif
@ -56,9 +56,9 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
SetForegroundColour(parent->GetForegroundColour()) ;
if ( id == -1 )
m_windowId = (int)NewControlId();
m_windowId = (int)NewControlId();
else
m_windowId = id;
m_windowId = id;
int x = pos.x;
int y = pos.y;
@ -80,7 +80,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
if (want3D)
{
Ctl3dSubclassCtl(wx_button);
m_useCtl3D = TRUE;
m_useCtl3D = TRUE;
}
#endif
@ -144,7 +144,7 @@ void wxStaticBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
}
WXHBRUSH wxStaticBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
#if wxUSE_CTL3D
if ( m_useCtl3D )
@ -206,12 +206,14 @@ void wxStaticBox::OnEraseBackground(wxEraseEvent& event)
::SetMapMode((HDC) event.GetDC()->GetHDC(), mode);
}
else
Default();
{
event.Skip();
}
}
long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
if (nMsg == WM_NCHITTEST)
if (nMsg == WM_NCHITTEST)
{
int xPos = LOWORD(lParam); // horizontal position of cursor
int yPos = HIWORD(lParam); // vertical position of cursor
@ -224,6 +226,6 @@ long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
return (long)HTCLIENT;
}
return wxControl::MSWWindowProc(nMsg, wParam, lParam);
return wxControl::MSWWindowProc(nMsg, wParam, lParam);
}

View File

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

View File

@ -6,7 +6,7 @@
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows license
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@ -52,10 +52,6 @@
IMPLEMENT_DYNAMIC_CLASS(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)
END_EVENT_TABLE()
#endif
@ -71,7 +67,7 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
m_imageList = NULL;
m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
m_foregroundColour = *wxBLACK ;
SetName(name);
@ -139,29 +135,20 @@ wxTabCtrl::~wxTabCtrl()
UnsubclassWin();
}
void wxTabCtrl::Command(wxCommandEvent& event)
{
}
bool wxTabCtrl::MSWCommand(WXUINT cmd, WXWORD id)
{
return FALSE;
}
bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
{
wxTabEvent event(wxEVT_NULL, m_windowId);
wxEventType eventType = wxEVT_NULL;
NMHDR* hdr1 = (NMHDR*) lParam;
switch ( hdr1->code )
{
case TCN_SELCHANGE:
eventType = wxEVT_COMMAND_TAB_SEL_CHANGED;
break;
wxTabEvent event(wxEVT_NULL, m_windowId);
wxEventType eventType = wxEVT_NULL;
NMHDR* hdr1 = (NMHDR*) lParam;
switch ( hdr1->code )
{
case TCN_SELCHANGE:
eventType = wxEVT_COMMAND_TAB_SEL_CHANGED;
break;
case TCN_SELCHANGING:
eventType = wxEVT_COMMAND_TAB_SEL_CHANGING;
break;
case TCN_SELCHANGING:
eventType = wxEVT_COMMAND_TAB_SEL_CHANGING;
break;
case TTN_NEEDTEXT:
{
@ -170,27 +157,23 @@ bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
// ttText->lpszText = (char *) (const char *)tool->m_shortHelpString;
}
default :
return wxControl::MSWOnNotify(idCtrl, lParam, result);
}
default :
return wxControl::MSWOnNotify(idCtrl, lParam, result);
}
event.SetEventObject( this );
event.SetEventType(eventType);
event.SetInt(idCtrl) ;
event.SetEventObject( this );
event.SetEventType(eventType);
event.SetInt(idCtrl) ;
return ProcessEvent(event);
return ProcessEvent(event);
}
// Responds to colour changes, and passes event on to children.
void wxTabCtrl::OnSysColourChanged(wxSysColourChangedEvent& event)
{
m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
// Remap the buttons
// CreateTools();
Default();
GetGValue(GetSysColor(COLOR_BTNFACE)),
GetBValue(GetSysColor(COLOR_BTNFACE)));
Refresh();

View File

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

View File

@ -74,7 +74,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
EVT_CHAR(wxTextCtrl::OnChar)
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
EVT_MENU(wxID_CUT, wxTextCtrl::OnCut)
EVT_MENU(wxID_COPY, wxTextCtrl::OnCopy)
@ -1070,7 +1069,7 @@ WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
void wxTextCtrl::OnChar(wxKeyEvent& event)
{
switch( event.KeyCode() )
switch ( event.KeyCode() )
{
case WXK_RETURN:
if ( !(m_windowStyle & wxTE_MULTILINE) )
@ -1111,8 +1110,9 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
// 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
// right here
Default();
// event.Skip();
// FIXME
event.Skip();
}
long wxTextCtrl::MSWGetDlgCode()
@ -1135,27 +1135,6 @@ long wxTextCtrl::MSWGetDlgCode()
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))
{
/*

View File

@ -441,7 +441,7 @@ bool wxThread::IsMain()
}
#ifdef Yield
#undef Yield
#undef Yield
#endif
void wxThread::Yield()

View File

@ -48,22 +48,6 @@
#include <commctrl.h>
#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
#ifndef TVIS_FOCUSED
#define TVIS_FOCUSED 0x0001

View File

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

File diff suppressed because it is too large Load Diff