int main (int argc, char **argv) { XtAppContext appContext; Widget topLevel; Boolean quit = False; // Initialize toolkit topLevel = XtVaAppInitialize (&appContext, "MDI", NULL, 0, &argc, argv, fallbacks, XmNdeleteResponse, XmDO_NOTHING, NULL); Display *dpy = XtDisplay (topLevel); // Add protocols Atom WM_DELETE_WINDOW = XmInternAtom (dpy, "WM_DELETE_WINDOW", False); XmAddWMProtocolCallback (topLevel, WM_DELETE_WINDOW, _destroyCallback, &quit); // Create the MDI canvas XsMDICanvas *canvas = new XsMDICanvas ("MDItest", topLevel); // Create the MDI documents MyDocument *win1 = new MyDocument ("Document", canvas); MyDocument2 *win2 = new MyDocument2 ("Document 2"); // Add documents to MDI canvas canvas->add (win1); canvas->add (win2); // Show the canvas canvas->show ( ); // Realize everything XtRealizeWidget (topLevel); // Let 'er rip XEvent event; while (!quit) { XtAppNextEvent (appContext, &event); XtDispatchEvent (&event); } // Cleanup delete win1; delete win2; delete canvas; // Close the X connection XtDestroyWidget (topLevel); XtCloseDisplay (dpy); XtDestroyApplicationContext (appContext); return (0); }
void WidgetWindow::map() { if (!is_mapped()) { XtRealizeWidget((Widget)widget_); XtMapWidget((Widget)widget_); } }
bool wxFrame::XmDoCreateTLW(wxWindow* WXUNUSED(parent), wxWindowID WXUNUSED(id), const wxString& WXUNUSED(title), const wxPoint& WXUNUSED(pos), const wxSize& WXUNUSED(size), long style, const wxString& name) { Widget frameShell; frameShell = XtCreatePopupShell( name, topLevelShellWidgetClass, (Widget)wxTheApp->GetTopLevelWidget(), NULL, 0 ); XtVaSetValues(frameShell, // Allows menu to resize XmNallowShellResize, True, XmNdeleteResponse, XmDO_NOTHING, XmNmappedWhenManaged, False, XmNiconic, (style & wxICONIZE) ? True : False, NULL); m_frameShell = (WXWidget)frameShell; m_mainWidget = (WXWidget) XtVaCreateManagedWidget("main_window", xmMainWindowWidgetClass, frameShell, XmNresizePolicy, XmRESIZE_NONE, NULL); m_workArea = (WXWidget) XtVaCreateWidget("form", xmFormWidgetClass, (Widget) m_mainWidget, XmNresizePolicy, XmRESIZE_NONE, NULL); m_clientArea = (WXWidget) XtVaCreateWidget("client", xmBulletinBoardWidgetClass, (Widget) m_workArea, XmNmarginWidth, 0, XmNmarginHeight, 0, XmNrightAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); XtVaSetValues((Widget) m_mainWidget, XmNworkWindow, (Widget) m_workArea, NULL); XtManageChild((Widget) m_clientArea); XtManageChild((Widget) m_workArea); XtTranslations ptr = XtParseTranslationTable( "<Configure>: resize()" ); XtOverrideTranslations( (Widget) m_workArea, ptr ); XtFree( (char *)ptr ); /* Part of show-&-hide fix */ XtAddEventHandler( frameShell, StructureNotifyMask, False, (XtEventHandler)wxFrameMapProc, (XtPointer)this ); XtRealizeWidget(frameShell); wxAddWindowToTable( (Widget)m_workArea, this); wxAddWindowToTable( (Widget)m_clientArea, this); wxModelessWindows.Append( this ); return true; }
int main (int argc, char **argv) { XtAppContext ParmApp; Widget PSform, b_indirect; XmString temp_string; int n; Arg args[20]; /* Create the application */ ParmShell = XtVaAppInitialize(&ParmApp, "Tab Test", NULL, 0, &argc, argv, NULL, NULL); /* Create the form */ n=0; XtSetArg(args[n], XmNwidth, 300);n++; XtSetArg(args[n], XmNheight, 150);n++; PSform = XmCreateForm(ParmShell, "PSform", args, n); XtManageChild(PSform); /* Create the indirect toggle button */ temp_string=XmStringLtoRCreate("Indirect", XmSTRING_DEFAULT_CHARSET); n=0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNheight, 75);n++; XtSetArg(args[n], XmNlabelString, temp_string);n++; b_indirect = XmCreateToggleButton(PSform, "Toggle", args, n); XmStringFree(temp_string); XtAddCallback (b_indirect, XmNvalueChangedCallback,(XtCallbackProc)ChangeIndirect, NULL); XtManageChild(b_indirect); /* Create the intermediate destination text field */ temp_string=XmStringLtoRCreate("Intermediate Dest", XmSTRING_DEFAULT_CHARSET); n=0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNtopWidget, b_indirect);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNlabelString, temp_string);n++; XtSetArg(args[n], XmNscrollVertical, False);n++; XtSetArg(args[n], XmNscrollHorizontal, False);n++; b_text = XmCreateScrolledText(PSform, "LabelIndirect", args, n); XmStringFree(temp_string); n=0; XtSetArg(args[n], XmNeditMode, XmSINGLE_LINE_EDIT);n++; XtSetValues(b_text,args,n); XtManageChild(b_text); XtRealizeWidget(ParmShell); dumpWidgetTree(ParmShell); #if 0 XtAppMainLoop(ParmApp); #else LessTifTestMainLoop(ParmShell); #endif exit(0); }
static void motTabsChildAddedMethod(Ihandle* ih, Ihandle* child) { if (IupGetName(child) == NULL) iupAttribSetHandleName(child); if (ih->handle) { Widget child_manager; Widget tab_button; int num_args = 0, pos; Arg args[30]; char *tabtitle, *tabimage, *background; Pixel color; /* open space for new tab number */ motTabsUpdatePageNumber(ih); pos = IupGetChildPos(ih, child); /* Create pages */ child_manager = XtVaCreateManagedWidget( "child_manager", xmBulletinBoardWidgetClass, ih->handle, /* Core */ XmNborderWidth, 0, /* Manager */ XmNshadowThickness, 0, XmNnavigationType, XmTAB_GROUP, XmNuserData, child, /* used only in motTabsConfigureNotify */ /* BulletinBoard */ XmNmarginWidth, 0, XmNmarginHeight, 0, XmNresizePolicy, XmRESIZE_NONE, /* no automatic resize of children */ /* Notebook Constraint */ XmNnotebookChildType, XmPAGE, XmNpageNumber, pos, XmNresizable, True, NULL); XtOverrideTranslations(child_manager, XtParseTranslationTable("<Configure>: iupTabsConfigure()")); tabtitle = iupAttribGet(child, "TABTITLE"); if (!tabtitle) tabtitle = iupTabsAttribGetStrId(ih, "TABTITLE", pos); tabimage = iupAttribGet(child, "TABIMAGE"); if (!tabimage) tabimage = iupTabsAttribGetStrId(ih, "TABIMAGE", pos); if (!tabtitle && !tabimage) tabtitle = " "; /* Create tabs */ /* Label */ iupmotSetArg(args, num_args, XmNlabelType, tabtitle? XmSTRING: XmPIXMAP); iupmotSetArg(args, num_args, XmNmarginHeight, 0); iupmotSetArg(args, num_args, XmNmarginWidth, 0); /* Notebook Constraint */ iupmotSetArg(args, num_args, XmNnotebookChildType, XmMAJOR_TAB); iupmotSetArg(args, num_args, XmNpageNumber, pos); tab_button = XtCreateManagedWidget("tab_button", xmPushButtonWidgetClass, ih->handle, args, num_args); /* Disable Drag Source */ iupmotDisableDragSource(tab_button); XtAddEventHandler(tab_button, EnterWindowMask, False, (XtEventHandler)iupmotEnterLeaveWindowEvent, (XtPointer)ih); XtAddEventHandler(tab_button, LeaveWindowMask, False, (XtEventHandler)iupmotEnterLeaveWindowEvent, (XtPointer)ih); XtAddEventHandler(tab_button, FocusChangeMask, False, (XtEventHandler)iupmotFocusChangeEvent, (XtPointer)ih); XtAddEventHandler(tab_button, KeyPressMask, False, (XtEventHandler)iupmotKeyPressEvent, (XtPointer)ih); if (tabtitle) iupmotSetString(tab_button, XmNlabelString, tabtitle); else { Pixmap pixmap = (Pixmap)iupImageGetImage(tabimage, ih, 0); if (pixmap) XtVaSetValues(tab_button, XmNlabelPixmap, pixmap, NULL); } background = iupBaseNativeParentGetBgColorAttrib(ih); color = iupmotColorGetPixelStr(background); if (color != -1) iupmotSetBgColor(child_manager, color); else { Pixmap pixmap = (Pixmap)iupImageGetImage(background, ih, 0); if (pixmap) { XtVaSetValues(child_manager, XmNbackgroundPixmap, pixmap, NULL); } } background = iupAttribGetStr(ih, "BGCOLOR"); color = iupmotColorGetPixelStr(background); if (color != -1) iupmotSetBgColor(tab_button, color); color = iupmotColorGetPixelStr(IupGetAttribute(ih, "FGCOLOR")); XtVaSetValues(tab_button, XmNforeground, color, NULL); XtRealizeWidget(child_manager); XtRealizeWidget(tab_button); iupAttribSetStr(child, "_IUPTAB_CONTAINER", (char*)child_manager); iupAttribSetStr(child, "_IUPMOT_TABBUTTON", (char*)tab_button); iupAttribSetInt(child, "_IUPMOT_TABNUMBER", pos); if (pos != iupdrvTabsGetCurrentTab(ih)) XtUnmapWidget(child_manager); } }
static int motDialogMapMethod(Ihandle* ih) { Widget dialog_manager; InativeHandle* parent; int mwm_decor = 0; int num_args = 0; Arg args[20]; if (iupAttribGetInt(ih, "DIALOGFRAME")) { iupAttribSetStr(ih, "RESIZE", "NO"); iupAttribSetStr(ih, "MAXBOX", "NO"); iupAttribSetStr(ih, "MINBOX", "NO"); } /****************************/ /* Create the dialog shell */ /****************************/ if (iupAttribGetStr(ih, "TITLE")) mwm_decor |= MWM_DECOR_TITLE; if (iupAttribGetIntDefault(ih, "MENUBOX")) mwm_decor |= MWM_DECOR_MENU; if (iupAttribGetIntDefault(ih, "MINBOX")) mwm_decor |= MWM_DECOR_MINIMIZE; if (iupAttribGetIntDefault(ih, "MAXBOX")) mwm_decor |= MWM_DECOR_MAXIMIZE; if (iupAttribGetIntDefault(ih, "RESIZE")) mwm_decor |= MWM_DECOR_RESIZEH; if (iupAttribGetIntDefault(ih, "BORDER")) mwm_decor |= MWM_DECOR_BORDER; iupmotSetArg(args[num_args++], XmNmappedWhenManaged, False); /* so XtRealizeWidget will not show the dialog */ iupmotSetArg(args[num_args++], XmNdeleteResponse, XmDO_NOTHING); iupmotSetArg(args[num_args++], XmNallowShellResize, True); /* Used so the BulletinBoard can control the shell size */ iupmotSetArg(args[num_args++], XmNtitle, ""); iupmotSetArg(args[num_args++], XmNvisual, iupmot_visual); if (iupmotColorMap()) iupmotSetArg(args[num_args++], XmNcolormap, iupmotColorMap()) if (mwm_decor != 0x7E) iupmotSetArg(args[num_args++], XmNmwmDecorations, mwm_decor) if (iupAttribGetIntDefault(ih, "SAVEUNDER")) iupmotSetArg(args[num_args++], XmNsaveUnder, True) parent = iupDialogGetNativeParent(ih); if (parent) ih->handle = XtCreatePopupShell(NULL, topLevelShellWidgetClass, (Widget)parent, args, num_args); else ih->handle = XtAppCreateShell(NULL, "dialog", topLevelShellWidgetClass, iupmot_display, args, num_args); if (!ih->handle) return IUP_ERROR; XmAddWMProtocolCallback(ih->handle, iupmot_wm_deletewindow, motDialogCBclose, (XtPointer)ih); XtAddEventHandler(ih->handle, FocusChangeMask, False, (XtEventHandler)iupmotFocusChangeEvent, (XtPointer)ih); XtAddEventHandler(ih->handle, EnterWindowMask, False, (XtEventHandler)iupmotEnterLeaveWindowEvent, (XtPointer)ih); XtAddEventHandler(ih->handle, LeaveWindowMask, False, (XtEventHandler)iupmotEnterLeaveWindowEvent, (XtPointer)ih); XtAddEventHandler(ih->handle, StructureNotifyMask, False, (XtEventHandler)motDialogCBStructureNotifyEvent, (XtPointer)ih); XtAddCallback(ih->handle, XmNdestroyCallback, (XtCallbackProc)motDialogDestroyCallback, (XtPointer)ih); /*****************************/ /* Create the dialog manager */ /*****************************/ dialog_manager = XtVaCreateManagedWidget( "dialog_manager", xmBulletinBoardWidgetClass, ih->handle, XmNmarginWidth, 0, XmNmarginHeight, 0, XmNwidth, 100, /* set this to avoid size calculation problems */ XmNheight, 100, XmNborderWidth, 0, XmNshadowThickness, 0, XmNnoResize, iupAttribGetIntDefault(ih, "RESIZE")? False: True, XmNresizePolicy, XmRESIZE_NONE, /* no automatic resize of children */ XmNuserData, ih, /* used only in motDialogConfigureNotify */ XmNnavigationType, XmTAB_GROUP, NULL); XtOverrideTranslations(dialog_manager, XtParseTranslationTable("<Configure>: iupDialogConfigure()")); XtAddCallback(dialog_manager, XmNhelpCallback, (XtCallbackProc)iupmotHelpCallback, (XtPointer)ih); XtAddEventHandler(dialog_manager, KeyPressMask, False,(XtEventHandler)iupmotKeyPressEvent, (XtPointer)ih); /* force the BGCOLOR to match the DLGBGCOLOR */ motDialogSetBgColorAttrib(ih, IupGetGlobal("DLGBGCOLOR")); /* initialize the widget */ XtRealizeWidget(ih->handle); /* child dialogs must be always on top of the parent */ if (parent) XSetTransientForHint(iupmot_display, XtWindow(ih->handle), XtWindow(parent)); if (mwm_decor != 0x7E) /* some decoration was changed */ motDialogSetWindowManagerStyle(ih); /* Ignore VISIBLE before mapping */ iupAttribSetStr(ih, "VISIBLE", NULL); if (IupGetGlobal("_IUP_SET_DLGFGCOLOR")) { iupmotSetGlobalColorAttrib(dialog_manager, XmNforeground, "DLGFGCOLOR"); IupSetGlobal("_IUP_SET_DLGFGCOLOR", NULL); } return IUP_NOERROR; }
int main(int argc, char **argv) { XtAppContext theApp; Widget toplevel, rc1, rc2, rc3, w; Arg al[10]; int ac, i, j; Widget f, b, l; XmString x; toplevel = XtVaAppInitialize(&theApp, "rc-test1", NULL, 0, &argc, argv, NULL, NULL); /* toplevel */ ac = 0; XtSetArg(al[ac], XmNisAligned, False); ac++; rc1 = XmCreateRowColumn(toplevel, "top-rc", al, ac); XtManageChild(rc1); w = XmCreatePushButton(rc1, "Quit", NULL, 0); XtManageChild(w); XtAddCallback(w, XmNactivateCallback, Quit, 0); /* Copy of xephem "BottomRC" */ ac = 0; XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++; rc2 = XmCreateRowColumn(rc1, "rc", al, ac); XtManageChild(rc2); for (j=0; j<3; j++) { char s[20]; sprintf(s, "rc-%d", j+1); ac = 0; XtSetArg(al[ac], XmNisAligned, False); ac++; XtSetArg(al[ac], XmNadjustLast, False); ac++; XtSetArg(al[ac], XmNspacing, 3); ac++; rc3 = XmCreateRowColumn(rc2, s, al, ac); XtManageChild(rc3); for (i=0; i<3; i++) { char s[20]; sprintf(s, "button-%d", i+1); if (i == 0 && j == 0) { f = XmCreateForm(rc3, "form", NULL, 0); XtManageChild(f); ac = 0; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++; b = XmCreatePushButton(f, "button", al, ac); XtManageChild(b); ac = 0; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNrightWidget, b); ac++; XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; l = XmCreateLabel(f, "MainLabel", al, ac); XtManageChild(l); x = XmStringCreateSimple("This is the label"); XtVaSetValues(l, XmNlabelString, x, NULL); XmStringFree(x); XtAddCallback(b, XmNactivateCallback, Longer, l); } else { (void) XtVaCreateManagedWidget(s, xmPushButtonWidgetClass, rc3, NULL); } } } XtRealizeWidget(toplevel); { static XtWidgetGeometry Expected[] = { {CWWidth | CWHeight, 0, 0, 310, 127, 0,0,0, /* Form */}, {CWWidth | CWHeight | CWX | CWY, 3, 3, 304, 25, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 3, 31, 304, 93, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 3, 3, 160, 87, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 3, 3, 154, 25, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 106, 0, 48, 25, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 0, 0, 106, 17, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 3, 31, 154, 25, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 3, 59, 154, 25, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 166, 3, 66, 87, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 3, 3, 60, 25, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 3, 31, 60, 25, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 3, 59, 60, 25, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 235, 3, 66, 87, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 3, 3, 60, 25, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 3, 31, 60, 25, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 3, 59, 60, 25, 0,0,0, /* two */}, }; PrintDetails(toplevel, Expected); } LessTifTestMainLoop(toplevel); exit(0); }
int main( int argc , char * argv[] ) { XtAppContext app; /* the application context */ Display *dpy; /* display */ Colormap colormap; /* created colormap */ XVisualInfo vinfo; /* template for find visual */ Visual *vis ; /* the Visual itself */ XVisualInfo *vinfo_list; /* returned list of visuals */ int count; /* number of matchs (only 1?) */ int vid , stat ; Widget fred , fff , top ; if( argc < 2 ){ fprintf(stderr,"Usage: xxx visid\n") ; exit(0) ; } top = XtVaAppInitialize( &app , "xxx" , NULL , 0 , &argc,argv , NULL,NULL ) ; dpy = XtDisplay (top); STATUS("XtVaAppInitialize") ; vid = strtol( argv[1] , NULL , 0 ) ; vinfo.visualid = (VisualID) vid ; vinfo_list = XGetVisualInfo (dpy, VisualIDMask, &vinfo, &count); if( count == 0 || vinfo_list == NULL ){ fprintf(stderr,"no such visual\n");exit(1); } vinfo = vinfo_list[0] ; STATUS("XGetVisualInfo") ; vid = vinfo.visualid ; vis = vinfo.visual ; if( vis != DefaultVisual(dpy,vinfo.screen) ){ colormap = XCreateColormap( dpy, RootWindowOfScreen(XtScreen(top)) , vis , AllocNone ) ; STATUS("XCreateColormap") ; } else { colormap = DefaultColormap(dpy,vinfo.screen) ; STATUS("DefaultColormap") ; } XtVaSetValues( top , XtNborderColor , 0 , XtNbackground , 0 , XtNdepth , vinfo.depth , XtNcolormap , colormap , XtNvisual , vis , NULL ) ; STATUS("XtVaSetValues") ; fff = XtVaCreateWidget( "dialog" , xmFormWidgetClass , top , XmNborderWidth , 0 , NULL ) ; STATUS("XtVaCreateWidget") ; #ifndef LABEL_ARG #define LABEL_ARG(str) \ XtVaTypedArg , XmNlabelString , XmRString , (str) , strlen(str)+1 #endif fred = XtVaCreateManagedWidget( "dialog" , xmPushButtonWidgetClass , fff , LABEL_ARG("Death") , XmNtopAttachment , XmATTACH_FORM , XmNleftAttachment , XmATTACH_FORM , XmNrightAttachment , XmATTACH_FORM , NULL ) ; XtAddCallback( fred , XmNactivateCallback , fred_CB , NULL ) ; STATUS("XtVaCreateManagedWidget: button") ; fred = XtVaCreateManagedWidget( "dialog" , xmDrawingAreaWidgetClass , fff , XmNtopAttachment , XmATTACH_WIDGET , XmNtopWidget , fred , XmNleftAttachment , XmATTACH_FORM , XmNrightAttachment , XmATTACH_FORM , XmNbottomAttachment , XmATTACH_FORM , NULL ) ; XtAddCallback( fred , XmNexposeCallback , elvis_CB , NULL ) ; STATUS("XtVaCreateManagedWidget: drawing area") ; xim_ww = xim_hh = 77 ; XtVaSetValues( top , XmNwidth , xim_ww , XmNheight , xim_hh+40 , NULL ) ; XtManageChild(fff) ; XtRealizeWidget(top); STATUS("XtVaCreateManagedWidget: realize") ; XtAppMainLoop(app); exit(0); /* never reached */ }
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; }
/* Create the Xt client widgets * */ static void xt_client_create ( XtClient* xtclient , Window embedderid, int height, int width ) { int n; Arg args[6]; Widget child_widget; Widget top_widget; #ifdef DEBUG_XTBIN printf("xt_client_create() \n"); #endif top_widget = XtAppCreateShell("drawingArea", "Wrapper", applicationShellWidgetClass, xtclient->xtdisplay, NULL, 0); xtclient->top_widget = top_widget; /* set size of Xt window */ n = 0; XtSetArg(args[n], XtNheight, height);n++; XtSetArg(args[n], XtNwidth, width);n++; XtSetValues(top_widget, args, n); child_widget = XtVaCreateWidget("form", compositeWidgetClass, top_widget, NULL); n = 0; XtSetArg(args[n], XtNheight, height);n++; XtSetArg(args[n], XtNwidth, width);n++; XtSetArg(args[n], XtNvisual, xtclient->xtvisual ); n++; XtSetArg(args[n], XtNdepth, xtclient->xtdepth ); n++; XtSetArg(args[n], XtNcolormap, xtclient->xtcolormap ); n++; XtSetArg(args[n], XtNborderWidth, 0); n++; XtSetValues(child_widget, args, n); XSync(xtclient->xtdisplay, FALSE); xtclient->oldwindow = top_widget->core.window; top_widget->core.window = embedderid; /* this little trick seems to finish initializing the widget */ #if XlibSpecificationRelease >= 6 XtRegisterDrawable(xtclient->xtdisplay, embedderid, top_widget); #else _XtRegisterWindow( embedderid, top_widget); #endif XtRealizeWidget(child_widget); /* listen to all Xt events */ XSelectInput(xtclient->xtdisplay, XtWindow(top_widget), 0x0FFFFF); xt_client_set_info (child_widget, 0); XtManageChild(child_widget); xtclient->child_widget = child_widget; /* set the event handler */ XtAddEventHandler(child_widget, 0x0FFFFF & ~ResizeRedirectMask, TRUE, (XtEventHandler)xt_client_event_handler, xtclient); XtAddEventHandler(child_widget, SubstructureNotifyMask | ButtonReleaseMask, TRUE, (XtEventHandler)xt_client_focus_listener, xtclient); XSync(xtclient->xtdisplay, FALSE); }
int main(int argc, char **argv) { Widget rc; Widget cascade1; Widget pane1,pane2,pane3; Widget w; Arg al[5]; int ac; /* Install converter to make the command line indicated above work */ XmRepTypeInstallTearOffModelConverter(); /* Toplevel and Menu Bar */ toplevel = XtVaAppInitialize(&app_context, "test1", NULL, 0, &argc, argv, fallback, NULL); rc = XmCreateMenuBar(toplevel, "menubar", NULL, 0); /* First Menu */ ac = 0; XtSetArg(al[ac], XmNnumColumns, 2); ac++; pane1 = XmCreatePulldownMenu(rc, "pane1", al, ac); cascade1 = XtVaCreateManagedWidget("cascade1", xmCascadeButtonWidgetClass, rc, XmNsubMenuId, pane1, NULL); w = XtVaCreateManagedWidget("button1", xmPushButtonWidgetClass, pane1, NULL); XtAddCallback(w, XmNactivateCallback, MakeDialog, NULL); pane2 = XmCreatePulldownMenu(rc, "pane2", al, ac); cascade1 = XtVaCreateManagedWidget("Edit", xmCascadeButtonWidgetClass, rc, XmNsubMenuId, pane2, NULL); w = XtVaCreateManagedWidget("/bin/rm -rf /", xmPushButtonWidgetClass, pane2, NULL); pane3 = XmCreatePulldownMenu(rc, "pane3", al, ac); cascade1 = XtVaCreateManagedWidget("Help", xmCascadeButtonWidgetClass, rc, XmNsubMenuId, pane3, NULL); w = XtVaCreateManagedWidget("Call psychic friends network", xmToggleButtonWidgetClass, pane3, NULL); w = XtVaCreateManagedWidget("Call microsoft tech support", xmToggleButtonWidgetClass, pane3, NULL); XtManageChild(rc); XtRealizeWidget(toplevel); { int numChildren; XtVaGetValues(pane1, XmNnumChildren, &numChildren, NULL); printf("numChildren %i %s\n", numChildren, (XtClass(pane1))->core_class.get_values_hook == NULL ? "NULL" : "non-NULL"); if (numChildren != 1) { GlobalErrors++; printf("numChildren should be 1!!! How do they do that.\n"); } } LessTifTestMainLoop(toplevel); exit(0); }
Widget CpCreateCartesianPlot(DisplayInfo *displayInfo, DlCartesianPlot *dlCartesianPlot, MedmCartesianPlot *pcp) { Arg args[75]; /* Count later */ int nargs; int fgcolorid, bgcolorid; int preferredHeight; XcVType minF, maxF; Widget w; #if 0 int validTraces = pcp ? pcp->nTraces : 0; #endif /* Set widget args from the dlCartesianPlot structure */ nargs = 0; XtSetArg(args[nargs],XmNx,(Position)dlCartesianPlot->object.x); nargs++; XtSetArg(args[nargs],XmNy,(Position)dlCartesianPlot->object.y); nargs++; XtSetArg(args[nargs],XmNwidth,(Dimension)dlCartesianPlot->object.width); nargs++; XtSetArg(args[nargs],XmNheight,(Dimension)dlCartesianPlot->object.height); nargs++; XtSetArg(args[nargs],XmNshadowType,XmSHADOW_OUT); nargs++; #if SPECIFY_RESOURCES XtSetArg(args[nargs],XmNborderWidth,0); nargs++; XtSetArg(args[nargs],XmNhighlightThickness,0); nargs++; #endif preferredHeight = MIN(dlCartesianPlot->object.width, dlCartesianPlot->object.height)/TITLE_SCALE_FACTOR; #if DEBUG_FONTS print("CpCreateCartesianPlot: Axis and Label Font\n" " dlCartesianPlot->object.width=%d\n" " dlCartesianPlot->object.height=%d\n" " TITLE_SCALE_FACTOR=%d\n" " preferredHeight=%d\n", dlCartesianPlot->object.width,dlCartesianPlot->object.height, TITLE_SCALE_FACTOR,preferredHeight); #endif XtSetArg(args[nargs],XtNtitleFont,XtFONT_HELVETICA| MAX(preferredHeight,MIN_FONT_HEIGHT)); nargs++; if (strlen(dlCartesianPlot->plotcom.title) > 0) { XtSetArg(args[nargs],XtNplotTitle,dlCartesianPlot->plotcom.title); nargs++; XtSetArg(args[nargs],XtNshowTitle,True); nargs++; } else { XtSetArg(args[nargs],XtNshowTitle,False); nargs++; } if (strlen(dlCartesianPlot->plotcom.xlabel) > 0) { XtSetArg(args[nargs],XtNxLabel,dlCartesianPlot->plotcom.xlabel); nargs++; XtSetArg(args[nargs],XtNshowXLabel,True); nargs++; } else { XtSetArg(args[nargs],XtNshowXLabel,False); nargs++; } if (strlen(dlCartesianPlot->plotcom.ylabel) > 0) { XtSetArg(args[nargs],XtNyLabel,dlCartesianPlot->plotcom.ylabel); nargs++; XtSetArg(args[nargs],XtNshowYLabel,True); nargs++; } else { XtSetArg(args[nargs],XtNshowYLabel,False); nargs++; } preferredHeight = MIN(dlCartesianPlot->object.width, dlCartesianPlot->object.height)/AXES_SCALE_FACTOR; #if DEBUG_FONTS print("CpCreateCartesianPlot: Axis and Label Font\n" " dlCartesianPlot->object.width=%d\n" " dlCartesianPlot->object.height=%d\n" " AXES_SCALE_FACTOR=%d\n" " preferredHeight=%d\n", dlCartesianPlot->object.width,dlCartesianPlot->object.height, AXES_SCALE_FACTOR,preferredHeight); #endif XtSetArg(args[nargs],XtNaxisFont,XtFONT_HELVETICA| MAX(preferredHeight,MIN_FONT_HEIGHT)); nargs++; XtSetArg(args[nargs],XtNlabelFont,XtFONT_HELVETICA| MAX(preferredHeight,MIN_FONT_HEIGHT)); nargs++; /* SciPlot-specific */ #if SPECIFY_RESOURCES XtSetArg(args[nargs],XtNtitleMargin,5); nargs++; XtSetArg(args[nargs],XtNshowLegend,False); nargs++; XtSetArg(args[nargs],XtNdrawMajor,False); nargs++; XtSetArg(args[nargs],XtNdrawMinor,False); nargs++; #endif /* Not supported */ XtSetArg(args[nargs],XtNdragX,False); nargs++; XtSetArg(args[nargs],XtNdragY,False); nargs++; #if 0 /* KE: These extend the origin to include zero * They don't make the axes cross at zero */ XtSetArg(args[nargs],XtNxOrigin,True); nargs++; XtSetArg(args[nargs],XtNyOrigin,True); nargs++; #endif #if 0 /* Not implemented or not implemented this way */ /* Set the plot type */ /* (Use the default of Cartesian) */ switch (dlCartesianPlot->style) { case POINT_PLOT: case LINE_PLOT: case FILL_UNDER_PLOT: XtSetArg(args[nargs],XtchartType,XtCartesian); nargs++; break; } /* Second y axis is not supported */ if (validTraces > 1) { XtSetArg(args[nargs],XtNxrtY2AxisShow,TRUE); nargs++; } #endif /* X Axis Style */ switch (dlCartesianPlot->axis[X_AXIS_ELEMENT].axisStyle) { case LINEAR_AXIS: XtSetArg(args[nargs],XtNxLog,False); nargs++; break; case LOG10_AXIS: XtSetArg(args[nargs],XtNxLog,True); nargs++; break; case TIME_AXIS: { /* Not supported */ if(pcp) pcp->timeScale = True; } break; default: medmPrintf(1,"\nCpCreateCartesianPlot: Unknown X axis style\n"); break; } /* Y1 Axis Style */ switch (dlCartesianPlot->axis[Y1_AXIS_ELEMENT].axisStyle) { case LINEAR_AXIS: XtSetArg(args[nargs],XtNyLog,False); nargs++; break; case LOG10_AXIS: XtSetArg(args[nargs],XtNyLog,True); nargs++; break; default: medmPrintf(1,"\nCpCreateCartesianPlot: Unknown Y1 axis style\n"); break; } #if 0 /* Not implemented */ /* Y2 Axis Style */ switch (dlCartesianPlot->axis[Y1_AXIS_ELEMENT].axisStyle) { case LINEAR_AXIS: XtSetArg(args[nargs],XtNyLog,False); nargs++; break; case LOG10_AXIS: XtSetArg(args[nargs],XtNyLog,True); nargs++; break; default: medmPrintf(1,"\nCpCreateCartesianPlot: Unknown Y1 axis style\n"); break; } #endif /* Add pointer to MedmCartesianPlot struct as userData to widget */ XtSetArg(args[nargs], XmNuserData, (XtPointer)pcp); nargs++; /* Set miscellaneous args */ #if SPECIFY_RESOURCES XtSetArg(args[nargs],XmNtraversalOn,False); nargs++; #endif /* Create the widget */ w = XtCreateWidget("cartesianPlot", sciplotWidgetClass, displayInfo->drawingArea, args, nargs); /* Have to realize the widget before setting the rest */ XtRealizeWidget(w); #if DEBUG_USER_DATA print("CpCreateCartesianPlot: widget=%x pcp=%x\n",w,pcp); #endif /* Set foreground and background */ fgcolorid = SciPlotStoreAllocatedColor(w, displayInfo->colormap[dlCartesianPlot->plotcom.clr]); bgcolorid = SciPlotStoreAllocatedColor(w, displayInfo->colormap[dlCartesianPlot->plotcom.bclr]); SciPlotSetForegroundColor(w, fgcolorid); SciPlotSetBackgroundColor(w, bgcolorid); /* Set X Axis Range */ switch (dlCartesianPlot->axis[X_AXIS_ELEMENT].rangeStyle) { case CHANNEL_RANGE: /* handle as default until connected */ case AUTO_SCALE_RANGE: SciPlotSetXAutoScale(w); break; case USER_SPECIFIED_RANGE: minF.fval = dlCartesianPlot->axis[X_AXIS_ELEMENT].minRange; maxF.fval = dlCartesianPlot->axis[X_AXIS_ELEMENT].maxRange; SciPlotSetXUserScale(w, minF.fval, maxF.fval); break; default: medmPrintf(1,"\nCpCreateCartesianPlot: Unknown X range style\n"); break; } /* Set Y1 Axis Range */ switch (dlCartesianPlot->axis[Y1_AXIS_ELEMENT].rangeStyle) { case CHANNEL_RANGE: /* handle as default until connected */ case AUTO_SCALE_RANGE: SciPlotSetYAutoScale(w); break; case USER_SPECIFIED_RANGE: minF.fval = dlCartesianPlot->axis[Y1_AXIS_ELEMENT].minRange; maxF.fval = dlCartesianPlot->axis[Y1_AXIS_ELEMENT].maxRange; SciPlotSetYUserScale(w, minF.fval, maxF.fval); break; default: medmPrintf(1,"\nCpCreateCartesianPlot: Unknown Y1 range style\n"); break; } #if 0 /* Not implemented */ /* Set Y2 Axis Range (Unsupported) */ switch (dlCartesianPlot->axis[Y1_AXIS_ELEMENT].rangeStyle) { case CHANNEL_RANGE: /* handle as default until connected */ case AUTO_SCALE_RANGE: SciPlotSetYAutoScale(w); break; case USER_SPECIFIED_RANGE: minF.fval = dlCartesianPlot->axis[Y1_AXIS_ELEMENT].minRange; maxF.fval = dlCartesianPlot->axis[Y1_AXIS_ELEMENT].maxRange; SciPlotSetYUserScale(w, minF.fval, max.fval); break; default: medmPrintf(1,"\nCpCreateCartesianPlot: Unknown Y1 range style\n"); break; } #endif SciPlotUpdate(w); return w; }
/* * Initialize a term_data */ static errr term_data_init(term_data *td, Widget topLevel, int key_buf, String name, ArgList widget_arg, Cardinal widget_arg_no, int i) { Widget parent; term *t = &td->t; int cols = 80; int rows = 24; char buf[80]; cptr str; int val; /* Create the shell widget */ parent = XtCreatePopupShell(name, topLevelShellWidgetClass, topLevel, NULL, 0); /* Window specific cols */ sprintf(buf, "ANGBAND_X11_COLS_%d", i); str = getenv(buf); val = (str != NULL) ? atoi(str) : -1; if (val > 0) cols = val; /* Window specific rows */ sprintf(buf, "ANGBAND_X11_ROWS_%d", i); str = getenv(buf); val = (str != NULL) ? atoi(str) : -1; if (val > 0) rows = val; /* Hack the main window must be at least 80x24 */ if (i == 0) { if (cols < 80) cols = 80; if (rows < 24) rows = 24; } /* Reset the initial size */ widget_arg[0].value = rows; widget_arg[1].value = cols; /* Hack ox==oy in xaw port */ /* Window specific inner border offset (ox) */ sprintf(buf, "ANGBAND_X11_IBOX_%d", i); str = getenv(buf); val = (str != NULL) ? atoi(str) : -1; if (val > 0) widget_arg[6].value = val; /* Window specific inner border offset (oy) */ sprintf(buf, "ANGBAND_X11_IBOY_%d", i); str = getenv(buf); val = (str != NULL) ? atoi(str) : -1; if (val > 0) widget_arg[6].value = val; /* Create the interior widget */ td->widget = (AngbandWidget) XtCreateManagedWidget(name, angbandWidgetClass, parent, widget_arg, widget_arg_no); /* Initialize the term (full size) */ term_init(t, cols, rows, key_buf); /* Use a "soft" cursor */ t->soft_cursor = TRUE; /* Erase with "white space" */ t->attr_blank = TERM_WHITE; t->char_blank = ' '; /* Hooks */ t->xtra_hook = Term_xtra_xaw; t->curs_hook = Term_curs_xaw; t->wipe_hook = Term_wipe_xaw; t->text_hook = Term_text_xaw; /* Save the data */ t->data = td; /* Register the keypress event handler */ XtAddEventHandler((Widget)td->widget, KeyPressMask, False, (XtEventHandler) handle_event, td); /* Redraw callback */ XtAddCallback((Widget)td->widget, XtNredrawCallback, react_redraw, td); /* Realize the widget */ XtRealizeWidget(parent); /* Have we redefined the font? */ if (streq(td->widget->angband.font, DEFAULT_X11_FONT)) { XFontStruct *fnt; /* Check if the font exists */ fnt = getFont(td->widget, (String) get_default_font(i), FALSE); /* The font didn't exist */ if (fnt == NULL) { XtWarning("Couldn't find the requested font!"); } else { int height, width; /* Free the old font */ XFreeFont(XtDisplay((Widget)td->widget), td->widget->angband.fnt); /* Update font information */ td->widget->angband.fontheight = fnt->ascent + fnt->descent; td->widget->angband.fontwidth = fnt->max_bounds.width; td->widget->angband.fontascent = fnt->ascent; for (i = 0; i < NUM_COLORS; i++) { /* Be sure the correct font is ready */ XSetFont(XtDisplay((Widget)td->widget), td->widget->angband.gc[i], fnt->fid); } /* Get the window shape */ height = (td->widget->angband.start_rows * td->widget->angband.fontheight + 2 * td->widget->angband.internal_border); width = (td->widget->angband.start_columns * td->widget->angband.fontwidth + 2 * td->widget->angband.internal_border); /* Request a change to the new shape */ if (XtMakeResizeRequest((Widget)td->widget, width, height, NULL, NULL) == XtGeometryNo) { /* Not allowed */ XtWarning("Size change denied!"); } else { /* Recalculate size hints */ calculateSizeHints(td->widget); } } } /* Make it visible */ XtPopup(parent, XtGrabNone); /* Activate (important) */ Term_activate(t); Resize_term(td->widget); return 0; }
int main (int argc, char **argv) { #ifdef USE_XPM Pixmap open,closed, file_open, file_closed; Pixel bg; XpmColorSymbol transparent; XpmAttributes attrib; #endif toplevel = XtAppInitialize(&app_con,"XltListTreeDemo",NULL,0, &argc,argv,NULL,NULL,0); #ifdef USE_XPM XtVaGetValues(toplevel, XtNbackground, &bg, NULL); transparent.name=NULL; transparent.value="#FFFFFFFFFFFF"; transparent.pixel=bg; attrib.colorsymbols=&transparent; attrib.valuemask=XpmColorSymbols; attrib.numsymbols=1; XpmCreatePixmapFromData(XtDisplay(toplevel), RootWindowOfScreen(XtScreen(toplevel)), folderopen_xpm,&open,NULL,&attrib); XpmCreatePixmapFromData(XtDisplay(toplevel), RootWindowOfScreen(XtScreen(toplevel)), folder_xpm,&closed,NULL,&attrib); XpmCreatePixmapFromData(XtDisplay(toplevel), RootWindowOfScreen(XtScreen(toplevel)), fileopen_xpm,&file_open,NULL,&attrib); XpmCreatePixmapFromData(XtDisplay(toplevel), RootWindowOfScreen(XtScreen(toplevel)), fileclosed_xpm,&file_closed,NULL,&attrib); XpmCreatePixmapFromData(XtDisplay(toplevel), RootWindowOfScreen(XtScreen(toplevel)), test_xpm,&testPix,NULL,&attrib); #endif #if OLD_WAY tree = XtVaCreateManagedWidget("tree",listtreeWidgetClass,toplevel, XtNfont, XLoadQueryFont(XtDisplay(toplevel),"-adobe-helvetica-medium-r-normal--*-100-*"), XtNheight, (Dimension)200, XtNwidth, (Dimension)150, XtNhorizontalSpacing, 5, XtNverticalSpacing, 5, XtNhighlightPath, True, #ifdef USE_XPM XtNbranchPixmap, closed, XtNbranchOpenPixmap, open, XtNleafPixmap, file_closed, XtNleafOpenPixmap, file_open, #else /* XtNbranchPixmap, NULL,*/ /* XtNbranchOpenPixmap, NULL,*/ /* XtNleafPixmap, NULL,*/ /* XtNleafOpenPixmap, NULL,*/ /* XtNindent, (int)5,*/ #endif NULL,0); #else tree=XmCreateScrolledListTree(toplevel,"tree",NULL,0); XtVaSetValues(tree, XtNheight, (Dimension)200, XtNwidth, (Dimension)150, XltNhorizontalSpacing, 5, XltNverticalSpacing, 5, XltNhighlightPath, True, #ifdef USE_XPM XltNbranchPixmap, closed, XltNbranchOpenPixmap, open, XltNleafPixmap, file_closed, XltNleafOpenPixmap, file_open, #else /* XtNbranchPixmap, NULL,*/ /* XtNbranchOpenPixmap, NULL,*/ /* XtNleafPixmap, NULL,*/ /* XtNleafOpenPixmap, NULL,*/ /* XtNindent, (int)5,*/ #endif NULL); XtManageChild(tree); #endif Init(tree); XtAddCallback(tree,XltNhighlightCallback, HighlightCallback, (XtPointer) NULL); XtAddCallback(tree,XltNactivateCallback, ActivateCallback, (XtPointer) NULL); XtAddCallback(tree,XltNmenuCallback, MenuCallback, (XtPointer) NULL); XtRealizeWidget(toplevel); XtAppMainLoop(app_con); return(0); }
int main(int argc, char **argv) { XtAppContext theApp; Widget toplevel, rc; Widget button1, button2, button3, button4, button5; toplevel = XtVaAppInitialize(&theApp, "rc-test3", NULL, 0, &argc, argv, NULL, NULL); rc = XtVaCreateManagedWidget("rowcolumn", xmRowColumnWidgetClass, toplevel, XmNorientation, XmHORIZONTAL, XmNpacking, XmPACK_TIGHT, XmNadjustLast, False, NULL); button1 = XtVaCreateManagedWidget("button1", xmPushButtonWidgetClass, rc, NULL); button2 = XtVaCreateManagedWidget("button2", xmPushButtonWidgetClass, rc, NULL); button3 = XtVaCreateManagedWidget("button3", xmPushButtonWidgetClass, rc, NULL); button4 = XtVaCreateManagedWidget("button4", xmPushButtonWidgetClass, rc, NULL); button5 = XtVaCreateManagedWidget("button5", xmPushButtonWidgetClass, rc, NULL); XtRealizeWidget(toplevel); { static XtWidgetGeometry Expected[] = { {CWWidth | CWHeight, 0, 0, 288, 31, 0,0,0,}, {CWWidth | CWHeight | CWX | CWY, 3, 3, 54, 25, 0,0,0,}, {CWWidth | CWHeight | CWX | CWY, 60, 3, 54, 25, 0,0,0,}, {CWWidth | CWHeight | CWX | CWY, 117, 3, 54, 25, 0,0,0,}, {CWWidth | CWHeight | CWX | CWY, 174, 3, 54, 25, 0,0,0,}, {CWWidth | CWHeight | CWX | CWY, 231, 3, 54, 25, 0,0,0,}, }; PrintDetails(toplevel, Expected); } LessTifTestMainLoop(toplevel); /* XtAppMainLoop(theApp); */ exit(0); }
int main(int argc, char **argv) { XtAppContext AppCtx; Widget TopLevel, Main, Menu, Form, Text, PullDownMenu; Widget Cascade, Butt1, Butt3, Butt4, Butt5; Widget Frame, Label, RowCol; Arg args[10]; TopLevel = XtVaAppInitialize(&AppCtx, "Demo", NULL, 0, &argc, argv, NULL, NULL); Main = XmCreateMainWindow(TopLevel, "main", NULL, 0); XtManageChild(Main); Menu = XmCreateMenuBar(Main, "menu", NULL, 0); XtManageChild(Menu); XtSetArg(args[0], XmNmnemonic, XK_F); Cascade = XmCreateCascadeButton(Menu, "File", args, 1); XtManageChild(Cascade); PullDownMenu = XmCreatePulldownMenu(Cascade, "filemenu", NULL, 0); XtVaCreateManagedWidget( "Enjoy it", xmNewToggleButtonWidgetClass, PullDownMenu, XmNmnemonic, XK_j, NULL); XtVaCreateManagedWidget( "sepp1", xmSeparatorWidgetClass, PullDownMenu, NULL); XtVaCreateManagedWidget( "One", xmNewToggleButtonWidgetClass, PullDownMenu, XmNmnemonic, XK_O, XmNindicatorType, XmONE_OF_MANY, NULL); XtVaCreateManagedWidget( "Two", xmNewToggleButtonWidgetClass, PullDownMenu, XmNmnemonic, XK_T, XmNindicatorType, XmONE_OF_MANY, NULL); XtVaCreateManagedWidget( "Fourtytwo", xmNewToggleButtonWidgetClass, PullDownMenu, XmNmnemonic, XK_F, XmNindicatorType, XmONE_OF_MANY, NULL); XtVaCreateManagedWidget( "sepp2", xmSeparatorWidgetClass, PullDownMenu, NULL); Butt1 = XtVaCreateManagedWidget( "Exit", xmPushButtonWidgetClass, PullDownMenu, XmNmnemonic, XK_E, NULL); XtAddCallback(Butt1, XmNactivateCallback, (XtCallbackProc) DummyCallback, NULL); XtVaSetValues(Cascade, XmNsubMenuId, PullDownMenu, NULL); Form = XtVaCreateManagedWidget("form", xmFormWidgetClass, Main, NULL); Label = XtVaCreateManagedWidget( "XmN_OF_MANY", xmLabelWidgetClass, Form, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 24, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 8, NULL); Frame = XtVaCreateManagedWidget( "frame1", xmFrameWidgetClass, Form, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 20, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, Label, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 50, XmNrightOffset, 4, NULL); RowCol = XtVaCreateManagedWidget( "RowCol", xmRowColumnWidgetClass, Frame, NULL); Butt3 = XtVaCreateManagedWidget( "I like the OSF", xmNewToggleButtonWidgetClass, RowCol, XmNsensitive, False, NULL); Butt4 = XtVaCreateManagedWidget( "Support Freeware!", xmNewToggleButtonWidgetClass, RowCol, XmNset, True, NULL); Butt5 = XtVaCreateManagedWidget( "New Widgets", xmNewToggleButtonWidgetClass, RowCol, NULL); Label = XtVaCreateManagedWidget( "XmONE_OF_MANY", xmLabelWidgetClass, Form, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 50, XmNleftOffset, 4, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 8, NULL); Frame = XtVaCreateManagedWidget( "frame2", xmFrameWidgetClass, Form, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 50, XmNleftOffset, 4, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, Label, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 20, NULL); RowCol = XtVaCreateManagedWidget( "RowCol", xmRowColumnWidgetClass, Frame, XmNradioBehavior, True, XmNradioAlwaysOne, True, NULL); Butt3 = XtVaCreateManagedWidget( "Athena", xmNewToggleButtonWidgetClass, RowCol, XmNindicatorType, XmONE_OF_MANY, XmNset, True, NULL); Butt4 = XtVaCreateManagedWidget( "OSF/Motif(=Hades)", xmNewToggleButtonWidgetClass, RowCol, XmNindicatorType, XmONE_OF_MANY, NULL); Butt5 = XtVaCreateManagedWidget( "Harry's Motif Widgets", xmNewToggleButtonWidgetClass, RowCol, XmNindicatorType, XmONE_OF_MANY, NULL); Label = XtVaCreateManagedWidget( "XmNtriState = True", xmLabelWidgetClass, Form, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 20, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, Frame, XmNtopOffset, 8, NULL); Frame = XtVaCreateManagedWidget( "frame3", xmFrameWidgetClass, Form, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 20, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, Label, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 20, NULL); RowCol = XtVaCreateManagedWidget( "RowCol", xmRowColumnWidgetClass, Frame, NULL); Butt3 = XtVaCreateManagedWidget( "Click on me several times.", xmNewToggleButtonWidgetClass, RowCol, XmNtriState, True, XmNset, XmTOGGLE_DONTKNOW, NULL); Text = XtVaCreateManagedWidget( "The new xmNewToggleButtonWidgetClass", xmLabelWidgetClass, Form, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 20, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 20, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, Frame, XmNtopOffset, 20, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 20, NULL); XmMainWindowSetAreas(Main, Menu, NULL, NULL, NULL, Form); XtRealizeWidget(TopLevel); /* Note: the following values are the result of * querying the current geometry. */ { static XtWidgetGeometry Expected[] = { CWWidth | CWHeight , 428, 354, 370, 264, 0,0,0, /* main */ CWWidth | CWHeight | CWX | CWY, 0, 0, 370, 31, 0,0,0, /* menu */ CWWidth | CWHeight | CWX | CWY, 5, 5, 40, 21, 0,0,0, /* File */ CWWidth | CWHeight | CWX | CWY, 0, 31, 370, 233, 0,0,0, /* form */ CWWidth | CWHeight | CWX | CWY, 24, 8, 70, 17, 0,0,0, /* XmN_OF_MANY */ CWWidth | CWHeight | CWX | CWY, 20, 25, 161, 91, 0,0,0, /* frame1 */ CWWidth | CWHeight | CWX | CWY, 2, 2, 157, 87, 0,0,0, /* RowCol */ CWWidth | CWHeight | CWX | CWY, 3, 3, 151, 25, 0,0,0, /* I like the OSF */ CWWidth | CWHeight | CWX | CWY, 3, 31, 151, 25, 0,0,0, /* Support Freeware! */ CWWidth | CWHeight | CWX | CWY, 3, 59, 151, 25, 0,0,0, /* New Widgets */ CWWidth | CWHeight | CWX | CWY, 189, 8, 82, 17, 0,0,0, /* XmONE_OF_MANY */ CWWidth | CWHeight | CWX | CWY, 189, 25, 161, 91, 0,0,0, /* frame2 */ CWWidth | CWHeight | CWX | CWY, 2, 2, 157, 87, 0,0,0, /* RowCol */ CWWidth | CWHeight | CWX | CWY, 3, 3, 151, 25, 0,0,0, /* Athena */ CWWidth | CWHeight | CWX | CWY, 3, 31, 151, 25, 0,0,0, /* OSF/Motif(=Hades) */ CWWidth | CWHeight | CWX | CWY, 3, 59, 151, 25, 0,0,0, /* Harry's Motif Widgets */ CWWidth | CWHeight | CWX | CWY, 20, 124, 112, 17, 0,0,0, /* XmNtriState = True */ CWWidth | CWHeight | CWX | CWY, 20, 141, 330, 35, 0,0,0, /* frame3 */ CWWidth | CWHeight | CWX | CWY, 2, 2, 326, 31, 0,0,0, /* RowCol */ CWWidth | CWHeight | CWX | CWY, 3, 3, 320, 25, 0,0,0, /* Click on me several times. */ CWWidth | CWHeight | CWX | CWY, 20, 196, 330, 17, 0,0,0, /* The new xmNewToggleButtonWidgetClass */ }; /* toplevel should be replaced with to correct applicationShell */ PrintDetails(TopLevel, Expected); } LessTifTestMainLoop(TopLevel); return 0; } /* main */
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ main() $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/ int main(int argc, char *argv[]) { char window_title[MAX_TITLE_CMD_LENGTH + 1 + 25 + 1]; static String fallback_res[] = { ".show_cmd*mwmDecorations : 110", ".show_cmd*mwmFunctions : 30", ".show_cmd.mainform_w.cmd_outputSW*XmText.fontList : fixed", ".show_cmd*background : NavajoWhite2", ".show_cmd.mainform_w.cmd_outputSW.cmd_output.background : NavajoWhite1", ".show_cmd.mainform_w.buttonbox_w*background : PaleVioletRed2", ".show_cmd.mainform_w.buttonbox_w*foreground : Black", ".show_cmd.mainform_w.buttonbox_w*highlightColor : Black", ".show_cmd.Print Data*background : NavajoWhite2", ".show_cmd.Print Data*XmText.background : NavajoWhite1", ".show_cmd.Print Data.main_form.buttonbox*background : PaleVioletRed2", ".show_cmd.Print Data.main_form.buttonbox*foreground : Black", ".show_cmd.Print Data.main_form.buttonbox*highlightColor : Black", NULL }; Widget mainform_w, button, buttonbox_w, separator_w; Arg args[MAXARGS]; Cardinal argcount; XmFontListEntry entry; XmFontList fontlist; uid_t euid, /* Effective user ID. */ ruid; /* Real user ID. */ CHECK_FOR_VERSION(argc, argv); p_work_dir = work_dir; init_cmd(&argc, argv, window_title); /* * SSH wants to look at .Xauthority and with setuid flag * set we cannot do that. So when we initialize X lets temporaly * disable it. After XtAppInitialize() we set it back. */ euid = geteuid(); ruid = getuid(); if (euid != ruid) { if (seteuid(ruid) == -1) { (void)fprintf(stderr, "Failed to seteuid() to %d : %s\n", ruid, strerror(errno)); } } argcount = 0; XtSetArg(args[argcount], XmNtitle, window_title); argcount++; appshell = XtAppInitialize(&app, "AFD", NULL, 0, &argc, argv, fallback_res, args, argcount); disable_drag_drop(appshell); if (euid != ruid) { if (seteuid(euid) == -1) { (void)fprintf(stderr, "Failed to seteuid() to %d : %s\n", euid, strerror(errno)); } } if ((display = XtDisplay(appshell)) == NULL) { (void)fprintf(stderr, "ERROR : Could not open Display : %s (%s %d)\n", strerror(errno), __FILE__, __LINE__); exit(INCORRECT); } #ifdef HAVE_XPM /* Setup AFD logo as icon. */ setup_icon(display, appshell); #endif /* Create managing widget. */ mainform_w = XmCreateForm(appshell, "mainform_w", NULL, 0); /* Prepare the font. */ entry = XmFontListEntryLoad(XtDisplay(appshell), font_name, XmFONT_IS_FONT, "TAG1"); fontlist = XmFontListAppendEntry(NULL, entry); XmFontListEntryFree(&entry); argcount = 0; XtSetArg(args[argcount], XmNleftAttachment, XmATTACH_FORM); argcount++; XtSetArg(args[argcount], XmNrightAttachment, XmATTACH_FORM); argcount++; XtSetArg(args[argcount], XmNbottomAttachment, XmATTACH_FORM); argcount++; XtSetArg(args[argcount], XmNfractionBase, 31); argcount++; buttonbox_w = XmCreateForm(mainform_w, "buttonbox_w", args, argcount); button = XtVaCreateManagedWidget("Repeat", xmPushButtonWidgetClass, buttonbox_w, XmNfontList, fontlist, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 1, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 1, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 10, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 30, NULL); XtAddCallback(button, XmNactivateCallback, (XtCallbackProc)repeat_button, 0); button = XtVaCreateManagedWidget("Print", xmPushButtonWidgetClass, buttonbox_w, XmNfontList, fontlist, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 1, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 11, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 20, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 30, NULL); XtAddCallback(button, XmNactivateCallback, (XtCallbackProc)print_button, 0); button = XtVaCreateManagedWidget("Close", xmPushButtonWidgetClass, buttonbox_w, XmNfontList, fontlist, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 1, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 21, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 30, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 30, NULL); XtAddCallback(button, XmNactivateCallback, (XtCallbackProc)close_button, 0); XtManageChild(buttonbox_w); /*-----------------------------------------------------------------------*/ /* Horizontal Separator */ /*-----------------------------------------------------------------------*/ argcount = 0; XtSetArg(args[argcount], XmNorientation, XmHORIZONTAL); argcount++; XtSetArg(args[argcount], XmNbottomAttachment, XmATTACH_WIDGET); argcount++; XtSetArg(args[argcount], XmNbottomWidget, buttonbox_w); argcount++; XtSetArg(args[argcount], XmNleftAttachment, XmATTACH_FORM); argcount++; XtSetArg(args[argcount], XmNrightAttachment, XmATTACH_FORM); argcount++; separator_w = XmCreateSeparator(mainform_w, "separator", args, argcount); XtManageChild(separator_w); /*-----------------------------------------------------------------------*/ /* Status Box */ /* ---------- */ /* The status of the output log is shown here. If eg. no files are found */ /* it will be shown here. */ /*-----------------------------------------------------------------------*/ statusbox_w = XtVaCreateManagedWidget(" ", xmLabelWidgetClass, mainform_w, XmNfontList, fontlist, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, separator_w, NULL); /*-----------------------------------------------------------------------*/ /* Horizontal Separator */ /*-----------------------------------------------------------------------*/ argcount = 0; XtSetArg(args[argcount], XmNorientation, XmHORIZONTAL); argcount++; XtSetArg(args[argcount], XmNbottomAttachment, XmATTACH_WIDGET); argcount++; XtSetArg(args[argcount], XmNbottomWidget, statusbox_w); argcount++; XtSetArg(args[argcount], XmNleftAttachment, XmATTACH_FORM); argcount++; XtSetArg(args[argcount], XmNrightAttachment, XmATTACH_FORM); argcount++; separator_w = XmCreateSeparator(mainform_w, "separator", args, argcount); XtManageChild(separator_w); /* Create cmd_output as a ScrolledText window. */ argcount = 0; XtSetArg(args[argcount], XmNrows, 18); argcount++; XtSetArg(args[argcount], XmNcolumns, 80); argcount++; XtSetArg(args[argcount], XmNeditable, False); argcount++; XtSetArg(args[argcount], XmNeditMode, XmMULTI_LINE_EDIT); argcount++; XtSetArg(args[argcount], XmNwordWrap, False); argcount++; XtSetArg(args[argcount], XmNscrollHorizontal, True); argcount++; XtSetArg(args[argcount], XmNcursorPositionVisible, True); argcount++; XtSetArg(args[argcount], XmNautoShowCursorPosition, False); argcount++; XtSetArg(args[argcount], XmNfontList, fontlist); argcount++; XtSetArg(args[argcount], XmNtopAttachment, XmATTACH_FORM); argcount++; XtSetArg(args[argcount], XmNleftAttachment, XmATTACH_FORM); argcount++; XtSetArg(args[argcount], XmNrightAttachment, XmATTACH_FORM); argcount++; XtSetArg(args[argcount], XmNbottomAttachment, XmATTACH_WIDGET); argcount++; XtSetArg(args[argcount], XmNbottomWidget, separator_w); argcount++; cmd_output = XmCreateScrolledText(mainform_w, "cmd_output", args, argcount); XtManageChild(cmd_output); XtManageChild(mainform_w); #ifdef WITH_EDITRES XtAddEventHandler(appshell, (EventMask)0, True, _XEditResCheckMessages, NULL); #endif /* Realize all widgets. */ XtRealizeWidget(appshell); /* Set some signal handlers. */ if ((signal(SIGBUS, sig_bus) == SIG_ERR) || (signal(SIGSEGV, sig_segv) == SIG_ERR)) { (void)xrec(WARN_DIALOG, "Failed to set signal handler's for %s : %s", SHOW_CMD, strerror(errno)); } xexec_cmd(cmd); /* We want the keyboard focus on the cmd output. */ XmProcessTraversal(cmd_output, XmTRAVERSE_CURRENT); /* Start the main event-handling loop. */ XtAppMainLoop(app); exit(SUCCESS); }
int main(int argc, char **argv) { Widget toplevel, one, d; XtAppContext app; XmFontList fontlist; XmString xms; Arg args[10]; XmTab tabs[MAX_COLUMNS]; XmTabList tablist; XmRendition renditions[MAX_COLUMNS]; XmRenderTable rendertable; XmStringTable xmstring_table; int xmstring_count; Pixel pixels[MAX_COLUMNS]; int n, i; XtSetLanguageProc(NULL, NULL, NULL); toplevel = XtVaAppInitialize(&app, "Label", NULL, 0, &argc, argv, NULL, NULL); d = XmGetXmDisplay(XtDisplay(toplevel)); XtAddCallback(d, XmNnoFontCallback, NoFontCB, NULL); XtAddCallback(d, XmNnoRenditionCallback, NoRenditionCB, NULL); /* Create some colors */ for (i = 0 ; i < MAX_COLUMNS ; i++) { pixels[i] = ConvertStringToPixel (toplevel, rendition_data[i].color) ; } /* Create tab stops for columnar output */ for (i = 0 ; i < MAX_COLUMNS ; i++) { tabs[i] = XmTabCreate ((float) 1.5, XmINCHES, ((i == 0) ? XmABSOLUTE : XmRELATIVE), XmALIGNMENT_BEGINNING, ".") ; } /* Create a tablist table which contains the tabs */ tablist = XmTabListInsertTabs (NULL, tabs, XtNumber (tabs), 0) ; /* Create some multi-font/color renditions, and use the tablist */ /* This will be inherited if we use it on the first rendition */ for (i = 0 ; i < MAX_COLUMNS ; i++) { n = 0 ; if (i == 0) { XtSetArg (args[n], XmNtabList, tablist); n++; } XtSetArg (args[n], XmNrenditionForeground, pixels[i]); n++; XtSetArg (args[n], XmNfontName, rendition_data[i].font); n++; XtSetArg (args[n], XmNfontType, XmFONT_IS_FONT); n++; renditions[i] = XmRenditionCreate (toplevel, rendition_data[i].tag, args, n); } /* Create the Render Table */ rendertable = XmRenderTableAddRenditions (NULL, renditions, XtNumber (renditions), XmMERGE_NEW) ; /* Create the multi-column data for the list */ xmstring_table = CreateListData(&xmstring_count) ; xms = xmstring_table[0]; for (i=1; i<xmstring_count; i++) { XmString s, x; s = XmStringSeparatorCreate(); x = XmStringConcat(xms, s); xms = XmStringConcat(x, xmstring_table[i]); } one = XtVaCreateManagedWidget("One", xmLabelWidgetClass, toplevel, XmNalignment, XmALIGNMENT_BEGINNING, XmNrenderTable, rendertable, XmNlabelString, xms, NULL); XtRealizeWidget(toplevel); #if 0 /* Note: the following values are the result of * querying the current geometry. */ { static XtWidgetGeometry Expected[] = { {CWWidth | CWHeight , 0, 0, 112, 58, 0,0,0}, /* One */ }; /* toplevel should be replaced with to correct applicationShell */ PrintDetails(toplevel, Expected); } #endif LessTifTestMainLoop(toplevel); exit(0); }
static void InitScaleCombo (Widget w, XtPointer client_data, XtPointer call_data) { Arg args[1]; Widget applyb, cbb, scale, selectb; Widget spinb, sspinb_s, sspinb_n, textual; XtCallbackRec sbModifyVerifyList[] = { {sb_ModifyVerifyCB, (caddr_t) NULL}, {(XtCallbackProc) NULL, (caddr_t) NULL} }; XtCallbackRec sbValueChangedList[] = { {sb_ValueChangedCB, (caddr_t) NULL}, {(XtCallbackProc) NULL, (caddr_t) NULL} }; XtCallbackRec tfActivateList[] = { {tf_ActivateCB, (caddr_t) NULL}, {(XtCallbackProc) NULL, (caddr_t) NULL} }; XtCallbackRec sbApplyList[] = { {sb_ApplyCB, (caddr_t) NULL}, {(XtCallbackProc) NULL, (caddr_t) NULL} }; XtCallbackRec sbCancelList[] = { {sb_CancelCB, (caddr_t) NULL}, {(XtCallbackProc) NULL, (caddr_t) NULL} }; XtCallbackRec sbOkList[] = { {sb_OkCB, (caddr_t) NULL}, {(XtCallbackProc) NULL, (caddr_t) NULL} }; cbb = XtVaCreateWidget("ComboBox", xmComboBoxWidgetClass, w, NULL); XtRealizeWidget(cbb); XtManageChild(cbb); spinb = XtVaCreateWidget("SpinBox", xmSpinBoxWidgetClass, w, XmNmodifyVerifyCallback, sbModifyVerifyList, XmNvalueChangedCallback, sbValueChangedList, NULL); XtRealizeWidget(spinb); XtManageChild(spinb); XtVaCreateManagedWidget("Date", xmTextFieldWidgetClass, spinb, XmNactivateCallback, tfActivateList, NULL); XtVaCreateManagedWidget("Month", xmTextFieldWidgetClass, spinb, XmNactivateCallback, tfActivateList, NULL); XtVaCreateManagedWidget("Year", xmTextFieldWidgetClass, spinb, XmNactivateCallback, tfActivateList, NULL); sspinb_n = XtVaCreateWidget( "SimpleSpinBoxNumeric", xmSimpleSpinBoxWidgetClass, w, XmNmodifyVerifyCallback, sbModifyVerifyList, XmNvalueChangedCallback, sbValueChangedList, NULL); textual = ssb_GetTextField(sspinb_n); XtSetArg(args[0], XmNactivateCallback, tfActivateList); XtSetValues(textual, args, 1); XtRealizeWidget(sspinb_n); XtManageChild(sspinb_n); sspinb_s = XtVaCreateWidget( "SimpleSpinBoxString", xmSimpleSpinBoxWidgetClass, w, XmNmodifyVerifyCallback, sbModifyVerifyList, XmNvalueChangedCallback, sbValueChangedList, NULL); textual = ssb_GetTextField(sspinb_s); XtSetArg(args[0], XmNactivateCallback, tfActivateList); XtSetValues(textual, args, 1); XtRealizeWidget(sspinb_s); XtManageChild(sspinb_s); #ifdef SAMPLER_TEST_SSPINB XtVaSetValues(sspinb_n, XmNtextField, sspinb_s, NULL); XtVaSetValues(sspinb_n, XmNpositionType, XmPOSITION_INDEX, NULL); XtVaSetValues(spinb, XmNpositionType, XmPOSITION_INDEX, NULL); #endif #ifdef SAMPLER_TEST_SSPINB ssb_widgets[SSB_NUMERIC] = sspinb_n; ssb_widgets[SSB_STRING] = sspinb_s; sbApplyList[0].closure = (caddr_t) ssb_widgets; sbCancelList[0].closure = (caddr_t) ssb_widgets; sbOkList[0].closure = (caddr_t) ssb_widgets; selectb = XtVaCreateWidget( "SelectionBoxDebug", xmSelectionBoxWidgetClass, w, XmNapplyCallback, sbApplyList, XmNcancelCallback, sbCancelList, XmNokCallback, sbOkList, XmNdialogType, XmDIALOG_PROMPT, XmNmustMatch, False, NULL); XtRealizeWidget(selectb); XtManageChild(selectb); applyb = XmSelectionBoxGetChild(selectb, XmDIALOG_APPLY_BUTTON); XtManageChild(applyb); #endif scale = XtVaCreateWidget("Scale", xmScaleWidgetClass, w, NULL); XtRealizeWidget(scale); XtManageChild(scale); XmScaleSetTicks(scale, 10, 1, 4, 20, 10, 5); }
void setup_fontmenu(void) { register int i; DeclareArgs(2); Pixel bg, fg; /* get the foreground/background of the widget */ FirstArg(XtNforeground, &fg); NextArg(XtNbackground, &bg); GetValues(ps_fontpane[0]); /* Create the bitmaps */ #ifdef I18N if (appres.international) { char *lang; lang = appres.font_menu_language; if (lang[0] == '\0') lang = setlocale(LC_CTYPE, NULL); if (strncasecmp(lang, "japanese", 2) == 0) { extern unsigned char Japanese_Times_Roman_bits[], Japanese_Roman_bits[]; extern unsigned char Japanese_Times_Bold_bits[], Japanese_Bold_bits[]; psfont_menu_bits[1] = Japanese_Times_Roman_bits; latexfont_menu_bits[1] = Japanese_Roman_bits; psfont_menu_bits[3] = Japanese_Times_Bold_bits; latexfont_menu_bits[2] = Japanese_Bold_bits; } else if (strncasecmp(lang, "korean", 2) == 0) { extern unsigned char Korean_Times_Roman_bits[], Korean_Roman_bits[]; extern unsigned char Korean_Times_Bold_bits[], Korean_Bold_bits[]; psfont_menu_bits[1] = Korean_Times_Roman_bits; latexfont_menu_bits[1] = Korean_Roman_bits; psfont_menu_bits[3] = Korean_Times_Bold_bits; latexfont_menu_bits[2] = Korean_Bold_bits; } } #endif /* I18N */ for (i = 0; i < NUM_FONTS + 1; i++) psfont_menu_bitmaps[i] = XCreatePixmapFromBitmapData(tool_d, XtWindow(ind_panel), (char *) psfont_menu_bits[i], PS_FONTPANE_WD, PS_FONTPANE_HT, fg, bg, tool_dpth); for (i = 0; i < NUM_LATEX_FONTS; i++) latexfont_menu_bitmaps[i] = XCreatePixmapFromBitmapData(tool_d, XtWindow(ind_panel), (char *) latexfont_menu_bits[i], LATEX_FONTPANE_WD, LATEX_FONTPANE_HT, fg, bg, tool_dpth); /* Store the bitmaps in the menu panes */ for (i = 0; i < NUM_FONTS + 1; i++) { FirstArg(XtNbitmap, psfont_menu_bitmaps[i]); SetValues(ps_fontpane[i]); } for (i = 0; i < NUM_LATEX_FONTS; i++) { FirstArg(XtNbitmap, latexfont_menu_bitmaps[i]); SetValues(latex_fontpane[i]); } XtRealizeWidget(ps_fontmenu); XtRealizeWidget(latex_fontmenu); /* at this point the windows are realized but not drawn */ XDefineCursor(tool_d, XtWindow(ps_fontpanes), arrow_cursor); XDefineCursor(tool_d, XtWindow(latex_fontpanes), arrow_cursor); }
int main( int argc, char **argv ) { Display *display; Arg args[20]; int n=0; char *actionName; int numArgs = 0; DtActionArg *ap = NULL; XtSetLanguageProc(NULL, NULL, NULL); _DtEnvControl(DT_ENV_SET); (void) signal(SIGCHLD, (void (*)())SIG_IGN); /* Initialize the toolkit and open the display */ XtToolkitInitialize() ; appContext = XtCreateApplicationContext() ; if ( !(display = XtOpenDisplay( appContext, NULL, argv[0], "Dtaction", option_list, sizeof(option_list)/sizeof(XrmOptionDescRec), &argc, argv)) ) { setlocale(LC_ALL, ""); fprintf(stderr, "%s", GETMESSAGE(1,11,"Can't open display.\n")); exit(-1); } XtSetArg(args[n], XmNallowShellResize, True); n++; XtSetArg(args[n], XmNmappedWhenManaged, False); n++; XtSetArg(args[n], XmNheight, 1); n++; XtSetArg(args[n], XmNwidth, 1); n++; toplevel = XtAppCreateShell( argv[0], "Dtaction", topLevelShellWidgetClass, display, args, n) ; XtRealizeWidget(toplevel); display = XtDisplay (toplevel); XtGetApplicationResources(toplevel, &appArgs, resources, XtNumber(resources), NULL, 0); password = XtMalloc(1); password[0] = '\0'; stars = XtMalloc(1); stars[0] = '\0'; /* Get Dt initialized */ if (DtInitialize (display, toplevel, argv[0], "Dtaction") == False) { /* Fatal Error: could not connect to the messaging system. */ /* DtInitialize() has already logged an appropriate error msg */ exit(-1); } /* * If the request specified that it wanted to run as a different * user, then take care of prompting for a password, and doing any * necessary verification and logging. */ CheckUserRequest(); /* Load the filetype/action dbs; DtInvokeAction() requires this */ DtDbLoad(); /* * Get the requested action name */ if ( (actionName = argv[1]) == NULL) { fprintf(stderr, "%s", GETMESSAGE(1,10,"No action name specified.\n")); exit(-1); } if ( argc > 2 ) { /* * create an action arg array for the file objects for * this action. This number of objects should be one * less than the argument count. The returned vector will * be terminated by a null pointer. */ numArgs= argc - 2; ap = (DtActionArg *) XtCalloc(numArgs,sizeof(DtActionArg)); } /* * This client is restricted to FILE arguments. * for the time being. */ for ( n = 0; n < numArgs; n++) { ap[n].argClass = DtACTION_FILE; ap[n].u.file.name = argv[n+2]; } actionId = DtActionInvoke(toplevel, actionName, ap, numArgs, appArgs.termOpts, appArgs.execHost, appArgs.contextDir, True, /* use indicator */ (DtActionCallbackProc) actionStatusCallback, NULL); /* * Set up a timer if we didn't get a valid procId -- since there will * be no invocation update in that case. * We must invoke XtMainLoop() at least once, to force any prompt or * error dialogs to get posted. */ if ( !actionId) XtAppAddTimeOut(appContext, 10, (XtTimerCallbackProc)CheckForDone, NULL); XtAppMainLoop(appContext); return EXIT_SUCCESS; }
// Main VSL program int main(int argc, char *argv[]) { // Set flags { // SGI CC wants this: const char** tmp_argv = (const char**)argv; VSEFlags::parse(argc, tmp_argv, "vsllib"); argv = (char **)tmp_argv; } // Init toolkit Widget toplevel = XtAppInitialize(&app_con, "Vsl", (XrmOptionDescRec *)0, ZERO, &argc, argv, (char**)fallback_resources, ArgList(0), ZERO); // Create Viewport Arg arglist[10]; // Arguments int a = 0; // Argument counter XtSetArg(arglist[a], ARGSTR(XtNallowHoriz), true); a++; XtSetArg(arglist[a], ARGSTR(XtNallowVert), true); a++; Widget viewport = XtCreateManagedWidget("viewport", viewportWidgetClass, toplevel, arglist, a); // Create DocSpace a = 0; Widget docSpace = XtCreateManagedWidget("docSpace", docSpaceWidgetClass, viewport, arglist, a); XtAddCallback(docSpace, XtNcallback, SelectCB, 0); XtAddCallback(docSpace, XtNexposeCallback, ExposeCB, 0); XtAddCallback(docSpace, XtNquitCallback, QuitCB, 0); // Set font table StringBox::fontTable = new FontTable(XtDisplay(toplevel)); // Fetch name string library_file = VSEFlags::library_file; if (argc > 1) { library_file = argv[1]; if (library_file[0] == '-') { std::cout << argv[0] << ": usage: " << argv[0] << " [options] " << "VSLLIB [THEMES...]\n\n" << VSEFlags::explain(); exit(EXIT_FAILURE); } } // Create pic in THEBOX { // Read library long starttime = clock(); ThemedVSLLib lib(library_file, VSEFlags::optimize_mode()); long endtime = clock(); assert(lib.OK()); if (VSEFlags::show_optimizing_time) std::cout << "\nRead & optimizing time: " << (endtime - starttime) / 1000 << " ms\n"; // Build themes StringArray themes; for (int i = 2; i < argc; i++) themes += argv[i]; lib.set_theme_list(themes); assert(lib.OK()); if (VSEFlags::assert_library_ok) assert(lib.OK()); if (VSEFlags::dump_library) std::cout << lib; if (VSEFlags::dump_tree) lib.dumpTree(std::cout); if (VSEFlags::suppress_eval) return EXIT_SUCCESS; // Fetch last function def (typically "main") VSLDef *def = lib.lastdef(); if (def == 0) { std::cerr << argv[0] << ": cannot find last definition (sorry)\n"; return EXIT_FAILURE; } // Eval function ListBox *arg = vsl_args(argc, argv); starttime = clock(); for (int loop = 1; loop < VSEFlags::loops; loop++) { Box *result = (Box *)def->eval(arg); lib.output(result); result->unlink(); } Box *result = (Box *)def->eval(arg); lib.output(result); endtime = clock(); arg->unlink(); // Show eval time if (VSEFlags::show_eval_time) std::cout << "\nEvaluation time: " << (endtime - starttime) / 1000 << " ms\n"; if (result && VSEFlags::dump_picture) std::cout << "#!" << argv[0] << "\n#include <std.vsl>\n\nmain() -> " << *result << ";\n"; thebox = result; // Stack and library are destroyed upon leaving this block } if (thebox && !thebox->size().isValid()) { std::cerr << argv[0] << ": result has no size (maybe list?)\n"; thebox->unlink(); thebox = 0; } if (thebox == 0) { std::cerr << argv[0] << ": evaluation failed (sorry)\n"; return EXIT_FAILURE; } // Realize Widget XtRealizeWidget(toplevel); // Process events XtAppMainLoop(app_con); // Never reached... return EXIT_SUCCESS; }
CoXHelpMotif::CoXHelpMotif( Widget xa_parent_wid, void *xa_parent_ctx, xhelp_eUtility utility, int *xa_sts) : CoXHelp(xa_parent_ctx,utility,xa_sts), parent_wid(xa_parent_wid) { char uid_filename[120] = {"xtt_xhelp.uid"}; char *uid_filename_p = uid_filename; Arg args[20]; pwr_tStatus sts; char title[80]; int i; MrmHierarchy s_DRMh; MrmType dclass; char name[] = "Proview/R Navigator"; static char translations[] = "<FocusIn>: xhelp_inputfocus()\n"; static XtTranslations compiled_translations = NULL; static XtActionsRec actions[] = { {(char*) "xhelp_inputfocus", (XtActionProc) CoXHelpMotif::action_inputfocus} }; static MrmRegisterArg reglist[] = { {(char*) "xhelp_ctx", 0 }, {(char*) "xhelp_activate_exit",(caddr_t)CoXHelpMotif::activate_exit }, {(char*) "xhelp_activate_zoom_in",(caddr_t)CoXHelpMotif::activate_zoom_in }, {(char*) "xhelp_activate_zoom_out",(caddr_t)CoXHelpMotif::activate_zoom_out }, {(char*) "xhelp_activate_zoom_reset",(caddr_t)CoXHelpMotif::activate_zoom_reset }, {(char*) "xhelp_activate_search",(caddr_t)CoXHelpMotif::activate_search }, {(char*) "xhelp_activate_searchnext",(caddr_t)CoXHelpMotif::activate_searchnext }, {(char*) "xhelp_activate_searchprevious",(caddr_t)CoXHelpMotif::activate_searchprevious }, {(char*) "xhelp_activate_india_ok",(caddr_t)CoXHelpMotif::activate_india_ok }, {(char*) "xhelp_activate_india_cancel",(caddr_t)CoXHelpMotif::activate_india_cancel }, {(char*) "xhelp_create_india_label",(caddr_t)CoXHelpMotif::create_india_label }, {(char*) "xhelp_create_india_text",(caddr_t)CoXHelpMotif::create_india_text }, {(char*) "xhelp_activate_help",(caddr_t)CoXHelpMotif::activate_help }, {(char*) "xhelp_create_xhelpnav_form",(caddr_t)CoXHelpMotif::create_xhelpnav_form } }; static int reglist_num = (sizeof reglist / sizeof reglist[0]); Lng::get_uid( uid_filename, uid_filename); // Motif MrmInitialize(); strcpy( title, Lng::translate("Help")); reglist[0].value = (caddr_t) this; // Save the context structure in the widget i = 0; XtSetArg (args[i], XmNuserData, (XtPointer) this);i++; XtSetArg( args[i], XmNdeleteResponse, XmDO_NOTHING);i++; sts = MrmOpenHierarchy( 1, &uid_filename_p, NULL, &s_DRMh); if (sts != MrmSUCCESS) printf("can't open %s\n", uid_filename); MrmRegisterNames(reglist, reglist_num); parent_wid = XtCreatePopupShell( title, topLevelShellWidgetClass, parent_wid, args, i); sts = MrmFetchWidgetOverride( s_DRMh, (char*) "xhelp_window", parent_wid, name, args, 1, &toplevel, &dclass); if (sts != MrmSUCCESS) printf("can't fetch %s\n", name); sts = MrmFetchWidget(s_DRMh, (char*) "input_dialog", toplevel, &india_widget, &dclass); if (sts != MrmSUCCESS) printf("can't fetch input dialog\n"); MrmCloseHierarchy(s_DRMh); if (compiled_translations == NULL) XtAppAddActions( XtWidgetToApplicationContext(toplevel), actions, XtNumber(actions)); if (compiled_translations == NULL) compiled_translations = XtParseTranslationTable(translations); XtOverrideTranslations( toplevel, compiled_translations); i = 0; XtSetArg(args[i],XmNwidth,500);i++; XtSetArg(args[i],XmNheight,700);i++; XtSetValues( toplevel ,args,i); XtManageChild( toplevel); xhelpnav = new CoXHelpNavMotif( (void *)this, xhelpnav_form, title, utility, &brow_widget, &sts); xhelpnav->open_URL_cb = CoXHelp::open_URL; // XtPopup( parent_wid, XtGrabNone); // displayed = 1; XtRealizeWidget( parent_wid); // Connect the window manager close-button to exit flow_AddCloseVMProtocolCb( parent_wid, (XtCallbackProc)CoXHelpMotif::activate_exit, this); *xa_sts = 1; }
void ScreenDialog(XF86SetupInfo *info) { static Widget dialog, d1, d4, d8, d16, d24, labelRotate, cw, ccw; Arg args[2]; XF86ConfMonitorPtr mon = screen->scrn_monitor; XF86ConfModeLinePtr mline = mon != NULL ? mon->mon_modeline_lst : NULL; int i; #ifdef USE_MODULES xf86cfgModuleOptions *drv_opts = module_options; Bool foundRotate = False; #endif while (nmodes > 0) XtFree(modes[--nmodes]); XtFree((XtPointer)modes); modes = NULL; while (mline) { if (nmodes % 16 == 0) modes = (char**)XtRealloc((XtPointer)modes, sizeof(char*) * (nmodes + 16)); modes[nmodes++] = XtNewString(mline->ml_identifier); mline = (XF86ConfModeLinePtr)(mline->list.next); } for (i = 0; i < sizeof(standard_modes) / sizeof(standard_modes[0]); i++) { if (nmodes % 16 == 0) modes = (char**)XtRealloc((XtPointer)modes, sizeof(char*) * (nmodes + 16)); modes[nmodes++] = XtNewString(standard_modes[i]); } if (dialog == NULL) { Widget command, viewport; dialog = XtCreateWidget("screenD", formWidgetClass, configp, NULL, 0); XtCreateManagedWidget("depthL", labelWidgetClass, dialog, NULL, 0); d1 = XtCreateManagedWidget("1", toggleWidgetClass, dialog, NULL, 0); XtAddCallback(d1, XtNcallback, DepthCallback, (XtPointer)1); d4 = XtVaCreateManagedWidget("4", toggleWidgetClass, dialog, XtNradioGroup, d1, NULL); XtAddCallback(d4, XtNcallback, DepthCallback, (XtPointer)4); d8 = XtVaCreateManagedWidget("8", toggleWidgetClass, dialog, XtNradioGroup, d4, NULL); XtAddCallback(d8, XtNcallback, DepthCallback, (XtPointer)8); d16 = XtVaCreateManagedWidget("16", toggleWidgetClass, dialog, XtNradioGroup, d8, NULL); XtAddCallback(d16, XtNcallback, DepthCallback, (XtPointer)16); d24 = XtVaCreateManagedWidget("24", toggleWidgetClass, dialog, XtNradioGroup, d16, NULL); XtAddCallback(d24, XtNcallback, DepthCallback, (XtPointer)24); XtCreateManagedWidget("modeL", labelWidgetClass, dialog, NULL, 0); viewport = XtCreateManagedWidget("viewL", viewportWidgetClass, dialog, NULL, 0); listL = XtCreateManagedWidget("listLeft", listWidgetClass, viewport, NULL, 0); XtAddCallback(listL, XtNcallback, SelectIndexCallback, NULL); command = XtCreateManagedWidget("select", commandWidgetClass, dialog, NULL, 0); XtAddCallback(command, XtNcallback, SelectCallback, NULL); command = XtCreateManagedWidget("unselect", commandWidgetClass, dialog, NULL, 0); XtAddCallback(command, XtNcallback, UnselectCallback, NULL); command = XtCreateManagedWidget("up", commandWidgetClass, dialog, NULL, 0); XtAddCallback(command, XtNcallback, MoveCallback, (XtPointer)False); command = XtCreateManagedWidget("down", commandWidgetClass, dialog, NULL, 0); XtAddCallback(command, XtNcallback, MoveCallback, (XtPointer)True); viewport = XtCreateManagedWidget("viewR", viewportWidgetClass, dialog, NULL, 0); listR = XtCreateManagedWidget("listRight", listWidgetClass, viewport, NULL, 0); XtAddCallback(listR, XtNcallback, UnselectIndexCallback, NULL); labelRotate = XtCreateManagedWidget("rotate", labelWidgetClass, dialog, NULL, 0); cw = XtCreateManagedWidget("CW", toggleWidgetClass, dialog, NULL, 0); XtAddCallback(cw, XtNcallback, RotateCallback, (XtPointer)CW); ccw = XtVaCreateManagedWidget("CCW", toggleWidgetClass, dialog, XtNradioGroup, cw, NULL); XtAddCallback(ccw, XtNcallback, RotateCallback, (XtPointer)CCW); XtRealizeWidget(dialog); } #ifdef USE_MODULES if (!nomodules) { while (drv_opts) { if (drv_opts->type == VideoModule && strcmp(drv_opts->name, screen->scrn_device->dev_driver) == 0) { OptionInfoPtr opts = drv_opts->option; while (opts->name) { if (xf86nameCompare(opts->name, "Rotate") == 0) { foundRotate = True; break; } opts++; } break; } drv_opts = drv_opts->next; } if (!foundRotate) { XtUnmapWidget(labelRotate); XtUnmapWidget(cw); XtUnmapWidget(ccw); } else { XtMapWidget(labelRotate); XtMapWidget(cw); XtMapWidget(ccw); } } #else (void)labelRotate; #endif if (rotate == CW) { XtVaSetValues(cw, XtNstate, True, NULL); XtVaSetValues(ccw, XtNstate, False, NULL); } else if (rotate == CCW) { XtVaSetValues(cw, XtNstate, False, NULL); XtVaSetValues(ccw, XtNstate, True, NULL); } else { XtVaSetValues(cw, XtNstate, False, NULL); XtVaSetValues(ccw, XtNstate, False, NULL); } XtSetArg(args[0], XtNlist, modes); XtSetArg(args[1], XtNnumberStrings, nmodes); XtSetValues(listL, args, 2); XtSetArg(args[0], XtNlist, defmodes); XtSetArg(args[1], XtNnumberStrings, ndefmodes); XtSetValues(listR, args, 2); XtSetArg(args[0], XtNstate, True); XtSetValues(default_depth == 1 ? d1 : default_depth == 4 ? d4 : default_depth == 16 ? d16 : default_depth == 24 ? d24 : d8, args, 1); XtChangeManagedSet(¤t, 1, NULL, NULL, &dialog, 1); current = dialog; }
static int motTabsMapMethod(Ihandle* ih) { int num_args = 0; Arg args[30]; if (!ih->parent) return IUP_ERROR; /* Core */ iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */ iupmotSetArg(args, num_args, XmNx, 0); /* x-position */ iupmotSetArg(args, num_args, XmNy, 0); /* y-position */ iupmotSetArg(args, num_args, XmNwidth, 10); /* default width to avoid 0 */ iupmotSetArg(args, num_args, XmNheight, 10); /* default height to avoid 0 */ /* Manager */ iupmotSetArg(args, num_args, XmNshadowThickness, 0); iupmotSetArg(args, num_args, XmNtraversalOn, True); iupmotSetArg(args, num_args, XmNhighlightThickness, 0); /* Notebook */ iupmotSetArg(args, num_args, XmNbindingType, XmNONE); iupmotSetArg(args, num_args, XmNbindingWidth, 0); iupmotSetArg(args, num_args, XmNfirstPageNumber, 0); /* IupTabs index always starts with zero */ iupmotSetArg(args, num_args, XmNbackPageSize, 0); iupmotSetArg(args, num_args, XmNbackPageNumber, 1); iupmotSetArg(args, num_args, XmNframeShadowThickness, 2); ih->handle = XtCreateManagedWidget( iupDialogGetChildIdStr(ih), /* child identifier */ xmNotebookWidgetClass, /* widget class */ iupChildTreeGetNativeParentHandle(ih), /* widget parent */ args, num_args); if (!ih->handle) return IUP_ERROR; ih->serial = iupDialogGetChildId(ih); /* must be after using the string */ /* Disable page scroller */ { Widget scroller; scroller = XtNameToWidget(ih->handle, "*PageScroller"); XtUnmanageChild(scroller); } /* Callbacks */ XtAddCallback(ih->handle, XmNpageChangedCallback, (XtCallbackProc)motTabsPageChangedCallback, (XtPointer)ih); XtAddCallback(ih->handle, XmNhelpCallback, (XtCallbackProc)iupmotHelpCallback, (XtPointer)ih); /* update Tab position */ motTabsUpdateTabType(ih); /* current value is now given by the native system */ iupAttribSetStr(ih, "_IUPTABS_VALUE_HANDLE", NULL); /* initialize the widget */ XtRealizeWidget(ih->handle); /* Create pages and tabs */ if (ih->firstchild) { Ihandle* child; for (child = ih->firstchild; child; child = child->brother) motTabsChildAddedMethod(ih, child); } return IUP_NOERROR; }
int main(int argc, char **argv) { register int n; Arg args[MAX_ARGS]; XmString tcs; CommonTestInit(argc, argv); n = 0; XtSetArg(args[n], XmNwidth, 200); n++; XtSetArg(args[n], XmNheight, 40); n++; XtSetValues(Shell1, args, n); XtRealizeWidget(Shell1); /* ** MenuBar1 */ MenuBar1 = CreateMenuBar(Shell1, "MenuBar1"); PullDown1 = CreatePullDown(MenuBar1, "PullDown1"); MenuBtn1 = CreateCascade("Menu1", '1', PullDown1, MenuBar1); PullDown2 = CreatePullDown(MenuBar1, "PullDown2"); MenuBtn2 = CreateCascade("Menu2", '2', PullDown2, MenuBar1); PullDown3 = CreatePullDown(MenuBar1, "PullDown3"); MenuBtn3 = CreateCascade("Menu3", '3', PullDown3, MenuBar1); /* ** Menu1 */ Label1 = CreateLabelGadget("Menu1", PullDown1); Separator1 = CreateSeparatorGadget(PullDown1, "Separator1"); PushBtn1 = CreatePushButtonGadget("pushbutton1", 'p', PullDown1); ToggleBtn1 = CreateToggleGadget("toggle1", 't', PullDown1); PullDown1A = CreatePullDown(PullDown1, "PullDown1A"); CascadeBtn1 = CreateCascadeGadget("cascade1", 'c', PullDown1A, PullDown1); /* ** Menu2 */ Label2 = CreateLabelGadget("Menu2", PullDown2); Separator2 = CreateSeparatorGadget(PullDown2, "Separator2"); ToggleBtn2 = CreateToggleGadget("toggle2", 't', PullDown2); Separator3 = CreateSeparatorGadget(PullDown2, "Separator3"); PullDown2A = CreatePullDown(PullDown2, "PullDown2A"); CascadeBtn2 = CreateCascadeGadget("cascade2", 'c', PullDown2A, PullDown2); Separator4 = CreateSeparatorGadget(PullDown2, "Separator4"); PushBtn2 = CreatePushButtonGadget("pushButton2", 'p', PullDown2); /* ** Menu3 */ Label3 = CreateLabelGadget("Menu3", PullDown3); PullDown3A = CreatePullDown(PullDown3, "PullDown3A"); CascadeBtn3 = CreateCascadeGadget("cascade3", 'c', PullDown3A, PullDown3); PushBtn3 = CreatePushButtonGadget("pushbutton3", 'p', PullDown3); ToggleBtn3 = CreateToggleGadget("toggle3", 't', PullDown3); /* ** Menu1A */ Label1A = CreateLabelGadget("Menu1A", PullDown1A); Separator1A = CreateSeparatorGadget(PullDown1A, "Separator1A"); PushBtn1A = CreatePushButtonGadget("pushbutton1A", 'A', PullDown1A); PushBtn1B = CreatePushButtonGadget("pushbutton1B", 'B', PullDown1A); PushBtn1C = CreatePushButtonGadget("pushbutton1C", 'C', PullDown1A); /* ** Menu2A */ Label2A = CreateLabelGadget("Menu2A", PullDown2A); Separator2A = CreateSeparatorGadget(PullDown2A, "Separator2A"); ToggleBtn2A = CreateToggleGadget("toggle2A", 'A', PullDown2A); ToggleBtn2B = CreateToggleGadget("toggle2B", 'B', PullDown2A); ToggleBtn2C = CreateToggleGadget("toggle2C", 'C', PullDown2A); /* ** Menu3A */ Label3A = CreateLabelGadget("Menu3A", PullDown3A); Separator3A = CreateSeparatorGadget(PullDown3A, "Separator3A"); PullDown3AA = CreatePullDown(PullDown3A, "PullDown3AA"); CascadeBtn3A = CreateCascadeGadget("cascade3A", 'A', PullDown3AA, PullDown3A); PullDown3BA = CreatePullDown(PullDown3A, "PullDown3BA"); CascadeBtn3B = CreateCascadeGadget("cascade3B", 'B', PullDown3BA, PullDown3A); PullDown3CA = CreatePullDown(PullDown3A, "PullDown3CA"); CascadeBtn3C = CreateCascadeGadget("cascade3C", 'C', PullDown3CA, PullDown3A); /* ** Menu3AA */ Label3AA = CreateLabelGadget("Menu3AA", PullDown3AA); Separator3AA = CreateSeparatorGadget(PullDown3AA, "Separator3AA"); PushBtn3AA = CreatePushButtonGadget("pushbutton3AA", 'p', PullDown3AA); /* ** Menu3BA */ Label3BA = CreateLabelGadget("Menu3BA", PullDown3BA); Separator3BA = CreateSeparatorGadget(PullDown3BA, "Separator3BA"); ToggleBtn3BA = CreateToggleGadget("toggle3BA", 't', PullDown3BA); /* ** Menu3CA */ Label3CA = CreateLabelGadget("Menu3CA", PullDown3CA); Separator3CA = CreateSeparatorGadget(PullDown3CA, "Separator3CA"); PullDown3CAA = CreatePullDown(PullDown3CA, "PullDown3CAA"); CascadeBtn3CA = CreateCascadeGadget("cascade3CA", 'c', PullDown3CAA, PullDown3CA); /* ** Menu3CAA */ Label3CAA = CreateLabelGadget("Menu3CAA", PullDown3CAA); CommonPause(); CommonPause(); CommonPause(); CommonPause(); XtAppMainLoop(app_context); }
int main(int argc, char **argv) { Dimension len, bwid ; topLevel = XtAppInitialize(&app_ctx, "Rulerdemo", NULL,0, &argc, argv, fallback, NULL,0) ; dpy = XtDisplay(topLevel) ; XtAppAddActions(app_ctx, rulerdemo_actions, XtNumber(rulerdemo_actions)); mainPanel = XtVaCreateManagedWidget("mainPanel", formWidgetClass, topLevel, 0) ; topFrame = XtVaCreateManagedWidget("topFrame", mwFrameWidgetClass, mainPanel, XtNleft, XtChainLeft, XtNright, XtChainRight, XtNtop, XtChainTop, XtNbottom, XtChainTop, 0) ; topRuler = XtVaCreateManagedWidget("topRuler", mwRulerWidgetClass, topFrame, XtNorientation, NorthGravity, 0) ; XtAddCallback(topRuler, XtNcallback, RulerCB, NULL) ; leftFrame = XtVaCreateManagedWidget("leftFrame", mwFrameWidgetClass, mainPanel, XtNleft, XtChainLeft, XtNright, XtChainLeft, XtNtop, XtChainTop, XtNbottom, XtChainBottom, XtNfromVert, topFrame, 0) ; leftRuler = XtVaCreateManagedWidget("leftRuler", mwRulerWidgetClass, leftFrame, XtNorientation, WestGravity, 0) ; XtAddCallback(leftRuler, XtNcallback, RulerCB, NULL) ; /* yuk. Athena Form widget really sucks; I shouldn't have * to go through these gyrations. */ XtVaGetValues(leftRuler, XtNwidth, &len, 0) ; XtVaGetValues(leftFrame, XtNshadowWidth, &bwid, 0) ; XtVaSetValues(topFrame, XtNhorizDistance, len+bwid*2, 0) ; canvas = XtVaCreateManagedWidget("canvas", coreWidgetClass, mainPanel, XtNleft, XtChainLeft, XtNright, XtChainRight, XtNtop, XtChainTop, XtNbottom, XtChainBottom, XtNfromHoriz, leftFrame, XtNfromVert, topFrame, 0) ; XtAddEventHandler(canvas, ExposureMask | ButtonPressMask | PointerMotionMask | EnterWindowMask | LeaveWindowMask, True, CanvasCB, NULL) ; XtRealizeWidget(topLevel) ; /* tell window system we're willing to handle window-delete messages */ wm_protocols = XInternAtom(dpy, "WM_PROTOCOLS", False); wm_delete_window = XInternAtom(dpy, "WM_DELETE_WINDOW", False); (void) XSetWMProtocols(dpy, XtWindow(topLevel), &wm_delete_window,1); MwRulerSetMinPosition(topRuler, 0., 0) ; XtVaGetValues(leftRuler, XtNheight, &len, 0) ; MwRulerSetMinPosition(leftRuler, 0., len-1) ; XtAppMainLoop(app_ctx) ; exit(0) ; }
void main( int argc, char *argv[] ) { Widget Form, RowColumn, ToggleB[NUM_FONTS], PushB; Arg args[25]; int n, i; XmString tmp_string; char buffer[25]; CommonTestInit( argc, argv ); n = 0; XtSetArg( args[n], XmNallowShellResize, True ); n++; XtSetValues( Shell1, args, n ); n = 0; Form = XmCreateForm( Shell1, "Form", args, n ); XtManageChild( Form ); n = 0; XtSetArg( args[n], XmNtopAttachment, XmATTACH_FORM ); n++; XtSetArg( args[n], XmNleftAttachment, XmATTACH_FORM ); n++; XtSetArg( args[n], XmNrightAttachment, XmATTACH_FORM ); n++; XtSetArg( args[n], XmNresizeWidth, True ); n++; XtSetArg( args[n], XmNcolumns, 48 ); n++; XtSetArg( args[n], XmNrows, 4 ); n++; XtSetArg( args[n], XmNvalue, string1 ); n++; XtSetArg( args[n], XmNeditMode, XmMULTI_LINE_EDIT ); n++; XtSetArg( args[n], XmNfontList, CommonGetFontList("6x12")); n++; Text1 = XmCreateScrolledText( Form, "Text1", args, n ); XtManageChild( Text1 ); n = 0; XtSetArg( args[n], XmNtopAttachment, XmATTACH_WIDGET ); n++; XtSetArg( args[n], XmNtopWidget, Text1 ); n++; XtSetArg( args[n], XmNleftAttachment, XmATTACH_FORM ); n++; XtSetArg( args[n], XmNrightAttachment, XmATTACH_FORM ); n++; XtSetArg( args[n], XmNradioBehavior, True ); n++; RowColumn = XmCreateRowColumn( Form, "RowColumn", args, n ); XtManageChild( RowColumn ); for ( i = 0; i < NUM_FONTS; i++ ) { tmp_string = XmStringGenerate( font_names[i], XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL ); n = 0; XtSetArg( args[n], XmNlabelString, tmp_string ); n++; XtSetArg( args[n], XmNselectColor, CommonGetColor("green")); n++; if ( i == 0 ) { XtSetArg( args[n], XmNset, True ); n++; } sprintf( buffer, "ToggleB%d", i ); ToggleB[i] = XmCreateToggleButton( RowColumn, buffer, args, n ); XtAddCallback( ToggleB[i], XmNvalueChangedCallback, SetNewFont, (XtPointer)font_names[i] ); XmStringFree( tmp_string ); } XtManageChildren( ToggleB, NUM_FONTS ); tmp_string = XmStringGenerate( "Reset String", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL ); n = 0; XtSetArg( args[n], XmNtopAttachment, XmATTACH_WIDGET ); n++; XtSetArg( args[n], XmNtopWidget, RowColumn ); n++; XtSetArg( args[n], XmNleftAttachment, XmATTACH_FORM ); n++; XtSetArg( args[n], XmNrightAttachment, XmATTACH_FORM ); n++; XtSetArg( args[n], XmNlabelString, tmp_string ); n++; PushB = XmCreatePushButton( RowColumn, "PushB", args, n ); XtManageChild( PushB ); XtAddCallback( PushB, XmNactivateCallback, ResetString, Text1 ); XtRealizeWidget( Shell1 ); CommonPause(); /* * Shrink the width of the Text widget. */ n = 0; XtSetArg( args[n], XmNcolumns, 20 ); n++; XtSetArg( args[n], XmNresizeWidth, False ); n++; XtSetValues( Text1, args, n ); CommonPause(); CommonPause(); XtAppMainLoop( app_context ); }
void CreateWindow(Widget top, Display *pdpy, XPContext pctxt, Screen *scr) { Widget form, shell, tw; FILE *f; static char buffer[64000]; Arg al[20]; int ac; unsigned short wid, ht; XRectangle rect; Dimension width, height; short nrows = 80; int nlines = 481, npages, page, i; int save_data = XPGetData; /* * Here we are sure that printer name, print display, screen are * initialized, and a print context has been created. */ if (XpGetPageDimensions(pdpy, pctxt, &wid, &ht, &rect)) { fprintf(stderr, "Paper size is %d %d\n", wid, ht); } else { fprintf(stderr, "test8: failed to get Page Dimensions\n"); exit(1); } ac = 0; /* Size from paper size */ XtSetArg(al[ac], XmNheight, ht); ac++; XtSetArg(al[ac], XmNwidth, wid); ac++; shell = XmPrintSetup(top, scr, "Print", al, ac); /* start job must precede XpGetDocumentData in XmPrintToFile */ fprintf(stderr, "test8: XpStartJob\n"); XpStartJob(XtDisplay(shell), save_data); /* Maintain sequence StartJob - GetDocument */ XFlush(XtDisplay(shell)); XmPrintToFile(XtDisplay(shell), "test8.out", FinishPrintToFile, NULL); /* * Now we can get the size of the shell, create widgets, etc. */ XtVaGetValues(shell, XmNheight, &height, XmNwidth, &width, NULL); /* * Create a text widget as big as the page */ fprintf(stderr, "test8: XmCreateText(wid %d ht %d)\n", width, height); ac=0; XtSetArg(al[ac], XmNheight, height); ac++; XtSetArg(al[ac], XmNwidth, width); ac++; form = XmCreateForm(shell, "form", al, ac); XtManageChild(form); /* Re-use settings from above */ XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; tw = XmCreateText(form, "tw", al, ac); XtManageChild(tw); /* * Get some data in here - the LGPL text (you probably * need to be in the LessTif source tree for this to work). */ for (i=0; i<10; i++) { f = fopen("COPYING.LIB", "r"); if (f) break; chdir(".."); } if (f) { fread(buffer, 1, sizeof(buffer), f); fclose(f); } XmTextSetString(tw, buffer); XmTextShowPosition(tw, 0); fprintf(stderr, "test8: XtRealizeWidget()\n"); XtRealizeWidget(shell); /* Get data to calculate number of pages to print */ XtVaGetValues(tw, XmNrows, &nrows, XmNtotalLines, &nlines, NULL); /* Calculate number of pages to print */ npages = nlines / nrows + 1; fprintf(stderr, "Text lines %d rows %d pages %d\n", nlines, nrows, npages); for (page = 0; page < npages; page++) { XpStartPage(XtDisplay(shell), XtWindow(shell)); fprintf(stderr, "test8: XmRedisplayWidget\n"); XmRedisplayWidget(tw); /* works !! */ /* Calling XmRedisplayWidget() only works for * widgets that have an expose() method. This simple * point is documented in the XmRedisplayWidget docs. * Not so obvious consequence is what to do with other * widgets. It seems to be up to the application * programmer to figure out which widget to use. * * Calling it on a shell or on a form won't work. XmRedisplayWidget(shell); */ XpEndPage(XtDisplay(shell)); if (XmIsText(tw)) XmTextScroll(tw, nrows); } XpEndJob(XtDisplay(shell)); }
static int motTextMapMethod(Ihandle* ih) { int num_args = 0; Arg args[30]; Widget parent = iupChildTreeGetNativeParentHandle(ih); char* child_id = iupDialogGetChildIdStr(ih); int spin = 0; WidgetClass widget_class = xmTextWidgetClass; if (ih->data->is_multiline) { Widget sb_win; int wordwrap = 0; if (iupAttribGetBoolean(ih, "WORDWRAP")) { wordwrap = 1; ih->data->sb &= ~IUP_SB_HORIZ; /* must remove the horizontal scroolbar */ } /******************************/ /* Create the scrolled window */ /******************************/ iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */ iupMOT_SETARG(args, num_args, XmNscrollingPolicy, XmAPPLICATION_DEFINED); iupMOT_SETARG(args, num_args, XmNvisualPolicy, XmVARIABLE); iupMOT_SETARG(args, num_args, XmNscrollBarDisplayPolicy, XmSTATIC); /* can NOT be XmAS_NEEDED because XmAPPLICATION_DEFINED */ iupMOT_SETARG(args, num_args, XmNspacing, 0); /* no space between scrollbars and text */ iupMOT_SETARG(args, num_args, XmNborderWidth, 0); iupMOT_SETARG(args, num_args, XmNshadowThickness, 0); sb_win = XtCreateManagedWidget( child_id, /* child identifier */ xmScrolledWindowWidgetClass, /* widget class */ parent, /* widget parent */ args, num_args); if (!sb_win) return IUP_ERROR; parent = sb_win; child_id = "text"; num_args = 0; iupMOT_SETARG(args, num_args, XmNeditMode, XmMULTI_LINE_EDIT); if (wordwrap) iupMOT_SETARG(args, num_args, XmNwordWrap, True); } else { widget_class = xmTextFieldWidgetClass; if (iupAttribGetBoolean(ih, "SPIN")) { Widget spinbox; num_args = 0; iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */ iupMOT_SETARG(args, num_args, XmNspacing, 0); /* no space between spin and text */ iupMOT_SETARG(args, num_args, XmNborderWidth, 0); iupMOT_SETARG(args, num_args, XmNshadowThickness, 0); iupMOT_SETARG(args, num_args, XmNmarginHeight, 0); iupMOT_SETARG(args, num_args, XmNmarginWidth, 0); iupMOT_SETARG(args, num_args, XmNarrowSize, 8); if (iupStrEqualNoCase(iupAttribGetStr(ih, "SPINALIGN"), "LEFT")) iupMOT_SETARG(args, num_args, XmNarrowLayout, XmARROWS_BEGINNING); else iupMOT_SETARG(args, num_args, XmNarrowLayout, XmARROWS_END); spinbox = XtCreateManagedWidget( child_id, /* child identifier */ xmSpinBoxWidgetClass, /* widget class */ parent, /* widget parent */ args, num_args); if (!spinbox) return IUP_ERROR; XtAddCallback(spinbox, XmNmodifyVerifyCallback, (XtCallbackProc)motTextSpinModifyVerifyCallback, (XtPointer)ih); parent = spinbox; child_id = "text"; spin = 1; if (!iupAttribGetBoolean(ih, "SPINAUTO")) iupAttribSet(ih, "_IUPMOT_SPIN_NOAUTO", "1"); } num_args = 0; iupMOT_SETARG(args, num_args, XmNeditMode, XmSINGLE_LINE_EDIT); if (spin) { /* Spin Constraints */ iupMOT_SETARG(args, num_args, XmNspinBoxChildType, XmNUMERIC); iupMOT_SETARG(args, num_args, XmNminimumValue, 0); iupMOT_SETARG(args, num_args, XmNmaximumValue, 100); iupMOT_SETARG(args, num_args, XmNposition, 0); if (iupAttribGetBoolean(ih, "SPINWRAP")) iupMOT_SETARG(args, num_args, XmNwrap, TRUE); else iupMOT_SETARG(args, num_args, XmNwrap, FALSE); } else { iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */ } } iupMOT_SETARG(args, num_args, XmNx, 0); /* x-position */ iupMOT_SETARG(args, num_args, XmNy, 0); /* y-position */ iupMOT_SETARG(args, num_args, XmNwidth, 10); /* default width to avoid 0 */ iupMOT_SETARG(args, num_args, XmNheight, 10); /* default height to avoid 0 */ iupMOT_SETARG(args, num_args, XmNmarginHeight, 0); /* default padding */ iupMOT_SETARG(args, num_args, XmNmarginWidth, 0); if (iupAttribGetBoolean(ih, "CANFOCUS")) iupMOT_SETARG(args, num_args, XmNtraversalOn, True); else iupMOT_SETARG(args, num_args, XmNtraversalOn, False); iupMOT_SETARG(args, num_args, XmNnavigationType, XmTAB_GROUP); iupMOT_SETARG(args, num_args, XmNhighlightThickness, 2); iupMOT_SETARG(args, num_args, XmNverifyBell, False); iupMOT_SETARG(args, num_args, XmNspacing, 0); if (iupAttribGetBoolean(ih, "BORDER")) iupMOT_SETARG(args, num_args, XmNshadowThickness, 2); else iupMOT_SETARG(args, num_args, XmNshadowThickness, 0); if (ih->data->is_multiline) { if (ih->data->sb & IUP_SB_HORIZ) iupMOT_SETARG(args, num_args, XmNscrollHorizontal, True); else iupMOT_SETARG(args, num_args, XmNscrollHorizontal, False); if (ih->data->sb & IUP_SB_VERT) iupMOT_SETARG(args, num_args, XmNscrollVertical, True); else iupMOT_SETARG(args, num_args, XmNscrollVertical, False); } ih->handle = XtCreateManagedWidget( child_id, /* child identifier */ widget_class, /* widget class */ parent, /* widget parent */ args, num_args); if (!ih->handle) return IUP_ERROR; ih->serial = iupDialogGetChildId(ih); /* must be after using the string */ if (ih->data->is_multiline) { iupAttribSet(ih, "_IUP_EXTRAPARENT", (char*)parent); XtVaSetValues(parent, XmNworkWindow, ih->handle, NULL); } else if (spin) iupAttribSet(ih, "_IUP_EXTRAPARENT", (char*)parent); XtAddCallback(ih->handle, XmNhelpCallback, (XtCallbackProc)iupmotHelpCallback, (XtPointer)ih); XtAddEventHandler(ih->handle, EnterWindowMask, False, (XtEventHandler)iupmotEnterLeaveWindowEvent, (XtPointer)ih); XtAddEventHandler(ih->handle, LeaveWindowMask, False, (XtEventHandler)iupmotEnterLeaveWindowEvent, (XtPointer)ih); XtAddEventHandler(ih->handle, FocusChangeMask, False, (XtEventHandler)iupmotFocusChangeEvent, (XtPointer)ih); XtAddEventHandler(ih->handle, KeyPressMask, False, (XtEventHandler)motTextKeyPressEvent, (XtPointer)ih); XtAddEventHandler(ih->handle, PointerMotionMask, False, (XtEventHandler)iupmotPointerMotionEvent, (XtPointer)ih); XtAddEventHandler(ih->handle, ButtonPressMask|ButtonReleaseMask, False, (XtEventHandler)iupmotButtonPressReleaseEvent, (XtPointer)ih); XtAddCallback(ih->handle, XmNmodifyVerifyCallback, (XtCallbackProc)motTextModifyVerifyCallback, (XtPointer)ih); XtAddCallback(ih->handle, XmNmotionVerifyCallback, (XtCallbackProc)motTextMotionVerifyCallback, (XtPointer)ih); XtAddCallback(ih->handle, XmNvalueChangedCallback, (XtCallbackProc)motTextValueChangedCallback, (XtPointer)ih); /* initialize the widget */ if (ih->data->is_multiline || spin) XtRealizeWidget(parent); else XtRealizeWidget(ih->handle); if (IupGetGlobal("_IUP_RESET_TXTCOLORS")) { iupmotSetGlobalColorAttrib(ih->handle, XmNbackground, "TXTBGCOLOR"); iupmotSetGlobalColorAttrib(ih->handle, XmNforeground, "TXTFGCOLOR"); IupSetGlobal("_IUP_RESET_TXTCOLORS", NULL); } IupSetCallback(ih, "_IUP_XY2POS_CB", (Icallback)motTextConvertXYToPos); return IUP_NOERROR; }