Fix build bustage for MOZ_MEDIUM (which doesn't show up on Tinderbox!):

Move fe_make_option_menu and friends from MOZ_MAIL_NEWS to all.


git-svn-id: svn://10.0.0.236/trunk@6755 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
akkana%netscape.com
1998-07-29 20:04:14 +00:00
parent 0b0fe0850a
commit 580743b370
2 changed files with 117 additions and 106 deletions

View File

@@ -1029,3 +1029,114 @@ D( printf ("Creating pulldown menu\n");)
}
#endif
//
// "C" routines moved from SearchRuleView.cpp because they're needed
// by more than just MOZ_MAIL_NEWS
//
extern "C" Widget
fe_make_option_menu(Widget toplevel, Widget parent, char* widgetName, Widget *popup)
{
Cardinal ac;
Arg av[10];
Widget option_menu;
Visual* v = 0;
Colormap cmap = 0;
Cardinal depth = 0;
XtVaGetValues(toplevel, XtNvisual, &v, XtNcolormap, &cmap,
XtNdepth, &depth, 0);
ac = 0;
XtSetArg(av[ac], XmNvisual, v); ac++;
XtSetArg(av[ac], XmNdepth, depth); ac++;
XtSetArg(av[ac], XmNcolormap, cmap); ac++;
*popup= XmCreatePulldownMenu(parent, widgetName, av, ac);
ac = 0;
XtSetArg(av[ac], XmNsubMenuId, *popup); ac++;
XtSetArg(av[ac], XmNmarginWidth, 0); ac++;
option_menu = XmCreateOptionMenu(parent, widgetName, av, ac);
XtUnmanageChild(XmOptionLabelGadget(option_menu));
return option_menu;
}
extern "C" void
fe_get_option_size ( Widget optionMenu,
Dimension *retWidth, Dimension *retHeight )
{
Dimension width = 0, height = 0;
Dimension mh=0, mw=0, ml=0, mr=0, mt=0, mb=0 ; /*margin*/
Dimension st=0, bw=0, ht=0;
Dimension space=0;
WidgetList children;
Cardinal numChildren;
Widget popupW;
Widget btn;
*retWidth = 0;
*retHeight = 0;
XtVaGetValues(optionMenu,
XmNsubMenuId, &popupW, 0);
XtVaGetValues(popupW,
XmNchildren, &children,
XmNnumChildren, &numChildren, 0);
if ( numChildren > 0 )
{
btn = children[0];
XtVaGetValues(btn, XmNwidth, &width,
XmNheight, &height,
XmNmarginHeight, &mh,
XmNmarginWidth, &mw,
XmNmarginLeft, &ml,
XmNmarginRight, &mr,
XmNmarginBottom, &mb,
XmNmarginTop, &mt,
XmNhighlightThickness, &ht,
XmNshadowThickness, &st,
XmNborderWidth, &bw,
0);
XtVaGetValues(optionMenu, XmNspacing, &space, 0);
*retHeight = height + (mh+mt+mb+bw+st+ht + space ) * 2;
*retWidth= width + (mw+ml+mr+bw+st+ht + space) * 2;
}
}
extern "C" Boolean
fe_set_current_attribute_option(Widget parent, int btnPos )
{
unsigned char type;
WidgetList children;
Cardinal numChildren;
Widget pulldownW;
if ( XmIsRowColumn(parent) )
{
XtVaGetValues(parent, XmNrowColumnType, &type,
XmNsubMenuId, &pulldownW,
0);
if ( type == XmMENU_OPTION && pulldownW)
{
XtVaGetValues(pulldownW,
XmNchildren, &children,
XmNnumChildren, &numChildren,0 );
if ( (int)numChildren > btnPos && btnPos >= 0)
{
XtVaSetValues(parent, XmNmenuHistory,
children[btnPos], 0);
return True;
}
}
}
return False;
}

View File

@@ -43,6 +43,12 @@
#include "xp_time.h"
#include "xplocale.h"
/* External routines which now live in Menu.cpp */
extern "C" {
Boolean fe_set_current_attribute_option(Widget parent, int btnPos );
Widget fe_make_option_menu(Widget toplevel, Widget parent, char* widgetName, Widget *popup);
void fe_get_option_size (Widget optionMenu, Dimension *retWidth, Dimension *retHeight);
};
extern int XFE_SEARCH_INVALID_DATE;
extern int XFE_SEARCH_INVALID_MONTH;
@@ -54,112 +60,6 @@ extern int XFE_SEARCH_INVALID_YEAR;
const char *XFE_SearchRuleView::activateSearch = "XFE_SearchRuleView::activateSearch";
//--- C utilities function ---
extern "C" Widget
fe_make_option_menu(Widget toplevel, Widget parent, char* widgetName, Widget *popup)
{
Cardinal ac;
Arg av[10];
Widget option_menu;
Visual* v = 0;
Colormap cmap = 0;
Cardinal depth = 0;
XtVaGetValues(toplevel, XtNvisual, &v, XtNcolormap, &cmap,
XtNdepth, &depth, 0);
ac = 0;
XtSetArg(av[ac], XmNvisual, v); ac++;
XtSetArg(av[ac], XmNdepth, depth); ac++;
XtSetArg(av[ac], XmNcolormap, cmap); ac++;
*popup= XmCreatePulldownMenu(parent, widgetName, av, ac);
ac = 0;
XtSetArg(av[ac], XmNsubMenuId, *popup); ac++;
XtSetArg(av[ac], XmNmarginWidth, 0); ac++;
option_menu = XmCreateOptionMenu(parent, widgetName, av, ac);
XtUnmanageChild(XmOptionLabelGadget(option_menu));
return option_menu;
}
extern "C" void
fe_get_option_size ( Widget optionMenu,
Dimension *retWidth, Dimension *retHeight )
{
Dimension width = 0, height = 0;
Dimension mh=0, mw=0, ml=0, mr=0, mt=0, mb=0 ; /*margin*/
Dimension st=0, bw=0, ht=0;
Dimension space=0;
WidgetList children;
Cardinal numChildren;
Widget popupW;
Widget btn;
*retWidth = 0;
*retHeight = 0;
XtVaGetValues(optionMenu,
XmNsubMenuId, &popupW, 0);
XtVaGetValues(popupW,
XmNchildren, &children,
XmNnumChildren, &numChildren, 0);
if ( numChildren > 0 )
{
btn = children[0];
XtVaGetValues(btn, XmNwidth, &width,
XmNheight, &height,
XmNmarginHeight, &mh,
XmNmarginWidth, &mw,
XmNmarginLeft, &ml,
XmNmarginRight, &mr,
XmNmarginBottom, &mb,
XmNmarginTop, &mt,
XmNhighlightThickness, &ht,
XmNshadowThickness, &st,
XmNborderWidth, &bw,
0);
XtVaGetValues(optionMenu, XmNspacing, &space, 0);
*retHeight = height + (mh+mt+mb+bw+st+ht + space ) * 2;
*retWidth= width + (mw+ml+mr+bw+st+ht + space) * 2;
}
}
extern "C" Boolean
fe_set_current_attribute_option(Widget parent, int btnPos )
{
unsigned char type;
WidgetList children;
Cardinal numChildren;
Widget pulldownW;
if ( XmIsRowColumn(parent) )
{
XtVaGetValues(parent, XmNrowColumnType, &type,
XmNsubMenuId, &pulldownW,
0);
if ( type == XmMENU_OPTION && pulldownW)
{
XtVaGetValues(pulldownW,
XmNchildren, &children,
XmNnumChildren, &numChildren,0 );
if ( (int)numChildren > btnPos && btnPos >= 0)
{
XtVaSetValues(parent, XmNmenuHistory,
children[btnPos], 0);
return True;
}
}
}
return False;
}
/*---------------------------------------------------------------
This part should be belonging to libmsg. This part is
copied from winfe