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 13const char* wxListBoxNameStr; 14 15class wxListBox : wxControl, wxItemContainer 16{ 17 %Docstring 18 ListBox() 19 ListBox(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, choices=[], style=0, validator=DefaultValidator, name=ListBoxNameStr) 20 21 A listbox is used to select one or more of a list of strings. 22 %End 23 %TypeHeaderCode 24 #include <wx/listbox.h> 25 %End 26 27public: 28 wxListBox(); 29 %PreMethodCode 30 if (!wxPyCheckForApp()) return NULL; 31 %End 32 33 wxListBox( 34 wxWindow * parent /TransferThis/, 35 wxWindowID id = wxID_ANY, 36 const wxPoint & pos = wxDefaultPosition, 37 const wxSize & size = wxDefaultSize, 38 const wxArrayString & choices = wxArrayString(), 39 long style = 0, 40 const wxValidator & validator = wxDefaultValidator, 41 const wxString & name = wxListBoxNameStr 42 ); 43 %PreMethodCode 44 if (!wxPyCheckForApp()) return NULL; 45 %End 46 47 ~wxListBox(); 48 49 bool Create( 50 wxWindow * parent /TransferThis/, 51 wxWindowID id = wxID_ANY, 52 const wxPoint & pos = wxDefaultPosition, 53 const wxSize & size = wxDefaultSize, 54 const wxArrayString & choices = wxArrayString(), 55 long style = 0, 56 const wxValidator & validator = wxDefaultValidator, 57 const wxString & name = wxListBoxNameStr 58 ); 59 %Docstring 60 Create(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, choices=[], style=0, validator=DefaultValidator, name=ListBoxNameStr) -> bool 61 62 Creates the listbox for two-step construction. 63 %End 64 65 void Deselect( 66 int n 67 ); 68 %Docstring 69 Deselect(n) 70 71 Deselects an item in the list box. 72 %End 73 74 void SetSelection( 75 int n 76 ); 77 %Docstring 78 SetSelection(n) 79 80 Sets the selection to the given item n or removes the selection 81 entirely if n == wxNOT_FOUND. 82 %End 83 84 int GetSelection() const; 85 %Docstring 86 GetSelection() -> int 87 88 Returns the index of the selected item or wxNOT_FOUND if no item is 89 selected. 90 %End 91 92 bool SetStringSelection( 93 const wxString & s, 94 bool select 95 ); 96 %Docstring 97 SetStringSelection(s, select) -> bool 98 SetStringSelection(s) -> bool 99 %End 100 101 bool SetStringSelection( 102 const wxString & s 103 ); 104 105 wxArrayInt* GetSelections( 106 ) const /Factory/; 107 %Docstring 108 GetSelections() -> ArrayInt 109 110 Fill an array of ints with the positions of the currently selected 111 items. 112 %End 113 %MethodCode 114 PyErr_Clear(); 115 Py_BEGIN_ALLOW_THREADS 116 sipRes = _wxListBox_GetSelections(sipCpp); 117 Py_END_ALLOW_THREADS 118 if (PyErr_Occurred()) sipIsErr = 1; 119 %End 120 %TypeCode 121 wxArrayInt* _wxListBox_GetSelections(const wxListBox* self) 122 { 123 wxArrayInt* array = new wxArrayInt; 124 self->GetSelections(*array); 125 return array; 126 } 127 %End 128 129 int HitTest( 130 const wxPoint & point 131 ) const; 132 %Docstring 133 HitTest(point) -> int 134 HitTest(x, y) -> int 135 136 Returns the item located at point, or wxNOT_FOUND if there is no item 137 located at point. 138 %End 139 140 int HitTest( 141 int x, 142 int y 143 ) const; 144 145 void InsertItems( 146 const wxArrayString & items, 147 unsigned int pos 148 ); 149 %Docstring 150 InsertItems(items, pos) 151 152 Insert the given number of strings before the specified position. 153 %End 154 155 bool IsSelected( 156 int n 157 ) const; 158 %Docstring 159 IsSelected(n) -> bool 160 161 Determines whether an item is selected. 162 %End 163 164 void SetFirstItem( 165 int n 166 ); 167 %Docstring 168 SetFirstItem(n) 169 SetFirstItem(string) 170 171 Set the specified item to be the first visible item. 172 %End 173 174 void SetFirstItem( 175 const wxString & string 176 ); 177 178 void EnsureVisible( 179 int n 180 ); 181 %Docstring 182 EnsureVisible(n) 183 184 Ensure that the item with the given index is currently shown. 185 %End 186 187 bool IsSorted() const; 188 %Docstring 189 IsSorted() -> bool 190 191 Return true if the listbox has wxLB_SORT style. 192 %End 193 194 unsigned int GetCount() const; 195 %Docstring 196 GetCount() -> unsignedint 197 198 Returns the number of items in the control. 199 %End 200 201 wxString GetString( 202 unsigned int n 203 ) const; 204 %Docstring 205 GetString(n) -> String 206 207 Returns the label of the item with the given index. 208 %End 209 210 void SetString( 211 unsigned int n, 212 const wxString & string 213 ); 214 %Docstring 215 SetString(n, string) 216 217 Sets the label for the given item. 218 %End 219 220 int FindString( 221 const wxString & string, 222 bool caseSensitive = false 223 ) const; 224 %Docstring 225 FindString(string, caseSensitive=False) -> int 226 227 Finds an item whose label matches the given string. 228 %End 229 230 void SetItemForegroundColour(int item, const wxColour* c); 231 %Docstring 232 SetItemForegroundColour(item, c) 233 234 Set the foreground colour of an item in the ListBox. 235 Only valid on MSW and if the ``wx.LB_OWNERDRAW`` flag is set. 236 %End 237 %MethodCode 238 PyErr_Clear(); 239 Py_BEGIN_ALLOW_THREADS 240 _wxListBox_SetItemForegroundColour(sipCpp, item, c); 241 Py_END_ALLOW_THREADS 242 if (PyErr_Occurred()) sipIsErr = 1; 243 %End 244 %TypeCode 245 void _wxListBox_SetItemForegroundColour(wxListBox* self, int item, const wxColour* c) 246 { 247 #ifdef __WXMSW__ 248 if (self->GetWindowStyle() & wxLB_OWNERDRAW) 249 self->GetItem(item)->SetTextColour(*c); 250 #endif 251 } 252 %End 253 254 void SetItemBackgroundColour(int item, const wxColour* c); 255 %Docstring 256 SetItemBackgroundColour(item, c) 257 258 Set the background colour of an item in the ListBox. 259 Only valid on MSW and if the ``wx.LB_OWNERDRAW`` flag is set. 260 %End 261 %MethodCode 262 PyErr_Clear(); 263 Py_BEGIN_ALLOW_THREADS 264 _wxListBox_SetItemBackgroundColour(sipCpp, item, c); 265 Py_END_ALLOW_THREADS 266 if (PyErr_Occurred()) sipIsErr = 1; 267 %End 268 %TypeCode 269 void _wxListBox_SetItemBackgroundColour(wxListBox* self, int item, const wxColour* c) 270 { 271 #ifdef __WXMSW__ 272 if (self->GetWindowStyle() & wxLB_OWNERDRAW) 273 self->GetItem(item)->SetBackgroundColour(*c); 274 #endif 275 } 276 %End 277 278 void SetItemFont(int item, const wxFont* f); 279 %Docstring 280 SetItemFont(item, f) 281 282 Set the font of an item in the ListBox. 283 Only valid on MSW and if the ``wx.LB_OWNERDRAW`` flag is set. 284 %End 285 %MethodCode 286 PyErr_Clear(); 287 Py_BEGIN_ALLOW_THREADS 288 _wxListBox_SetItemFont(sipCpp, item, f); 289 Py_END_ALLOW_THREADS 290 if (PyErr_Occurred()) sipIsErr = 1; 291 %End 292 %TypeCode 293 void _wxListBox_SetItemFont(wxListBox* self, int item, const wxFont* f) 294 { 295 #ifdef __WXMSW__ 296 if (self->GetWindowStyle() & wxLB_OWNERDRAW) 297 self->GetItem(item)->SetFont(*f); 298 #endif 299 } 300 %End 301 302 public: 303 virtual wxPoint GetClientAreaOrigin() const; 304 virtual bool Validate(); 305 virtual bool TransferDataToWindow(); 306 virtual bool TransferDataFromWindow(); 307 virtual void InitDialog(); 308 virtual bool AcceptsFocus() const; 309 virtual bool AcceptsFocusRecursively() const; 310 virtual bool AcceptsFocusFromKeyboard() const; 311 virtual void AddChild( wxWindowBase *child ); 312 virtual void RemoveChild( wxWindowBase *child ); 313 virtual void InheritAttributes(); 314 virtual bool ShouldInheritColours() const; 315 virtual void OnInternalIdle(); 316 virtual wxWindow *GetMainWindowOfCompositeControl(); 317 virtual bool InformFirstDirection(int direction, int size, int availableOtherDir); 318 virtual void SetCanFocus(bool canFocus); 319 virtual bool Destroy(); 320 virtual void SetValidator( const wxValidator &validator ); 321 virtual wxValidator* GetValidator(); 322 323 324 protected: 325 virtual bool ProcessEvent(wxEvent & event); 326 virtual void DoEnable(bool enable); 327 virtual void DoGetPosition(int *x, int *y) const; 328 virtual void DoGetSize(int *width, int *height) const; 329 virtual void DoGetClientSize(int *width, int *height) const; 330 virtual wxSize DoGetBestSize() const; 331 virtual wxSize DoGetBestClientSize() const; 332 virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags); 333 virtual void DoSetClientSize(int width, int height); 334 virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH ); 335 virtual wxSize DoGetBorderSize() const; 336 virtual void DoMoveWindow(int x, int y, int width, int height); 337 virtual void DoSetWindowVariant( wxWindowVariant variant); 338 virtual wxBorder GetDefaultBorder() const; 339 virtual wxBorder GetDefaultBorderForControl() const; 340 virtual void DoFreeze(); 341 virtual void DoThaw(); 342 virtual bool HasTransparentBackground(); 343 virtual bool TryBefore(wxEvent& event); 344 virtual bool TryAfter(wxEvent& event); 345 346 347 public: 348 349 350 static 351 wxVisualAttributes GetClassDefaultAttributes( 352 wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL 353 ); 354 %Docstring 355 GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes 356 %End 357 %PreMethodCode 358 if (!wxPyCheckForApp()) return NULL; 359 %End 360 361 public: 362 363 364 %Property(name=Count, get=GetCount) 365 %Property(name=Selection, get=GetSelection, set=SetSelection) 366 %Property(name=Selections, get=GetSelections) 367}; // end of class wxListBox 368 369 370 371//--------------------------------------------------------------------------- 372 373