SV * Widget_accelItems( Handle self, Bool set, SV * accelItems) { dPROFILE; enter_method; if ( var-> stage > csFrozen) return nilSV; if ( !set) return var-> accelTable ? CAbstractMenu( var-> accelTable)-> get_items( var-> accelTable, "") : nilSV; if ( var-> accelTable == nilHandle) { HV * profile = newHV(); if ( SvTYPE( accelItems)) pset_sv( items, accelItems); pset_H ( owner, self); my-> set_accelTable( self, create_instance( "Prima::AccelTable")); sv_free(( SV *) profile); } else CAbstractMenu( var-> accelTable)-> set_items( var-> accelTable, accelItems); return nilSV; }
static Handle xdup( Handle self, char * className) { Handle h; PDrawable i; HV * profile = newHV(); Point s; pset_H( owner, var-> owner); pset_i( width, var-> w); pset_i( height, var-> h); pset_i( type, var-> monochrome ? imMono : imRGB); h = Object_create( className, profile); sv_free(( SV *) profile); i = ( PDrawable) h; s = i-> self-> get_size( h); i-> self-> begin_paint( h); i-> self-> put_image_indirect( h, self, 0, 0, 0, 0, s.x, s.y, s.x, s.y, ropCopyPut); i-> self-> end_paint( h); --SvREFCNT( SvRV( i-> mate)); return h; }
SV * Window_menuItems( Handle self, Bool set, SV * menuItems) { dPROFILE; if ( var-> stage > csFrozen) return nilSV; if ( !set) return var-> menu ? CMenu( var-> menu)-> get_items( var-> menu, "") : nilSV; if ( var-> menu == nilHandle) { if ( SvTYPE( menuItems)) { HV * profile = newHV(); pset_sv( items, menuItems); pset_H ( owner, self); pset_i ( selected, false); my-> set_menu( self, create_instance( "Prima::Menu")); sv_free(( SV *) profile); } } else CMenu( var-> menu)-> set_items( var-> menu, menuItems); return menuItems; }
SV * Widget_popupItems( Handle self, Bool set, SV * popupItems) { dPROFILE; enter_method; if ( var-> stage > csFrozen) return nilSV; if ( !set) return var-> popupMenu ? CAbstractMenu( var-> popupMenu)-> get_items( var-> popupMenu, "") : nilSV; if ( var-> popupMenu == nilHandle) { if ( SvTYPE( popupItems)) { HV * profile = newHV(); pset_sv( items, popupItems); pset_H ( owner, self); my-> set_popup( self, create_instance( "Prima::Popup")); sv_free(( SV *) profile); } } else CAbstractMenu( var-> popupMenu)-> set_items( var-> popupMenu, popupItems); return popupItems; }
void Application_init( Handle self, HV * profile) { dPROFILE; int hintPause = pget_i( hintPause); Color hintColor = pget_i( hintColor), hintBackColor = pget_i( hintBackColor); SV * hintFont = pget_sv( hintFont); SV * sv; char * hintClass = pget_c( hintClass); if ( application != nilHandle) croak( "Attempt to create more than one application instance"); CDrawable-> init( self, profile); list_create( &var-> widgets, 16, 16); list_create( &var-> modalHorizons, 0, 8); application = self; if ( !apc_application_create( self)) croak( "Error creating application"); /* Widget init */ SvHV_Font( pget_sv( font), &Font_buffer, "Application::init"); my-> set_font( self, Font_buffer); SvHV_Font( pget_sv( popupFont), &Font_buffer, "Application::init"); my-> set_popup_font( self, Font_buffer); { AV * av = ( AV *) SvRV( pget_sv( designScale)); SV ** holder = av_fetch( av, 0, 0); if ( holder) var-> designScale. x = SvNV( *holder); else warn("Array panic on 'designScale'"); holder = av_fetch( av, 1, 0); if ( holder) var-> designScale. y = SvNV( *holder); else warn("Array panic on 'designScale'"); pdelete( designScale); } var-> text = duplicate_string(""); opt_set( optModalHorizon); /* store extra info */ { HV * hv = ( HV *) SvRV( var-> mate); (void) hv_store( hv, "PrinterClass", 12, newSVpv( pget_c( printerClass), 0), 0); (void) hv_store( hv, "PrinterModule", 13, newSVpv( pget_c( printerModule), 0), 0); (void) hv_store( hv, "HelpClass", 9, newSVpv( pget_c( helpClass), 0), 0); (void) hv_store( hv, "HelpModule", 10, newSVpv( pget_c( helpModule), 0), 0); } { HV * profile = newHV(); static Timer_vmt HintTimerVmt; pset_H( owner, self); pset_i( timeout, hintPause); pset_c( name, "HintTimer"); var-> hintTimer = create_instance( "Prima::Timer"); protect_object( var-> hintTimer); hv_clear( profile); memcpy( &HintTimerVmt, CTimer, sizeof( HintTimerVmt)); HintTimerVmt. handle_event = Application_HintTimer_handle_event; (( PTimer) var-> hintTimer)-> self = &HintTimerVmt; pset_H( owner, self); pset_i( color, hintColor); pset_i( backColor, hintBackColor); pset_i( visible, 0); pset_i( selectable, 0); pset_i( showHint, 0); pset_c( name, "HintWidget"); pset_sv( font, hintFont); var-> hintWidget = create_instance( hintClass); protect_object( var-> hintWidget); sv_free(( SV *) profile); } if ( SvTYPE( sv = pget_sv( accelItems)) != SVt_NULL) my-> set_accelItems( self, sv); if ( SvTYPE( sv = pget_sv( popupItems)) != SVt_NULL) my-> set_popupItems( self, sv); pdelete( accelTable); pdelete( accelItems); pdelete( popupItems); my-> set( self, profile); CORE_INIT_TRANSIENT(Application); }