X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b68dc582b8c6dd32ef9f0a4ec91573bd5cc0296a..c0f8674c79186e83854f43e53e4805fd3ee866b4:/wxPython/src/controls.i diff --git a/wxPython/src/controls.i b/wxPython/src/controls.i index 2e8f3e4f1f..a30e1d7244 100644 --- a/wxPython/src/controls.i +++ b/wxPython/src/controls.i @@ -19,7 +19,7 @@ #include #include #include -//#include +#include #ifdef __WXMSW__ #if wxUSE_OWNER_DRAWN @@ -125,31 +125,6 @@ public: int GetMarginY() const { return m_marginY; } }; -//---------------------------------------------------------------------- - -// class wxToggleButton : public wxControl { -// public: -// wxToggleButton(wxWindow *parent, wxWindowID id, const wxString& label, -// const wxPoint& pos = wxDefaultPosition, -// const wxSize& size = wxDefaultSize, long style = 0, -// const wxValidator& validator = wxDefaultValidator, -// const char* name = "toggle"); -// void SetValue(bool value); -// bool GetValue() const ; -// void SetLabel(const wxString& label); -// }; - -// class wxBitmapToggleButton : public wxToggleButton { -// public: -// wxBitmapToggleButton(wxWindow *parent, wxWindowID id, const wxBitmap *label, -// const wxPoint& pos = wxDefaultPosition, -// const wxSize& size = wxDefaultSize, long style = 0, -// const wxValidator& validator = wxDefaultValidator, -// const char *name = "toggle"); -// void SetLabel(const wxBitmap& bitmap); -// }; - - //---------------------------------------------------------------------- class wxCheckBox : public wxControl { @@ -183,15 +158,23 @@ public: void Append(const wxString& item); void Clear(); + void Delete(int n); int FindString(const wxString& string); int GetColumns(); int GetSelection(); wxString GetString(const int n); wxString GetStringSelection(); - int Number(); + int GetCount(); void SetColumns(const int n = 1); void SetSelection(const int n); void SetStringSelection(const wxString& string); + void SetString(int n, const wxString& s); + + %pragma(python) addtoclass = " + Number = GetCount + Select = SetSelection + " + }; //---------------------------------------------------------------------- @@ -223,7 +206,6 @@ public: wxString GetString(int n); wxString GetStringSelection(); wxString GetValue(); - int Number(); void Paste(); void Replace(long from, long to, const wxString& text); void Remove(long from, long to); @@ -233,6 +215,7 @@ public: void SetSelection(int n); %name(SetMark)void SetSelection(long from, long to); void SetValue(const wxString& text); + void SetEditable(bool editable); }; //---------------------------------------------------------------------- @@ -339,7 +322,9 @@ public: wxString GetString(int n); wxString GetStringSelection(); - int Number(); + int GetCount(); + %pragma(python) addtoclass = "Number = GetCount" + bool IsSelected(const int n); bool Selected(const int n); void Set(int LCOUNT, wxString* choices); // TODO: void SetClientData(const int n, char* data); @@ -375,6 +360,33 @@ public: //---------------------------------------------------------------------- + +class wxTextAttr +{ +public: + // ctors + wxTextAttr(const wxColour& colText = wxNullColour, + const wxColour& colBack = wxNullColour, + const wxFont& font = wxNullFont); + ~wxTextAttr(); + + // setters + void SetTextColour(const wxColour& colText); + void SetBackgroundColour(const wxColour& colBack); + void SetFont(const wxFont& font); + + // accessors + bool HasTextColour() const; + bool HasBackgroundColour() const; + bool HasFont() const; + + const wxColour& GetTextColour() const; + const wxColour& GetBackgroundColour() const; + const wxFont& GetFont() const; +}; + + + class wxTextCtrl : public wxControl { public: wxTextCtrl(wxWindow* parent, wxWindowID id, char* value = "", @@ -423,9 +435,13 @@ public: void Undo(); void Redo(); + bool SetStyle(long start, long end, const wxTextAttr& style); + bool SetDefaultStyle(const wxTextAttr& style); + const wxTextAttr& GetDefaultStyle() const; + %addmethods { void write(const wxString& text) { - self->AppendText(text + '\n'); + self->AppendText(text); } } }; @@ -509,15 +525,26 @@ public: %name(EnableItem)void Enable(int n, bool enable); int FindString(const wxString& string); -//*** wxString GetLabel(); -//*** void SetLabel(const wxString& label); + wxString GetString(int n); + +#ifdef __WXMSW__ + void SetString(int n, const wxString& label); + %pragma(python) addtoclass = " + GetItemLabel = GetString + SetItemLabel = SetString + " + int GetColumnCount(); + int GetRowCount(); +#else + %name(GetItemLabel)wxString GetLabel( int item ); + %name(SetItemLabel)void SetLabel( int item, const wxString& label ); +#endif - %name(GetItemLabel)wxString GetLabel(int n); int GetSelection(); - wxString GetString(int n); wxString GetStringSelection(); - int Number(); - %name(SetItemLabel)void SetLabel(int n, const wxString& label); + int GetCount(); + %pragma(python) addtoclass = "Number = GetCount" + void SetSelection(int n); void SetStringSelection(const wxString& string); void Show(bool show); @@ -603,5 +630,28 @@ public: //---------------------------------------------------------------------- +enum { wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, }; + +class wxToggleButton : public wxControl { +public: + wxToggleButton(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const char* name = "toggle"); + + void SetValue(bool value); + bool GetValue() const ; + void SetLabel(const wxString& label); + +}; + +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +