Ejemplo n.º 1
0
XFE_ToolboxItem *
XFE_Toolbox::firstOpenAndManagedItem()
{
	XP_ASSERT( XfeIsAlive(m_widget) );

	Cardinal	num_items = getNumItems();
	Cardinal	i;

	// Make sure toolbox has items
	if (!num_items)
	{
		return NULL;
	}

	for (i = 0; i < num_items; i++)
	{
		Widget item = XfeToolBoxItemGetByIndex(m_widget,i);

		if (XfeIsAlive(item) && XtIsManaged(item) &&
			XfeToolBoxItemGetOpen(m_widget,item))
		{
			return (XFE_ToolboxItem *) XfeUserData(item);
		}
	}

	return NULL;
}
Ejemplo n.º 2
0
void
XFE_Toolbox::setItemOpen(Widget item,XP_Bool open)
{
	XP_ASSERT( XfeIsAlive(m_widget) );
	XP_ASSERT( XfeIsAlive(item) );

	XfeToolBoxItemSetOpen(m_widget,item,open);
}
Ejemplo n.º 3
0
Widget
XFE_Toolbox::tabOfItem(Widget item,XP_Bool opened)
{
	XP_ASSERT( XfeIsAlive(m_widget) );
	XP_ASSERT( XfeIsAlive(item) );

	return XfeToolBoxItemGetTab(m_widget,item,(Boolean) opened);
}
Ejemplo n.º 4
0
XP_Bool
XFE_Toolbox::stateOfItem(Widget item)
{
	XP_ASSERT( XfeIsAlive(m_widget) );
	XP_ASSERT( XfeIsAlive(item) );

	return (XP_Bool) XfeToolBoxItemGetOpen(m_widget,item);
}
Ejemplo n.º 5
0
void
XFE_Toolbox::setItemPosition(Widget item,int position)
{
	XP_ASSERT( XfeIsAlive(m_widget) );
	XP_ASSERT( XfeIsAlive(item) );

	XfeToolBoxItemSetPosition(m_widget,item,position);
}
Ejemplo n.º 6
0
int
XFE_Toolbox::positionOfItem(Widget item)
{
	XP_ASSERT( XfeIsAlive(m_widget) );
	XP_ASSERT( XfeIsAlive(item) );

//	return XfeToolBoxItemGetPosition(m_widget,item);
	return XfeToolBoxItemGetIndex(m_widget,item);
}
Ejemplo n.º 7
0
XFE_ToolboxItem *	
XFE_Toolbox::getItemAtIndex(Cardinal index)
{
	XP_ASSERT( XfeIsAlive(m_widget) );
	XP_ASSERT( index < getNumItems() );

	XP_ASSERT( XfeIsAlive(m_widget) );

	Widget item = XfeToolBoxItemGetByIndex(m_widget,index);

	XP_ASSERT( XfeIsAlive(item) );

	return (XFE_ToolboxItem *) XfeUserData(item);
}
Ejemplo n.º 8
0
XFE_CALLBACK_DEFN(XFE_TaskBar, updateFloatingBusyState)
	(XFE_NotificationCenter *	/* obj */,
	 void *						clientData,
	 void *						/* callData */)
{
	XP_Bool busy = (XP_Bool) (int) clientData;

	Widget floatingShell = XfeAncestorFindByClass(m_widget,
												  shellWidgetClass,
												  XfeFIND_ANY);

	// Dont update busy state if not realized/alive or undocked
	if (!XfeIsAlive(floatingShell) || 
		!XtIsRealized(floatingShell) ||
		XFE_Dashboard::isTaskBarDocked())
	{
		return;
	}

	if (busy)
	{
		MWContext *	context = m_parentFrame->getContext();
		Cursor		cursor = CONTEXT_DATA(context)->busy_cursor;

		XDefineCursor(XtDisplay(floatingShell),
					  XtWindow(floatingShell),
					  cursor);
	}
	else
	{
		XUndefineCursor(XtDisplay(floatingShell),XtWindow(floatingShell));
	}
}
Ejemplo n.º 9
0
void
XFE_TaskBar::createFloatingWidgets(Widget parent)
{
	XP_ASSERT( XfeIsAlive(parent) );

	unsigned char	orientation = 
		fe_globalPrefs.task_bar_horizontal ? XmHORIZONTAL : XmVERTICAL;
	
	// Create the floating task bar
	m_widget = XtVaCreateWidget(FLOATING_TASK_BAR_NAME,
								xfeTaskBarWidgetClass,
								parent,
								XmNorientation,			orientation,
								XmNusePreferredWidth,	True,
								XmNusePreferredHeight,	True,
								NULL);

	// Create floating buttons
	createButtons(m_floatingSpec);

	// Show both label and pixmap for floating tools
	XtVaSetValues(m_widget,XmNbuttonLayout,XmBUTTON_LABEL_ON_BOTTOM,NULL);

	// Update the floating appearance for the first time
	updateFloatingAppearance();
 
	// Update the icons layout when needed
    XFE_MozillaApp::theApp()->registerInterest(
		XFE_MozillaApp::updateToolbarAppearance,
		this,
		(XFE_FunctionNotification)updateIconAppearance_cb);
}
Ejemplo n.º 10
0
void
XFE_Toolbox::removeDragDescendant(Widget descendant)
{
	XP_ASSERT( XfeIsAlive(m_widget) );

	XfeToolBoxRemoveDragDescendant(m_widget,descendant);
}
Ejemplo n.º 11
0
void 
XFE_TaskBar::createButtons(TaskBarSpec * spec)
{
	XP_ASSERT( XfeIsAlive(m_widget) );
	
	if (!spec)
	{
		return;
	}

	TaskBarSpec *cur_spec = spec;
	
	while (cur_spec->taskBarButtonName)
	{
		// Create the button only if it is not disabled through resources.
  		if (XfeChildIsEnabled(m_widget,
							  (String) cur_spec->taskBarButtonName,
							  "TaskBarButton",
							  True))
  		{
			createTaskBarButton(cur_spec);
  		}

		cur_spec++;
	}
}
Ejemplo n.º 12
0
void
XFE_FrameListMenu::item_activate(Widget item)
{
	XP_ASSERT( XfeIsAlive(m_submenu) );

	int i = XfeChildGetIndex(item) - m_firstslot;

	XP_ASSERT( i > 0 );

	if (i <= 0)
	{
		return;
	}

	XP_List * frame_list = getShownFrames();
	
	XFE_Frame * frame = (XFE_Frame *) XP_ListGetObjectNum(frame_list,i);
	
	XP_ASSERT( frame != NULL );
	
	if (frame)
	{
		frame->show();
	}

	XmUpdateDisplay(frame->getBaseWidget());

	if (frame_list)
	{
		XP_ListDestroy(frame_list);
	}
}
Ejemplo n.º 13
0
XP_List *
XFE_FrameListMenu::getShownFrames()
{
	XP_List *	frame_list = XFE_MozillaApp::theApp()->getAllFrameList();
	Cardinal	frame_count = XP_ListCount(frame_list);

	XP_List *	shown_frame_list = NULL;
	Cardinal	i;

	// Find the shown frames and add them to a list
	for (i = 0; i < frame_count; i++)
	{
		// Get the next frame
		XFE_Frame * frame = (XFE_Frame*) XP_ListNextObject(frame_list);

		// Add it to list if valid and shown
		if (frame && XfeIsAlive(frame->getBaseWidget()) && frame->isShown())
		{
			// Create a new list as soon as we find the first shown item
			if (!shown_frame_list)
			{
				shown_frame_list = XP_ListNew();
			}

			XP_ListAddObject(shown_frame_list,frame);
		}
	}

	return shown_frame_list;
}
Ejemplo n.º 14
0
void
XFE_Toolbox::toggleItemState(Widget item)
{
	XP_ASSERT( XfeIsAlive(m_widget) );

	XfeToolBoxItemToggleOpen(m_widget,item);
}
Ejemplo n.º 15
0
//
// Returns True if the toolbox is needed.  The toolbox is only needed if 
// at least 1 item is managed or 1 tab is managed.
//
//////////////////////////////////////////////////////////////////////////
XP_Bool
XFE_Toolbox::isNeeded()
{
	XP_ASSERT( XfeIsAlive(m_widget) );

	return XfeToolBoxIsNeeded(m_widget);
}
Ejemplo n.º 16
0
//////////////////////////////////////////////////////////////////////////
//
// Item methods
//
//////////////////////////////////////////////////////////////////////////
Cardinal
XFE_Toolbox::getNumItems()
{
	XP_ASSERT( XfeIsAlive(m_widget) );

	Cardinal		item_count;

	XtVaGetValues(m_widget,XmNitemCount,&item_count,NULL);

	return item_count;
}
Ejemplo n.º 17
0
WidgetList
XFE_Toolbox::getItems()
{
	XP_ASSERT( XfeIsAlive(m_widget) );

	WidgetList		items;
	
	XtVaGetValues(m_widget,XmNitems,&items,NULL);

	return items;
}
Ejemplo n.º 18
0
void
XFE_TaskBar::updateFloatingAppearance() 
{
	XP_ASSERT( XfeIsAlive(m_widget) );
	XP_ASSERT( m_isFloating == True );

	unsigned char	button_layout;

	button_layout = XFE_Toolbar::styleToLayout(fe_globalPrefs.toolbar_style);

	XtVaSetValues(m_widget,XmNbuttonLayout,button_layout,NULL);
}
Ejemplo n.º 19
0
void
XFE_TaskBar::setFloatingTitle(const char * title)
{
	XP_ASSERT( XfeIsAlive(m_widget) );
	XP_ASSERT( m_isFloating == True );
	XP_ASSERT( m_isFloating == True );

	Widget shell_widget = XfeAncestorFindByClass(m_widget,
												 shellWidgetClass,
												 XfeFIND_ANY);

	XtVaSetValues(shell_widget,XmNtitle,title,NULL);
}
Ejemplo n.º 20
0
Cardinal
XFE_TaskBar::numEnabledButtons()
{
	if (!XfeIsAlive(m_widget))
	{
		return 0;
	}

	Cardinal num_managed = XfeChildrenGetNumManaged(m_widget);

	// Ignore the action button
	if (!m_isFloating && (num_managed > 0))
	{
		num_managed--;
	}

	return num_managed;
}
Ejemplo n.º 21
0
void
XFE_TaskBar::createDockedWidgets(Widget parent)
{
	XP_ASSERT( XfeIsAlive(parent) );

	// Create a horizontal task bar
	m_widget = XtVaCreateWidget(DOCKED_TASK_BAR_NAME,
								xfeTaskBarWidgetClass,
								parent,
								XmNorientation,			XmHORIZONTAL,
								XmNusePreferredWidth,	True,
								XmNusePreferredHeight,	True,
								NULL);

	// Floating undock image
	IconGroup_createAllIcons(&TaskSm_Handle_group,

							 XfeAncestorFindByClass(m_widget,
													shellWidgetClass,
													XfeFIND_ANY),

							 XfeForeground(m_widget),

							 XfeBackground(m_widget));

	// Create floating buttons
	createButtons(m_dockedSpec);
	
	if (XfePixmapGood(TaskSm_Handle_group.pixmap_icon.pixmap))
	{
		XtVaSetValues(m_widget,
					  XmNactionPixmap, TaskSm_Handle_group.pixmap_icon.pixmap,
					  NULL);
	}

	// If the floating taskbar does not have any enabled buttons, then 
	// we dont need to show the action button.
	XFE_TaskBar * ftb = XFE_Dashboard::getFloatingTaskBar();

	if (!ftb || !ftb->numEnabledButtons())
	{
		XtVaSetValues(m_widget,XmNshowActionButton,False,NULL);
	}
}
Ejemplo n.º 22
0
Widget
XFE_TaskBar::createTaskBarButton(TaskBarSpec *spec)
{
    Widget result = NULL;
    
    XP_ASSERT( XfeIsAlive(m_widget) );
    
    if ( (spec->taskBarButtonName == xfeCmdOpenEditor) &&
         fe_IsEditorDisabled() )
	{
		return NULL;
	}

    // Create a XFE_Button.
    XFE_Button *newButton = new XFE_Button(m_parentFrame,
										   m_widget,
                                           spec->taskBarButtonName, 
                                           spec->icons);
    
    newButton->registerInterest(XFE_Button::doCommandCallback,
								this,
								(XFE_FunctionNotification)doCommandNotice_cb);

	XtVaSetValues(newButton->getBaseWidget(),
				  XmNtraversalOn,			False,
				  XmNhighlightThickness,	0,
				  NULL);
	
	// Show the new button
	newButton->show();
	
    result = newButton->getBaseWidget();
	
    // register drop site and associated destroy callback
	// for interesting commands
    
	if (spec->taskBarButtonName == xfeCmdOpenOrBringUpBrowser
		|| spec->taskBarButtonName == xfeCmdOpenEditor 
#ifdef MOZ_MAIL_NEWS
		|| spec->taskBarButtonName == xfeCmdOpenInboxAndGetNewMessages 
		|| spec->taskBarButtonName == xfeCmdOpenNewsgroups
#endif
		) 
	{
		XFE_TaskBarDrop * dropSite = 
			new XFE_TaskBarDrop(result,spec->taskBarButtonName);

		dropSite->enable();

        XtAddCallback(result,
					  XmNdestroyCallback,
					  DropSiteDestroyCb,
					  (XtPointer)dropSite);
    }

#ifdef MOZ_MAIL_NEWS
	if (spec->taskBarButtonName == xfeCmdOpenInboxAndGetNewMessages)
	{
		XFE_MozillaApp::theApp()->registerInterest(
			XFE_MozillaApp::biffStateChanged,
			this,
			(XFE_FunctionNotification) updateBiffStateNotice_cb);
		
		// make sure we have the correct biff icon when we start.
		updateBiffStateNotice(NULL, 
							  NULL,
							  (void*) XFE_MNView::getBiffState());

		m_biffNoticeInstalled = True;
	}
#endif
        
    return result;
}
Ejemplo n.º 23
0
void
XFE_Toolbox::createMain(Widget parent)
{
	XP_ASSERT( XfeIsAlive(parent) );

	// The main frame
	m_widget = XtVaCreateWidget("toolBox",
								xfeToolBoxWidgetClass,
								parent,
								XmNusePreferredWidth,		False,
//								XmNusePreferredHeight,		True,
								XmNusePreferredHeight,		False,
								XmNheight,					200,
								NULL);

	// Create all the tab icons
	Pixel	fg = XfeForeground(m_widget);
	Pixel	bg = XfeBackground(m_widget);
	Widget	shell = XfeAncestorFindByClass(parent,
										   shellWidgetClass,
										   XfeFIND_ANY);

	IconGroup_createAllIcons(&BOTTOM_ICON,shell,fg,bg);
	IconGroup_createAllIcons(&HORIZONTAL_ICON,shell,fg,bg);
	IconGroup_createAllIcons(&LEFT_ICON,shell,fg,bg);
	IconGroup_createAllIcons(&RIGHT_ICON,shell,fg,bg);
	IconGroup_createAllIcons(&TOP_ICON,shell,fg,bg);
	IconGroup_createAllIcons(&VERTICAL_ICON,shell,fg,bg);

	XtVaSetValues(
		m_widget,
		XmNbottomPixmap,			BOTTOM_ICON.pixmap_icon.pixmap,
		XmNbottomRaisedPixmap,		BOTTOM_ICON.pixmap_mo_icon.pixmap,
		XmNtopPixmap,				TOP_ICON.pixmap_icon.pixmap,
		XmNtopRaisedPixmap,			TOP_ICON.pixmap_mo_icon.pixmap,
		XmNleftPixmap,				LEFT_ICON.pixmap_icon.pixmap,
		XmNleftRaisedPixmap,		LEFT_ICON.pixmap_mo_icon.pixmap,
		XmNrightPixmap,				RIGHT_ICON.pixmap_icon.pixmap,
		XmNrightRaisedPixmap,		RIGHT_ICON.pixmap_mo_icon.pixmap,
		XmNverticalPixmap,			VERTICAL_ICON.pixmap_icon.pixmap,
		XmNverticalRaisedPixmap, 	VERTICAL_ICON.pixmap_mo_icon.pixmap,
		XmNhorizontalPixmap,		HORIZONTAL_ICON.pixmap_icon.pixmap,
		XmNhorizontalRaisedPixmap,	HORIZONTAL_ICON.pixmap_mo_icon.pixmap,
		NULL);

#if notyet
	// Set the hand cursor
	Cursor hand_cursor = XfeCursorGetDragHand(parent);

	if (hand_cursor != None)
	{
		XtVaSetValues(m_widget,XmNdragCursor,hand_cursor,NULL);
	}
#endif

	// Add new item callback
	XtAddCallback(m_widget,
				  XmNnewItemCallback,
				  &XFE_Toolbox::newItemCallback,
				  (XtPointer) this);

	// Add swap callback
	XtAddCallback(m_widget,
				  XmNswapCallback,
				  &XFE_Toolbox::swapCallback,
				  (XtPointer) this);


	// Add snap callback
	XtAddCallback(m_widget,
				  XmNsnapCallback,
				  &XFE_Toolbox::snapCallback,
				  (XtPointer) this);

	// Add close callback
	XtAddCallback(m_widget,
				  XmNcloseCallback,
				  &XFE_Toolbox::closeCallback,
				  (XtPointer) this);

	// Add open callback
	XtAddCallback(m_widget,
				  XmNopenCallback,
				  &XFE_Toolbox::openCallback,
				  (XtPointer) this);


	installDestroyHandler();
}