/* * OpenMotif test case for MZ#1517 * * Copyright (C) 2010 Red Hat, Inc. * Author: Thomas Woerner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published by * the Free Software Foundation; version 2 only * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include static String fallbacks[] = { /* enable the renderTable ressources to enable Xft usage: */ /* "*renderTable: renditionB", "*renderTable.renditionB.fontName: Helvetica", "*renderTable.renditionB.fontType: FONT_IS_XFT", "*renderTable.renditionB.fontSize: 12", */ /*"*foreground: white",*/ /*"*background: gray50",*/ "*mainW.width: 400", "*mainW.height: 300", "*menuCB.labelString: File", "*menuPB1.labelString: Test Button", "*menuPB2.labelString: Sensitiv/Insensitive", "*rowcolumn.isHomogeneous: True", "*rowcolumn.background: gray80", "*label1.labelString: Test label1", "*label1.background: gray50", /*"*label2.labelString: ",*/ "*label2.topWidget: *label1", /*"*label2.background: gray30", */ "*label3.labelString: Test label3", "*label3.topWidget: *label2", "*label3.background: gray50", /*"*label.foreground: black",*/ "*XmLabelGadget.height: 40", "*XmLabelGadget.width: 200", /* "Xft.antialias: 1", */ NULL }; void Callback(Widget w, XtPointer client_data, XtPointer call_data) { Widget label = (Widget) client_data; if (XtIsSensitive(label)) XtSetSensitive(label, False); else XtSetSensitive(label, True); } int main(int argc, char **argv) { XtAppContext app; Widget toplevel, mainW, menuMB, menuCB, menuPM, menuPB1, menuPB2, rowcolumn, label; toplevel = XtVaAppInitialize(&app, "omtc_1381", NULL, 0, &argc, argv, fallbacks, NULL); mainW = XmCreateMainWindow(toplevel, "mainW", NULL, 0); XtManageChild(mainW); /* menu bar */ rowcolumn = XmCreateRowColumn(mainW, "rowcolumn", NULL, 0); XtVaSetValues(rowcolumn, XmNisHomogeneous, TRUE, NULL, 0); XtManageChild(rowcolumn); label = XmCreateLabelGadget(rowcolumn, "label1", NULL, 0); XtManageChild(label); label = XmCreateLabelGadget(rowcolumn, "label2", NULL, 0); { XmString xmstr; xmstr = XmStringCreateLtoR("", XmFONTLIST_DEFAULT_TAG); XtVaSetValues(label, XmNlabelString, xmstr, NULL); } XtManageChild(label); label = XmCreateLabelGadget(rowcolumn, "label3", NULL, 0); XtManageChild(label); menuMB = XmCreateMenuBar(mainW, "menuMB", NULL, 0); XtManageChild(menuMB); menuCB = XmCreateCascadeButton(menuMB, "menuCB", NULL, 0); XtManageChild(menuCB); menuPM = XmCreatePulldownMenu(mainW, "menuPM", NULL, 0); menuPB1 = XmCreatePushButton(menuPM, "menuPB1", NULL, 0); XtManageChild(menuPB1); menuPB2 = XmCreatePushButton(menuPM, "menuPB2", NULL, 0); XtAddCallback(menuPB2, XmNactivateCallback, Callback, (XtPointer) label); XtManageChild(menuPB2); XtVaSetValues(menuCB, XmNsubMenuId, menuPM, NULL); /* realize */ XtRealizeWidget(toplevel); XtAppMainLoop(app); return 1; }