the chain until the event is processed or the chain is exhausted.
This function is called from ProcessEvent() and, in turn, calls
- TryThis() for each handler in turn. It is not virtual and so cannot be
+ TryBefore() and TryAfter(). It is not virtual and so cannot be
overridden but can, and should, be called to forward an event to
another handler instead of ProcessEvent() which would result in a
duplicate call to TryAfter(), e.g. resulting in all unprocessed events
*/
virtual bool TryBefore(wxEvent& event);
- /**
- Try to process the event in this event handler.
-
- This method is called from ProcessEventLocally() and thus, indirectly,
- from ProcessEvent(), please see the detailed description of the event
- processing logic there.
-
- It is currently @em not virtual and so may not be overridden.
-
- @since 2.9.1
-
- @param event
- Event to process.
- @return
- @true if this object itself defines a handler for this event and
- the handler didn't skip the event.
- */
- bool TryThis(wxEvent& event);
-
/**
Method called by ProcessEvent() as last resort.
else
{
// It's a special key, deal with all the known ones:
- switch ( keycode )
+ switch ( GetKeyCode() )
{
case WXK_LEFT:
case WXK_RIGHT:
wxClipboardTextEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
};
+/**
+ Possible axis values for mouse wheel scroll events.
+
+ @since 2.9.4
+ */
+enum wxMouseWheelAxis
+{
+ wxMOUSE_WHEEL_VERTICAL, ///< Vertical scroll event.
+ wxMOUSE_WHEEL_HORIZONTAL ///< Horizontal scroll event.
+};
/**
int GetWheelRotation() const;
/**
- Gets the axis the wheel operation concerns; @c 0 is the Y axis as on
- most mouse wheels, @c 1 is the X axis.
+ Gets the axis the wheel operation concerns.
+
+ Usually the mouse wheel is used to scroll vertically so @c
+ wxMOUSE_WHEEL_VERTICAL is returned but some mice (and most trackpads)
+ also allow to use the wheel to scroll horizontally in which case
+ @c wxMOUSE_WHEEL_HORIZONTAL is returned.
- Note that only some models of mouse have horizontal wheel axis.
+ Notice that before wxWidgets 2.9.4 this method returned @c int.
*/
- int GetWheelAxis() const;
+ wxMouseWheelAxis GetWheelAxis() const;
/**
Returns @true if the event was a mouse button event (not necessarily a button
wxClientData* GetClientObject() const;
/**
- Returns extra information dependant on the event objects type.
+ Returns extra information dependent on the event objects type.
If the event comes from a listbox selection, it is a boolean
determining whether the event was a selection (@true) or a
window (whether using the mouse or keyboard) and when it is done from the
program itself using wxWindow::SetFocus.
+ The focus event handlers should almost invariably call wxEvent::Skip() on
+ their event argument to allow the default handling to take place. Failure
+ to do this may result in incorrect behaviour of the native controls. Also
+ note that wxEVT_KILL_FOCUS handler must not call wxWindow::SetFocus() as
+ this, again, is not supported by all native controls. If you need to do
+ this, consider using the @ref sec_delayed_action described in wxIdleEvent
+ documentation.
+
@beginEventTable{wxFocusEvent}
@event{EVT_SET_FOCUS(func)}
Process a @c wxEVT_SET_FOCUS event.
@library{wxbase}
@category{events}
+ @section sec_delayed_action Delayed Action Mechanism
+
+ wxIdleEvent can be used to perform some action "at slightly later time".
+ This can be necessary in several circumstances when, for whatever reason,
+ something can't be done in the current event handler. For example, if a
+ mouse event handler is called with the mouse button pressed, the mouse can
+ be currently captured and some operations with it -- notably capturing it
+ again -- might be impossible or lead to undesirable results. If you still
+ want to capture it, you can do it from @c wxEVT_IDLE handler when it is
+ called the next time instead of doing it immediately.
+
+ This can be achieved in two different ways: when using static event tables,
+ you will need a flag indicating to the (always connected) idle event
+ handler whether the desired action should be performed. The originally
+ called handler would then set it to indicate that it should indeed be done
+ and the idle handler itself would reset it to prevent it from doing the
+ same action again.
+
+ Using dynamically connected event handlers things are even simpler as the
+ original event handler can simply wxEvtHandler::Connect() or
+ wxEvtHandler::Bind() the idle event handler which would only be executed
+ then and could wxEvtHandler::Disconnect() or wxEvtHandler::Unbind() itself.
+
+
@see @ref overview_events, wxUpdateUIEvent, wxWindow::OnInternalIdle
*/
class wxIdleEvent : public wxEvent