示例#1
0
文件: test11.c 项目: melanj/lesstif
int
main(int argc, char **argv)
{
  Widget toplevel, one, two;
  XtAppContext app;
  unsigned int maximum;
  XmString str;

  XtSetLanguageProc(NULL, NULL, NULL);

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

  one = XtVaCreateManagedWidget("form", xmFormWidgetClass, toplevel,
                                NULL);

  str = XmStringCreateLtoR("Test Scale", XmFONTLIST_DEFAULT_TAG);

  two = XtVaCreateManagedWidget("sb", xmScaleWidgetClass, one, 
                                XmNtopAttachment,  XmATTACH_FORM,
                                XmNleftAttachment,  XmATTACH_FORM,
                                XmNrightAttachment,  XmATTACH_FORM,
                                XmNbottomAttachment,  XmATTACH_FORM,
                                XmNorientation, XmHORIZONTAL, 
				XmNshowValue, True,
#if 0
                                XmNscaleWidth, 40,
#endif
				XmNminimum, 100,
				XmNmaximum, 300,
				XmNtitleString, str,
				XmNprocessingDirection, XmMAX_ON_LEFT,
				NULL);

  XtAddCallback(two, XmNdragCallback, dragCallback, NULL);
  XtAddCallback(two, XmNvalueChangedCallback, valueChangedCallback, NULL);

  XtRealizeWidget(toplevel);

  XtVaGetValues(two, XmNmaximum, &maximum, NULL);

  printf ("one.maximum = %u\n", maximum);

  
{
    static XtWidgetGeometry Expected[] = {
   CWWidth | CWHeight            ,   50,   50,  104,   56, 0,0,0, /* form */
   CWWidth | CWHeight | CWX | CWY,    0,    0,  104,   56, 0,0,0, /* sb */
   CWWidth | CWHeight | CWX | CWY,    0,   35,   64,   17, 0,0,0, /* Title */
   CWWidth | CWHeight | CWX | CWY,    0,   16,  104,   19, 0,0,0, /* Scrollbar */ 
    };
    PrintDetails(toplevel,Expected);
};
  LessTifTestMainLoop(toplevel);

  exit(0);
}
示例#2
0
void XttMotif::set_prompt( const char *prompt)
{
  Arg 		args[1];
  XmString	cstr;

  cstr=XmStringCreateLtoR( (char*) prompt, (char*) "ISO8859-1");
  XtSetArg(args[0],XmNlabelString, cstr);
  XtSetValues( cmd_prompt, args, 1);
  XmStringFree( cstr);
}
示例#3
0
void Component::setText(std::string text)
{
  XmString msg;
  Arg args[2];

  msg = XmStringCreateLtoR((char*)text.c_str(), XmSTRING_DEFAULT_CHARSET);
  XtSetArg(args[0], XmNlabelType, XmSTRING);
  XtSetArg(args[1], XmNlabelString, msg);
  XtSetValues(widget, args, 2);
}
示例#4
0
void AttrMotif::message(char severity, const char* message)
{
  Arg args[2];
  XmString cstr;

  cstr = XmStringCreateLtoR((char*)message, (char*)"ISO8859-1");
  XtSetArg(args[0], XmNlabelString, cstr);
  XtSetValues(msg_label, args, 1);
  XmStringFree(cstr);
}
示例#5
0
void WGeMotif::message_dialog_cb( void *ge_ctx, const char *text)
{
  Arg 		args[1];
  WGe 	*ge = (WGe *)ge_ctx;

  XtManageChild( ((WGeMotif *)ge)->message_dia_widget);

  XtSetArg(args[0],XmNmessageString, XmStringCreateLtoR( (char*) text, (char*) "ISO8859-1"));
  XtSetValues( ((WGeMotif *)ge)->message_dia_widget, args, 1);
}
示例#6
0
文件: test12.c 项目: melanj/lesstif
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);
}
示例#7
0
void WdaMotif::set_prompt( const char *prompt)
{
  Arg 		args[3];
  XmString	cstr;

  cstr=XmStringCreateLtoR( (char*) prompt, (char*) "ISO8859-1");
  XtSetArg(args[0],XmNlabelString, cstr);
  XtSetArg(args[1],XmNwidth, 50);
  XtSetArg(args[2],XmNheight, 30);
  XtSetValues( cmd_prompt, args, 3);
  XmStringFree( cstr);
}
示例#8
0
文件: show_message.c 项目: hfs/afd
/*########################### show_message() ############################*/
void
show_message(Widget w, char *message)
{
   XmString xstr;

   (void)strcpy(status_message, message);
   xstr = XmStringCreateLtoR(status_message, XmFONTLIST_DEFAULT_TAG);
   XtVaSetValues(w, XmNlabelString, xstr, NULL);
   XmStringFree(xstr);

   return;
}
示例#9
0
static void Error_popup( char *msg_buf )
{
    Widget dialog;
    Widget temp_widget;
    Widget ok_button;
    XmString ok;
    XmString msg;

    ok = XmStringCreateLocalized( "OK" );

    msg = XmStringCreateLtoR( msg_buf, XmFONTLIST_DEFAULT_TAG );

    dialog = XmCreateInformationDialog( Top_widget, "error", NULL, 0 );

    /* Get rid of Cancel and Help buttons on popup. */

    temp_widget = XmMessageBoxGetChild( dialog, XmDIALOG_CANCEL_BUTTON );
    XtUnmanageChild( temp_widget );

    temp_widget = XmMessageBoxGetChild( dialog, XmDIALOG_HELP_BUTTON );
    XtUnmanageChild( temp_widget );

    /* Set properties of OK button. */

    ok_button = XmMessageBoxGetChild( dialog, XmDIALOG_OK_BUTTON );

    XtVaSetValues( ok_button,
                   XmNforeground, hci_get_read_color( BUTTON_FOREGROUND ),
                   XmNbackground, hci_get_read_color( BUTTON_BACKGROUND ),
                   NULL );

    /* Set properties of popup. */

    XtVaSetValues (dialog,
                   XmNmessageString, msg,
                   XmNokLabelString, ok,
                   XmNbackground, hci_get_read_color( WARNING_COLOR ),
                   XmNforeground, hci_get_read_color( TEXT_FOREGROUND ),
                   XmNdialogStyle, XmDIALOG_PRIMARY_APPLICATION_MODAL,
                   XmNdeleteResponse, XmDESTROY,
                   NULL);

    /* Free allocated space. */

    XmStringFree( ok );
    XmStringFree( msg );

    /* Do this to make popup appear. */

    XtManageChild( dialog );
    XtPopup( Top_widget, XtGrabNone );
}
示例#10
0
文件: test1.c 项目: melanj/lesstif
int
main(int argc,
     char **argv)
{
    Widget toplevel;
    XtAppContext app;
    Dimension width, height;
    XmFontList fl;
    XmString xmstr, xmstr2, xmstr3;

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

    fl = _XmGetDefaultFontList(toplevel, XmTEXT_FONTLIST);

    xmstr = XmStringCreate("Hello World", XmFONTLIST_DEFAULT_TAG);
    xmstr2 = XmStringCreateLtoR("Hello\nWorld", XmFONTLIST_DEFAULT_TAG);
    xmstr3 = XmStringCreateLocalized("Céline Dion a chantée à Paris");

    XmStringExtent(fl, xmstr, &width, &height);

    printf ("String 'Hello World' has dimensions %dx%d\n", width, height);

    XmStringExtent(fl, xmstr2, &width, &height);

    printf ("String 'Hello\\nWorld' has dimensions %dx%d\n", width, height);

    PrintIt((char *)xmstr);
    PrintIt((char *)xmstr2);
    PrintIt((char *)xmstr3);

    printf("Trying XmStringCreateLtoR(NULL, XmFONTLIST_DEFAULT_TAG) ...\n");
    xmstr = XmStringCreateLtoR(NULL, XmFONTLIST_DEFAULT_TAG);
    printf("Result is %p\n", xmstr);

    printf("Trying XmStringCreateLtoR('This', NULL) ...\n");
    xmstr = XmStringCreateLtoR("This", NULL);
    printf("Result is %p\n", xmstr);
    exit(0);
}
示例#11
0
//
// This routine is called by any one who wants to send a little message.
// in a ( modal) message box. No callback is expected. We just want to
// be sure that the user see the message.
// Author: SG
// Date : 24.02.91
//
void WFoeMotif::msgbox( const char *new_label) 
{
  Arg		args[10];
  int 		i;
  XmString	cstr;

  i=0;
  XtSetArg(args[0], XmNmessageString,
	   cstr=XmStringCreateLtoR((char*) new_label , (char*) "ISO8859-1") ); i++;
  XtSetValues( widgets.msgbox ,args,i);
  XmStringFree( cstr);
  XtManageChild( widgets.msgbox);
}
示例#12
0
文件: malerts.cpp 项目: nixz/covise
void infowin(char *s)
{
    static XmString str;
    char *buf = (char *)"Sorry, no help available for this item";
    if (s == NULL)
    {
        s = buf;
    }
    if (!inwin)
    {
        fprintf(stderr, "%s\n", s);
        return;
    }
    if (info_popup)
    {
        XmStringFree(str);
        str = XmStringCreateLtoR(s, charset);
        XtVaSetValues(info_popup,
                      XmNmessageString, str,
                      NULL);
        XtManageChild(info_popup);
        return;
    }
    str = XmStringCreateLtoR(s, charset);
    info_popup = XmCreateInformationDialog(app_shell, (char *)"Info", NULL, 0);
    XtVaSetValues(info_popup,
                  XmNmessageString, str,
                  XmNdialogTitle, XmStringCreateLtoR((char *)"Info", charset),
                  XmNdialogStyle, XmDIALOG_APPLICATION_MODAL,
                  NULL);
    /*
       XtAddCallback(info_popup, XmNhelpCallback, (XtCallbackProc) info_helpCB,
           (XtPointer) NULL);
    */
    XtUnmanageChild(XmMessageBoxGetChild(info_popup, XmDIALOG_CANCEL_BUTTON));
    XtUnmanageChild(XmMessageBoxGetChild(info_popup, XmDIALOG_HELP_BUTTON));
    XtManageChild(info_popup);
}
示例#13
0
文件: p_avert.c 项目: armnlib/xrec
int  MessageAvertissementAux(char *message, int typeMessage, Widget widgetMessage, Widget widgetParent)
{
   Widget avrtWidgetParent;
   XEvent avrtEvent;
   Arg args[2];
   XmString label;

   label = XmStringCreateLtoR(message, XmSTRING_DEFAULT_CHARSET);
   XtSetArg(args[0], XmNmessageString, label);
   
   XtSetValues(widgetMessage, args, 1);
   widgetCourant = widgetMessage;

   XmStringFree(label);

   avrtSelectionTerminee = False;
   
   AjusterPositionForme(widgetCourant, widgetParent);

   XtManageChild(widgetCourant);
   FlusherTousLesEvenements();
   CheckColormap(widgetCourant);

   while (!avrtSelectionTerminee)
      {
      XtAppPeekEvent(SuperWidget.contexte, &(avrtEvent));
      switch(avrtEvent.type)
         {
         case ButtonPress:
         avrtWidgetParent =(Widget) TrouverWidgetParent(avrtEvent.xbutton.window);
         if (avrtWidgetParent == widgetParent)
            {
            XtAppNextEvent(SuperWidget.contexte, &(avrtEvent));
            XtDispatchEvent(&(avrtEvent));
            }
         else
            {
            XtAppNextEvent(SuperWidget.contexte, &(avrtEvent));
            }
         break;
         
         default:
         XtAppNextEvent(SuperWidget.contexte, &(avrtEvent));
         XtDispatchEvent(&(avrtEvent));
         break;
         }

      }
   return okCancel;
   }
示例#14
0
文件: process.c 项目: idunham/dtextra
/* Routine to set the default signal used by "Quick Kill", or
   Point and Kill. 
*/ 
void
popup_default_kill_dialog( Widget button, XtPointer client_data,
			   XtPointer call_data)
{
  Widget dialog_box, signal_list;
  int i;
  XmStringTable xmstr;
  
#include "help/kill_signal.h"

  /* Create the user name dialog */
  dialog_box = NewDialog(button, "set_kill_signal", "Set Kill Signal", 
			 True,  help_callback           , kill_signal_help,
			 True,  destroy_widget_callback , NULL,
			 True,  set_kill_signal_callback, &dialog_signal_pos);


  dialog_signal_pos = last_global_signal_pos;
  xmstr = ( XmString * ) XtMalloc (sizeof ( XmString ) * sigmap_elts ) ;

  /* Create list skipping over the 0th item -- no action. */
  for  ( i = 1; i < sigmap_elts; i++ ) {
    xmstr[i-1] = XmStringCreateLtoR ( signal_map[i].signal_name, 
				      XmFONTLIST_DEFAULT_TAG );
  }

  signal_list = XmCreateScrolledList( dialog_box, "signal_list", NULL, 0 );
  XtManageChild(signal_list);
  XtVaSetValues(signal_list, 
		 XmNitems, xmstr,
		 XmNitemCount, sigmap_elts-1,
		 XmNvisibleItemCount, 6, 
		 XmNselectionPolicy,   XmSINGLE_SELECT, 
		 NULL );

  for  ( i = 0; i < sigmap_elts-1; i++ ) {
    XmStringFree ( xmstr[i] );
  }
  XtFree((char *) xmstr);

  XtAddCallback( signal_list, XmNdefaultActionCallback, 
		 set_kill_signal_callback, &dialog_signal_pos);
  XtAddCallback( signal_list, XmNsingleSelectionCallback, 
		 SignalListCallback, &dialog_signal_pos);


  XmListSelectPos(signal_list, last_global_signal_pos+1, False);

  XtManageChild(dialog_box);
}
示例#15
0
文件: test6.c 项目: melanj/lesstif
int
main(int argc, char **argv)
{
    XtAppContext app;
    XmFontList fontlist;
    XmString xmstr1 = XmStringCreateLtoR("Here\nIs\nA\nLabel", "MY_FONT");
    Atom XA_MWM_MESSAGES, PUNT;
    char buf[256];

    XtSetLanguageProc(NULL, NULL, NULL);

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

    fontlist = XmFontListAppendEntry(NULL,
                                     XmFontListEntryCreate("MY_FONT",
                                             XmFONT_IS_FONT,
                                             XLoadQueryFont(XtDisplay(toplevel),
                                                     "-adobe-helvetica-bold-o-normal--17-0-75-75-p-*-iso8859-1")));

    one = XtVaCreateManagedWidget("One",
                                  xmPushButtonWidgetClass,
                                  toplevel, XmNfontList, fontlist,
                                  XmNlabelString, xmstr1,
                                  XtNborderWidth, 20,
                                  NULL);
    XtAddCallback(one, XmNactivateCallback, cb, NULL);


    XA_MWM_MESSAGES = XmInternAtom(XtDisplay(toplevel), _XA_MWM_MESSAGES, False);
    XmAddWMProtocols(toplevel, &XA_MWM_MESSAGES, 1);
    PUNT = XmInternAtom(XtDisplay(toplevel), "PUNT", False);
    XmAddProtocolCallback(toplevel, XA_MWM_MESSAGES, PUNT, punt, NULL);

    sprintf(buf, MENU, PUNT);
    XtVaSetValues(toplevel, XmNmwmMenu, buf, NULL);

    XtRealizeWidget(toplevel);


    {
        static XtWidgetGeometry Expected[] = {
            CWWidth | CWHeight            ,   50,   50,   57,   84, 0,0,0, /* One */
        };
        PrintDetails(  toplevel ,Expected);
    };
    LessTifTestMainLoop(  toplevel );

    exit(0);
}
示例#16
0
文件: error.c 项目: douglandau/Color
void Message(char *s) {
    XmString msgString, okString;
    char buf[512];

    answer = UNANSWERED;
    sprintf (buf, "%s", s);
    msgString = XmStringCreateLtoR (buf, XmSTRING_DEFAULT_CHARSET);
    XtVaSetValues (dialog, XmNmessageString, msgString, NULL);

    XtManageChild (dialog);
    XtPopup (XtParent(dialog), XtGrabNone);

    while (answer==UNANSWERED)
      XtAppProcessEvent(theAppContext, XtIMAll);
}
示例#17
0
//
//	Displays a message in the foe window.
//	Changes the label of a label widget which id is stored in the context.
//	Author: SG
// 	Date : 25.01.91 
//    	To avoid unnecessary call to this routine the context variable :
//     	foe.msg_label_id is set to null if the the message to be displayed 
//     	is "" . This case occurs when you want to erase a previous message.
//
void WFoeMotif::message( const char *new_label) 
{
  Arg		args[2];
  int 		l;
  XmString	cstr;

  gre->search_rectangle_delete();
  l= strlen (new_label);
  msg_label_id = ( l !=0 );
  if ( l == 0 ) new_label = " " ;
  XtSetArg(args[0], XmNlabelString, 
	   cstr=XmStringCreateLtoR((char*) new_label , (char*) "ISO8859-1"));
  XtSetValues( widgets.label ,args,1);
  XmStringFree( cstr);
}
示例#18
0
void CreateTrans(char *text, char *name)
{
    XmString message, button_text, title;
    int n;
    Arg args[MAX_ARGS];
    Widget box, button;

    message = XmStringCreateLtoR(text, XmSTRING_DEFAULT_CHARSET);
    button_text = XmStringCreateLtoR(TRANSBUTTON,
        XmSTRING_DEFAULT_CHARSET);

    title = XmStringCreateLtoR(name, XmSTRING_DEFAULT_CHARSET);

    n = 0;
    XtSetArg(args[n], XmNdialogTitle, title); n++;
    XtSetArg(args[n], XmNokLabelString, button_text); n++;
    XtSetArg(args[n], XmNmessageString, message); n++;
    box = XmCreateMessageDialog(globl.parent, "helpbox", args, n);

    button = XmMessageBoxGetChild(box, XmDIALOG_CANCEL_BUTTON);
    XtUnmanageChild(button);

    button = XmMessageBoxGetChild(box, XmDIALOG_HELP_BUTTON);
    XtUnmanageChild(button);

    if (title)
	XmStringFree(title);

    if (button_text)
	XmStringFree(button_text);

    if (message)
	XmStringFree(message);

    XtManageChild(box);
}
示例#19
0
static void
Help(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
    static Widget Dialog = NULL;
    char HelpText[] =
    "BASIC-style expression evaluator which understands the following\n"
    "operators (all trigonometrical functions use degrees):\n\n"
    "+,-,*,/,^   Addition, subtraction, multiplication, division and power.\n"
    "()          Brackets (overrides operator precedence).\n"
    "ACS expr    Arccosine.\n"
    "ASN expr    Arcsine.\n"
    "ATN expr    Arctangent.\n"
    "COS expr    Cosine.\n"
    "EXP expr    Exponential power.\n"
    "FACT expr   Factorial (expr must be between 0 and 147).\n"
    "LN expr     Natural log (expr must be positive).\n"
    "LOG expr    Log to base 10 (expr must be positive).\n"
    "RND expr    Random number generator.\n"
    "            If expr<0, then expr is used to seed the random number generator.\n"
    "            If 0<=expr<=1, then returns a real number between 0 and 1.\n"
    "            If expr>1, then returns an integer between 1 and expr.\n"
    "SIN expr    Sine.\n"
    "SQRT expr   Square root.\n"
    "TAN expr    Tangent.\n"
    "TIME        Returns the number of seconds since 1st January 1970.\n"
    "\nderived from:\n"
    "calc.c - Floating-point calculator V1.00 (C) Richard K. Lloyd 1992\n"
    "[email protected]"
     ;

    if (Dialog == NULL)
    {
	Widget ParentShell;
	XmString string;

	ParentShell = w;
	while (!XtIsApplicationShell(ParentShell))
	    ParentShell = XtParent(ParentShell);
	Dialog = XmCreateInformationDialog(ParentShell, "HelpText", NULL, 0);
	string = XmStringCreateLtoR(HelpText, XmFONTLIST_DEFAULT_TAG);
	XtVaSetValues(Dialog,
		      XmNmessageString, string,
		      NULL);
	XmStringFree(string);
    }
    XtManageChild(Dialog);

}
示例#20
0
/* add another entry of site specific data by entering its site id */
void site_edit_add_callback(Widget w, XtPointer client_data, XtPointer call_data)
{
    Widget d;
    XmString xmstr;

    d = XmCreatePromptDialog(w, "sid_add", NULL, 0);
    XtVaSetValues(XtParent(d), XmNtitle, "Add Site ID", NULL);
    xmstr = XmStringCreateLtoR("Site ID to add:", XmFONTLIST_DEFAULT_TAG);
    XtVaSetValues(d, XmNselectionLabelString, xmstr, 
             XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL, NULL);
    XtAddCallback(d, XmNcancelCallback, site_edit_add_cancel_callback, NULL);
    XtAddCallback(d, XmNokCallback, site_edit_add_ok_callback, NULL);
    XmStringFree(xmstr);

    XtManageChild(d);
}
示例#21
0
static Widget createPanelHelp(Widget parent, const char *helpText, const char *title)
{
    Arg al[20];
    int ac;
    Widget form, text, button;
    XmString st1;
    
    ac = 0;
    form = CreateFormDialog(parent, "helpForm", al, ac);

    ac = 0;
    XtSetArg (al[ac], XmNbottomAttachment, XmATTACH_FORM);  ac++;
    XtSetArg (al[ac], XmNtopAttachment, XmATTACH_NONE);  ac++;
    XtSetArg(al[ac], XmNlabelString, st1=XmStringCreateLtoR ("OK", 
                      XmSTRING_DEFAULT_CHARSET)); ac++;
    XtSetArg (al[ac], XmNmarginWidth, BUTTON_WIDTH_MARGIN);  ac++;
    button = XmCreatePushButtonGadget(form, "ok", al, ac);
    XtAddCallback(button, XmNactivateCallback, (XtCallbackProc)helpDismissCB,
    	    (char *)form);
    XmStringFree(st1);
    XtManageChild(button);
    SET_ONE_RSRC(form, XmNdefaultButton, button);
    
    ac = 0;
    XtSetArg(al[ac], XmNrows, 15);  ac++;
    XtSetArg(al[ac], XmNcolumns, 60);  ac++;
    XtSetArg(al[ac], XmNresizeHeight, False);  ac++;
    XtSetArg(al[ac], XmNtraversalOn, False); ac++;
    XtSetArg(al[ac], XmNwordWrap, True);  ac++;
    XtSetArg(al[ac], XmNscrollHorizontal, False);  ac++;
    XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT);  ac++;
    XtSetArg(al[ac], XmNeditable, False);  ac++;
    XtSetArg(al[ac], XmNvalue, helpText);  ac++;
    XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);  ac++;
    XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);  ac++;
    XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET);  ac++;
    XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);  ac++;
    XtSetArg(al[ac], XmNbottomWidget, button);  ac++;
    text = XmCreateScrolledText(form, "helpText", al, ac);
    AddMouseWheelSupport(text);
    XtManageChild(text);
    
    SET_ONE_RSRC(XtParent(form), XmNtitle, title);
    
    return form;
}
示例#22
0
文件: ssX.c 项目: q3k/ski
void prodInfoCallback(CALLBACK_ARGS)
{
    static Widget dialog = NULL;

    if (!dialog) {
	XmString xms;
	Arg arg;

	xms = XmStringCreateLtoR(productInfo(), XmFONTLIST_DEFAULT_TAG);
	XtSetArg(arg, XmNmessageString, xms);
	dialog = XmCreateInformationDialog(cmd, "prodInfo", &arg, 1);
	XmStringFree(xms);
	XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON));
	XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
    }
    XtManageChild(dialog);
}
示例#23
0
static Widget Make_menu_option(char *option_name, int client_data, Widget menu)
{
    int             ac;
    Arg             al[10];
    Widget          b;

    ac = 0;
    XtSetArg(al[ac], XmNlabelString,
	     XmStringCreateLtoR(option_name, char_set));
    ac++;
    b = XmCreatePushButton(menu, option_name, al, ac);
    XtManageChild(b);

    XtAddCallback(b, XmNactivateCallback, (XtCallbackProc)menuCB, 
					(XtPointer *)client_data);
    return (b);
}
示例#24
0
void tab_prev_callback(Widget w, XtPointer client_data, XtPointer call_data) 
{
    tab_info *call_info = (tab_info *)client_data; /* info needed to redisplay */
    
    int offset = call_info->offset;
    XmString xmstr;
    int *cur_page; 

    int ret;

    
    cur_page = call_info->cur_page;
    
    /* print out some of the client data*/
    if(verbose_flag)
        printf("page number = %d  tab offset = %d   tab screen = %d\n", 
                 *cur_page, call_info->offset,call_info->tabscreen);


    /* decrement page number! */
    (*cur_page)--;
    if(*cur_page <= 0)
        *cur_page = num_tab_pages;
       
    if(verbose_flag)
        printf("New page = %d\n", *cur_page);

    /* GET NEXT PAGE */
    ret = get_tab_page(offset,*cur_page,call_info->tabscreen);
  
    if(ret==FALSE) {
        fprintf(stderr," ERROR - Unable to retrieve the previous TAB Page.\n");
        return;
    }

      if(ret==TRUE) {  

        /* set new string for display */
            /*  xmstr = XmStringCreateLtoR(tab_buf, XmFONTLIST_DEFAULT_TAG); */
        xmstr = XmStringCreateLtoR(tab_buf, "tabfont");     
        XtVaSetValues(call_info->label, XmNlabelString, xmstr, NULL);
        XmStringFree(xmstr);
        return;
    }

} /*  end tab_prev_callback */
示例#25
0
文件: show_message.c 项目: hfs/afd
/*########################## reset_message() ############################*/
void
reset_message(Widget w)
{
   if ((status_message[0] != ' ') && (status_message[1] != '\0'))
   {
      XmString xstr;

      status_message[0] = ' ';
      status_message[1] = '\0';

      xstr = XmStringCreateLtoR(status_message, XmFONTLIST_DEFAULT_TAG);
      XtVaSetValues(w, XmNlabelString, xstr, NULL);
      XmStringFree(xstr);
   }

   return;
}
示例#26
0
文件: wid_seper.c 项目: spider-em/Web
 Widget wid_seper(Widget iw_parent, Widget iw_seper,
                   char * label,  int ix, int iy)

 { 
 int           n;
 XmString      str_label;        /* String label */
 Arg           args[MAX_ARGS];   /* Arg list */

 n = 0;

 // Note: XmStringCreateLtoR handles newline char oK) if this
 // changed to XmStringCreate you will have to solve newline problem 

 str_label = XmStringCreateLtoR(label,XmSTRING_DEFAULT_CHARSET);
 XtSetArg(args[n], XmNlabelString, str_label); n++;

 XtSetArg(args[n], XmNbackground, 0);          n++;

 if (iw_seper <= (Widget) 0)
    {   // Create seper widget first 
 
    if (ix > 0 && iy > 0)
       { // Set label position 
       XtSetArg(args[n], XmNx, (Position) ix); n++;
       XtSetArg(args[n], XmNy, (Position) iy); n++;
       }
    else
       {  // Use default alignment 
       XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
       }

    iw_seper = XmCreateLabelGadget(iw_parent,"iw_seper",args,n);
    }
 else
    {
    XtSetValues(iw_seper,args,n);
    }

 // Free the String (not doing this may result in a memory leak)
 XmStringFree(str_label);

 XtManageChild(iw_seper);

 return iw_seper;
 }
示例#27
0
//
// This routine is called by any one who wants to send a little caution message.
// The calling routine send also the address of the function it want to
// be executed when the yes button is pressed in the caution box.
// Author: SG
// Date : 13.02.91
//
void WFoeMotif::popupmsg( const char *new_label, void (* yes_procedure)(WFoe *), 
			  void (* no_procedure)(WFoe *),
			  void (* cancel_procedure)(WFoe *)) 
{
  Arg		args[10];
  int 		i;
  XmString	cstr;

  cstr = XmStringCreateLtoR((char*) new_label , (char*) "ISO8859-1");
  i=0;
  XtSetArg(args[0], XmNmessageString, cstr); i++;
  XtSetValues( widgets.caution ,args,i);
  XtManageChild( widgets.caution);
  XmStringFree( cstr);

  popupmsg_yes_p = yes_procedure ;        
  popupmsg_no_p = no_procedure ;        
  popupmsg_cancel_p = cancel_procedure ;        
}
示例#28
0
void XSilChessWindow::UpdateMovesList()
{
	XmString xms;
	Widget clpwin,scrbar;
	char * buf, * p;
	int i,smax,ssiz;
	Position x,y;
	Dimension h,hc;

	buf=(char*)malloc(65536);
	p=buf;
	for (i=0; i<Machine->GetMoveCount(); i++) {
		if ((i&1)==0) p+=sprintf(p,"%03d",i/2+1);
		*p++=' ';
		Machine->GetMove(i).ToString(p);
		p+=4;
		if ((i&1)!=0 || i==Machine->GetMoveCount()-1) *p++='\n';
	}
	*p=0;
	if (p==buf) strcpy(buf,"<empty>");
	xms=XmStringCreateLtoR(buf,XmFONTLIST_DEFAULT_TAG);
	free(buf);

	XtVaSetValues(LDList,XmNlabelString,xms,(char*)NULL);
	XmStringFree(xms);

	// Make last entry visible
	clpwin=NULL;
	XtVaGetValues(LDScroll,XmNclipWindow,&clpwin,(char*)NULL);
	if (clpwin) {
		XtVaGetValues(LDList,XmNx,&x,XmNy,&y,XmNheight,&h,(char*)NULL);
		XtVaGetValues(clpwin,XmNheight,&hc,(char*)NULL);
		if (((Position)hc-h)<y) {
			XtMoveWidget(LDList,x,hc-h);
			scrbar=NULL;
			XtVaGetValues(LDScroll,XmNverticalScrollBar,&scrbar,(char*)NULL);
			if (scrbar) {
				XtVaGetValues(scrbar,XmNmaximum,&smax,XmNsliderSize,&ssiz,(char*)NULL);
				XtVaSetValues(scrbar,XmNvalue,smax-ssiz,(char*)NULL);
			}
		}
	}
}
示例#29
0
static void doErrorDialog(const char *errorString, const char *filename)
{
    char string[255];
    XmString mString;

    ErrorDone = False;

    sprintf(string, errorString, filename);
    mString = XmStringCreateLtoR(string, XmSTRING_DEFAULT_CHARSET);
    
    SET_ONE_RSRC(ErrorDialog, XmNmessageString, mString);
    XmStringFree(mString);
    ManageDialogCenteredOnPointer(ErrorDialog);

    while (!ErrorDone)
	XtAppProcessEvent (XtWidgetToApplicationContext(ErrorDialog), XtIMAll);
    
    XtUnmanageChild(ErrorDialog);
}
示例#30
0
void WGeMotif::confirm_cb( void *ge_ctx, void *confirm_object, char *text)
{
  Arg 		args[1];
  WGe	*ge = (WGe *)ge_ctx;

  if ( ge->confirm_open) {
    XtUnmanageChild( ((WGeMotif *)ge)->confirm_widget);
    ge->confirm_open = 0;
    return;
  }

  XtManageChild( ((WGeMotif *)ge)->confirm_widget);

  message( ge, ' ', "");

  XtSetArg(args[0],XmNmessageString, XmStringCreateLtoR( text, (char*) "ISO8859-1"));
  XtSetValues( ((WGeMotif *)ge)->confirm_widget, args, 1);
  ge->confirm_open = 1;
  ge->current_confirm_object = confirm_object;
}