Move setItemLabelString() to XFE_RDFUtils.

This commit is contained in:
ramiro%netscape.com 1998-10-12 14:36:51 +00:00
parent fc8169360f
commit 90081a01ed
5 changed files with 39 additions and 30 deletions

View File

@ -677,7 +677,7 @@ XFE_RDFMenuToolbarBase::createCascadeButton(Widget menu,
&pulldown);
// Set the item's label
setItemLabelString(cascade,entry);
XFE_RDFUtils::setItemLabelString(_frame->getContext(),cascade,entry);
// Configure the new cascade button
if (_fancyItems)
@ -774,7 +774,7 @@ XFE_RDFMenuToolbarBase::createPushButton(Widget menu, HT_Resource entry)
}
// Set the item's label
setItemLabelString(button,entry);
XFE_RDFUtils::setItemLabelString(_frame->getContext(),button,entry);
// Create a new bookmark data structure for the callbacks
data = XP_NEW_ZAP(ItemCallbackStruct);
@ -1086,31 +1086,6 @@ XFE_RDFMenuToolbarBase::getDropLastAccess()
return _dropLastAccess;
}
//////////////////////////////////////////////////////////////////////////
void
XFE_RDFMenuToolbarBase::setItemLabelString(Widget item,HT_Resource entry)
{
XP_ASSERT( XfeIsAlive(item) );
XP_ASSERT( entry != NULL );
XP_ASSERT( XmIsLabel(item) ||
XmIsLabelGadget(item) ||
XfeIsLabel(item) );
MWContext * context = _frame->getContext();
INTL_CharSetInfo charSetInfo =
LO_GetDocumentCharacterSetInfo(context);
// Create am XmString from the entry
XmString xmname = XFE_RDFUtils::entryToXmString(entry, charSetInfo);
if (xmname != NULL)
{
XtVaSetValues(item,XmNlabelString,xmname,NULL);
XmStringFree(xmname);
}
}
//////////////////////////////////////////////////////////////////////////
void
XFE_RDFMenuToolbarBase::getStyleAndLayout(HT_Resource entry, int32 * toolbar_style, unsigned char * layout)
{

View File

@ -144,7 +144,6 @@ protected:
HT_Resource getMenuFolder ();
XP_Bool getOnlyHeaders ();
void setItemLabelString (Widget menu, HT_Resource entry);
void getStyleAndLayout(HT_Resource , int32 *, unsigned char * );
// Item callbacks

View File

@ -465,7 +465,7 @@ XFE_RDFToolbar::createXfeButton(Widget parent,HT_Resource entry)
button = XfeCreateButton(parent,"bookmarkButton",av,ac);
// Set the item's label
setItemLabelString(button,entry);
XFE_RDFUtils::setItemLabelString(_frame->getContext(),button,entry);
configureXfeButton(button,entry);
@ -540,7 +540,7 @@ XFE_RDFToolbar::createXfeCascade(Widget parent,HT_Resource entry)
// Set the item's label
setItemLabelString(cascade,entry);
XFE_RDFUtils::setItemLabelString(_frame->getContext(),cascade,entry);
configureXfeCascade(cascade,entry);

View File

@ -35,6 +35,10 @@
#include "xfe.h" // For fe_FormatDocTitle()
#include <Xfe/Xfe.h> // For XfeIsAlive()
#include <Xfe/Label.h> // For XfeIsLabel()
#include <Xm/Label.h> // For XmIsLabel()
//////////////////////////////////////////////////////////////////////////
//
// XFE Command utilities
@ -386,3 +390,29 @@ XFE_RDFUtils::getStringFromResource(MWContext * context,
return xmname;
}
//////////////////////////////////////////////////////////////////////////
/* static */ void
XFE_RDFUtils::setItemLabelString(MWContext * context,
Widget item,
HT_Resource entry)
{
XP_ASSERT( XfeIsAlive(item) );
XP_ASSERT( entry != NULL );
XP_ASSERT( XmIsLabel(item) ||
XmIsLabelGadget(item) ||
XfeIsLabel(item) );
INTL_CharSetInfo charSetInfo = LO_GetDocumentCharacterSetInfo(context);
// Create am XmString from the entry
XmString xmname = XFE_RDFUtils::entryToXmString(entry,charSetInfo);
if (xmname != NULL)
{
XtVaSetValues(item,XmNlabelString,xmname,NULL);
XmStringFree(xmname);
}
}
//////////////////////////////////////////////////////////////////////////

View File

@ -99,6 +99,11 @@ public:
static XmString getStringFromResource (MWContext * context,
HT_Resource entry);
// Set the XmNlabelString for a widget
static void setItemLabelString (MWContext * context,
Widget item,
HT_Resource entry);
};
#endif // _xfe_rdf_utils_h_