Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / XS / Geom.xs
1 #############################################################################
2 ## Name:        XS/Geom.xs
3 ## Purpose:     XS for Wx::Point, Wx::Size, Wx::Rect, Wx::Region
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     29/10/2000
7 ## RCS-ID:      $Id: Geom.xs 2527 2009-02-07 17:44:57Z mbarbon $
8 ## Copyright:   (c) 2000-2003, 2006-2009 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 MODULE=Wx PACKAGE=Wx::Size
14
15 wxSize*
16 wxSize::new( width = 0, height = 0 )
17     int width
18     int height
19
20 static void
21 wxSize::CLONE()
22   CODE:
23     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
24
25 ## // thread OK
26 void
27 wxSize::DESTROY()
28   CODE:
29     wxPli_thread_sv_unregister( aTHX_ "Wx::Size", THIS, ST(0) );
30     delete THIS;
31
32 int
33 wxSize::width( ... )
34   CODE:
35     if( items > 1 )
36       THIS->x = SvIV( ST(1) );
37     RETVAL = THIS->x;
38   OUTPUT:
39     RETVAL
40
41 int
42 wxSize::height( ... )
43   CODE:
44     if( items > 1 )
45       THIS->y = SvIV( ST(1) );
46     RETVAL = THIS->y;
47   OUTPUT:
48     RETVAL
49
50 int
51 wxSize::GetHeight()
52
53 int
54 wxSize::GetWidth()
55
56 void
57 wxSize::Set( width, height )
58     int width
59     int height
60
61 void
62 wxSize::SetHeight( height )
63     int height
64
65 void
66 wxSize::SetWidth( width )
67     int width
68
69 void
70 wxSize::IncTo( size )
71     wxSize size
72
73 void
74 wxSize::DecTo( size )
75     wxSize size
76
77 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
78
79 SV*
80 wxSize::Scale( xscale, yscale )
81     float xscale
82     float yscale
83   CODE:
84     THIS->Scale( xscale, yscale );
85     RETVAL = ST(0);
86   OUTPUT: RETVAL
87
88 #endif
89
90 bool
91 wxSize::IsFullySpecified()
92
93 void
94 wxSize::SetDefaults( size )
95     wxSize size
96
97 MODULE=Wx PACKAGE=Wx::Point
98
99 wxPoint*
100 wxPoint::new( x = 0, y = 0 )
101     int x
102     int y
103
104 static void
105 wxPoint::CLONE()
106   CODE:
107     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
108
109 ## // thread OK
110 void
111 wxPoint::DESTROY()
112   CODE:
113     wxPli_thread_sv_unregister( aTHX_ "Wx::Point", THIS, ST(0) );
114     delete THIS;
115
116 int
117 wxPoint::x( ... )
118   CODE:
119     if( items > 1 )
120       THIS->x = SvIV( ST(1) );
121     RETVAL = THIS->x;
122   OUTPUT:
123     RETVAL
124
125 int
126 wxPoint::y( ... )
127   CODE:
128     if( items > 1 )
129       THIS->y = SvIV( ST(1) );
130     RETVAL = THIS->y;
131   OUTPUT:
132     RETVAL
133
134 MODULE=Wx PACKAGE=Wx::Rect
135
136 void
137 wxRect::new( ... )
138   PPCODE:
139     BEGIN_OVERLOAD()
140         MATCH_REDISP( wxPliOvl_n_n_n_n, newXYWH )
141         MATCH_REDISP( wxPliOvl_wpoi_wsiz, newPS )
142         MATCH_REDISP( wxPliOvl_wpoi_wpoi, newPP )
143     END_OVERLOAD( Wx::Rect::new )
144
145 wxRect*
146 newXYWH( CLASS, x, y, width, height )
147     SV* CLASS
148     int x
149     int y
150     int width
151     int height
152   CODE:
153     RETVAL = new wxRect( x, y, width, height );
154   OUTPUT:
155     RETVAL
156
157 wxRect*
158 newPP( CLASS, tl, br )
159     SV* CLASS
160     wxPoint tl
161     wxPoint br
162   CODE:
163     RETVAL = new wxRect( tl, br );
164   OUTPUT:
165     RETVAL
166
167 wxRect*
168 newPS( CLASS, pos, size )
169     SV* CLASS
170     wxPoint pos
171     wxSize size
172   CODE:
173     RETVAL = new wxRect( pos, size );
174   OUTPUT:
175     RETVAL
176
177 static void
178 wxRect::CLONE()
179   CODE:
180     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
181
182 ## // thread OK
183 void
184 wxRect::DESTROY()
185   CODE:
186     wxPli_thread_sv_unregister( aTHX_ "Wx::Rect", THIS, ST(0) );
187     delete THIS;
188
189 int
190 wxRect::x( ... )
191   CODE:
192     if( items > 1 )
193       THIS->x = SvIV( ST(1) );
194     RETVAL = THIS->x;
195   OUTPUT:
196     RETVAL
197
198 int
199 wxRect::y( ... )
200   CODE:
201     if( items > 1 )
202       THIS->y = SvIV( ST(1) );
203     RETVAL = THIS->y;
204   OUTPUT:
205     RETVAL
206
207 int
208 wxRect::width( ... )
209   CODE:
210     if( items > 1 )
211       THIS->width = SvIV( ST(1) );
212     RETVAL = THIS->width;
213   OUTPUT:
214     RETVAL
215
216 int
217 wxRect::height( ... )
218   CODE:
219     if( items > 1 )
220       THIS->height = SvIV( ST(1) );
221     RETVAL = THIS->height;
222   OUTPUT:
223     RETVAL
224
225 int
226 wxRect::GetBottom()
227
228 int
229 wxRect::GetHeight()
230
231 int
232 wxRect::GetLeft()
233
234 wxPoint*
235 wxRect::GetPosition()
236   CODE:
237     RETVAL = new wxPoint( THIS->GetPosition() );
238   OUTPUT:
239     RETVAL
240     
241 wxPoint*
242 wxRect::GetTopLeft()
243   CODE:
244     RETVAL = new wxPoint( THIS->GetTopLeft() );
245   OUTPUT:
246     RETVAL
247     
248 wxPoint*
249 wxRect::GetBottomRight()
250   CODE:
251     RETVAL = new wxPoint( THIS->GetBottomRight() );
252   OUTPUT:
253     RETVAL
254     
255 #if WXPERL_W_VERSION_GE( 2, 8, 0 )
256
257 wxPoint*
258 wxRect::GetBottomLeft()
259   CODE:
260     RETVAL = new wxPoint( THIS->GetBottomLeft() );
261   OUTPUT:
262     RETVAL
263     
264 wxPoint*
265 wxRect::GetTopRight()
266   CODE:
267     RETVAL = new wxPoint( THIS->GetTopRight() );
268   OUTPUT:
269     RETVAL
270
271 bool
272 wxRect::IsEmpty()
273
274 wxRect*
275 wxRect::Union( wxRect* rec )
276   CODE:
277     RETVAL = new wxRect( THIS->Union( *rec ) );
278   OUTPUT:
279     RETVAL
280
281 #endif    
282
283 int
284 wxRect::GetRight()
285
286 wxSize*
287 wxRect::GetSize()
288   CODE:
289     RETVAL = new wxSize( THIS->GetSize() );
290   OUTPUT:
291     RETVAL
292
293 int
294 wxRect::GetTop()
295
296 int
297 wxRect::GetWidth()
298
299 int
300 wxRect::GetX()
301
302 int
303 wxRect::GetY()
304
305 void
306 wxRect::Deflate( x, y )
307     wxCoord x 
308     wxCoord y = NO_INIT
309   CODE:
310     if( items == 2 )
311       y = x;
312     else
313       y = SvIV( ST(2) );
314     THIS->Deflate( x, y );
315
316 void
317 wxRect::Inflate( x, y )
318     wxCoord x 
319     wxCoord y = NO_INIT
320   CODE:
321     if( items == 2 )
322       y = x;
323     else
324       y = SvIV( ST(2) );
325     THIS->Inflate( x, y );
326
327 wxRect*
328 wxRect::Intersect( rect )
329     wxRect* rect
330   CODE:
331     RETVAL = new wxRect( THIS->Intersect( *rect ) );
332   OUTPUT: RETVAL
333
334 bool
335 wxRect::Intersects( wxRect* rec )
336   CODE:
337     RETVAL = THIS->Intersects( *rec );
338   OUTPUT: RETVAL
339
340 void
341 wxRect::SetHeight( height )
342     int height
343
344 void
345 wxRect::SetWidth( width )
346     int width
347
348 void
349 wxRect::SetX( x )
350     int x
351
352 void
353 wxRect::SetY( y )
354    int y
355
356 void
357 wxRect::SetPosition( pos )
358     wxPoint pos
359
360 void
361 wxRect::SetSize( size )
362     wxSize size
363     
364 void
365 wxRect::Offset( x, y )
366     wxCoord x
367     wxCoord y
368  CODE:
369    THIS->Offset( x, y);
370
371 void
372 wxRect::Contains( ... )
373   PPCODE:
374     BEGIN_OVERLOAD()
375         MATCH_REDISP( wxPliOvl_n_n, ContainsXY )
376         MATCH_REDISP( wxPliOvl_wpoi, ContainsPoint )
377         MATCH_REDISP( wxPliOvl_wrec, ContainsRect )
378     END_OVERLOAD( Wx::Rect::Contains )
379
380 void
381 wxRect::Inside( ... )
382   PPCODE:
383     BEGIN_OVERLOAD()
384         MATCH_REDISP( wxPliOvl_n_n, ContainsXY )
385         MATCH_REDISP( wxPliOvl_wpoi, ContainsPoint )
386 #if WXPERL_W_VERSION_GE( 2, 7, 0 )
387         MATCH_REDISP( wxPliOvl_wrec, ContainsRect )
388 #endif
389     END_OVERLOAD( Wx::Rect::Inside )
390
391 bool
392 wxRect::ContainsXY( int x, int y )
393   CODE:
394 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
395     RETVAL = THIS->Contains( x, y );
396 #else
397     RETVAL = THIS->Inside( x, y );
398 #endif
399   OUTPUT: RETVAL
400
401 bool
402 wxRect::ContainsPoint( wxPoint pt )
403   CODE:
404 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
405     RETVAL = THIS->Contains( pt );
406 #else
407     RETVAL = THIS->Inside( pt );
408 #endif
409   OUTPUT: RETVAL
410
411 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
412
413 bool
414 wxRect::ContainsRect( wxRect* rec )
415   CODE:
416     RETVAL = THIS->Contains( *rec );
417   OUTPUT: RETVAL
418
419 wxRect*
420 wxRect::CentreIn ( wxRect* rec, int dir = wxBOTH )
421   CODE:
422     RETVAL = new wxRect( THIS->CentreIn( *rec, dir ) );
423   OUTPUT:
424     RETVAL
425     
426 #endif
427
428 MODULE=Wx PACKAGE=Wx::Region
429
430 wxRegion*
431 newEmpty( CLASS )
432     SV* CLASS
433   CODE:
434     RETVAL = new wxRegion();
435   OUTPUT:
436     RETVAL
437
438 wxRegion*
439 newXYWH( CLASS, x, y, width, height )
440     SV* CLASS
441     wxCoord x
442     wxCoord y
443     wxCoord width
444     wxCoord height
445   CODE:
446     RETVAL = new wxRegion( x, y, width, height );
447   OUTPUT:
448     RETVAL
449
450 wxRegion*
451 newPP( CLASS, topLeft, bottomRight )
452     SV* CLASS
453     wxPoint topLeft
454     wxPoint bottomRight
455   CODE:
456     RETVAL = new wxRegion( topLeft, bottomRight );
457   OUTPUT:
458     RETVAL
459
460 wxRegion*
461 newRect( CLASS, rect )
462     SV* CLASS
463     wxRect* rect
464   CODE:
465     RETVAL = new wxRegion( *rect );
466   OUTPUT:
467     RETVAL
468
469 #if !defined( __WXMAC__ ) && !defined( __WXMOTIF__ )
470
471 wxRegion*
472 newPolygon( CLASS, list, fillStyle = wxODDEVEN_RULE )
473     SV* CLASS
474     SV* list
475     wxPolygonFillMode fillStyle
476   PREINIT:
477     wxPoint* points;
478     size_t n;
479   CODE:
480     n = wxPli_av_2_pointarray( aTHX_ list, &points );
481     RETVAL = new wxRegion( n, points, fillStyle );
482     delete [] points;
483   OUTPUT: RETVAL
484
485 #endif
486
487 #if !defined( __WXOSX_COCOA__ )
488
489 wxRegion*
490 newBitmap( CLASS, bitmap, colour, tolerance = 0 )
491     SV* CLASS
492     wxBitmap* bitmap
493     wxColour colour
494     int tolerance
495   CODE: 
496     RETVAL = new wxRegion( *bitmap, colour, tolerance );
497   OUTPUT: RETVAL
498
499 wxRegion*
500 newBitmapOnly( CLASS, bitmap )
501     SV* CLASS
502     wxBitmap* bitmap
503   CODE:
504     RETVAL = new wxRegion( *bitmap );
505   OUTPUT: RETVAL
506
507 #endif
508
509 void
510 wxRegion::new( ... )
511   PPCODE:
512     BEGIN_OVERLOAD()
513         MATCH_VOIDM_REDISP( newEmpty )
514         MATCH_REDISP( wxPliOvl_n_n_n_n, newXYWH )
515         MATCH_REDISP( wxPliOvl_wpoi_wpoi, newPP )
516         MATCH_REDISP( wxPliOvl_wrec, newRect )
517         MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_wbmp_wcol_n, newBitmap, 2 )
518         MATCH_REDISP( wxPliOvl_wbmp, newBitmapOnly )
519         MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_arr, newPolygon, 1 )
520     END_OVERLOAD( Wx::Region::new )
521
522 static void
523 wxRegion::CLONE()
524   CODE:
525     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
526
527 ## // thread OK
528 void
529 wxRegion::DESTROY()
530   CODE:
531     wxPli_thread_sv_unregister( aTHX_ "Wx::Region", THIS, ST(0) );
532     delete THIS;
533
534 void
535 wxRegion::Clear()
536
537 wxRegionContain
538 wxRegion::ContainsXY( x, y )
539     wxCoord x
540     wxCoord y
541   CODE:
542     RETVAL = THIS->Contains( x, y );
543   OUTPUT:
544     RETVAL
545
546 wxRegionContain
547 wxRegion::ContainsPoint( point )
548     wxPoint point
549   CODE:
550     RETVAL = THIS->Contains( point );
551   OUTPUT:
552     RETVAL
553
554 wxRegionContain
555 wxRegion::ContainsXYWH( x, y, w, h )
556     wxCoord x
557     wxCoord y
558     wxCoord w
559     wxCoord h
560   CODE:
561     RETVAL = THIS->Contains( x, y, w, h );
562   OUTPUT:
563     RETVAL
564
565 wxRegionContain
566 wxRegion::ContainsRect( rect )
567     wxRect* rect
568   CODE:
569     RETVAL = THIS->Contains( *rect );
570   OUTPUT:
571     RETVAL
572
573 void
574 wxRegion::Contains( ... )
575   PPCODE:
576     BEGIN_OVERLOAD()
577         MATCH_REDISP( wxPliOvl_n_n_n_n, ContainsXYWH )
578         MATCH_REDISP( wxPliOvl_n_n, ContainsXY )
579         MATCH_REDISP( wxPliOvl_wpoi, ContainsPoint )
580         MATCH_REDISP( wxPliOvl_wrec, ContainsRect )
581     END_OVERLOAD( Wx::Region::Contains )
582
583 wxBitmap*
584 wxRegion::ConvertToBitmap()
585   CODE:
586     RETVAL = new wxBitmap( THIS->ConvertToBitmap() );
587   OUTPUT: RETVAL
588
589 wxRect*
590 wxRegion::GetBox()
591   CODE:
592     RETVAL = new wxRect( THIS->GetBox() );
593   OUTPUT:
594     RETVAL
595
596 void
597 wxRegion::GetBoxXYWH()
598   PREINIT:
599     int x;
600     int y;
601     int w;
602     int h;
603   PPCODE:
604     THIS->GetBox( x, y, w, h );
605     EXTEND( SP, 4 );
606     PUSHs( sv_2mortal( newSViv( (IV) x ) ) );
607     PUSHs( sv_2mortal( newSViv( (IV) y ) ) );
608     PUSHs( sv_2mortal( newSViv( (IV) w ) ) );
609     PUSHs( sv_2mortal( newSViv( (IV) h ) ) );
610
611 bool
612 wxRegion::IntersectXYWH( x, y, w, h )
613     wxCoord x
614     wxCoord y
615     wxCoord w
616     wxCoord h
617   CODE:
618     RETVAL = THIS->Intersect( x, y, w, h );
619   OUTPUT:
620     RETVAL
621
622 bool
623 wxRegion::IntersectRect( rect )
624     wxRect* rect
625   CODE:
626     RETVAL = THIS->Intersect( *rect );
627   OUTPUT:
628     RETVAL
629
630 bool
631 wxRegion::IntersectRegion( region )
632     wxRegion* region
633   CODE:
634     RETVAL = THIS->Intersect( *region );
635   OUTPUT:
636     RETVAL
637
638 void
639 wxRegion::Intersect( ... )
640   PPCODE:
641     BEGIN_OVERLOAD()
642         MATCH_REDISP( wxPliOvl_n_n_n_n, IntersectXYWH )
643         MATCH_REDISP( wxPliOvl_wrec, IntersectRect )
644         MATCH_REDISP( wxPliOvl_wreg, IntersectRegion )
645     END_OVERLOAD( Wx::Region::Intersect )
646
647 bool
648 wxRegion::IsEmpty()
649
650 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
651
652 bool
653 wxRegion::IsEqual( region )
654     wxRegion* region
655   C_ARGS: *region
656
657 #endif
658
659 bool
660 wxRegion::SubtractRect( rect )
661     wxRect* rect
662   CODE:
663     RETVAL = THIS->Subtract( *rect );
664   OUTPUT:
665     RETVAL
666
667 #if !defined(__WXMOTIF__) && !defined(__WXMAC__)
668
669 bool
670 wxRegion::Offset( x, y )
671     wxCoord x
672     wxCoord y
673
674 #endif
675
676 bool
677 wxRegion::SubtractRegion( region )
678     wxRegion* region
679   CODE:
680     RETVAL = THIS->Subtract( *region );
681   OUTPUT:
682     RETVAL
683
684 void
685 wxRegion::Subtract( ... )
686   PPCODE:
687     BEGIN_OVERLOAD()
688         MATCH_REDISP( wxPliOvl_wrec, SubtractRect )
689         MATCH_REDISP( wxPliOvl_wreg, SubtractRegion )
690     END_OVERLOAD( Wx::Region::Subtract )
691
692 bool
693 wxRegion::UnionXYWH( x, y, w, h )
694     wxCoord x
695     wxCoord y
696     wxCoord w
697     wxCoord h
698   CODE:
699     RETVAL = THIS->Union( x, y, w, h );
700   OUTPUT: RETVAL
701
702 bool
703 wxRegion::UnionRect( rect )
704     wxRect* rect
705   CODE:
706     RETVAL = THIS->Union( *rect );
707   OUTPUT: RETVAL
708
709 bool
710 wxRegion::UnionRegion( region )
711     wxRegion* region
712   CODE:
713     RETVAL = THIS->Union( *region );
714   OUTPUT: RETVAL
715
716 bool
717 wxRegion::UnionBitmapOnly( bitmap )
718     wxBitmap* bitmap
719   CODE:
720     RETVAL = THIS->Union( *bitmap );
721   OUTPUT: RETVAL
722
723 bool
724 wxRegion::UnionBitmap( bitmap, colour, tolerance = 0 )
725     wxBitmap* bitmap
726     wxColour colour
727     int tolerance
728   CODE:
729     RETVAL = THIS->Union( *bitmap, colour, tolerance );
730   OUTPUT: RETVAL
731
732 void
733 wxRegion::Union( ... )
734   PPCODE:
735     BEGIN_OVERLOAD()
736         MATCH_REDISP( wxPliOvl_n_n_n_n, UnionXYWH )
737         MATCH_REDISP( wxPliOvl_wrec, UnionRect )
738         MATCH_REDISP( wxPliOvl_wreg, UnionRegion )
739         MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_wbmp_wcol_n, UnionBitmap, 2 )
740         MATCH_REDISP( wxPliOvl_wbmp, UnionBitmapOnly )
741     END_OVERLOAD( Wx::Region::Union )
742
743 bool
744 wxRegion::XorXYWH( x, y, w, h )
745     wxCoord x
746     wxCoord y
747     wxCoord w
748     wxCoord h
749   CODE:
750     RETVAL = THIS->Xor( x, y, w, h );
751   OUTPUT:
752     RETVAL
753
754 bool
755 wxRegion::XorRect( rect )
756     wxRect* rect
757   CODE:
758     RETVAL = THIS->Xor( *rect );
759   OUTPUT:
760     RETVAL
761
762 bool
763 wxRegion::XorRegion( region )
764     wxRegion* region
765   CODE:
766     RETVAL = THIS->Xor( *region );
767   OUTPUT:
768     RETVAL
769
770 void
771 wxRegion::Xor( ... )
772   PPCODE:
773     BEGIN_OVERLOAD()
774         MATCH_REDISP( wxPliOvl_n_n_n_n, XorXYWH )
775         MATCH_REDISP( wxPliOvl_wrec, XorRect )
776         MATCH_REDISP( wxPliOvl_wreg, XorRegion )
777     END_OVERLOAD( Wx::Region::Xor )
778
779 MODULE=Wx PACKAGE=Wx::Position
780
781 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
782
783 #include <wx/position.h>
784
785 wxPosition*
786 wxPosition::new( row = 0, column = 0 )
787     int row
788     int column
789
790 static void
791 wxPosition::CLONE()
792   CODE:
793     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
794
795 ## // thread OK
796 void
797 wxPosition::DESTROY()
798   CODE:
799     wxPli_thread_sv_unregister( aTHX_ "Wx::Position", THIS, ST(0) );
800     delete THIS;
801
802 int
803 wxPosition::row( ... )
804   CODE:
805     if( items > 1 )
806       THIS->SetRow( SvIV( ST(1) ) );
807     RETVAL = THIS->GetRow();
808   OUTPUT:
809     RETVAL
810
811 int
812 wxPosition::col( ... )
813   CODE:
814     if( items > 1 )
815       THIS->SetCol( SvIV( ST(1) ) );
816     RETVAL = THIS->GetCol();
817   OUTPUT:
818     RETVAL
819
820 int
821 wxPosition::column( ... )
822   CODE:
823     if( items > 1 )
824       THIS->SetColumn( SvIV( ST(1) ) );
825     RETVAL = THIS->GetColumn();
826   OUTPUT:
827     RETVAL
828
829 int
830 wxPosition::GetRow()
831
832 int
833 wxPosition::GetCol()
834
835 int
836 wxPosition::GetColumn()
837
838 void
839 wxPosition::SetRow( height )
840     int height
841
842 void
843 wxPosition::SetCol( width )
844     int width
845
846 void
847 wxPosition::SetColumn( width )
848     int width
849
850 #endif