1 #############################################################################
3 ## Purpose: XS for Wx::Menu, Wx::MenuBar, Wx::MenuItem
4 ## Author: Mattia Barbon
7 ## RCS-ID: $Id: Menu.xs 2315 2008-01-18 21:47:17Z mbarbon $
8 ## Copyright: (c) 2000-2004, 2006-2008 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 #############################################################################
15 MODULE=Wx PACKAGE=Wx::Menu
18 wxMenu::new( title = wxEmptyString, style = 0)
22 #if WXPERL_W_VERSION_GE( 2, 7, 0 )
25 wxMenu::AppendSubMenu( submenu, text, help = wxEmptyString )
33 wxMenu::AppendString( id, item = wxEmptyString, help = wxEmptyString, kind = wxITEM_NORMAL )
39 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
40 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
41 THIS->Append( id, item, help, kind ) ) );
43 THIS->Append( id, item, help, kind );
47 wxMenu::AppendSubMenu_( id, item, subMenu, helpString = wxEmptyString )
53 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
54 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
55 THIS->Append( id, item, subMenu, helpString ) ) );
57 THIS->Append( id, item, subMenu, helpString );
61 wxMenu::AppendItem( menuItem )
64 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
65 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
66 THIS->Append( menuItem ) ) );
68 THIS->Append( menuItem );
72 wxMenu::AppendCheckItem( id, item, helpString = wxEmptyString )
77 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
78 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
79 THIS->AppendCheckItem( id, item, helpString ) ) );
81 THIS->AppendCheckItem( id, item, helpString );
85 wxMenu::AppendRadioItem( id, item, helpString = wxEmptyString )
90 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
91 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
92 THIS->AppendRadioItem( id, item, helpString ) ) );
94 THIS->AppendRadioItem( id, item, helpString );
98 wxMenu::AppendSeparator()
100 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
101 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
102 THIS->AppendSeparator() ) );
104 THIS->AppendSeparator();
111 wxMenu::Check( id, check )
116 wxMenu::DeleteId( id )
122 wxMenu::DeleteItem( item )
125 THIS->Delete( item );
128 wxMenu::DestroyMenu()
133 wxMenu::DestroyId( id )
139 wxMenu::DestroyItem( item )
142 THIS->Destroy( item );
145 wxMenu::Enable( id, enable )
149 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
152 wxMenu::FindItemByPosition( pos )
158 wxMenu::FindItem( item )
161 if( looks_like_number( item ) ) {
162 int id = SvIV( item );
166 ret = THIS->FindItem( id, &submenu );
168 SV* mi = sv_newmortal();
170 if( GIMME_V == G_ARRAY ) {
172 SV* sm = sv_newmortal();
174 PUSHs( wxPli_object_2_sv( aTHX_ mi, ret ) );
175 PUSHs( wxPli_object_2_sv( aTHX_ sm, submenu ) );
179 PUSHs( wxPli_object_2_sv( aTHX_ mi, ret ) );
184 WXSTRING_INPUT( string, const char*, item );
185 int id = THIS->FindItem( string );
188 PUSHs( sv_2mortal( newSViv( id ) ) );
192 wxMenu::GetHelpString( id )
196 wxMenu::GetLabel( id )
199 #if WXPERL_W_VERSION_GE( 2, 8, 5 )
202 wxMenu::GetLabelText( id )
208 wxMenu::GetMenuItemCount()
211 wxMenu::GetMenuItems()
213 wxMenuItemList& data = THIS->GetMenuItems();
214 wxMenuItemList::compatibility_iterator node;
216 EXTEND( SP, (IV) data.GetCount() );
217 for( node = data.GetFirst(); node; node = node->GetNext() )
219 PUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(), node->GetData() ) );
226 wxMenu::InsertItem( pos, item )
230 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
231 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
232 THIS->Insert( pos, item ) ) );
234 XPUSHs( THIS->Insert( pos, item ) ? &PL_sv_yes : &PL_sv_no );
238 wxMenu::InsertString( pos, id, item = wxEmptyString, helpString = wxEmptyString, kind = wxITEM_NORMAL )
245 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
246 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
247 THIS->Insert( pos, id, item, helpString, kind ) ) );
249 THIS->Insert( pos, id, item, helpString, kind );
253 wxMenu::InsertSubMenu( pos, id, text, submenu, help = wxEmptyString )
260 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
261 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
262 THIS->Insert( pos, id, text, submenu, help ) ) );
264 THIS->Insert( pos, id, text, submenu, help );
268 wxMenu::InsertCheckItem( pos, id, item, helpString )
274 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
275 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
276 THIS->InsertCheckItem( pos, id, item, helpString ) ) );
278 THIS->InsertCheckItem( pos, id, item, helpString );
282 wxMenu::InsertRadioItem( pos, id, item, helpString )
288 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
289 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
290 THIS->InsertRadioItem( pos, id, item, helpString ) ) );
292 THIS->InsertRadioItem( pos, id, item, helpString );
296 wxMenu::InsertSeparator( pos )
299 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
300 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
301 THIS->InsertSeparator( pos ) ) );
303 THIS->InsertSeparator( pos );
307 wxMenu::IsChecked( id )
311 wxMenu::IsEnabled( id )
315 wxMenu::PrependString( id, item = wxEmptyString, help = wxEmptyString, kind = wxITEM_NORMAL )
321 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
322 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
323 THIS->Prepend( id, item, help, kind ) ) );
325 THIS->Prepend( id, item, help, kind );
329 wxMenu::PrependItem( menuItem )
332 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
333 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
334 THIS->Prepend( menuItem ) ) );
336 THIS->Prepend( menuItem );
340 wxMenu::PrependSubMenu( id, item, subMenu, helpString = wxEmptyString )
346 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
347 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
348 THIS->Prepend( id, item, subMenu, helpString ) ) );
350 THIS->Prepend( id, item, subMenu, helpString );
354 wxMenu::PrependCheckItem( id, item, helpString = wxEmptyString )
359 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
360 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
361 THIS->PrependCheckItem( id, item, helpString ) ) );
363 THIS->PrependCheckItem( id, item, helpString );
367 wxMenu::PrependRadioItem( id, item, helpString = wxEmptyString )
372 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
373 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
374 THIS->PrependRadioItem( id, item, helpString ) ) );
376 THIS->PrependRadioItem( id, item, helpString );
380 wxMenu::PrependSeparator()
382 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
383 XPUSHs( wxPli_object_2_sv( aTHX_ sv_newmortal(),
384 THIS->PrependSeparator() ) );
386 THIS->PrependSeparator();
390 wxMenu::RemoveId( id )
393 RETVAL = THIS->Remove( id );
398 wxMenu::RemoveItem( item )
401 RETVAL = THIS->Remove( item );
406 wxMenu::SetHelpString( id, helpString )
411 wxMenu::SetLabel( id, label )
416 wxMenu::SetTitle( title )
420 wxMenu::UpdateUI( source = 0 )
423 MODULE=Wx PACKAGE=Wx::MenuBar
426 wxMenuBar::new( style = 0 )
430 wxMenuBar::Append( menu, title )
435 wxMenuBar::Check( id, check )
440 wxMenuBar::Enable( id, enable )
445 wxMenuBar::EnableTop( pos, enable )
450 wxMenuBar::FindItem( id )
456 ret = THIS->FindItem( id, &submenu );
458 SV* mi = sv_newmortal();
460 if( GIMME_V == G_ARRAY ) {
462 SV* sm = sv_newmortal();
464 PUSHs( wxPli_object_2_sv( aTHX_ mi, ret ) );
465 PUSHs( wxPli_object_2_sv( aTHX_ sm, submenu ) );
469 PUSHs( wxPli_object_2_sv( aTHX_ mi, ret ) );
473 wxMenuBar::FindMenu( title )
477 wxMenuBar::FindMenuItem( menuString, itemString )
482 wxMenuBar::GetHelpString( id )
486 wxMenuBar::GetLabel( id )
489 #if !WXPERL_W_VERSION_GE( 2, 9, 0 ) || WXWIN_COMPATIBILITY_2_8
492 wxMenuBar::GetLabelTop( id )
497 #if WXPERL_W_VERSION_GE( 2, 8, 5 )
500 wxMenuBar::GetMenuLabel( id )
504 wxMenuBar::GetMenuLabelText( id )
510 wxMenuBar::GetMenu( index )
514 wxMenuBar::GetMenuCount()
517 wxMenuBar::Insert( pos, menu, title )
523 wxMenuBar::IsChecked( id )
527 wxMenuBar::IsEnabled( id )
534 wxMenuBar::Remove( pos )
538 wxMenuBar::Replace( pos, menu, title )
544 wxMenuBar::SetHelpString( id, helpString )
549 wxMenuBar::SetLabel( id, label )
553 #if !WXPERL_W_VERSION_GE( 2, 9, 0 ) || WXWIN_COMPATIBILITY_2_8
556 wxMenuBar::SetLabelTop( pos, label )
562 #if WXPERL_W_VERSION_GE( 2, 8, 5 )
565 wxMenuBar::SetMenuLabel( pos, label )
572 wxMenuBar::IsEnabledTop( id )
575 MODULE=Wx PACKAGE=Wx::MenuItem
578 wxMenuItem::new( parentMenu = 0, id = wxID_ANY, text = wxEmptyString, helpString = wxEmptyString, itemType = wxITEM_NORMAL, subMenu = 0 )
587 wxMenuItem::Check( check )
591 # wxMenuItem::DeleteSubMenu()
594 wxMenuItem::Enable( enable )
597 #if defined( __WXMSW__ ) && !defined( __WXWINCE__ )
600 wxMenuItem::GetBackgroundColour()
602 RETVAL = new wxColour( THIS->GetBackgroundColour() );
607 wxMenuItem::GetFont()
609 RETVAL = new wxFont( THIS->GetFont() );
615 #if ( defined( __WXMSW__ ) && !defined( __WXWINCE__ ) ) || \
619 wxMenuItem::GetBitmap()
621 RETVAL = new wxBitmap( THIS->GetBitmap() );
628 wxMenuItem::GetHelp()
630 #if WXPERL_W_VERSION_LT( 2, 9, 0 ) && !defined(__WXMSW__)
633 wxMenuItem::GetName()
641 wxMenuItem::GetKind()
643 #if !WXPERL_W_VERSION_GE( 2, 9, 0 ) || WXWIN_COMPATIBILITY_2_8
646 wxMenuItem::GetLabel()
649 GetLabelFromText( text )
652 RETVAL = wxMenuItem::GetLabelFromText( text );
658 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
661 wxMenuItem::GetItemLabel()
664 wxMenuItem::GetItemLabelText()
670 RETVAL = wxMenuItem::GetLabelText( text );
677 wxMenuItem::GetMenu()
679 #if defined( __WXMSW__ ) && !defined( __WXWINCE__ )
682 wxMenuItem::GetMarginWidth()
686 #if !WXPERL_W_VERSION_GE( 2, 9, 0 ) || WXWIN_COMPATIBILITY_2_8
689 wxMenuItem::GetText()
694 wxMenuItem::GetSubMenu()
696 #if defined( __WXMSW__ ) && !defined( __WXWINCE__ )
699 wxMenuItem::GetTextColour()
701 RETVAL = new wxColour( THIS->GetTextColour() );
708 wxMenuItem::IsCheckable()
711 wxMenuItem::IsChecked()
714 wxMenuItem::IsEnabled()
717 wxMenuItem::IsSeparator()
720 wxMenuItem::IsSubMenu()
722 #if defined( __WXMSW__ ) && !defined( __WXWINCE__ )
725 wxMenuItem::SetBackgroundColour( colour )
728 THIS->SetBackgroundColour( *colour );
731 wxMenuItem::SetFont( font )
734 THIS->SetFont( *font );
739 wxMenuItem::SetHelp( helpString )
743 wxMenuItem::SetMenu( menu )
747 wxMenuItem::SetSubMenu( menu )
750 #if !WXPERL_W_VERSION_GE( 2, 9, 0 ) || WXWIN_COMPATIBILITY_2_8
753 wxMenuItem::SetText( text )
758 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
761 wxMenuItem::SetItemLabel( label )
766 #if defined( __WXMSW__ ) && !defined( __WXWINCE__ )
769 wxMenuItem::SetMarginWidth( width )
773 # wxMenuItem::SetName( text )
777 wxMenuItem::SetTextColour( colour )
780 THIS->SetTextColour( *colour );
783 wxMenuItem::SetBitmaps( checked, unchecked = (wxBitmap*)&wxNullBitmap )
787 THIS->SetBitmaps( *checked, *unchecked );
791 #if ( defined( __WXMSW__ ) && !defined( __WXWINCE__ ) ) || \
795 wxMenuItem::SetBitmap( bitmap )
798 THIS->SetBitmap( *bitmap );