Example #1
0
int
main (int argc, char **argv)
{
  XtAppContext theApp;
  Widget dialog, rc, label;
  XmString xmstr;

  toplevel = XtVaAppInitialize (&theApp, "drawingArea", NULL, 0,
				&argc, argv, NULL, NULL);
     XtVaSetValues(toplevel,
     	XmNallowShellResize, True,
     	NULL);
     dialog = XmCreateMessageBox(toplevel, "MyDialog", NULL, 0);
     xmstr = XmStringCreateLtoR("Hello World\n\nIf you hit OK on this dialog, another one"
				      "\nshould appear, positioned to the lower right of this one.",
				      XmFONTLIST_DEFAULT_TAG);
  
  
     XtVaSetValues(dialog, XmNmessageString, xmstr, NULL);
  
#if 1
     rc = XmCreateRowColumn(dialog, "rc", NULL, 0);
#else
     rc = XmCreateForm(dialog, "rc", NULL, 0);
#endif
     label = XmCreateLabel(rc, "label", NULL, 0);
     XtVaSetValues(label,
     	XmNborderWidth, 1,
     	NULL);
     XtManageChild(label);
     XtManageChild(rc);
  XtManageChild (dialog);


  XtRealizeWidget (toplevel);

{
static XtWidgetGeometry Expected[] = {
   CWWidth | CWHeight            ,   56,   72,  368,  176, 0,0,0, /* MyDialog */
   CWWidth | CWHeight | CWX | CWY,    0,    0,    4,    4, 0,0,0, /* Symbol */
   CWWidth | CWHeight | CWX | CWY,   11,   11,  346,   56, 0,0,0, /* Message */
   CWWidth | CWHeight | CWX | CWY,    0,  112,  368,    2, 0,0,0, /* Separator */
   CWWidth | CWHeight | CWX | CWY,   11,  124,   64,   41, 0,0,0, /* OK */
   CWWidth | CWHeight | CWX | CWY,  152,  124,   64,   41, 0,0,0, /* Cancel */
   CWWidth | CWHeight | CWX | CWY,  293,  124,   64,   41, 0,0,0, /* Help */
   CWWidth | CWHeight | CWX | CWY,   11,   77,  346,   25, 0,0,0, /* rc */
   CWWidth | CWHeight | CWX | CWY,    3,    3,  338,   17, 0,0,0, /* label */
};
/* toplevel should be replaced with to correct applicationShell */
PrintDetails(toplevel, Expected);
}
  LessTifTestMainLoop(toplevel);

  exit (0);
}
Example #2
0
int
main(int argc, char **argv)
{
	XtAppContext	app;
	XmString	xms;
	Arg		args[3];
	int		nargs;

	toplevel = XtVaAppInitialize(&app, "listTest", NULL, 0,
			       &argc, argv, FallBack, NULL);

	nargs=0;
	xms = XmStringCreateSimple("Yow, buddy");
	XtSetArg(args[nargs], XmNmessageString, xms); nargs++;
	XtSetArg(args[nargs], XmNwidth, 300); nargs++;
	XtSetArg(args[nargs], XmNheight, 300); nargs++;
	box = XmCreateMessageBox(toplevel, "Box", args, nargs);
	XtManageChild(box);

	XtRealizeWidget(toplevel);

	/*XdbPrintTree(toplevel);*/

{
static XtWidgetGeometry Expected[] = {
   CWWidth | CWHeight            ,   56,   72,  300,  300, 0,0,0, /* Box */
   CWWidth | CWHeight | CWX | CWY,    0,    0,    4,    4, 0,0,0, /* Symbol */
   CWWidth | CWHeight | CWX | CWY,   11,   60,  278,   17, 0,0,0, /* Message */
   CWWidth | CWHeight | CWX | CWY,    0,  137,  300,    2, 0,0,0, /* Separator */
   CWWidth | CWHeight | CWX | CWY,   11,  199,   64,   41, 0,0,0, /* OK */
   CWWidth | CWHeight | CWX | CWY,  118,  199,   64,   41, 0,0,0, /* Cancel */
   CWWidth | CWHeight | CWX | CWY,  225,  199,   64,   41, 0,0,0, /* Help */
};
/* toplevel should be replaced with to correct applicationShell */
PrintDetails(toplevel, Expected);
}
  LessTifTestMainLoop(toplevel);

	exit(0);
}
Example #3
0
static Widget 
CreateAccountDialog (Widget W)
{
  Widget AccountDialog;
  Widget Type;
  Widget PB;
  char **type;

  AccountDialog = XmCreateMessageBox (W, "AccountDialog", NULL, 0);

  Pulldown = XmCreatePulldownMenu (AccountDialog, "Pulldown", NULL, 0);
  type = AccountTypes;
  while (*type != NULL)
  {

    PB = XmCreatePushButton (Pulldown, *type, NULL, 0);
    XtManageChild (PB);
    type++;
  }
  Type = XmCreateOptionMenu (AccountDialog, "Type", NULL, 0);
  XtVaSetValues (Type,
		 XmNsubMenuId, Pulldown,
		 NULL);
  XtManageChild (Type);

  PB = XmCreatePushButton (AccountDialog, "Apply", NULL, 0);
  XtVaSetValues (AccountDialog,
#if 1
/* add this and you get the cache problem??? */
		 XmNdefaultButton, PB,
#endif
		 NULL);
  XtManageChild (PB);
  XtAddCallback(PB, XmNactivateCallback, (XtCallbackProc)ChangeLabels, NULL);
  return (AccountDialog);
}
Example #4
0
void
main (int argc, char **argv)

{
  Arg args[10];
  int n,i;
  char buf[16];

Widget Parent;
Widget Notebook;
Widget Frame1,Form1,PW1,RC1,BB1,PB1;
Widget MajorTab[3];
Widget MinorTab[3];
Widget StatusArea[6];
Widget FrameKid1;
Widget FormKid[4];
Widget RCKid[4];
Widget BBKid[4];
Widget PWKid[4];




  CommonTestInit (argc, argv);



  
  /* 
   * Create the parent. 
   */

  n=0;
  Parent = XmCreateFrame (Shell1, "Parent", args, n);
  XtManageChild (Parent);

  n=0;
  Notebook = XmCreateNotebook (Parent, "Notebook", args, n);
  XtManageChild (Notebook);

    
  for (i=0; i< 3; i++)
    {
      n=0;
      sprintf (buf, "MajorTab%d", i+1);
      MajorTab[i] = XmCreatePushButton (Notebook,buf,args,n);
      XtManageChild(MajorTab[i]);
    }
            


  for (i=0; i< 3; i++)
    {
       sprintf (buf, "MinorTab%d", i+1);
       MinorTab[i] = XmCreatePushButton (Notebook,buf,args,n);
       XtManageChild(MinorTab[i]);
    }
        

  for (i=0; i< 7; i++)
     {
       n=0;
       sprintf (buf,"StatusArea%d", i+1);
       StatusArea[i] = XmCreateText (Notebook, buf, args,n);
       XtManageChild(StatusArea[i]);
     }


  /*
   * Create Pages of Notebook
   */

  n=0;
  Frame1 = XmCreateFrame (Notebook, "Frame1", args, n);
  XtManageChild (Frame1);

  n=0;
  Form1 = XmCreateForm (Notebook, "Form1", args, n);
  XtManageChild (Form1);

  n=0;
  RC1 = XmCreateRowColumn (Notebook, "RC1", args, n);
  XtManageChild (RC1);


  n=0;
  PW1 = XmCreatePanedWindow (Notebook, "PW1", args, n);
  XtManageChild (PW1);

  n=0;
  BB1 = XmCreateBulletinBoard (Notebook, "BB1", args, n);
  XtManageChild (BB1);

  n=0;
  PB1 = XmCreatePushButton (Notebook, "PB1", args, n);
  XtManageChild (PB1);

  n=0;
  NB1 = XmCreateNotebook (Notebook, "NB1", args, n);
  XtManageChild (NB1);

  /*
   *   Create kids of pages
   */

   n=0;
   FrameKid1 = XmCreatePushButton (Frame1,"FrameKid1",args,n);
   XtManageChild (FrameKid1);


  for (i=0; i < 4; i++)
    {
      n=0;
      sprintf (buf, "FormKid%d", i+1);
      FormKid[i] = XmCreatePushButton (Form1,buf,args,n);
      XtManageChild (FormKid[i]);
    }

  for (i=0; i < 4; i++)
    {
      n=0;
      sprintf (buf, "RCKid%d", i+1);
      RCKid[i] = XmCreatePushButton (RC1,buf,args,n);
      XtManageChild (RCKid[i]);
    }


  for (i=0; i < 4; i++)
    {
      n=0;
      sprintf (buf, "PWKid%d", i+1);
      PWKid[i] = XmCreatePushButton (PW1,buf,args,n);
      XtManageChild (PWKid[i]);
    }

  for (i=0; i < 4; i++)
    {
      n=0;
      sprintf (buf, "BBKid%d", i+1);
      BBKid[i] = XmCreatePushButton (BB1,buf,args,n);
      XtManageChild (BBKid[i]);
    }

  n=0;
  NBKid1 = XmCreateMessageBox (NB1, "NBKid1", args, n);
  XtManageChild (NBKid1);


  XtRealizeWidget (Shell1);

  CommonPause();
  CommonPause();
  CommonPause();
  CommonPause();
  XtDestroyWidget (Notebook);
  CommonPause();

  /* 
   * destroy the widget 
   */



  CommonPause();

  XtAppMainLoop (app_context);
    
}
Example #5
0
Widget XmCreateMessageBox_TNK(Widget parent, String name, ArgList arglist,Cardinal argcount) { return XmCreateMessageBox(parent, name, arglist, argcount);}
Example #6
0
static int motMessageDlgPopup(Ihandle* ih, int x, int y)
{
  InativeHandle* parent = iupDialogGetNativeParent(ih);
  Widget msgbox, dialog;
  int style = XmDIALOG_FULL_APPLICATION_MODAL;
  int type = XmDIALOG_MESSAGE;
  int num_but = 2;
  char *value;

  iupAttribSetInt(ih, "_IUPDLG_X", x);   /* used in iupDialogUpdatePosition */
  iupAttribSetInt(ih, "_IUPDLG_Y", y);

  if (parent)
  {
    msgbox = XmCreateMessageDialog(parent, "messagedialog", NULL, 0);
    dialog = XtParent(msgbox);
  }
  else
  {
    dialog = XtAppCreateShell(NULL, "messagedialog", topLevelShellWidgetClass, iupmot_display, NULL, 0);
    msgbox = XmCreateMessageBox(dialog, "messagebox", NULL, 0);
    style = XmDIALOG_MODELESS;
    XtVaSetValues(dialog,
      XmNmwmInputMode, MWM_INPUT_FULL_APPLICATION_MODAL,
      XmNmappedWhenManaged, False,
      XmNsaveUnder, True,
      NULL);
  }
  if (!msgbox)
    return IUP_NOERROR;

  value = iupAttribGetStr(ih, "DIALOGTYPE");
  if (iupStrEqualNoCase(value, "ERROR"))
    type = XmDIALOG_ERROR;
  else if (iupStrEqualNoCase(value, "WARNING"))
    type = XmDIALOG_WARNING;
  else if (iupStrEqualNoCase(value, "INFORMATION"))
    type = XmDIALOG_INFORMATION;
  else if (iupStrEqualNoCase(value, "QUESTION"))
    type = XmDIALOG_QUESTION;


  value = iupAttribGet(ih, "TITLE");
  if (value)
    iupmotSetString(msgbox, XmNdialogTitle, value);
  else
  {
    if (parent)
    {
      XmString title;
      XtVaGetValues(parent, XmNdialogTitle, &title, NULL);
      XtVaSetValues(msgbox, XmNdialogTitle, title, NULL);
    }
  }

  value = iupAttribGet(ih, "VALUE");
  if (value)
    iupmotSetString(msgbox, XmNmessageString, value);

  XtVaSetValues(msgbox,
                XmNdialogType, type,
                XmNdialogStyle, style,
                XmNautoUnmanage, False,
                XmNnoResize, True,
                NULL);

  value = iupAttribGetStr(ih, "BUTTONS");
  if (iupStrEqualNoCase(value, "OK"))
  {
    XtUnmanageChild(XmMessageBoxGetChild(msgbox, XmDIALOG_CANCEL_BUTTON));
    num_but = 1;
  }
  else if (iupStrEqualNoCase(value, "YESNO"))
  {
    iupmotSetString(msgbox, XmNokLabelString, iupStrMessageGet("IUP_YES"));
    iupmotSetString(msgbox, XmNcancelLabelString, iupStrMessageGet("IUP_NO"));
  }

  if (!IupGetCallback(ih, "HELP_CB"))
    XtUnmanageChild(XmMessageBoxGetChild(msgbox, XmDIALOG_HELP_BUTTON));

  if (num_but == 2 && iupAttribGetInt(ih, "BUTTONDEFAULT") == 2)
    XtVaSetValues(msgbox, XmNdefaultButtonType, XmDIALOG_CANCEL_BUTTON, NULL);
  else
    XtVaSetValues(msgbox, XmNdefaultButtonType, XmDIALOG_OK_BUTTON, NULL);

  XtAddCallback(msgbox, XmNokCallback, (XtCallbackProc)motMessageDlgCallback, (XtPointer)ih);
  XtAddCallback(msgbox, XmNcancelCallback, (XtCallbackProc)motMessageDlgCallback, (XtPointer)ih);
  XtAddCallback(msgbox, XmNhelpCallback, (XtCallbackProc)motMessageDlgHelpCallback, (XtPointer)ih);

  XmAddWMProtocolCallback(dialog, iupmot_wm_deletewindow, motMessageDlgDeleteWindowCallback, (XtPointer)ih);
  XtManageChild(msgbox);

  XtRealizeWidget(dialog);
  ih->handle = dialog;
  iupDialogUpdatePosition(ih);
  ih->handle = NULL;  /* reset handle */

  if (style == XmDIALOG_MODELESS)
    XtPopup(dialog, XtGrabExclusive);

  /* while the user hasn't provided an answer, simulate main loop.
  ** The answer changes as soon as the user selects one of the
  ** buttons and the callback routine changes its value. */
  iupAttribSetStr(ih, "BUTTONRESPONSE", NULL);
  while (iupAttribGet(ih, "BUTTONRESPONSE") == NULL)
    XtAppProcessEvent(iupmot_appcontext, XtIMAll);

  if (!iupAttribGet(ih, "_IUP_WM_DELETE"))
  {
    XtUnmanageChild(msgbox);

    if (style == XmDIALOG_MODELESS)
    {
      XtPopdown(dialog);
      XtDestroyWidget(dialog);
    }
  }

  return IUP_NOERROR;
}