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%ModuleHeaderCode 12#include <wx/vlbox.h> 13%End 14 15 16//--------------------------------------------------------------------------- 17 18const char* wxVListBoxNameStr; 19 20class wxVListBox : wxVScrolledWindow 21{ 22 %Docstring 23 VListBox() 24 VListBox(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=0, name=VListBoxNameStr) 25 26 wxVListBox is a wxListBox-like control with the following two main 27 differences from a regular wxListBox: it can have an arbitrarily huge 28 number of items because it doesn't store them itself but uses the 29 OnDrawItem() callback to draw them (so it is a virtual listbox) and 30 its items can have variable height as determined by OnMeasureItem() 31 (so it is also a listbox with the lines of variable height). 32 %End 33 %TypeHeaderCode 34 #include <wx/vlbox.h> 35 %End 36 37public: 38 wxVListBox(); 39 %PreMethodCode 40 if (!wxPyCheckForApp()) return NULL; 41 %End 42 43 wxVListBox( 44 wxWindow * parent /TransferThis/, 45 wxWindowID id = wxID_ANY, 46 const wxPoint & pos = wxDefaultPosition, 47 const wxSize & size = wxDefaultSize, 48 long style = 0, 49 const wxString & name = wxVListBoxNameStr 50 ); 51 %PreMethodCode 52 if (!wxPyCheckForApp()) return NULL; 53 %End 54 55 ~wxVListBox(); 56 57 void SetMargins( 58 const wxPoint & pt 59 ); 60 %Docstring 61 SetMargins(pt) 62 SetMargins(x, y) 63 64 Set the margins: horizontal margin is the distance between the window 65 border and the item contents while vertical margin is half of the 66 distance between items. 67 %End 68 69 void SetMargins( 70 wxCoord x, 71 wxCoord y 72 ); 73 74 void Clear(); 75 %Docstring 76 Clear() 77 78 Deletes all items from the control. 79 %End 80 81 bool Create( 82 wxWindow * parent /TransferThis/, 83 wxWindowID id = wxID_ANY, 84 const wxPoint & pos = wxDefaultPosition, 85 const wxSize & size = wxDefaultSize, 86 long style = 0, 87 const wxString & name = wxVListBoxNameStr 88 ); 89 %Docstring 90 Create(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=0, name=VListBoxNameStr) -> bool 91 92 Creates the control. 93 %End 94 95 bool DeselectAll(); 96 %Docstring 97 DeselectAll() -> bool 98 99 Deselects all the items in the listbox. 100 %End 101 102 int GetFirstSelected( 103 unsigned long & cookie /Out/ 104 ) const; 105 %Docstring 106 GetFirstSelected() -> (int, cookie) 107 108 Returns the index of the first selected item in the listbox or 109 wxNOT_FOUND if no items are currently selected. 110 %End 111 112 size_t GetItemCount() const; 113 %Docstring 114 GetItemCount() -> size_t 115 116 Get the number of items in the control. 117 %End 118 119 wxPoint GetMargins() const; 120 %Docstring 121 GetMargins() -> Point 122 123 Returns the margins used by the control. 124 %End 125 126 wxRect GetItemRect( 127 size_t item 128 ) const; 129 %Docstring 130 GetItemRect(item) -> Rect 131 132 Returns the rectangle occupied by this item in physical coordinates. 133 %End 134 135 int GetNextSelected( 136 unsigned long & cookie /In, Out/ 137 ) const; 138 %Docstring 139 GetNextSelected(cookie) -> (int, cookie) 140 141 Returns the index of the next selected item or wxNOT_FOUND if there 142 are no more. 143 %End 144 145 size_t GetSelectedCount() const; 146 %Docstring 147 GetSelectedCount() -> size_t 148 149 Returns the number of the items currently selected. 150 %End 151 152 int GetSelection() const; 153 %Docstring 154 GetSelection() -> int 155 156 Get the currently selected item or wxNOT_FOUND if there is no 157 selection. 158 %End 159 160 const wxColour & GetSelectionBackground() const; 161 %Docstring 162 GetSelectionBackground() -> Colour 163 164 Returns the background colour used for the selected cells. 165 %End 166 167 bool HasMultipleSelection() const; 168 %Docstring 169 HasMultipleSelection() -> bool 170 171 Returns true if the listbox was created with wxLB_MULTIPLE style and 172 so supports multiple selection or false if it is a single selection 173 listbox. 174 %End 175 176 bool IsCurrent( 177 size_t item 178 ) const; 179 %Docstring 180 IsCurrent(item) -> bool 181 182 Returns true if this item is the current one, false otherwise. 183 %End 184 185 bool IsSelected( 186 size_t item 187 ) const; 188 %Docstring 189 IsSelected(item) -> bool 190 191 Returns true if this item is selected, false otherwise. 192 %End 193 194 bool Select( 195 size_t item, 196 bool select = true 197 ); 198 %Docstring 199 Select(item, select=True) -> bool 200 201 Selects or deselects the specified item which must be valid (i.e. not 202 equal to wxNOT_FOUND). 203 %End 204 205 bool SelectAll(); 206 %Docstring 207 SelectAll() -> bool 208 209 Selects all the items in the listbox. 210 %End 211 212 bool SelectRange( 213 size_t from_, 214 size_t to_ 215 ); 216 %Docstring 217 SelectRange(from_, to_) -> bool 218 219 Selects all items in the specified range which may be given in any 220 order. 221 %End 222 223 void SetItemCount( 224 size_t count 225 ); 226 %Docstring 227 SetItemCount(count) 228 229 Set the number of items to be shown in the control. 230 %End 231 232 void SetSelection( 233 int selection 234 ); 235 %Docstring 236 SetSelection(selection) 237 238 Set the selection to the specified item, if it is -1 the selection is 239 unset. 240 %End 241 242 void SetSelectionBackground( 243 const wxColour & col 244 ); 245 %Docstring 246 SetSelectionBackground(col) 247 248 Sets the colour to be used for the selected cells background. 249 %End 250 251 void Toggle( 252 size_t item 253 ); 254 %Docstring 255 Toggle(item) 256 257 Toggles the state of the specified item, i.e. selects it if it was 258 unselected and deselects it if it was selected. 259 %End 260 261 public: 262 virtual wxPoint GetClientAreaOrigin() const; 263 virtual bool Validate(); 264 virtual bool TransferDataToWindow(); 265 virtual bool TransferDataFromWindow(); 266 virtual void InitDialog(); 267 virtual bool AcceptsFocus() const; 268 virtual bool AcceptsFocusRecursively() const; 269 virtual bool AcceptsFocusFromKeyboard() const; 270 virtual void AddChild( wxWindowBase *child ); 271 virtual void RemoveChild( wxWindowBase *child ); 272 virtual void InheritAttributes(); 273 virtual bool ShouldInheritColours() const; 274 virtual void OnInternalIdle(); 275 virtual wxWindow *GetMainWindowOfCompositeControl(); 276 virtual bool InformFirstDirection(int direction, int size, int availableOtherDir); 277 virtual void SetCanFocus(bool canFocus); 278 virtual bool Destroy(); 279 virtual void SetValidator( const wxValidator &validator ); 280 virtual wxValidator* GetValidator(); 281 282 283 protected: 284 virtual bool ProcessEvent(wxEvent & event); 285 virtual void DoEnable(bool enable); 286 virtual void DoGetPosition(int *x, int *y) const; 287 virtual void DoGetSize(int *width, int *height) const; 288 virtual void DoGetClientSize(int *width, int *height) const; 289 virtual wxSize DoGetBestSize() const; 290 virtual wxSize DoGetBestClientSize() const; 291 virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags); 292 virtual void DoSetClientSize(int width, int height); 293 virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH ); 294 virtual wxSize DoGetBorderSize() const; 295 virtual void DoMoveWindow(int x, int y, int width, int height); 296 virtual void DoSetWindowVariant( wxWindowVariant variant); 297 virtual wxBorder GetDefaultBorder() const; 298 virtual wxBorder GetDefaultBorderForControl() const; 299 virtual void DoFreeze(); 300 virtual void DoThaw(); 301 virtual bool HasTransparentBackground(); 302 virtual bool TryBefore(wxEvent& event); 303 virtual bool TryAfter(wxEvent& event); 304 305 306 public: 307 308 309 static 310 wxVisualAttributes GetClassDefaultAttributes( 311 wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL 312 ); 313 %Docstring 314 GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes 315 %End 316 %PreMethodCode 317 if (!wxPyCheckForApp()) return NULL; 318 %End 319 320 public: 321 322 323 %Property(name=ItemCount, get=GetItemCount, set=SetItemCount) 324 %Property(name=Margins, get=GetMargins, set=SetMargins) 325 %Property(name=SelectedCount, get=GetSelectedCount) 326 %Property(name=Selection, get=GetSelection, set=SetSelection) 327 %Property(name=SelectionBackground, get=GetSelectionBackground, set=SetSelectionBackground) 328 329protected: 330 virtual 331 void OnDrawItem( 332 wxDC & dc, 333 const wxRect & rect, 334 size_t n 335 ) const = 0; 336 %Docstring 337 OnDrawItem(dc, rect, n) 338 339 The derived class must implement this function to actually draw the 340 item with the given index on the provided DC. 341 %End 342 343 virtual 344 void OnDrawBackground( 345 wxDC & dc, 346 const wxRect & rect, 347 size_t n 348 ) const; 349 %Docstring 350 OnDrawBackground(dc, rect, n) 351 352 This method is used to draw the item's background and, maybe, a border 353 around it. 354 %End 355 356 virtual 357 void OnDrawSeparator( 358 wxDC & dc, 359 wxRect & rect, 360 size_t n 361 ) const; 362 %Docstring 363 OnDrawSeparator(dc, rect, n) 364 365 This method may be used to draw separators between the lines. 366 %End 367 368 virtual 369 wxCoord OnMeasureItem( 370 size_t n 371 ) const = 0; 372 %Docstring 373 OnMeasureItem(n) -> Coord 374 375 The derived class must implement this method to return the height of 376 the specified item (in pixels). 377 %End 378 379 virtual wxCoord OnGetRowHeight(size_t n) const; 380 381 382}; // end of class wxVListBox 383 384 385 386//--------------------------------------------------------------------------- 387 388