- wxWindow::IsBeingDeleted() now returns true not only if the window itself is
marked for destruction but also if any of its parent windows are.
- Improved drawing of the hint during column move in wxGrid.
+- Get/HasModifiers() of wxKeyEvent are now also available in wxMouseEvent.
wxGTK:
#if wxUSE_GUI
#include "wx/gdicmn.h"
#include "wx/cursor.h"
+ #include "wx/mousestate.h"
#endif
#include "wx/dynarray.h"
class WXDLLIMPEXP_BASE wxEvent : public wxObject
{
-private:
- wxEvent& operator=(const wxEvent&);
-
-protected:
- wxEvent(const wxEvent&); // for implementing Clone()
-
public:
wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL );
// backwards compatibility as it is new
int m_propagationLevel;
-protected:
bool m_skipped;
bool m_isCommandEvent;
+protected:
+ wxEvent(const wxEvent&); // for implementing Clone()
+ wxEvent& operator=(const wxEvent&); // for derived classes operator=()
+
private:
// it needs to access our m_propagationLevel
friend class WXDLLIMPEXP_FWD_BASE wxPropagateOnce;
wxMOUSE_BTN_MAX
};
-class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent,
+ public wxMouseState
{
public:
wxMouseEvent(wxEventType mouseType = wxEVT_NULL);
- wxMouseEvent(const wxMouseEvent& event) : wxEvent(event)
- { Assign(event); }
+ wxMouseEvent(const wxMouseEvent& event)
+ : wxEvent(event),
+ wxMouseState(event)
+ {
+ Assign(event);
+ }
// Was it a button event? (*doesn't* mean: is any button *down*?)
bool IsButton() const { return Button(wxMOUSE_BTN_ANY); }
// Get the button which is changing state (wxMOUSE_BTN_NONE if none)
int GetButton() const;
- // Find state of shift/control keys
- bool ControlDown() const { return m_controlDown; }
- bool MetaDown() const { return m_metaDown; }
- bool AltDown() const { return m_altDown; }
- bool ShiftDown() const { return m_shiftDown; }
- bool CmdDown() const
- {
-#if defined(__WXMAC__) || defined(__WXCOCOA__)
- return MetaDown();
-#else
- return ControlDown();
-#endif
- }
-
// Find which event was just generated
bool LeftDown() const { return (m_eventType == wxEVT_LEFT_DOWN); }
bool MiddleDown() const { return (m_eventType == wxEVT_MIDDLE_DOWN); }
virtual wxEvent *Clone() const { return new wxMouseEvent(*this); }
- wxMouseEvent& operator=(const wxMouseEvent& event) { if (&event != this) Assign(event); return *this; }
+ wxMouseEvent& operator=(const wxMouseEvent& event)
+ {
+ if (&event != this)
+ Assign(event);
+ return *this;
+ }
public:
wxCoord m_x, m_y;
bool m_aux1Down;
bool m_aux2Down;
- bool m_controlDown;
- bool m_shiftDown;
- bool m_altDown;
- bool m_metaDown;
-
int m_clickCount;
int m_wheelAxis;
wxEVT_HOTKEY
*/
-class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent,
+ public wxKeyboardState
{
public:
wxKeyEvent(wxEventType keyType = wxEVT_NULL);
wxKeyEvent(const wxKeyEvent& evt);
- // can be used check if the key event has exactly the given modifiers:
- // "GetModifiers() = wxMOD_CONTROL" is easier to write than "ControlDown()
- // && !MetaDown() && !AltDown() && !ShiftDown()"
- int GetModifiers() const
- {
- return (m_controlDown ? wxMOD_CONTROL : 0) |
- (m_shiftDown ? wxMOD_SHIFT : 0) |
- (m_metaDown ? wxMOD_META : 0) |
- (m_altDown ? wxMOD_ALT : 0);
- }
-
- // Find state of shift/control keys
- bool ControlDown() const { return m_controlDown; }
- bool ShiftDown() const { return m_shiftDown; }
- bool MetaDown() const { return m_metaDown; }
- bool AltDown() const { return m_altDown; }
-
- // "Cmd" is a pseudo key which is Control for PC and Unix platforms but
- // Apple ("Command") key under Macs: it makes often sense to use it instead
- // of, say, ControlDown() because Cmd key is used for the same thing under
- // Mac as Ctrl elsewhere (but Ctrl still exists, just not used for this
- // purpose under Mac)
- bool CmdDown() const
- {
-#if defined(__WXMAC__) || defined(__WXCOCOA__)
- return MetaDown();
-#else
- return ControlDown();
-#endif
- }
-
- // exclude MetaDown() from HasModifiers() because NumLock under X is often
- // configured as mod2 modifier, yet the key events even when it is pressed
- // should be processed normally, not like Ctrl- or Alt-key
- bool HasModifiers() const { return ControlDown() || AltDown(); }
-
// get the key code: an ASCII7 char or an element of wxKeyCode enum
int GetKeyCode() const { return (int)m_keyCode; }
{
if (&evt != this)
{
+ wxEvent::operator=(evt);
+ wxKeyboardState::operator=(evt);
+
m_x = evt.m_x;
m_y = evt.m_y;
m_keyCode = evt.m_keyCode;
- m_controlDown = evt.m_controlDown;
- m_shiftDown = evt.m_shiftDown;
- m_altDown = evt.m_altDown;
- m_metaDown = evt.m_metaDown;
m_scanCode = evt.m_scanCode;
m_rawCode = evt.m_rawCode;
m_rawFlags = evt.m_rawFlags;
long m_keyCode;
- // TODO: replace those with a single m_modifiers bitmask of wxMOD_XXX?
- bool m_controlDown;
- bool m_shiftDown;
- bool m_altDown;
- bool m_metaDown;
-
// FIXME: what is this for? relation to m_rawXXX?
bool m_scanCode;
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/kbdstate.h
+// Purpose: Declaration of wxKeyboardState class
+// Author: Vadim Zeitlin
+// Created: 2008-09-19
+// RCS-ID: $Id$
+// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_KBDSTATE_H_
+#define _WX_KBDSTATE_H_
+
+#include "wx/defs.h"
+
+// ----------------------------------------------------------------------------
+// wxKeyboardState stores the state of the keyboard modifier keys
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxKeyboardState
+{
+public:
+ wxKeyboardState()
+ : m_controlDown(false),
+ m_shiftDown(false),
+ m_altDown(false),
+ m_metaDown(false)
+ {
+ }
+
+ // default copy ctor, assignment operator and dtor are ok
+
+
+ // accessors for the various modifier keys
+ // ---------------------------------------
+
+ // should be used check if the key event has exactly the given modifiers:
+ // "GetModifiers() = wxMOD_CONTROL" is easier to write than "ControlDown()
+ // && !MetaDown() && !AltDown() && !ShiftDown()"
+ int GetModifiers() const
+ {
+ return (m_controlDown ? wxMOD_CONTROL : 0) |
+ (m_shiftDown ? wxMOD_SHIFT : 0) |
+ (m_metaDown ? wxMOD_META : 0) |
+ (m_altDown ? wxMOD_ALT : 0);
+ }
+
+ // returns true if any modifiers at all are pressed
+ bool HasModifiers() const { return GetModifiers() != wxMOD_NONE; }
+
+ // accessors for individual modifier keys
+ bool ControlDown() const { return m_controlDown; }
+ bool ShiftDown() const { return m_shiftDown; }
+ bool MetaDown() const { return m_metaDown; }
+ bool AltDown() const { return m_altDown; }
+
+ // "Cmd" is a pseudo key which is Control for PC and Unix platforms but
+ // Apple ("Command") key under Macs: it makes often sense to use it instead
+ // of, say, ControlDown() because Cmd key is used for the same thing under
+ // Mac as Ctrl elsewhere (but Ctrl still exists, just not used for this
+ // purpose under Mac)
+ bool CmdDown() const
+ {
+#if defined(__WXMAC__) || defined(__WXCOCOA__)
+ return MetaDown();
+#else
+ return ControlDown();
+#endif
+ }
+
+ // these functions are mostly used by wxWidgets itself
+ // ---------------------------------------------------
+
+ void SetControlDown(bool down) { m_controlDown = down; }
+ void SetShiftDown(bool down) { m_shiftDown = down; }
+ void SetAltDown(bool down) { m_altDown = down; }
+ void SetMetaDown(bool down) { m_metaDown = down; }
+
+
+ // for backwards compatibility with the existing code accessing these
+ // members of wxKeyEvent directly, these variables are public, however you
+ // should not use them in any new code, please use the accessors instead
+public:
+ bool m_controlDown : 1;
+ bool m_shiftDown : 1;
+ bool m_altDown : 1;
+ bool m_metaDown : 1;
+};
+
+#endif // _WX_KBDSTATE_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/mousestate.h
+// Purpose: Declaration of wxMouseState class
+// Author: Vadim Zeitlin
+// Created: 2008-09-19 (extracted from wx/utils.h)
+// RCS-ID: $Id$
+// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MOUSESTATE_H_
+#define _WX_MOUSESTATE_H_
+
+#include "wx/kbdstate.h"
+
+// ----------------------------------------------------------------------------
+// wxMouseState contains the information about mouse position, buttons and also
+// key modifiers
+// ----------------------------------------------------------------------------
+
+// wxMouseState is used to hold information about button and modifier state
+// and is what is returned from wxGetMouseState.
+class WXDLLIMPEXP_CORE wxMouseState : public wxKeyboardState
+{
+public:
+ wxMouseState()
+ : m_x(0), m_y(0),
+ m_leftDown(false), m_middleDown(false), m_rightDown(false),
+ m_aux1Down(false), m_aux2Down(false)
+ {
+ }
+
+ // default copy ctor, assignment operator and dtor are ok
+
+
+ // accessors for the mouse position
+ wxCoord GetX() const { return m_x; }
+ wxCoord GetY() const { return m_y; }
+ wxPoint GetPosition() const { return wxPoint(m_x, m_y); }
+
+ // accessors for the pressed buttons
+ bool LeftDown() const { return m_leftDown; }
+ bool MiddleDown() const { return m_middleDown; }
+ bool RightDown() const { return m_rightDown; }
+ bool Aux1Down() const { return m_aux1Down; }
+ bool Aux2Down() const { return m_aux2Down; }
+
+ // these functions are mostly used by wxWidgets itself
+ void SetX(wxCoord x) { m_x = x; }
+ void SetY(wxCoord y) { m_y = y; }
+
+ void SetLeftDown(bool down) { m_leftDown = down; }
+ void SetMiddleDown(bool down) { m_middleDown = down; }
+ void SetRightDown(bool down) { m_rightDown = down; }
+ void SetAux1Down(bool down) { m_aux1Down = down; }
+ void SetAux2Down(bool down) { m_aux2Down = down; }
+
+private:
+ bool m_leftDown : 1;
+ bool m_middleDown : 1;
+ bool m_rightDown : 1;
+ bool m_aux1Down : 1;
+ bool m_aux2Down : 1;
+
+ wxCoord m_x,
+ m_y;
+};
+
+#endif // _WX_MOUSESTATE_H_
+
#include "wx/object.h"
#include "wx/list.h"
#include "wx/filefn.h"
+
#if wxUSE_GUI
#include "wx/gdicmn.h"
+ #include "wx/mousestate.h"
#endif
class WXDLLIMPEXP_FWD_BASE wxArrayString;
// in wxMSW.
WXDLLIMPEXP_CORE bool wxSetDetectableAutoRepeat( bool flag );
-
-// wxMouseState is used to hold information about button and modifier state
-// and is what is returned from wxGetMouseState.
-class WXDLLIMPEXP_CORE wxMouseState
-{
-public:
- wxMouseState()
- : m_x(0), m_y(0),
- m_leftDown(false), m_middleDown(false), m_rightDown(false),
- m_aux1Down(false), m_aux2Down(false),
- m_controlDown(false), m_shiftDown(false), m_altDown(false),
- m_metaDown(false)
- {}
-
- wxCoord GetX() const { return m_x; }
- wxCoord GetY() const { return m_y; }
- wxPoint GetPosition() const { return wxPoint(m_x, m_y); }
-
- bool LeftDown() const { return m_leftDown; }
- bool MiddleDown() const { return m_middleDown; }
- bool RightDown() const { return m_rightDown; }
- bool Aux1Down() const { return m_aux1Down; }
- bool Aux2Down() const { return m_aux2Down; }
-
- bool ControlDown() const { return m_controlDown; }
- bool ShiftDown() const { return m_shiftDown; }
- bool AltDown() const { return m_altDown; }
- bool MetaDown() const { return m_metaDown; }
- bool CmdDown() const
- {
-#if defined(__WXMAC__) || defined(__WXCOCOA__)
- return MetaDown();
-#else
- return ControlDown();
-#endif
- }
-
- void SetX(wxCoord x) { m_x = x; }
- void SetY(wxCoord y) { m_y = y; }
-
- void SetLeftDown(bool down) { m_leftDown = down; }
- void SetMiddleDown(bool down) { m_middleDown = down; }
- void SetRightDown(bool down) { m_rightDown = down; }
- void SetAux1Down(bool down) { m_aux1Down = down; }
- void SetAux2Down(bool down) { m_aux2Down = down; }
-
- void SetControlDown(bool down) { m_controlDown = down; }
- void SetShiftDown(bool down) { m_shiftDown = down; }
- void SetAltDown(bool down) { m_altDown = down; }
- void SetMetaDown(bool down) { m_metaDown = down; }
-
-private:
- wxCoord m_x,
- m_y;
-
- bool m_leftDown : 1;
- bool m_middleDown : 1;
- bool m_rightDown : 1;
- bool m_aux1Down : 1;
- bool m_aux2Down : 1;
-
- bool m_controlDown : 1;
- bool m_shiftDown : 1;
- bool m_altDown : 1;
- bool m_metaDown : 1;
-};
-
-
// Returns the current state of the mouse position, buttons and modifers
WXDLLIMPEXP_CORE wxMouseState wxGetMouseState();
Process a wxEVT_CHAR event.
@endEventTable
+ @see wxKeyboardState
+
@library{wxcore}
@category{events}
*/
-class wxKeyEvent : public wxEvent
+class wxKeyEvent : public wxEvent,
+ public wxKeyboardState
{
public:
/**
*/
wxKeyEvent(wxEventType keyEventType = wxEVT_NULL);
- /**
- Returns @true if the Alt key was down at the time of the key event.
-
- Notice that GetModifiers() is easier to use correctly than this function
- so you should consider using it in new code.
- */
- bool AltDown() const;
-
- /**
- CMD is a pseudo key which is the same as Control for PC and Unix
- platforms but the special APPLE (a.k.a as COMMAND) key under Macs:
- it makes often sense to use it instead of, say, ControlDown() because Cmd
- key is used for the same thing under Mac as Ctrl elsewhere (but Ctrl still
- exists, just not used for this purpose under Mac). So for non-Mac platforms
- this is the same as ControlDown() and under Mac this is the same as MetaDown().
- */
- bool CmdDown() const;
-
- /**
- Returns @true if the control key was down at the time of the key event.
-
- Notice that GetModifiers() is easier to use correctly than this function
- so you should consider using it in new code.
- */
- bool ControlDown() const;
-
/**
Returns the virtual key code. ASCII events return normal ASCII values,
while non-ASCII events return values such as @b WXK_LEFT for the left cursor
*/
int GetKeyCode() const;
- /**
- Return the bitmask of modifier keys which were pressed when this event
- happened. See @ref page_keymodifiers for the full list of modifiers.
-
- Notice that this function is easier to use correctly than, for example,
- ControlDown() because when using the latter you also have to remember to
- test that none of the other modifiers is pressed:
-
- @code
- if ( ControlDown() && !AltDown() && !ShiftDown() && !MetaDown() )
- ... handle Ctrl-XXX ...
- @endcode
-
- and forgetting to do it can result in serious program bugs (e.g. program
- not working with European keyboard layout where ALTGR key which is seen by
- the program as combination of CTRL and ALT is used). On the other hand,
- you can simply write:
-
- @code
- if ( GetModifiers() == wxMOD_CONTROL )
- ... handle Ctrl-XXX ...
- @endcode
-
- with this function.
- */
- int GetModifiers() const;
-
//@{
/**
Obtains the position (in client coordinates) at which the key was pressed.
Returns the Y position (in client coordinates) of the event.
*/
wxCoord GetY() const;
-
- /**
- Returns @true if either CTRL or ALT keys was down at the time of the
- key event.
-
- Note that this function does not take into account neither SHIFT nor
- META key states (the reason for ignoring the latter is that it is
- common for NUMLOCK key to be configured as META under X but the key
- presses even while NUMLOCK is on should be still processed normally).
- */
- bool HasModifiers() const;
-
- /**
- Returns @true if the Meta key was down at the time of the key event.
-
- Notice that GetModifiers() is easier to use correctly than this function
- so you should consider using it in new code.
- */
- bool MetaDown() const;
-
- /**
- Returns @true if the shift key was down at the time of the key event.
-
- Notice that GetModifiers() is easier to use correctly than this function
- so you should consider using it in new code.
- */
- bool ShiftDown() const;
};
@library{wxcore}
@category{events}
- @see wxKeyEvent::CmdDown
+ @see wxKeyEvent
*/
-class wxMouseEvent : public wxEvent
+class wxMouseEvent : public wxEvent,
+ public wxMouseState
{
public:
/**
*/
wxMouseEvent(wxEventType mouseEventType = wxEVT_NULL);
- /**
- Returns @true if the Alt key was down at the time of the event.
- */
- bool AltDown() const;
-
/**
Returns @true if the event was a first extra button double click.
*/
*/
bool ButtonUp(int = wxMOUSE_BTN_ANY) const;
- /**
- Same as MetaDown() under Mac, same as ControlDown() elsewhere.
-
- @see wxKeyEvent::CmdDown
- */
- bool CmdDown() const;
-
- /**
- Returns @true if the control key was down at the time of the event.
- */
- bool ControlDown() const;
-
/**
Returns @true if this was a dragging event (motion while a button is depressed).
Returns @true if the right mouse button changed to up.
*/
bool RightUp() const;
-
- /**
- Returns @true if the shift key was down at the time of the event.
- */
- bool ShiftDown() const;
};
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/kbdstate.h
+// Purpose: documentation of wxKeyboardState
+// Author: wxWidgets team
+// Created: 2008-09-19
+// RCS-ID: $Id$
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ Provides methods for testing the state of the keyboard modifier keys.
+
+ This class is used as a base class of wxKeyEvent and wxMouseState and,
+ hence, indirectly, of wxMouseEvent, so its methods may be used to get
+ information about the modifier keys which were pressed when the event
+ occurred.
+
+ This class is implemented entirely inline in @<wx/keystate.h@> and thus has
+ no linking requirements.
+
+ @category{misc}
+
+ @see wxKeyEvent, wxMouseState
+ */
+class wxKeyboardState
+{
+public:
+ /**
+ Default constructor.
+
+ By default, no modifiers are active.
+ */
+ wxKeyboardState();
+
+ /**
+ Return the bit mask of all pressed modifier keys.
+
+ The return value is a combination of @c wxMOD_ALT, @c wxMOD_CONTROL,
+ @c wxMOD_SHIFT and @c wxMOD_META bit masks. Additionally, @c wxMOD_NONE
+ is defined as 0, i.e. corresponds to no modifiers (see HasModifiers())
+ and @c wxMOD_CMD is either @c wxMOD_CONTROL (MSW and Unix) or @c
+ wxMOD_META (Mac), see CmdDown(). See @ref page_keymodifiers for the
+ full list of modifiers.
+
+ Notice that this function is easier to use correctly than, for example,
+ ControlDown() because when using the latter you also have to remember to
+ test that none of the other modifiers is pressed:
+
+ @code
+ if ( ControlDown() && !AltDown() && !ShiftDown() && !MetaDown() )
+ ... handle Ctrl-XXX ...
+ @endcode
+
+ and forgetting to do it can result in serious program bugs (e.g. program
+ not working with European keyboard layout where @c AltGr key which is
+ seen by the program as combination of CTRL and ALT is used). On the
+ other hand, you can simply write:
+
+ @code
+ if ( GetModifiers() == wxMOD_CONTROL )
+ ... handle Ctrl-XXX ...
+ @endcode
+
+ with this function.
+ */
+ int GetModifiers() const;
+
+ /**
+ Returns true if any modifiers at all are pressed.
+
+ This is equivalent to @c GetModifiers() @c != @c wxMOD_NONE.
+ */
+ bool HasModifiers() const;
+
+ /**
+ Returns true if the Control key is pressed.
+
+ This function doesn't distinguish between right and left control keys.
+
+ In portable code you usually want to use CmdDown() to automatically
+ test for the more frequently used Command key (and not the rarely used
+ Control one) under Mac.
+
+ Notice that GetModifiers() should usually be used instead of this one.
+ */
+ bool ControlDown() const;
+
+ /**
+ Returns true if the Shift key is pressed.
+
+ This function doesn't distinguish between right and left shift keys.
+
+ Notice that GetModifiers() should usually be used instead of this one.
+ */
+ bool ShiftDown() const;
+
+ /**
+ Returns true if the Meta/Windows/Apple key is pressed.
+
+ This function tests the state of the key traditionally called Meta
+ under Unix systems, Windows keys under MSW and Apple, or Command, key
+ under Mac.
+
+ Notice that GetModifiers() should usually be used instead of this one.
+
+ @see CmdDown()
+ */
+ bool MetaDown() const;
+
+ /**
+ Returns true if the Alt key is pressed.
+
+ Notice that GetModifiers() should usually be used instead of this one.
+ */
+ bool AltDown() const;
+
+ /**
+ Returns true if the key used for command accelerators is pressed.
+
+ @c Cmd is a pseudo key which is Control for PC and Unix platforms but
+ Apple (or Command) key under Macs: it makes often sense to use it
+ instead of ControlDown() because @c Command key is used for the same
+ thing under Mac as @c Control elsewhere (even though @c Control still
+ exists, it is usually not used for the same purpose under Mac).
+
+ Notice that GetModifiers() should usually be used instead of this one.
+ */
+ bool CmdDown() const;
+};
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/mousestate.h
+// Purpose: documentation of wxMouseState
+// Author: wxWidgets team
+// Created: 2008-09-19
+// RCS-ID: $Id$
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+
+/**
+ @class wxMouseState
+
+ Represents the mouse state.
+
+ This class is used as a base class by wxMouseEvent and so its methods may
+ be used to obtain information about the mouse state for the mouse events.
+ It also inherits from wxKeyboardState and so carries information about the
+ keyboard state and not only the mouse one.
+
+ This class is implemented entirely inline in @<wx/mousestate.h@> and thus
+ has no linking requirements.
+
+ @category{misc}
+
+ @see wxGetMouseState(), wxMouseEvent
+ */
+class wxMouseState : public wxKeyboardState
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxMouseState();
+
+ /**
+ Returns X coordinate of the physical mouse event position.
+ */
+ wxCoord GetX() const;
+ /**
+ Returns Y coordinate of the physical mouse event position.
+ */
+ wxCoord GetY() const;
+ /**
+ Returns the physical mouse position.
+ */
+ wxPoint GetPosition() const;
+
+ /**
+ Returns @true if the left mouse button changed to down.
+ */
+ bool LeftDown() const;
+ /**
+ Returns @true if the middle mouse button changed to down.
+ */
+ bool MiddleDown() const;
+ /**
+ Returns @true if the right mouse button changed to down.
+ */
+ bool RightDown() const;
+ /**
+ Returns @true if the first extra button mouse button changed to down.
+ */
+ bool Aux1Down() const;
+ /**
+ Returns @true if the second extra button mouse button changed to down.
+ */
+ bool Aux2Down() const;
+};
+
+
-/**
- @class wxMouseState
-
- Represents the mouse state.
-
- The methods of this class generally mirror the corresponding methods of
- wxMouseEvent.
-
- This class is implemented entirely in @<wx/utils.h@>, meaning no extra
- library needs to be linked to use this class.
-
- @category{misc}
-
- @see wxGetMouseState()
- */
-class wxMouseState
-{
-public:
- /**
- Default constructor.
- */
- wxMouseState();
-
- /**
- Returns X coordinate of the physical mouse event position.
- */
- wxCoord GetX() const;
- /**
- Returns Y coordinate of the physical mouse event position.
- */
- wxCoord GetY() const;
- /**
- Returns the physical mouse position.
- */
- wxPoint GetPosition() const;
-
- /**
- Returns @true if the left mouse button changed to down.
- */
- bool LeftDown() const;
- /**
- Returns @true if the middle mouse button changed to down.
- */
- bool MiddleDown() const;
- /**
- Returns @true if the right mouse button changed to down.
- */
- bool RightDown() const;
- /**
- Returns @true if the first extra button mouse button changed to down.
- */
- bool Aux1Down() const;
- /**
- Returns @true if the second extra button mouse button changed to down.
- */
- bool Aux2Down() const;
-
- /**
- Returns @true if the control key is down.
- */
- bool ControlDown() const;
- /**
- Returns @true if the shift key is down.
- */
- bool ShiftDown() const;
- /**
- Returns @true if the alt key is down.
- */
- bool AltDown() const;
- /**
- Returns @true if the meta key is down.
- */
- bool MetaDown() const;
- /**
- Same as MetaDown() under Mac systems, ControlDown() for the others.
- */
- bool CmdDown() const;
-};
-
-
// ============================================================================
// Global functions/macros
// ============================================================================
m_propagationLevel = wxEVENT_PROPAGATE_NONE;
}
-wxEvent::wxEvent(const wxEvent &src)
+wxEvent::wxEvent(const wxEvent& src)
: wxObject(src)
, m_eventObject(src.m_eventObject)
, m_eventType(src.m_eventType)
{
}
+wxEvent& wxEvent::operator=(const wxEvent& src)
+{
+ wxObject::operator=(src);
+
+ m_eventObject = src.m_eventObject;
+ m_eventType = src.m_eventType;
+ m_timeStamp = src.m_timeStamp;
+ m_id = src.m_id;
+ m_callbackUserData = src.m_callbackUserData;
+ m_propagationLevel = src.m_propagationLevel;
+ m_skipped = src.m_skipped;
+ m_isCommandEvent = src.m_isCommandEvent;
+
+ return *this;
+}
+
#endif // wxUSE_BASE
#if wxUSE_GUI
m_aux1Down = false;
m_aux2Down = false;
- m_controlDown = false;
- m_shiftDown = false;
- m_altDown = false;
- m_metaDown = false;
-
m_clickCount = -1;
m_wheelRotation = 0;
void wxMouseEvent::Assign(const wxMouseEvent& event)
{
- m_eventType = event.m_eventType;
+ wxEvent::operator=(event);
+ wxMouseState::operator=(event);
m_x = event.m_x;
m_y = event.m_y;
m_aux1Down = event.m_aux1Down;
m_aux2Down = event.m_aux2Down;
- m_controlDown = event.m_controlDown;
- m_shiftDown = event.m_shiftDown;
- m_altDown = event.m_altDown;
- m_metaDown = event.m_metaDown;
-
m_wheelRotation = event.m_wheelRotation;
m_wheelDelta = event.m_wheelDelta;
m_linesPerAction = event.m_linesPerAction;
wxKeyEvent::wxKeyEvent(wxEventType type)
{
m_eventType = type;
- m_shiftDown = false;
- m_controlDown = false;
- m_metaDown = false;
- m_altDown = false;
m_keyCode = 0;
m_scanCode = 0;
#if wxUSE_UNICODE
}
wxKeyEvent::wxKeyEvent(const wxKeyEvent& evt)
- : wxEvent(evt)
+ : wxEvent(evt),
+ wxKeyboardState(evt)
{
m_x = evt.m_x;
m_y = evt.m_y;
m_keyCode = evt.m_keyCode;
- m_controlDown = evt.m_controlDown;
- m_shiftDown = evt.m_shiftDown;
- m_altDown = evt.m_altDown;
- m_metaDown = evt.m_metaDown;
m_scanCode = evt.m_scanCode;
m_rawCode = evt.m_rawCode;
m_rawFlags = evt.m_rawFlags;