From: Robin Dunn Date: Fri, 21 Jan 2005 20:38:51 +0000 (+0000) Subject: * Some WXWIN_COMPATIBILITY_2_4 changes, as well as flagging other X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/aeee37c362c178e4b79702e8e61869cd9dcb65ff * Some WXWIN_COMPATIBILITY_2_4 changes, as well as flagging other things that will need fixing when WXWIN_COMPATIBILITY_2_4 is turned off. * Create a custom version of the "default" ctor for wxCursor on wxGTK * Switch to new format string and name string constants for default values * Changes some public data members of event classes into properties as they are no longer public in the C++. * Added wxSL_INVERSE git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31555 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/wxPython/docs/CHANGES.txt b/wxPython/docs/CHANGES.txt index 998c210367..91c3aa2dd1 100644 --- a/wxPython/docs/CHANGES.txt +++ b/wxPython/docs/CHANGES.txt @@ -124,7 +124,7 @@ morbidly curious, here are a few more details: * The %name directive is now deprecated so I replaced most uses of it with a custom %Rename macro that uses %rename internally. These will evetually need to be replaced with a DocDecl macro - when docstrings are added. + when docstrings are added for those items. * The "this" attribute of all SWIGged classes is no longer a string containing a "swigified pointer", but rather a custom @@ -161,6 +161,25 @@ lots of surplus events) wxGTK: Applied patch for proper menu highlight colour detection in wx.SystemSettings. +wxGTK: Commited scrollbar patch #1093339 which sends lineup, linedown +events based on intercepting the mouse down events. + +wxGTK: Applied patch #1102789 which solved conflicts between wxWidgets +and GTK+'s context menu code. + +wxGTK: Applied patch #1100327 for correct feedback from DND actions +(not all actions are allowed). + +Fixed memory leak in wxGRID::UpdateAttr[Rows][Or][Cols] (patch 1104355) + +For efficiency reasons, text controls no longer set the string for +each text updated event, but rather query for the string value only +when GetString is called from an event handler. + +Added wx.SL_INVERSE style which will cause wx.Slider to invert the min +and max ends of the slider. (Only for wxGTK so far.) + + diff --git a/wxPython/src/__controls_rename.i b/wxPython/src/__controls_rename.i index 43404b7510..838721a6b8 100644 --- a/wxPython/src/__controls_rename.i +++ b/wxPython/src/__controls_rename.i @@ -73,6 +73,8 @@ %rename(TE_HT_ON_TEXT) wxTE_HT_ON_TEXT; %rename(TE_HT_BELOW) wxTE_HT_BELOW; %rename(TE_HT_BEYOND) wxTE_HT_BEYOND; +%rename(OutOfRangeTextCoord) wxOutOfRangeTextCoord; +%rename(InvalidTextCoord) wxInvalidTextCoord; %rename(TextAttr) wxTextAttr; %rename(TextCtrl) wxTextCtrl; %rename(TextUrlEvent) wxTextUrlEvent; diff --git a/wxPython/src/_cursor.i b/wxPython/src/_cursor.i index 9d7e87851b..f1fd9f3036 100644 --- a/wxPython/src/_cursor.i +++ b/wxPython/src/_cursor.i @@ -70,17 +70,17 @@ public: %extend { DocStr(wxCursor, "Construct a Cursor from a file. Specify the type of file using -wx.BITAMP_TYPE* constants, and specify the hotspot if not using a cur -file. - -This constructor is not available on wxGTK, use ``wx.StockCursor``, -``wx.CursorFromImage``, or ``wx.CursorFromBits`` instead.", ""); - wxCursor(const wxString* cursorName, long type, int hotSpotX=0, int hotSpotY=0) { +wx.BITAMP_TYPE* constants, and specify the hotspot if not using a .cur +file."," +:see: Alternate constructors `wx.StockCursor`,`wx.CursorFromImage`, `wx.CursorFromBits`"); + wxCursor(const wxString& cursorName, long type, int hotSpotX=0, int hotSpotY=0) { %#ifdef __WXGTK__ - wxCHECK_MSG(false, NULL, - wxT("wx.Cursor constructor not implemented for wxGTK, use wx.StockCursor, wx.CursorFromImage, or wx.CursorFromBits instead.")); + wxImage img(cursorName, type); + img.SetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X, hotSpotX); + img.SetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y, hotSpotY); + return new wxCursor(img); %#else - return new wxCursor(*cursorName, type, hotSpotX, hotSpotY); + return new wxCursor(cursorName, type, hotSpotX, hotSpotY); %#endif } } @@ -90,7 +90,7 @@ This constructor is not available on wxGTK, use ``wx.StockCursor``, DocCtorStrName( wxCursor(int id), "Create a cursor using one of the stock cursors. Note that not all -cursors are available on all platforms.", "", +stock cursors are available on all platforms.", "", StockCursor); diff --git a/wxPython/src/_datetime.i b/wxPython/src/_datetime.i index d932869e94..4805236239 100644 --- a/wxPython/src/_datetime.i +++ b/wxPython/src/_datetime.i @@ -18,10 +18,10 @@ %{ #include - %} -MAKE_CONST_WXSTRING2(DateFormatStr, wxT("%c")); -MAKE_CONST_WXSTRING2(TimeSpanFormatStr, wxT("%H:%M:%S")); + +MAKE_CONST_WXSTRING(DefaultDateTimeFormat); +MAKE_CONST_WXSTRING(DefaultTimeSpanFormat); //--------------------------------------------------------------------------- @@ -783,7 +783,7 @@ public: // default, they will not change if they had valid values or will // default to Today() otherwise) int ParseFormat(const wxString& date, - const wxString& format = wxPyDateFormatStr, + const wxString& format = wxPyDefaultDateTimeFormat, const wxDateTime& dateDef = wxDefaultDateTime) { const wxChar* rv; const wxChar* _date = date; @@ -828,7 +828,7 @@ public: // argument corresponds to the preferred date and time representation // for the current locale) and returns the string containing the // resulting text representation - wxString Format(const wxString& format = wxPyDateFormatStr, + wxString Format(const wxString& format = wxPyDefaultDateTimeFormat, const wxDateTime::TimeZone& tz = LOCAL_TZ) const; // preferred date representation for the current locale @@ -995,7 +995,7 @@ public: // resulting text representation. Notice that only some of format // specifiers valid for wxDateTime are valid for wxTimeSpan: hours, // minutes and seconds make sense, but not "PM/AM" string for example. - wxString Format(const wxString& format = wxPyTimeSpanFormatStr) const; + wxString Format(const wxString& format = wxPyDefaultTimeSpanFormat) const; %pythoncode { def __repr__(self): diff --git a/wxPython/src/_defs.i b/wxPython/src/_defs.i index 4309bf62b5..81a04191c7 100644 --- a/wxPython/src/_defs.i +++ b/wxPython/src/_defs.i @@ -370,6 +370,13 @@ FORWARD_DECLARE(wxStaticBox, StaticBox); //--------------------------------------------------------------------------- +%{ +#if !WXWIN_COMPATIBILITY_2_4 + #define wxHIDE_READONLY 0 +#endif +%} + + // General numeric #define's and etc. Making them all enums makes SWIG use the // real macro when making the Python Int @@ -437,16 +444,6 @@ enum { wxRA_SPECIFY_COLS, wxRB_GROUP, wxRB_SINGLE, - wxSL_HORIZONTAL, - wxSL_VERTICAL, - wxSL_AUTOTICKS, - wxSL_LABELS, - wxSL_LEFT, - wxSL_TOP, - wxSL_RIGHT, - wxSL_BOTTOM, - wxSL_BOTH, - wxSL_SELRANGE, wxSB_HORIZONTAL, wxSB_VERTICAL, wxST_SIZEGRIP, diff --git a/wxPython/src/_event.i b/wxPython/src/_event.i index 53bf9e1d4c..8feb6f6934 100644 --- a/wxPython/src/_event.i +++ b/wxPython/src/_event.i @@ -809,15 +809,13 @@ public: wxPoint GetPosition() const; wxRect GetRect() const; - void SetRect(wxRect rect); - %extend { - void SetPosition(wxPoint pos) { - self->m_pos = pos; - } - } + void SetRect(const wxRect& rect); + void SetPosition(const wxPoint& pos); - wxPoint m_pos; - wxRect m_rect; + %pythoncode { + m_pos = property(GetPosition, SetPosition) + m_rect = property(GetRect, SetRect) + } }; //--------------------------------------------------------------------------- diff --git a/wxPython/src/_functions.i b/wxPython/src/_functions.i index f3f05a9858..31e312426c 100644 --- a/wxPython/src/_functions.i +++ b/wxPython/src/_functions.i @@ -202,6 +202,7 @@ int wxMessageBox(const wxString& message, wxWindow *parent = NULL, int x = -1, int y = -1); +// WXWIN_COMPATIBILITY_2_4 MustHaveApp(wxGetNumberFromUser); long wxGetNumberFromUser(const wxString& message, const wxString& prompt, @@ -323,5 +324,40 @@ MustHaveApp(wxThread); } %} +//--------------------------------------------------------------------------- + +// enum wxPowerType +// { +// wxPOWER_SOCKET, +// wxPOWER_BATTERY, +// wxPOWER_UNKNOWN +// }; + +// DocDeclStr( +// wxPowerType , wxGetPowerType(), +// "Returns the type of power source as one of wx.POWER_SOCKET, +// wx.POWER_BATTERY or wx.POWER_UNKNOWN. wx.POWER_UNKNOWN is also the +// default on platforms where this feature is not implemented.", ""); + + +// enum wxBatteryState +// { +// wxBATTERY_NORMAL_STATE, // system is fully usable +// wxBATTERY_LOW_STATE, // start to worry +// wxBATTERY_CRITICAL_STATE, // save quickly +// wxBATTERY_SHUTDOWN_STATE, // too late +// wxBATTERY_UNKNOWN_STATE +// }; + +// DocDeclStr( +// wxBatteryState , wxGetBatteryState(), +// "Returns battery state as one of wx.BATTERY_NORMAL_STATE, +// wx.BATTERY_LOW_STATE}, wx.BATTERY_CRITICAL_STATE, +// wx.BATTERY_SHUTDOWN_STATE or wx.BATTERY_UNKNOWN_STATE. +// wx.BATTERY_UNKNOWN_STATE is also the default on platforms where this +// feature is not implemented.", ""); + + + //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- diff --git a/wxPython/src/_joystick.i b/wxPython/src/_joystick.i index b446daeb68..01acf952e1 100644 --- a/wxPython/src/_joystick.i +++ b/wxPython/src/_joystick.i @@ -172,12 +172,6 @@ public: class wxJoystickEvent : public wxEvent { public: - wxPoint m_pos; - int m_zPosition; - int m_buttonChange; // Which button changed? - int m_buttonState; // Which buttons are down? - int m_joyStick; // Which joystick? - wxJoystickEvent(wxEventType type = wxEVT_NULL, int state = 0, int joystick = wxJOYSTICK1, @@ -212,6 +206,14 @@ public: // Was the given button 1,2,3,4 or any in Down state? bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const; + + %pythoncode { + m_pos = property(GetPosition, SetPosition) + m_zPosition = property(GetZPosition, SetZPosition) + m_buttonChange = property(GetButtonChange, SetButtonChange) + m_buttonState = property(GetButtonState, SetButtonState) + m_joyStick = property(GetJoystick, SetJoystick) + } }; diff --git a/wxPython/src/_listctrl.i b/wxPython/src/_listctrl.i index 0d3269c53f..c5679fdc75 100644 --- a/wxPython/src/_listctrl.i +++ b/wxPython/src/_listctrl.i @@ -19,7 +19,7 @@ #include %} -MAKE_CONST_WXSTRING2(ListCtrlNameStr, _T("wxListCtrl")); +MAKE_CONST_WXSTRING(ListCtrlNameStr); //--------------------------------------------------------------------------- %newgroup @@ -288,8 +288,6 @@ public: %constant wxEventType wxEVT_COMMAND_LIST_END_LABEL_EDIT; %constant wxEventType wxEVT_COMMAND_LIST_DELETE_ITEM; %constant wxEventType wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS; -%constant wxEventType wxEVT_COMMAND_LIST_GET_INFO; -%constant wxEventType wxEVT_COMMAND_LIST_SET_INFO; %constant wxEventType wxEVT_COMMAND_LIST_ITEM_SELECTED; %constant wxEventType wxEVT_COMMAND_LIST_ITEM_DESELECTED; %constant wxEventType wxEVT_COMMAND_LIST_KEY_DOWN; @@ -305,6 +303,9 @@ public: %constant wxEventType wxEVT_COMMAND_LIST_COL_END_DRAG; %constant wxEventType wxEVT_COMMAND_LIST_ITEM_FOCUSED; +// WXWIN_COMPATIBILITY_2_4 +%constant wxEventType wxEVT_COMMAND_LIST_GET_INFO; +%constant wxEventType wxEVT_COMMAND_LIST_SET_INFO; %pythoncode { diff --git a/wxPython/src/_notebook.i b/wxPython/src/_notebook.i index f1d9b07282..56a016a812 100644 --- a/wxPython/src/_notebook.i +++ b/wxPython/src/_notebook.i @@ -407,6 +407,7 @@ public: //--------------------------------------------------------------------------- %newgroup; +// WXWIN_COMPATIBILITY_2_4 class wxBookCtrlSizer: public wxSizer { diff --git a/wxPython/src/_slider.i b/wxPython/src/_slider.i index 106c3aaf7d..1698e2a374 100644 --- a/wxPython/src/_slider.i +++ b/wxPython/src/_slider.i @@ -25,6 +25,21 @@ MAKE_CONST_WXSTRING(SliderNameStr); //--------------------------------------------------------------------------- %newgroup +enum { + wxSL_HORIZONTAL, + wxSL_VERTICAL, + wxSL_AUTOTICKS, + wxSL_LABELS, + wxSL_LEFT, + wxSL_TOP, + wxSL_RIGHT, + wxSL_BOTTOM, + wxSL_BOTH, + wxSL_SELRANGE, + wxSL_INVERSE +}; + + MustHaveApp(wxSlider); class wxSlider : public wxControl { diff --git a/wxPython/src/_textctrl.i b/wxPython/src/_textctrl.i index 8863219b7b..76f2995baf 100644 --- a/wxPython/src/_textctrl.i +++ b/wxPython/src/_textctrl.i @@ -99,6 +99,12 @@ enum wxTextCtrlHitTestResult wxTE_HT_BEYOND // after [the end of line] }; + +enum { + wxOutOfRangeTextCoord, + wxInvalidTextCoord +}; + //--------------------------------------------------------------------------- // wxTextAttr: a structure containing the visual attributes of a text diff --git a/wxPython/src/grid.i b/wxPython/src/grid.i index 741c4c0915..d5fb58ff43 100644 --- a/wxPython/src/grid.i +++ b/wxPython/src/grid.i @@ -39,8 +39,7 @@ MAKE_CONST_WXSTRING_NOSWIG(EmptyString); MAKE_CONST_WXSTRING_NOSWIG(PanelNameStr); -MAKE_CONST_WXSTRING2(DateTimeFormatStr, wxT("%c")); - +MAKE_CONST_WXSTRING_NOSWIG(DefaultDateTimeFormat); //--------------------------------------------------------------------------- // OOR related typemaps and helper functions @@ -736,8 +735,8 @@ class wxGridCellDateTimeRenderer : public wxGridCellStringRenderer { public: %pythonAppend wxGridCellDateTimeRenderer "self._setOORInfo(self)" - wxGridCellDateTimeRenderer(wxString outformat = wxPyDateTimeFormatStr, - wxString informat = wxPyDateTimeFormatStr); + wxGridCellDateTimeRenderer(wxString outformat = wxPyDefaultDateTimeFormat, + wxString informat = wxPyDefaultDateTimeFormat); }; diff --git a/wxPython/wxPython/_controls.py b/wxPython/wxPython/_controls.py index 9894528e6d..f7bbff8508 100644 --- a/wxPython/wxPython/_controls.py +++ b/wxPython/wxPython/_controls.py @@ -135,6 +135,8 @@ wxTE_HT_BEFORE = wx._controls.TE_HT_BEFORE wxTE_HT_ON_TEXT = wx._controls.TE_HT_ON_TEXT wxTE_HT_BELOW = wx._controls.TE_HT_BELOW wxTE_HT_BEYOND = wx._controls.TE_HT_BEYOND +wxOutOfRangeTextCoord = wx._controls.OutOfRangeTextCoord +wxInvalidTextCoord = wx._controls.InvalidTextCoord wxTextAttr = wx._controls.TextAttr wxTextAttrPtr = wx._controls.TextAttrPtr wxTextAttr_Combine = wx._controls.TextAttr_Combine @@ -348,8 +350,6 @@ wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT = wx._controls.wxEVT_COMMAND_LIST_BEGIN_LABE wxEVT_COMMAND_LIST_END_LABEL_EDIT = wx._controls.wxEVT_COMMAND_LIST_END_LABEL_EDIT wxEVT_COMMAND_LIST_DELETE_ITEM = wx._controls.wxEVT_COMMAND_LIST_DELETE_ITEM wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS = wx._controls.wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS -wxEVT_COMMAND_LIST_GET_INFO = wx._controls.wxEVT_COMMAND_LIST_GET_INFO -wxEVT_COMMAND_LIST_SET_INFO = wx._controls.wxEVT_COMMAND_LIST_SET_INFO wxEVT_COMMAND_LIST_ITEM_SELECTED = wx._controls.wxEVT_COMMAND_LIST_ITEM_SELECTED wxEVT_COMMAND_LIST_ITEM_DESELECTED = wx._controls.wxEVT_COMMAND_LIST_ITEM_DESELECTED wxEVT_COMMAND_LIST_KEY_DOWN = wx._controls.wxEVT_COMMAND_LIST_KEY_DOWN @@ -364,6 +364,8 @@ wxEVT_COMMAND_LIST_COL_BEGIN_DRAG = wx._controls.wxEVT_COMMAND_LIST_COL_BEGIN_DR wxEVT_COMMAND_LIST_COL_DRAGGING = wx._controls.wxEVT_COMMAND_LIST_COL_DRAGGING wxEVT_COMMAND_LIST_COL_END_DRAG = wx._controls.wxEVT_COMMAND_LIST_COL_END_DRAG wxEVT_COMMAND_LIST_ITEM_FOCUSED = wx._controls.wxEVT_COMMAND_LIST_ITEM_FOCUSED +wxEVT_COMMAND_LIST_GET_INFO = wx._controls.wxEVT_COMMAND_LIST_GET_INFO +wxEVT_COMMAND_LIST_SET_INFO = wx._controls.wxEVT_COMMAND_LIST_SET_INFO wxListCtrl = wx._controls.ListCtrl wxListCtrlPtr = wx._controls.ListCtrlPtr wxListCtrl = wx._controls.ListCtrl diff --git a/wxPython/wxPython/_misc.py b/wxPython/wxPython/_misc.py index f622463499..c69c81f081 100644 --- a/wxPython/wxPython/_misc.py +++ b/wxPython/wxPython/_misc.py @@ -458,8 +458,8 @@ wxFileConfigPtr = wx._misc.FileConfigPtr wxConfigPathChanger = wx._misc.ConfigPathChanger wxConfigPathChangerPtr = wx._misc.ConfigPathChangerPtr wxExpandEnvVars = wx._misc.ExpandEnvVars -wxDateFormatStr = wx._misc.DateFormatStr -wxTimeSpanFormatStr = wx._misc.TimeSpanFormatStr +wxDefaultDateTimeFormat = wx._misc.DefaultDateTimeFormat +wxDefaultTimeSpanFormat = wx._misc.DefaultTimeSpanFormat wxDateTime = wx._misc.DateTime wxDateTimePtr = wx._misc.DateTimePtr wxDateTime_SetCountry = wx._misc.DateTime_SetCountry diff --git a/wxPython/wxPython/grid.py b/wxPython/wxPython/grid.py index 0c4f0791a2..f94389f540 100644 --- a/wxPython/wxPython/grid.py +++ b/wxPython/wxPython/grid.py @@ -19,7 +19,6 @@ del sys, _wx # Now assign all the reverse-renamed names: -wxDateTimeFormatStr = wx.grid.DateTimeFormatStr wxGRID_VALUE_STRING = wx.grid.GRID_VALUE_STRING wxGRID_VALUE_BOOL = wx.grid.GRID_VALUE_BOOL wxGRID_VALUE_NUMBER = wx.grid.GRID_VALUE_NUMBER