1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: XS for Wx::Window
4 // Author: Mattia Barbon
7 // RCS-ID: $Id: Window.xs 2700 2009-12-13 11:25:50Z mbarbon $
8 // Copyright: (c) 2000-2002, 2004-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 /////////////////////////////////////////////////////////////////////////////
13 #define PERL_NO_GET_CONTEXT
15 #include "cpp/wxapi.h"
17 #include <wx/window.h>
18 #include <wx/layout.h>
21 #include "cpp/overload.h"
23 #if wxPERL_USE_TOOLTIPS
24 #include <wx/tooltip.h>
29 #include "cpp/v_cback.h"
30 #include "cpp/window.h"
32 WXPLI_BOOT_ONCE(Wx_Win);
33 #define boot_Wx_Win wxPli_boot_Wx_Win
35 MODULE=Wx_Win PACKAGE=Wx PREFIX=wx
42 ::wxGetMousePosition( &x, &y );
43 RETVAL = new wxPoint( x, y );
48 wxGetMousePositionXY()
52 ::wxGetMousePosition( &x, &y );
54 PUSHs( newSViv( x ) );
55 PUSHs( newSViv( y ) );
58 wxGetTopLevelParent( window )
62 wxFindWindowAtPointer( pt )
68 MODULE=Wx_Win PACKAGE=Wx::Window
74 RETVAL = wxWindowBase::NewControlId();
77 #if WXPERL_W_VERSION_LT( 2, 9, 0 )
80 NextControlId( winid )
83 RETVAL = wxWindowBase::NextControlId( winid );
87 PrevControlId( winid )
90 RETVAL = wxWindowBase::PrevControlId( winid );
99 MATCH_VOIDM_REDISP( newDefault )
100 MATCH_ANY_REDISP( newFull )
101 END_OVERLOAD( "Wx::Window::new" )
107 RETVAL = new wxPliWindow( CLASS );
111 newFull( CLASS, parent, id = wxID_ANY, pos = wxDefaultPosition, size = wxDefaultSize, style = 0 , name = wxPanelNameStr )
120 RETVAL = new wxPliWindow( CLASS, parent, id, pos, size, style, name );
124 wxWindow::Create( parent, id = wxID_ANY, pos = wxDefaultPosition, size = wxDefaultSize, style = 0 , name = wxPanelNameStr)
133 wxWindow::CaptureMouse()
138 wxWindow::Centre( direction = wxBOTH )
144 wxWindow::CentreOnParent( direction = wxBOTH )
147 #if WXPERL_W_VERSION_GE( 2, 7, 0 )
152 wxWindow::CentreOnScreen( direction = wxBOTH )
155 THIS->Centre( direction | wxCENTER_ON_SCREEN );
160 wxWindow::CentreOnScreen( direction = wxBOTH )
165 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
168 wxWindow::ClearBackground()
178 wxWindow::ClientToScreen( ... )
181 MATCH_REDISP( wxPliOvl_n_n, ClientToScreenXY )
182 MATCH_REDISP( wxPliOvl_wpoi, ClientToScreenPoint )
183 END_OVERLOAD( Wx::Window::ClientToScreen )
186 wxWindow::ClientToScreenPoint( point )
189 RETVAL = new wxPoint( THIS->ClientToScreen( point ) );
194 wxWindow::ClientToScreenXY( x, y )
198 THIS->ClientToScreen( &x, &y );
200 PUSHs( sv_2mortal( newSViv( x ) ) );
201 PUSHs( sv_2mortal( newSViv( y ) ) );
204 wxWindow::Close( force = false )
208 wxWindow::ConvertDialogToPixels( ... )
211 MATCH_REDISP( wxPliOvl_wpoi, ConvertDialogPointToPixels )
212 MATCH_REDISP( wxPliOvl_wsiz, ConvertDialogSizeToPixels )
213 END_OVERLOAD( Wx::Window::ConvertDialogToPixels )
216 wxWindow::ConvertDialogPointToPixels( point )
219 RETVAL = new wxPoint( THIS->ConvertDialogToPixels( point ) );
224 wxWindow::ConvertDialogSizeToPixels( size )
227 RETVAL = new wxSize( THIS->ConvertDialogToPixels( size ) );
232 wxWindow::ConvertPixelsToDialog( ... )
235 MATCH_REDISP( wxPliOvl_wpoi, ConvertPixelsPointToDialog )
236 MATCH_REDISP( wxPliOvl_wsiz, ConvertPixelsSizeToDialog )
237 END_OVERLOAD( Wx::Window::ConvertPixelsToDialog )
240 wxWindow::ConvertPixelsPointToDialog( point )
243 RETVAL = new wxPoint( THIS->ConvertPixelsToDialog( point ) );
248 wxWindow::ConvertPixelsSizeToDialog( size )
251 RETVAL = new wxSize( THIS->ConvertPixelsToDialog( size ) );
258 #if defined( __WXMSW__ ) \
259 || ( WXPERL_W_VERSION_GE( 2, 9, 0 ) && !defined( __WXGTK__ ) )
262 wxWindow::DragAcceptFiles( accept )
268 wxWindow::Enable( enable = true )
277 RETVAL = wxWindow::FindFocus();
282 wxWindow::FindWindow( i )
285 if( looks_like_number( i ) ) {
287 RETVAL = THIS->FindWindow( id );
291 WXSTRING_INPUT( name, const char*, i );
292 RETVAL = THIS->FindWindow( name );
298 FindWindowById( id, parent = NULL )
302 RETVAL = wxWindow::FindWindowById( id, parent );
307 FindWindowByName( id, parent = NULL )
311 RETVAL = wxWindow::FindWindowByName( id, parent );
316 FindWindowByLabel( id, parent = NULL )
320 RETVAL = wxWindow::FindWindowByLabel( id, parent );
329 wxWindow::FitInside()
334 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
342 wxWindow::GetAcceleratorTable()
344 RETVAL = new wxAcceleratorTable( *THIS->GetAcceleratorTable() );
347 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
350 wxWindow::GetBackgroundStyle()
355 wxWindow::GetBackgroundColour()
357 RETVAL = new wxColour( THIS->GetBackgroundColour() );
362 wxWindow::GetBestSize()
364 RETVAL = new wxSize( THIS->GetBestSize() );
372 wxWindow::GetCharHeight()
375 wxWindow::GetCharWidth()
378 wxWindow::GetChildren()
380 const wxWindowList& list = THIS->GetChildren();
381 wxWindowList::compatibility_iterator node;
383 EXTEND( SP, (IV) list.GetCount() );
385 for( node = list.GetFirst(); node; node = node->GetNext() )
386 PUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(), node->GetData() ) );
389 wxWindow::GetClientSize()
391 RETVAL = new wxSize( THIS->GetClientSize() );
396 wxWindow::GetClientSizeXY()
401 THIS->GetClientSize( &x, &y );
403 PUSHs( sv_2mortal( newSViv( x ) ) );
404 PUSHs( sv_2mortal( newSViv( y ) ) );
407 wxWindow::GetContainingSizer()
409 #if wxPERL_USE_DRAG_AND_DROP
412 wxWindow::GetDropTarget()
414 wxPli_object_set_deleteable( aTHX_ ST(0), false );
418 #if WXPERL_W_VERSION_LT( 2, 7, 0 )
421 wxWindow::GetDefaultItem()
426 wxWindow::GetEventHandler()
429 wxWindow::GetExtraStyle()
434 RETVAL = new wxFont( THIS->GetFont() );
439 wxWindow::GetForegroundColour()
441 RETVAL = new wxColour( THIS->GetForegroundColour() );
446 wxWindow::GetGrandParent()
448 #if defined( __WXMSW__ )
451 wxWindow::CreateWindowFromHWND( parent, hWnd )
454 C_ARGS: parent, (WXHWND) hWnd
458 #if ( WXPERL_W_VERSION_GE( 2, 5, 1 ) && defined( __WXMSW__ ) ) \
459 || WXPERL_W_VERSION_GE( 2, 5, 4 )
462 wxWindow::GetHandle()
467 wxWindow::GetHandle()
470 WXHWND handle = THIS->GetHandle();
473 WXWidget handle = THIS->GetHandle();
474 RETVAL = PTR2IV(handle);
482 wxWindow::GetHelpText()
491 wxWindow::GetConstraints()
493 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
496 wxWindow::GetMinSize()
498 RETVAL = new wxSize( THIS->GetMinSize() );
503 wxWindow::GetMaxSize()
505 RETVAL = new wxSize( THIS->GetMaxSize() );
515 wxWindow::GetParent()
518 wxWindow::GetPosition()
520 RETVAL = new wxPoint( THIS->GetPosition() );
525 wxWindow::GetPositionXY()
530 THIS->GetPosition( &x, &y );
532 PUSHs( sv_2mortal( newSViv( (IV) x ) ) );
533 PUSHs( sv_2mortal( newSViv( (IV) y ) ) );
538 RETVAL = new wxRect( THIS->GetRect() );
543 wxWindow::GetScrollThumb( orientation )
547 wxWindow::GetScrollPos( orientation )
551 wxWindow::GetScrollRange( orientation )
557 RETVAL = new wxSize( THIS->GetSize() );
565 wxWindow::GetSizeWH()
570 THIS->GetSize( &x, &y );
572 PUSHs( sv_2mortal( newSViv( (IV) x ) ) );
573 PUSHs( sv_2mortal( newSViv( (IV) y ) ) );
576 wxWindow::GetTextExtent( string, font = 0 )
585 THIS->GetTextExtent( string, &x, &y, &descent, &externalLeading,
588 PUSHs( sv_2mortal( newSViv( x ) ) );
589 PUSHs( sv_2mortal( newSViv( y ) ) );
590 PUSHs( sv_2mortal( newSViv( descent ) ) );
591 PUSHs( sv_2mortal( newSViv( externalLeading ) ) );
593 #if WXPERL_W_VERSION_GE( 2, 7, 0 )
598 RETVAL = THIS->GetLabel();
608 #if wxPERL_USE_TOOLTIPS
611 wxWindow::GetToolTip()
616 wxWindow::GetUpdateRegion()
618 RETVAL = new wxRegion( THIS->GetUpdateRegion() );
623 wxWindow::GetValidator()
626 wxWindow::GetWindowStyleFlag()
628 #if WXPERL_W_VERSION_GE( 2, 8, 0 )
631 wxWindow::GetWindowBorderSize()
635 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
638 wxWindow::InvalidateBestSize()
641 wxWindow::InheritAttributes()
646 wxWindow::IsEnabled()
648 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
651 wxWindow::IsThisEnabled()
656 wxWindow::IsExposed( ... )
659 MATCH_REDISP( wxPliOvl_wpoi, IsExposedPoint )
660 MATCH_REDISP( wxPliOvl_wrec, IsExposedRect )
661 MATCH_REDISP( wxPliOvl_n_n_n_n, IsExposedXYWH )
662 END_OVERLOAD( Wx::Window::IsExposed )
665 wxWindow::IsExposedXYWH( x, y, w = 0, h = 0 )
671 RETVAL = THIS->IsExposed( x, y, w, h );
676 wxWindow::IsExposedPoint( point )
679 RETVAL = THIS->IsExposed( point );
684 wxWindow::IsExposedRect( rect )
687 RETVAL = THIS->IsExposed( *rect );
692 wxWindow::IsRetained()
698 wxWindow::IsTopLevel()
700 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
703 wxWindow::IsDoubleBuffered()
706 wxWindow::IsShownOnScreen()
717 wxWindow::MakeModal( flag )
721 wxWindow::Move( ... )
724 MATCH_REDISP( wxPliOvl_wpoi, MovePoint )
725 MATCH_REDISP( wxPliOvl_n_n, MoveXY )
726 END_OVERLOAD( Wx::Window::Move )
729 wxWindow::MoveXY( x, y )
736 wxWindow::MovePoint( point )
741 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
744 wxWindow::MoveBeforeInTabOrder( window )
748 wxWindow::MoveAfterInTabOrder( window )
753 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
755 # wxNavigateBackward, wxNavigateForward, wxNavigateWinChange, wxNavigateFromTab
757 wxWindow::NavigateIn( flags = wxNavigationKeyEvent::IsForward )
761 wxWindow::Navigate( flags = wxNavigationKeyEvent::IsForward )
767 wxWindow::PopEventHandler( deleteHandler )
771 wxWindow::PopupMenu( ... )
774 MATCH_REDISP( wxPliOvl_wmen_wpoi, PopupMenuPoint )
775 MATCH_REDISP( wxPliOvl_wmen_n_n, PopupMenuXY )
776 END_OVERLOAD( Wx::Window::PopupMenu )
779 wxWindow::PopupMenuPoint( menu, point )
783 RETVAL = THIS->PopupMenu( menu, point );
788 wxWindow::PopupMenuXY( menu, x, y )
793 RETVAL = THIS->PopupMenu( menu, x, y );
798 wxWindow::PushEventHandler( handler )
799 wxEvtHandler* handler
805 wxWindow::Refresh( eraseBackground = true, rect = 0 )
810 wxWindow::ReleaseMouse()
813 wxWindow::RemoveEventHandler( handler )
814 wxEvtHandler* handler
817 wxWindow::Reparent( newParent )
821 wxWindow::ScreenToClient( ... )
824 MATCH_REDISP( wxPliOvl_n_n, ScreenToClientXY )
825 MATCH_REDISP( wxPliOvl_wpoi, ScreenToClientPoint )
826 END_OVERLOAD( Wx::Window::ScreenToClient )
829 wxWindow::ScreenToClientPoint( point )
832 RETVAL = new wxPoint( THIS->ScreenToClient( point ) );
837 wxWindow::ScreenToClientXY( x, y )
841 THIS->ScreenToClient( &x, &y );
843 PUSHs( sv_2mortal( newSViv( (IV) x ) ) );
844 PUSHs( sv_2mortal( newSViv( (IV) y ) ) );
847 wxWindow::ScrollLines( lines )
851 wxWindow::ScrollPages( lines )
855 wxWindow::ScrollWindow( x, y, rect = 0 )
861 wxWindow::SetAcceleratorTable( accel )
862 wxAcceleratorTable* accel
866 wxWindow::SetAutoLayout( autoLayout )
872 wxWindow::SetThemeEnabled( themeEnabled )
877 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
880 wxWindow::SetBackgroundStyle( style )
881 wxBackgroundStyle style
885 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
888 wxWindow::SetBestFittingSize( size = wxDefaultSize )
891 #if WXPERL_W_VERSION_LT( 2, 7, 2 )
892 THIS->SetBestFittingSize( size );
894 THIS->SetInitialSize( size );
899 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
902 wxWindow::SetInitialSize( size = wxDefaultSize )
908 wxWindow::SetCaret( caret )
912 wxWindow::SetClientSize( ... )
915 MATCH_REDISP( wxPliOvl_wsiz, SetClientSizeSize )
916 MATCH_REDISP( wxPliOvl_n_n, SetClientSizeWH )
917 END_OVERLOAD( Wx::Window::SetClientSize )
920 wxWindow::SetClientSizeSize( size )
923 THIS->SetClientSize( size );
926 wxWindow::SetClientSizeWH( width, height )
930 THIS->SetClientSize( width, height );
933 wxWindow::SetConstraints( constraints )
934 wxLayoutConstraints* constraints
937 wxWindow::SetContainingSizer( sizer )
940 #if WXPERL_W_VERSION_LT( 2, 7, 0 )
943 wxWindow::SetDefaultItem( window )
948 #if wxPERL_USE_DRAG_AND_DROP
951 wxWindow::SetDropTarget( target )
954 wxPli_object_set_deleteable( aTHX_ ST(1), false );
955 SvREFCNT_inc( SvRV( ST(1) ) ); // at this point the scalar must not go away
956 THIS->SetDropTarget( target );
961 wxWindow::SetEventHandler( handler )
962 wxEvtHandler* handler
965 wxWindow::SetExtraStyle( style )
972 wxWindow::SetHelpText( text )
975 #if WXPERL_W_VERSION_LT( 2, 9, 0 ) || WXWIN_COMPATIBILITY_2_8
978 wxWindow::SetHelpTextForId( text )
984 wxWindow::SetId( id )
988 wxWindow::SetLabel( label )
992 wxWindow::SetName( name )
996 wxWindow::SetScrollbar( orientation, position, thumbSize, range, refresh = true )
1004 wxWindow::SetScrollPos( orientation, position, refresh = true )
1009 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
1012 wxWindow::SetMinSize( size )
1016 wxWindow::SetMaxSize( size )
1022 wxWindow::SetSize( ... )
1025 MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_n_n_n_n_n, SetSizeXYWHF, 4 )
1026 MATCH_REDISP( wxPliOvl_n_n, SetSizeWH )
1027 MATCH_REDISP( wxPliOvl_wsiz, SetSizeSize )
1028 MATCH_REDISP( wxPliOvl_wrec, SetSizeRect )
1029 END_OVERLOAD( Wx::Window::SetSize )
1032 wxWindow::SetSizeSize( size )
1035 THIS->SetSize( size );
1038 wxWindow::SetSizeRect( rect )
1041 THIS->SetSize( *rect );
1044 wxWindow::SetSizeWH( width, height )
1048 THIS->SetSize( width, height );
1051 wxWindow::SetSizeXYWHF( x, y, width, height, flags = wxSIZE_AUTO )
1058 THIS->SetSize( x, y, width, height, flags );
1061 wxWindow::SetSizeHints( minW, minH, maxW = -1, maxH = -1, incW = -1, incH = -1 )
1069 #if WXPERL_W_VERSION_LT( 2, 9, 0 )
1072 wxWindow::SetVirtualSizeHints( minW, minH, maxW = -1, maxH = -1 )
1081 wxWindow::SetVirtualSize( ... )
1084 MATCH_REDISP( wxPliOvl_n_n, SetVirtualSizeXY )
1085 MATCH_REDISP( wxPliOvl_wsiz, SetVirtualSizeSize )
1086 END_OVERLOAD( Wx::Window::SetVirtualSize )
1089 wxWindow::SetVirtualSizeXY( width, height )
1093 THIS->SetVirtualSize( width, height );
1096 wxWindow::SetVirtualSizeSize( size )
1099 THIS->SetVirtualSize( size );
1102 wxWindow::SetSizer( sizer, deleteOld = true )
1107 wxWindow::SetSizerAndFit( sizer, deleteOld = true )
1111 #if WXPERL_W_VERSION_GE( 2, 7, 0 )
1114 wxWindow::SetTitle( title )
1117 THIS->SetLabel( title );
1122 wxWindow::SetTitle( title )
1127 #if wxPERL_USE_TOOLTIPS
1130 wxWindow::SetToolTip( ... )
1133 MATCH_REDISP( wxPliOvl_wtip, SetToolTipTip )
1134 MATCH_REDISP( wxPliOvl_s, SetToolTipString )
1135 END_OVERLOAD( Wx::Window::SetToolTip )
1138 wxWindow::SetToolTipTip( tooltip )
1141 THIS->SetToolTip( tooltip );
1145 #if wxPERL_USE_TOOLTIPS || WXPERL_W_VERSION_GE( 2, 5, 3 )
1148 wxWindow::SetToolTipString( string )
1151 THIS->SetToolTip( string );
1156 wxWindow::SetValidator( validator )
1157 wxValidator* validator
1159 THIS->SetValidator( *validator );
1162 wxWindow::SetWindowStyle( style )
1166 wxWindow::SetWindowStyleFlag( style )
1169 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
1172 wxWindow::ShouldInheritColours()
1177 wxWindow::Show( show = true )
1180 #if WXPERL_W_VERSION_GE( 2, 7, 0 )
1183 wxWindow::HasMultiplePages()
1194 wxWindow::TransferDataFromWindow()
1196 RETVAL = THIS->wxWindow::TransferDataFromWindow();
1201 wxWindow::TransferDataToWindow()
1203 RETVAL = THIS->wxWindow::TransferDataToWindow();
1208 wxWindow::Validate()
1210 RETVAL = THIS->wxWindow::Validate();
1217 #if WXPERL_W_VERSION_GE( 2, 6, 0 )
1220 wxWindow::UpdateWindowUI( flags = wxUPDATE_UI_NONE )
1226 wxWindow::RefreshRect( rect )
1229 THIS->RefreshRect( *rect );
1232 wxWindow::WarpPointer( x, y )
1236 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
1239 wxWindow::GetLayoutDirection()
1242 wxWindow::SetLayoutDirection( direction )
1243 wxLayoutDirection direction
1246 wxWindow::SetTransparent( alpha )
1250 wxWindow::CanSetTransparent()
1254 INCLUDE: perl -MExtUtils::XSpp::Cmd -e xspp -- -t typemap.xsp XS/Window.xsp |
1256 INCLUDE: XS/Accelerators.xs
1258 INCLUDE: perl -MExtUtils::XSpp::Cmd -e xspp -- -t typemap.xsp XS/PlWindow.xsp |
1260 INCLUDE: perl -MExtUtils::XSpp::Cmd -e xspp -- -t typemap.xsp XS/SplitterWindow.xs |
1262 INCLUDE: perl -MExtUtils::XSpp::Cmd -e xspp -- -t typemap.xsp XS/VScrolledWindow.xsp |
1264 INCLUDE: XS/ScrolledWindow.xs
1265 INCLUDE: XS/Validators.xs
1266 INCLUDE: XS/Constraint.xs
1268 INCLUDE: perl -MExtUtils::XSpp::Cmd -e xspp -- -t typemap.xsp XS/Sizer.xs |
1270 INCLUDE: perl -MExtUtils::XSpp::Cmd -e xspp -- -t typemap.xsp XS/GridBagSizer.xsp |
1272 INCLUDE: XS/SashWindow.xs
1274 MODULE=Wx_Win PACKAGE=Wx::Window