* 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
This commit is contained in:
Robin Dunn
2005-01-21 20:38:51 +00:00
parent d7f03cae7f
commit aeee37c362
16 changed files with 130 additions and 53 deletions

View File

@@ -124,7 +124,7 @@ morbidly curious, here are a few more details:
* The %name directive is now deprecated so I replaced most uses of * The %name directive is now deprecated so I replaced most uses of
it with a custom %Rename macro that uses %rename internally. it with a custom %Rename macro that uses %rename internally.
These will evetually need to be replaced with a DocDecl macro 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 * The "this" attribute of all SWIGged classes is no longer a
string containing a "swigified pointer", but rather a custom 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 wxGTK: Applied patch for proper menu highlight colour detection in
wx.SystemSettings. 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.)

View File

@@ -73,6 +73,8 @@
%rename(TE_HT_ON_TEXT) wxTE_HT_ON_TEXT; %rename(TE_HT_ON_TEXT) wxTE_HT_ON_TEXT;
%rename(TE_HT_BELOW) wxTE_HT_BELOW; %rename(TE_HT_BELOW) wxTE_HT_BELOW;
%rename(TE_HT_BEYOND) wxTE_HT_BEYOND; %rename(TE_HT_BEYOND) wxTE_HT_BEYOND;
%rename(OutOfRangeTextCoord) wxOutOfRangeTextCoord;
%rename(InvalidTextCoord) wxInvalidTextCoord;
%rename(TextAttr) wxTextAttr; %rename(TextAttr) wxTextAttr;
%rename(TextCtrl) wxTextCtrl; %rename(TextCtrl) wxTextCtrl;
%rename(TextUrlEvent) wxTextUrlEvent; %rename(TextUrlEvent) wxTextUrlEvent;

View File

@@ -70,17 +70,17 @@ public:
%extend { %extend {
DocStr(wxCursor, DocStr(wxCursor,
"Construct a Cursor from a file. Specify the type of file using "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 wx.BITAMP_TYPE* constants, and specify the hotspot if not using a .cur
file. file.","
:see: Alternate constructors `wx.StockCursor`,`wx.CursorFromImage`, `wx.CursorFromBits`");
This constructor is not available on wxGTK, use ``wx.StockCursor``, wxCursor(const wxString& cursorName, long type, int hotSpotX=0, int hotSpotY=0) {
``wx.CursorFromImage``, or ``wx.CursorFromBits`` instead.", "");
wxCursor(const wxString* cursorName, long type, int hotSpotX=0, int hotSpotY=0) {
%#ifdef __WXGTK__ %#ifdef __WXGTK__
wxCHECK_MSG(false, NULL, wxImage img(cursorName, type);
wxT("wx.Cursor constructor not implemented for wxGTK, use wx.StockCursor, wx.CursorFromImage, or wx.CursorFromBits instead.")); img.SetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X, hotSpotX);
img.SetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y, hotSpotY);
return new wxCursor(img);
%#else %#else
return new wxCursor(*cursorName, type, hotSpotX, hotSpotY); return new wxCursor(cursorName, type, hotSpotX, hotSpotY);
%#endif %#endif
} }
} }
@@ -90,7 +90,7 @@ This constructor is not available on wxGTK, use ``wx.StockCursor``,
DocCtorStrName( DocCtorStrName(
wxCursor(int id), wxCursor(int id),
"Create a cursor using one of the stock cursors. Note that not all "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); StockCursor);

View File

@@ -18,10 +18,10 @@
%{ %{
#include <wx/datetime.h> #include <wx/datetime.h>
%} %}
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, they will not change if they had valid values or will
// default to Today() otherwise) // default to Today() otherwise)
int ParseFormat(const wxString& date, int ParseFormat(const wxString& date,
const wxString& format = wxPyDateFormatStr, const wxString& format = wxPyDefaultDateTimeFormat,
const wxDateTime& dateDef = wxDefaultDateTime) { const wxDateTime& dateDef = wxDefaultDateTime) {
const wxChar* rv; const wxChar* rv;
const wxChar* _date = date; const wxChar* _date = date;
@@ -828,7 +828,7 @@ public:
// argument corresponds to the preferred date and time representation // argument corresponds to the preferred date and time representation
// for the current locale) and returns the string containing the // for the current locale) and returns the string containing the
// resulting text representation // resulting text representation
wxString Format(const wxString& format = wxPyDateFormatStr, wxString Format(const wxString& format = wxPyDefaultDateTimeFormat,
const wxDateTime::TimeZone& tz = LOCAL_TZ) const; const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
// preferred date representation for the current locale // preferred date representation for the current locale
@@ -995,7 +995,7 @@ public:
// resulting text representation. Notice that only some of format // resulting text representation. Notice that only some of format
// specifiers valid for wxDateTime are valid for wxTimeSpan: hours, // specifiers valid for wxDateTime are valid for wxTimeSpan: hours,
// minutes and seconds make sense, but not "PM/AM" string for example. // 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 { %pythoncode {
def __repr__(self): def __repr__(self):

View File

@@ -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 // General numeric #define's and etc. Making them all enums makes SWIG use the
// real macro when making the Python Int // real macro when making the Python Int
@@ -437,16 +444,6 @@ enum {
wxRA_SPECIFY_COLS, wxRA_SPECIFY_COLS,
wxRB_GROUP, wxRB_GROUP,
wxRB_SINGLE, 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_HORIZONTAL,
wxSB_VERTICAL, wxSB_VERTICAL,
wxST_SIZEGRIP, wxST_SIZEGRIP,

View File

@@ -809,15 +809,13 @@ public:
wxPoint GetPosition() const; wxPoint GetPosition() const;
wxRect GetRect() const; wxRect GetRect() const;
void SetRect(wxRect rect); void SetRect(const wxRect& rect);
%extend { void SetPosition(const wxPoint& pos);
void SetPosition(wxPoint pos) {
self->m_pos = pos;
}
}
wxPoint m_pos; %pythoncode {
wxRect m_rect; m_pos = property(GetPosition, SetPosition)
m_rect = property(GetRect, SetRect)
}
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@@ -202,6 +202,7 @@ int wxMessageBox(const wxString& message,
wxWindow *parent = NULL, wxWindow *parent = NULL,
int x = -1, int y = -1); int x = -1, int y = -1);
// WXWIN_COMPATIBILITY_2_4
MustHaveApp(wxGetNumberFromUser); MustHaveApp(wxGetNumberFromUser);
long wxGetNumberFromUser(const wxString& message, long wxGetNumberFromUser(const wxString& message,
const wxString& prompt, 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.", "");
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@@ -172,12 +172,6 @@ public:
class wxJoystickEvent : public wxEvent class wxJoystickEvent : public wxEvent
{ {
public: 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, wxJoystickEvent(wxEventType type = wxEVT_NULL,
int state = 0, int state = 0,
int joystick = wxJOYSTICK1, int joystick = wxJOYSTICK1,
@@ -212,6 +206,14 @@ public:
// Was the given button 1,2,3,4 or any in Down state? // Was the given button 1,2,3,4 or any in Down state?
bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const; 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)
}
}; };

View File

@@ -19,7 +19,7 @@
#include <wx/listctrl.h> #include <wx/listctrl.h>
%} %}
MAKE_CONST_WXSTRING2(ListCtrlNameStr, _T("wxListCtrl")); MAKE_CONST_WXSTRING(ListCtrlNameStr);
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
%newgroup %newgroup
@@ -288,8 +288,6 @@ public:
%constant wxEventType wxEVT_COMMAND_LIST_END_LABEL_EDIT; %constant wxEventType wxEVT_COMMAND_LIST_END_LABEL_EDIT;
%constant wxEventType wxEVT_COMMAND_LIST_DELETE_ITEM; %constant wxEventType wxEVT_COMMAND_LIST_DELETE_ITEM;
%constant wxEventType wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS; %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_SELECTED;
%constant wxEventType wxEVT_COMMAND_LIST_ITEM_DESELECTED; %constant wxEventType wxEVT_COMMAND_LIST_ITEM_DESELECTED;
%constant wxEventType wxEVT_COMMAND_LIST_KEY_DOWN; %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_COL_END_DRAG;
%constant wxEventType wxEVT_COMMAND_LIST_ITEM_FOCUSED; %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 { %pythoncode {

View File

@@ -407,6 +407,7 @@ public:
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
%newgroup; %newgroup;
// WXWIN_COMPATIBILITY_2_4
class wxBookCtrlSizer: public wxSizer class wxBookCtrlSizer: public wxSizer
{ {

View File

@@ -25,6 +25,21 @@ MAKE_CONST_WXSTRING(SliderNameStr);
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
%newgroup %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); MustHaveApp(wxSlider);
class wxSlider : public wxControl { class wxSlider : public wxControl {

View File

@@ -99,6 +99,12 @@ enum wxTextCtrlHitTestResult
wxTE_HT_BEYOND // after [the end of line] wxTE_HT_BEYOND // after [the end of line]
}; };
enum {
wxOutOfRangeTextCoord,
wxInvalidTextCoord
};
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// wxTextAttr: a structure containing the visual attributes of a text // wxTextAttr: a structure containing the visual attributes of a text

View File

@@ -39,8 +39,7 @@
MAKE_CONST_WXSTRING_NOSWIG(EmptyString); MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
MAKE_CONST_WXSTRING_NOSWIG(PanelNameStr); MAKE_CONST_WXSTRING_NOSWIG(PanelNameStr);
MAKE_CONST_WXSTRING2(DateTimeFormatStr, wxT("%c")); MAKE_CONST_WXSTRING_NOSWIG(DefaultDateTimeFormat);
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// OOR related typemaps and helper functions // OOR related typemaps and helper functions
@@ -736,8 +735,8 @@ class wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
{ {
public: public:
%pythonAppend wxGridCellDateTimeRenderer "self._setOORInfo(self)" %pythonAppend wxGridCellDateTimeRenderer "self._setOORInfo(self)"
wxGridCellDateTimeRenderer(wxString outformat = wxPyDateTimeFormatStr, wxGridCellDateTimeRenderer(wxString outformat = wxPyDefaultDateTimeFormat,
wxString informat = wxPyDateTimeFormatStr); wxString informat = wxPyDefaultDateTimeFormat);
}; };

View File

@@ -135,6 +135,8 @@ wxTE_HT_BEFORE = wx._controls.TE_HT_BEFORE
wxTE_HT_ON_TEXT = wx._controls.TE_HT_ON_TEXT wxTE_HT_ON_TEXT = wx._controls.TE_HT_ON_TEXT
wxTE_HT_BELOW = wx._controls.TE_HT_BELOW wxTE_HT_BELOW = wx._controls.TE_HT_BELOW
wxTE_HT_BEYOND = wx._controls.TE_HT_BEYOND wxTE_HT_BEYOND = wx._controls.TE_HT_BEYOND
wxOutOfRangeTextCoord = wx._controls.OutOfRangeTextCoord
wxInvalidTextCoord = wx._controls.InvalidTextCoord
wxTextAttr = wx._controls.TextAttr wxTextAttr = wx._controls.TextAttr
wxTextAttrPtr = wx._controls.TextAttrPtr wxTextAttrPtr = wx._controls.TextAttrPtr
wxTextAttr_Combine = wx._controls.TextAttr_Combine 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_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_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_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_SELECTED = wx._controls.wxEVT_COMMAND_LIST_ITEM_SELECTED
wxEVT_COMMAND_LIST_ITEM_DESELECTED = wx._controls.wxEVT_COMMAND_LIST_ITEM_DESELECTED wxEVT_COMMAND_LIST_ITEM_DESELECTED = wx._controls.wxEVT_COMMAND_LIST_ITEM_DESELECTED
wxEVT_COMMAND_LIST_KEY_DOWN = wx._controls.wxEVT_COMMAND_LIST_KEY_DOWN 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_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_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_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 wxListCtrl = wx._controls.ListCtrl
wxListCtrlPtr = wx._controls.ListCtrlPtr wxListCtrlPtr = wx._controls.ListCtrlPtr
wxListCtrl = wx._controls.ListCtrl wxListCtrl = wx._controls.ListCtrl

View File

@@ -458,8 +458,8 @@ wxFileConfigPtr = wx._misc.FileConfigPtr
wxConfigPathChanger = wx._misc.ConfigPathChanger wxConfigPathChanger = wx._misc.ConfigPathChanger
wxConfigPathChangerPtr = wx._misc.ConfigPathChangerPtr wxConfigPathChangerPtr = wx._misc.ConfigPathChangerPtr
wxExpandEnvVars = wx._misc.ExpandEnvVars wxExpandEnvVars = wx._misc.ExpandEnvVars
wxDateFormatStr = wx._misc.DateFormatStr wxDefaultDateTimeFormat = wx._misc.DefaultDateTimeFormat
wxTimeSpanFormatStr = wx._misc.TimeSpanFormatStr wxDefaultTimeSpanFormat = wx._misc.DefaultTimeSpanFormat
wxDateTime = wx._misc.DateTime wxDateTime = wx._misc.DateTime
wxDateTimePtr = wx._misc.DateTimePtr wxDateTimePtr = wx._misc.DateTimePtr
wxDateTime_SetCountry = wx._misc.DateTime_SetCountry wxDateTime_SetCountry = wx._misc.DateTime_SetCountry

View File

@@ -19,7 +19,6 @@ del sys, _wx
# Now assign all the reverse-renamed names: # Now assign all the reverse-renamed names:
wxDateTimeFormatStr = wx.grid.DateTimeFormatStr
wxGRID_VALUE_STRING = wx.grid.GRID_VALUE_STRING wxGRID_VALUE_STRING = wx.grid.GRID_VALUE_STRING
wxGRID_VALUE_BOOL = wx.grid.GRID_VALUE_BOOL wxGRID_VALUE_BOOL = wx.grid.GRID_VALUE_BOOL
wxGRID_VALUE_NUMBER = wx.grid.GRID_VALUE_NUMBER wxGRID_VALUE_NUMBER = wx.grid.GRID_VALUE_NUMBER