* 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

@@ -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;

View File

@@ -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);

View File

@@ -18,10 +18,10 @@
%{
#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 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):

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
// 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,

View File

@@ -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)
}
};
//---------------------------------------------------------------------------

View File

@@ -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.", "");
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

View File

@@ -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)
}
};

View File

@@ -19,7 +19,7 @@
#include <wx/listctrl.h>
%}
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 {

View File

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

View File

@@ -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 {

View File

@@ -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

View File

@@ -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);
};