X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ae3c17b4013e80b99976c750c19fca47729517f6..a70ab3b804b6c363f8bcbed0b4fce94b7fb03612:/interface/wx/event.h diff --git a/interface/wx/event.h b/interface/wx/event.h index 8c051f00d8..22e06d8fe6 100644 --- a/interface/wx/event.h +++ b/interface/wx/event.h @@ -11,7 +11,6 @@ /** @class wxEvent - @wxheader{event.h} An event is a structure holding information about an event passed to a callback or member function. @@ -172,7 +171,6 @@ protected: /** @class wxEventBlocker - @wxheader{event.h} This class is a special event handler which allows to discard any event (or a set of event types) directed to a specific window. @@ -215,7 +213,7 @@ public: 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 @@ -233,7 +231,6 @@ public: /** @class wxEvtHandler - @wxheader{event.h} A class that can handle events from the windowing system. wxWindow (and therefore all window classes) are derived from this class. @@ -322,7 +319,7 @@ public: wxString object which happens because the wxString field in the original @a event object and its copy made internally by this function share the same string buffer internally. Use QueueEvent() to avoid - this. + this. A copy of 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 @@ -420,8 +417,8 @@ public: @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); @@ -443,8 +440,8 @@ public: 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); @@ -635,7 +632,6 @@ public: /** @class wxKeyEvent - @wxheader{event.h} This event class contains information about keypress (character) events. @@ -702,10 +698,13 @@ public: Process a wxEVT_CHAR event. @endEventTable + @see wxKeyboardState + @library{wxcore} @category{events} */ -class wxKeyEvent : public wxEvent +class wxKeyEvent : public wxEvent, + public wxKeyboardState { public: /** @@ -714,32 +713,6 @@ 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 @@ -751,33 +724,6 @@ public: */ 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. @@ -821,40 +767,12 @@ public: 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; }; /** @class wxJoystickEvent - @wxheader{event.h} This event class contains information about joystick events, particularly events received by windows. @@ -967,7 +885,6 @@ public: /** @class wxScrollWinEvent - @wxheader{event.h} A scroll event holds information about events sent from scrolling windows. @@ -1032,7 +949,6 @@ public: /** @class wxSysColourChangedEvent - @wxheader{event.h} This class is used for system colour change events, which are generated when the user changes the colour settings using the control panel. @@ -1067,7 +983,6 @@ public: /** @class wxWindowCreateEvent - @wxheader{event.h} This event is sent just after the actual window associated with a wxWindow object has been created. @@ -1098,7 +1013,6 @@ public: /** @class wxPaintEvent - @wxheader{event.h} A paint event is sent when a window's contents needs to be repainted. @@ -1180,7 +1094,6 @@ public: /** @class wxMaximizeEvent - @wxheader{event.h} An event being sent when a top level window is maximized. Notice that it is not sent when the window is restored to its original size after it had been @@ -1222,7 +1135,6 @@ enum wxUpdateUIMode /** @class wxUpdateUIEvent - @wxheader{event.h} This class is used for pseudo-events which are called by wxWidgets to give an application the chance to update various user interface elements. @@ -1422,7 +1334,6 @@ public: /** @class wxClipboardTextEvent - @wxheader{event.h} This class represents the events generated by a control (typically a wxTextCtrl but other windows can generate these events as well) when its @@ -1475,7 +1386,6 @@ public: /** @class wxMouseEvent - @wxheader{event.h} This event class contains information about the events generated by the mouse: they include mouse buttons press and release events and mouse move events. @@ -1559,9 +1469,10 @@ public: @library{wxcore} @category{events} - @see wxKeyEvent::CmdDown + @see wxKeyEvent */ -class wxMouseEvent : public wxEvent +class wxMouseEvent : public wxEvent, + public wxMouseState { public: /** @@ -1589,11 +1500,6 @@ 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. */ @@ -1672,18 +1578,6 @@ public: */ 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). @@ -1878,18 +1772,12 @@ public: 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; }; /** @class wxDropFilesEvent - @wxheader{event.h} This class is used for drop files events, that is, when files have been dropped onto the window. This functionality is currently only available under Windows. @@ -1943,7 +1831,6 @@ public: /** @class wxCommandEvent - @wxheader{event.h} This event class contains information about command events, which originate from a variety of simple controls. @@ -2034,7 +1921,7 @@ public: /** 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 @@ -2131,7 +2018,6 @@ public: /** @class wxActivateEvent - @wxheader{event.h} An activate event is sent when a window or application is being activated or deactivated. @@ -2174,7 +2060,6 @@ public: /** @class wxContextMenuEvent - @wxheader{event.h} This class is used for context menu events, sent to give the application a chance to show a context (popup) menu. @@ -2231,7 +2116,6 @@ public: /** @class wxEraseEvent - @wxheader{event.h} An erase event is sent when a window's background needs to be repainted. @@ -2278,7 +2162,6 @@ public: /** @class wxFocusEvent - @wxheader{event.h} A focus event is sent when a window's focus changes. The window losing focus receives a "kill focus" event while the window gaining it gets a "set focus" one. @@ -2321,7 +2204,6 @@ public: /** @class wxChildFocusEvent - @wxheader{event.h} A child focus event is sent to a (parent-)window when one of its child windows gains focus, so that the window could restore the focus back to its corresponding @@ -2365,7 +2247,6 @@ public: /** @class wxMouseCaptureLostEvent - @wxheader{event.h} An mouse capture lost event is sent to a window that obtained mouse capture, which was subsequently loss due to "external" event, for example when a dialog @@ -2404,10 +2285,9 @@ public: /** @class wxNotifyEvent - @wxheader{event.h} This class is not used by the event handlers by itself, but is a base class - for other event classes (such as wxNotebookEvent). + for other event classes (such as wxBookCtrlEvent). It (or an object of a derived class) is sent when the controls state is being changed and allows the program to wxNotifyEvent::Veto() this change if it wants @@ -2416,7 +2296,7 @@ public: @library{wxcore} @category{events} - @see wxNotebookEvent + @see wxBookCtrlEvent */ class wxNotifyEvent : public wxCommandEvent { @@ -2453,13 +2333,10 @@ public: -/** - 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). */ @@ -2468,7 +2345,6 @@ enum wxHelpEventOrigin /** @class wxHelpEvent - @wxheader{event.h} A help event is sent when the user has requested context-sensitive help. This can either be caused by the application requesting context-sensitive help mode @@ -2503,13 +2379,26 @@ enum wxHelpEventOrigin 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 @@ -2520,7 +2409,7 @@ public: @see SetOrigin() */ - wxHelpEventOrigin GetOrigin() const; + wxHelpEvent::Origin GetOrigin() const; /** Returns the left-click position of the mouse, in screen coordinates. @@ -2533,7 +2422,7 @@ public: @see GetOrigin() */ - void SetOrigin(wxHelpEventOrigin); + void SetOrigin(wxHelpEvent::Origin origin); /** Sets the left-click position of the mouse, in screen coordinates. @@ -2545,7 +2434,6 @@ public: /** @class wxScrollEvent - @wxheader{event.h} A scroll event holds information about events sent from stand-alone scrollbars (see wxScrollBar) and sliders (see wxSlider). @@ -2555,7 +2443,7 @@ public: 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 @@ -2664,7 +2552,6 @@ enum wxIdleMode /** @class wxIdleEvent - @wxheader{event.h} This class is used for idle events, which are generated when the system becomes idle. Note that, unless you do something specifically, the idle events are not @@ -2764,7 +2651,6 @@ public: /** @class wxInitDialogEvent - @wxheader{event.h} A wxInitDialogEvent is sent as a dialog or panel is being initialised. Handlers for this event can transfer data to the window. @@ -2794,7 +2680,6 @@ public: /** @class wxWindowDestroyEvent - @wxheader{event.h} This event is sent from the wxWindow destructor wxWindow::~wxWindow() when a window is destroyed. @@ -2837,7 +2722,6 @@ enum wxNavigationKeyEventFlags /** @class wxNavigationKeyEvent - @wxheader{event.h} This event class contains information about navigation events, generated by navigation keys such as tab and page down. @@ -2917,7 +2801,6 @@ public: /** @class wxMouseCaptureChangedEvent - @wxheader{event.h} An mouse capture changed event is sent to a window that loses its mouse capture. This is called even if wxWindow::ReleaseCapture @@ -2958,7 +2841,6 @@ public: /** @class wxCloseEvent - @wxheader{event.h} This event class contains information about window and session close events. @@ -3035,11 +2917,6 @@ public: */ void SetCanVeto(bool canVeto); - /** - Sets the 'force' flag. - */ - void SetForce(bool force) const; - /** Sets the 'logging off' flag. */ @@ -3058,7 +2935,6 @@ public: /** @class wxMenuEvent - @wxheader{event.h} This class is used for a variety of menu-related events. Note that these do not include menu command events, which are @@ -3117,7 +2993,6 @@ public: /** @class wxShowEvent - @wxheader{event.h} An event being sent when the window is shown or hidden. @@ -3166,7 +3041,6 @@ public: /** @class wxIconizeEvent - @wxheader{event.h} An event being sent when the frame is iconized (minimized) or restored. @@ -3209,7 +3083,6 @@ public: /** @class wxMoveEvent - @wxheader{event.h} A move event holds information about move change events. @@ -3246,7 +3119,6 @@ public: /** @class wxSizeEvent - @wxheader{event.h} A size event holds information about size change events. @@ -3290,9 +3162,8 @@ public: /** @class wxSetCursorEvent - @wxheader{event.h} - A SetCursorEvent is generated when the mouse cursor is about to be set as a + A wxSetCursorEvent is generated when the mouse cursor is about to be set as a result of mouse motion. This event gives the application the chance to perform specific mouse cursor