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 int wxLC_VRULES; 14const int wxLC_HRULES; 15const int wxLC_ICON; 16const int wxLC_SMALL_ICON; 17const int wxLC_LIST; 18const int wxLC_REPORT; 19const int wxLC_ALIGN_TOP; 20const int wxLC_ALIGN_LEFT; 21const int wxLC_AUTOARRANGE; 22const int wxLC_VIRTUAL; 23const int wxLC_EDIT_LABELS; 24const int wxLC_NO_HEADER; 25const int wxLC_NO_SORT_HEADER; 26const int wxLC_SINGLE_SEL; 27const int wxLC_SORT_ASCENDING; 28const int wxLC_SORT_DESCENDING; 29const int wxLC_MASK_TYPE; 30const int wxLC_MASK_ALIGN; 31const int wxLC_MASK_SORT; 32const int wxLIST_MASK_STATE; 33const int wxLIST_MASK_TEXT; 34const int wxLIST_MASK_IMAGE; 35const int wxLIST_MASK_DATA; 36const int wxLIST_SET_ITEM; 37const int wxLIST_MASK_WIDTH; 38const int wxLIST_MASK_FORMAT; 39const int wxLIST_STATE_DONTCARE; 40const int wxLIST_STATE_DROPHILITED; 41const int wxLIST_STATE_FOCUSED; 42const int wxLIST_STATE_SELECTED; 43const int wxLIST_STATE_CUT; 44const int wxLIST_STATE_DISABLED; 45const int wxLIST_STATE_FILTERED; 46const int wxLIST_STATE_INUSE; 47const int wxLIST_STATE_PICKED; 48const int wxLIST_STATE_SOURCE; 49const int wxLIST_HITTEST_ABOVE; 50const int wxLIST_HITTEST_BELOW; 51const int wxLIST_HITTEST_NOWHERE; 52const int wxLIST_HITTEST_ONITEMICON; 53const int wxLIST_HITTEST_ONITEMLABEL; 54const int wxLIST_HITTEST_ONITEMRIGHT; 55const int wxLIST_HITTEST_ONITEMSTATEICON; 56const int wxLIST_HITTEST_TOLEFT; 57const int wxLIST_HITTEST_TORIGHT; 58const int wxLIST_HITTEST_ONITEM; 59const int wxLIST_GETSUBITEMRECT_WHOLEITEM; 60enum 61{ 62 wxLIST_NEXT_ABOVE, 63 wxLIST_NEXT_ALL, 64 wxLIST_NEXT_BELOW, 65 wxLIST_NEXT_LEFT, 66 wxLIST_NEXT_RIGHT 67}; 68 69enum 70{ 71 wxLIST_ALIGN_DEFAULT, 72 wxLIST_ALIGN_LEFT, 73 wxLIST_ALIGN_TOP, 74 wxLIST_ALIGN_SNAP_TO_GRID 75}; 76 77enum wxListColumnFormat 78{ 79 wxLIST_FORMAT_LEFT, 80 wxLIST_FORMAT_RIGHT, 81 wxLIST_FORMAT_CENTRE, 82 wxLIST_FORMAT_CENTER 83}; 84 85enum 86{ 87 wxLIST_AUTOSIZE, 88 wxLIST_AUTOSIZE_USEHEADER 89}; 90 91enum 92{ 93 wxLIST_RECT_BOUNDS, 94 wxLIST_RECT_ICON, 95 wxLIST_RECT_LABEL 96}; 97 98enum 99{ 100 wxLIST_FIND_UP, 101 wxLIST_FIND_DOWN, 102 wxLIST_FIND_LEFT, 103 wxLIST_FIND_RIGHT 104}; 105 106wxEventType wxEVT_LIST_BEGIN_DRAG /PyName=wxEVT_LIST_BEGIN_DRAG/; 107 108wxEventType wxEVT_LIST_BEGIN_RDRAG /PyName=wxEVT_LIST_BEGIN_RDRAG/; 109 110wxEventType wxEVT_LIST_BEGIN_LABEL_EDIT /PyName=wxEVT_LIST_BEGIN_LABEL_EDIT/; 111 112wxEventType wxEVT_LIST_END_LABEL_EDIT /PyName=wxEVT_LIST_END_LABEL_EDIT/; 113 114wxEventType wxEVT_LIST_DELETE_ITEM /PyName=wxEVT_LIST_DELETE_ITEM/; 115 116wxEventType wxEVT_LIST_DELETE_ALL_ITEMS /PyName=wxEVT_LIST_DELETE_ALL_ITEMS/; 117 118wxEventType wxEVT_LIST_ITEM_SELECTED /PyName=wxEVT_LIST_ITEM_SELECTED/; 119 120wxEventType wxEVT_LIST_ITEM_DESELECTED /PyName=wxEVT_LIST_ITEM_DESELECTED/; 121 122wxEventType wxEVT_LIST_KEY_DOWN /PyName=wxEVT_LIST_KEY_DOWN/; 123 124wxEventType wxEVT_LIST_INSERT_ITEM /PyName=wxEVT_LIST_INSERT_ITEM/; 125 126wxEventType wxEVT_LIST_COL_CLICK /PyName=wxEVT_LIST_COL_CLICK/; 127 128wxEventType wxEVT_LIST_ITEM_RIGHT_CLICK /PyName=wxEVT_LIST_ITEM_RIGHT_CLICK/; 129 130wxEventType wxEVT_LIST_ITEM_MIDDLE_CLICK /PyName=wxEVT_LIST_ITEM_MIDDLE_CLICK/; 131 132wxEventType wxEVT_LIST_ITEM_ACTIVATED /PyName=wxEVT_LIST_ITEM_ACTIVATED/; 133 134wxEventType wxEVT_LIST_CACHE_HINT /PyName=wxEVT_LIST_CACHE_HINT/; 135 136wxEventType wxEVT_LIST_COL_RIGHT_CLICK /PyName=wxEVT_LIST_COL_RIGHT_CLICK/; 137 138wxEventType wxEVT_LIST_COL_BEGIN_DRAG /PyName=wxEVT_LIST_COL_BEGIN_DRAG/; 139 140wxEventType wxEVT_LIST_COL_DRAGGING /PyName=wxEVT_LIST_COL_DRAGGING/; 141 142wxEventType wxEVT_LIST_COL_END_DRAG /PyName=wxEVT_LIST_COL_END_DRAG/; 143 144wxEventType wxEVT_LIST_ITEM_FOCUSED /PyName=wxEVT_LIST_ITEM_FOCUSED/; 145 146class wxListItemAttr 147{ 148 %Docstring 149 ListItemAttr() 150 ListItemAttr(colText, colBack, font) 151 152 Represents the attributes (color, font, ...) of a wxListCtrl's 153 wxListItem. 154 %End 155 %TypeHeaderCode 156 #include <wx/listctrl.h> 157 %End 158 159public: 160 wxListItemAttr(); 161 162 wxListItemAttr( 163 const wxColour & colText, 164 const wxColour & colBack, 165 const wxFont & font 166 ); 167 168 const wxColour & GetBackgroundColour() const; 169 %Docstring 170 GetBackgroundColour() -> Colour 171 172 Returns the currently set background color. 173 %End 174 175 const wxFont & GetFont() const; 176 %Docstring 177 GetFont() -> Font 178 179 Returns the currently set font. 180 %End 181 182 const wxColour & GetTextColour() const; 183 %Docstring 184 GetTextColour() -> Colour 185 186 Returns the currently set text color. 187 %End 188 189 bool HasBackgroundColour() const; 190 %Docstring 191 HasBackgroundColour() -> bool 192 193 Returns true if the currently set background color is valid. 194 %End 195 196 bool HasFont() const; 197 %Docstring 198 HasFont() -> bool 199 200 Returns true if the currently set font is valid. 201 %End 202 203 bool HasTextColour() const; 204 %Docstring 205 HasTextColour() -> bool 206 207 Returns true if the currently set text color is valid. 208 %End 209 210 void SetBackgroundColour( 211 const wxColour & colour 212 ); 213 %Docstring 214 SetBackgroundColour(colour) 215 216 Sets a new background color. 217 %End 218 219 void SetFont( 220 const wxFont & font 221 ); 222 %Docstring 223 SetFont(font) 224 225 Sets a new font. 226 %End 227 228 void SetTextColour( 229 const wxColour & colour 230 ); 231 %Docstring 232 SetTextColour(colour) 233 234 Sets a new text color. 235 %End 236 237 public: 238 239 240 %Property(name=BackgroundColour, get=GetBackgroundColour, set=SetBackgroundColour) 241 %Property(name=Font, get=GetFont, set=SetFont) 242 %Property(name=TextColour, get=GetTextColour, set=SetTextColour) 243}; // end of class wxListItemAttr 244 245 246class wxListItem : wxObject 247{ 248 %Docstring 249 ListItem() 250 251 This class stores information about a wxListCtrl item or column. 252 %End 253 %TypeHeaderCode 254 #include <wx/listctrl.h> 255 %End 256 257public: 258 wxListItem(); 259 260 void SetData( 261 long data 262 ); 263 %Docstring 264 SetData(data) 265 266 Sets client data for the item. 267 %End 268 269 void Clear(); 270 %Docstring 271 Clear() 272 273 Resets the item state to the default. 274 %End 275 276 wxListColumnFormat GetAlign() const; 277 %Docstring 278 GetAlign() -> ListColumnFormat 279 280 Returns the alignment for this item. 281 %End 282 283 wxColour GetBackgroundColour() const; 284 %Docstring 285 GetBackgroundColour() -> Colour 286 287 Returns the background colour for this item. 288 %End 289 290 int GetColumn() const; 291 %Docstring 292 GetColumn() -> int 293 294 Returns the zero-based column; meaningful only in report mode. 295 %End 296 297 long GetData() const; 298 %Docstring 299 GetData() -> long 300 301 Returns client data associated with the control. 302 %End 303 304 wxFont GetFont() const; 305 %Docstring 306 GetFont() -> Font 307 308 Returns the font used to display the item. 309 %End 310 311 long GetId() const; 312 %Docstring 313 GetId() -> long 314 315 Returns the zero-based item position. 316 %End 317 318 int GetImage() const; 319 %Docstring 320 GetImage() -> int 321 322 Returns the zero-based index of the image associated with the item 323 into the image list. 324 %End 325 326 long GetMask() const; 327 %Docstring 328 GetMask() -> long 329 330 Returns a bit mask indicating which fields of the structure are valid. 331 %End 332 333 long GetState() const; 334 %Docstring 335 GetState() -> long 336 337 Returns a bit field representing the state of the item. 338 %End 339 340 const wxString & GetText() const; 341 %Docstring 342 GetText() -> String 343 344 Returns the label/header text. 345 %End 346 347 wxColour GetTextColour() const; 348 %Docstring 349 GetTextColour() -> Colour 350 351 Returns the text colour. 352 %End 353 354 int GetWidth() const; 355 %Docstring 356 GetWidth() -> int 357 358 Meaningful only for column headers in report mode. 359 %End 360 361 void SetAlign( 362 wxListColumnFormat align 363 ); 364 %Docstring 365 SetAlign(align) 366 367 Sets the alignment for the item. 368 %End 369 370 void SetBackgroundColour( 371 const wxColour & colBack 372 ); 373 %Docstring 374 SetBackgroundColour(colBack) 375 376 Sets the background colour for the item. 377 %End 378 379 void SetColumn( 380 int col 381 ); 382 %Docstring 383 SetColumn(col) 384 385 Sets the zero-based column. 386 %End 387 388 void SetFont( 389 const wxFont & font 390 ); 391 %Docstring 392 SetFont(font) 393 394 Sets the font for the item. 395 %End 396 397 void SetId( 398 long id 399 ); 400 %Docstring 401 SetId(id) 402 403 Sets the zero-based item position. 404 %End 405 406 void SetImage( 407 int image 408 ); 409 %Docstring 410 SetImage(image) 411 412 Sets the zero-based index of the image associated with the item into 413 the image list. 414 %End 415 416 void SetMask( 417 long mask 418 ); 419 %Docstring 420 SetMask(mask) 421 422 Sets the mask of valid fields. 423 %End 424 425 void SetState( 426 long state 427 ); 428 %Docstring 429 SetState(state) 430 431 Sets the item state flags (note that the valid state flags are 432 influenced by the value of the state mask, see 433 wxListItem::SetStateMask). 434 %End 435 436 void SetStateMask( 437 long stateMask 438 ); 439 %Docstring 440 SetStateMask(stateMask) 441 442 Sets the bitmask that is used to determine which of the state flags 443 are to be set. 444 %End 445 446 void SetText( 447 const wxString & text 448 ); 449 %Docstring 450 SetText(text) 451 452 Sets the text label for the item. 453 %End 454 455 void SetTextColour( 456 const wxColour & colText 457 ); 458 %Docstring 459 SetTextColour(colText) 460 461 Sets the text colour for the item. 462 %End 463 464 void SetWidth( 465 int width 466 ); 467 %Docstring 468 SetWidth(width) 469 470 Meaningful only for column headers in report mode. 471 %End 472 473 public: 474 475 476 %Property(name=Align, get=GetAlign, set=SetAlign) 477 %Property(name=BackgroundColour, get=GetBackgroundColour, set=SetBackgroundColour) 478 %Property(name=Column, get=GetColumn, set=SetColumn) 479 %Property(name=Data, get=GetData, set=SetData) 480 %Property(name=Font, get=GetFont, set=SetFont) 481 %Property(name=Id, get=GetId, set=SetId) 482 %Property(name=Image, get=GetImage, set=SetImage) 483 %Property(name=Mask, get=GetMask, set=SetMask) 484 %Property(name=State, get=GetState, set=SetState) 485 %Property(name=Text, get=GetText, set=SetText) 486 %Property(name=TextColour, get=GetTextColour, set=SetTextColour) 487 %Property(name=Width, get=GetWidth, set=SetWidth) 488}; // end of class wxListItem 489 490 491const char* wxListCtrlNameStr; 492 493class wxListCtrl : wxControl 494{ 495 %Docstring 496 ListCtrl() 497 ListCtrl(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=LC_ICON, validator=DefaultValidator, name=ListCtrlNameStr) 498 499 A list control presents lists in a number of formats: list view, 500 report view, icon view and small icon view. 501 %End 502 %TypeHeaderCode 503 #include <wx/listctrl.h> 504 %End 505 506 %TypeCode 507 static int wxCALLBACK wxPyListCtrl_SortItems(wxIntPtr item1, wxIntPtr item2, wxIntPtr funcPtr) 508 { 509 int retval = 0; 510 PyObject* func = (PyObject*)funcPtr; 511 wxPyThreadBlocker blocker; 512 513 #if SIZEOF_LONG >= SIZEOF_VOID_P 514 PyObject* args = Py_BuildValue("(ll)", item1, item2); 515 #else 516 PyObject* args = Py_BuildValue("(LL)", item1, item2); 517 #endif 518 519 PyObject* result = PyEval_CallObject(func, args); 520 Py_DECREF(args); 521 if (result) { 522 retval = wxPyInt_AsLong(result); 523 Py_DECREF(result); 524 } 525 return retval; 526 } 527 %End 528public: 529 wxListCtrl(); 530 %PreMethodCode 531 if (!wxPyCheckForApp()) return NULL; 532 %End 533 534 wxListCtrl( 535 wxWindow * parent /TransferThis/, 536 wxWindowID id = wxID_ANY, 537 const wxPoint & pos = wxDefaultPosition, 538 const wxSize & size = wxDefaultSize, 539 long style = wxLC_ICON, 540 const wxValidator & validator = wxDefaultValidator, 541 const wxString & name = wxListCtrlNameStr 542 ); 543 %PreMethodCode 544 if (!wxPyCheckForApp()) return NULL; 545 %End 546 547 ~wxListCtrl(); 548 549 long AppendColumn( 550 const wxString & heading, 551 wxListColumnFormat format = wxLIST_FORMAT_LEFT, 552 int width = -1 553 ); 554 %Docstring 555 AppendColumn(heading, format=LIST_FORMAT_LEFT, width=-1) -> long 556 557 Adds a new column to the list control in report view mode. 558 %End 559 560 bool Arrange( 561 int flag = wxLIST_ALIGN_DEFAULT 562 ); 563 %Docstring 564 Arrange(flag=LIST_ALIGN_DEFAULT) -> bool 565 566 Arranges the items in icon or small icon view. 567 %End 568 569 void AssignImageList( 570 wxImageList * imageList /Transfer/, 571 int which 572 ); 573 %Docstring 574 AssignImageList(imageList, which) 575 576 Sets the image list associated with the control and takes ownership of 577 it (i.e. 578 %End 579 580 void ClearAll(); 581 %Docstring 582 ClearAll() 583 584 Deletes all items and all columns. 585 %End 586 587 bool Create( 588 wxWindow * parent /TransferThis/, 589 wxWindowID id = wxID_ANY, 590 const wxPoint & pos = wxDefaultPosition, 591 const wxSize & size = wxDefaultSize, 592 long style = wxLC_ICON, 593 const wxValidator & validator = wxDefaultValidator, 594 const wxString & name = wxListCtrlNameStr 595 ); 596 %Docstring 597 Create(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=LC_ICON, validator=DefaultValidator, name=ListCtrlNameStr) -> bool 598 599 Creates the list control. 600 %End 601 602 bool DeleteAllColumns(); 603 %Docstring 604 DeleteAllColumns() -> bool 605 606 Delete all columns in the list control. 607 %End 608 609 bool DeleteAllItems(); 610 %Docstring 611 DeleteAllItems() -> bool 612 613 Deletes all items in the list control. 614 %End 615 616 bool DeleteColumn( 617 int col 618 ); 619 %Docstring 620 DeleteColumn(col) -> bool 621 622 Deletes a column. 623 %End 624 625 bool DeleteItem( 626 long item 627 ); 628 %Docstring 629 DeleteItem(item) -> bool 630 631 Deletes the specified item. 632 %End 633 634 wxTextCtrl * EditLabel( 635 long item 636 ); 637 %Docstring 638 EditLabel(item) -> TextCtrl 639 640 Starts editing the label of the given item. 641 %End 642 643 void EnableAlternateRowColours( 644 bool enable = true 645 ); 646 %Docstring 647 EnableAlternateRowColours(enable=True) 648 649 Enable alternating row background colours (also called zebra 650 striping). 651 %End 652 653 void EnableBellOnNoMatch( 654 bool on = true 655 ); 656 %Docstring 657 EnableBellOnNoMatch(on=True) 658 659 Enable or disable a beep if there is no match for the currently 660 entered text when searching for the item from keyboard. 661 %End 662 663 bool EnsureVisible( 664 long item 665 ); 666 %Docstring 667 EnsureVisible(item) -> bool 668 669 Ensures this item is visible. 670 %End 671 672 long FindItem( 673 long start, 674 const wxString & str, 675 bool partial = false 676 ); 677 %Docstring 678 FindItem(start, str, partial=False) -> long 679 FindItem(start, data) -> long 680 FindItem(start, pt, direction) -> long 681 682 Find an item whose label matches this string, starting from start or 683 the beginning if start is -1. 684 %End 685 686 long FindItem( 687 long start, 688 wxUIntPtr data 689 ); 690 691 long FindItem( 692 long start, 693 const wxPoint & pt, 694 int direction 695 ); 696 697 wxListItem* GetColumn(int col) /Factory/; 698 %Docstring 699 GetColumn(col) -> ListItem 700 701 Gets information about this column. See SetItem() for more 702 information. 703 %End 704 %MethodCode 705 PyErr_Clear(); 706 Py_BEGIN_ALLOW_THREADS 707 sipRes = _wxListCtrl_GetColumn(sipCpp, col); 708 Py_END_ALLOW_THREADS 709 if (PyErr_Occurred()) sipIsErr = 1; 710 %End 711 %TypeCode 712 wxListItem* _wxListCtrl_GetColumn(wxListCtrl* self, int col) 713 { 714 wxListItem item; 715 item.SetMask( wxLIST_MASK_STATE | 716 wxLIST_MASK_TEXT | 717 wxLIST_MASK_IMAGE | 718 wxLIST_MASK_DATA | 719 wxLIST_SET_ITEM | 720 wxLIST_MASK_WIDTH | 721 wxLIST_MASK_FORMAT 722 ); 723 if (self->GetColumn(col, item)) 724 return new wxListItem(item); 725 else 726 return NULL; 727 } 728 %End 729 730 int GetColumnCount() const; 731 %Docstring 732 GetColumnCount() -> int 733 734 Returns the number of columns. 735 %End 736 737 int GetColumnIndexFromOrder( 738 int pos 739 ) const; 740 %Docstring 741 GetColumnIndexFromOrder(pos) -> int 742 743 Gets the column index from its position in visual order. 744 %End 745 %MethodCode 746 PyErr_Clear(); 747 Py_BEGIN_ALLOW_THREADS 748 sipRes = _wxListCtrl_GetColumnIndexFromOrder(sipCpp, pos); 749 Py_END_ALLOW_THREADS 750 if (PyErr_Occurred()) sipIsErr = 1; 751 %End 752 %TypeCode 753 int _wxListCtrl_GetColumnIndexFromOrder(const wxListCtrl* self, int pos) 754 { 755 #ifdef wxHAS_LISTCTRL_COLUMN_ORDER 756 return self->GetColumnIndexFromOrder(pos); 757 #else 758 wxPyRaiseNotImplemented(); 759 return 0; 760 #endif 761 } 762 %End 763 764 int GetColumnOrder( 765 int col 766 ) const; 767 %Docstring 768 GetColumnOrder(col) -> int 769 770 Gets the column visual order position. 771 %End 772 %MethodCode 773 PyErr_Clear(); 774 Py_BEGIN_ALLOW_THREADS 775 sipRes = _wxListCtrl_GetColumnOrder(sipCpp, col); 776 Py_END_ALLOW_THREADS 777 if (PyErr_Occurred()) sipIsErr = 1; 778 %End 779 %TypeCode 780 int _wxListCtrl_GetColumnOrder(const wxListCtrl* self, int col) 781 { 782 #ifdef wxHAS_LISTCTRL_COLUMN_ORDER 783 return self->GetColumnOrder(col); 784 #else 785 wxPyRaiseNotImplemented(); 786 return 0; 787 #endif 788 } 789 %End 790 791 int GetColumnWidth( 792 int col 793 ) const; 794 %Docstring 795 GetColumnWidth(col) -> int 796 797 Gets the column width (report view only). 798 %End 799 800 wxArrayInt* GetColumnsOrder() const /Factory/; 801 %Docstring 802 GetColumnsOrder() -> ArrayInt 803 804 Returns the array containing the orders of all columns. 805 %End 806 %MethodCode 807 PyErr_Clear(); 808 Py_BEGIN_ALLOW_THREADS 809 sipRes = _wxListCtrl_GetColumnsOrder(sipCpp); 810 Py_END_ALLOW_THREADS 811 if (PyErr_Occurred()) sipIsErr = 1; 812 %End 813 %TypeCode 814 wxArrayInt* _wxListCtrl_GetColumnsOrder(const wxListCtrl* self) 815 { 816 #ifdef wxHAS_LISTCTRL_COLUMN_ORDER 817 return new wxArrayInt(self->GetColumnsOrder()); 818 #else 819 wxPyRaiseNotImplemented(); 820 return new wxArrayInt(); 821 #endif 822 } 823 %End 824 825 int GetCountPerPage() const; 826 %Docstring 827 GetCountPerPage() -> int 828 829 Gets the number of items that can fit vertically in the visible area 830 of the list control (list or report view) or the total number of items 831 in the list control (icon or small icon view). 832 %End 833 834 wxTextCtrl * GetEditControl() const; 835 %Docstring 836 GetEditControl() -> TextCtrl 837 838 Returns the edit control being currently used to edit a label. 839 %End 840 841 wxImageList * GetImageList( 842 int which 843 ) const; 844 %Docstring 845 GetImageList(which) -> ImageList 846 847 Returns the specified image list. 848 %End 849 850 wxListItem* GetItem(int itemIdx, int col=0) /Factory/; 851 %Docstring 852 GetItem(itemIdx, col=0) -> ListItem 853 854 Gets information about the item. See SetItem() for more information. 855 %End 856 %MethodCode 857 PyErr_Clear(); 858 Py_BEGIN_ALLOW_THREADS 859 sipRes = _wxListCtrl_GetItem(sipCpp, itemIdx, col); 860 Py_END_ALLOW_THREADS 861 if (PyErr_Occurred()) sipIsErr = 1; 862 %End 863 %TypeCode 864 wxListItem* _wxListCtrl_GetItem(wxListCtrl* self, int itemIdx, int col) 865 { 866 wxListItem* info = new wxListItem; 867 info->m_itemId = itemIdx; 868 info->m_col = col; 869 info->m_mask = 0xFFFF; 870 info->m_stateMask = 0xFFFF; 871 self->GetItem(*info); 872 return info; 873 } 874 %End 875 876 wxColour GetItemBackgroundColour( 877 long item 878 ) const; 879 %Docstring 880 GetItemBackgroundColour(item) -> Colour 881 882 Returns the colour for this item. 883 %End 884 885 int GetItemCount() const; 886 %Docstring 887 GetItemCount() -> int 888 889 Returns the number of items in the list control. 890 %End 891 892 long GetItemData( 893 long item 894 ) const; 895 %Docstring 896 GetItemData(item) -> long 897 898 Gets the application-defined data associated with this item. 899 %End 900 901 wxFont GetItemFont( 902 long item 903 ) const; 904 %Docstring 905 GetItemFont(item) -> Font 906 907 Returns the item's font. 908 %End 909 910 wxPoint* GetItemPosition(long item) /Factory/; 911 %Docstring 912 GetItemPosition(item) -> Point 913 914 Returns the position of the item, in icon or small icon view. 915 %End 916 %MethodCode 917 PyErr_Clear(); 918 Py_BEGIN_ALLOW_THREADS 919 sipRes = _wxListCtrl_GetItemPosition(sipCpp, item); 920 Py_END_ALLOW_THREADS 921 if (PyErr_Occurred()) sipIsErr = 1; 922 %End 923 %TypeCode 924 wxPoint* _wxListCtrl_GetItemPosition(wxListCtrl* self, long item) 925 { 926 wxPoint* pos = new wxPoint; 927 self->GetItemPosition(item, *pos); 928 return pos; 929 } 930 %End 931 932 wxRect* GetItemRect(long item, int code = wxLIST_RECT_BOUNDS) /Factory/; 933 %Docstring 934 GetItemRect(item, code=LIST_RECT_BOUNDS) -> Rect 935 936 Returns the rectangle representing the item's size and position, in 937 physical coordinates. 938 code is one of wx.LIST_RECT_BOUNDS, wx.LIST_RECT_ICON, 939 wx.LIST_RECT_LABEL. 940 %End 941 %MethodCode 942 PyErr_Clear(); 943 Py_BEGIN_ALLOW_THREADS 944 sipRes = _wxListCtrl_GetItemRect(sipCpp, item, code); 945 Py_END_ALLOW_THREADS 946 if (PyErr_Occurred()) sipIsErr = 1; 947 %End 948 %TypeCode 949 wxRect* _wxListCtrl_GetItemRect(wxListCtrl* self, long item, int code) 950 { 951 wxRect* rect = new wxRect; 952 self->GetItemRect(item, *rect, code); 953 return rect; 954 } 955 %End 956 957 wxSize GetItemSpacing() const; 958 %Docstring 959 GetItemSpacing() -> Size 960 961 Retrieves the spacing between icons in pixels: horizontal spacing is 962 returned as x component of the wxSize object and the vertical spacing 963 as its y component. 964 %End 965 966 int GetItemState( 967 long item, 968 long stateMask 969 ) const; 970 %Docstring 971 GetItemState(item, stateMask) -> int 972 973 Gets the item state. 974 %End 975 976 wxString GetItemText( 977 long item, 978 int col = 0 979 ) const; 980 %Docstring 981 GetItemText(item, col=0) -> String 982 983 Gets the item text for this item. 984 %End 985 986 wxColour GetItemTextColour( 987 long item 988 ) const; 989 %Docstring 990 GetItemTextColour(item) -> Colour 991 992 Returns the colour for this item. 993 %End 994 995 long GetNextItem( 996 long item, 997 int geometry = wxLIST_NEXT_ALL, 998 int state = wxLIST_STATE_DONTCARE 999 ) const; 1000 %Docstring 1001 GetNextItem(item, geometry=LIST_NEXT_ALL, state=LIST_STATE_DONTCARE) -> long 1002 1003 Searches for an item with the given geometry or state, starting from 1004 item but excluding the item itself. 1005 %End 1006 1007 int GetSelectedItemCount() const; 1008 %Docstring 1009 GetSelectedItemCount() -> int 1010 1011 Returns the number of selected items in the list control. 1012 %End 1013 1014 bool GetSubItemRect( 1015 long item, 1016 long subItem, 1017 wxRect & rect, 1018 int code = wxLIST_RECT_BOUNDS 1019 ) const; 1020 %Docstring 1021 GetSubItemRect(item, subItem, rect, code=LIST_RECT_BOUNDS) -> bool 1022 1023 Returns the rectangle representing the size and position, in physical 1024 coordinates, of the given subitem, i.e. 1025 %End 1026 1027 wxColour GetTextColour() const; 1028 %Docstring 1029 GetTextColour() -> Colour 1030 1031 Gets the text colour of the list control. 1032 %End 1033 1034 long GetTopItem() const; 1035 %Docstring 1036 GetTopItem() -> long 1037 1038 Gets the index of the topmost visible item when in list or report 1039 view. 1040 %End 1041 1042 wxRect GetViewRect() const; 1043 %Docstring 1044 GetViewRect() -> Rect 1045 1046 Returns the rectangle taken by all items in the control. 1047 %End 1048 1049 void SetAlternateRowColour( 1050 const wxColour & colour 1051 ); 1052 %Docstring 1053 SetAlternateRowColour(colour) 1054 1055 Set the alternative row background colour to a specific colour. 1056 %End 1057 1058 long HitTest( 1059 const wxPoint & point, 1060 int & flags /Out/ 1061 ) const; 1062 %Docstring 1063 HitTest(point) -> (long, flags) 1064 1065 Determines which item (if any) is at the specified point, giving 1066 details in flags. 1067 %End 1068 1069 bool InReportView() const; 1070 %Docstring 1071 InReportView() -> bool 1072 1073 Returns true if the control is currently using wxLC_REPORT style. 1074 %End 1075 1076 long InsertColumn( 1077 long col, 1078 const wxListItem & info 1079 ); 1080 %Docstring 1081 InsertColumn(col, info) -> long 1082 InsertColumn(col, heading, format=LIST_FORMAT_LEFT, width=LIST_AUTOSIZE) -> long 1083 1084 For report view mode (only), inserts a column. 1085 %End 1086 1087 long InsertColumn( 1088 long col, 1089 const wxString & heading, 1090 int format = wxLIST_FORMAT_LEFT, 1091 int width = wxLIST_AUTOSIZE 1092 ); 1093 1094 long InsertItem( 1095 wxListItem & info 1096 ); 1097 %Docstring 1098 InsertItem(info) -> long 1099 InsertItem(index, label) -> long 1100 InsertItem(index, imageIndex) -> long 1101 InsertItem(index, label, imageIndex) -> long 1102 1103 Inserts an item, returning the index of the new item if successful, -1 1104 otherwise. 1105 %End 1106 1107 long InsertItem( 1108 long index, 1109 const wxString & label 1110 ); 1111 1112 long InsertItem( 1113 long index, 1114 int imageIndex 1115 ); 1116 1117 long InsertItem( 1118 long index, 1119 const wxString & label, 1120 int imageIndex 1121 ); 1122 1123 bool IsVirtual() const; 1124 %Docstring 1125 IsVirtual() -> bool 1126 1127 Returns true if the control is currently in virtual report view. 1128 %End 1129 1130 void RefreshItem( 1131 long item 1132 ); 1133 %Docstring 1134 RefreshItem(item) 1135 1136 Redraws the given item. 1137 %End 1138 1139 void RefreshItems( 1140 long itemFrom, 1141 long itemTo 1142 ); 1143 %Docstring 1144 RefreshItems(itemFrom, itemTo) 1145 1146 Redraws the items between itemFrom and itemTo. 1147 %End 1148 1149 bool ScrollList( 1150 int dx, 1151 int dy 1152 ); 1153 %Docstring 1154 ScrollList(dx, dy) -> bool 1155 1156 Scrolls the list control. 1157 %End 1158 1159 bool SetBackgroundColour( 1160 const wxColour & col 1161 ); 1162 %Docstring 1163 SetBackgroundColour(col) -> bool 1164 1165 Sets the background colour. 1166 %End 1167 1168 bool SetColumn( 1169 int col, 1170 wxListItem & item 1171 ); 1172 %Docstring 1173 SetColumn(col, item) -> bool 1174 1175 Sets information about this column. 1176 %End 1177 1178 bool SetColumnWidth( 1179 int col, 1180 int width 1181 ); 1182 %Docstring 1183 SetColumnWidth(col, width) -> bool 1184 1185 Sets the column width. 1186 %End 1187 1188 bool SetColumnsOrder( 1189 const wxArrayInt & orders 1190 ); 1191 %Docstring 1192 SetColumnsOrder(orders) -> bool 1193 1194 Changes the order in which the columns are shown. 1195 %End 1196 %MethodCode 1197 PyErr_Clear(); 1198 Py_BEGIN_ALLOW_THREADS 1199 sipRes = _wxListCtrl_SetColumnsOrder(sipCpp, orders); 1200 Py_END_ALLOW_THREADS 1201 if (PyErr_Occurred()) sipIsErr = 1; 1202 %End 1203 %TypeCode 1204 bool _wxListCtrl_SetColumnsOrder(wxListCtrl* self, const wxArrayInt *orders) 1205 { 1206 #ifdef wxHAS_LISTCTRL_COLUMN_ORDER 1207 return self->SetColumnsOrder(*orders); 1208 #else 1209 wxPyRaiseNotImplemented(); 1210 return false; 1211 #endif 1212 } 1213 %End 1214 1215 void SetImageList( 1216 wxImageList * imageList, 1217 int which 1218 ); 1219 %Docstring 1220 SetImageList(imageList, which) 1221 1222 Sets the image list associated with the control. 1223 %End 1224 1225 bool SetItem( 1226 wxListItem & info 1227 ); 1228 %Docstring 1229 SetItem(info) -> bool 1230 SetItem(index, column, label, imageId=-1) -> long 1231 1232 Sets the data of an item. 1233 %End 1234 1235 long SetItem( 1236 long index, 1237 int column, 1238 const wxString & label, 1239 int imageId = -1 1240 ); 1241 1242 void SetItemBackgroundColour( 1243 long item, 1244 const wxColour & col 1245 ); 1246 %Docstring 1247 SetItemBackgroundColour(item, col) 1248 1249 Sets the background colour for this item. 1250 %End 1251 1252 bool SetItemColumnImage( 1253 long item, 1254 long column, 1255 int image 1256 ); 1257 %Docstring 1258 SetItemColumnImage(item, column, image) -> bool 1259 1260 Sets the image associated with the item. 1261 %End 1262 1263 void SetItemCount( 1264 long count 1265 ); 1266 %Docstring 1267 SetItemCount(count) 1268 1269 This method can only be used with virtual list controls. 1270 %End 1271 1272 bool SetItemData( 1273 long item, 1274 long data 1275 ); 1276 %Docstring 1277 SetItemData(item, data) -> bool 1278 1279 Associates application-defined data with this item. 1280 %End 1281 1282 void SetItemFont( 1283 long item, 1284 const wxFont & font 1285 ); 1286 %Docstring 1287 SetItemFont(item, font) 1288 1289 Sets the item's font. 1290 %End 1291 1292 bool SetItemImage( 1293 long item, 1294 int image, 1295 int selImage = -1 1296 ); 1297 %Docstring 1298 SetItemImage(item, image, selImage=-1) -> bool 1299 1300 Sets the unselected and selected images associated with the item. 1301 %End 1302 1303 bool SetItemPosition( 1304 long item, 1305 const wxPoint & pos 1306 ); 1307 %Docstring 1308 SetItemPosition(item, pos) -> bool 1309 1310 Sets the position of the item, in icon or small icon view. 1311 %End 1312 1313 bool SetItemState( 1314 long item, 1315 long state, 1316 long stateMask 1317 ); 1318 %Docstring 1319 SetItemState(item, state, stateMask) -> bool 1320 1321 Sets the item state. 1322 %End 1323 1324 void SetItemText( 1325 long item, 1326 const wxString & text 1327 ); 1328 %Docstring 1329 SetItemText(item, text) 1330 1331 Sets the item text for this item. 1332 %End 1333 1334 void SetItemTextColour( 1335 long item, 1336 const wxColour & col 1337 ); 1338 %Docstring 1339 SetItemTextColour(item, col) 1340 1341 Sets the colour for this item. 1342 %End 1343 1344 void SetSingleStyle( 1345 long style, 1346 bool add = true 1347 ); 1348 %Docstring 1349 SetSingleStyle(style, add=True) 1350 1351 Adds or removes a single window style. 1352 %End 1353 1354 void SetTextColour( 1355 const wxColour & col 1356 ); 1357 %Docstring 1358 SetTextColour(col) 1359 1360 Sets the text colour of the list control. 1361 %End 1362 1363 void SetWindowStyleFlag( 1364 long style 1365 ); 1366 %Docstring 1367 SetWindowStyleFlag(style) 1368 1369 Sets the whole window style, deleting all items. 1370 %End 1371 1372 bool SortItems( 1373 PyObject* fnSortCallBack 1374 ); 1375 %Docstring 1376 SortItems(fnSortCallBack) -> bool 1377 1378 Call this function to sort the items in the list control. 1379 %End 1380 %MethodCode 1381 PyErr_Clear(); 1382 Py_BEGIN_ALLOW_THREADS 1383 sipRes = _wxListCtrl_SortItems(sipCpp, fnSortCallBack); 1384 Py_END_ALLOW_THREADS 1385 if (PyErr_Occurred()) sipIsErr = 1; 1386 %End 1387 %TypeCode 1388 bool _wxListCtrl_SortItems(wxListCtrl* self, PyObject* fnSortCallBack) 1389 { 1390 if (!PyCallable_Check(fnSortCallBack)) 1391 return false; 1392 return self->SortItems((wxListCtrlCompare)wxPyListCtrl_SortItems, 1393 (wxIntPtr)fnSortCallBack); 1394 } 1395 %End 1396 1397 public: 1398 virtual wxPoint GetClientAreaOrigin() const; 1399 virtual bool Validate(); 1400 virtual bool TransferDataToWindow(); 1401 virtual bool TransferDataFromWindow(); 1402 virtual void InitDialog(); 1403 virtual bool AcceptsFocus() const; 1404 virtual bool AcceptsFocusRecursively() const; 1405 virtual bool AcceptsFocusFromKeyboard() const; 1406 virtual void AddChild( wxWindowBase *child ); 1407 virtual void RemoveChild( wxWindowBase *child ); 1408 virtual void InheritAttributes(); 1409 virtual bool ShouldInheritColours() const; 1410 virtual void OnInternalIdle(); 1411 virtual wxWindow *GetMainWindowOfCompositeControl(); 1412 virtual bool InformFirstDirection(int direction, int size, int availableOtherDir); 1413 virtual void SetCanFocus(bool canFocus); 1414 virtual bool Destroy(); 1415 virtual void SetValidator( const wxValidator &validator ); 1416 virtual wxValidator* GetValidator(); 1417 1418 1419 protected: 1420 virtual bool ProcessEvent(wxEvent & event); 1421 virtual void DoEnable(bool enable); 1422 virtual void DoGetPosition(int *x, int *y) const; 1423 virtual void DoGetSize(int *width, int *height) const; 1424 virtual void DoGetClientSize(int *width, int *height) const; 1425 virtual wxSize DoGetBestSize() const; 1426 virtual wxSize DoGetBestClientSize() const; 1427 virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags); 1428 virtual void DoSetClientSize(int width, int height); 1429 virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH ); 1430 virtual wxSize DoGetBorderSize() const; 1431 virtual void DoMoveWindow(int x, int y, int width, int height); 1432 virtual void DoSetWindowVariant( wxWindowVariant variant); 1433 virtual wxBorder GetDefaultBorder() const; 1434 virtual wxBorder GetDefaultBorderForControl() const; 1435 virtual void DoFreeze(); 1436 virtual void DoThaw(); 1437 virtual bool HasTransparentBackground(); 1438 virtual bool TryBefore(wxEvent& event); 1439 virtual bool TryAfter(wxEvent& event); 1440 1441 1442 public: 1443 1444 1445 static 1446 wxVisualAttributes GetClassDefaultAttributes( 1447 wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL 1448 ); 1449 %Docstring 1450 GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes 1451 %End 1452 %PreMethodCode 1453 if (!wxPyCheckForApp()) return NULL; 1454 %End 1455 1456 PyObject* HitTestSubItem(const wxPoint& point); 1457 %Docstring 1458 HitTestSubItemHitTestSubItem(point) -> (item, flags, subitem) 1459 1460 Determines which item (if any) is at the specified point, giving 1461 details in flags. 1462 %End 1463 %MethodCode 1464 PyErr_Clear(); 1465 Py_BEGIN_ALLOW_THREADS 1466 sipRes = _wxListCtrl_HitTestSubItem(sipCpp, point); 1467 Py_END_ALLOW_THREADS 1468 if (PyErr_Occurred()) sipIsErr = 1; 1469 %End 1470 %TypeCode 1471 PyObject* _wxListCtrl_HitTestSubItem(wxListCtrl* self, const wxPoint* point) 1472 { 1473 long item, subitem; 1474 int flags; 1475 item = self->HitTest(*point, flags, &subitem); 1476 wxPyThreadBlocker blocker; 1477 PyObject* rv = PyTuple_New(3); 1478 PyTuple_SetItem(rv, 0, wxPyInt_FromLong(item)); 1479 PyTuple_SetItem(rv, 1, wxPyInt_FromLong(flags)); 1480 PyTuple_SetItem(rv, 2, wxPyInt_FromLong(subitem)); 1481 return rv; 1482 } 1483 %End 1484 1485 bool HasColumnOrderSupport(); 1486 %Docstring 1487 HasColumnOrderSupport() -> bool 1488 %End 1489 %MethodCode 1490 PyErr_Clear(); 1491 Py_BEGIN_ALLOW_THREADS 1492 sipRes = _wxListCtrl_HasColumnOrderSupport(sipCpp); 1493 Py_END_ALLOW_THREADS 1494 if (PyErr_Occurred()) sipIsErr = 1; 1495 %End 1496 %TypeCode 1497 bool _wxListCtrl_HasColumnOrderSupport(wxListCtrl* self) 1498 { 1499 #ifdef wxHAS_LISTCTRL_COLUMN_ORDER 1500 return true; 1501 #else 1502 return false; 1503 #endif 1504 } 1505 %End 1506 1507 wxWindow* GetMainWindow(); 1508 %Docstring 1509 GetMainWindow() -> Window 1510 %End 1511 %MethodCode 1512 PyErr_Clear(); 1513 Py_BEGIN_ALLOW_THREADS 1514 sipRes = _wxListCtrl_GetMainWindow(sipCpp); 1515 Py_END_ALLOW_THREADS 1516 if (PyErr_Occurred()) sipIsErr = 1; 1517 %End 1518 %TypeCode 1519 wxWindow* _wxListCtrl_GetMainWindow(wxListCtrl* self) 1520 { 1521 #if defined(__WXMSW__) || defined(__WXMAC__) 1522 return self; 1523 #else 1524 return (wxWindow*)self->m_mainWin; 1525 #endif 1526 } 1527 %End 1528 1529 public: 1530 1531 1532 %Property(name=Column, get=GetColumn, set=SetColumn) 1533 %Property(name=ColumnCount, get=GetColumnCount) 1534 %Property(name=ColumnsOrder, get=GetColumnsOrder, set=SetColumnsOrder) 1535 %Property(name=CountPerPage, get=GetCountPerPage) 1536 %Property(name=EditControl, get=GetEditControl) 1537 %Property(name=Item, get=GetItem, set=SetItem) 1538 %Property(name=ItemCount, get=GetItemCount, set=SetItemCount) 1539 %Property(name=ItemPosition, get=GetItemPosition, set=SetItemPosition) 1540 %Property(name=ItemRect, get=GetItemRect) 1541 %Property(name=ItemSpacing, get=GetItemSpacing) 1542 %Property(name=MainWindow, get=GetMainWindow) 1543 %Property(name=SelectedItemCount, get=GetSelectedItemCount) 1544 %Property(name=TextColour, get=GetTextColour, set=SetTextColour) 1545 %Property(name=TopItem, get=GetTopItem) 1546 %Property(name=ViewRect, get=GetViewRect) 1547 1548protected: 1549 virtual 1550 wxListItemAttr * OnGetItemAttr( 1551 long item 1552 ) const; 1553 %Docstring 1554 OnGetItemAttr(item) -> ListItemAttr 1555 1556 This function may be overridden in the derived class for a control 1557 with wxLC_VIRTUAL style. 1558 %End 1559 1560 virtual 1561 int OnGetItemColumnImage( 1562 long item, 1563 long column 1564 ) const; 1565 %Docstring 1566 OnGetItemColumnImage(item, column) -> int 1567 1568 Override this function in the derived class for a control with 1569 wxLC_VIRTUAL and wxLC_REPORT styles in order to specify the image 1570 index for the given line and column. 1571 %End 1572 1573 virtual 1574 int OnGetItemImage( 1575 long item 1576 ) const; 1577 %Docstring 1578 OnGetItemImage(item) -> int 1579 1580 This function must be overridden in the derived class for a control 1581 with wxLC_VIRTUAL style having an "image list" (see SetImageList(); if 1582 the control doesn't have an image list, it is not necessary to 1583 override it). 1584 %End 1585 1586 virtual 1587 wxString OnGetItemText( 1588 long item, 1589 long column 1590 ) const; 1591 %Docstring 1592 OnGetItemText(item, column) -> String 1593 1594 This function must be overridden in the derived class for a control 1595 with wxLC_VIRTUAL style. 1596 %End 1597 1598}; // end of class wxListCtrl 1599 1600 1601%Extract(id=pycode_core) 1602ListCtrl.FindItemData = wx.deprecated(ListCtrl.FindItem, "Use FindItem instead.") 1603 1604%End 1605 1606%Extract(id=pycode_core) 1607ListCtrl.FindItemAtPos = wx.deprecated(ListCtrl.FindItem, "Use FindItem instead.") 1608 1609%End 1610 1611%Extract(id=pycode_core) 1612ListCtrl.InsertStringItem = wx.deprecated(ListCtrl.InsertItem, "Use InsertItem instead.") 1613 1614%End 1615 1616%Extract(id=pycode_core) 1617ListCtrl.InsertImageItem = wx.deprecated(ListCtrl.InsertItem, "Use InsertItem instead.") 1618 1619%End 1620 1621%Extract(id=pycode_core) 1622ListCtrl.InsertImageStringItem = wx.deprecated(ListCtrl.InsertItem, "Use InsertItem instead.") 1623 1624%End 1625 1626%Extract(id=pycode_core) 1627ListCtrl.SetStringItem = wx.deprecated(ListCtrl.SetItem, "Use SetItem instead.") 1628 1629%End 1630 1631%Extract(id=pycode_core) 1632def _ListCtrl_Select(self, idx, on=1): 1633 """ 1634 Selects/deselects an item. 1635 """ 1636 if on: state = wx.LIST_STATE_SELECTED 1637 else: state = 0 1638 self.SetItemState(idx, state, wx.LIST_STATE_SELECTED) 1639ListCtrl.Select = _ListCtrl_Select 1640del _ListCtrl_Select 1641%End 1642 1643%Extract(id=pycode_core) 1644def _ListCtrl_Focus(self, idx): 1645 """ 1646 Focus and show the given item. 1647 """ 1648 self.SetItemState(idx, wx.LIST_STATE_FOCUSED, wx.LIST_STATE_FOCUSED) 1649 self.EnsureVisible(idx) 1650ListCtrl.Focus = _ListCtrl_Focus 1651del _ListCtrl_Focus 1652%End 1653 1654%Extract(id=pycode_core) 1655def _ListCtrl_GetFocusedItem(self): 1656 """ 1657 Gets the currently focused item or -1 if none is focused. 1658 """ 1659 return self.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_FOCUSED) 1660ListCtrl.GetFocusedItem = _ListCtrl_GetFocusedItem 1661del _ListCtrl_GetFocusedItem 1662%End 1663 1664%Extract(id=pycode_core) 1665def _ListCtrl_GetFirstSelected(self, *args): 1666 """ 1667 Returns the first selected item, or -1 when none is selected. 1668 """ 1669 return self.GetNextSelected(-1) 1670ListCtrl.GetFirstSelected = _ListCtrl_GetFirstSelected 1671del _ListCtrl_GetFirstSelected 1672%End 1673 1674%Extract(id=pycode_core) 1675def _ListCtrl_GetNextSelected(self, item): 1676 """ 1677 Returns subsequent selected items, or -1 when no more are selected. 1678 """ 1679 return self.GetNextItem(item, wx.LIST_NEXT_ALL, wx.LIST_STATE_SELECTED) 1680ListCtrl.GetNextSelected = _ListCtrl_GetNextSelected 1681del _ListCtrl_GetNextSelected 1682%End 1683 1684%Extract(id=pycode_core) 1685def _ListCtrl_IsSelected(self, idx): 1686 """ 1687 Returns ``True`` if the item is selected. 1688 """ 1689 return (self.GetItemState(idx, wx.LIST_STATE_SELECTED) & wx.LIST_STATE_SELECTED) != 0 1690ListCtrl.IsSelected = _ListCtrl_IsSelected 1691del _ListCtrl_IsSelected 1692%End 1693 1694%Extract(id=pycode_core) 1695def _ListCtrl_SetColumnImage(self, col, image): 1696 item = self.GetColumn(col) 1697 # preserve all other attributes too 1698 item.SetMask( wx.LIST_MASK_STATE | 1699 wx.LIST_MASK_TEXT | 1700 wx.LIST_MASK_IMAGE | 1701 wx.LIST_MASK_DATA | 1702 wx.LIST_SET_ITEM | 1703 wx.LIST_MASK_WIDTH | 1704 wx.LIST_MASK_FORMAT ) 1705 item.SetImage(image) 1706 self.SetColumn(col, item) 1707ListCtrl.SetColumnImage = _ListCtrl_SetColumnImage 1708del _ListCtrl_SetColumnImage 1709%End 1710 1711%Extract(id=pycode_core) 1712def _ListCtrl_ClearColumnImage(self, col): 1713 self.SetColumnImage(col, -1) 1714ListCtrl.ClearColumnImage = _ListCtrl_ClearColumnImage 1715del _ListCtrl_ClearColumnImage 1716%End 1717 1718%Extract(id=pycode_core) 1719def _ListCtrl_Append(self, entry): 1720 """ 1721 Append an item to the list control. The `entry` parameter should be a 1722 sequence with an item for each column 1723 """ 1724 if len(entry): 1725 from six import text_type 1726 pos = self.InsertItem(self.GetItemCount(), text_type(entry[0])) 1727 for i in range(1, len(entry)): 1728 self.SetItem(pos, i, text_type(entry[i])) 1729 return pos 1730ListCtrl.Append = _ListCtrl_Append 1731del _ListCtrl_Append 1732%End 1733 1734%Extract(id=pycode_core) 1735ListCtrl.FocusedItem = property(ListCtrl.GetFocusedItem) 1736%End 1737 1738class wxListView : wxListCtrl 1739{ 1740 %Docstring 1741 ListView() 1742 ListView(parent, winid=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=LC_REPORT, validator=DefaultValidator, name=ListCtrlNameStr) 1743 1744 This class currently simply presents a simpler to use interface for 1745 the wxListCtrl it can be thought of as a façade for that complicated 1746 class. 1747 %End 1748 %TypeHeaderCode 1749 #include <wx/listctrl.h> 1750 %End 1751 1752public: 1753 wxListView(); 1754 %PreMethodCode 1755 if (!wxPyCheckForApp()) return NULL; 1756 %End 1757 1758 wxListView( 1759 wxWindow * parent /TransferThis/, 1760 wxWindowID winid = wxID_ANY, 1761 const wxPoint & pos = wxDefaultPosition, 1762 const wxSize & size = wxDefaultSize, 1763 long style = wxLC_REPORT, 1764 const wxValidator & validator = wxDefaultValidator, 1765 const wxString & name = wxListCtrlNameStr 1766 ); 1767 %PreMethodCode 1768 if (!wxPyCheckForApp()) return NULL; 1769 %End 1770 1771 ~wxListView(); 1772 1773 void ClearColumnImage( 1774 int col 1775 ); 1776 %Docstring 1777 ClearColumnImage(col) 1778 1779 Resets the column image after calling this function, no image will be 1780 shown. 1781 %End 1782 1783 void Focus( 1784 long index 1785 ); 1786 %Docstring 1787 Focus(index) 1788 1789 Sets focus to the item with the given index. 1790 %End 1791 1792 long GetFirstSelected() const; 1793 %Docstring 1794 GetFirstSelected() -> long 1795 1796 Returns the first selected item in a (presumably) multiple selection 1797 control. 1798 %End 1799 1800 long GetFocusedItem() const; 1801 %Docstring 1802 GetFocusedItem() -> long 1803 1804 Returns the currently focused item or -1 if none. 1805 %End 1806 1807 long GetNextSelected( 1808 long item 1809 ) const; 1810 %Docstring 1811 GetNextSelected(item) -> long 1812 1813 Used together with GetFirstSelected() to iterate over all selected 1814 items in the control. 1815 %End 1816 1817 bool IsSelected( 1818 long index 1819 ) const; 1820 %Docstring 1821 IsSelected(index) -> bool 1822 1823 Returns true if the item with the given index is selected, false 1824 otherwise. 1825 %End 1826 1827 void Select( 1828 long n, 1829 bool on = true 1830 ); 1831 %Docstring 1832 Select(n, on=True) 1833 1834 Selects or unselects the given item. 1835 %End 1836 1837 void SetColumnImage( 1838 int col, 1839 int image 1840 ); 1841 %Docstring 1842 SetColumnImage(col, image) 1843 1844 Sets the column image for the specified column. 1845 %End 1846 1847 public: 1848 virtual wxPoint GetClientAreaOrigin() const; 1849 virtual bool Validate(); 1850 virtual bool TransferDataToWindow(); 1851 virtual bool TransferDataFromWindow(); 1852 virtual void InitDialog(); 1853 virtual bool AcceptsFocus() const; 1854 virtual bool AcceptsFocusRecursively() const; 1855 virtual bool AcceptsFocusFromKeyboard() const; 1856 virtual void AddChild( wxWindowBase *child ); 1857 virtual void RemoveChild( wxWindowBase *child ); 1858 virtual void InheritAttributes(); 1859 virtual bool ShouldInheritColours() const; 1860 virtual void OnInternalIdle(); 1861 virtual wxWindow *GetMainWindowOfCompositeControl(); 1862 virtual bool InformFirstDirection(int direction, int size, int availableOtherDir); 1863 virtual void SetCanFocus(bool canFocus); 1864 virtual bool Destroy(); 1865 virtual void SetValidator( const wxValidator &validator ); 1866 virtual wxValidator* GetValidator(); 1867 1868 1869 protected: 1870 virtual bool ProcessEvent(wxEvent & event); 1871 virtual void DoEnable(bool enable); 1872 virtual void DoGetPosition(int *x, int *y) const; 1873 virtual void DoGetSize(int *width, int *height) const; 1874 virtual void DoGetClientSize(int *width, int *height) const; 1875 virtual wxSize DoGetBestSize() const; 1876 virtual wxSize DoGetBestClientSize() const; 1877 virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags); 1878 virtual void DoSetClientSize(int width, int height); 1879 virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH ); 1880 virtual wxSize DoGetBorderSize() const; 1881 virtual void DoMoveWindow(int x, int y, int width, int height); 1882 virtual void DoSetWindowVariant( wxWindowVariant variant); 1883 virtual wxBorder GetDefaultBorder() const; 1884 virtual wxBorder GetDefaultBorderForControl() const; 1885 virtual void DoFreeze(); 1886 virtual void DoThaw(); 1887 virtual bool HasTransparentBackground(); 1888 virtual bool TryBefore(wxEvent& event); 1889 virtual bool TryAfter(wxEvent& event); 1890 1891 1892 public: 1893 1894 1895 static 1896 wxVisualAttributes GetClassDefaultAttributes( 1897 wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL 1898 ); 1899 %Docstring 1900 GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes 1901 %End 1902 %PreMethodCode 1903 if (!wxPyCheckForApp()) return NULL; 1904 %End 1905 1906 public: 1907 1908 1909 %Property(name=FirstSelected, get=GetFirstSelected) 1910 %Property(name=FocusedItem, get=GetFocusedItem) 1911}; // end of class wxListView 1912 1913 1914class wxListEvent : wxNotifyEvent 1915{ 1916 %Docstring 1917 ListEvent(commandType=wxEVT_NULL, id=0) 1918 1919 A list event holds information about events associated with wxListCtrl 1920 objects. 1921 %End 1922 %TypeHeaderCode 1923 #include <wx/listctrl.h> 1924 %End 1925 1926public: 1927 wxListEvent( 1928 wxEventType commandType = wxEVT_NULL, 1929 int id = 0 1930 ); 1931 1932 long GetCacheFrom() const; 1933 %Docstring 1934 GetCacheFrom() -> long 1935 1936 For EVT_LIST_CACHE_HINT event only: return the first item which the 1937 list control advises us to cache. 1938 %End 1939 1940 long GetCacheTo() const; 1941 %Docstring 1942 GetCacheTo() -> long 1943 1944 For EVT_LIST_CACHE_HINT event only: return the last item (inclusive) 1945 which the list control advises us to cache. 1946 %End 1947 1948 int GetColumn() const; 1949 %Docstring 1950 GetColumn() -> int 1951 1952 The column position: it is only used with COL events. 1953 %End 1954 1955 wxUIntPtr GetData() const; 1956 %Docstring 1957 GetData() -> UIntPtr 1958 1959 The data. 1960 %End 1961 1962 int GetImage() const; 1963 %Docstring 1964 GetImage() -> int 1965 1966 The image. 1967 %End 1968 1969 long GetIndex() const; 1970 %Docstring 1971 GetIndex() -> long 1972 1973 The item index. 1974 %End 1975 1976 const wxListItem & GetItem() const; 1977 %Docstring 1978 GetItem() -> ListItem 1979 1980 An item object, used by some events. 1981 %End 1982 1983 int GetKeyCode() const; 1984 %Docstring 1985 GetKeyCode() -> int 1986 1987 Key code if the event is a keypress event. 1988 %End 1989 1990 const wxString & GetLabel() const; 1991 %Docstring 1992 GetLabel() -> String 1993 1994 The (new) item label for EVT_LIST_END_LABEL_EDIT event. 1995 %End 1996 1997 long GetMask() const; 1998 %Docstring 1999 GetMask() -> long 2000 2001 The mask. 2002 %End 2003 2004 wxPoint GetPoint() const; 2005 %Docstring 2006 GetPoint() -> Point 2007 2008 The position of the mouse pointer if the event is a drag event. 2009 %End 2010 2011 const wxString & GetText() const; 2012 %Docstring 2013 GetText() -> String 2014 2015 The text. 2016 %End 2017 2018 bool IsEditCancelled() const; 2019 %Docstring 2020 IsEditCancelled() -> bool 2021 2022 This method only makes sense for EVT_LIST_END_LABEL_EDIT message and 2023 returns true if it the label editing has been cancelled by the user 2024 (GetLabel() returns an empty string in this case but it doesn't allow 2025 the application to distinguish between really cancelling the edit and 2026 the admittedly rare case when the user wants to rename it to an empty 2027 string). 2028 %End 2029 2030 void SetKeyCode( 2031 int code 2032 ); 2033 %Docstring 2034 SetKeyCode(code) 2035 %End 2036 2037 void SetIndex( 2038 long index 2039 ); 2040 %Docstring 2041 SetIndex(index) 2042 %End 2043 2044 void SetColumn( 2045 int col 2046 ); 2047 %Docstring 2048 SetColumn(col) 2049 %End 2050 2051 void SetPoint( 2052 const wxPoint & point 2053 ); 2054 %Docstring 2055 SetPoint(point) 2056 %End 2057 2058 void SetItem( 2059 const wxListItem & item 2060 ); 2061 %Docstring 2062 SetItem(item) 2063 %End 2064 2065 void SetCacheFrom( 2066 long cacheFrom 2067 ); 2068 %Docstring 2069 SetCacheFrom(cacheFrom) 2070 %End 2071 2072 void SetCacheTo( 2073 long cacheTo 2074 ); 2075 %Docstring 2076 SetCacheTo(cacheTo) 2077 %End 2078 2079 public: 2080 virtual wxEvent* Clone() const /Factory/; 2081 2082 2083 private: 2084 wxListEvent& operator=(const wxListEvent&); 2085 2086 2087 public: 2088 2089 2090 %Property(name=CacheFrom, get=GetCacheFrom, set=SetCacheFrom) 2091 %Property(name=CacheTo, get=GetCacheTo, set=SetCacheTo) 2092 %Property(name=Column, get=GetColumn, set=SetColumn) 2093 %Property(name=Data, get=GetData) 2094 %Property(name=Image, get=GetImage) 2095 %Property(name=Index, get=GetIndex, set=SetIndex) 2096 %Property(name=Item, get=GetItem, set=SetItem) 2097 %Property(name=KeyCode, get=GetKeyCode, set=SetKeyCode) 2098 %Property(name=Label, get=GetLabel) 2099 %Property(name=Mask, get=GetMask) 2100 %Property(name=Point, get=GetPoint, set=SetPoint) 2101 %Property(name=Text, get=GetText) 2102}; // end of class wxListEvent 2103 2104 2105%Extract(id=pycode_core) 2106EVT_LIST_BEGIN_DRAG = PyEventBinder(wxEVT_LIST_BEGIN_DRAG , 1) 2107EVT_LIST_BEGIN_RDRAG = PyEventBinder(wxEVT_LIST_BEGIN_RDRAG , 1) 2108EVT_LIST_BEGIN_LABEL_EDIT = PyEventBinder(wxEVT_LIST_BEGIN_LABEL_EDIT , 1) 2109EVT_LIST_END_LABEL_EDIT = PyEventBinder(wxEVT_LIST_END_LABEL_EDIT , 1) 2110EVT_LIST_DELETE_ITEM = PyEventBinder(wxEVT_LIST_DELETE_ITEM , 1) 2111EVT_LIST_DELETE_ALL_ITEMS = PyEventBinder(wxEVT_LIST_DELETE_ALL_ITEMS , 1) 2112EVT_LIST_ITEM_SELECTED = PyEventBinder(wxEVT_LIST_ITEM_SELECTED , 1) 2113EVT_LIST_ITEM_DESELECTED = PyEventBinder(wxEVT_LIST_ITEM_DESELECTED , 1) 2114EVT_LIST_KEY_DOWN = PyEventBinder(wxEVT_LIST_KEY_DOWN , 1) 2115EVT_LIST_INSERT_ITEM = PyEventBinder(wxEVT_LIST_INSERT_ITEM , 1) 2116EVT_LIST_COL_CLICK = PyEventBinder(wxEVT_LIST_COL_CLICK , 1) 2117EVT_LIST_ITEM_RIGHT_CLICK = PyEventBinder(wxEVT_LIST_ITEM_RIGHT_CLICK , 1) 2118EVT_LIST_ITEM_MIDDLE_CLICK = PyEventBinder(wxEVT_LIST_ITEM_MIDDLE_CLICK, 1) 2119EVT_LIST_ITEM_ACTIVATED = PyEventBinder(wxEVT_LIST_ITEM_ACTIVATED , 1) 2120EVT_LIST_CACHE_HINT = PyEventBinder(wxEVT_LIST_CACHE_HINT , 1) 2121EVT_LIST_COL_RIGHT_CLICK = PyEventBinder(wxEVT_LIST_COL_RIGHT_CLICK , 1) 2122EVT_LIST_COL_BEGIN_DRAG = PyEventBinder(wxEVT_LIST_COL_BEGIN_DRAG , 1) 2123EVT_LIST_COL_DRAGGING = PyEventBinder(wxEVT_LIST_COL_DRAGGING , 1) 2124EVT_LIST_COL_END_DRAG = PyEventBinder(wxEVT_LIST_COL_END_DRAG , 1) 2125EVT_LIST_ITEM_FOCUSED = PyEventBinder(wxEVT_LIST_ITEM_FOCUSED , 1) 2126 2127# deprecated wxEVT aliases 2128wxEVT_COMMAND_LIST_BEGIN_DRAG = wxEVT_LIST_BEGIN_DRAG 2129wxEVT_COMMAND_LIST_BEGIN_RDRAG = wxEVT_LIST_BEGIN_RDRAG 2130wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT = wxEVT_LIST_BEGIN_LABEL_EDIT 2131wxEVT_COMMAND_LIST_END_LABEL_EDIT = wxEVT_LIST_END_LABEL_EDIT 2132wxEVT_COMMAND_LIST_DELETE_ITEM = wxEVT_LIST_DELETE_ITEM 2133wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS = wxEVT_LIST_DELETE_ALL_ITEMS 2134wxEVT_COMMAND_LIST_ITEM_SELECTED = wxEVT_LIST_ITEM_SELECTED 2135wxEVT_COMMAND_LIST_ITEM_DESELECTED = wxEVT_LIST_ITEM_DESELECTED 2136wxEVT_COMMAND_LIST_KEY_DOWN = wxEVT_LIST_KEY_DOWN 2137wxEVT_COMMAND_LIST_INSERT_ITEM = wxEVT_LIST_INSERT_ITEM 2138wxEVT_COMMAND_LIST_COL_CLICK = wxEVT_LIST_COL_CLICK 2139wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK = wxEVT_LIST_ITEM_RIGHT_CLICK 2140wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK = wxEVT_LIST_ITEM_MIDDLE_CLICK 2141wxEVT_COMMAND_LIST_ITEM_ACTIVATED = wxEVT_LIST_ITEM_ACTIVATED 2142wxEVT_COMMAND_LIST_CACHE_HINT = wxEVT_LIST_CACHE_HINT 2143wxEVT_COMMAND_LIST_COL_RIGHT_CLICK = wxEVT_LIST_COL_RIGHT_CLICK 2144wxEVT_COMMAND_LIST_COL_BEGIN_DRAG = wxEVT_LIST_COL_BEGIN_DRAG 2145wxEVT_COMMAND_LIST_COL_DRAGGING = wxEVT_LIST_COL_DRAGGING 2146wxEVT_COMMAND_LIST_COL_END_DRAG = wxEVT_LIST_COL_END_DRAG 2147wxEVT_COMMAND_LIST_ITEM_FOCUSED = wxEVT_LIST_ITEM_FOCUSED 2148 2149%End 2150 2151 2152//--------------------------------------------------------------------------- 2153 2154