зеркало из https://github.com/mozilla/pjs.git
Cleanup menu pane creation code. Use ONE function instead of cut-and-pasting
the code all over.
This commit is contained in:
Родитель
647d8d54b3
Коммит
0be09f87c8
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -251,6 +251,8 @@ private:
|
|||
INTL_CharSetInfo char_set_info);
|
||||
|
||||
|
||||
void setItemLabelString(Widget menu,BM_Entry * entry);
|
||||
|
||||
void createPixmaps();
|
||||
|
||||
Widget getLastMoreMenu (Widget menu);
|
||||
|
|
|
@ -483,47 +483,36 @@ XFE_Button::setMenuSpec(MenuSpec * spec)
|
|||
|
||||
case DYNA_CASCADEBUTTON:
|
||||
case DYNA_FANCY_CASCADEBUTTON:
|
||||
{
|
||||
XP_ASSERT( cur_spec != NULL );
|
||||
XP_ASSERT( cur_spec->generateProc != NULL );
|
||||
{
|
||||
Widget cascade;
|
||||
Widget pulldown;
|
||||
WidgetClass wc = NULL;
|
||||
|
||||
if (cur_spec->tag == DYNA_FANCY_CASCADEBUTTON)
|
||||
{
|
||||
wc = xfeBmCascadeWidgetClass;
|
||||
}
|
||||
else
|
||||
{
|
||||
wc = xmCascadeButtonWidgetClass;
|
||||
}
|
||||
|
||||
Widget top_level = m_toplevel->getBaseWidget();
|
||||
Visual * visual = XfeVisual(top_level);
|
||||
Colormap cmap = XfeColormap(top_level);
|
||||
Cardinal depth = XfeDepth(top_level);
|
||||
Arg av[10];
|
||||
Cardinal ac = 0;
|
||||
Widget pulldown;
|
||||
Widget cascade;
|
||||
WidgetClass wc = NULL;
|
||||
|
||||
ac = 0;
|
||||
XtSetArg(av[ac],XmNvisual, visual); ac++;
|
||||
XtSetArg(av[ac],XmNcolormap, cmap); ac++;
|
||||
XtSetArg(av[ac],XmNdepth, depth); ac++;
|
||||
|
||||
pulldown = XmCreatePulldownMenu(sub_menu_id,"pulldown",av,ac);
|
||||
|
||||
if (cur_spec->tag == DYNA_FANCY_CASCADEBUTTON)
|
||||
{
|
||||
wc = xfeBmCascadeWidgetClass;
|
||||
// Create a pulldown pane (cascade + pulldown)
|
||||
XfeMenuCreatePulldownPane(sub_menu_id,
|
||||
m_toplevel->getBaseWidget(),
|
||||
cur_spec->menuItemName,
|
||||
"pulldown",
|
||||
wc,
|
||||
True,
|
||||
NULL,
|
||||
0,
|
||||
&cascade,
|
||||
&pulldown);
|
||||
|
||||
(*cur_spec->generateProc)(cascade,
|
||||
cur_spec->callData,
|
||||
(XFE_Frame *) m_toplevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
wc = xmCascadeButtonWidgetClass;
|
||||
}
|
||||
|
||||
cascade = XtVaCreateManagedWidget(cur_spec->menuItemName,
|
||||
wc,
|
||||
sub_menu_id,
|
||||
XmNsubMenuId, pulldown,
|
||||
NULL);
|
||||
|
||||
|
||||
(*cur_spec->generateProc)(cascade,
|
||||
cur_spec->callData,
|
||||
(XFE_Frame *) m_toplevel);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -414,34 +414,21 @@ Widget
|
|||
XFE_Menu::createPulldown(char *cascadeName, MenuSpec *, Widget parent_menu,
|
||||
XP_Bool is_fancy)
|
||||
{
|
||||
Widget cascade, pulldown;
|
||||
Arg av[10];
|
||||
int ac;
|
||||
Visual *v = 0;
|
||||
Colormap cmap = 0;
|
||||
Cardinal depth = 0;
|
||||
Widget cascade;
|
||||
Widget pulldown;
|
||||
WidgetClass wc = is_fancy ? ITEM_FANCY_CASCADE_CLASS : ITEM_CASCADE_CLASS;
|
||||
|
||||
XtVaGetValues(m_parentFrame->getBaseWidget(),
|
||||
XtNvisual, &v,
|
||||
XtNcolormap, &cmap,
|
||||
XtNdepth, &depth,
|
||||
0);
|
||||
|
||||
ac = 0;
|
||||
XtSetArg(av[ac], XmNvisual, v); ac++;
|
||||
XtSetArg(av[ac], XmNcolormap, cmap); ac++;
|
||||
XtSetArg(av[ac], XmNdepth, depth); ac++;
|
||||
|
||||
pulldown = XmCreatePulldownMenu(parent_menu,
|
||||
"pulldown",
|
||||
av, ac);
|
||||
|
||||
cascade = XtVaCreateWidget(cascadeName,
|
||||
wc,
|
||||
parent_menu,
|
||||
XmNsubMenuId, pulldown,
|
||||
NULL);
|
||||
// Create a pulldown pane (cascade + pulldown)
|
||||
XfeMenuCreatePulldownPane(parent_menu,
|
||||
m_parentFrame->getBaseWidget(),
|
||||
cascadeName,
|
||||
"pulldown",
|
||||
wc,
|
||||
False,
|
||||
NULL,
|
||||
0,
|
||||
&cascade,
|
||||
&pulldown);
|
||||
|
||||
#if DELAYED_MENU_CREATION
|
||||
XtAddCallback(cascade, XmNcascadingCallback, delayed_create_pulldown, this);
|
||||
|
|
Загрузка…
Ссылка в новой задаче