comparison lwlib/xlwmenu.c @ 380:8626e4521993 r21-2-5

Import from CVS: tag r21-2-5
author cvs
date Mon, 13 Aug 2007 11:07:10 +0200
parents 6240c7796c7a
children 7d59cb494b73
comparison
equal deleted inserted replaced
379:76b7d63099ad 380:8626e4521993
81 {XmNfontList, XmCFontList, XmRFontList, sizeof(XmFontList), 81 {XmNfontList, XmCFontList, XmRFontList, sizeof(XmFontList),
82 offset(menu.fallback_font_list), 82 offset(menu.fallback_font_list),
83 /* We must use an iso8859-1 font here, or people without $LANG set lose. 83 /* We must use an iso8859-1 font here, or people without $LANG set lose.
84 It's fair to assume that those who do have $LANG set also have the 84 It's fair to assume that those who do have $LANG set also have the
85 *fontList resource set, or at least know how to deal with this. */ 85 *fontList resource set, or at least know how to deal with this. */
86 XtRString, "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1"}, 86 XtRString, (XtPointer) "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1"},
87 #else 87 #else
88 {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), 88 {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
89 offset(menu.font), XtRString, "XtDefaultFont"}, 89 offset(menu.font), XtRString, (XtPointer) "XtDefaultFont"},
90 # ifdef USE_XFONTSET 90 # ifdef USE_XFONTSET
91 {XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet), 91 {XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet),
92 offset(menu.font_set), XtRString, "XtDefaultFontSet"}, 92 offset(menu.font_set), XtRString, (XtPointer) "XtDefaultFontSet"},
93 # endif 93 # endif
94 #endif 94 #endif
95 {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), 95 {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
96 offset(menu.foreground), XtRString, "XtDefaultForeground"}, 96 offset(menu.foreground), XtRString, (XtPointer) "XtDefaultForeground"},
97 {XtNbuttonForeground, XtCButtonForeground, XtRPixel, sizeof(Pixel), 97 {XtNbuttonForeground, XtCButtonForeground, XtRPixel, sizeof(Pixel),
98 offset(menu.button_foreground), XtRString, "XtDefaultForeground"}, 98 offset(menu.button_foreground), XtRString, (XtPointer) "XtDefaultForeground"},
99 {XtNhighlightForeground, XtCHighlightForeground, XtRPixel, sizeof(Pixel), 99 {XtNhighlightForeground, XtCHighlightForeground, XtRPixel, sizeof(Pixel),
100 offset(menu.highlight_foreground), XtRString, "XtDefaultForeground"}, 100 offset(menu.highlight_foreground), XtRString, (XtPointer) "XtDefaultForeground"},
101 {XtNtitleForeground, XtCTitleForeground, XtRPixel, sizeof(Pixel), 101 {XtNtitleForeground, XtCTitleForeground, XtRPixel, sizeof(Pixel),
102 offset(menu.title_foreground), XtRString, "XtDefaultForeground"}, 102 offset(menu.title_foreground), XtRString, (XtPointer) "XtDefaultForeground"},
103 {XtNmargin, XtCMargin, XtRDimension, sizeof(Dimension), 103 {XtNmargin, XtCMargin, XtRDimension, sizeof(Dimension),
104 offset(menu.margin), XtRImmediate, (XtPointer)2}, 104 offset(menu.margin), XtRImmediate, (XtPointer)2},
105 {XmNmarginWidth, XmCMarginWidth, XmRHorizontalDimension, sizeof(Dimension), 105 {XmNmarginWidth, XmCMarginWidth, XmRHorizontalDimension, sizeof(Dimension),
106 offset(menu.horizontal_margin), XtRImmediate, (XtPointer)2}, 106 offset(menu.horizontal_margin), XtRImmediate, (XtPointer)2},
107 {XmNmarginHeight, XmCMarginHeight, XmRVerticalDimension, sizeof(Dimension), 107 {XmNmarginHeight, XmCMarginHeight, XmRVerticalDimension, sizeof(Dimension),
865 #else 865 #else
866 char *string 866 char *string
867 #endif 867 #endif
868 ) 868 )
869 { 869 {
870 int i,s=0; 870 int i, s = 0;
871 char *chars; 871 char *chars;
872 872
873 #ifdef NEED_MOTIF 873 #ifdef NEED_MOTIF
874 XmStringGetLtoR (string, XmFONTLIST_DEFAULT_TAG, &chars); 874 XmStringGetLtoR (string, XmFONTLIST_DEFAULT_TAG, &chars);
875 #else 875 #else
876 chars = string; 876 chars = string;
877 #endif 877 #endif
878 for (i=0;chars[i];++i) { 878 for (i=0; chars[i]; ++i) {
879 if (chars[i]=='%'&&chars[i+1]=='_') { 879 if (chars[i] == '%' && chars[i+1] == '_') {
880 int w; 880 int w;
881 881
882 x += string_draw_range (mw, window, x, y, gc, chars, s, i); 882 x += string_draw_range (mw, window, x, y, gc, chars, s, i);
883 w = string_draw_range (mw, window, x, y, gc, chars, i+2, i+3); 883 w = string_draw_range (mw, window, x, y, gc, chars, i+2, i+3);
884 884
1473 { 1473 {
1474 printf ("\n"); 1474 printf ("\n");
1475 print_widget_value (wv->next, 0, depth); 1475 print_widget_value (wv->next, 0, depth);
1476 } 1476 }
1477 } 1477 }
1478 #endif 1478 #endif /* SLOPPY_TYPES < 2 */
1479 1479
1480 static Boolean 1480 static Boolean
1481 all_dashes_p (char *s) 1481 all_dashes_p (char *s)
1482 { 1482 {
1483 char *p; 1483 char *p;
1487 1487
1488 if (*p == '!' || *p == '\0') 1488 if (*p == '!' || *p == '\0')
1489 return True; 1489 return True;
1490 return False; 1490 return False;
1491 } 1491 }
1492 #endif 1492 #endif /* SLOPPY_TYPES */
1493 1493
1494 static widget_value_type 1494 static widget_value_type
1495 menu_item_type (widget_value *val) 1495 menu_item_type (widget_value *val)
1496 { 1496 {
1497 if (val->type != UNSPECIFIED_TYPE) 1497 if (val->type != UNSPECIFIED_TYPE)
1498 return val->type; 1498 return val->type;
1499 #if SLOPPY_TYPES
1500 else if (all_dashes_p (val->name))
1501 return SEPARATOR_TYPE;
1502 else if (val->name && val->name[0] == '\0') /* push right */
1503 return PUSHRIGHT_TYPE;
1504 else if (val->contents) /* cascade */
1505 return CASCADE_TYPE;
1506 else if (val->call_data) /* push button */
1507 return BUTTON_TYPE;
1499 else 1508 else
1500 { 1509 return TEXT_TYPE;
1501 #if SLOPPY_TYPES
1502 if (all_dashes_p (val->name))
1503 return SEPARATOR_TYPE;
1504 else if (val->name && val->name[0] == '\0') /* push right */
1505 return PUSHRIGHT_TYPE;
1506 else if (val->contents) /* cascade */
1507 return CASCADE_TYPE;
1508 else if (val->call_data) /* push button */
1509 return BUTTON_TYPE;
1510 else
1511 return TEXT_TYPE;
1512 #else 1510 #else
1511 else
1513 abort(); 1512 abort();
1513 return UNSPECIFIED_TYPE; /* Not reached */
1514 #endif 1514 #endif
1515 }
1516 } 1515 }
1517 1516
1518 static void 1517 static void
1519 label_button_size (XlwMenuWidget mw, 1518 label_button_size (XlwMenuWidget mw,
1520 widget_value *val, 1519 widget_value *val,