Esempio n. 1
0
//////////////////////////////////////////////////////////////////////////
//
// XFE_TaskBar Private Methods
//
//////////////////////////////////////////////////////////////////////////
void
XFE_TaskBar::setIconGroupForCommand(CommandType cmd, IconGroup *icons)
{
	Widget *	children;
	Cardinal	num_children;
	Cardinal	i;
  
	XfeChildrenGet(m_widget,&children,&num_children);

	for (i = 0; i < num_children; i ++)
    {
		if (XfeIsButton(children[i]))
		{
			if (Command::intern(XtName(children[i])) == cmd)
			{
				XFE_Button * button = 
					(XFE_Button *) XfeInstancePointer(children[i]);
				
				XP_ASSERT(button);

				if (!button) return;
				
				button->setPixmap(icons);
				
				return;
			}
		}
    }

	XP_ASSERT(0); // command not found in the taskbar...
}
Esempio n. 2
0
/*----------------------------------------------------------------------*/
/* extern */ void
XfeChildrenRemoveEventHandler(Widget			w,
							  EventMask			event_mask,
							  Boolean			nonmaskable,
							  XtEventHandler	proc,
							  XtPointer			data)
{
	Widget *		children;
	Cardinal		num_children;
	Cardinal		i;

    assert( _XfeIsAlive(w) );
    assert( XtIsComposite(w) );

	XfeChildrenGet(w,&children,&num_children);

	for (i = 0; i < num_children; i++)
	{
		if (_XfeIsAlive(w))
		{
			XtRemoveEventHandler(children[i],event_mask,nonmaskable,proc,data);
		}

		XtRemoveEventHandler(children[i],event_mask,nonmaskable,proc,data);
	}
}
Esempio n. 3
0
/*----------------------------------------------------------------------*/
/* extern */ void
XfeChildrenRemoveCallback(Widget			w,
						  String			callback_name,
						  XtCallbackProc	callback,
						  XtPointer			data)
{
	Widget *		children;
	Cardinal		num_children;
	Cardinal		i;

    assert( _XfeIsAlive(w) );
    assert( XtIsComposite(w) );

	XfeChildrenGet(w,&children,&num_children);

	for (i = 0; i < num_children; i++)
	{
		assert( _XfeIsAlive(children[i]) );

		XtRemoveCallback(children[i],callback_name,callback,data);
	}
}
Esempio n. 4
0
/* virtual */ void
XFE_BookmarkMenu::reallyUpdateRoot()
{
 	WidgetList		children;
 	Cardinal		numChildren;
 	BM_Entry *		root = getMenuFolder();

	// Ignore the root header (ie, "Joe's Bookmarks")
	if (root && BM_IsHeader(root))
	{
		root = BM_GetChildren(root);
	}

 	XfeChildrenGet(_subMenu,&children,&numChildren);	
	
	//  XtUnrealizeWidget(m_subMenu);

 	// Get rid of the previous items we created
 	if (children && numChildren)
	{
 		children += _firstSlot;

 		numChildren -= _firstSlot;

 		if (children && numChildren)
		{
 			XtUnmanageChildren(children,numChildren);
      
 			fe_DestroyWidgetTree(children,numChildren);
		}
	}

 	// Create the entries if any
 	if (root)
 	{
 		createItemTree(_subMenu,root);
 	}
}
Esempio n. 5
0
void
XFE_BookmarkMenu::setFixedItemSensitive(XP_Bool state)
{
 	WidgetList		children;
 	Cardinal		numChildren;

 	XfeChildrenGet(_subMenu,&children,&numChildren);	
	
 	// Make sure some fixed items exist
 	if (children && numChildren && _firstSlot && (_firstSlot < numChildren))
	{
		Cardinal i;

		// Set the sensitivity state for all the fixed push button items
		for (i = 0; i < _firstSlot; i++)
		{
			if (IS_PUSH(children[i]) || IS_CASCADE(children[i]))
			{
				XtSetSensitive(children[i],state);
			}
		}
	}
}
void
XFE_FrameListMenu::cascading()
{
	XP_List *	frame_list = getShownFrames();

	XFE_Frame *	frame;
	int			i;
	int			frame_count = XP_ListCount(frame_list);

	Cardinal	num_children;
	WidgetList	children;

	int			total_slots_needed;
	int			slots_to_add;
	int			count;

	XfeChildrenGet(m_submenu,&children,&num_children);

	XP_ASSERT( num_children > 1 );

	// Total number of slots needed
	total_slots_needed = m_firstslot + 1 + frame_count;

	// Number of slots to add
	slots_to_add = total_slots_needed - num_children;

	// Add more slots if needed
	if (slots_to_add > 0)
	{
		for (i = 0; i < slots_to_add; i++)
		{
			Widget item = XtVaCreateWidget(xfeCmdFrameListRaiseItem,
										   //xmToggleButtonGadgetClass,
										   xmPushButtonGadgetClass,
										   m_submenu,
										   NULL);

			XtAddCallback(item,
						  XmNactivateCallback,
						  //XmNvalueChangedCallback,
						  &XFE_FrameListMenu::item_activate_cb,
						  (XtPointer) this);
		}

		// Update num_slots, since we added stuff
		XfeChildrenGet(m_submenu,&children,&num_children);
	}

	count = 1;

	// Configure the items
	for (i = (int) m_firstslot + 1; i < (int) num_children; i++)
	{
		// Get the next frame
		frame = (XFE_Frame*) XP_ListNextObject(frame_list);

		// If the frame is valid, add its title to the slot buttons
		if (frame)
		{
			MWContext *			context = m_parentFrame->getContext();
			INTL_CharSetInfo	c = LO_GetDocumentCharacterSetInfo(context);
			XmFontList			font_list;
			char				name[1024];

			XP_SPRINTF(name,"%d. %s",count++,frame->getTitle());

			INTL_MidTruncateString(INTL_GetCSIWinCSID(c), 
								   name, 
								   name,
								   MAX_ITEM_WIDTH);

			XmString label = fe_ConvertToXmString((unsigned char *) name,
												  INTL_GetCSIWinCSID(c), 
												  NULL, 
												  XmFONT_IS_FONT,
												  &font_list);

			if (label)
			{
				XtVaSetValues(children[i],XmNlabelString,label,NULL);

				XmStringFree(label);
			}

			XtManageChild(children[i]);
		}
		// If the frame is not valid, the unmanage the slot button
		else
		{
			XtUnmanageChild(children[i]);
		}
	}

	// Update the display so that the gadget buttons get drawn
	XmUpdateDisplay(m_submenu);

	if (frame_list)
	{
		XP_ListDestroy(frame_list);
	}
}