Note that the @a win window @b must remain alive until the
wxEventBlocker object destruction.
*/
- wxEventBlocker(wxWindow* win, wxEventType = wxEVT_ANY);
+ wxEventBlocker(wxWindow* win, wxEventType type = -1);
/**
Destructor. The blocker will remove itself from the chain of event handlers for
share the same string buffer internally. Use QueueEvent() to avoid
this.
- A copy of event is made by the function, so the original can be deleted
+ A copy of @a event is made by the function, so the original can be deleted
as soon as function returns (it is common that the original is created
on the stack). This requires that the wxEvent::Clone() method be
implemented by event so that it can be duplicated and stored until it
@param eventSink
Object whose member function should be called.
*/
- bool Disconnect(wxEventType eventType = wxEVT_NULL,
- wxObjectEventFunction function = NULL,
+ bool Disconnect(wxEventType eventType,
+ wxObjectEventFunction function,
wxObject* userData = NULL,
wxEvtHandler* eventSink = NULL);
This overload takes an additional range of source IDs.
*/
- bool Disconnect(int id, int lastId = wxID_ANY,
- wxEventType eventType = wxEVT_NULL,
+ bool Disconnect(int id, int lastId,
+ wxEventType eventType,
wxObjectEventFunction function = NULL,
wxObject* userData = NULL,
wxEvtHandler* eventSink = NULL);
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;
};
The value of wxCommandEvent::GetSelection() is the tool id, or -1 if the mouse cursor
has moved off a tool.
@event{EVT_COMMAND_LEFT_CLICK(id, func)}
- Process a wxEVT_COMMAND_LEFT_CLICK command, which is generated by a control (Windows 95 and NT only).
+ Process a wxEVT_COMMAND_LEFT_CLICK command, which is generated by a control (wxMSW only).
@event{EVT_COMMAND_LEFT_DCLICK(id, func)}
- Process a wxEVT_COMMAND_LEFT_DCLICK command, which is generated by a control (Windows 95 and NT only).
+ Process a wxEVT_COMMAND_LEFT_DCLICK command, which is generated by a control (wxMSW only).
@event{EVT_COMMAND_RIGHT_CLICK(id, func)}
- Process a wxEVT_COMMAND_RIGHT_CLICK command, which is generated by a control (Windows 95 and NT only).
+ Process a wxEVT_COMMAND_RIGHT_CLICK command, which is generated by a control (wxMSW only).
@event{EVT_COMMAND_SET_FOCUS(id, func)}
- Process a wxEVT_COMMAND_SET_FOCUS command, which is generated by a control (Windows 95 and NT only).
+ Process a wxEVT_COMMAND_SET_FOCUS command, which is generated by a control (wxMSW only).
@event{EVT_COMMAND_KILL_FOCUS(id, func)}
- Process a wxEVT_COMMAND_KILL_FOCUS command, which is generated by a control (Windows 95 and NT only).
+ Process a wxEVT_COMMAND_KILL_FOCUS command, which is generated by a control (wxMSW only).
@event{EVT_COMMAND_ENTER(id, func)}
Process a wxEVT_COMMAND_ENTER command, which is generated by a control.
@endEventTable
/**
Constructor.
*/
- wxCommandEvent(wxEventType commandEventType = 0, int id = 0);
+ wxCommandEvent(wxEventType commandEventType = wxEVT_NULL, int id = 0);
/**
Returns client data pointer for a listbox or choice selection event
-/**
- Indicates how a wxHelpEvent was generated.
-*/
enum wxHelpEventOrigin
{
- wxHE_ORIGIN_UNKNOWN = -1, /**< unrecognized event source. */
- wxHE_ORIGIN_KEYBOARD, /**< event generated from F1 key press. */
+ wxHE_ORIGIN_UNKNOWN = -1,
+ wxHE_ORIGIN_KEYBOARD,
/** event generated by wxContextHelp or from the [?] button on
the title bar (Windows). */
class wxHelpEvent : public wxCommandEvent
{
public:
+ /**
+ Indicates how a wxHelpEvent was generated.
+ */
+ enum Origin
+ {
+ Origin_Unknown, /**< unrecognized event source. */
+ Origin_Keyboard, /**< event generated from F1 key press. */
+
+ /** event generated by wxContextHelp or from the [?] button on
+ the title bar (Windows). */
+ Origin_HelpButton
+ };
+
/**
Constructor.
*/
wxHelpEvent(wxEventType type = wxEVT_NULL,
wxWindowID winid = 0,
const wxPoint& pt = wxDefaultPosition,
- wxHelpEventOrigin origin = wxHE_ORIGIN_UNKNOWN);
+ wxHelpEvent::Origin origin = Origin_Unknown);
/**
Returns the origin of the help event which is one of the ::wxHelpEventOrigin
@see SetOrigin()
*/
- wxHelpEventOrigin GetOrigin() const;
+ wxHelpEvent::Origin GetOrigin() const;
/**
Returns the left-click position of the mouse, in screen coordinates.
@see GetOrigin()
*/
- void SetOrigin(wxHelpEventOrigin);
+ void SetOrigin(wxHelpEvent::Origin origin);
/**
Sets the left-click position of the mouse, in screen coordinates.
events and use the event table macros mentioned below only for the scrollbar-like
controls.
- @section wxscrollevent_diff The difference between EVT_SCROLL_THUMBRELEASE and EVT_SCROLL_CHANGED
+ @section scrollevent_diff The difference between EVT_SCROLL_THUMBRELEASE and EVT_SCROLL_CHANGED
The EVT_SCROLL_THUMBRELEASE event is only emitted when actually dragging the thumb
using the mouse and releasing it (This EVT_SCROLL_THUMBRELEASE event is also followed
*/
void SetCanVeto(bool canVeto);
- /**
- Sets the 'force' flag.
- */
- void SetForce(bool force) const;
-
/**
Sets the 'logging off' flag.
*/