X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e47ce385a75d78babaaac68d47d6f4dd5230a31c..a9a04486a2fc7be11a42343070ff8dd859618c46:/wxPython/src/_event.i diff --git a/wxPython/src/_event.i b/wxPython/src/_event.i index 05aef22285..979fbf1604 100644 --- a/wxPython/src/_event.i +++ b/wxPython/src/_event.i @@ -99,8 +99,16 @@ wxEventType wxNewEventType(); %constant wxEventType wxEVT_NAVIGATION_KEY; %constant wxEventType wxEVT_KEY_DOWN; %constant wxEventType wxEVT_KEY_UP; + +%{ +#if ! wxUSE_HOTKEY +#define wxEVT_HOTKEY -9999 +#endif +%} + %constant wxEventType wxEVT_HOTKEY; - + + // Set cursor event %constant wxEventType wxEVT_SET_CURSOR; @@ -113,7 +121,9 @@ wxEventType wxNewEventType(); %constant wxEventType wxEVT_SCROLL_PAGEDOWN; %constant wxEventType wxEVT_SCROLL_THUMBTRACK; %constant wxEventType wxEVT_SCROLL_THUMBRELEASE; -%constant wxEventType wxEVT_SCROLL_ENDSCROLL; +%constant wxEventType wxEVT_SCROLL_CHANGED; +%pythoncode { wxEVT_SCROLL_ENDSCROLL = wxEVT_SCROLL_CHANGED } + // Scroll events from wxWindow %constant wxEventType wxEVT_SCROLLWIN_TOP; @@ -132,7 +142,6 @@ wxEventType wxNewEventType(); %constant wxEventType wxEVT_END_SESSION; %constant wxEventType wxEVT_QUERY_END_SESSION; %constant wxEventType wxEVT_ACTIVATE_APP; -%constant wxEventType wxEVT_POWER; %constant wxEventType wxEVT_ACTIVATE; %constant wxEventType wxEVT_CREATE; %constant wxEventType wxEVT_DESTROY; @@ -165,6 +174,10 @@ wxEventType wxNewEventType(); %constant wxEventType wxEVT_MOVING; %constant wxEventType wxEVT_HIBERNATE; +%constant wxEventType wxEVT_COMMAND_TEXT_COPY; +%constant wxEventType wxEVT_COMMAND_TEXT_CUT; +%constant wxEventType wxEVT_COMMAND_TEXT_PASTE; + // Generic command events // Note: a click is a higher-level event than button down/up @@ -194,7 +207,7 @@ EVT_ERASE_BACKGROUND = wx.PyEventBinder( wxEVT_ERASE_BACKGROUND ) EVT_CHAR = wx.PyEventBinder( wxEVT_CHAR ) EVT_KEY_DOWN = wx.PyEventBinder( wxEVT_KEY_DOWN ) EVT_KEY_UP = wx.PyEventBinder( wxEVT_KEY_UP ) -EVT_HOTKEY = wx.PyEventBinder( wxEVT_HOTKEY, 1) +EVT_HOTKEY = wx.PyEventBinder( wxEVT_HOTKEY, 1) EVT_CHAR_HOOK = wx.PyEventBinder( wxEVT_CHAR_HOOK ) EVT_MENU_OPEN = wx.PyEventBinder( wxEVT_MENU_OPEN ) EVT_MENU_CLOSE = wx.PyEventBinder( wxEVT_MENU_CLOSE ) @@ -205,7 +218,7 @@ EVT_KILL_FOCUS = wx.PyEventBinder( wxEVT_KILL_FOCUS ) EVT_CHILD_FOCUS = wx.PyEventBinder( wxEVT_CHILD_FOCUS ) EVT_ACTIVATE = wx.PyEventBinder( wxEVT_ACTIVATE ) EVT_ACTIVATE_APP = wx.PyEventBinder( wxEVT_ACTIVATE_APP ) -EVT_HIBERNATE = wx.PyEventBinder( wxEVT_HIBERNATE ) +EVT_HIBERNATE = wx.PyEventBinder( wxEVT_HIBERNATE ) EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION ) EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION ) EVT_DROP_FILES = wx.PyEventBinder( wxEVT_DROP_FILES ) @@ -254,11 +267,11 @@ EVT_MOUSE_EVENTS = wx.PyEventBinder([ wxEVT_LEFT_DOWN, %# Scrolling from wxWindow (sent to wxScrolledWindow) -EVT_SCROLLWIN = wx.PyEventBinder([ wxEVT_SCROLLWIN_TOP, +EVT_SCROLLWIN = wx.PyEventBinder([ wxEVT_SCROLLWIN_TOP, wxEVT_SCROLLWIN_BOTTOM, wxEVT_SCROLLWIN_LINEUP, wxEVT_SCROLLWIN_LINEDOWN, - wxEVT_SCROLLWIN_PAGEUP, + wxEVT_SCROLLWIN_PAGEUP, wxEVT_SCROLLWIN_PAGEDOWN, wxEVT_SCROLLWIN_THUMBTRACK, wxEVT_SCROLLWIN_THUMBRELEASE, @@ -274,15 +287,15 @@ EVT_SCROLLWIN_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBTRACK ) EVT_SCROLLWIN_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBRELEASE ) %# Scrolling from wx.Slider and wx.ScrollBar -EVT_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP, - wxEVT_SCROLL_BOTTOM, - wxEVT_SCROLL_LINEUP, - wxEVT_SCROLL_LINEDOWN, - wxEVT_SCROLL_PAGEUP, - wxEVT_SCROLL_PAGEDOWN, - wxEVT_SCROLL_THUMBTRACK, - wxEVT_SCROLL_THUMBRELEASE, - wxEVT_SCROLL_ENDSCROLL, +EVT_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP, + wxEVT_SCROLL_BOTTOM, + wxEVT_SCROLL_LINEUP, + wxEVT_SCROLL_LINEDOWN, + wxEVT_SCROLL_PAGEUP, + wxEVT_SCROLL_PAGEDOWN, + wxEVT_SCROLL_THUMBTRACK, + wxEVT_SCROLL_THUMBRELEASE, + wxEVT_SCROLL_CHANGED, ]) EVT_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP ) @@ -293,18 +306,19 @@ EVT_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP ) EVT_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN ) EVT_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK ) EVT_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE ) -EVT_SCROLL_ENDSCROLL = wx.PyEventBinder( wxEVT_SCROLL_ENDSCROLL ) +EVT_SCROLL_CHANGED = wx.PyEventBinder( wxEVT_SCROLL_CHANGED ) +EVT_SCROLL_ENDSCROLL = EVT_SCROLL_CHANGED %# Scrolling from wx.Slider and wx.ScrollBar, with an id -EVT_COMMAND_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP, - wxEVT_SCROLL_BOTTOM, - wxEVT_SCROLL_LINEUP, - wxEVT_SCROLL_LINEDOWN, - wxEVT_SCROLL_PAGEUP, - wxEVT_SCROLL_PAGEDOWN, - wxEVT_SCROLL_THUMBTRACK, +EVT_COMMAND_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP, + wxEVT_SCROLL_BOTTOM, + wxEVT_SCROLL_LINEUP, + wxEVT_SCROLL_LINEDOWN, + wxEVT_SCROLL_PAGEUP, + wxEVT_SCROLL_PAGEDOWN, + wxEVT_SCROLL_THUMBTRACK, wxEVT_SCROLL_THUMBRELEASE, - wxEVT_SCROLL_ENDSCROLL, + wxEVT_SCROLL_CHANGED, ], 1) EVT_COMMAND_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP, 1) @@ -315,7 +329,8 @@ EVT_COMMAND_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP, 1) EVT_COMMAND_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN, 1) EVT_COMMAND_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK, 1) EVT_COMMAND_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE, 1) -EVT_COMMAND_SCROLL_ENDSCROLL = wx.PyEventBinder( wxEVT_SCROLL_ENDSCROLL, 1) +EVT_COMMAND_SCROLL_CHANGED = wx.PyEventBinder( wxEVT_SCROLL_CHANGED, 1) +EVT_COMMAND_SCROLL_ENDSCROLL = EVT_COMMAND_SCROLL_CHANGED EVT_BUTTON = wx.PyEventBinder( wxEVT_COMMAND_BUTTON_CLICKED, 1) EVT_CHECKBOX = wx.PyEventBinder( wxEVT_COMMAND_CHECKBOX_CLICKED, 1) @@ -354,6 +369,9 @@ EVT_UPDATE_UI_RANGE = wx.PyEventBinder( wxEVT_UPDATE_UI, 2) EVT_CONTEXT_MENU = wx.PyEventBinder( wxEVT_CONTEXT_MENU ) +EVT_TEXT_CUT = wx.PyEventBinder( wxEVT_COMMAND_TEXT_CUT ) +EVT_TEXT_COPY = wx.PyEventBinder( wxEVT_COMMAND_TEXT_COPY ) +EVT_TEXT_PASTE = wx.PyEventBinder( wxEVT_COMMAND_TEXT_PASTE ) } @@ -373,43 +391,43 @@ public: DocDeclStr( void , SetEventType(wxEventType typ), "Sets the specific type of the event.", ""); - + DocDeclStr( wxEventType , GetEventType() const, "Returns the identifier of the given event type, such as ``wxEVT_COMMAND_BUTTON_CLICKED``.", ""); - + DocDeclStr( wxObject *, GetEventObject() const, "Returns the object (usually a window) associated with the event, if any.", ""); - + DocDeclStr( void , SetEventObject(wxObject *obj), "Sets the originating object, or in other words, obj is normally the object that is sending the event.", ""); - + long GetTimestamp() const; void SetTimestamp(long ts = 0); - + DocDeclStr( int , GetId() const, "Returns the identifier associated with this event, such as a button command id.", ""); - + DocDeclStr( void , SetId(int Id), "Set's the ID for the event. This is usually the ID of the window that is sending the event, but it can also be a command id from a menu item, etc.", ""); - + DocDeclStr( bool , IsCommandEvent() const, "Returns true if the event is or is derived from `wx.CommandEvent` else it returns false. Note: Exists only for optimization purposes.", ""); - + DocDeclStr( void , Skip(bool skip = true), @@ -421,18 +439,18 @@ returned to the sender of the event immediately after the current handler has finished. Skip(True) will cause the event processing system to continue searching for a handler function for this event. ", ""); - + DocDeclStr( bool , GetSkipped() const, "Returns true if the event handler should be skipped, false otherwise. :see: `Skip`", ""); - + DocDeclStr( bool , ShouldPropagate() const, "Test if this event should be propagated to the parent window or not, i.e. if the propagation level is currently greater than 0.", ""); - + // Stop an event from propagating to its parent window, returns the old // propagation level value @@ -441,7 +459,7 @@ i.e. if the propagation level is currently greater than 0.", ""); "Stop the event from propagating to its parent window. Returns the old propagation level value which may be later passed to `ResumePropagation` to allow propagating the event again.", ""); - + DocDeclStr( void , ResumePropagation(int propagationLevel), @@ -449,7 +467,7 @@ propagation level value which may be later passed to example, you can use the value returned by an earlier call to `StopPropagation`.) ", ""); - + // this function is used to create a copy of the event polymorphically and // all derived classes must implement it because otherwise wxPostEvent() @@ -506,19 +524,19 @@ public: // void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; } // void *GetClientObject() const { return m_clientObject; } - + DocDeclStr( int , GetSelection() const, "Returns item index for a listbox or choice selection event (not valid for a deselection).", ""); - + void SetString(const wxString& s); DocDeclStr( wxString , GetString() const, "Returns item string for a listbox or choice selection event (not valid for a deselection).", ""); - + DocDeclStr( bool , IsChecked() const, @@ -527,14 +545,14 @@ checkboxes, the method returns true for a selection event and false for a deselection one. For the menu events, this method indicates if the menu item just has become checked or unchecked (and thus only makes sense for checkable menu items).", ""); - + %pythoncode { Checked = IsChecked } - + DocDeclStr( bool , IsSelection() const, "For a listbox or similar event, returns true if it is a selection, false if it is a deselection.", ""); - + void SetExtraLong(long extraLong); DocDeclStr( @@ -545,15 +563,41 @@ whether the event was a selection (true) or a deselection (false). A listbox deselection only occurs for multiple-selection boxes, and in this case the index and string values are indeterminate and the listbox must be examined by the application.", ""); - + void SetInt(int i); DocDeclStr( - long , GetInt() const, + int , GetInt() const, "Returns the integer identifier corresponding to a listbox, choice or radiobox selection (only if the event was a selection, not a deselection), or a boolean value representing the value of a checkbox.", ""); - + + + %extend { + DocStr(GetClientData, + "Returns the client data object for a listbox or choice selection event, (if any.)", ""); + PyObject* GetClientData() { + wxPyClientData* data = (wxPyClientData*)self->GetClientObject(); + if (data) { + Py_INCREF(data->m_obj); + return data->m_obj; + } else { + Py_INCREF(Py_None); + return Py_None; + } + } + + DocStr(SetClientData, + "Associate the given client data with the item at position n.", ""); + void SetClientData(PyObject* clientData) { + wxPyClientData* data = new wxPyClientData(clientData); + self->SetClientObject(data); + } + } + %pythoncode { + GetClientObject = GetClientData + SetClientObject = SetClientData + } virtual wxEvent *Clone() const; @@ -580,7 +624,7 @@ public: It is in general a good idea to notify the user about the reasons for vetoing the change because otherwise the applications behaviour (which just refuses to do what the user wants) might be quite surprising.", ""); - + DocDeclStr( void , Allow(), @@ -588,13 +632,13 @@ just refuses to do what the user wants) might be quite surprising.", ""); processed. For most events it is not necessary to call this method as the events are allowed anyhow but some are forbidden by default (this will be mentioned in the corresponding event description).", ""); - + DocDeclStr( bool , IsAllowed(), "Returns true if the change is allowed (`Veto` hasn't been called) or false otherwise (if it was).", ""); - + }; @@ -654,11 +698,11 @@ public: int , GetOrientation() const, "Returns wx.HORIZONTAL or wx.VERTICAL, depending on the orientation of the scrollbar.", ""); - + DocDeclStr( int , GetPosition() const, "Returns the position of the scrollbar.", ""); - + void SetOrientation(int orient); void SetPosition(int pos); }; @@ -700,13 +744,13 @@ public: int , GetOrientation() const, "Returns wx.HORIZONTAL or wx.VERTICAL, depending on the orientation of the scrollbar.", ""); - + DocDeclStr( int , GetPosition() const, "Returns the position of the scrollbar for the thumb track and release events. Note that this field can't be used for the other events, you need to query the window itself for the current position in that case.", ""); - + void SetOrientation(int orient); void SetPosition(int pos); }; @@ -801,7 +845,7 @@ public: bool , IsButton() const, "Returns true if the event was a mouse button event (not necessarily a button down event - that may be tested using `ButtonDown`).", ""); - + DocDeclStr( bool , ButtonDown(int but = wxMOUSE_BTN_ANY) const, @@ -809,7 +853,7 @@ button down event - that may be tested using `ButtonDown`).", ""); mouse button down event. Otherwise the argument specifies which button-down event shold be checked for (see `Button` for the possible values).", ""); - + DocDeclStr( bool , ButtonDClick(int but = wxMOUSE_BTN_ANY) const, @@ -817,14 +861,14 @@ values).", ""); mouse double click event. Otherwise the argument specifies which double click event to check for (see `Button` for the possible values).", ""); - + DocDeclStr( bool , ButtonUp(int but = wxMOUSE_BTN_ANY) const, "If the argument is omitted, this returns true if the event was any mouse button up event. Otherwise the argument specifies which button up event to check for (see `Button` for the possible values).", ""); - + DocDeclStr( bool , Button(int button) const, @@ -838,7 +882,7 @@ values of button are: wx.MOUSE_BTN_ANY check if any button was pressed ==================== ===================================== ", ""); - + // Was the given button in Down state? bool ButtonIsDown(int but) const; @@ -851,25 +895,25 @@ leave event, for example). Otherwise wx.MOUSE_BTN_LEFT is returned for the left button down, up and double click events, wx.MOUSE_BTN_MIDDLE and wx.MOUSE_BTN_RIGHT for the same events for the middle and the right buttons respectively.", ""); - + DocDeclStr( bool , ControlDown() const, "Returns true if the control key was down at the time of the event.", ""); - + DocDeclStr( bool , MetaDown() const, "Returns true if the Meta key was down at the time of the event.", ""); - - + + DocDeclStr( bool , AltDown() const, "Returns true if the Alt key was down at the time of the event.", ""); - + DocDeclStr( bool , ShiftDown() const, "Returns true if the Shift key was down at the time of the event.", ""); - + DocDeclStr( bool , CmdDown() const, @@ -880,51 +924,51 @@ because Cmd key is used for the same thing under Mac as Ctrl elsewhere. The Ctrl key still exists, it's just not used for this purpose. So for non-Mac platforms this is the same as `ControlDown` and Macs this is the same as `MetaDown`.", ""); - + DocDeclStr( bool , LeftDown() const, "Returns true if the left mouse button state changed to down.", ""); - + DocDeclStr( bool , MiddleDown() const, "Returns true if the middle mouse button state changed to down.", ""); - + DocDeclStr( bool , RightDown() const, "Returns true if the right mouse button state changed to down.", ""); - - + + DocDeclStr( bool , LeftUp() const, "Returns true if the left mouse button state changed to up.", ""); - + DocDeclStr( bool , MiddleUp() const, "Returns true if the middle mouse button state changed to up.", ""); - + DocDeclStr( bool , RightUp() const, "Returns true if the right mouse button state changed to up.", ""); - - + + DocDeclStr( bool , LeftDClick() const, "Returns true if the event was a left button double click.", ""); - + DocDeclStr( bool , MiddleDClick() const, "Returns true if the event was a middle button double click.", ""); - + DocDeclStr( bool , RightDClick() const, "Returns true if the event was a right button double click.", ""); - - + + DocDeclStr( bool , LeftIsDown(), "Returns true if the left mouse button is currently down, independent @@ -937,41 +981,41 @@ state of the mouse button before the event happened. This event is usually used in the mouse event handlers which process \"move mouse\" messages to determine whether the user is (still) dragging the mouse.", ""); - + DocDeclStr( bool , MiddleIsDown(), "Returns true if the middle mouse button is currently down, independent of the current event type.", ""); - + DocDeclStr( bool , RightIsDown(), "Returns true if the right mouse button is currently down, independent of the current event type.", ""); - - + + DocDeclStr( bool , Dragging() const, "Returns true if this was a dragging event (motion while a button is depressed).", ""); - + DocDeclStr( bool , Moving() const, "Returns true if this was a motion event and no mouse buttons were pressed. If any mouse button is held pressed, then this method returns false and Dragging returns true.", ""); - + DocDeclStr( bool , Entering() const, "Returns true if the mouse was entering the window.", ""); - + DocDeclStr( bool , Leaving() const, "Returns true if the mouse was leaving the window.", ""); - + DocStr(GetPosition, // sets the docstring for both @@ -983,22 +1027,22 @@ event happened.", ""); void, GetPosition(long *OUTPUT, long *OUTPUT), "GetPositionTuple() -> (x,y)", GetPositionTuple); - + DocDeclStr( wxPoint , GetLogicalPosition(const wxDC& dc) const, "Returns the logical mouse position in pixels (i.e. translated according to the translation set for the DC, which usually indicates that the window has been scrolled).", ""); - + DocDeclStr( wxCoord , GetX() const, "Returns X coordinate of the physical mouse event position.", ""); - + DocDeclStr( wxCoord , GetY() const, "Returns Y coordinate of the physical mouse event position.", ""); - + DocDeclStr( int , GetWheelRotation() const, @@ -1009,26 +1053,26 @@ created in the future. Because of this you shouldn't assume that one event is equal to 1 line or whatever, but you should be able to either do partial line scrolling or wait until +/-WheelDelta rotation values have been accumulated before scrolling.", ""); - + DocDeclStr( int , GetWheelDelta() const, "Get wheel delta, normally 120. This is the threshold for action to be taken, and one such action (for example, scrolling one increment) should occur for each delta.", ""); - + DocDeclStr( int , GetLinesPerAction() const, "Returns the configured number of lines (or whatever) to be scrolled per wheel action. Defaults to three.", ""); - + DocDeclStr( bool , IsPageScroll() const, "Returns true if the system has been setup to do page scrolling with the mouse wheel instead of line scrolling.", ""); - + public: wxCoord m_x, m_y; @@ -1069,24 +1113,24 @@ public: DocDeclStr( wxCoord , GetX() const, "Returns the X coordinate of the mouse in client coordinates.", ""); - + DocDeclStr( wxCoord , GetY() const, "Returns the Y coordinate of the mouse in client coordinates.", ""); - + DocDeclStr( void , SetCursor(const wxCursor& cursor), "Sets the cursor associated with this event.", ""); - + DocDeclStr( const wxCursor& , GetCursor() const, "Returns a reference to the cursor specified by this event.", ""); - + DocDeclStr( bool , HasCursor() const, "Returns true if the cursor specified by this event is a valid cursor.", ""); - + }; //--------------------------------------------------------------------------- @@ -1167,35 +1211,35 @@ Events Keycode Table ------------- - =========== ============== ======== ==================== ================= - WXK_BACK WXK_EXECUTE WXK_F1 WXK_NUMPAD_SPACE WXK_WINDOWS_LEFT - WXK_TAB WXK_SNAPSHOT WXK_F2 WXK_NUMPAD_TAB WXK_WINDOWS_RIGHT - WXK_RETURN WXK_INSERT WXK_F3 WXK_NUMPAD_ENTER WXK_WINDOWS_MENU - WXK_ESCAPE WXK_HELP WXK_F4 WXK_NUMPAD_F1 WXK_SPECIAL1 - WXK_SPACE WXK_NUMPAD0 WXK_F5 WXK_NUMPAD_F2 WXK_SPECIAL2 - WXK_DELETE WXK_NUMPAD1 WXK_F6 WXK_NUMPAD_F3 WXK_SPECIAL3 - WXK_LBUTTON WXK_NUMPAD2 WXK_F7 WXK_NUMPAD_F4 WXK_SPECIAL4 - WXK_RBUTTON WXK_NUMPAD3 WXK_F8 WXK_NUMPAD_HOME WXK_SPECIAL5 - WXK_CANCEL WXK_NUMPAD4 WXK_F9 WXK_NUMPAD_LEFT WXK_SPECIAL6 - WXK_MBUTTON WXK_NUMPAD5 WXK_F10 WXK_NUMPAD_UP WXK_SPECIAL7 - WXK_CLEAR WXK_NUMPAD6 WXK_F11 WXK_NUMPAD_RIGHT WXK_SPECIAL8 - WXK_SHIFT WXK_NUMPAD7 WXK_F12 WXK_NUMPAD_DOWN WXK_SPECIAL9 - WXK_ALT WXK_NUMPAD8 WXK_F13 WXK_NUMPAD_PRIOR WXK_SPECIAL10 - WXK_CONTROL WXK_NUMPAD9 WXK_F14 WXK_NUMPAD_PAGEUP WXK_SPECIAL11 - WXK_MENU WXK_MULTIPLY WXK_F15 WXK_NUMPAD_NEXT WXK_SPECIAL12 - WXK_PAUSE WXK_ADD WXK_F16 WXK_NUMPAD_PAGEDOWN WXK_SPECIAL13 - WXK_CAPITAL WXK_SEPARATOR WXK_F17 WXK_NUMPAD_END WXK_SPECIAL14 - WXK_PRIOR WXK_SUBTRACT WXK_F18 WXK_NUMPAD_BEGIN WXK_SPECIAL15 - WXK_NEXT WXK_DECIMAL WXK_F19 WXK_NUMPAD_INSERT WXK_SPECIAL16 - WXK_END WXK_DIVIDE WXK_F20 WXK_NUMPAD_DELETE WXK_SPECIAL17 - WXK_HOME WXK_NUMLOCK WXK_F21 WXK_NUMPAD_EQUAL WXK_SPECIAL18 - WXK_LEFT WXK_SCROLL WXK_F22 WXK_NUMPAD_MULTIPLY WXK_SPECIAL19 - WXK_UP WXK_PAGEUP WXK_F23 WXK_NUMPAD_ADD WXK_SPECIAL20 - WXK_RIGHT WXK_PAGEDOWN WXK_F24 WXK_NUMPAD_SEPARATOR - WXK_DOWN WXK_NUMPAD_SUBTRACT - WXK_SELECT WXK_NUMPAD_DECIMAL - WXK_PRINT WXK_NUMPAD_DIVIDE - =========== ============== ======== ==================== ================= + =========== ============== ======== ==================== ================= + WXK_BACK WXK_EXECUTE WXK_F1 WXK_NUMPAD_SPACE WXK_WINDOWS_LEFT + WXK_TAB WXK_SNAPSHOT WXK_F2 WXK_NUMPAD_TAB WXK_WINDOWS_RIGHT + WXK_RETURN WXK_INSERT WXK_F3 WXK_NUMPAD_ENTER WXK_WINDOWS_MENU + WXK_ESCAPE WXK_HELP WXK_F4 WXK_NUMPAD_F1 WXK_SPECIAL1 + WXK_SPACE WXK_NUMPAD0 WXK_F5 WXK_NUMPAD_F2 WXK_SPECIAL2 + WXK_DELETE WXK_NUMPAD1 WXK_F6 WXK_NUMPAD_F3 WXK_SPECIAL3 + WXK_LBUTTON WXK_NUMPAD2 WXK_F7 WXK_NUMPAD_F4 WXK_SPECIAL4 + WXK_RBUTTON WXK_NUMPAD3 WXK_F8 WXK_NUMPAD_HOME WXK_SPECIAL5 + WXK_CANCEL WXK_NUMPAD4 WXK_F9 WXK_NUMPAD_LEFT WXK_SPECIAL6 + WXK_MBUTTON WXK_NUMPAD5 WXK_F10 WXK_NUMPAD_UP WXK_SPECIAL7 + WXK_CLEAR WXK_NUMPAD6 WXK_F11 WXK_NUMPAD_RIGHT WXK_SPECIAL8 + WXK_SHIFT WXK_NUMPAD7 WXK_F12 WXK_NUMPAD_DOWN WXK_SPECIAL9 + WXK_ALT WXK_NUMPAD8 WXK_F13 WXK_NUMPAD_PRIOR WXK_SPECIAL10 + WXK_CONTROL WXK_NUMPAD9 WXK_F14 WXK_NUMPAD_PAGEUP WXK_SPECIAL11 + WXK_MENU WXK_MULTIPLY WXK_F15 WXK_NUMPAD_NEXT WXK_SPECIAL12 + WXK_PAUSE WXK_ADD WXK_F16 WXK_NUMPAD_PAGEDOWN WXK_SPECIAL13 + WXK_CAPITAL WXK_SEPARATOR WXK_F17 WXK_NUMPAD_END WXK_SPECIAL14 + WXK_PRIOR WXK_SUBTRACT WXK_F18 WXK_NUMPAD_BEGIN WXK_SPECIAL15 + WXK_NEXT WXK_DECIMAL WXK_F19 WXK_NUMPAD_INSERT WXK_SPECIAL16 + WXK_END WXK_DIVIDE WXK_F20 WXK_NUMPAD_DELETE WXK_SPECIAL17 + WXK_HOME WXK_NUMLOCK WXK_F21 WXK_NUMPAD_EQUAL WXK_SPECIAL18 + WXK_LEFT WXK_SCROLL WXK_F22 WXK_NUMPAD_MULTIPLY WXK_SPECIAL19 + WXK_UP WXK_PAGEUP WXK_F23 WXK_NUMPAD_ADD WXK_SPECIAL20 + WXK_RIGHT WXK_PAGEDOWN WXK_F24 WXK_NUMPAD_SEPARATOR + WXK_DOWN WXK_NUMPAD_SUBTRACT + WXK_SELECT WXK_NUMPAD_DECIMAL + WXK_PRINT WXK_NUMPAD_DIVIDE + =========== ============== ======== ==================== ================= "); class wxKeyEvent : public wxEvent @@ -1207,23 +1251,34 @@ public: * ", ""); + DocDeclStr( + int, GetModifiers() const, + "Returns a bitmask of the current modifier settings. Can be used to +check if the key event has exactly the given modifiers without having +to explicitly check that the other modifiers are not down. For +example:: + + if event.GetModifers() == wx.MOD_CONTROL: + DoSomething() +", ""); + DocDeclStr( bool , ControlDown() const, "Returns ``True`` if the Control key was down at the time of the event.", ""); - + DocDeclStr( bool , MetaDown() const, "Returns ``True`` if the Meta key was down at the time of the event.", ""); - + DocDeclStr( bool , AltDown() const, "Returns ``True`` if the Alt key was down at the time of the event.", ""); - + DocDeclStr( bool , ShiftDown() const, "Returns ``True`` if the Shift key was down at the time of the event.", ""); - - + + DocDeclStr( bool , CmdDown() const, "\"Cmd\" is a pseudo key which is the same as Control for PC and Unix @@ -1233,8 +1288,8 @@ because Cmd key is used for the same thing under Mac as Ctrl elsewhere. The Ctrl still exists, it's just not used for this purpose. So for non-Mac platforms this is the same as `ControlDown` and Macs this is the same as `MetaDown`.", ""); - - + + DocDeclStr( bool , HasModifiers() const, @@ -1244,7 +1299,7 @@ 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).", ""); - + DocDeclStr( int , GetKeyCode() const, @@ -1259,12 +1314,12 @@ locale's default charset. You can obtain the corresponding Unicode character using `GetUnicodeKey`.", ""); %pythoncode { KeyCode = GetKeyCode } - + %extend { DocStr( GetUnicodeKey, "Returns the Unicode character corresponding to this key event. This -function is only meaningfule in a Unicode build of wxPython.", ""); +function is only meaningfule in a Unicode build of wxPython.", ""); int GetUnicodeKey() { %#if wxUSE_UNICODE return self->GetUnicodeKey(); @@ -1274,24 +1329,35 @@ function is only meaningfule in a Unicode build of wxPython.", ""); } } %pythoncode { GetUniChar = GetUnicodeKey } - - + + %extend { + DocStr( + SetUnicodeKey, + "Set the Unicode value of the key event, but only if this is a Unicode +build of wxPython.", ""); + void SetUnicodeKey(int uniChar) { + %#if wxUSE_UNICODE + self->m_uniChar = uniChar; + %#endif + } + } + DocDeclStr( wxUint32 , GetRawKeyCode() const, "Returns the raw key code for this event. This is a platform-dependent scan code which should only be used in advanced applications. Currently the raw key codes are not supported by all ports.", ""); - + DocDeclStr( wxUint32 , GetRawKeyFlags() const, "Returns the low level key flags for this event. The flags are platform-dependent and should only be used in advanced applications. Currently the raw key flags are not supported by all ports.", ""); - - + + DocStr(GetPosition, // sets the docstring for both "Find the position of the event, if applicable.", ""); wxPoint GetPosition(); @@ -1301,18 +1367,18 @@ Currently the raw key flags are not supported by all ports.", ""); "GetPositionTuple() -> (x,y)", GetPositionTuple); - + DocDeclStr( wxCoord , GetX() const, "Returns the X position (in client coordinates) of the event, if applicable.", ""); - + DocDeclStr( wxCoord , GetY() const, "Returns the Y position (in client coordinates) of the event, if applicable.", ""); - + public: wxCoord m_x, m_y; @@ -1362,10 +1428,10 @@ public: wxSize , GetSize() const, "Returns the entire size of the window generating the size change event.", ""); - + wxRect GetRect() const; void SetRect(wxRect rect); - + %extend { void SetSize(wxSize size) { self->m_size = size; @@ -1395,7 +1461,7 @@ public: DocDeclStr( wxPoint , GetPosition() const, "Returns the position of the window generating the move change event.", ""); - + wxRect GetRect() const; void SetRect(const wxRect& rect); void SetPosition(const wxPoint& pos); @@ -1495,7 +1561,7 @@ window which had the focus before for the EVT_SET_FOCUS event and the window which is going to receive focus for the wxEVT_KILL_FOCUS event. Warning: the window returned may be None!", ""); - + void SetWindow(wxWindow *win); }; @@ -1518,7 +1584,7 @@ public: DocDeclStr( wxWindow *, GetWindow() const, "The window which has just received the focus.", ""); - + }; //--------------------------------------------------------------------------- @@ -1557,12 +1623,12 @@ public: DocCtorStr( wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true, int Id = 0), "Constructor", ""); - + DocDeclStr( bool , GetActive() const, "Returns true if the application or window is being activated, false otherwise.", ""); - + }; @@ -1624,25 +1690,25 @@ public: DocCtorStr( wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL), "Constructor", ""); - + DocDeclStr( int , GetMenuId() const, "Returns the menu identifier associated with the event. This method should be only used with the HIGHLIGHT events.", ""); - + DocDeclStr( bool , IsPopup() const, "Returns ``True`` if the menu which is being opened or closed is a popup menu, ``False`` if it is a normal one. This method should only be used with the OPEN and CLOSE events.", ""); - + DocDeclStr( wxMenu* , GetMenu() const, "Returns the menu which is being opened or closed. This method should only be used with the OPEN and CLOSE events.", ""); - + }; //--------------------------------------------------------------------------- @@ -1690,15 +1756,18 @@ public: DocCtorStr( wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0), "Constructor.", ""); - + DocDeclStr( void , SetLoggingOff(bool logOff), "Sets the 'logging off' flag.", ""); - + DocDeclStr( bool , GetLoggingOff() const, - "Returns true if the user is logging off.", ""); - + "Returns ``True`` if the user is logging off or ``False`` if the +system is shutting down. This method can only be called for end +session and query end session events, it doesn't make sense for close +window event.", ""); + DocDeclStr( void , Veto(bool veto = true), @@ -1706,20 +1775,20 @@ public: signal to the calling application that a window close did not happen. You can only veto a shutdown or close if `CanVeto` returns true.", ""); - + bool GetVeto() const; - + DocDeclStr( void , SetCanVeto(bool canVeto), "Sets the 'can veto' flag.", ""); - + DocDeclStr( bool , CanVeto() const, "Returns true if you can veto a system shutdown or a window close event. Vetoing a window close event is not possible if the calling code wishes to force the application to exit, and so this function must be called to check this.", ""); - + }; @@ -1733,7 +1802,7 @@ class wxShowEvent : public wxEvent { public: wxShowEvent(int winid = 0, bool show = false); - + void SetShow(bool show); bool GetShow() const; @@ -1751,12 +1820,12 @@ class wxIconizeEvent: public wxEvent { public: wxIconizeEvent(int id = 0, bool iconized = true); - + DocDeclStr( bool , Iconized(), "Returns ``True`` if the frame has been iconized, ``False`` if it has been restored.", ""); - + }; @@ -1796,21 +1865,21 @@ public: // TODO: wrap the ctor! - + DocDeclStr( wxPoint , GetPosition(), "Returns the position at which the files were dropped.", ""); - + DocDeclStr( int , GetNumberOfFiles(), "Returns the number of files dropped.", ""); - + %extend { DocStr( GetFiles, "Returns a list of the filenames that were dropped.", ""); - + PyObject* GetFiles() { int count = self->GetNumberOfFiles(); wxString* files = self->GetFiles(); @@ -1903,50 +1972,63 @@ public: DocCtorStr( wxUpdateUIEvent(wxWindowID commandId = 0), "Constructor", ""); - + DocDeclStr( bool , GetChecked() const, "Returns ``True`` if the UI element should be checked.", ""); - + DocDeclStr( bool , GetEnabled() const, "Returns ``True`` if the UI element should be enabled.", ""); - + + DocDeclStr( + bool , GetShown() const, + "Returns ``True`` if the UI element should be shown.", ""); + DocDeclStr( wxString , GetText() const, "Returns the text that should be set for the UI element.", ""); - + DocDeclStr( bool , GetSetText() const, "Returns ``True`` if the application has called `SetText`. For wxWidgets internal use only.", ""); - + DocDeclStr( bool , GetSetChecked() const, "Returns ``True`` if the application has called `Check`. For wxWidgets internal use only.", ""); - + DocDeclStr( bool , GetSetEnabled() const, "Returns ``True`` if the application has called `Enable`. For wxWidgets internal use only.", ""); - + + DocDeclStr( + bool , GetSetShown() const, + "Returns ``True`` if the application has called `Show`. For wxWidgets +internal use only.", ""); DocDeclStr( void , Check(bool check), "Check or uncheck the UI element.", ""); - + DocDeclStr( void , Enable(bool enable), "Enable or disable the UI element.", ""); - + + DocDeclStr( + void , Show(bool show), + "Show or hide the UI element.", ""); + + DocDeclStr( void , SetText(const wxString& text), "Sets the text for this UI element.", ""); - - + + DocDeclStr( static void , SetUpdateInterval(long updateInterval), "Sets the interval between updates in milliseconds. Set to -1 to @@ -1958,13 +2040,13 @@ application has a lot of windows. If you set the value to -1 or greater than 0, you may also need to call `wx.Window.UpdateWindowUI` at appropriate points in your application, such as when a dialog is about to be shown.", ""); - + DocDeclStr( static long , GetUpdateInterval(), "Returns the current interval between updates in milliseconds. -1 disables updates, 0 updates as frequently as possible.", ""); - + DocDeclStr( static bool , CanUpdate(wxWindow *win), @@ -1981,14 +2063,14 @@ events will be sent as often as possible. You can reduce the frequency that events are sent by changing the mode and/or setting an update interval. ", ""); - + DocDeclStr( static void , ResetUpdateTime(), "Used internally to reset the last-updated time to the current time. It is assumed that update events are normally sent in idle time, so this is called at the end of idle processing.", ""); - + DocDeclStr( static void , SetMode(wxUpdateUIMode mode), @@ -2005,14 +2087,14 @@ The mode may be one of the following values: style set. ============================= ========================================== ", ""); - + DocDeclStr( static wxUpdateUIMode , GetMode(), "Returns a value specifying how wxWidgets will send update events: to all windows, or only to those which specify that they will process the events.", ""); - + }; //--------------------------------------------------------------------------- @@ -2061,7 +2143,7 @@ public: wxWindow* , GetCapturedWindow() const, "Returns the window that gained the capture, or ``None`` if it was a non-wxWidgets window.", ""); - + }; //--------------------------------------------------------------------------- @@ -2120,7 +2202,7 @@ public: DocDeclStr( void , SetPaletteRealized(bool realized), "App should set this if it changes the palette.", ""); - + bool GetPaletteRealized() const; }; @@ -2144,38 +2226,38 @@ public: DocCtorStr( wxNavigationKeyEvent(), "", ""); - + DocDeclStr( bool , GetDirection() const, "Returns ``True`` if the direction is forward, ``False`` otherwise.", ""); - + DocDeclStr( void , SetDirection(bool forward), "Specify the direction that the navigation should take. Usually the difference between using Tab and Shift-Tab.", ""); - + DocDeclStr( bool , IsWindowChange() const, "Returns ``True`` if window change is allowed.", ""); - + DocDeclStr( void , SetWindowChange(bool ischange), "Specify if the navigation should be able to change parent windows. For example, changing notebook pages, etc. This is usually implemented by using Control-Tab.", ""); - + DocDeclStr( bool , IsFromTab() const, "Returns ``True`` if the navigation event is originated from the Tab key.", ""); - + DocDeclStr( void , SetFromTab(bool bIs), "Set to true under MSW if the event was generated using the tab key. This is required for proper navogation over radio buttons.", ""); - + DocDeclStr( void , SetFlags(long flags), @@ -2186,17 +2268,17 @@ This is required for proper navogation over radio buttons.", ""); * wx.NavigationKeyEvent.WinChange * wx.NavigationKeyEvent.FromTab ", ""); - - + + DocDeclStr( wxWindow* , GetCurrentFocus() const, "Returns the child window which currenty has the focus. May be ``None``.", ""); - + DocDeclStr( void , SetCurrentFocus(wxWindow *win), "Set the window that has the focus.", ""); - + enum { IsBackward, @@ -2218,25 +2300,32 @@ class wxWindowCreateEvent : public wxCommandEvent { public: wxWindowCreateEvent(wxWindow *win = NULL); - + DocDeclStr( wxWindow *, GetWindow() const, "Returns the window that this event refers to.", ""); - + }; DocStr(wxWindowDestroyEvent, - "The EVT_WINDOW_DESTROY event is sent right before the window is -destroyed.", ""); + "The EVT_WINDOW_DESTROY event is sent from the `wx.Window` destructor +when the GUI window is destroyed. + +When a class derived from `wx.Window` is destroyed its destructor will +have already run by the time this event is sent. Therefore this event +will not usually be received at all by the window itself. Since it is +received after the destructor has run, an object should not try to +handle its own wx.WindowDestroyEvent, but it can be used to get +notification of the destruction of another window.", ""); class wxWindowDestroyEvent : public wxCommandEvent { public: wxWindowDestroyEvent(wxWindow *win = NULL); - + DocDeclStr( wxWindow *, GetWindow() const, - "Returns the window that this event refers to.", ""); + "Returns the window that this event refers to.", ""); }; @@ -2263,11 +2352,11 @@ public: "Returns the position (in screen coordinants) at which the menu should be shown.", ""); - + DocDeclStr( void , SetPosition(const wxPoint& pos), "Sets the position at which the menu should be shown.", ""); - + }; //--------------------------------------------------------------------------- @@ -2301,8 +2390,8 @@ public: DocCtorStr( wxIdleEvent(), "Constructor", ""); - - + + DocDeclStr( void , RequestMore(bool needMore = true), "Tells wxWidgets that more processing is required. This function can be @@ -2312,12 +2401,12 @@ application windows. If no window calls this function during its EVT_IDLE handler, then the application will remain in a passive event loop until a new event is posted to the application by the windowing system.", ""); - + DocDeclStr( bool , MoreRequested() const, "Returns ``True`` if the OnIdle function processing this event requested more processing time.", ""); - + DocDeclStr( static void , SetMode(wxIdleMode mode), @@ -2334,14 +2423,14 @@ The mode can be one of the following values: flag set. ========================= ======================================== ", ""); - + DocDeclStr( static wxIdleMode , GetMode(), "Static method returning a value specifying how wxWidgets will send idle events: to all windows, or only to those which specify that they will process the events.", ""); - + DocDeclStr( static bool , CanSend(wxWindow* win), @@ -2354,9 +2443,28 @@ events should be sent to this window now. By default this will always return ``True`` because the update mode is initially wx.IDLE_PROCESS_ALL. You can change the mode to only send idle events to windows with the wx.WS_EX_PROCESS_IDLE extra window style set.", ""); - + }; +//--------------------------------------------------------------------------- +%newgroup; + + +DocStr(wxClipboardTextEvent, +"A Clipboard Text event is sent when a window intercepts a text +copy/cut/paste message, i.e. the user has cut/copied/pasted data +from/into a text control via ctrl-C/X/V, ctrl/shift-del/insert, a +popup menu command, etc. NOTE : under windows these events are *NOT* +generated automatically for a Rich Edit text control.", ""); + +class wxClipboardTextEvent : public wxCommandEvent +{ +public: + wxClipboardTextEvent(wxEventType type = wxEVT_NULL, + wxWindowID winid = 0); +}; + + //--------------------------------------------------------------------------- %newgroup; @@ -2380,7 +2488,7 @@ public: DocCtorStr( wxPyEvent(int winid=0, wxEventType eventType = wxEVT_NULL ), "", ""); - + ~wxPyEvent(); @@ -2408,7 +2516,7 @@ public: DocCtorStr( wxPyCommandEvent(wxEventType eventType = wxEVT_NULL, int id=0), "", ""); - + ~wxPyCommandEvent(); %Rename(_SetSelf, void , SetSelf(PyObject* self)); @@ -2436,12 +2544,12 @@ public: DocDeclStr( const wxDateTime& , GetDate() const, "Returns the date.", ""); - + DocDeclStr( void , SetDate(const wxDateTime &date), "Sets the date carried by the event, normally only used by the library internally.", ""); - + }; @@ -2454,3 +2562,4 @@ internally.", ""); //--------------------------------------------------------------------------- +//---------------------------------------------------------------------------