1//--------------------------------------------------------------------------- 2// This file is generated by wxPython's SIP generator. Do not edit by hand. 3// 4// Copyright: (c) 2018 by Total Control Software 5// License: wxWindows License 6// 7// This file will be included by _core.sip 8// 9//--------------------------------------------------------------------------- 10 11//--------------------------------------------------------------------------- 12 13class wxCheckListBox : wxListBox 14{ 15 %Docstring 16 CheckListBox(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, choices=[], style=0, validator=DefaultValidator, name="listBox") 17 CheckListBox() 18 19 A wxCheckListBox is like a wxListBox, but allows items to be checked 20 or unchecked. 21 %End 22 %TypeHeaderCode 23 #include <wx/checklst.h> 24 %End 25 26public: 27 wxCheckListBox( 28 wxWindow * parent /TransferThis/, 29 wxWindowID id = wxID_ANY, 30 const wxPoint & pos = wxDefaultPosition, 31 const wxSize & size = wxDefaultSize, 32 const wxArrayString & choices = wxArrayString(), 33 long style = 0, 34 const wxValidator & validator = wxDefaultValidator, 35 const wxString & name = "listBox" 36 ); 37 %PreMethodCode 38 if (!wxPyCheckForApp()) return NULL; 39 %End 40 41 wxCheckListBox(); 42 %PreMethodCode 43 if (!wxPyCheckForApp()) return NULL; 44 %End 45 46 ~wxCheckListBox(); 47 48 bool Create( 49 wxWindow * parent /TransferThis/, 50 wxWindowID id = wxID_ANY, 51 const wxPoint & pos = wxDefaultPosition, 52 const wxSize & size = wxDefaultSize, 53 const wxArrayString & choices = wxArrayString(), 54 long style = 0, 55 const wxValidator & validator = wxDefaultValidator, 56 const wxString & name = wxListBoxNameStr 57 ); 58 %Docstring 59 Create(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, choices=[], style=0, validator=DefaultValidator, name=ListBoxNameStr) -> bool 60 %End 61 62 void Check( 63 unsigned int item, 64 bool check = true 65 ); 66 %Docstring 67 Check(item, check=True) 68 69 Checks the given item. 70 %End 71 72 bool IsChecked( 73 unsigned int item 74 ) const; 75 %Docstring 76 IsChecked(item) -> bool 77 78 Returns true if the given item is checked, false otherwise. 79 %End 80 81 public: 82 virtual wxPoint GetClientAreaOrigin() const; 83 virtual bool Validate(); 84 virtual bool TransferDataToWindow(); 85 virtual bool TransferDataFromWindow(); 86 virtual void InitDialog(); 87 virtual bool AcceptsFocus() const; 88 virtual bool AcceptsFocusRecursively() const; 89 virtual bool AcceptsFocusFromKeyboard() const; 90 virtual void AddChild( wxWindowBase *child ); 91 virtual void RemoveChild( wxWindowBase *child ); 92 virtual void InheritAttributes(); 93 virtual bool ShouldInheritColours() const; 94 virtual void OnInternalIdle(); 95 virtual wxWindow *GetMainWindowOfCompositeControl(); 96 virtual bool InformFirstDirection(int direction, int size, int availableOtherDir); 97 virtual void SetCanFocus(bool canFocus); 98 virtual bool Destroy(); 99 virtual void SetValidator( const wxValidator &validator ); 100 virtual wxValidator* GetValidator(); 101 102 103 protected: 104 virtual bool ProcessEvent(wxEvent & event); 105 virtual void DoEnable(bool enable); 106 virtual void DoGetPosition(int *x, int *y) const; 107 virtual void DoGetSize(int *width, int *height) const; 108 virtual void DoGetClientSize(int *width, int *height) const; 109 virtual wxSize DoGetBestSize() const; 110 virtual wxSize DoGetBestClientSize() const; 111 virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags); 112 virtual void DoSetClientSize(int width, int height); 113 virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH ); 114 virtual wxSize DoGetBorderSize() const; 115 virtual void DoMoveWindow(int x, int y, int width, int height); 116 virtual void DoSetWindowVariant( wxWindowVariant variant); 117 virtual wxBorder GetDefaultBorder() const; 118 virtual wxBorder GetDefaultBorderForControl() const; 119 virtual void DoFreeze(); 120 virtual void DoThaw(); 121 virtual bool HasTransparentBackground(); 122 virtual bool TryBefore(wxEvent& event); 123 virtual bool TryAfter(wxEvent& event); 124 125 126 public: 127 128 129 static 130 wxVisualAttributes GetClassDefaultAttributes( 131 wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL 132 ); 133 %Docstring 134 GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes 135 %End 136 %PreMethodCode 137 if (!wxPyCheckForApp()) return NULL; 138 %End 139 140}; // end of class wxCheckListBox 141 142 143%Extract(id=pycode_core) 144def _CheckListBox_GetCheckedItems(self): 145 """ 146 GetCheckedItems() 147 148 Return a sequence of integers corresponding to the checked items in 149 the control, based on :meth:`IsChecked`. 150 """ 151 return tuple([i for i in range(self.Count) if self.IsChecked(i)]) 152CheckListBox.GetCheckedItems = _CheckListBox_GetCheckedItems 153del _CheckListBox_GetCheckedItems 154%End 155 156%Extract(id=pycode_core) 157def _CheckListBox_GetCheckedStrings(self): 158 """ 159 GetCheckedStrings() 160 161 Return a tuple of strings corresponding to the checked 162 items of the control, based on :meth:`GetChecked`. 163 """ 164 return tuple([self.GetString(i) for i in self.GetCheckedItems()]) 165CheckListBox.GetCheckedStrings = _CheckListBox_GetCheckedStrings 166del _CheckListBox_GetCheckedStrings 167%End 168 169%Extract(id=pycode_core) 170def _CheckListBox_SetCheckedItems(self, indexes): 171 """ 172 SetCheckedItems(indexes) 173 174 Sets the checked state of items if the index of the item is 175 found in the indexes sequence. 176 """ 177 for i in indexes: 178 assert 0 <= i < self.Count, "Index (%s) out of range" % i 179 for i in range(self.Count): 180 self.Check(i, i in indexes) 181CheckListBox.SetCheckedItems = _CheckListBox_SetCheckedItems 182del _CheckListBox_SetCheckedItems 183%End 184 185%Extract(id=pycode_core) 186def _CheckListBox_SetCheckedStrings(self, strings): 187 """ 188 SetCheckedStrings(strings) 189 190 Sets the checked state of items if the item's string is found 191 in the strings sequence. 192 """ 193 for s in strings: 194 assert s in self.GetStrings(), "String ('%s') not found" % s 195 for i in range(self.Count): 196 self.Check(i, self.GetString(i) in strings) 197CheckListBox.SetCheckedStrings = _CheckListBox_SetCheckedStrings 198del _CheckListBox_SetCheckedStrings 199%End 200 201%Extract(id=pycode_core) 202def _CheckListBox_GetChecked(self): 203 return self.GetCheckedItems() 204CheckListBox.GetChecked = wx.deprecated(_CheckListBox_GetChecked, "Use GetCheckedItems instead.") 205del _CheckListBox_GetChecked 206%End 207 208%Extract(id=pycode_core) 209def _CheckListBox_SetChecked(self, indexes): 210 return self.SetCheckedItems(indexes) 211CheckListBox.SetChecked = wx.deprecated(_CheckListBox_SetChecked, "Use SetCheckedItems instead.") 212del _CheckListBox_SetChecked 213%End 214 215%Extract(id=pycode_core) 216CheckListBox.Checked = property(CheckListBox.GetChecked, CheckListBox.SetChecked) 217%End 218 219%Extract(id=pycode_core) 220CheckListBox.CheckedItems = property(CheckListBox.GetCheckedItems, CheckListBox.SetCheckedItems) 221%End 222 223%Extract(id=pycode_core) 224CheckListBox.CheckedStrings = property(CheckListBox.GetCheckedStrings, CheckListBox.SetCheckedStrings) 225%End 226 227 228//--------------------------------------------------------------------------- 229 230