Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / XS / ListCtrl.xs
1 #############################################################################
2 ## Name:        XS/ListCtrl.xs
3 ## Purpose:     XS for Wx::ListCtrl, Wx::ListItem
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     04/02/2001
7 ## RCS-ID:      $Id: ListCtrl.xs 2145 2007-08-15 10:22:29Z mbarbon $
8 ## Copyright:   (c) 2001-2007 Mattia Barbon
9 ## Licence:     This program is free software; you can redistribute it and/or
10 ##              modify it under the same terms as Perl itself
11 #############################################################################
12
13 #include <wx/colour.h>
14 #include <wx/listctrl.h>
15
16 #if WXPERL_W_VERSION_LT( 2, 6, 0 )
17 #define wxListCtrlNameStr wxT("listCtrl")
18 #endif
19
20 MODULE=Wx_Evt PACKAGE=Wx::ListEvent
21
22 wxListEvent*
23 wxListEvent::new( eventType = wxEVT_NULL, id = 0 )
24     wxEventType eventType
25     int id
26
27 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
28
29 bool
30 wxListEvent::IsEditCancelled()
31
32 #endif
33
34 long
35 wxListEvent::GetCacheFrom()
36
37 long
38 wxListEvent::GetCacheTo()
39
40 long
41 wxListEvent::GetIndex()
42
43 int
44 wxListEvent::GetColumn()
45
46 int
47 wxListEvent::GetKeyCode()
48
49 wxPoint*
50 wxListEvent::GetPoint()
51   CODE:
52     RETVAL = new wxPoint( THIS->GetPoint() );
53   OUTPUT:
54     RETVAL
55
56 wxString
57 wxListEvent::GetLabel()
58
59 wxString
60 wxListEvent::GetText()
61
62 int
63 wxListEvent::GetImage()
64
65 long
66 wxListEvent::GetData()
67
68 long
69 wxListEvent::GetMask()
70
71 wxListItem*
72 wxListEvent::GetItem()
73   CODE:
74     RETVAL = new wxListItem( THIS->GetItem() );
75   OUTPUT:
76     RETVAL
77
78 MODULE=Wx PACKAGE=Wx::ListItem
79
80 wxListItem*
81 wxListItem::new()
82
83 static void
84 wxListItem::CLONE()
85   CODE:
86     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
87
88 ## // thread OK
89 void
90 wxListItem::DESTROY()
91   CODE:
92     wxPli_thread_sv_unregister( aTHX_ "Wx::ListItem", THIS, ST(0) );
93     delete THIS;
94
95 void
96 wxListItem::Clear()
97
98 void
99 wxListItem::ClearAttributes()
100
101 void
102 wxListItem::SetMask( mask )
103     long mask
104
105 void
106 wxListItem::SetId( id )
107     long id
108
109 void
110 wxListItem::SetColumn( column )
111     int column
112
113 void
114 wxListItem::SetState( state )
115    long state
116
117 void
118 wxListItem::SetStateMask( stateMask )
119     long stateMask
120
121 void
122 wxListItem::SetText( text )
123     wxString text
124
125 void
126 wxListItem::SetImage( image )
127      int image
128
129 void
130 wxListItem::SetData( data )
131     long data
132
133 void
134 wxListItem::SetWidth( width )
135     int width
136
137 void
138 wxListItem::SetAlign( align )
139     wxListColumnFormat align
140
141 void
142 wxListItem::SetTextColour( colour )
143     wxColour colour
144
145 void
146 wxListItem::SetBackgroundColour( colour )
147     wxColour colour
148
149 void
150 wxListItem::SetFont( font )
151     wxFont* font
152   C_ARGS: *font
153
154 long
155 wxListItem::GetMask()
156
157 long
158 wxListItem::GetId()
159
160 int
161 wxListItem::GetColumn()
162
163 long
164 wxListItem::GetState()
165
166 wxString
167 wxListItem::GetText()
168
169 int
170 wxListItem::GetImage()
171
172 long
173 wxListItem::GetData()
174
175 int
176 wxListItem::GetWidth()
177
178 wxListColumnFormat
179 wxListItem::GetAlign()
180
181 wxColour*
182 wxListItem::GetTextColour()
183   CODE:
184     RETVAL = new wxColour( THIS->GetTextColour() );
185   OUTPUT:
186     RETVAL
187
188 wxColour*
189 wxListItem::GetBackgroundColour()
190   CODE:
191     RETVAL = new wxColour( THIS->GetBackgroundColour() );
192   OUTPUT:
193     RETVAL
194
195 wxFont*
196 wxListItem::GetFont()
197   CODE:
198     RETVAL = new wxFont( THIS->GetFont() );
199   OUTPUT:
200     RETVAL
201
202 MODULE=Wx PACKAGE=Wx::ListItemAttr
203
204 wxListItemAttr*
205 wxListItemAttr::new( ... )
206   CASE: items == 1
207     CODE:
208       RETVAL = new wxListItemAttr();
209     OUTPUT:
210       RETVAL
211   CASE: items == 4
212     INPUT:
213       wxColour text = NO_INIT
214       wxColour back = NO_INIT
215       wxFont* font = NO_INIT
216     CODE:
217       text = *(wxColour *) wxPli_sv_2_object( aTHX_ ST(1), "Wx::Colour" );
218       back = *(wxColour *) wxPli_sv_2_object( aTHX_ ST(2), "Wx::Colour" );
219       font = (wxFont *) wxPli_sv_2_object( aTHX_ ST(3), "Wx::Font" );
220       RETVAL = new wxListItemAttr( text, back, *font );
221     OUTPUT:
222       RETVAL
223   CASE:
224     CODE:
225       croak( "Usage: Wx::ListItemAttr::new(THIS [, text, back, font ] )" );
226
227 static void
228 wxListItemAttr::CLONE()
229   CODE:
230     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
231
232 ## // thread OK
233 void
234 wxListItemAttr::DESTROY()
235   CODE:
236     wxPli_thread_sv_unregister( aTHX_ "Wx::ListItemAttr", THIS, ST(0) );
237     delete THIS;
238
239 void
240 wxListItemAttr::SetTextColour( text )
241     wxColour text
242
243 void
244 wxListItemAttr::SetBackgroundColour( back )
245     wxColour back
246
247 void
248 wxListItemAttr::SetFont( font )
249     wxFont* font
250   CODE:
251     THIS->SetFont( *font );
252
253 bool
254 wxListItemAttr::HasTextColour()
255
256 bool
257 wxListItemAttr::HasBackgroundColour()
258
259 bool
260 wxListItemAttr::HasFont()
261
262 wxColour*
263 wxListItemAttr::GetTextColour()
264   CODE:
265     RETVAL = new wxColour( THIS->GetTextColour() );
266   OUTPUT:
267     RETVAL
268
269 wxColour*
270 wxListItemAttr::GetBackgroundColour()
271   CODE:
272     RETVAL = new wxColour( THIS->GetBackgroundColour() );
273   OUTPUT:
274     RETVAL
275
276 wxFont*
277 wxListItemAttr::GetFont()
278   CODE:
279     RETVAL = new wxFont( THIS->GetFont() );
280   OUTPUT:
281     RETVAL
282
283 MODULE=Wx PACKAGE=Wx::ListCtrl
284
285 #!sub OnGetItemText
286 #!sub OnGetItemImage
287 #!sub OnGetItemAttr
288 #!sub OnGetItemColumnImage
289
290 void
291 new( ... )
292   PPCODE:
293     BEGIN_OVERLOAD()
294         MATCH_VOIDM_REDISP( newDefault )
295         MATCH_ANY_REDISP( newFull )
296     END_OVERLOAD( "Wx::ListCtrl::new" )
297
298 wxListCtrl*
299 newDefault( CLASS )
300     PlClassName CLASS
301   CODE:
302     RETVAL = new wxPliListCtrl( CLASS );
303     wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
304   OUTPUT: RETVAL
305
306 wxListCtrl*
307 newFull( CLASS, parent, id = wxID_ANY, pos = wxDefaultPosition, size = wxDefaultSize, style = wxLC_ICON, validator = (wxValidator*)&wxDefaultValidator, name = wxListCtrlNameStr )
308     PlClassName CLASS
309     wxWindow* parent
310     wxWindowID id
311     wxPoint pos
312     wxSize size
313     long style
314     wxValidator* validator
315     wxString name
316   CODE:
317     RETVAL = new wxPliListCtrl( CLASS, parent, id, pos, size, style,
318         *validator, name );
319   OUTPUT:
320     RETVAL
321
322 bool
323 wxListCtrl::Create( parent, id = wxID_ANY, pos = wxDefaultPosition, size = wxDefaultSize, style = wxLC_ICON, validator = (wxValidator*)&wxDefaultValidator, name = wxListCtrlNameStr )
324     wxWindow* parent
325     wxWindowID id
326     wxPoint pos
327     wxSize size
328     long style
329     wxValidator* validator
330     wxString name
331   C_ARGS: parent, id, pos, size, style, *validator, name
332
333 bool
334 wxListCtrl::Arrange( flag = wxLIST_ALIGN_DEFAULT )
335     int flag
336
337 void
338 wxListCtrl::AssignImageList( imagelist, which )
339     wxImageList* imagelist
340     int which
341   CODE:
342     wxPli_object_set_deleteable( aTHX_ ST(1), false );
343     THIS->AssignImageList( imagelist, which );
344
345 void
346 wxListCtrl::ClearAll()
347
348 bool
349 wxListCtrl::DeleteItem( item )
350     long item
351
352 bool
353 wxListCtrl::DeleteAllItems()
354
355 bool
356 wxListCtrl::DeleteColumn( col )
357     int col
358
359 void
360 wxListCtrl::EditLabel( item )
361     long item
362
363 bool
364 wxListCtrl::EnsureVisible( item )
365     long item
366
367 long
368 wxListCtrl::FindItem( start, str, partial = false )
369     long start
370     wxString str
371     bool partial
372   CODE:
373     RETVAL = THIS->FindItem( start, str, partial );
374   OUTPUT:
375     RETVAL
376
377 long
378 wxListCtrl::FindItemData( start, data )
379     long start
380     long data
381   CODE:
382     RETVAL = THIS->FindItem( start, data );
383   OUTPUT:
384     RETVAL
385
386 long
387 wxListCtrl::FindItemAtPos( start, pt, direction )
388     long start
389     wxPoint pt
390     int direction
391   CODE:
392     RETVAL = THIS->FindItem( start, pt, direction );
393   OUTPUT:
394     RETVAL
395
396 wxListItem*
397 wxListCtrl::GetColumn( col )
398     int col
399   PREINIT:
400     wxListItem item;
401   CODE:
402     item.SetMask( wxLIST_MASK_TEXT|wxLIST_MASK_IMAGE|wxLIST_MASK_FORMAT );
403     if( THIS->GetColumn( col, item ) )
404     {
405       RETVAL = new wxListItem( item );
406     }
407     else
408     {
409       RETVAL = 0;
410     }
411   OUTPUT:
412     RETVAL
413
414 int
415 wxListCtrl::GetColumnCount()
416
417 int
418 wxListCtrl::GetColumnWidth( col )
419     int col
420
421 int
422 wxListCtrl::GetCountPerPage()
423
424 #if defined( __WXMSW__ ) || defined( __WXPERL_FORCE__ )
425
426 wxTextCtrl*
427 wxListCtrl::GetEditControl()
428
429 #endif
430
431 wxImageList*
432 wxListCtrl::GetImageList( which )
433     int which
434   CODE:
435     RETVAL = (wxImageList*)THIS->GetImageList( which );
436   OUTPUT:
437     RETVAL
438   CLEANUP:
439     wxPli_object_set_deleteable( aTHX_ ST(0), false );
440
441 wxListItem*
442 wxListCtrl::GetItem( id, col = -1 )
443     long id
444     int col
445   PREINIT:
446     wxListItem item;
447   CODE:
448     item.SetId( id );
449     if( col != -1 ) { item.SetColumn( col ); }
450     item.SetMask( wxLIST_MASK_TEXT|wxLIST_MASK_DATA|wxLIST_MASK_IMAGE|
451         wxLIST_MASK_STATE );
452     if( THIS->GetItem( item ) )
453     {
454       RETVAL = new wxListItem( item );
455     }
456     else
457     {
458       RETVAL = 0;
459     }
460   OUTPUT:
461     RETVAL
462
463 long
464 wxListCtrl::GetItemData( item )
465     long item
466
467 wxPoint*
468 wxListCtrl::GetItemPosition( item )
469     long item
470   PREINIT:
471     wxPoint point;
472   CODE:
473     if( THIS->GetItemPosition( item, point ) )
474     {
475       RETVAL = new wxPoint( point );
476     }
477     else
478     {
479       RETVAL = 0;
480     }
481   OUTPUT:
482     RETVAL
483
484 wxRect*
485 wxListCtrl::GetItemRect( item, code = wxLIST_RECT_BOUNDS )
486     long item
487     int code
488   PREINIT:
489     wxRect rect;
490   CODE:
491     if( THIS->GetItemRect( item, rect, code ) )
492     {
493         RETVAL = new wxRect( rect );
494     }
495     else
496     {
497         RETVAL = 0;
498     }
499   OUTPUT: RETVAL
500
501 #if WXPERL_W_VERSION_GE( 2, 7, 2 ) && defined(__WXMSW__)
502
503 wxRect*
504 wxListCtrl::GetSubItemRect( item, subItem, code = wxLIST_RECT_BOUNDS )
505     long item
506     long subItem
507     int code
508   PREINIT:
509     wxRect rect;
510   CODE:
511     if( THIS->GetSubItemRect( item, subItem, rect, code ) )
512     {
513         RETVAL = new wxRect( rect );
514     }
515     else
516     {
517         RETVAL = 0;
518     }
519   OUTPUT: RETVAL
520
521 #endif
522
523 int
524 wxListCtrl::GetItemState( item, stateMask )
525     long item
526     long stateMask
527
528 int
529 wxListCtrl::GetItemCount()
530
531 #if WXPERL_W_VERSION_LE( 2, 5, 1 )
532
533 int
534 wxListCtrl::GetItemSpacing( isSmall )
535     bool isSmall
536
537 #else
538
539 wxSize*
540 wxListCtrl::GetItemSpacing()
541   CODE:
542     RETVAL = new wxSize( THIS->GetItemSpacing() );
543   OUTPUT: RETVAL
544
545 #endif
546
547 wxString
548 wxListCtrl::GetItemText( item )
549     long item
550
551 wxColour*
552 wxListCtrl::GetItemTextColour( item )
553     long item
554   CODE:
555     RETVAL = new wxColour( THIS->GetItemTextColour( item ) );
556   OUTPUT:
557     RETVAL
558
559 wxColour*
560 wxListCtrl::GetItemBackgroundColour( item )
561     long item
562   CODE:
563     RETVAL = new wxColour( THIS->GetItemBackgroundColour( item ) );
564   OUTPUT:
565     RETVAL
566
567 void
568 wxListCtrl::SetItemTextColour( item, colour )
569     long item
570     wxColour* colour
571   CODE:
572     THIS->SetItemTextColour( item, *colour );
573
574 void
575 wxListCtrl::SetItemBackgroundColour( item, colour )
576     long item
577     wxColour* colour
578   CODE:
579     THIS->SetItemBackgroundColour( item, *colour );
580
581 long
582 wxListCtrl::GetNextItem( item, geometry = wxLIST_NEXT_ALL, state = wxLIST_STATE_DONTCARE )
583     long item
584     int geometry
585     int state
586
587 int
588 wxListCtrl::GetSelectedItemCount()
589
590 wxColour*
591 wxListCtrl::GetTextColour()
592   CODE:
593     RETVAL = new wxColour( THIS->GetTextColour() );
594   OUTPUT:
595     RETVAL
596
597 long
598 wxListCtrl::GetTopItem()
599
600 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
601
602 wxRect*
603 wxListCtrl::GetViewRect()
604   CODE:
605     RETVAL = new wxRect( THIS->GetViewRect() );
606   OUTPUT: RETVAL
607
608 #endif
609
610 void
611 wxListCtrl::HitTest( point )
612     wxPoint point
613   PREINIT:
614     int flags;
615     long item;
616 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
617     long subitem;
618 #endif
619   PPCODE:
620 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
621     item = THIS->HitTest( point, flags, &subitem );
622 #else
623     item = THIS->HitTest( point, flags );
624 #endif
625     EXTEND( SP, 3 );
626     PUSHs( sv_2mortal( newSViv( item ) ) );
627     PUSHs( sv_2mortal( newSViv( flags ) ) );
628 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
629     PUSHs( sv_2mortal( newSViv( subitem ) ) );
630 #endif
631
632 void
633 wxListCtrl::InsertColumn( ... )
634   PPCODE:
635     BEGIN_OVERLOAD()
636         MATCH_REDISP( wxPliOvl_n_wlci, InsertColumnInfo )
637         MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_n_s_n_n, InsertColumnString, 2 )
638     END_OVERLOAD( Wx::ListCtrl::InsertColumn )
639
640 long
641 wxListCtrl::InsertColumnInfo( col, info )
642     int col
643     wxListItem* info
644   CODE:
645     RETVAL = THIS->InsertColumn( col, *info );
646   OUTPUT:
647     RETVAL
648
649 long
650 wxListCtrl::InsertColumnString( col, heading, format = wxLIST_FORMAT_LEFT, width = -1 )
651     int col
652     wxString heading
653     int format
654     int width
655   CODE:
656     RETVAL = THIS->InsertColumn( col, heading, format, width );
657   OUTPUT:
658     RETVAL
659
660 long
661 wxListCtrl::InsertItem( info )
662     wxListItem* info
663   CODE:
664     RETVAL = THIS->InsertItem( *info );
665   OUTPUT:
666     RETVAL
667
668 long
669 wxListCtrl::InsertStringItem( index, label )
670     long index
671     wxString label
672   CODE:
673     RETVAL = THIS->InsertItem( index, label );
674   OUTPUT:
675     RETVAL
676
677 long
678 wxListCtrl::InsertImageItem( index, image )
679     long index
680     int image
681   CODE:
682     RETVAL = THIS->InsertItem( index, image );
683   OUTPUT:
684     RETVAL
685
686 long
687 wxListCtrl::InsertImageStringItem( index, label, image )
688     long index
689     wxString label
690     int image
691   CODE:
692     RETVAL = THIS->InsertItem( index, label, image );
693   OUTPUT: 
694     RETVAL
695
696 bool
697 wxListCtrl::IsVirtual()
698
699 void
700 wxListCtrl::RefreshItem( item )
701     long item
702
703 void
704 wxListCtrl::RefreshItems( itemFrom, itemTo )
705     long itemFrom
706     long itemTo
707
708 bool
709 wxListCtrl::ScrollList( dx, dy )
710     int dx
711     int dy
712
713 bool
714 wxListCtrl::SetColumn( col, item )
715     int col
716     wxListItem* item
717   CODE:
718     RETVAL = THIS->SetColumn( col, *item );
719   OUTPUT:
720     RETVAL
721
722 bool
723 wxListCtrl::SetColumnWidth( col, width )
724     int col
725     int width
726
727 void
728 wxListCtrl::SetImageList( imagelist, which )
729     wxImageList* imagelist
730     int which
731
732 void
733 wxListCtrl::SetItemCount( count )
734     long count
735
736 void
737 wxListCtrl::SetItem( ... )
738   PPCODE:
739     BEGIN_OVERLOAD()
740         MATCH_REDISP( wxPliOvl_wlci, SetItemInfo )
741         MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_n_n_s_n, SetItemString, 3 )
742     END_OVERLOAD( Wx::ListCtrl::SetItem )
743
744 bool
745 wxListCtrl::SetItemInfo( info )
746     wxListItem* info
747   CODE:
748     RETVAL = THIS->SetItem( *info );
749   OUTPUT:
750     RETVAL
751
752 bool
753 wxListCtrl::SetItemString( index, col, label, image = -1 )
754     long index
755     int col
756     wxString label
757     int image
758   CODE:
759     RETVAL = THIS->SetItem( index, col, label, image );
760   OUTPUT:
761     RETVAL
762
763 bool
764 wxListCtrl::SetItemData( item, data )
765     long item
766     long data
767
768 bool
769 wxListCtrl::SetItemImage( item, image, selImage )
770     long item
771     int image
772     int selImage
773
774 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
775
776 bool
777 wxListCtrl::SetItemColumnImage( item, column, image )
778     long item
779     long column
780     int image
781
782 #endif
783
784 bool
785 wxListCtrl::SetItemPosition( item, pos )
786     long item
787     wxPoint pos
788
789 bool
790 wxListCtrl::SetItemState( item, state, stateMask )
791     long item
792     long state
793     long stateMask
794
795 void
796 wxListCtrl::SetItemText( item, text )
797     long item
798     wxString text
799
800 void
801 wxListCtrl::SetSingleStyle( style, add = true )
802     long style
803     bool add
804
805 void
806 wxListCtrl::SetTextColour( colour )
807     wxColour colour
808
809 void
810 wxListCtrl::SetWindowStyleFlag( style )
811     long style
812
813 bool
814 wxListCtrl::SortItems( function )
815     SV* function
816   CODE:
817     RETVAL = THIS->SortItems( (wxListCtrlCompare)&ListCtrlCompareFn,
818         (long)function );
819   OUTPUT:
820     RETVAL
821
822 MODULE=Wx PACKAGE=Wx::ListView
823
824 void
825 new( ... )
826   PPCODE:
827     BEGIN_OVERLOAD()
828         MATCH_VOIDM_REDISP( newDefault )
829         MATCH_ANY_REDISP( newFull )
830     END_OVERLOAD( "Wx::ListView::new" )
831
832 wxListView*
833 newDefault( CLASS )
834     PlClassName CLASS
835   CODE:
836     RETVAL = new wxListView();
837     wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
838   OUTPUT: RETVAL
839
840 wxListView*
841 newFull( CLASS, parent, id = wxID_ANY, pos = wxDefaultPosition, size = wxDefaultSize, style = wxLC_REPORT, validator = (wxValidator*)&wxDefaultValidator, name = wxListCtrlNameStr )
842     PlClassName CLASS
843     wxWindow* parent
844     wxWindowID id
845     wxPoint pos
846     wxSize size
847     long style
848     wxValidator* validator
849     wxString name
850   CODE:
851     RETVAL = new wxListView( parent, id, pos, size, style,
852         *validator, name );
853     wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
854   OUTPUT:
855     RETVAL
856
857 bool
858 wxListView::Create( parent, id = wxID_ANY, pos = wxDefaultPosition, size = wxDefaultSize, style = wxLC_REPORT, validator = (wxValidator*)&wxDefaultValidator, name = wxListCtrlNameStr )
859     wxWindow* parent
860     wxWindowID id
861     wxPoint pos
862     wxSize size
863     long style
864     wxValidator* validator
865     wxString name
866   C_ARGS: parent, id, pos, size, style, *validator, name
867
868 void
869 wxListView::Select( n, on )
870     long n
871     bool on
872
873 void
874 wxListView::SetColumnImage( col, image )
875     int col
876     int image
877
878 void
879 wxListView::ClearColumnImage( col )
880     int col
881
882 void
883 wxListView::Focus( index )
884     long index
885
886 long
887 wxListView::GetFocusedItem()
888
889 long
890 wxListView::GetFirstSelected()
891
892 long
893 wxListView::GetNextSelected( item )
894     long item
895
896 bool
897 wxListView::IsSelected( index )
898     long index