String GetIconName (String image_name, unsigned int icon_size) { String return_name; Screen * screen = XtScreen (panel.shell); /* Get name. */ return_name = _DtGetIconFileName (screen, image_name, NULL, NULL, icon_size); if (return_name == NULL) return_name = _DtGetIconFileName (screen, image_name, NULL, NULL, DtUNSPECIFIED); if (return_name == NULL) return_name = XtNewString (image_name); /* Return value to be freed by caller. */ return (return_name); }
static void ProcessComponentList( Widget parent, Widget mainRC ) { int count=0; int j=0; int n, n2; Arg args[MAX_ARGS]; Widget componentWidget; int s; char *string; char *resString, *resString2; XmString cmp_string; int helpTag; char *dtIcon; int len; style.workProcs = False; if (style.xrdb.componentList == NULL) return; n = 0; XtSetArg(args[n], XmNalignment, XmALIGNMENT_CENTER); n++; XtSetArg(args[n], XmNpixmapPosition, XmPIXMAP_TOP); n++; XtSetArg(args[n], XmNshadowType, XmSHADOW_OUT); n++; n2 = 3; /* number of preset args for creating Icons */ resString = strdup (style.xrdb.componentList); resString2 = resString; len = strlen(resString); string = strtok(resString, " "); s = 0; while (string != NULL) { /* check for valid name, duplicate name *** */ /* create Icon in Dtstyle main window */ n = n2; XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++; if (colorUse == XmCO_BLACK_WHITE) { XtSetArg(args[n], XmNuseEmbossedText, False); n++; } XtSetArg(args[n], XmNpixmapForeground, style.primBSCol); n++; XtSetArg(args[n], XmNpixmapBackground, style.primTSCol); n++; if (strcmp(string, COLOR) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 27, "Color")); helpTag = HELP_COLOR_BUTTON; dtIcon = _DtGetIconFileName(style.screen, COLOR_ICON, NULL, NULL, NULL); style.workProcs = True; } else if (strcmp(string, FONT) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 28, "Font")); dtIcon = _DtGetIconFileName(style.screen, FONT_ICON, NULL, NULL, NULL); helpTag = HELP_FONT_BUTTON; } else if (strcmp(string, BACKDROP) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 29, "Backdrop")); dtIcon = _DtGetIconFileName(style.screen, BACKDROP_ICON, NULL, NULL, NULL); helpTag = HELP_BACKDROP_BUTTON; } else if (strcmp(string, KEYBOARD) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 30, "Keyboard")); dtIcon = _DtGetIconFileName(style.screen, KEYBOARD_ICON, NULL, NULL, NULL); helpTag = HELP_KEYBOARD_BUTTON; } else if (strcmp(string, MOUSE) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 31, "Mouse")); dtIcon = _DtGetIconFileName(style.screen, MOUSE_ICON, NULL, NULL, NULL); helpTag = HELP_MOUSE_BUTTON; } else if (strcmp(string, BEEP) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 32, "Beep")); dtIcon = _DtGetIconFileName(style.screen, BEEP_ICON, NULL, NULL, NULL); helpTag = HELP_AUDIO_BUTTON; } else if (strcmp(string, SCREEN) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 33, "Screen")); dtIcon = _DtGetIconFileName(style.screen, SCREEN_ICON, NULL, NULL, NULL); helpTag = HELP_SCREEN_BUTTON; } else if (strcmp(string, DTWM) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 38, "Window")); dtIcon = _DtGetIconFileName(style.screen, DTWM_ICON, NULL, NULL, NULL); helpTag = HELP_DTWM_BUTTON; } else if (strcmp(string, STARTUP) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 35, "Startup")); dtIcon = _DtGetIconFileName(style.screen, STARTUP_ICON, NULL, NULL, NULL); helpTag = HELP_STARTUP_BUTTON; } else if (strcmp(string, I18N) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 34, "Intl'")); dtIcon = _DtGetIconFileName(style.screen, I18N_ICON, NULL, NULL, NULL); helpTag = HELP_I18N_BUTTON; } else { s += strlen(string) +1; if (resString+s >= resString2 + len) string = NULL; else string = strtok(resString+s, " "); continue; } XtSetArg(args[n], XmNimageName, dtIcon); n++; XtSetArg(args[n], XmNstring, cmp_string); n++; componentWidget = _DtCreateControl(mainRC, string, args, n); XtManageChild (componentWidget); XtAddCallback(componentWidget, XmNcallback, activateCB, string); XtAddCallback(componentWidget, XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)helpTag); XmStringFree(cmp_string); XtFree(dtIcon); s += strlen(string) +1; if (resString+s >= resString2 + len) string = NULL; else string = strtok(resString+s, " "); } /* while */ }
/*************************************************************************** * * SetDtLabelAndIcon * * label to display in the dt_label widget and * the logo to display in logo_pixmap **************************************************************************/ void SetDtLabelAndIcon() { static XmString blanks = NULL; int i; char *logoFile; char *logoName; char *temp_p; #ifdef VG_TRACE vg_TRACE_EXECUTION("main: entered SetDtLabelAndIcon ..."); #endif /* VG_TRACE */ if (NULL == blanks) blanks = XmStringCreateLocalized(" "); /* * if user is logging in, set dt_label desired. No more than * one desktop can be selected at a time ... */ i = 0; XtSetArg(argt[0], XmNset, FALSE); i++; XtSetValues(options_failsafe, argt, i); XtSetValues(options_dtlite, argt, i); XtSetValues(options_dt, argt, i); if (options_last_dt != NULL) XtSetValues(options_last_dt, argt, i); for(i = 0; i<appInfo.altDts ; ++i) if(alt_dts[i] != NULL) XtSetValues(alt_dts[i], argt, i); if (NULL != default_dt) { i = 0; XtSetArg(argt[i], XmNset, True); i++; XtSetValues(default_dt, argt, i); if(default_dt == options_last_dt) xmstr = blanks; else { i = 0; XtSetArg(argt[i], XmNlabelString, &xmstr); i++; XtGetValues(default_dt, argt, i); } i = 0; XtSetArg(argt[i], XmNuserData, &logoFile); i++; XtGetValues(default_dt, argt, i); } else { xmstr = blanks; logoFile = logoInfo.bitmapFile; } #ifdef FIX_FOR_DEFECT_CDExc19307 /* * This code causes the Session toggle buttons to be reset * to the default setting when the user commits a typing error. * NOT very user friendly. * * As for setting the defaults after the user is done entering * the we could do the same thing by passing in an argument. For * now, I'm not convinced that it is required. */ /* * to set the defaults after the user is done * entering the login .. */ if (strcmp(userName,"\0") != 0) strcpy(userName,"\0"); #endif i = 0; XtSetArg(argt[i], XmNlabelString, xmstr); i++; XtSetValues(dt_label, argt, i); /* * remove trailing spaces */ if(strchr(logoFile,' ')) temp_p = strtok(logoFile," "); else temp_p = logoFile; logoName = _DtGetIconFileName( DefaultScreenOfDisplay(dpyinfo.dpy), temp_p, NULL, NULL, 0); if (logoName == NULL) { LogError( ReadCatalog(MC_LOG_SET,MC_LOG_NO_LOGOBIT,MC_DEF_LOG_NO_LOGOBIT), logoFile); logoFile = NULL; } i = 0; XtSetArg(argt[i], XmNimageName, logoName); i++; XtSetValues(logo_pixmap, argt, i); }
void MenuItemCB( Widget w, XtPointer client_data, XtPointer call_data ) { int i; char *logoFile; char *logoName; char *temp_p; char temp[MAXPATHLEN]; #ifdef VG_TRACE vg_TRACE_EXECUTION("main: entered MenuItemCB ..."); #endif /* VG_TRACE */ session_selected = True; switch ( (int) client_data) { case OB_RESTART_SERVER: CleanupAndExit(NULL, NOTIFY_RESTART); break; case OB_NO_WINDOWS: CleanupAndExit(NULL, NOTIFY_NO_WINDOWS); break; case OB_COPYRIGHT: _DtShowDialog(copyright, NULL); break; case OB_ALT_DTS: case OB_FAILSAFE: case OB_DTLITE: case OB_DT: case OB_LAST_DT: /* * set the label on the dt_label widget.. */ if(w != options_last_dt) { XtSetArg(argt[0], XmNlabelString, &xmstr); XtGetValues(w, argt, 1); XtSetArg(argt[0], XmNlabelString, xmstr); XtSetValues(dt_label, argt, 1); } else ClearDtlabel(); i = 0; XtSetArg(argt[i], XmNuserData, &logoFile ); i++; XtGetValues(w, argt, i); /* * remove trailing spaces */ if(strchr(logoFile,' ')) temp_p = strtok(logoFile," "); else temp_p = logoFile; logoName = _DtGetIconFileName(DefaultScreenOfDisplay(dpyinfo.dpy), temp_p, NULL, NULL, 0); if (logoName == NULL) { LogError( ReadCatalog(MC_LOG_SET,MC_LOG_NO_LOGOBIT,MC_DEF_LOG_NO_LOGOBIT), logoFile); logoFile = NULL; } i = 0; XtSetArg(argt[i], XmNimageName, logoName); i++; XtSetValues(logo_pixmap, argt, i); /* * Clear Dt toggles... */ ClearDtButtons(); /* * set the selected toggle button... */ XtSetArg(argt[0], XmNset, True); XtSetValues(w, argt, 1); SetDefaultDt(w); /* * return focus to name/password widgets... */ if ( focusWidget != NULL) ProcessTraversal(focusWidget, XmTRAVERSE_CURRENT); break; } }
void MakeLogo( void ) { register int i; char *logoFile; /* name of logo bitmap file */ Pixmap logoPixmap; /* logo pixmap */ char *logoName; /* logo name */ int logoWidth, logoHeight; /* width, height of logo */ Pixel fg, bg; /* foreground, background colors */ Pixmap dsPixmap; /* drop shadow pixmap */ int dsWidth, dsHeight; /* width, height of drop shadow */ Pixmap pixmap; /* scratch pixmap */ GC gc; /* scratch GC */ XGCValues gcval; /* GC values */ unsigned int width, height; /* width, height of bitmap */ int x_hot, y_hot; /* bitmap hot spot (if any)*/ /* * get the user's logo preferences... */ XtGetSubresources(table, &logoInfo, "logo", "Logo", logoResources, XtNumber(logoResources), NULL, 0); /* * create the logo frame... */ i = InitArg(Frame); XtSetArg(argt[i], XmNshadowType, XmSHADOW_OUT); i++; XtSetArg(argt[i], XmNshadowThickness, 2); i++; XtSetArg(argt[i], XmNtopAttachment, XmATTACH_FORM); i++; XtSetArg(argt[i], XmNtopOffset, 15); i++; XtSetArg(argt[i], XmNbottomAttachment, XmATTACH_FORM); i++; XtSetArg(argt[i], XmNbottomOffset, 15); i++; XtSetArg(argt[i], XmNrightAttachment, XmATTACH_FORM); i++; XtSetArg(argt[i], XmNrightOffset, 15); i++; XtSetArg(argt[i], XmNleftAttachment, XmATTACH_WIDGET); i++; XtSetArg(argt[i], XmNleftWidget, matteFrame); i++; logo1 = XmCreateFrame(matte, "logo", argt, i); XtManageChild(logo1); /* * get the colors of the frame... */ XtSetArg(argt[0], XmNforeground, &fg); XtSetArg(argt[1], XmNbackground, &bg); XtGetValues(logo1, argt, 2); /* * create the logo pixmap... */ logoFile = logoInfo.bitmapFile; #if defined (_AIX) && defined (_POWER) /* * On AIX4 we have a Dtlogo.s.pm */ # define LOGO_TYPE (LOWRES ? DtSMALL : 0) #else # define LOGO_TYPE 0 #endif logoName = _DtGetIconFileName(DefaultScreenOfDisplay(dpyinfo.dpy), logoFile, NULL, NULL, LOGO_TYPE); if (logoName == NULL) { LogError( ReadCatalog(MC_LOG_SET,MC_LOG_NO_LOGOBIT,MC_DEF_LOG_NO_LOGOBIT), logoFile); logoFile = NULL; } /* * create the logo control... */ i = InitArg(LabelG); XtSetArg(argt[i], XmNmarginWidth, 0); i++; XtSetArg(argt[i], XmNmarginHeight, 0); i++; XtSetArg(argt[i], XmNhighlightThickness, 0); i++; XtSetArg(argt[i], XmNbehavior, XmICON_LABEL); i++; XtSetArg(argt[i], XmNfillMode, XmFILL_TRANSPARENT); i++; XtSetArg(argt[i], XmNstring, NULL); i++; if (logoName != NULL) { XtSetArg(argt[i], XmNpixmapForeground, fg); i++; XtSetArg(argt[i], XmNpixmapBackground, bg); i++; XtSetArg(argt[i], XmNimageName, logoName); i++; } else { /* * use built-in logo if no logo was not found */ logoPixmap = XCreatePixmapFromBitmapData( dpyinfo.dpy, /* display */ dpyinfo.root, /* drawable */ (char *)dt_logo_bits, /* data */ dt_logo_width, /* width */ dt_logo_height, /* height */ fg, /* foreground */ bg, /* background */ dpyinfo.depth); /* depth */ logoWidth = dt_logo_width; logoHeight = dt_logo_height; XtSetArg(argt[i], XmNpixmap, logoPixmap); i++; } logo_pixmap = _DtCreateIcon(logo1, "logo_pixmap", argt, i); XtManageChild(logo_pixmap); XtSetArg(argt[0], XmNheight, 245); /* keeps dialog a consistent height and width */ XtSetArg(argt[1], XmNwidth, 245); XtSetValues(logo1, argt, 2); }