X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dd9f7fea29e3f8bb61861f52984b7943512346ac..9e477492e29e03c02827b1e42a16cb09a13f5149:/wxPython/src/_radio.i diff --git a/wxPython/src/_radio.i b/wxPython/src/_radio.i index 323f7ae965..0294f6cf85 100644 --- a/wxPython/src/_radio.i +++ b/wxPython/src/_radio.i @@ -15,40 +15,42 @@ //--------------------------------------------------------------------------- -%{ - DECLARE_DEF_STRING(RadioBoxNameStr); - DECLARE_DEF_STRING(RadioButtonNameStr); -%} +MAKE_CONST_WXSTRING(RadioBoxNameStr); +MAKE_CONST_WXSTRING(RadioButtonNameStr); //--------------------------------------------------------------------------- %newgroup +MustHaveApp(wxRadioBox); + class wxRadioBox : public wxControl { public: - %addtofunc wxRadioBox "self._setOORInfo(self)" - %addtofunc wxRadioBox() "" - - wxRadioBox(wxWindow* parent, wxWindowID id, - const wxString& label, - const wxPoint& point = wxDefaultPosition, + %pythonPrepend wxRadioBox "if kwargs.has_key('point'): kwargs['pos'] = kwargs['point'];del kwargs['point']" + %pythonPrepend wxRadioBox() "" + %pythonAppend wxRadioBox "self._setOORInfo(self)" + %pythonAppend wxRadioBox() "" + + wxRadioBox(wxWindow* parent, wxWindowID id=-1, + const wxString& label = wxPyEmptyString, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int choices = 0, wxString* choices_array = NULL, - int majorDimension = 0, - long style = wxRA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxPyRadioBoxNameStr); - %name(PreRadioBox)wxRadioBox(); - - bool Create(wxWindow* parent, wxWindowID id, - const wxString& label, - const wxPoint& point = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int choices = 0, wxString* choices_array = NULL, + const wxArrayString& choices = wxPyEmptyStringArray, int majorDimension = 0, long style = wxRA_HORIZONTAL, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxPyRadioBoxNameStr); + %RenameCtor(PreRadioBox, wxRadioBox()); + + bool Create(wxWindow* parent, wxWindowID id=-1, + const wxString& label = wxPyEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxArrayString& choices = wxPyEmptyStringArray, + int majorDimension = 0, + long style = wxRA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxPyRadioBoxNameStr); virtual void SetSelection(int n); virtual int GetSelection() const; @@ -57,7 +59,7 @@ public: virtual bool SetStringSelection(const wxString& s); // string access - virtual int GetCount() const; + virtual size_t GetCount() const; virtual int FindString(const wxString& s) const; virtual wxString GetString(int n) const; @@ -66,47 +68,68 @@ public: %pythoncode { SetItemLabel = SetString }; // change the individual radio button state - %name(EnableItem) virtual void Enable(int n, bool enable = True); - %name(ShowItem) virtual void Show(int n, bool show = True); + %Rename(EnableItem, virtual void, Enable(unsigned int n, bool enable = true)); + %Rename(ShowItem, virtual void, Show(unsigned int n, bool show = true)); + virtual bool IsItemEnabled(unsigned int n) const; + virtual bool IsItemShown(unsigned int n) const; -#ifndef __WXGTK__ // layout parameters - virtual int GetColumnCount() const; - virtual int GetRowCount() const; + virtual unsigned int GetColumnCount() const; + virtual unsigned int GetRowCount() const; // return the item above/below/to the left/right of the given one int GetNextItem(int item, wxDirection dir, long style) const; -#else - %extend { - int GetColumnCount() const { return -1; } - int GetRowCount() const { return -1; } - int GetNextItem(int item, wxDirection dir, long style) const { return -1; } - } -#endif + + // set the tooltip text for a radio item, empty string unsets any tooltip + void SetItemToolTip(unsigned int item, const wxString& text); + + // get the individual items tooltip; returns NULL if none + wxToolTip *GetItemToolTip(unsigned int item) const; + + // set helptext for a particular item, pass an empty string to erase it + void SetItemHelpText(unsigned int n, const wxString& helpText); + + // retrieve helptext for a particular item, empty string means no help text + wxString GetItemHelpText(unsigned int n) const; + +// Hmmm... This is protected on wxMSW. +// virtual int GetItemFromPoint(const wxPoint& pt) const; + +// bool IsValid(int n) const; ** not public + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + %property(ColumnCount, GetColumnCount, doc="See `GetColumnCount`"); + %property(Count, GetCount, doc="See `GetCount`"); + %property(RowCount, GetRowCount, doc="See `GetRowCount`"); + %property(Selection, GetSelection, SetSelection, doc="See `GetSelection` and `SetSelection`"); + %property(StringSelection, GetStringSelection, SetStringSelection, doc="See `GetStringSelection` and `SetStringSelection`"); }; //--------------------------------------------------------------------------- %newgroup +MustHaveApp(wxRadioButton); + class wxRadioButton : public wxControl { public: - %addtofunc wxRadioButton "self._setOORInfo(self)" - %addtofunc wxRadioButton() "" + %pythonAppend wxRadioButton "self._setOORInfo(self)" + %pythonAppend wxRadioButton() "" - wxRadioButton(wxWindow* parent, wxWindowID id, - const wxString& label, + wxRadioButton(wxWindow* parent, wxWindowID id=-1, + const wxString& label = wxPyEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxPyRadioButtonNameStr); - %name(PreRadioButton)wxRadioButton(); + %RenameCtor(PreRadioButton, wxRadioButton()); - bool Create(wxWindow* parent, wxWindowID id, - const wxString& label, + bool Create(wxWindow* parent, wxWindowID id=-1, + const wxString& label = wxPyEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, @@ -115,6 +138,11 @@ public: bool GetValue(); void SetValue(bool value); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + %property(Value, GetValue, SetValue, doc="See `GetValue` and `SetValue`"); }; //---------------------------------------------------------------------------