Mercurial > hg > xemacs-beta
comparison lwlib/xlwmenu.c @ 4521:383ab474a241
Fix docstring typo.
author | Stephen J. Turnbull <stephen@xemacs.org> |
---|---|
date | Tue, 28 Oct 2008 10:38:26 +0900 |
parents | 03f6627a2e09 |
children | fc7067b7f407 |
comparison
equal
deleted
inserted
replaced
4520:279cadceaa13 | 4521:383ab474a241 |
---|---|
68 <BtnUp>: select()\n\ | 68 <BtnUp>: select()\n\ |
69 "; | 69 "; |
70 | 70 |
71 extern Widget lw_menubar_widget; | 71 extern Widget lw_menubar_widget; |
72 | 72 |
73 #define offset(field) XtOffset(XlwMenuWidget, field) | |
74 static XtResource | 73 static XtResource |
75 xlwMenuResources[] = | 74 xlwMenuResources[] = |
76 { | 75 { |
76 /* The offset macro is a standard trick. The remaining macros are an | |
77 experiment to compress redundancies in resource descriptions, and shut | |
78 up GCC 4.3 (the String casts, which keep G++ from complaining about | |
79 implicit conversions from const char *). */ | |
80 #define offset(field) XtOffset(XlwMenuWidget, menu.field) | |
81 #define fontres(name,_class,repr,type,member,value) \ | |
82 Xt_RESOURCE (name, _class, repr, type, offset(member), XtRString, value) | |
83 #define mflres(name,cls,member,repr,value) \ | |
84 Xt_RESOURCE (name, cls, XmRFontList, XmFontList, offset(member), repr, value) | |
85 #define dimres(name,cls,repr,member,value) \ | |
86 Xt_RESOURCE (name, cls, repr, Dimension, offset(member), XtRImmediate, value) | |
87 #define boolres(nm,cls,member,val) \ | |
88 Xt_RESOURCE (nm, cls, XtRBoolean, Boolean, offset(member), XtRImmediate, val) | |
89 #define cbres(name,member,value) \ | |
90 Xt_RESOURCE (name, XtCCallback, XtRCallback, XtPointer, offset(member), \ | |
91 XtRCallback, value) | |
92 #define pixres(name,_class,member,repr,value) \ | |
93 Xt_RESOURCE (name, _class, XtRPixel, Pixel, offset(member), repr, value) | |
94 #define fgpixres(name,_class,member) \ | |
95 pixres (name, _class, member, XtRString, "XtDefaultForeground") | |
96 #define nullpixres(name,_class,member) \ | |
97 pixres (name, _class, member, XtRImmediate, -1) | |
98 #define pmres(name,cls,member) \ | |
99 Xt_RESOURCE (name, cls, XtRPixmap, Pixmap, offset(member), XtRImmediate, None) | |
100 | |
77 #if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) | 101 #if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) |
78 /* There are three font list resources, so that we can accept either of | 102 /* There are three font list resources, so that we can accept either of |
79 the resources *fontList: or *font:, and so that we can tell the | 103 the resources *fontList: or *font:, and so that we can tell the |
80 difference between them being specified, and being defaulted to a | 104 difference between them being specified, and being defaulted to a |
81 font from the XtRString specified here. */ | 105 font from the XtRString specified here. */ |
82 {XmNfontList, XmCFontList, XmRFontList, sizeof(XmFontList), | 106 mflres (XmNfontList, XmCFontList, font_list, XtRImmediate, 0), |
83 offset(menu.font_list), XtRImmediate, (XtPointer)0}, | 107 mflres (XtNfont, XtCFont, font_list_2, XtRImmediate, 0), |
84 {XtNfont, XtCFont, XmRFontList, sizeof(XmFontList), | 108 mflres (XmNfontList, XmCFontList, fallback_font_list, |
85 offset(menu.font_list_2),XtRImmediate, (XtPointer)0}, | |
86 {XmNfontList, XmCFontList, XmRFontList, sizeof(XmFontList), | |
87 offset(menu.fallback_font_list), | |
88 /* We must use an iso8859-1 font here, or people without $LANG set lose. | 109 /* We must use an iso8859-1 font here, or people without $LANG set lose. |
89 It's fair to assume that those who do have $LANG set also have the | 110 It's fair to assume that those who do have $LANG set also have the |
90 *fontList resource set, or at least know how to deal with this. */ | 111 *fontList resource set, or at least know how to deal with this. */ |
91 XtRString, (XtPointer) "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1"}, | 112 XtRString, (XtPointer) "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1"), |
92 #else | 113 #else |
93 {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), | 114 fontres (XtNfont, XtCFont, XtRFontStruct, XFontStruct *, font, |
94 offset(menu.font), XtRString, (XtPointer) "XtDefaultFont"}, | 115 "XtDefaultFont"), |
95 #ifdef USE_XFT_MENUBARS | 116 #ifdef USE_XFT_MENUBARS |
96 {XtNfcFontName, XtCFcFontName, XtRString, sizeof (String), | 117 fontres (XtNfcFontName, XtCFcFontName, XtRString, String, fcFontName, |
97 offset(menu.fcFontName), | 118 "sans-serif-12:bold"), |
98 XtRString, (XtPointer) NULL}, | |
99 /* #### This needs to be fixed to give a proper type and converter for | 119 /* #### This needs to be fixed to give a proper type and converter for |
100 XftFonts. See also xlwtabs.c. */ | 120 XftFonts. See also xlwtabs.c. */ |
101 {XtNxftFont, XtCXftFont, XtRString, sizeof(XtPointer), | 121 fontres (XtNxftFont, XtCXftFont, XtRString, XtPointer, xftFontName, |
102 offset(menu.xftFontName), XtRString, (XtPointer) "Helvetica-12:bold" }, | 122 "Helvetica-12:bold"), |
103 #endif | 123 #endif |
104 # ifdef USE_XFONTSET | 124 # ifdef USE_XFONTSET |
105 /* #### Consider using the same method as for Motif; see the comment in | 125 /* #### Consider using the same method as for Motif; see the comment in |
106 XlwMenuInitialize(). */ | 126 XlwMenuInitialize(). */ |
107 {XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet), | 127 fontres (XtNfontSet, XtCFontSet, XtRFontSet, XFontSet, font_set, |
108 offset(menu.font_set), XtRString, (XtPointer) "XtDefaultFontSet"}, | 128 "XtDefaultFontSet"), |
109 # endif | 129 # endif |
110 #endif | 130 #endif |
111 {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), | 131 fgpixres (XtNforeground, XtCForeground, foreground), |
112 offset(menu.foreground), XtRString, (XtPointer) "XtDefaultForeground"}, | 132 fgpixres (XtNbuttonForeground, XtCButtonForeground, button_foreground), |
113 {XtNbuttonForeground, XtCButtonForeground, XtRPixel, sizeof(Pixel), | 133 fgpixres (XtNhighlightForeground, XtCHighlightForeground, |
114 offset(menu.button_foreground), XtRString, (XtPointer) "XtDefaultForeground"}, | 134 highlight_foreground), |
115 {XtNhighlightForeground, XtCHighlightForeground, XtRPixel, sizeof(Pixel), | 135 fgpixres (XtNtitleForeground, XtCTitleForeground, title_foreground), |
116 offset(menu.highlight_foreground), XtRString, (XtPointer) "XtDefaultForeground"}, | 136 dimres (XtNmargin, XtCMargin, XtRDimension, margin, 2), |
117 {XtNtitleForeground, XtCTitleForeground, XtRPixel, sizeof(Pixel), | 137 dimres (XmNmarginWidth, XmCMarginWidth, XmRHorizontalDimension, |
118 offset(menu.title_foreground), XtRString, (XtPointer) "XtDefaultForeground"}, | 138 horizontal_margin, 2), |
119 {XtNmargin, XtCMargin, XtRDimension, sizeof(Dimension), | 139 dimres (XmNmarginHeight, XmCMarginHeight, XmRVerticalDimension, |
120 offset(menu.margin), XtRImmediate, (XtPointer)2}, | 140 vertical_margin, 1), |
121 {XmNmarginWidth, XmCMarginWidth, XmRHorizontalDimension, sizeof(Dimension), | 141 dimres (XmNspacing, XmCSpacing, XmRHorizontalDimension, column_spacing, 4), |
122 offset(menu.horizontal_margin), XtRImmediate, (XtPointer)2}, | 142 dimres (XmNindicatorSize, XmCIndicatorSize, XtRDimension, indicator_size, 0), |
123 {XmNmarginHeight, XmCMarginHeight, XmRVerticalDimension, sizeof(Dimension), | |
124 offset(menu.vertical_margin), XtRImmediate, (XtPointer)1}, | |
125 {XmNspacing, XmCSpacing, XmRHorizontalDimension, sizeof(Dimension), | |
126 offset(menu.column_spacing), XtRImmediate, (XtPointer)4}, | |
127 {XmNindicatorSize, XmCIndicatorSize, XtRDimension, sizeof(Dimension), | |
128 offset(menu.indicator_size), XtRImmediate, (XtPointer)0}, | |
129 #if 0 | 143 #if 0 |
130 {XmNshadowThickness, XmCShadowThickness, XmRHorizontalDimension, | 144 dimres (XmNshadowThickness, XmCShadowThickness, XmRHorizontalDimension, |
131 sizeof (Dimension), offset (menu.shadow_thickness), | 145 shadow_thickness, 2), |
132 XtRImmediate, (XtPointer) 2}, | 146 #else |
133 #else | 147 dimres (XmNshadowThickness, XmCShadowThickness, XtRDimension, |
134 {XmNshadowThickness, XmCShadowThickness, XtRDimension, | 148 shadow_thickness, 2), |
135 sizeof (Dimension), offset (menu.shadow_thickness), | 149 #endif |
136 XtRImmediate, (XtPointer) 2}, | 150 nullpixres (XmNselectColor, XmCSelectColor, select_color), |
137 #endif | 151 nullpixres (XmNtopShadowColor, XmCTopShadowColor, top_shadow_color), |
138 {XmNselectColor, XmCSelectColor, XtRPixel, sizeof (Pixel), | 152 nullpixres (XmNbottomShadowColor, XmCBottomShadowColor, bottom_shadow_color), |
139 offset (menu.select_color), XtRImmediate, (XtPointer)-1}, | 153 pmres (XmNtopShadowPixmap, XmCTopShadowPixmap, top_shadow_pixmap), |
140 {XmNtopShadowColor, XmCTopShadowColor, XtRPixel, sizeof (Pixel), | 154 pmres (XmNbottomShadowPixmap, XmCBottomShadowPixmap, bottom_shadow_pixmap), |
141 offset (menu.top_shadow_color), XtRImmediate, (XtPointer)-1}, | 155 |
142 {XmNbottomShadowColor, XmCBottomShadowColor, XtRPixel, sizeof (Pixel), | 156 cbres (XtNopen, open, NULL), |
143 offset (menu.bottom_shadow_color), XtRImmediate, (XtPointer)-1}, | 157 cbres (XtNselect, select, NULL), |
144 {XmNtopShadowPixmap, XmCTopShadowPixmap, XtRPixmap, sizeof (Pixmap), | 158 Xt_RESOURCE (XtNmenu, XtCMenu, XtRPointer, XtPointer, offset(contents), |
145 offset (menu.top_shadow_pixmap), XtRImmediate, (XtPointer)None}, | 159 XtRImmediate, NULL), |
146 {XmNbottomShadowPixmap, XmCBottomShadowPixmap, XtRPixmap, sizeof (Pixmap), | 160 Xt_RESOURCE (XtNcursor, XtCCursor, XtRCursor, Cursor, offset(cursor_shape), |
147 offset (menu.bottom_shadow_pixmap), XtRImmediate, (XtPointer)None}, | 161 XtRString, "right_ptr"), |
148 | 162 Xt_RESOURCE (XtNhorizontal, XtCHorizontal, XtRInt, int, offset(horizontal), |
149 {XtNopen, XtCCallback, XtRCallback, sizeof(XtPointer), | 163 XtRImmediate, True), |
150 offset(menu.open), XtRCallback, (XtPointer)NULL}, | 164 boolres (XtNuseBackingStore, XtCUseBackingStore, use_backing_store, False), |
151 {XtNselect, XtCCallback, XtRCallback, sizeof(XtPointer), | 165 boolres (XtNbounceDown, XtCBounceDown, bounce_down, True), |
152 offset(menu.select), XtRCallback, (XtPointer)NULL}, | 166 boolres (XtNresourceLabels, XtCResourceLabels, lookup_labels, False), |
153 {XtNmenu, XtCMenu, XtRPointer, sizeof(XtPointer), | 167 |
154 offset(menu.contents), XtRImmediate, (XtPointer)NULL}, | 168 #undef offset |
155 {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), | 169 #undef mflres |
156 offset(menu.cursor_shape), XtRString, (XtPointer) "right_ptr"}, | 170 #undef fontres |
157 {XtNhorizontal, XtCHorizontal, XtRInt, sizeof(int), | 171 #undef dimres |
158 offset(menu.horizontal), XtRImmediate, (XtPointer)True}, | 172 #undef boolres |
159 {XtNuseBackingStore, XtCUseBackingStore, XtRBoolean, sizeof (Boolean), | 173 #undef cbres |
160 offset (menu.use_backing_store), XtRImmediate, (XtPointer)False}, | 174 #undef pixres |
161 {XtNbounceDown, XtCBounceDown, XtRBoolean, sizeof (Boolean), | 175 #undef fgpixres |
162 offset (menu.bounce_down), XtRImmediate, (XtPointer)True}, | 176 #undef nullpixres |
163 {XtNresourceLabels, XtCResourceLabels, XtRBoolean, sizeof (Boolean), | 177 #undef pmres |
164 offset (menu.lookup_labels), XtRImmediate, (XtPointer)False}, | |
165 }; | 178 }; |
166 #undef offset | |
167 | 179 |
168 static Boolean XlwMenuSetValues (Widget current, Widget request, Widget new_, | 180 static Boolean XlwMenuSetValues (Widget current, Widget request, Widget new_, |
169 ArgList args, Cardinal *num_args); | 181 ArgList args, Cardinal *num_args); |
170 static void XlwMenuRealize (Widget w, Mask *valueMask, | 182 static void XlwMenuRealize (Widget w, Mask *valueMask, |
171 XSetWindowAttributes *attributes); | 183 XSetWindowAttributes *attributes); |
184 #endif | 196 #endif |
185 | 197 |
186 static XtActionsRec | 198 static XtActionsRec |
187 xlwMenuActionsList [] = | 199 xlwMenuActionsList [] = |
188 { | 200 { |
189 {"start", Start}, | 201 { (String) "start", Start}, |
190 {"drag", Drag}, | 202 { (String) "drag", Drag}, |
191 {"select", Select}, | 203 { (String) "select", Select}, |
192 }; | 204 }; |
193 | 205 |
194 #define SuperClass ((CoreWidgetClass)&coreClassRec) | 206 #define SuperClass ((CoreWidgetClass)&coreClassRec) |
195 | 207 |
196 XlwMenuClassRec xlwMenuClassRec = | 208 XlwMenuClassRec xlwMenuClassRec = |
197 { | 209 { |
198 { /* CoreClass fields initialization */ | 210 { /* CoreClass fields initialization */ |
199 (WidgetClass) SuperClass, /* superclass */ | 211 (WidgetClass) SuperClass, /* superclass */ |
200 "XlwMenu", /* class_name */ | 212 (String) "XlwMenu", /* class_name */ |
201 sizeof(XlwMenuRec), /* size */ | 213 sizeof(XlwMenuRec), /* size */ |
202 XlwMenuClassInitialize, /* class_initialize */ | 214 XlwMenuClassInitialize, /* class_initialize */ |
203 NULL, /* class_part_initialize */ | 215 NULL, /* class_part_initialize */ |
204 FALSE, /* class_inited */ | 216 FALSE, /* class_inited */ |
205 XlwMenuInitialize, /* initialize */ | 217 XlwMenuInitialize, /* initialize */ |
493 } | 505 } |
494 | 506 |
495 static XtResource | 507 static XtResource |
496 nameResource[] = | 508 nameResource[] = |
497 { | 509 { |
498 { "labelString", "LabelString", XtRString, sizeof(String), | 510 { (String) "labelString", (String) "LabelString", XtRString, sizeof(String), |
499 0, XtRImmediate, 0 } | 511 0, XtRImmediate, 0 } |
500 }; | 512 }; |
501 | 513 |
502 /* This function searches STRING for parameter inserts of the form: | 514 /* This function searches STRING for parameter inserts of the form: |
503 %[padding]1 | 515 %[padding]1 |