Esempio n. 1
0
void
Window_cancel_children( Handle self)
{
   protect_object( self);
   if ( my-> get_modalHorizon( self)) {
      Handle next = var-> nextSharedModal;
      while ( next) {
         CWindow( next)-> cancel( next);
         next = var-> nextSharedModal;
      }
   } else {
      Handle mh   = my-> get_horizon( self);
      Handle next = ( mh == application) ?
                  PApplication(mh)-> sharedModal :
                  PWindow(mh)-> nextSharedModal;
      while ( next) {
         if ( Widget_is_child( next, self)) {
            CWindow( next)-> cancel( next);
            next = PWindow(mh)-> nextSharedModal;
         } else
            next = PWindow(next)-> nextSharedModal;
      }
   }
   unprotect_object( self);
}
Esempio n. 2
0
void
Application_done( Handle self)
{
   if ( self != application) return;
   unprotect_object( var-> hintTimer);
   unprotect_object( var-> hintWidget);
   list_destroy( &var->  modalHorizons);
   list_destroy( &var->  widgets);
   free( var-> text);
   free( var-> hint);
   free( var-> helpContext);
   var-> accelTable = var-> hintWidget = var-> hintTimer = nilHandle;
   var-> text = var->  hint = var-> helpContext = nil;
   apc_application_destroy( self);
   CDrawable-> done( self);
   application = nilHandle;
}
Esempio n. 3
0
int
Window_execute( Handle self, Handle insertBefore)
{
   if ( var-> modal)
      return mbCancel;

   protect_object( self);
   if ( insertBefore
	&& ( insertBefore == self
	     || !kind_of( insertBefore, CWindow)
	     || PWindow( insertBefore)-> modal != mtExclusive))
      insertBefore = nilHandle;
   if ( !apc_window_execute( self, insertBefore))
      var-> modalResult = mbCancel;

   unprotect_object( self);
   return var-> modalResult;
}
Esempio n. 4
0
void
AbstractMenu_dispose_menu( Handle self, void * menu)
{
	PMenuItemReg m = ( PMenuItemReg) menu;
	if  ( m == nil) return;
	free( m-> text);
	free( m-> accel);
	free( m-> variable);
	free( m-> perlSub);
	if ( m-> code) sv_free( m-> code);
	if ( m-> data) sv_free( m-> data);
	if ( m-> bitmap) {
		if ( PObject( m-> bitmap)-> stage < csDead)
			SvREFCNT_dec( SvRV(( PObject( m-> bitmap))-> mate)); 
		unprotect_object( m-> bitmap);
	}
	my-> dispose_menu( self, m-> next);
	my-> dispose_menu( self, m-> down);
	free( m);
}
Esempio n. 5
0
Handle
AbstractMenu_image( Handle self, Bool set, char * varName, Handle image)
{
	PMenuItemReg m;
	PImage i = ( PImage) image;

	if ( var-> stage > csFrozen) return nilHandle;

	m = find_menuitem( self, varName, true);
	if ( m == nil) return nilHandle;
	if ( !m-> bitmap) return nilHandle;
	if ( !set) { 
		if ( PObject( m-> bitmap)-> stage == csDead) return nilHandle;
		return m-> bitmap;
	}

	if (( image == nilHandle) || !( kind_of( image, CImage))) {
		warn("invalid object passed to ::image");
		return nilHandle;
	}
	if ( i-> w == 0 || i-> h == 0) {
		warn("invalid object passed to ::image");
		return nilHandle;
	}

	SvREFCNT_inc( SvRV(( PObject( image))-> mate));
	protect_object( image);
	if ( PObject( m-> bitmap)-> stage < csDead) 
		SvREFCNT_dec( SvRV(( PObject( m-> bitmap))-> mate));
	unprotect_object( m-> bitmap);
	m-> bitmap = image;
	if ( m-> id > 0)
		if ( var-> stage <= csNormal && var-> system)
			apc_menu_item_set_image( self, m);
	return nilHandle;
}