1 /* 2 * Motif 3 * 4 * Copyright (c) 1987-2012, The Open Group. All rights reserved. 5 * 6 * These libraries and programs are free software; you can 7 * redistribute them and/or modify them under the terms of the GNU 8 * Lesser General Public License as published by the Free Software 9 * Foundation; either version 2 of the License, or (at your option) 10 * any later version. 11 * 12 * These libraries and programs are distributed in the hope that 13 * they will be useful, but WITHOUT ANY WARRANTY; without even the 14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 15 * PURPOSE. See the GNU Lesser General Public License for more 16 * details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with these librararies and programs; if not, write 20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth 21 * Floor, Boston, MA 02110-1301 USA 22 * 23 */ 24 25 #ifndef _XmIconButtonP_h 26 #define _XmIconButtonP_h 27 28 29 /************************************************************ 30 * INCLUDE FILES 31 *************************************************************/ 32 #include <Xm/PrimitiveP.h> 33 #include <Xm/IconButton.h> 34 #include <Xm/XmP.h> 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 /************************************************************ 41 * TYPEDEFS AND DEFINES 42 *************************************************************/ 43 44 #define XmIconButtonIndex (XmPrimitiveIndex + 1) 45 46 /************************************************************ 47 * MACROS 48 *************************************************************/ 49 50 /************************************************************ 51 * GLOBAL DECLARATIONS 52 *************************************************************/ 53 54 typedef struct { 55 XtPointer extension; /* Just in case we need it later. */ 56 } XmIconButtonClassPart; 57 58 typedef struct _XmIconButtonClassRec { 59 CoreClassPart core_class; 60 XmPrimitiveClassPart primitive_class; 61 XmIconButtonClassPart icon_class; 62 } XmIconButtonClassRec; 63 64 typedef struct { 65 /* resources */ 66 67 String label; /* The label to display. */ 68 Pixmap pixmap; /* The pixmap to display. */ 69 Pixel arm_color; /* The color to arm this widget with. */ 70 XmFontList font_list; /* The font in MOTIF(tm) format. */ 71 XmIconPlacement icon_placement; /* Where to place the icon label. */ 72 Boolean recompute; /* Whether to recompute size every time. */ 73 Boolean set; /* State of the button. */ 74 Boolean armed; /* Armed value for button. */ 75 76 Dimension v_space; /* The amount of space between the edges */ 77 Dimension h_space; /* of the widget and the picture/text. */ 78 79 Dimension icon_text_padding; /* padding between the icon and the text. */ 80 81 XtCallbackList activate_callback; /* Called when I am selected */ 82 XtCallbackList double_click_callback; /* Called when I am 2 clicked. */ 83 84 /* 85 * Added in 1.2 for I18N. 86 */ 87 88 XmString label_string; /* The label stored as an XmString. */ 89 unsigned char string_direction; 90 unsigned char alignment; 91 92 /* private state */ 93 94 Position pix_x, pix_y; /* Location of the pixmap. */ 95 96 /* public state */ 97 Dimension pix_width, pix_height; /* size of the pixmap. */ 98 Dimension pix_depth; /* Depth of the pixmap. */ 99 100 /* private state */ 101 Position text_x, text_y; /* Location to begin drawing text. */ 102 Dimension max_text_width; /* maximum space the text can take up. */ 103 Dimension max_text_height; /* maximum vertical space for the text */ 104 105 XtIntervalId unset_timer; /* The arm and activate timer. */ 106 GC gc; /* The graphics context. */ 107 GC fill_gc; /* The gc for filling on the arm. */ 108 GC pixmap_fill_gc; /* The gc for drawing the pixmap when 109 the button is filled. */ 110 111 GC stippled_text_gc; /* GC to use stippling text. */ 112 GC stippled_set_text_gc; /* GC to use for stip. text in a set button. */ 113 GC stippled_set_gc; /* GC to use for images when toggle is set. */ 114 GC stippled_unset_gc; /* GC to use for images when toggle is unset.*/ 115 116 Time time; /* The server time of the last button click. */ 117 118 Boolean label_from_name; 119 Boolean check_set_render_table; 120 #ifdef FIX_1381 121 GC shadow_gc; /* GC to use shadow for text. */ 122 #endif 123 124 125 } XmIconButtonPart; 126 127 #define XmIconButton_label(w) (((XmIconButtonWidget)(w))->icon.label) 128 #define XmIconButton_pixmap(w) (((XmIconButtonWidget)(w))->icon.pixmap) 129 #define XmIconButton_arm_color(w) (((XmIconButtonWidget)(w))->icon.arm_color) 130 #define XmIconButton_font_list(w) (((XmIconButtonWidget)(w))->icon.font_list) 131 #define XmIconButton_icon_placement(w) (((XmIconButtonWidget)(w))->icon.icon_placement) 132 #define XmIconButton_recompute(w) (((XmIconButtonWidget)(w))->icon.recompute) 133 #define XmIconButton_set(w) (((XmIconButtonWidget)(w))->icon.set) 134 #define XmIconButton_armed(w) (((XmIconButtonWidget)(w))->icon.armed) 135 #define XmIconButton_v_space(w) (((XmIconButtonWidget)(w))->icon.v_space) 136 #define XmIconButton_h_space(w) (((XmIconButtonWidget)(w))->icon.h_space) 137 #define XmIconButton_icon_text_padding(w) (((XmIconButtonWidget)(w))->icon.icon_text_padding) 138 #define XmIconButton_activate_callback(w) (((XmIconButtonWidget)(w))->icon.activate_callback) 139 #define XmIconButton_double_click_callback(w) (((XmIconButtonWidget)(w))->icon.double_click_callback) 140 #define XmIconButton_label_string(w) (((XmIconButtonWidget)(w))->icon.label_string) 141 #define XmIconButton_string_direction(w) (((XmIconButtonWidget)(w))->icon.string_direction) 142 #define XmIconButton_alignment(w) (((XmIconButtonWidget)(w))->icon.alignment) 143 #define XmIconButton_pix_x(w) (((XmIconButtonWidget)(w))->icon.pix_x) 144 #define XmIconButton_pix_y(w) (((XmIconButtonWidget)(w))->icon.pix_y) 145 #define XmIconButton_pix_width(w) (((XmIconButtonWidget)(w))->icon.pix_width) 146 #define XmIconButton_pix_height(w) (((XmIconButtonWidget)(w))->icon.pix_height) 147 #define XmIconButton_pix_depth(w) (((XmIconButtonWidget)(w))->icon.pix_depth) 148 #define XmIconButton_text_x(w) (((XmIconButtonWidget)(w))->icon.text_x) 149 #define XmIconButton_text_y(w) (((XmIconButtonWidget)(w))->icon.text_y) 150 #define XmIconButton_max_text_width(w) (((XmIconButtonWidget)(w))->icon.max_text_width) 151 #define XmIconButton_max_text_height(w) (((XmIconButtonWidget)(w))->icon.max_text_height) 152 #define XmIconButton_unset_timer(w) (((XmIconButtonWidget)(w))->icon.unset_timer) 153 #define XmIconButton_gc(w) (((XmIconButtonWidget)(w))->icon.gc) 154 #define XmIconButton_fill_gc(w) (((XmIconButtonWidget)(w))->icon.fill_gc) 155 #define XmIconButton_pixmap_fill_gc(w) (((XmIconButtonWidget)(w))->icon.pixmap_fill_gc) 156 #define XmIconButton_stippled_text_gc(w) (((XmIconButtonWidget)(w))->icon.stippled_text_gc) 157 #ifdef FIX_1381 158 #define XmIconButton_insensitive_text_gc(w) (((XmIconButtonWidget)(w))->icon.stippled_text_gc) 159 #endif 160 #define XmIconButton_stippled_set_text_gc(w) (((XmIconButtonWidget)(w))->icon.stippled_set_text_gc) 161 #define XmIconButton_stippled_set_gc(w) (((XmIconButtonWidget)(w))->icon.stippled_set_gc) 162 #define XmIconButton_stippled_unset_gc(w) (((XmIconButtonWidget)(w))->icon.stippled_unset_gc) 163 #define XmIconButton_time(w) (((XmIconButtonWidget)(w))->icon.time) 164 #define XmIconButton_label_from_name(w) (((XmIconButtonWidget)(w))->icon.label_from_name) 165 #ifdef FIX_1381 166 #define XmIconButton_shadow_gc(w) (((XmIconButtonWidget)(w))->icon.shadow_gc) 167 #endif 168 typedef struct _XmIconButtonRec { 169 CorePart core; 170 XmPrimitivePart primitive; 171 XmIconButtonPart icon; 172 } XmIconButtonRec; 173 174 /************************************************************ 175 * EXTERNAL DECLARATIONS 176 *************************************************************/ 177 178 extern XmIconButtonClassRec xmIconButtonClassRec; 179 180 /************************************************************ 181 * STATIC DECLARATIONS 182 *************************************************************/ 183 184 #ifdef __cplusplus 185 } /* Closes scope of 'extern "C"' declaration */ 186 #endif 187 188 189 190 void _XmPrimitiveEnter( 191 Widget wid, 192 XEvent *event, 193 String *params, 194 Cardinal *num_params) ; 195 void _XmPrimitiveLeave( 196 Widget wid, 197 XEvent *event, 198 String *params, 199 Cardinal *num_params) ; 200 201 202 203 #endif /* _XmIconButtonP_h */ 204