popup menu on drop?



Is there some reason I can't popup a menu when I
get drag_data_recevied. I want to popup a menu to
ask when the user drops on a branch in a tree to
ask the user where the data should go. It could either
be inserted into the branch at the end or prepended
in front of the branch.

The menu pops up, but it only draws about 4 pixels.

Any clue?

thanks,
Todd.

basic psuedocode ( gtk-- )

void
CTreeView::drag_data_received ( GdkDragContext     *context_in,
				gint                x_in,
				gint                y_in,
				GtkSelectionData   *selection_data_in,
				guint               info_in,
				guint32             time_in ) 
{

...
    if ( branch )
	{
	  insert_ask_append_prepend ( time_in, view, position, *pmipl );
	}
      else
	{
	  parent_view -> insert_items ( position, *pmipl );
	}
...
}

void
CTreeView::insert_ask_append_prepend ( guint32 time_in,
				       View   *view_in, 
				       int     position_in, 
				       ViewPL &pmipl_in )
{
  _ask_menu_active = true;

#define IFC ItemFactoryConnector

  AskItemFactoryData * if_data = new AskItemFactoryData;

  delete _ask_menu . release ();
  delete _ask_menu_factory;
  
  _ask_menu_factory = new Gtk_ItemFactory_Menu ( "<Main>" );

  if_data -> view = view_in;
  if_data -> position = position_in;
  if_data -> pmipl = pmipl_in;

  _ask_menu_factory ->
    create_item ( "prepend" , "", "<Item>",
		  IFC < CTreeView, AskItemFactoryData *  > 
		  ( this, &( CTreeView::insert_ask_menu_prepend ), if_data ) );
  
  _ask_menu_factory ->
    create_item ( "append" , "", "<Item>",
		  IFC < CTreeView, AskItemFactoryData * > 
		  ( this, &( CTreeView::insert_ask_menu_append ), if_data ) );
  
  _ask_menu . set_object ( _ask_menu_factory -> get_menu_widget ( "" ) .
release () );
  _ask_menu . set_owned ( true );
  _ask_menu -> popup ( 0, 0, 3, time_in );

}

-- 
   | Todd Dukes                      E-MAIL:  tdukes@ibmoto.com |
   | Motorola Somerset                  Phone:   (512) 424-8008 |
   | 6200 Bridgepoint Parkway Building #4 MS OE70               |
   | Austin, Texas 78730                                        |



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]