void appIcon_Init(Widget* w_TopLevel, int argc, char* argv[]) { Position x, y; Dimension w, h; appLList = (struct NODE *)malloc(sizeof(struct NODE)); appLList->ptrData = NULL; appLList->next = NULL; XtSetLanguageProc (NULL, NULL, NULL); *w_TopLevel = XtVaOpenApplication (&GXIM_App, "gXipmsg", NULL, 0, &argc, argv, NULL,sessionShellWidgetClass, NULL); APPICON_Form = XmCreateForm (*w_TopLevel, "ipmsgForm", NULL, 0); // Create list holder APPICON_List_Users = XmCreateScrolledList (APPICON_Form, "List", NULL, 0); XtVaGetValues (APPICON_Form, XmNforeground, &fg, XmNbackground, &bg, NULL); pixmap =XmGetPixmap (XtScreen (APPICON_Form), "ipmsg.xpm", fg, bg); if(pixmap == XmUNSPECIFIED_PIXMAP) { pixmap = XmGetPixmap (XtScreen (APPICON_Form), "/etc/gXipmsg/ipmsg.xpm", fg, bg); } // Create icon button n = 0; XtSetArg (args[n], XmNlabelType, XmPIXMAP); n++; XtSetArg (args[n], XmNlabelPixmap, pixmap); n++; APPICON_BtnG_Icon = XmCreatePushButtonGadget (APPICON_Form, "ipmsgButton", args, n); XtAddCallback (APPICON_BtnG_Icon, XmNactivateCallback, appIcon_IconCallBack, APPICON_List_Users); XtManageChild (APPICON_BtnG_Icon); XtManageChild (APPICON_Form); x = WidthOfScreen (XtScreen (*w_TopLevel)); y = HeightOfScreen (XtScreen (*w_TopLevel)); XtVaGetValues(*w_TopLevel, XmNwidth, &w, XmNheight, &h, NULL); x = x - (w+150); y = y - (h+150); XtVaSetValues (*w_TopLevel, XmNmwmDecorations, MWM_DECOR_TITLE | MWM_DECOR_MENU, XmNmwmFunctions, MWM_FUNC_CLOSE | MWM_FUNC_MOVE, XmNtitle, "gXip", XmNx, x, XmNy, y, NULL); // Materialize major widgets XtRealizeWidget (*w_TopLevel); }
static void mytest(Widget w, XtPointer p, XtPointer s) { Pixel fg, bg; int height, width; Pixmap pixmap; printf("hi\n"); XtVaGetValues(w, XmNwidth, &width, XmNheight, &height, NULL); printf("height == %d, width == %d\n", height, width); fg = XBlackPixelOfScreen(XtScreen(w)); bg = XWhitePixelOfScreen(XtScreen(w)); pixmap = XmGetPixmap(XtScreen(w), "xlogo64", fg, bg); XtVaSetValues(w, XmNwidth, 0, XmNheight, 0, XmNlabelPixmap, pixmap, XmNlabelType,XmPIXMAP, NULL); XtVaGetValues(w, XmNwidth, &width, XmNheight, &height, NULL); printf("height == %d, width == %d\n", height, width); }
static Pixmap ConvertPixmap(char *file_name, int depth) #endif { XrmValue fg_from, fg_to, bg_from, bg_to; Pixel fg, bg; fg_from.size = strlen(XtDefaultForeground); fg_from.addr = XtDefaultForeground; fg_to.addr = (XPointer) & fg; bg_from.size = strlen(XtDefaultBackground); bg_from.addr = XtDefaultBackground; bg_to.addr = (XPointer) & bg; if (!XtConvertAndStore (UxTopLevel, XtRString, &bg_from, XtRPixel, &bg_to) || !XtConvertAndStore (UxTopLevel, XtRString, &fg_from, XtRPixel, &fg_to) || (fg == bg)) { fg = WhitePixelOfScreen(XtScreen(UxTopLevel)); bg = BlackPixelOfScreen(XtScreen(UxTopLevel)); } if (depth) return (XmGetPixmapByDepth (XtScreen(UxTopLevel), file_name, fg, bg, depth)); else return (XmGetPixmap(XtScreen(UxTopLevel), file_name, fg, bg)); }
// Convert String to Pixmap (using XmGetPixmap) // A Pixmap will be read in as bitmap file // 1 and 0 values are set according to the widget's // foreground/background colors. static Boolean CvtStringToPixmap(Display *display, XrmValue *args, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, XtPointer *) { // Default parameters Screen *screen = DefaultScreenOfDisplay(display); Pixel background = WhitePixelOfScreen(screen); Pixel foreground = BlackPixelOfScreen(screen); if (*num_args >= 1) { // convert first arg into widget Widget w = *(Widget *) args[0].addr; background = w->core.background_pixel; screen = XtScreen(w); if (XtIsWidget(w) && XmIsPrimitive(w)) { // Get foreground color from widget foreground = XmPrimitiveWidget(w)->primitive.foreground; } else { // Ask Motif for a default foreground color Pixel newfg, newtop, newbot, newselect; XmGetColors(screen, w->core.colormap, background, &newfg, &newtop, &newbot, &newselect); foreground = newfg; } } // Get pixmap Pixmap p = XmUNSPECIFIED_PIXMAP; string value = str(fromVal, false); // Some Motif versions use `unspecified_pixmap' and `unspecified pixmap' // as values for XmUNSPECIFIED_PIXMAP. Check for this. string v = downcase(value); v.gsub(" ", "_"); if (v.contains("xm", 0)) v = v.after("xm"); if (v != "unspecified_pixmap") { p = XmGetPixmap(screen, XMST(value.chars()), foreground, background); if (p == XmUNSPECIFIED_PIXMAP) { XtDisplayStringConversionWarning(display, fromVal->addr, XmRPixmap); return False; } } done(Pixmap, p); }
int main(int argc, char **argv) { XtAppContext theApp; Widget label; Pixel fg,bg; toplevel = XtVaAppInitialize(&theApp, "drawingArea", NULL, 0, &argc, argv, NULL, NULL); label= XtVaCreateManagedWidget("Button1", xmPushButtonWidgetClass, toplevel, NULL); XtRealizeWidget(toplevel); theDisplay = XtDisplay(toplevel); theRootWindow = XDefaultRootWindow(theDisplay); fg = XBlackPixelOfScreen(DefaultScreenOfDisplay(theDisplay)); bg = XWhitePixelOfScreen(DefaultScreenOfDisplay(theDisplay)); Pix = XmGetPixmap(DefaultScreenOfDisplay(theDisplay), "xlogo64", fg, bg); XtVaSetValues(label, XmNlabelPixmap,Pix, XmNlabelType,XmPIXMAP, NULL); { static XtWidgetGeometry Expected[] = { CWWidth | CWHeight, 0, 0, 54, 25, 0,0,0, /* Form */ CWWidth | CWHeight | CWX | CWY, 45, 30, 30, 25, 0,0,0, /* two */ }; PrintDetails(toplevel, Expected); } fprintf(stderr, "Button %p VendorExt %p ButtonFontList %p TextFontList %p (r %p) LabelFontList %p\n", label, _LtFindVendorExt(label), ((XmVendorShellExtObject)_LtFindVendorExt(label))->vendor.button_font_list, ((XmVendorShellExtObject)_LtFindVendorExt(label))->vendor.text_font_list, ((XmVendorShellExtObject)_LtFindVendorExt(label))->vendor.label_font_list, ((XmVendorShellExtObject)_LtFindVendorExt(label))->vendor.text_font_list->renditions[0]); LessTifTestMainLoop(toplevel); /* XtAppMainLoop(theApp); */ exit(0); }
int main(int argc, char **argv) { XtAppContext theApp; Widget toplevel; Widget butt; Pixmap pixmap; Pixel fg, bg; toplevel = XtVaAppInitialize(&theApp, "test3", NULL, 0, &argc, argv, NULL, NULL); fg = XBlackPixelOfScreen(DefaultScreenOfDisplay(XtDisplay(toplevel))); bg = XWhitePixelOfScreen(DefaultScreenOfDisplay(XtDisplay(toplevel))); pixmap = XmGetPixmap(DefaultScreenOfDisplay(XtDisplay(toplevel)), "xlogo64", fg, bg); if (pixmap == XmUNSPECIFIED_PIXMAP) printf("Pixmap unspecified\n"); butt= XtVaCreateManagedWidget("Button1", xmDrawnButtonWidgetClass, toplevel, XmNwidth, 100, XmNheight, 100, XmNshadowThickness, 4, XmNshadowType, XmSHADOW_ETCHED_OUT, XmNlabelType, XmPIXMAP, XmNlabelPixmap, pixmap, NULL); XtRealizeWidget(toplevel); /* Note: the following values are the result of * querying the current geometry. */ { static XtWidgetGeometry Expected[] = { CWWidth | CWHeight , 0, 0, 100, 100, 0,0,0, /* Button1 */ }; /* toplevel should be replaced with to correct applicationShell */ PrintDetails(toplevel, Expected); } LessTifTestMainLoop(toplevel); exit(0); }
void* iupdrvImageLoad(const char* name, int type) { if (type == IUPIMAGE_CURSOR) { Cursor cursor = 0; int id; if (iupStrToInt(name, &id)) cursor = XCreateFontCursor(iupmot_display, id); return (void*)cursor; } else /* IUPIMAGE_IMAGE or IUPIMAGE_ICON */ { Screen* screen = ScreenOfDisplay(iupmot_display, iupmot_screen); Pixmap pixmap = XmGetPixmap(screen, (char*)name, BlackPixelOfScreen(screen), WhitePixelOfScreen(screen)); if (pixmap == XmUNSPECIFIED_PIXMAP) { unsigned int width, height; int hotx, hoty; pixmap = 0; XReadBitmapFile(iupmot_display, RootWindow(iupmot_display,iupmot_screen), name, &width, &height, &pixmap, &hotx, &hoty); } return (void*)pixmap; } }
WXPixmap wxBitmapCache::GetPixmapFromCache(WXWidget w) { Widget widget = (Widget)w; #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ while( XmIsGadget( widget ) ) widget = XtParent( widget ); WXPixel fg, bg; XtVaGetValues( widget, XmNbackground, &bg, XmNforeground, &fg, NULL ); Screen* screen = DefaultScreenOfDisplay( (Display*)m_display ); return (WXPixmap)XmGetPixmap(screen, GetCacheImageName(m_image).data(), fg, bg); }
int main(int argc, char **argv) { XtAppContext theApp; Widget label; Pixel fg,bg; XmFontList fontlist; toplevel = XtVaAppInitialize(&theApp, "drawingArea", NULL, 0, &argc, argv, Fallback, NULL); fontlist = XmFontListAppendEntry(NULL, XmFontListEntryCreate("MY_FONT", XmFONT_IS_FONT, XLoadQueryFont(XtDisplay(toplevel), "-adobe-helvetica-bold-o-normal--17-0-75-75-p-*-iso8859-1"))); fontlist = XmFontListAppendEntry(fontlist, XmFontListEntryCreate("MY_FONT1", XmFONT_IS_FONT, XLoadQueryFont(XtDisplay(toplevel), "-adobe-helvetica-bold-r-normal--17-0-75-75-p-*-iso8859-1"))); #if 0 label= XtVaCreateManagedWidget("Button1", xmLabelWidgetClass, toplevel, XmNfontList, fontlist, NULL); #else label= XtVaCreateManagedWidget("Button1", xmLabelWidgetClass, toplevel, NULL); #endif XtRealizeWidget(toplevel); theDisplay = XtDisplay(toplevel); theRootWindow = XDefaultRootWindow(theDisplay); fg = XBlackPixelOfScreen(DefaultScreenOfDisplay(theDisplay)); bg = XWhitePixelOfScreen(DefaultScreenOfDisplay(theDisplay)); Pix = XmGetPixmap(DefaultScreenOfDisplay(theDisplay), "xlogo64", fg, bg); if (Pix == XmUNSPECIFIED_PIXMAP) { printf("NO PIXMAP!\n"); exit(0); } XtVaSetValues(label, XmNlabelPixmap,Pix, XmNlabelType,XmPIXMAP, NULL); printf("%p\n", XmDragStart(label, NULL, NULL, 0)); { static XtWidgetGeometry Expected[] = { CWWidth | CWHeight , 57, 73, 46, 17, 0,0,0, /* Button1 */ }; PrintDetails( toplevel ,Expected); }; LessTifTestMainLoop( toplevel ); exit(0); }
static Pixmap get_pixmap (Widget w, char *name, Boolean notLast) { static char *names = (char *) NULL; static int nFailures = 0; Pixmap result; result = XmGetPixmap(XtScreen(w), name, BlackPixelOfScreen(XtScreen(root)), WhitePixelOfScreen(XtScreen(root))); if(result == XmUNSPECIFIED_PIXMAP) { /* try in PPHOME/bitmaps */ char * alt_name = (char*) XtMalloc( strlen(BITMAP_TMPL) + strlen(pp_home) + strlen(name) + 1); sprintf(alt_name, BITMAP_TMPL, pp_home, name); result = XmGetPixmap(XtScreen(w), alt_name, BlackPixelOfScreen(XtScreen(root)), WhitePixelOfScreen(XtScreen(root))); XtFree(alt_name); } if (result == XmUNSPECIFIED_PIXMAP) { nFailures++; if (nFailures == 1) { names = XtMalloc(template_table_bitmaps_size + (template_table_size * 4) + 4); if (names) { sprintf(names, "\"%s\"", name); } else { nFailures = 0; } } else { char *newNames; newNames = XtMalloc(template_table_bitmaps_size + (template_table_size * 4) + 4); if (newNames) { sprintf(newNames, "\"%s\"%s %s", name, (nFailures == 2) ? " and" : ",", names); strcpy(names, newNames); XtFree(newNames); } else { nFailures--; } } } if (! notLast && nFailures > 0) { char *msg; msg = XtMalloc(strlen(names) + strlen(bad_pixmap_msg)); if (msg) { sprintf(msg, bad_pixmap_msg, (nFailures == 1) ? "" : "s", names, (nFailures == 1) ? "a " : "", (nFailures == 1) ? "" : "s", (nFailures == 1) ? "a " : "", (nFailures == 1) ? "" : "s"); ok_dialog(w, msg); XtFree(msg); } else { ok_dialog(w, bad_pixmap_nomalloc_msg); } XtFree(names); names = (char *) NULL; nFailures = 0; } return result; }
static void repaint() { int win = winner(); for (int i = 1; i <= 9; i++) { const char *name = 0; switch (board[i]) { case NO_ONE: name = "empty"; break; case PLAYER1: name = "circle"; break; case PLAYER2: name = "cross"; break; } assert(name != 0); Pixel foreground; Pixel background; XtVaGetValues(buttons[i], XmNforeground, &foreground, XmNbackground, &background, XtPointer(0)); if (win == NO_ONE || winning[i]) { if (board[i] == PLAYER1) foreground = color(buttons[i], "red4", BlackPixelOfScreen(XtScreen(buttons[i]))); else foreground = BlackPixelOfScreen(XtScreen(buttons[i])); } Pixmap p = XmGetPixmap(XtScreen(buttons[i]), XMST(name), foreground, background); XtVaSetValues(buttons[i], XmNlabelType, XmPIXMAP, XmNlabelPixmap, p, XmNlabelInsensitivePixmap, p, XtPointer(0)); XtSetSensitive(buttons[i], win == NO_ONE && board[i] == NO_ONE); } switch (win) { case PLAYER1: set_status("You win."); break; case PLAYER2: set_status(DDD_NAME " wins."); break; case CATSEYE: set_status("Cat's eye."); break; } }
void create_ci_equiplist_shell (Widget parent) { Widget children[10]; /* Children to manage */ Arg al[64]; /* Arg List */ register int ac = 0; /* Arg Count */ Pixel fg, bg; /* colour values for pixmaps */ XmString xmstrings[16]; /* temporary storage for XmStrings */ XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++; XtSetArg(al[ac], XmNminWidth, 787); ac++; XtSetArg(al[ac], XmNminHeight, 496); ac++; ci_equiplist_shell = XtCreatePopupShell ( "ci_equiplist_shell", topLevelShellWidgetClass, parent, al, ac ); ac = 0; /* begin ci_equipinfo_form pre-creation code */ XtVaSetValues(ci_equiplist_shell, XmNiconPixmap, abp_icon, NULL) ; /* end ci_equipinfo_form pre-creation code */ XtSetArg(al[ac], XmNshadowType, XmSHADOW_OUT); ac++; XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++; ci_equiplist_form = XmCreateForm ( ci_equiplist_shell, "ci_equiplist_form", al, ac ); ac = 0; XtSetArg(al[ac], XmNshadowThickness, 2); ac++; XtSetArg(al[ac], XmNshadowType, XmSHADOW_OUT); ac++; ci_equip_account_form = XmCreateForm ( ci_equiplist_form, "ci_equip_account_form", al, ac ); ac = 0; ci_equip_account_id_lbl = XmCreateLabel ( ci_equip_account_form, "ci_equip_account_id_lbl", al, ac ); XtSetArg(al[ac], XmNmaxLength, 48); ac++; XtSetArg(al[ac], XmNcolumns, 48); ac++; ci_equip_accountid_txt = XmCreateText ( ci_equip_account_form, "ci_equip_accountid_txt", al, ac ); ac = 0; ci_equip_account_name_lbl = XmCreateLabel ( ci_equip_account_form, "ci_equip_account_name_lbl", al, ac ); XtSetArg(al[ac], XmNmaxLength, 40); ac++; XtSetArg(al[ac], XmNcolumns, 40); ac++; ci_equip_name_txt = XmCreateText ( ci_equip_account_form, "ci_equip_name_txt", al, ac ); ac = 0; XtSetArg(al[ac], XmNshadowThickness, 2); ac++; XtSetArg(al[ac], XmNshadowType, XmSHADOW_IN); ac++; ci_equiplist_filter_form = XmCreateForm ( ci_equiplist_form, "ci_equiplist_filter_form", al, ac ); ac = 0; XtSetArg(al[ac], XmNnavigationType, XmEXCLUSIVE_TAB_GROUP); ac++; XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++; XtSetArg(al[ac], XmNpacking, XmPACK_COLUMN); ac++; XtSetArg(al[ac], XmNentryAlignment, XmALIGNMENT_CENTER); ac++; ci_equip_filter_rc = XmCreateRowColumn ( ci_equiplist_filter_form, "ci_equip_filter_rc", al, ac ); ac = 0; XtSetArg(al[ac], XmNhighlightOnEnter, FALSE); ac++; ci_equip_filter_btn = XmCreatePushButton ( ci_equip_filter_rc, "ci_equip_filter_btn", al, ac ); ac = 0; xmstrings[0] = XmStringCreateLtoR("Reset", (XmStringCharSet)XmFONTLIST_DEFAULT_TAG); XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++; ci_equip_reset_btn = XmCreatePushButton ( ci_equip_filter_rc, "ci_equip_reset_btn", al, ac ); ac = 0; XmStringFree ( xmstrings [ 0 ] ); XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++; ci_equip_filter_equip_lbl = XmCreateLabel ( ci_equiplist_filter_form, "ci_equip_filter_equip_lbl", al, ac ); ac = 0; XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++; ci_equip_filter_status_lbl = XmCreateLabel ( ci_equiplist_filter_form, "ci_equip_filter_status_lbl", al, ac ); ac = 0; XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++; XtSetArg(al[ac], XmNmaxLength, 16); ac++; XtSetArg(al[ac], XmNcolumns, 16); ac++; XtSetArg(al[ac], XmNmarginHeight, 3); ac++; XtSetArg(al[ac], XmNmarginWidth, 3); ac++; ci_equip_filter_equip_txt = XmCreateText ( ci_equiplist_filter_form, "ci_equip_filter_equip_txt", al, ac ); ac = 0; XtSetArg(al[ac], XmNhighlightOnEnter, TRUE); ac++; XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++; XtSetArg(al[ac], XmNmaxLength, 10); ac++; XtSetArg(al[ac], XmNcolumns, 10); ac++; XtSetArg(al[ac], XmNmarginHeight, 3); ac++; XtSetArg(al[ac], XmNmarginWidth, 3); ac++; ci_filter_status_txt = XmCreateText ( ci_equiplist_filter_form, "ci_filter_status_txt", al, ac ); ac = 0; XtSetArg(al[ac], XmNmarginWidth, 0); ac++; XtSetArg(al[ac], XmNmarginHeight, 0); ac++; XtSetArg(al[ac], XmNlabelType, XmPIXMAP); ac++; ci_equip_status_btn = XmCreatePushButton ( ci_equiplist_filter_form, "ci_equip_status_btn", al, ac ); ac = 0; XtSetArg(al[ac], XmNforeground, &fg ); ac++; XtSetArg(al[ac], XmNbackground, &bg ); ac++; XtGetValues(ci_equip_status_btn, al, ac ); ac = 0; XtSetArg(al[ac], XmNlabelPixmap, XmGetPixmap ( XtScreen ( ci_equip_status_btn ), "down_arrow.xbm", fg, bg )); ac++; XtSetArg(al[ac], XmNlabelInsensitivePixmap, XmGetPixmap ( XtScreen ( ci_equip_status_btn ), "down_arrow.xbm", fg, bg )); ac++; XtSetValues ( ci_equip_status_btn,al, ac ); ac = 0; ci_filter_ckt_lbl = XmCreateLabel ( ci_equiplist_filter_form, "ci_filter_ckt_lbl", al, ac ); XtSetArg(al[ac], XmNmaxLength, 16); ac++; XtSetArg(al[ac], XmNcolumns, 16); ac++; ci_filter_ckt_txt = XmCreateText ( ci_equiplist_filter_form, "ci_filter_ckt_txt", al, ac ); ac = 0; XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++; XtSetArg(al[ac], XmNpacking, XmPACK_COLUMN); ac++; XtSetArg(al[ac], XmNentryAlignment, XmALIGNMENT_CENTER); ac++; ci_filter_radio = XmCreateRadioBox ( ci_equiplist_filter_form, "ci_filter_radio", al, ac ); ac = 0; ci_filter_owned_tgl = XmCreateToggleButtonGadget ( ci_filter_radio, "ci_filter_owned_tgl", al, ac ); ci_filter_billed_tgl = XmCreateToggleButtonGadget ( ci_filter_radio, "ci_filter_billed_tgl", al, ac ); XtSetArg(al[ac], XmNseparatorType, XmNO_LINE); ac++; ci_filter_sep1 = XmCreateSeparator ( ci_equiplist_filter_form, "ci_filter_sep1", al, ac ); ac = 0; XtSetArg(al[ac], XmNshadowThickness, 2); ac++; XtSetArg(al[ac], XmNshadowType, XmSHADOW_IN); ac++; XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++; XtSetArg(al[ac], XmNhorizontalSpacing, 5); ac++; XtSetArg(al[ac], XmNverticalSpacing, 3); ac++; ci_equip_sort_form = XmCreateForm ( ci_equiplist_form, "ci_equip_sort_form", al, ac ); ac = 0; XtSetArg(al[ac], XmNnavigationType, XmEXCLUSIVE_TAB_GROUP); ac++; XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++; XtSetArg(al[ac], XmNpacking, XmPACK_COLUMN); ac++; XtSetArg(al[ac], XmNentryAlignment, XmALIGNMENT_CENTER); ac++; ci_equip_sort_rc_btn = XmCreateRowColumn ( ci_equip_sort_form, "ci_equip_sort_rc_btn", al, ac ); ac = 0; ci_equip_sort_btn = XmCreatePushButton ( ci_equip_sort_rc_btn, "ci_equip_sort_btn", al, ac ); ci_equip_sort_reset_btn = XmCreatePushButton ( ci_equip_sort_rc_btn, "ci_equip_sort_reset_btn", al, ac ); XtSetArg(al[ac], XmNheight, 78); ac++; XtSetArg(al[ac], XmNnavigationType, XmEXCLUSIVE_TAB_GROUP); ac++; XtSetArg(al[ac], XmNspacing, 0); ac++; XtSetArg(al[ac], XmNmarginWidth, 0); ac++; XtSetArg(al[ac], XmNmarginHeight, 0); ac++; ci_equip_sort_tgls = XmCreateRowColumn ( ci_equip_sort_form, "ci_equip_sort_tgls", al, ac ); ac = 0; ci_equip_sort_status_tgl = XmCreateToggleButton ( ci_equip_sort_tgls, "ci_equip_sort_status_tgl", al, ac ); XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; ci_equip_sort_equip_tgl = XmCreateToggleButton ( ci_equip_sort_tgls, "ci_equip_sort_equip_tgl", al, ac ); ac = 0; XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; ci_equip_sort_date_tgl = XmCreateToggleButton ( ci_equip_sort_tgls, "ci_equip_sort_date_tgl", al, ac ); ac = 0; XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; ci_equip_sort_rev_lbl = XmCreateLabel ( ci_equip_sort_form, "ci_equip_sort_rev_lbl", al, ac ); ac = 0; XtSetArg(al[ac], XmNnavigationType, XmEXCLUSIVE_TAB_GROUP); ac++; XtSetArg(al[ac], XmNspacing, 0); ac++; XtSetArg(al[ac], XmNmarginWidth, 0); ac++; XtSetArg(al[ac], XmNmarginHeight, 0); ac++; ci_equip_sort_rev_tgls = XmCreateRowColumn ( ci_equip_sort_form, "ci_equip_sort_rev_tgls", al, ac ); ac = 0; ci_equip_sort_status_rev_tgl = XmCreateToggleButton ( ci_equip_sort_rev_tgls, "ci_equip_sort_status_rev_tgl", al, ac ); ci_equip_sort_equip_rev_tgl = XmCreateToggleButton ( ci_equip_sort_rev_tgls, "ci_equip_sort_equip_rev_tgl", al, ac ); ci_equip_sort_date_rev_tgl = XmCreateToggleButton ( ci_equip_sort_rev_tgls, "ci_equip_sort_date_rev_tgl", al, ac ); XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; ci_equip_sort_order_lbl = XmCreateLabel ( ci_equip_sort_form, "ci_equip_sort_order_lbl", al, ac ); ac = 0; XtSetArg(al[ac], XmNmaxLength, 300); ac++; XtSetArg(al[ac], XmNcolumns, 31); ac++; XtSetArg(al[ac], XmNmarginHeight, 1); ac++; XtSetArg(al[ac], XmNmarginWidth, 1); ac++; XtSetArg(al[ac], XmNeditable, FALSE); ac++; XtSetArg(al[ac], XmNcursorPositionVisible, FALSE); ac++; XtSetArg(al[ac], XmNautoShowCursorPosition, FALSE); ac++; ci_equip_sort_orderby_txt = XmCreateText ( ci_equip_sort_form, "ci_equip_sort_orderby_txt", al, ac ); ac = 0; ci_equip_sort_by_lbl = XmCreateLabel ( ci_equip_sort_form, "ci_equip_sort_by_lbl", al, ac ); XtSetArg(al[ac], XmNresizePolicy, XmRESIZE_NONE); ac++; XtSetArg(al[ac], XmNshadowType, XmSHADOW_IN); ac++; XtSetArg(al[ac], XmNverticalSpacing, 0); ac++; ci_subscrlist_form = XmCreateForm ( ci_equiplist_form, "ci_subscrlist_form", al, ac ); ac = 0; XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; equip_emf_lbl = XmCreateLabel ( ci_subscrlist_form, "equip_emf_lbl", al, ac ); ac = 0; XtSetArg(al[ac], XmNheight, 151); ac++; XtSetArg(al[ac], XmNhighlightOnEnter, TRUE); ac++; XtSetArg(al[ac], XmNvisibleItemCount, 9); ac++; XtSetArg(al[ac], XmNselectionPolicy, XmSINGLE_SELECT); ac++; XtSetArg(al[ac], XmNscrollBarDisplayPolicy, XmSTATIC); ac++; XtSetArg(al[ac], XmNlistSizePolicy, XmCONSTANT); ac++; ci_equiplist = XmCreateScrolledList ( ci_subscrlist_form, "ci_equiplist", al, ac ); ac = 0; ci_equipslist = XtParent ( ci_equiplist ); XtSetArg(al[ac], XmNhorizontalScrollBar, &ci_equipHscrollbar ); ac++; XtSetArg(al[ac], XmNverticalScrollBar, &ci_equipVscrollbar ); ac++; XtGetValues(ci_equipslist, al, ac ); ac = 0; ci_equiplist_btn_form = XmCreateForm ( ci_equiplist_form, "ci_equiplist_btn_form", al, ac ); XtSetArg(al[ac], XmNspacing, 20); ac++; XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++; XtSetArg(al[ac], XmNpacking, XmPACK_COLUMN); ac++; XtSetArg(al[ac], XmNentryAlignment, XmALIGNMENT_CENTER); ac++; ci_equiplist_rowcol = XmCreateRowColumn ( ci_equiplist_btn_form, "ci_equiplist_rowcol", al, ac ); ac = 0; ci_equiplist_prov_btn = XmCreatePushButton ( ci_equiplist_rowcol, "ci_equiplist_prov_btn", al, ac ); ci_equiplist_modify_btn = XmCreatePushButton ( ci_equiplist_rowcol, "ci_equiplist_modify_btn", al, ac ); ci_equiplist_disc_btn = XmCreatePushButton ( ci_equiplist_rowcol, "ci_equiplist_disc_btn", al, ac ); ci_equiplist_contract_btn = XmCreatePushButton ( ci_equiplist_rowcol, "ci_equiplist_contract_btn", al, ac ); ci_equiplist_close_btn = XmCreatePushButton ( ci_equiplist_rowcol, "ci_equiplist_close_btn", al, ac ); ci_equiplist_help_btn = XmCreatePushButton ( ci_equiplist_rowcol, "ci_equiplist_help_btn", al, ac ); ci_equip_status_txt = XmCreateText ( ci_equiplist_btn_form, "ci_equip_status_txt", al, ac ); XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 0); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, 0); ac++; XtSetValues ( ci_equip_account_form,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 10); ac++; XtSetArg(al[ac], XmNtopWidget, ci_equip_account_form); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 10); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNrightPosition, 45); ac++; XtSetValues ( ci_equiplist_filter_form,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 10); ac++; XtSetArg(al[ac], XmNtopWidget, ci_equip_account_form); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNbottomOffset, 0); ac++; XtSetArg(al[ac], XmNbottomWidget, ci_equiplist_filter_form); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNleftOffset, 10); ac++; XtSetArg(al[ac], XmNleftWidget, ci_equiplist_filter_form); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, 10); ac++; XtSetValues ( ci_equip_sort_form,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 10); ac++; XtSetArg(al[ac], XmNtopWidget, ci_equiplist_filter_form); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNbottomOffset, 10); ac++; XtSetArg(al[ac], XmNbottomWidget, ci_equiplist_btn_form); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 10); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, 10); ac++; XtSetValues ( ci_subscrlist_form,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, 0); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 1); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, 1); ac++; XtSetValues ( ci_equiplist_btn_form,al, ac ); ac = 0; XtAddCallback (ci_equiplist_form,XmNhelpCallback, XDhelp_link, (XtPointer) &_xd_help_pairs[0] ); XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, ci_equip_accountid_txt); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNbottomOffset, 0); ac++; XtSetArg(al[ac], XmNbottomWidget, ci_equip_accountid_txt); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNrightOffset, 5); ac++; XtSetArg(al[ac], XmNrightWidget, ci_equip_accountid_txt); ac++; XtSetValues ( ci_equip_account_id_lbl,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 5); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 100); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( ci_equip_accountid_txt,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, ci_equip_name_txt); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNbottomOffset, 0); ac++; XtSetArg(al[ac], XmNbottomWidget, ci_equip_name_txt); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNrightOffset, 5); ac++; XtSetArg(al[ac], XmNrightWidget, ci_equip_name_txt); ac++; XtSetValues ( ci_equip_account_name_lbl,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 5); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, 5); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 500); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( ci_equip_name_txt,al, ac ); ac = 0; children[ac++] = ci_equip_account_id_lbl; children[ac++] = ci_equip_accountid_txt; children[ac++] = ci_equip_account_name_lbl; children[ac++] = ci_equip_name_txt; XtManageChildren(children, ac); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 5); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 5); ac++; XtSetValues ( ci_equip_filter_rc,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, ci_equip_filter_equip_txt); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNbottomOffset, 0); ac++; XtSetArg(al[ac], XmNbottomWidget, ci_equip_filter_equip_txt); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNrightOffset, 0); ac++; XtSetArg(al[ac], XmNrightWidget, ci_equip_filter_equip_txt); ac++; XtSetValues ( ci_equip_filter_equip_lbl,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, ci_filter_status_txt); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNbottomOffset, 0); ac++; XtSetArg(al[ac], XmNbottomWidget, ci_filter_status_txt); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNrightOffset, 0); ac++; XtSetArg(al[ac], XmNrightWidget, ci_filter_status_txt); ac++; XtSetValues ( ci_equip_filter_status_lbl,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, ci_filter_status_txt); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNleftOffset, 0); ac++; XtSetArg(al[ac], XmNleftWidget, ci_filter_status_txt); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( ci_equip_filter_equip_txt,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, ci_filter_radio); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 136); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( ci_filter_status_txt,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, ci_filter_status_txt); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNbottomOffset, 0); ac++; XtSetArg(al[ac], XmNbottomWidget, ci_filter_status_txt); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNleftOffset, -1); ac++; XtSetArg(al[ac], XmNleftWidget, ci_filter_status_txt); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( ci_equip_status_btn,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, ci_filter_ckt_txt); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNbottomOffset, 0); ac++; XtSetArg(al[ac], XmNbottomWidget, ci_filter_ckt_txt); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNrightOffset, 0); ac++; XtSetArg(al[ac], XmNrightWidget, ci_filter_ckt_txt); ac++; XtSetValues ( ci_filter_ckt_lbl,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, ci_equip_filter_equip_txt); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNleftOffset, 0); ac++; XtSetArg(al[ac], XmNleftWidget, ci_equip_filter_equip_txt); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( ci_filter_ckt_txt,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, ci_equip_filter_rc); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 96); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( ci_filter_radio,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 10); ac++; XtSetArg(al[ac], XmNtopWidget, ci_filter_ckt_txt); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNleftOffset, 10); ac++; XtSetArg(al[ac], XmNleftWidget, ci_filter_ckt_txt); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( ci_filter_sep1,al, ac ); ac = 0; XtAddCallback (ci_equip_filter_btn, XmNactivateCallback, filter_equipment,NULL); XtAddCallback (ci_equip_reset_btn, XmNactivateCallback, reset_filter_equipment,NULL); children[ac++] = ci_equip_filter_btn; children[ac++] = ci_equip_reset_btn; XtManageChildren(children, ac); ac = 0; XtAddCallback (ci_equip_filter_equip_txt, XmNactivateCallback, filter_equipment,NULL); XtAddCallback (ci_equip_status_btn, XmNactivateCallback, emf_display_status_values,NULL); children[ac++] = ci_filter_owned_tgl; children[ac++] = ci_filter_billed_tgl; XtManageChildren(children, ac); ac = 0; children[ac++] = ci_equip_filter_rc; children[ac++] = ci_equip_filter_equip_lbl; children[ac++] = ci_equip_filter_status_lbl; children[ac++] = ci_equip_filter_equip_txt; children[ac++] = ci_filter_status_txt; children[ac++] = ci_equip_status_btn; children[ac++] = ci_filter_ckt_lbl; children[ac++] = ci_filter_ckt_txt; children[ac++] = ci_filter_radio; children[ac++] = ci_filter_sep1; XtManageChildren(children, ac); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 5); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 5); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( ci_equip_sort_rc_btn,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, ci_equip_sort_by_lbl); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, 5); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNleftOffset, 0); ac++; XtSetArg(al[ac], XmNleftWidget, ci_equip_sort_by_lbl); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( ci_equip_sort_tgls,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, ci_equip_sort_by_lbl); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 111); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( ci_equip_sort_rev_lbl,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, ci_equip_sort_rev_lbl); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNleftOffset, 0); ac++; XtSetArg(al[ac], XmNleftWidget, ci_equip_sort_rev_lbl); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( ci_equip_sort_rev_tgls,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, ci_equip_sort_rev_lbl); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNleftPosition, 44); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( ci_equip_sort_order_lbl,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, ci_equip_sort_order_lbl); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNbottomOffset, 0); ac++; XtSetArg(al[ac], XmNbottomWidget, ci_equip_sort_rev_tgls); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++; XtSetArg(al[ac], XmNleftOffset, 0); ac++; XtSetArg(al[ac], XmNleftWidget, ci_equip_sort_order_lbl); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNrightPosition, 95); ac++; XtSetValues ( ci_equip_sort_orderby_txt,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 5); ac++; XtSetArg(al[ac], XmNtopWidget, ci_equip_sort_rc_btn); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 5); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( ci_equip_sort_by_lbl,al, ac ); ac = 0; XtAddCallback (ci_equip_sort_btn, XmNactivateCallback, filter_equipment,NULL); XtAddCallback (ci_equip_sort_reset_btn, XmNactivateCallback, reset_sort_equipment,NULL); children[ac++] = ci_equip_sort_btn; children[ac++] = ci_equip_sort_reset_btn; XtManageChildren(children, ac); ac = 0; XtAddCallback (ci_equip_sort_status_tgl, XmNvalueChangedCallback, update_equip_sort_fields,&equip_status_data); XtAddCallback (ci_equip_sort_equip_tgl, XmNvalueChangedCallback, update_equip_sort_fields,&equip_subscr_no_data); XtAddCallback (ci_equip_sort_date_tgl, XmNvalueChangedCallback, update_equip_sort_fields,&equip_start_date_data); children[ac++] = ci_equip_sort_status_tgl; children[ac++] = ci_equip_sort_equip_tgl; children[ac++] = ci_equip_sort_date_tgl; XtManageChildren(children, ac); ac = 0; XtAddCallback (ci_equip_sort_status_rev_tgl, XmNvalueChangedCallback, update_equip_asc_desc_list,EQUIPMENT_STATUS); XtAddCallback (ci_equip_sort_equip_rev_tgl, XmNvalueChangedCallback, update_equip_asc_desc_list,EQUIPMENT_EQUIP_NUM); XtAddCallback (ci_equip_sort_date_rev_tgl, XmNvalueChangedCallback, update_equip_asc_desc_list,EQUIPMENT_START_DATE); children[ac++] = ci_equip_sort_status_rev_tgl; children[ac++] = ci_equip_sort_equip_rev_tgl; children[ac++] = ci_equip_sort_date_rev_tgl; XtManageChildren(children, ac); ac = 0; children[ac++] = ci_equip_sort_rc_btn; children[ac++] = ci_equip_sort_tgls; children[ac++] = ci_equip_sort_rev_lbl; children[ac++] = ci_equip_sort_rev_tgls; children[ac++] = ci_equip_sort_order_lbl; children[ac++] = ci_equip_sort_orderby_txt; children[ac++] = ci_equip_sort_by_lbl; XtManageChildren(children, ac); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 0); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( equip_emf_lbl,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, equip_emf_lbl); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, 0); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 0); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, 0); ac++; XtSetValues ( ci_equipslist,al, ac ); ac = 0; XtAddCallback (ci_equiplist, XmNdefaultActionCallback, modify_emf_cb,NULL); XtManageChild(ci_equiplist); children[ac++] = equip_emf_lbl; XtManageChildren(children, ac); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 40); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( ci_equiplist_rowcol,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNtopWidget, ci_equiplist_rowcol); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 0); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, 0); ac++; XtSetValues ( ci_equip_status_txt,al, ac ); ac = 0; XtAddCallback (ci_equiplist_prov_btn, XmNactivateCallback, add_emf_cb,NULL); XtAddCallback (ci_equiplist_modify_btn, XmNactivateCallback, modify_emf_cb,NULL); XtAddCallback (ci_equiplist_disc_btn, XmNactivateCallback, disconnect_emf_cb,NULL); XtAddCallback (ci_equiplist_contract_btn, XmNactivateCallback, display_equip_contract_cb,NULL); XtAddCallback (ci_equiplist_close_btn, XmNactivateCallback, close_equipment_window,NULL); XtAddCallback (ci_equiplist_help_btn,XmNactivateCallback, XDhelp_link, (XtPointer) &_xd_help_pairs[0] ); children[ac++] = ci_equiplist_prov_btn; children[ac++] = ci_equiplist_modify_btn; children[ac++] = ci_equiplist_disc_btn; children[ac++] = ci_equiplist_contract_btn; children[ac++] = ci_equiplist_close_btn; children[ac++] = ci_equiplist_help_btn; XtManageChildren(children, ac); ac = 0; children[ac++] = ci_equiplist_rowcol; children[ac++] = ci_equip_status_txt; XtManageChildren(children, ac); ac = 0; children[ac++] = ci_equip_account_form; children[ac++] = ci_equiplist_filter_form; children[ac++] = ci_equip_sort_form; children[ac++] = ci_subscrlist_form; children[ac++] = ci_equiplist_btn_form; XtManageChildren(children, ac); ac = 0; XtManageChild ( ci_equiplist_form); }
/********************************************************************* * Function: CreateDA * * CreateDA creates a Text Graphic area with the appropriate scroll bars. * *********************************************************************/ static XtPointer HelpCreateDA( Widget parent, char *name, short vert_flag, short horz_flag, Boolean traversal_flag, _DtCvValue honor_size, _DtCvRenderType render_type, int rows, int columns, unsigned short media_resolution, void (*hyperTextCB)(), void (*resizeCB)(), int (*exec_ok_routine)(), XtPointer client_data, XmFontList default_list ) { DtHelpDispAreaStruct *pDAS; DAArgs DA_args; Arg args[20]; int n; int maxFontAscent; int maxFontDescent; int maxFontCharWidth; short margin_width; short margin_height; short shadowThick, highThick; Dimension hBarHeight = 0; Dimension vBarWidth = 0; Dimension width; Boolean value; Widget form; Display *dpy = XtDisplay(parent); Screen *retScr = XtScreen(parent); int screen = XScreenNumberOfScreen(retScr); Colormap colormap; Pixmap tile; XGCValues gcValues; unsigned long gcMask; unsigned long char_width; Atom xa_ave_width; XFontStruct *tmpFont = NULL; XtPointer default_font = NULL; XRectangle rectangle[1]; XmFontContext fontContext; XmFontListEntry fontEntry; XmFontType fontType; /* Allocate the Display Area. */ pDAS = (DtHelpDispAreaStruct *) XtMalloc(sizeof(DtHelpDispAreaStruct)); /* * get the resources */ XtGetSubresources(parent, &DA_args, name, "XmDrawnButton", Resources, XtNumber(Resources), NULL, 0); if (rows <= 0) rows = 1; if (columns <= 0) columns = 1; /* * initialize the structure variables. */ pDAS->text_selected = False; pDAS->primary = False; pDAS->select_state = _DtHelpNothingDoing; pDAS->toc_y = 0; pDAS->toc_base = 0; pDAS->toc_flag = 0; if (traversal_flag) pDAS->toc_flag = _DT_HELP_SHADOW_TRAVERSAL | _DT_HELP_NOT_INITIALIZED; pDAS->max_spc = 0; pDAS->cur_spc = 0; pDAS->maxX = 0; pDAS->virtualX = 0; pDAS->firstVisible = 0; pDAS->visibleCount = rows; pDAS->maxYpos = 0; pDAS->neededFlags = 0; pDAS->vert_init_scr = DA_args.initialDelay; pDAS->vert_rep_scr = DA_args.repeatDelay; pDAS->horz_init_scr = DA_args.initialDelay; pDAS->horz_rep_scr = DA_args.repeatDelay; pDAS->moveThreshold = DA_args.moveThreshold; pDAS->marginWidth = DA_args.marginWidth; pDAS->marginHeight = DA_args.marginHeight; pDAS->searchColor = DA_args.search_color; pDAS->depth = 0; pDAS->spc_chars = NULL; pDAS->scr_timer_id = 0; pDAS->def_pix = 0; pDAS->context = NULL; pDAS->vertIsMapped = False; pDAS->horzIsMapped = False; pDAS->lst_topic = NULL; pDAS->nextNonVisible = 0; pDAS->media_resolution = media_resolution; pDAS->honor_size = honor_size; pDAS->render_type = render_type; pDAS->dtinfo = 0; pDAS->stipple = None; /* * locale dependant information */ pDAS->nl_to_space = 1; pDAS->cant_begin_chars = NULL; pDAS->cant_end_chars = NULL; if (1 < MB_CUR_MAX) _DtHelpLoadMultiInfo (&(pDAS->cant_begin_chars), &(pDAS->cant_end_chars), &(pDAS->nl_to_space)); /* * initialize the hypertext callback pointer */ pDAS->exec_filter = exec_ok_routine; pDAS->hyperCall = hyperTextCB; pDAS->resizeCall = resizeCB; pDAS->clientData = client_data; /* * zero out other callback fields */ pDAS->vScrollNotify = NULL ; pDAS->armCallback = NULL ; /* * create the atoms needed */ xa_ave_width = XmInternAtom(dpy, "AVERAGE_WIDTH" , False); /* * Malloc for the default font. */ (void) XmeRenderTableGetDefaultFont(DA_args.userFont, &tmpFont); if (default_list != NULL && XmFontListInitFontContext (&fontContext, default_list)) { fontEntry = XmFontListNextEntry (fontContext); if (fontEntry != NULL) default_font = XmFontListEntryGetFont (fontEntry, &fontType); XmFontListFreeFontContext (fontContext); } /* * fake out the next call by using the parent as the display widget */ pDAS->dispWid = parent; __DtHelpFontDatabaseInit (pDAS, default_font, fontType, tmpFont); /* * Get the base font meterics. */ __DtHelpFontMetrics (pDAS->font_info, __DtHelpDefaultFontIndexGet(pDAS), &maxFontAscent, &maxFontDescent, &maxFontCharWidth, NULL, NULL); pDAS->leading = DA_args.leading; pDAS->fontAscent = maxFontAscent; pDAS->lineHeight = maxFontAscent + maxFontDescent + pDAS->leading + 1; n = __DtHelpDefaultFontIndexGet(pDAS); if (n < 0) value = get_fontsetproperty(__DtHelpFontSetGet(pDAS->font_info, n), xa_ave_width, ((unsigned long *) &(pDAS->charWidth))); else value = XGetFontProperty(__DtHelpFontStructGet(pDAS->font_info, n), xa_ave_width, ((unsigned long *) &(pDAS->charWidth))); if (False == value || 0 == pDAS->charWidth) { int len = maxFontCharWidth; if (n < 0) len += XmbTextEscapement( __DtHelpFontSetGet(pDAS->font_info,n),"1",1); else len += XTextWidth(__DtHelpFontStructGet(pDAS->font_info, n),"1",1); pDAS->charWidth = 10 * len / 2; } /* * Create the form to manage the window and scroll bars. */ n = 0; XtSetArg(args[n], XmNresizePolicy , XmRESIZE_ANY); ++n; XtSetArg(args[n], XmNshadowType , XmSHADOW_OUT); ++n; form = XmCreateForm(parent, "DisplayAreaForm", args, n); XtManageChild(form); /* * force the shadowThickness to zero. The XmManager will try to set * this to one. */ n = 0; XtSetArg(args[n], XmNshadowThickness , 0); ++n; XtSetArg(args[n], XmNhighlightThickness, 0); ++n; XtSetValues (form, args, n); /* * get the colors and margin widths and heights */ n = 0; XtSetArg (args[n], XmNmarginWidth , &margin_width); ++n; XtSetArg (args[n], XmNmarginHeight, &margin_height); ++n; XtSetArg (args[n], XmNcolormap , &colormap); ++n; XtGetValues(form, args, n); /* Create the vertical scrollbar. */ pDAS->vertScrollWid = NULL; if (vert_flag != _DtHelpNONE) { if (vert_flag == _DtHelpSTATIC) pDAS->vertIsMapped = True; n = 0; XtSetArg(args[n], XmNtopAttachment , XmATTACH_FORM); ++n; XtSetArg(args[n], XmNtopOffset , 0); ++n; XtSetArg(args[n], XmNbottomAttachment , XmATTACH_FORM); ++n; XtSetArg(args[n], XmNbottomOffset , margin_height); ++n; XtSetArg(args[n], XmNrightAttachment , XmATTACH_FORM); ++n; XtSetArg(args[n], XmNrightOffset , 0); ++n; XtSetArg(args[n], XmNorientation , XmVERTICAL); ++n; XtSetArg(args[n], XmNtraversalOn , True); ++n; XtSetArg(args[n], XmNhighlightThickness, 1); ++n; XtSetArg(args[n], XmNshadowType , XmSHADOW_IN); ++n; XtSetArg(args[n], XmNvalue , 0); ++n; XtSetArg(args[n], XmNminimum , 0); ++n; /* fake out the scrollbar manager, who will init dims to 100 */ XtSetArg(args[n], XmNheight , 1); ++n; XtSetArg(args[n], XmNmaximum , 1); ++n; XtSetArg(args[n], XmNincrement , 1); ++n; XtSetArg(args[n], XmNpageIncrement , 1); ++n; XtSetArg(args[n], XmNsliderSize , 1); ++n; XtSetArg(args[n], XtNmappedWhenManaged , pDAS->vertIsMapped); ++n; pDAS->vertScrollWid = XmCreateScrollBar(form, "DisplayDtHelpVertScrollBar", args, n); XtManageChild(pDAS->vertScrollWid); if (vert_flag != _DtHelpSTATIC) pDAS->neededFlags = _DtHelpSET_AS_NEEDED (pDAS->neededFlags, _DtHelpVERTICAL_SCROLLBAR); XtAddCallback(pDAS->vertScrollWid, XmNdragCallback, _DtHelpVertScrollCB, (XtPointer) pDAS); XtAddCallback(pDAS->vertScrollWid, XmNincrementCallback, _DtHelpVertScrollCB, (XtPointer) pDAS); XtAddCallback(pDAS->vertScrollWid, XmNdecrementCallback, _DtHelpVertScrollCB, (XtPointer) pDAS); XtAddCallback(pDAS->vertScrollWid, XmNpageIncrementCallback, _DtHelpVertScrollCB, (XtPointer) pDAS); XtAddCallback(pDAS->vertScrollWid, XmNpageDecrementCallback, _DtHelpVertScrollCB, (XtPointer) pDAS); XtAddCallback(pDAS->vertScrollWid, XmNtoBottomCallback, _DtHelpVertScrollCB, (XtPointer) pDAS); XtAddCallback(pDAS->vertScrollWid, XmNtoTopCallback, _DtHelpVertScrollCB, (XtPointer) pDAS); XtAddCallback(pDAS->vertScrollWid, XmNvalueChangedCallback, _DtHelpVertScrollCB, (XtPointer) pDAS); XtAddEventHandler (pDAS->vertScrollWid, ButtonPressMask, True, (XtEventHandler)_DtHelpMoveBtnFocusCB,(XtPointer) pDAS); } /* Create the horizontal scrollbar. */ pDAS->horzScrollWid = NULL; if (horz_flag != _DtHelpNONE) { if (horz_flag == _DtHelpSTATIC) pDAS->horzIsMapped = True; n = 0; XtSetArg(args[n], XmNbottomAttachment , XmATTACH_FORM); ++n; XtSetArg(args[n], XmNbottomOffset , 0); ++n; XtSetArg(args[n], XmNrightAttachment , XmATTACH_FORM); ++n; XtSetArg(args[n], XmNrightOffset , margin_width); ++n; XtSetArg(args[n], XmNleftAttachment , XmATTACH_FORM); ++n; XtSetArg(args[n], XmNleftOffset , 0); ++n; XtSetArg(args[n], XmNorientation , XmHORIZONTAL); ++n; XtSetArg(args[n], XmNtraversalOn , True); ++n; XtSetArg(args[n], XmNhighlightThickness, 1); ++n; XtSetArg(args[n], XmNshadowType , XmSHADOW_IN); ++n; XtSetArg(args[n], XmNvalue , 0); ++n; XtSetArg(args[n], XmNminimum , 0); ++n; XtSetArg(args[n], XmNmaximum , (pDAS->charWidth/10)); ++n; /* fake out the scrollbar manager, who will init dims to 100 */ XtSetArg(args[n], XmNwidth , 1); ++n; XtSetArg(args[n], XmNincrement , (pDAS->charWidth/10)); ++n; XtSetArg(args[n], XmNpageIncrement , (pDAS->charWidth/10)); ++n; XtSetArg(args[n], XmNsliderSize , (pDAS->charWidth/10)); ++n; XtSetArg(args[n], XtNmappedWhenManaged , pDAS->horzIsMapped); ++n; pDAS->horzScrollWid = XmCreateScrollBar(form, "DisplayHorzScrollBar", args, n); XtManageChild(pDAS->horzScrollWid); if (horz_flag != _DtHelpSTATIC) pDAS->neededFlags = _DtHelpSET_AS_NEEDED (pDAS->neededFlags, _DtHelpHORIZONTAL_SCROLLBAR); XtAddCallback(pDAS->horzScrollWid, XmNdragCallback, _DtHelpHorzScrollCB, (XtPointer) pDAS); XtAddCallback(pDAS->horzScrollWid, XmNincrementCallback, _DtHelpHorzScrollCB, (XtPointer) pDAS); XtAddCallback(pDAS->horzScrollWid, XmNdecrementCallback, _DtHelpHorzScrollCB, (XtPointer) pDAS); XtAddCallback(pDAS->horzScrollWid, XmNpageIncrementCallback, _DtHelpHorzScrollCB, (XtPointer) pDAS); XtAddCallback(pDAS->horzScrollWid, XmNpageDecrementCallback, _DtHelpHorzScrollCB, (XtPointer) pDAS); XtAddCallback(pDAS->horzScrollWid, XmNtoBottomCallback, _DtHelpHorzScrollCB, (XtPointer) pDAS); XtAddCallback(pDAS->horzScrollWid, XmNtoTopCallback, _DtHelpHorzScrollCB, (XtPointer) pDAS); XtAddCallback(pDAS->horzScrollWid, XmNvalueChangedCallback, _DtHelpHorzScrollCB, (XtPointer) pDAS); } /* * check for the horizontal attachments */ n = 0; if (horz_flag == _DtHelpSTATIC) { XtSetArg(args[n], XmNbottomAttachment , XmATTACH_WIDGET); ++n; XtSetArg(args[n], XmNbottomWidget , pDAS->horzScrollWid); ++n; } else { XtSetArg(args[n], XmNbottomAttachment , XmATTACH_FORM); ++n; } /* * check for the vertical attachments */ if (vert_flag == _DtHelpSTATIC) { XtSetArg(args[n], XmNrightAttachment , XmATTACH_WIDGET); ++n; XtSetArg(args[n], XmNrightWidget , pDAS->vertScrollWid); ++n; } else { XtSetArg(args[n], XmNrightAttachment , XmATTACH_FORM); ++n; } /* * do the rest of the arguments */ XtSetArg(args[n], XmNbottomOffset , margin_height); ++n; XtSetArg(args[n], XmNrightOffset , margin_width); ++n; XtSetArg(args[n], XmNtopAttachment , XmATTACH_FORM); ++n; XtSetArg(args[n], XmNtopOffset , 0); ++n; XtSetArg(args[n], XmNleftAttachment , XmATTACH_FORM); ++n; XtSetArg(args[n], XmNleftOffset , 0); ++n; XtSetArg(args[n], XmNrecomputeSize , False); ++n; XtSetArg(args[n], XmNpushButtonEnabled , False); ++n; XtSetArg(args[n], XmNtraversalOn , True); ++n; XtSetArg(args[n], XmNhighlightThickness, 1); ++n; XtSetArg(args[n], XmNshadowType , XmSHADOW_IN); ++n; XtSetArg(args[n], XmNmultiClick , XmMULTICLICK_DISCARD); ++n; XtSetArg(args[n], XmNuserData , pDAS); ++n; pDAS->dispWid = XmCreateDrawnButton(form, name, args, n); XtManageChild(pDAS->dispWid); XtAddCallback(pDAS->dispWid, XmNexposeCallback, _DtHelpExposeCB, (XtPointer) pDAS); XtAddCallback(pDAS->dispWid, XmNresizeCallback, _DtHelpResizeCB, (XtPointer) pDAS); XtAddCallback(pDAS->dispWid, XmNarmCallback, _DtHelpClickOrSelectCB, (XtPointer) pDAS); XtAddCallback(pDAS->dispWid, XmNdisarmCallback, _DtHelpEndSelectionCB, (XtPointer) pDAS); XtAddEventHandler (pDAS->dispWid, Button1MotionMask, True, (XtEventHandler)_DtHelpMouseMoveCB, (XtPointer) pDAS); /* * add my actions * parse the translations. */ _DtHelpProcessLock(); if (DrawnBTrans == NULL) DrawnBTrans = XtParseTranslationTable(DrawnBTransTable); /* * override the translations XtSetArg(args[n], XmNtranslations , DrawnBTrans); ++n; */ if (DrawnBTrans != NULL) XtOverrideTranslations(pDAS->dispWid, DrawnBTrans); _DtHelpProcessUnlock(); if (_XmGetFocusPolicy(parent) == XmPOINTER) { XtAddEventHandler (pDAS->dispWid, EnterWindowMask, True, (XtEventHandler)_DtHelpEnterLeaveCB, (XtPointer) pDAS); XtAddEventHandler (pDAS->dispWid, LeaveWindowMask, True, (XtEventHandler)_DtHelpEnterLeaveCB, (XtPointer) pDAS); } else XtAddEventHandler (pDAS->dispWid, FocusChangeMask, True, (XtEventHandler)_DtHelpFocusCB, (XtPointer) pDAS); XtAddEventHandler (pDAS->dispWid, VisibilityChangeMask, True, (XtEventHandler)_DtHelpVisibilityCB, (XtPointer) pDAS); /* Add a destroy callback so that the display area can clean up prior to * the help widget getting destroyed (e.g. display area's parent) */ XtAddCallback(pDAS->dispWid, XmNdestroyCallback, _DtHelpDisplayAreaDestroyCB, (XtPointer) pDAS); n = 0; XtSetArg(args[n], XmNshadowThickness , &shadowThick); ++n; XtSetArg(args[n], XmNhighlightThickness, &highThick); ++n; XtSetArg(args[n], XmNforeground , &(pDAS->foregroundColor)); ++n; XtSetArg(args[n], XmNbackground , &(pDAS->backgroundColor)); ++n; XtSetArg(args[n], XmNhighlightColor, &(pDAS->traversalColor) ); ++n; XtSetArg(args[n], XmNdepth , &(pDAS->depth) ); ++n; XtGetValues(pDAS->dispWid, args, n); pDAS->decorThickness = shadowThick + highThick; /* * Get the underline information */ GetUnderLineInfo (dpy, pDAS, &(pDAS->lineThickness)); /* * get the tiling pattern. */ tile = XmGetPixmap (XtScreen(pDAS->dispWid), "50_foreground", pDAS->foregroundColor, pDAS->backgroundColor); /* * Get the data for the graphics contexts and create the GC's. */ gcMask = (GCFunction | GCPlaneMask | GCForeground | GCBackground | GCLineWidth | GCLineStyle | GCClipXOrigin | GCClipYOrigin | GCClipMask); gcValues.function = GXcopy; gcValues.plane_mask = AllPlanes; gcValues.foreground = pDAS->foregroundColor; gcValues.background = pDAS->backgroundColor; gcValues.line_style = LineSolid; gcValues.line_width = pDAS->lineThickness; gcValues.clip_x_origin = 0; gcValues.clip_y_origin = 0; gcValues.clip_mask = None; if (tile) { gcMask |= GCTile; gcValues.tile = tile; } pDAS->normalGC = XCreateGC(dpy, RootWindowOfScreen(XtScreen(pDAS->dispWid)), gcMask, &gcValues); gcMask &= (~GCTile); pDAS->pixmapGC = XCreateGC(dpy, RootWindowOfScreen(XtScreen(pDAS->dispWid)), gcMask, &gcValues); gcValues.foreground = pDAS->backgroundColor; gcValues.background = pDAS->foregroundColor; pDAS->invertGC = XCreateGC(dpy, RootWindowOfScreen(XtScreen(pDAS->dispWid)), gcMask, &gcValues); /* * Set the size of the text view area to the requested * number of columns and lines. */ char_width = pDAS->charWidth * columns; /* * Make sure the margins include enough room for a traversal line */ if (((int) pDAS->marginWidth) < pDAS->lineThickness) pDAS->marginWidth = pDAS->lineThickness; if (((int) pDAS->marginHeight) < pDAS->lineThickness) pDAS->marginHeight = pDAS->lineThickness; if (pDAS->leading < pDAS->lineThickness) pDAS->leading = pDAS->lineThickness; /* * get the scrollbar widths. */ if (NULL != pDAS->horzScrollWid) { n = 0; XtSetArg(args[n], XmNheight , &hBarHeight); n++; XtSetArg(args[n], XmNinitialDelay, &(pDAS->horz_init_scr)); n++; XtSetArg(args[n], XmNrepeatDelay , &(pDAS->horz_rep_scr)); n++; XtGetValues(pDAS->horzScrollWid, args, n); } if (NULL != pDAS->vertScrollWid) { n = 0; XtSetArg(args[n], XmNwidth , &vBarWidth); n++; XtSetArg(args[n], XmNinitialDelay, &(pDAS->vert_init_scr)); n++; XtSetArg(args[n], XmNrepeatDelay , &(pDAS->vert_rep_scr)); n++; XtGetValues(pDAS->vertScrollWid, args, n); } /* * calculate the display area height/width */ pDAS->dispUseWidth = ((int) (char_width / 10 + (char_width % 10 ? 1 : 0))) + 2 * pDAS->marginWidth; if (vert_flag != _DtHelpSTATIC && pDAS->dispUseWidth < vBarWidth) pDAS->dispUseWidth = vBarWidth; pDAS->dispWidth = pDAS->dispUseWidth + 2 * pDAS->decorThickness; pDAS->dispUseHeight = pDAS->lineHeight * rows; if (horz_flag != _DtHelpSTATIC && pDAS->dispUseHeight < hBarHeight) pDAS->dispUseHeight = hBarHeight; pDAS->dispHeight = pDAS->dispUseHeight + 2 * pDAS->decorThickness; /* * Truncate the width and height to the size of the display. * This will prevent an X protocal error when it is asked for * a too large size. Besides, any decent window manager will * force the overall size to the height and width of the display. * This simply refines the size down to a closer (but not perfect) * fit. */ if (((int) pDAS->dispWidth) > XDisplayWidth (dpy, screen)) { pDAS->dispWidth = XDisplayWidth (dpy, screen); } if (((int) pDAS->dispHeight) > XDisplayHeight (dpy, screen)) { pDAS->dispHeight = XDisplayHeight (dpy, screen); } n = 0; pDAS->formWidth = 0; pDAS->formHeight = 0; XtSetArg(args[n], XmNwidth, pDAS->dispWidth); ++n; XtSetArg(args[n], XmNheight, pDAS->dispHeight); ++n; XtSetValues(pDAS->dispWid, args, n); /* * set the scroll bar values */ if (pDAS->vertScrollWid != NULL) { n = 0; XtSetArg(args[n], XmNmaximum , pDAS->dispUseHeight); ++n; XtSetArg(args[n], XmNincrement , pDAS->lineHeight); ++n; XtSetArg(args[n], XmNpageIncrement , pDAS->lineHeight); ++n; XtSetArg(args[n], XmNsliderSize , pDAS->dispUseHeight); ++n; XtSetValues(pDAS->vertScrollWid, args, n); } if (pDAS->resizeCall) (*(pDAS->resizeCall)) (pDAS->clientData); /* * calculate the offset for the right edge of the * horizontal scrollbar. */ if (vert_flag == _DtHelpSTATIC && pDAS->horzScrollWid) { width = vBarWidth + margin_width; XtSetArg(args[0], XmNrightOffset , width); XtSetValues(pDAS->horzScrollWid, args, 1); } /* * calculate the offset for the bottom end of the * vertical scrollbar. */ if (horz_flag == _DtHelpSTATIC && pDAS->vertScrollWid) { width = hBarHeight + margin_height; XtSetArg(args[0], XmNbottomOffset , width); XtSetValues(pDAS->vertScrollWid, args, 1); } rectangle[0].x = pDAS->decorThickness; rectangle[0].y = pDAS->decorThickness; rectangle[0].width = pDAS->dispUseWidth; rectangle[0].height = pDAS->dispUseHeight; XSetClipRectangles(XtDisplay(pDAS->dispWid), pDAS->normalGC, 0, 0, rectangle, 1, Unsorted); XSetClipRectangles(XtDisplay(pDAS->dispWid), pDAS->invertGC, 0, 0, rectangle, 1, Unsorted); /* * get the colormap and the visual */ if (!XtIsShell(parent) && XtParent(parent) != NULL) parent = XtParent(parent); pDAS->visual = NULL; n = 0; XtSetArg (args[n], XmNcolormap, &(pDAS->colormap)); n++; XtSetArg (args[n], XmNvisual , &(pDAS->visual )); n++; XtGetValues (parent, args, n); if (pDAS->visual == NULL) pDAS->visual = XDefaultVisualOfScreen(XtScreen(pDAS->dispWid)); /* * set up the canvas */ _DtHelpProcessLock(); DefVirtFunctions.exec_cmd_filter = exec_ok_routine; pDAS->canvas = _DtCanvasCreate (DefVirtFunctions, (_DtCvPointer) pDAS); _DtHelpProcessUnlock(); return (XtPointer) pDAS; } /* End _DtHelpCreateDA */
int main(int argc, char **argv) { XtAppContext theApp; Widget toplevel; Widget butt; Pixmap Pix; Display *theDisplay; Window theRootWindow; Pixel fg,bg; Dimension mt, mb, ml, mr, mw, mh, st, ht; XtWidgetGeometry geo; toplevel = XtVaAppInitialize(&theApp, "toggle1", NULL, 0, &argc, argv, NULL, NULL); butt= XtVaCreateManagedWidget("Button1", xmToggleButtonWidgetClass, toplevel, #if 0 XmNindicatorOn, False, #endif XmNshadowThickness, 5, XmNfillOnSelect, True, NULL); XtAddCallback(butt,XmNvalueChangedCallback,HiCB,NULL); XtRealizeWidget(toplevel); theDisplay = XtDisplay(toplevel); theRootWindow = XDefaultRootWindow(theDisplay); fg = XBlackPixelOfScreen(DefaultScreenOfDisplay(theDisplay)); bg = XWhitePixelOfScreen(DefaultScreenOfDisplay(theDisplay)); Pix = XmGetPixmap(DefaultScreenOfDisplay(theDisplay), "xlogo64", fg, bg); if (Pix == XmUNSPECIFIED_PIXMAP) printf("PIX IS UNSPECIFIED\n"); XtVaGetValues(butt, XmNmarginTop, &mt, XmNmarginBottom, &mb, XmNmarginLeft, &ml, XmNmarginRight, &mr, XmNmarginWidth, &mw, XmNmarginHeight, &mh, XmNshadowThickness, &st, XmNhighlightThickness, &ht, NULL); printf("%d %d %d %d %d %d %d %d\n", mt, mb, ml, mr, mw, mh, st, ht); XtVaSetValues(butt, #if 0 XmNlabelPixmap,Pix, #endif XmNlabelType, XmPIXMAP, NULL); Pix = XmGetPixmap(DefaultScreenOfDisplay(theDisplay), "woman", fg, bg); XtVaGetValues(butt, XmNmarginTop, &mt, XmNmarginBottom, &mb, XmNmarginLeft, &ml, XmNmarginRight, &mr, XmNmarginWidth, &mw, XmNmarginHeight, &mh, XmNshadowThickness, &st, XmNhighlightThickness, &ht, NULL); printf("%d %d %d %d %d %d %d %d\n", mt, mb, ml, mr, mw, mh, st, ht); XtVaSetValues(butt, XmNselectPixmap, Pix, NULL); XtQueryGeometry(butt, NULL, &geo); printf("toggle wants: %d %d has %d %d\n", geo.width, geo.height, XtWidth(butt), XtHeight(butt)); XtVaGetValues(butt, XmNmarginTop, &mt, XmNmarginBottom, &mb, XmNmarginLeft, &ml, XmNmarginRight, &mr, XmNmarginWidth, &mw, XmNmarginHeight, &mh, XmNshadowThickness, &st, XmNhighlightThickness, &ht, NULL); printf("%d %d %d %d %d %d %d %d\n", mt, mb, ml, mr, mw, mh, st, ht); /* Note: the following values are the result of * querying the current geometry. */ { static XtWidgetGeometry Expected[] = { CWWidth | CWHeight , 387, 402, 77, 45, 0,0,0, /* Button1 */ }; /* toplevel should be replaced with to correct applicationShell */ PrintDetails(toplevel, Expected); } LessTifTestMainLoop(toplevel); exit(0); }
UI2DView::UI2DView () : DBObject ("Noname 2DView",sizeof (UI2DView)) { char name [DBStringLength]; Widget menuBar, scrolledWindow, radioBox; Widget button; static Pixmap iconPixmap = (Pixmap) NULL, meshPixmap = (Pixmap) NULL; static Pixmap fullPixmap = (Pixmap) NULL, extentPixmap = (Pixmap) NULL; static Pixmap capturePixmap = (Pixmap) NULL, redrawPixmap = (Pixmap) NULL; static Pixmap zoomPixmap = (Pixmap) NULL, panePixmap = (Pixmap) NULL, userPixmap = (Pixmap) NULL; Pixel foreground, background; XWindowAttributes xwa; XSetWindowAttributes xswa; Atom deleteWindowAtom = XmInternAtom(XtDisplay(UITopLevel ()),(char *) "WM_DELETE_WINDOW",FALSE); _UI2DViewLIST.Add (this); sprintf (name,"2DView:%2d",RowID ()); Name (name); Image = (XImage *) NULL; DrawRegion = FullRegion = NULL; MaxVertexNumVAR = 0; PointARR = (XPoint *) NULL; RequiredEXT = (UIDataset ())->Extent (); DShell = XtVaCreatePopupShell ("UI2DView",xmDialogShellWidgetClass,UITopLevel (), XmNkeyboardFocusPolicy, XmPOINTER, XmNtitle, Name (), XmNtransient, false, XmNminWidth, 600, XmNminHeight, 450, NULL); XmAddWMProtocolCallback (DShell,deleteWindowAtom,(XtCallbackProc) _UI2DViewDeleteCBK,(XtPointer) this); MainFormW = XtVaCreateManagedWidget ("UI2DViewForm",xmFormWidgetClass,DShell, XmNdialogStyle, XmDIALOG_WORK_AREA, XmNshadowThickness, 0, XmNwidth, 600, XmNheight, 450, NULL); menuBar = XtVaCreateManagedWidget ("UI2DViewMenuBar",xmRowColumnWidgetClass,MainFormW, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 2, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 2, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 2, XmNorientation, XmHORIZONTAL, XmNrowColumnType, XmWORK_AREA, NULL); XtVaGetValues (MainFormW,XmNforeground, &foreground,XmNbackground, &background,NULL); iconPixmap = iconPixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen (UITopLevel()),(char *) "GHAAS2Dview.bmp",foreground,background): iconPixmap; XtVaSetValues (DShell,XmNiconPixmap, iconPixmap,NULL); fullPixmap = fullPixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASfull.bmp", foreground,background) : fullPixmap; extentPixmap = extentPixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASextent.bmp",foreground,background) : extentPixmap; capturePixmap= capturePixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAAScapture.bmp",foreground,background):capturePixmap; redrawPixmap = redrawPixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASredraw.bmp", foreground,background) : redrawPixmap; zoomPixmap = zoomPixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASzoom.bmp", foreground,background) : zoomPixmap; panePixmap = panePixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASpane.bmp", foreground,background) : panePixmap; userPixmap = userPixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASuser.bmp", foreground,background) : userPixmap; meshPixmap = meshPixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASmesh.bmp", foreground,background) : meshPixmap; button = XtVaCreateManagedWidget ("UI2DViewRedrawButton",xmPushButtonGadgetClass,menuBar, XmNlabelType, XmPIXMAP, XmNlabelPixmap, redrawPixmap, NULL); XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) _UI2DViewRedrawCBK,this); button = XtVaCreateManagedWidget ("UI2DViewFullButton",xmPushButtonGadgetClass,menuBar, XmNlabelType, XmPIXMAP, XmNlabelPixmap, fullPixmap, NULL); XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) _UI2DViewFullActivateCBK,this); button = XtVaCreateManagedWidget ("UI2DViewExtentButton",xmPushButtonGadgetClass,menuBar, XmNlabelType, XmPIXMAP, XmNlabelPixmap, extentPixmap, NULL); XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) _UI2DViewExtentActivateCBK,this); button = XtVaCreateManagedWidget ("UI2DViewCaptureButton",xmPushButtonGadgetClass,menuBar, XmNlabelType, XmPIXMAP, XmNlabelPixmap, capturePixmap, NULL); radioBox = XtVaCreateManagedWidget ("UI2DViewRadioBox",xmRowColumnWidgetClass,menuBar, XmNorientation, XmHORIZONTAL, XmNpacking, XmPACK_COLUMN, XmNisHomogeneous, true, XmNentryClass, xmToggleButtonGadgetClass, XmNradioBehavior, true, NULL); ZoomToggle = XtVaCreateManagedWidget ("UI2DViewZoomToggle",xmToggleButtonGadgetClass,radioBox, XmNlabelType, XmPIXMAP, XmNlabelPixmap, zoomPixmap, XmNshadowThickness, 0, XmNset, true, NULL); XtAddCallback (ZoomToggle,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewZoomToggleValueCBK,this); PaneToggle = XtVaCreateManagedWidget ("UI2DViewPaneToggle",xmToggleButtonGadgetClass,radioBox, XmNlabelType, XmPIXMAP, XmNlabelPixmap, panePixmap, XmNshadowThickness, 0, NULL); XtAddCallback (PaneToggle,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewPaneToggleValueCBK,this); UserToggle = XtVaCreateWidget ("UI2DViewUserToggle",xmToggleButtonGadgetClass,radioBox, XmNlabelType, XmPIXMAP, XmNlabelPixmap, userPixmap, XmNmappedWhenManaged, false, XmNshadowThickness, 0, NULL); XtAddCallback (UserToggle,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewUserToggleValueCBK,this); if (_UI2DViewUserFunction != (UI2DViewUserFunction) NULL) XtManageChild (UserToggle); MeshOptionW = XtVaCreateManagedWidget ("UI2DViewMeshOption",xmToggleButtonGadgetClass,menuBar, XmNlabelType, XmPIXMAP, XmNlabelPixmap, meshPixmap, XmNshadowThickness, 0, NULL); XtAddCallback (MeshOptionW,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewMeshOptionCBK,this); XtVaSetValues (menuBar, XmNmenuHelpWidget, MeshOptionW, NULL); ScaleW = XtVaCreateManagedWidget ("UI2DViewScale",xmScaleWidgetClass,MainFormW, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, menuBar, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 2, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 18, XmNorientation, XmVERTICAL, XmNwidth, 16, NULL); XtAddCallback (ScaleW,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewScaleValueChangedCBK,this); scrolledWindow = XtVaCreateManagedWidget ("UI2DViewScrolledWindow",xmScrolledWindowWidgetClass,MainFormW, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, menuBar, XmNtopOffset, 2, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, ScaleW, XmNleftOffset, 3, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 3, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 3, XmNspacing, 2, NULL); HorScrollBarW = XtVaCreateManagedWidget ("UI2DViewHorScrollBar", xmScrollBarWidgetClass, scrolledWindow, XmNsliderSize, 100, XmNorientation, XmHORIZONTAL, XmNheight, 16, NULL); XtAddCallback (HorScrollBarW,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewHorScrollBarValueChangedCBK,this); VerScrollBarW = XtVaCreateManagedWidget ("UI2DViewVerScrollBar", xmScrollBarWidgetClass, scrolledWindow, XmNsliderSize, 100, XmNorientation, XmVERTICAL, XmNwidth, 16, NULL); XtAddCallback (VerScrollBarW,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewVerScrollBarValueChangedCBK,this); DrawingAreaW = XtVaCreateManagedWidget ("UI2DViewDrawingArea", xmDrawingAreaWidgetClass, scrolledWindow, XmNuserData, this, XmNbackground, UIColor (UIColorStandard,0), NULL); XtAddCallback (DrawingAreaW,XmNresizeCallback,(XtCallbackProc) _UI2DViewResizeCBK,this); XtAddEventHandler (DrawingAreaW,EnterWindowMask|LeaveWindowMask|PointerMotionMask|ButtonPressMask|ButtonReleaseMask, false,(XtEventHandler) _UI2DViewPointerEHR,this); XmScrolledWindowSetAreas(scrolledWindow,HorScrollBarW,VerScrollBarW,DrawingAreaW); _UI2DViewViewCursor = _UI2DViewViewCursor != (Cursor) NULL ? _UI2DViewViewCursor : XCreateFontCursor (XtDisplay (DrawingAreaW),XC_top_left_arrow), _UI2DViewUserCursor = _UI2DViewUserCursor != (Cursor) NULL ? _UI2DViewUserCursor : XCreateFontCursor (XtDisplay (DrawingAreaW),XC_crosshair); RegenCursor = XCreateFontCursor (XtDisplay (DrawingAreaW),XC_watch); ActiveCursor = xswa.cursor = _UI2DViewViewCursor; XChangeWindowAttributes (XtDisplay (DrawingAreaW), XtWindow (DrawingAreaW), CWCursor, &xswa); XGetWindowAttributes (XtDisplay (DrawingAreaW),XtWindow (DrawingAreaW),&xwa); Background = xwa.backing_pixel; xswa.backing_store = Always; XChangeWindowAttributes (XtDisplay (DrawingAreaW), XtWindow (DrawingAreaW),CWBackingStore,&xswa); InputMode (ZOOM_MODE); Size (); Set (); }
/****************************************************************** main: ******************************************************************/ int main(int argc, char **argv) { static Widget MainWindow; XtAppContext app_context; Widget Frame1, RC1, Label1, DrawingArea1; Pixmap pixmap; GC gc; XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); toplevel = XtOpenApplication(&app_context, "Test", NULL, 0, &argc, argv, NULL, sessionShellWidgetClass, NULL, 0); MainWindow = XtVaCreateManagedWidget("MainWindow1", xmMainWindowWidgetClass, toplevel, NULL); CreateMenus(MainWindow); RC1 = XtVaCreateManagedWidget("RC1", xmRowColumnWidgetClass, MainWindow, NULL); if (!argv[1]) { printf("usage: %s bitmap-file\n", *argv); exit(1); } /* Load bitmap given in argv[1] */ pixmap = XmGetPixmap(XtScreen(toplevel), argv[1], BlackPixelOfScreen(XtScreen(toplevel)), WhitePixelOfScreen(XtScreen(toplevel))); if (pixmap == XmUNSPECIFIED_PIXMAP) { printf("can't create pixmap from %s\n", argv[1]); exit(1); } /* Now instantiate an XmLabel widget that displays pixmap. */ Label1 = XtVaCreateManagedWidget("Label1", xmLabelWidgetClass, RC1, XmNlabelType, XmPIXMAP, XmNlabelPixmap, pixmap, NULL); Frame1 = XtVaCreateManagedWidget("Frame1", xmFrameWidgetClass, RC1, XmNshadowThickness, 3, NULL); DrawingArea1 = XtVaCreateManagedWidget("DrawingArea1", xmDrawingAreaWidgetClass, Frame1, XmNwidth, 150, XmNheight, 150, XmNresizePolicy, XmRESIZE_NONE, NULL); XmeDropSink(DrawingArea1, NULL, 0); XtAddCallback(DrawingArea1, XmNdestinationCallback, DestinationCallback, NULL); XtRealizeWidget(toplevel); XtAppMainLoop(app_context); return 0; /* make compiler happy */ }
int main( int argc, char *argv[] ) { int n; Arg Args[MAX_ARGS]; int i; Widget Text; Widget Window; Pixmap WindPixmap; Pixmap TextPixmap; CommonTestInit(argc, argv); /* Get the pixmaps for the backgrounds */ WindPixmap = XmGetPixmap(screen, WINDOW_PIXMAP, BlackPixelOfScreen(screen), WhitePixelOfScreen(screen)); TextPixmap = XmGetPixmap(screen, TEXT_PIXMAP, BlackPixelOfScreen(screen), WhitePixelOfScreen(screen)); if (!WindPixmap) { (void)printf("Can't make pixmap for file %s!\n", WINDOW_PIXMAP ); exit(1); } if (!TextPixmap) { (void)printf("Can't make pixmap for file %s!\n", TEXT_PIXMAP ); exit(1); } /* Make the ScrolledWindow and Text */ n = 0; XtSetArg( Args[n], XmNvalue, Strings ); n++; XtSetArg( Args[n], XmNeditable, False ); n++; XtSetArg( Args[n], XmNeditMode, XmMULTI_LINE_EDIT ); n++; Text = XmCreateScrolledText(Shell1, "Text", Args, n ); /* Get the Widget for the parent Scrolled Window */ Window = XtParent(Text); /* Set the Text Pixmap and color */ n = 0; XtSetArg(Args[n], XmNbackgroundPixmap, TextPixmap ); n++; XtSetValues( Text, Args, n ); SetWidgetColor( Text, "white" ); /* Set the Window Pixmap and color */ n = 0; XtSetArg(Args[n], XmNbackgroundPixmap, WindPixmap ); n++; XtSetValues( Window, Args, n ); SetWidgetColor( Window, "pink" ); XtManageChild(Text); XtManageChild(Window); /************* * Assertion 1. Now that the text and window have differing pixmaps, * lets dump the values for the child scrollbar values. */ PrintValues( Window, "Assertion 1" ); CommonPause(); /************* * Assertion 2. Now that the text and window have differing pixmaps, * lets dump the values for the child scrollbar values. */ SetWidgetColor( Text, "green" ); PrintValues( Window, "Assertion 2" ); CommonPause(); /* Cleanup Time */ XmDestroyPixmap( screen, WindPixmap ); XmDestroyPixmap( screen, TextPixmap ); XtDestroyWidget( XtParent(Text) ); CommonPause(); XtAppMainLoop(app_context); return 0; }
int main(int argc, char **argv) { Widget ScrollWin, Container, *IconGad; int i; Cardinal n; Arg args[MAX_ARGS]; Dimension x_size, y_size; CommonTestInit(argc, argv); n = 0; XtSetArg( args[n], XmNx, 20 ); n++; ScrollWin = XmCreateScrolledWindow(Shell1, "ScrollWin7", args, n); XtManageChild(ScrollWin); XtSetArg(args[n], XmNselectionPolicy, XmMULTIPLE_SELECT); n++; XtSetArg(args[n], XmNspatialStyle, XmNONE ); n++; Container = XmCreateContainer(ScrollWin, "Container7", args, n); XtManageChild(Container); /* Add a bunch of Icon Gadgets */ IconGad = (Widget*) XtMalloc(NUM_ELEMS * sizeof(Widget)); /* Put some pixmaps in the Container */ for (i = 0; i < NUM_PIXMAP; i++) { char IconName[20] ; XmString icon_name; Pixmap pixmap; n = 0 ; sprintf(IconName, "IconGad%d", i); icon_name = XmStringGenerate(IconName, NULL, XmCHARSET_TEXT, NULL); /* make icons from pixmap files */ pixmap = XmGetPixmap(screen, BitmapPaths[i], BlackPixelOfScreen(screen), WhitePixelOfScreen(screen)); if (!pixmap) { printf("Can't make pixmap for file %s!\n", BitmapPaths[i]); exit(1); } XtSetArg(args[n], XmNx, PIXEL_X(i) ); n++; XtSetArg(args[n], XmNy, PIXEL_Y(i) ); n++; XtSetArg(args[n], XmNlabelString, icon_name); n++; XtSetArg(args[n], XmNlargeIconPixmap, pixmap); n++; IconGad[i] = XmCreateIconGadget(Container, IconName, args, n); XtManageChild(IconGad[i]); XmStringFree(icon_name); } /* Put some labels in the Container */ for (i = NUM_PIXMAP; i < NUM_ELEMS; i++) { char LabelName[20] ; XmString label_name; n = 0 ; sprintf(LabelName, "LabelName%d", i); label_name = XmStringGenerate(LabelName, NULL, XmCHARSET_TEXT, NULL); XtSetArg(args[n], XmNx, PIXEL_X(i) ); n++; XtSetArg(args[n], XmNy, PIXEL_Y(i) ); n++; XtSetArg(args[n], XmNlabelString, label_name); n++; XtSetArg(args[n], XmNlabelType, XmSTRING); n++; IconGad[i] = XmCreateIconGadget(Container, LabelName, args, n); XtManageChild(IconGad[i]); XmStringFree(label_name); } XtRealizeWidget(Shell1); /* Find out the default size for X and Y */ n = 0; XtSetArg( args[n], XmNwidth, &x_size ); n++; XtSetArg( args[n], XmNheight, &y_size ); n++; XtGetValues( ScrollWin, args, n ); /************************* * Assertions begin */ /* Assertions 1 and 2 */ n = 0; XtSetArg( args[n], XmNwidth, 175 ); n++; XtSetValues( ScrollWin, args, n ); CommonPause(); RestoreXY( ScrollWin, x_size, y_size ); UnselectAll( Container ); /* Assertions 3 and 4 */ n = 0; XtSetArg( args[n], XmNwidth, 400 ); n++; XtSetValues( ScrollWin, args, n ); CommonPause(); RestoreXY( ScrollWin, x_size, y_size ); UnselectAll( Container ); /* Assertions 5 and 6 */ n = 0; XtSetArg( args[n], XmNheight, 400 ); n++; XtSetValues( ScrollWin, args, n ); CommonPause(); RestoreXY( ScrollWin, x_size, y_size ); UnselectAll( Container ); /* Assertions 7 and 8 */ CommonPause(); XtAppMainLoop(app_context); for ( i=0; i < NUM_ELEMS; i++ ) XtDestroyWidget( IconGad[i] ); XtDestroyWidget( Container ); XtDestroyWidget( ScrollWin ); XtFree( (char *)IconGad ); }
void CreateHelpPopup ( Widget parent ) { Widget pane, rowcol, b; Pixmap pixmap; Pixel fg, bg; Arg args[15]; int n, error, verbose; char *startuptextH; char *file, *dpath, *icon_file; verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ("CreateHelpPopup\n" ); /* * Define home page file. */ dpath = GetConfigValue ("GarpHTML"); file = builddirpath ( dpath, home_html ); if ( file == NULL ) { printf ("*** CreateHelpPopup: HTML homepage is undefined ... exiting\n" ); exit ( 1 ); } /* * Create widgets for help dialog. */ n = 0; XtSetArg( args[n], XmNallowOverlap, False); n++; XtSetArg( args[n], XmNdialogStyle, XmDIALOG_MODELESS); n++; XtSetArg( args[n], XmNautoUnmanage, False); n++; XtSetArg( args[n], XmNwidth, 500); n++; XtSetArg( args[n], XmNheight, 700); n++; help.dialog = XmCreateFormDialog(parent,"help_dialog",args,n); rowcol = XtVaCreateManagedWidget ( "rowcol", xmRowColumnWidgetClass, help.dialog, XmNorientation, XmHORIZONTAL, NULL ); XtVaGetValues ( rowcol, XmNforeground, &fg, XmNbackground, &bg, NULL ); /* * Exit button. */ icon_file = (char *) GetIcon ("exit.xbm"); pixmap = XmGetPixmap ( XtScreen ( rowcol ), icon_file, fg, bg ); b = XtVaCreateManagedWidget ( "b", xmDrawnButtonWidgetClass, rowcol, XmNlabelType, XmPIXMAP, XmNlabelPixmap, pixmap, NULL ); XtAddCallback ( b, XmNactivateCallback, ExitHTMLCB, NULL ); Free ( icon_file ); /* * Home button. */ icon_file = (char *) GetIcon ("icon11.xbm"); pixmap = XmGetPixmap ( XtScreen ( rowcol ), icon_file, fg, bg ); b = XtVaCreateManagedWidget ( "b", xmDrawnButtonWidgetClass, rowcol, XmNlabelType, XmPIXMAP, XmNlabelPixmap, pixmap, NULL ); XtAddCallback ( b, XmNactivateCallback, HomeHTMLCB, NULL ); Free ( icon_file ); /* * Back button. */ icon_file = (char *) GetIcon ("icon09.xbm"); pixmap = XmGetPixmap ( XtScreen ( rowcol ), icon_file, fg, bg ); b = XtVaCreateManagedWidget ( "b", xmDrawnButtonWidgetClass, rowcol, XmNlabelType, XmPIXMAP, XmNlabelPixmap, pixmap, NULL ); XtAddCallback ( b, XmNactivateCallback, BackHTMLCB, NULL ); Free ( icon_file ); /* * Forward button. */ icon_file = (char *) GetIcon ("icon09.xbm"); pixmap = XmGetPixmap ( XtScreen ( rowcol ), icon_file, fg, bg ); b = XtVaCreateManagedWidget ( "b", xmDrawnButtonWidgetClass, rowcol, XmNlabelType, XmPIXMAP, XmNlabelPixmap, pixmap, NULL ); XtAddCallback ( b, XmNactivateCallback, ForwardHTMLCB, NULL ); Free ( icon_file ); /* * Pane widget to contain html widget. */ pane = XtVaCreateWidget("help_pane", xmPanedWindowWidgetClass, help.dialog, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, rowcol, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); /* * HTML widget. */ help.htlmWid = XtVaCreateWidget( "htlmWid", htmlWidgetClass, pane, XmNresizePolicy, XmRESIZE_ANY, WbNpointerMotionCallback, CrossingAnchorCB, WbNresolveImageFunction, *html_ImageResolve, XmNshadowThickness, 2, WbNverticalScrollOnRight, True, XmNwidth, 800, XmNheight, 600, NULL); XtAddCallback ( help.htlmWid, WbNanchorCallback, HTMLRefCB, NULL ); XtManageChild ( help.htlmWid ); startuptextH = ReadHyperTextFile ( file, &error ); HTMLSetText ( help.htlmWid, startuptextH, NULL, NULL, 0, 0, NULL ); XtFree ( startuptextH ); XtManageChild(pane); Free ( dpath ); Free ( file ); }
// --------------------------------------------------------------------------- int main (int argc, char* argv[]) { int i; struct timezone zone; struct timeval time; struct HEXON_TIME_STRUCT hexon; struct DAYSEC_STRUCT daysec; Widget shell; XtAppContext app; Widget button[0x11]; Pixmap pix[0x11]; Pixel fg; Pixel bg; const char* pixmap_filename[] = { "hexal-0-10x10.xpm", "hexal-1-10x10.xpm", "hexal-2-10x10.xpm", "hexal-3-10x10.xpm", "hexal-4-10x10.xpm", "hexal-5-10x10.xpm", "hexal-6-10x10.xpm", "hexal-7-10x10.xpm", "hexal-8-10x10.xpm", "hexal-9-10x10.xpm", "hexal-A-10x10.xpm", "hexal-B-10x10.xpm", "hexal-C-10x10.xpm", "hexal-D-10x10.xpm", "hexal-E-10x10.xpm", "hexal-F-10x10.xpm" "hexal-dot-10x10.xpm" }; #ifdef USE_PIXMAP_FROM_DATA const char** pixmap_data[] = { (const char**) hexal_0_10x10_xpm, (const char**) hexal_1_10x10_xpm, (const char**) hexal_2_10x10_xpm, (const char**) hexal_3_10x10_xpm, (const char**) hexal_4_10x10_xpm, (const char**) hexal_5_10x10_xpm, (const char**) hexal_6_10x10_xpm, (const char**) hexal_7_10x10_xpm, (const char**) hexal_8_10x10_xpm, (const char**) hexal_9_10x10_xpm, (const char**) hexal_A_10x10_xpm, (const char**) hexal_B_10x10_xpm, (const char**) hexal_C_10x10_xpm, (const char**) hexal_D_10x10_xpm, (const char**) hexal_E_10x10_xpm, (const char**) hexal_F_10x10_xpm, (const char**) hexal_dot_10x10_xpm }; #endif Set_Epoch (DEFAULT_EPOCH); Set_Format (DEFAULT_FORMAT); shell = XtAppInitialize (&app, "xHexClock", NULL, 0, &argc, argv, NULL, NULL, 0); for (i = 1; i < argc; i++) { char* argument = argv[i]; if ((strcmp (argument, "--help") == 0) || (strcmp (argument, "-h") == 0)) Usage(); else if (strequ (argument, "--epoch=" )) Set_Epoch (strchr (argument, '=') + 1); else if (strequ (argument, "--format=")) Set_Format (strchr (argument, '=') + 1); else if (strequ (argument, "--verbose")) verbose = 1; else { fprintf (stderr, PROGRAM_NAME ": *** error: unknown option \"%s\".\n\n", argument); Usage(); } } gettimeofday (&time, &zone); Set_Unix_Time (&daysec, &time, &zone); if (verbose) { printf ("Unix time (seconds.microseconds): %lu.%06lu (hex 0x%lx/0x%05lx.\n", time.tv_sec, time.tv_usec, time.tv_sec, time.tv_usec); printf ("Unix daysec (days.seconds): %lu.%05lu (hex 0x%lx/0x%05lx.\n", daysec.day, (long) daysec.sec, daysec.day, (long) daysec.sec); printf ("Epoch daysec (days.seconds): %lu.%05lu (hex 0x%lx/0x%05lx.\n", epoch.day, (long) epoch.sec, epoch.day, (long) epoch.sec); } daysec_sub (&daysec, &daysec, &epoch); if (verbose) { printf ("Daysec since epoch (days.seconds): %lu.%05lu (hex 0x%lx/0x%05lx.\n", daysec.day, (long) daysec.sec, daysec.day, (long) daysec.sec); } Hexon_Set_Day_Second (&hexon, daysec.day, daysec.sec); if (verbose) { printf ("Decimal hexon = %20.6f.\n", hexon.hexon); } // if (!Hexon_Print (stdout, output_format, &hexon)) // { // fprintf (stderr, PROGRAM_NAME ": *** error: could not print using format \"%s\".\n", Null_Check (output_format)); // return 1; // } XtVaGetValues (shell, XmNforeground, &fg, XmNbackground, &bg, NULL); XtRealizeWidget (shell); for (i = 0; i < 3 /* 0x10 */; i++) { #if defined (USE_PIXMAP_FROM_DATA) XpmAttributes attributes; int status; Display* display = XtDisplay (shell); Pixmap mask; XpmColorSymbol symbols[2]; #endif // button[i] = XtCreateManagedWidget (pixmap_filename[i], xmLabelWidgetClass, shell, NULL, 0); button[i] = XtVaCreateManagedWidget (pixmap_filename[i], xmLabelWidgetClass, shell, XmNx, i * 32, XmNy, 0, NULL); #if !defined (USE_PIXMAP_FROM_DATA) pix[i] = XmGetPixmap (XtScreen (shell), (char*) pixmap_filename[i], fg, bg); if (pix[i]) { XtVaSetValues (button[i], XmNlabelType, XmPIXMAP, XmNlabelPixmap, pix[i], #if 0 XmNx, 0, XmNy, 0, XmNwidth, 16, XmNheight, 16, #endif NULL); } #else symbols[0].name = "background"; symbols[0].value = NULL; symbols[0].pixel = bg; // symbols[1].name = "foreground"; // symbols[1].value = NULL; // symbols[1].pixel = fg; attributes.colorsymbols = symbols; attributes.numsymbols = 1; XtVaGetValues (button[i], XmNdepth, &attributes.depth, XmNcolormap, &attributes.colormap, NULL); attributes.visual = DefaultVisual (display, DefaultScreen (display)); attributes.valuemask = 0; // XpmDepth | XpmColormap | XpmVisual | XpmColorSymbols; status = XpmCreatePixmapFromData (display, DefaultRootWindow (display), (char**) pixmap_data[i], &pix[i], &mask, &attributes); if (mask /* != NULL */) XFreePixmap (display, mask); if (status == XpmSuccess) { XtVaSetValues (button[i], XmNlabelType, XmPIXMAP, XmNlabelPixmap, pix[i], XmNx, i * 16, XmNy, 0, XmNwidth, 16, XmNheight, 16, NULL); } #endif } // For each hexal symbol pixmap. // XtRealizeWidget (shell); XtAppMainLoop (app); return 0; } // main
Widget NxmVolcano_menuCreate ( Widget parent, Widget textwid, XtCallbackProc push_cb ) /************************************************************************ * NxmVolcano_menuCreate * * * * This function creates a volcano list menu. * * * * Widget NxmVolcano_menuCreate(parent, textwid, push_cb) * * * * Input parameters: * * parent Widget parent widget ID * * textwid Widget text field id on the left side * * (*push_cb)() void callback function for push btn * * * * Output parameters: * * NONE * * Return parameters: * * NxmVolcano_create Widget The menu bar widget * * * ** * * Log: * * H. Zeng/XTRIA 10/02 initial coding * * M. Li/SAIC 11/03 Re-arranged cascade button group * ***********************************************************************/ { Widget menub, menu, cascade, push_btn, vol_menu[24]; int toff = 5, menu_idx, ii, iret, nn; static Boolean first = TRUE; char *vol_list[] = {"AA-AM", "AN-AZ", "B", "CA-CH", "CI-CZ", "D-E", "F", "G", "H", "I-J", "KA-KH", "KI-KZ", "L", "MA-MC", "ME-MZ", "N", "O-P", "Q-R", "SA-SE", "SF-SZ", "TA-TH", "TI-TZ", "U", "V-Z" }; XmString xmstr; Pixel fg, bg; long btn_idx, ignore; char filename[256]; static Pixmap menu_pxm; /*---------------------------------------------------------------------*/ /* * If it is the first time NxmVolcano_menuCreate() be called, read * volcano info. from volcano.tbl. */ if ( _gotVolInfo == FALSE ) { NxmVolcano_rdInfo(); } /* * Create volcano menu bar and cascade button. */ menub = XmCreateMenuBar (parent, "tmbar", NULL, 0); XtVaSetValues (menub, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, textwid, XmNleftOffset, toff, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, toff, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, toff, XmNmarginHeight, 0, XmNmarginWidth, 0, XmNborderWidth, 0, XmNwidth, 5, XmNhighlightThickness, 1, XmNshadowThickness, 1, NULL); menu = XmCreatePulldownMenu (menub, "tmmenu", NULL, 0); cascade = XtVaCreateManagedWidget ("tmcascade", xmCascadeButtonWidgetClass, menub, XmNsubMenuId, menu, NULL); if (first) { first = FALSE; XtVaGetValues (parent, XmNforeground, &fg, XmNbackground, &bg, NULL); cfl_inqr ("menu_arrow.xbm", "$NAWIPS/icons/nmap", &ignore, filename, &iret); if (iret == 0) { menu_pxm = XmGetPixmap (XtScreen (parent), filename, fg, bg); } else { menu_pxm = XmUNSPECIFIED_PIXMAP; } } if (menu_pxm == (Pixmap)XmUNSPECIFIED_PIXMAP) { xmstr = XmStringCreateLocalized ("\\/"); XtVaSetValues (cascade, XmNlabelString, xmstr, NULL); XmStringFree (xmstr); } else { XtVaSetValues (cascade, XmNlabelType, XmPIXMAP, XmNlabelPixmap, menu_pxm, XmNmarginHeight, 0, XmNmarginWidth, 0, NULL); } /* * Create the first push button. */ btn_idx = 0; xmstr = XmStringCreateLocalized ("-Not_listed.__Enter_Name/Location-"); push_btn = XtVaCreateManagedWidget ("vol_list_button", xmPushButtonWidgetClass, menu, XmNlabelString, xmstr, XmNuserData, textwid, NULL); XmStringFree (xmstr); XtAddCallback ( push_btn, XmNactivateCallback, (XtCallbackProc)push_cb, (XtPointer)btn_idx ); btn_idx++; /* * Create cascade button group. */ nn = XtNumber(vol_list); for ( ii = 0; ii < nn; ii++ ) { xmstr = XmStringCreateLocalized (vol_list[ii]); vol_menu[ii] = XmCreatePulldownMenu (menu, "tmmenu", NULL, 0); XtVaCreateManagedWidget ("tmcascade", xmCascadeButtonWidgetClass, menu, XmNlabelString, xmstr, XmNsubMenuId, vol_menu[ii], NULL); XmStringFree (xmstr); } /* * Create the rest of volcano push buttons. */ for ( ii = 0; ii < _volNum; ii++ ) { /* * Check which cascade group the volcano station belongs to. */ if ( strcasecmp (_volTbl[ii].name, "AN") < 0 ) { menu_idx = 0; } else if ( strcasecmp (_volTbl[ii].name, "B") < 0 ) { menu_idx = 1; } else if ( strcasecmp (_volTbl[ii].name, "C") < 0 ) { menu_idx = 2; } else if ( strcasecmp (_volTbl[ii].name, "CI") < 0 ) { menu_idx = 3; } else if ( strcasecmp (_volTbl[ii].name, "D") < 0 ) { menu_idx = 4; } else if ( strcasecmp (_volTbl[ii].name, "F") < 0 ) { menu_idx = 5; } else if ( strcasecmp (_volTbl[ii].name, "G") < 0 ) { menu_idx = 6; } else if ( strcasecmp (_volTbl[ii].name, "H") < 0 ) { menu_idx = 7; } else if ( strcasecmp (_volTbl[ii].name, "I") < 0 ) { menu_idx = 8; } else if ( strcasecmp (_volTbl[ii].name, "K") < 0 ) { menu_idx = 9; } else if ( strcasecmp (_volTbl[ii].name, "KI") < 0 ) { menu_idx = 10; } else if ( strcasecmp (_volTbl[ii].name, "L") < 0 ) { menu_idx = 11; } else if ( strcasecmp (_volTbl[ii].name, "M") < 0 ) { menu_idx = 12; } else if ( strcasecmp (_volTbl[ii].name, "ME") < 0 ) { menu_idx = 13; } else if ( strcasecmp (_volTbl[ii].name, "N") < 0 ) { menu_idx = 14; } else if ( strcasecmp (_volTbl[ii].name, "O") < 0 ) { menu_idx = 15; } else if ( strcasecmp (_volTbl[ii].name, "Q") < 0 ) { menu_idx = 16; } else if ( strcasecmp (_volTbl[ii].name, "S") < 0 ) { menu_idx = 17; } else if ( strcasecmp (_volTbl[ii].name, "SF") < 0 ) { menu_idx = 18; } else if ( strcasecmp (_volTbl[ii].name, "T") < 0 ) { menu_idx = 19; } else if ( strcasecmp (_volTbl[ii].name, "TI") < 0 ) { menu_idx = 20; } else if ( strcasecmp (_volTbl[ii].name, "U") < 0 ) { menu_idx = 21; } else if ( strcasecmp (_volTbl[ii].name, "V") < 0 ) { menu_idx = 22; } else { menu_idx = 23; } xmstr = XmStringCreateLocalized (_volTbl[ii].name); push_btn = XtVaCreateManagedWidget ("vol_list_button", xmPushButtonWidgetClass, vol_menu[menu_idx], XmNlabelString, xmstr, XmNuserData, textwid, NULL); XmStringFree (xmstr); XtAddCallback ( push_btn, XmNactivateCallback, (XtCallbackProc)push_cb, (XtPointer)btn_idx ); btn_idx++; } XtManageChild(menub); return (menub); }
/*+++++++++++++++++++++++++++++++++++++++++++++*/ static void build_mainWindow( Widget shell ) { int count, n, n2; Arg args[MAX_ARGS]; Widget WidgList[10]; Widget frame; Widget mainMenu; Widget mainRC; Widget filePulldown; Widget helpPulldown; Widget exitBtn; char *mnemonic; char *tmpStr; Pixmap pixmap; XmString labelString; Pixmap ditherPix; XmPixelSet pixelSet[XmCO_NUM_COLORS]; Pixel bg; short a,i,p,s; /* saveRestore * Note that save.poscnt has been initialized elsewhere. * save.posArgs may contain information from restoreAudio().*/ XtSetArg(save.posArgs[save.poscnt], XmNnoResize, True); save.poscnt++; XtSetArg(save.posArgs[save.poscnt], XmNresizePolicy, XmRESIZE_NONE); save.poscnt++; style.mainWindow= XmCreateMainWindow(shell,"mainWindow", save.posArgs, save.poscnt); XtAddCallback(style.mainWindow, XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_MAIN_WINDOW); n = 0; tmpStr = (char *)XtMalloc(strlen(GETMESSAGE(4, 1, "Style Manager"))+1); sprintf(tmpStr, GETMESSAGE(4, 1, "Style Manager")); XtSetArg(args[n], XmNtitle, tmpStr); n++; XtSetArg(args[n], XmNiconName, (char *)GETMESSAGE(4, 37, "Style")); n++; XtSetValues(XtParent(style.mainWindow), args, n); XtFree(tmpStr); n = 0; mainMenu= XmCreateMenuBar(style.mainWindow,"mainMenu", args, n); XtAddCallback(mainMenu, XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_MENUBAR); XtManageChild(mainMenu); /* create the pulldown widgets */ n = 0; filePulldown= XmCreatePulldownMenu(mainMenu,"fileMenu", args, n ); XtAddCallback(filePulldown, XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_FILE_MENU); n = 0; helpPulldown= XmCreatePulldownMenu(mainMenu, "helpMenu" , args, n ); XtAddCallback(helpPulldown, XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_HELP_MENU); /* create the cascade butons */ count = 0; n = 0; mnemonic = ((char *)GETMESSAGE(4, 2, "F")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 3, "File")); XtSetArg(args[n], XmNlabelString, labelString); n++; XtSetArg(args[n], XmNsubMenuId, filePulldown); n++; XtSetArg (args[n], XmNmarginWidth, LB_MARGIN_WIDTH); n++; WidgList[count++]= XmCreateCascadeButton(mainMenu, "fileCascadeButton", args, n ); XtAddCallback(WidgList[count-1], XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_FILE_MENU); XmStringFree(labelString); n = 0; mnemonic = ((char *)GETMESSAGE(4, 4, "H")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 5, "Help")); XtSetArg(args[n], XmNlabelString, labelString); n++; XtSetArg(args[n], XmNsubMenuId, helpPulldown); n++; XtSetArg (args[n], XmNmarginWidth, 6); n++; WidgList[count++]= XmCreateCascadeButton(mainMenu, "helpCascadeButton", args, n ); XtAddCallback(WidgList[count-1], XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_HELP_MENU); XmStringFree(labelString); n = 0; XtSetArg(args[n], XmNmenuHelpWidget, WidgList[count-1]); n++; XtSetValues (mainMenu, args, n); XtManageChildren (WidgList, count); /* create the File menu pane's buttons */ n = 0; mnemonic = ((char *)GETMESSAGE(4, 53, "x")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 7, "Exit")); XtSetArg(args[n], XmNlabelString, labelString); n++; exitBtn= XmCreatePushButton(filePulldown, "exit", args, n ); XtAddCallback(exitBtn, XmNactivateCallback, activateCB_exitBtn, NULL); XtAddCallback(exitBtn, XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_EXIT); XtManageChild(exitBtn); XmStringFree(labelString); /* create the Help menu pane's buttons */ count =0; n = 0; mnemonic = ((char *)GETMESSAGE(4, 54, "v")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 55, "Overview")); XtSetArg(args[n], XmNlabelString, labelString); n++; WidgList[count++]= XmCreatePushButton(helpPulldown, "overview", args, n ); XtAddCallback(WidgList[count-1], XmNactivateCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_INTRODUCTION); XmStringFree(labelString); n = 0; WidgList[count++]= XmCreateSeparatorGadget(helpPulldown,"separator",args,n); n = 0; mnemonic = ((char *)GETMESSAGE(4, 43, "T")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 56, "Tasks")); XtSetArg(args[n], XmNlabelString, labelString); n++; WidgList[count++]= XmCreatePushButton(helpPulldown, "tasks", args, n ); XtAddCallback(WidgList[count-1], XmNactivateCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_TASKS); XmStringFree(labelString); n = 0; mnemonic = ((char *)GETMESSAGE(4, 45, "R")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 57, "Reference")); XtSetArg(args[n], XmNlabelString, labelString); n++; WidgList[count++]= XmCreatePushButton(helpPulldown, "reference", args, n ); XtAddCallback(WidgList[count-1], XmNactivateCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_REFERENCE); XmStringFree(labelString); n = 0; mnemonic = ((char *)GETMESSAGE(4, 47, "O")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 48, "On Item")); XtSetArg(args[n], XmNlabelString, labelString); n++; WidgList[count++]= XmCreatePushButton(helpPulldown, "onItem", args, n ); XtAddCallback(WidgList[count-1], XmNactivateCallback, (XtCallbackProc)HelpModeCB, (XtPointer)NULL); XmStringFree(labelString); n = 0; WidgList[count++] = XmCreateSeparatorGadget(helpPulldown,"separator",args,n); n = 0; mnemonic = ((char *)GETMESSAGE(4, 49, "U")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 58, "Using Help")); XtSetArg(args[n], XmNlabelString, labelString); n++; WidgList[count++]= XmCreatePushButton(helpPulldown, "usingHelp", args, n ); XtAddCallback(WidgList[count-1], XmNactivateCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_USING); XmStringFree(labelString); n = 0; WidgList[count++] = XmCreateSeparatorGadget(helpPulldown,"separator",args,n); n = 0; mnemonic = ((char *)GETMESSAGE(4, 59, "A")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 60, "About Style Manager")); XtSetArg(args[n], XmNlabelString, labelString); n++; WidgList[count++]= XmCreatePushButton(helpPulldown, "stylemanager", args, n ); XtAddCallback(WidgList[count-1], XmNactivateCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_VERSION); XmStringFree(labelString); XtManageChildren(WidgList, count); /* create frame and row column for icon gadgets */ n = 0; XtSetArg(args[n], XmNresizePolicy, XmRESIZE_NONE); n++; XtSetArg(args[n], XmNshadowType, XmSHADOW_OUT); n++; XtSetArg(args[n], XmNshadowThickness, 1); n++; frame = XmCreateFrame(style.mainWindow, "frame", args, n); XtManageChild(frame); /* Save pixels for later use */ /* primary top/bottom shadow -> fg/bg for pixmaps in primary areas */ /* secondary top/bottom shadow -> fg/bg for pixmaps in secondary areas */ /* secondary select color -> backgrounds of editable text areas */ /* secondary foreground -> fill color on toggle indicators */ /* Get the primary colors to be used later */ n = 0; XtSetArg(args[n], XmNbackground, &bg); n++; XtGetValues(style.mainWindow, args, n); XmGetColors (style.screen, style.colormap, bg, NULL, &style.primTSCol, &style.primBSCol, NULL); /* Get the secondary colors to be used later */ n = 0; XtSetArg(args[n], XmNbackground, &style.secBgCol); n++; XtGetValues(exitBtn, args, n); XmGetColors (style.screen, style.colormap, style.secBgCol, &style.tgSelectColor, &style.secTSCol, &style.secBSCol, &style.secSelectColor); if ((style.secTSCol == style.secBSCol) || /* B_W or shadowPixmaps==True */ (!style.useMultiColorIcons)) /* multiColorIcons turned off */ { /* force TS = White, BS = Black */ style.secTSCol = style.primTSCol = WhitePixelOfScreen(style.screen); style.secBSCol = style.primBSCol = BlackPixelOfScreen(style.screen); } XmeGetPixelData(style.screenNum, &colorUse, pixelSet, &a, &i, &p, &s); n = 0; if (colorUse == XmCO_BLACK_WHITE) { ditherPix = XmGetPixmap (style.screen, "50_foreground", style.primBSCol,style.primTSCol); XtSetArg(args[n], XmNbackgroundPixmap, ditherPix); n++; } XtSetArg(args[n], XmNallowOverlap, False); n++; XtSetArg(args[n], XmNadjustLast, False); n++; XtSetArg(args[n], XmNpacking, XmPACK_TIGHT); n++; XtSetArg(args[n], XmNspacing, style.horizontalSpacing); n++; mainRC = XmCreateRowColumn(frame, "mainRC", args, n); XtManageChild(mainRC); n = 0; XtSetArg(args[n], XmNmenuBar, mainMenu); n++; XtSetArg(args[n], XmNcommandWindow, NULL); n++; XtSetArg(args[n], XmNworkWindow, frame); n++; XtSetValues (style.mainWindow, args, n); ProcessComponentList (shell, mainRC); }