1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330
|
/*
* This file is part of the XForms library package.
*
* XForms is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1, or
* (at your option) any later version.
*
* XForms is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with XForms. If not, see <http://www.gnu.org/licenses/>.
*/
/********************** crop here for forms.h **********************/
/**
* \file button.h
*
* All Buttons: regular button, light button and round button
*
*/
#ifndef FL_BUTTON_H
#define FL_BUTTON_H
typedef enum {
FL_NORMAL_BUTTON,
FL_PUSH_BUTTON,
FL_RADIO_BUTTON,
FL_HIDDEN_BUTTON,
FL_TOUCH_BUTTON,
FL_INOUT_BUTTON,
FL_RETURN_BUTTON,
FL_HIDDEN_RET_BUTTON,
FL_MENU_BUTTON
} FL_BUTTON_TYPE;
#define FL_TOGGLE_BUTTON FL_PUSH_BUTTON
typedef struct {
Pixmap pixmap,
mask;
unsigned int bits_w,
bits_h;
int val; /* state of button (on/off) */
int mousebut; /* mouse button that caused the push */
int timdel; /* time since last touch (TOUCH buttons) */
int event; /* what event triggers redraw */
int is_pushed; /* set while drawn as pushed down */
int react_to[ 5 ]; /* mouse buttons button reacts to */
long cspecl; /* reserved for class specfic stuff */
void * cspecv; /* misc. things */
char * filename;
Pixmap focus_pixmap,
focus_mask;
char * focus_filename;
} FL_BUTTON_SPEC;
#define FL_BUTTON_STRUCT FL_BUTTON_SPEC
typedef void ( * FL_DrawButton )( FL_OBJECT * );
typedef void ( * FL_CleanupButton )( FL_BUTTON_STRUCT * );
#define FL_DRAWBUTTON FL_DrawButton
#define FL_CLEANUPBUTTON FL_CleanupButton
/* normal button default */
#define FL_BUTTON_BOXTYPE FL_UP_BOX
#define FL_BUTTON_COL1 FL_COL1
#define FL_BUTTON_COL2 FL_COL1
#define FL_BUTTON_LCOL FL_LCOL
#define FL_BUTTON_ALIGN FL_ALIGN_CENTER
#define FL_BUTTON_MCOL1 FL_MCOL
#define FL_BUTTON_MCOL2 FL_MCOL
#define FL_BUTTON_BW FL_BOUND_WIDTH
/* light button defaults */
#define FL_LIGHTBUTTON_BOXTYPE FL_UP_BOX
#define FL_LIGHTBUTTON_COL1 FL_COL1
#define FL_LIGHTBUTTON_COL2 FL_YELLOW
#define FL_LIGHTBUTTON_LCOL FL_LCOL
#define FL_LIGHTBUTTON_ALIGN FL_ALIGN_CENTER
#define FL_LIGHTBUTTON_TOPCOL FL_COL1
#define FL_LIGHTBUTTON_MCOL FL_MCOL
#define FL_LIGHTBUTTON_MINSIZE ( ( FL_Coord ) 12 )
/* round button defaults */
#define FL_ROUNDBUTTON_BOXTYPE FL_NO_BOX
#define FL_ROUNDBUTTON_COL1 FL_MCOL
#define FL_ROUNDBUTTON_COL2 FL_YELLOW
#define FL_ROUNDBUTTON_LCOL FL_LCOL
#define FL_ROUNDBUTTON_ALIGN FL_ALIGN_CENTER
#define FL_ROUNDBUTTON_TOPCOL FL_COL1
#define FL_ROUNDBUTTON_MCOL FL_MCOL
/* round3d button defaults */
#define FL_ROUND3DBUTTON_BOXTYPE FL_NO_BOX
#define FL_ROUND3DBUTTON_COL1 FL_COL1
#define FL_ROUND3DBUTTON_COL2 FL_BLACK
#define FL_ROUND3DBUTTON_LCOL FL_LCOL
#define FL_ROUND3DBUTTON_ALIGN FL_ALIGN_CENTER
#define FL_ROUND3DBUTTON_TOPCOL FL_COL1
#define FL_ROUND3DBUTTON_MCOL FL_MCOL
/* check button defaults */
#define FL_CHECKBUTTON_BOXTYPE FL_NO_BOX
#define FL_CHECKBUTTON_COL1 FL_COL1
#define FL_CHECKBUTTON_COL2 FL_YELLOW
#define FL_CHECKBUTTON_LCOL FL_LCOL
#define FL_CHECKBUTTON_ALIGN FL_ALIGN_CENTER
#define FL_CHECKBUTTON_TOPCOL FL_COL1
#define FL_CHECKBUTTON_MCOL FL_MCOL
/* bitmap button defaults */
#define FL_BITMAPBUTTON_BOXTYPE FL_UP_BOX
#define FL_BITMAPBUTTON_COL1 FL_COL1 /* bitmap background */
#define FL_BITMAPBUTTON_COL2 FL_BLUE /* "focus" color */
#define FL_BITMAPBUTTON_LCOL FL_LCOL /* bitmap foreground */
#define FL_BITMAPBUTTON_ALIGN FL_ALIGN_BOTTOM
/* bitmap button defaults */
#define FL_PIXMAPBUTTON_BOXTYPE FL_UP_BOX
#define FL_PIXMAPBUTTON_COL1 FL_BUTTON_COL1
#define FL_PIXMAPBUTTON_COL2 FL_BUTTON_COL2
#define FL_PIXMAPBUTTON_LCOL FL_BUTTON_LCOL
#define FL_PIXMAPBUTTON_MCOL1 FL_BUTTON_MCOL1
#define FL_PIXMAPBUTTON_MCOL2 FL_BUTTON_MCOL2
#define FL_PIXMAPBUTTON_ALIGN FL_ALIGN_BOTTOM
/***** Routines *****/
FL_EXPORT FL_OBJECT * fl_create_button( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT FL_OBJECT * fl_create_roundbutton( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT FL_OBJECT * fl_create_round3dbutton( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT FL_OBJECT * fl_create_lightbutton( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT FL_OBJECT * fl_create_checkbutton( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT FL_OBJECT * fl_create_bitmapbutton( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT FL_OBJECT * fl_create_pixmapbutton( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT FL_OBJECT * fl_create_scrollbutton( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT FL_OBJECT * fl_create_labelbutton( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT FL_OBJECT *fl_add_roundbutton( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT FL_OBJECT * fl_add_round3dbutton( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT FL_OBJECT * fl_add_lightbutton( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT FL_OBJECT * fl_add_checkbutton( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT FL_OBJECT * fl_add_button( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT FL_OBJECT * fl_add_bitmapbutton( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT FL_OBJECT * fl_add_scrollbutton( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT FL_OBJECT * fl_add_labelbutton( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
#define fl_set_bitmapbutton_file fl_set_bitmap_file
FL_EXPORT void fl_set_bitmapbutton_data( FL_OBJECT * ob,
int w,
int h,
unsigned char * bits );
#define fl_set_bitmapbutton_datafile fl_set_bitmapbutton_file
FL_EXPORT FL_OBJECT * fl_add_pixmapbutton( int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
#define fl_set_pixmapbutton_data fl_set_pixmap_data
#define fl_set_pixmapbutton_file fl_set_pixmap_file
#define fl_set_pixmapbutton_pixmap fl_set_pixmap_pixmap
#define fl_get_pixmapbutton_pixmap fl_get_pixmap_pixmap
#define fl_set_pixmapbutton_align fl_set_pixmap_align
#define fl_free_pixmapbutton_pixmap fl_free_pixmap_pixmap
#define fl_set_pixmapbutton_datafile fl_set_pixmapbutton_file
#define fl_set_pixmapbutton_show_focus fl_set_pixmapbutton_focus_outline
FL_EXPORT void fl_set_pixmapbutton_focus_outline( FL_OBJECT * ob,
int yes );
FL_EXPORT void fl_set_pixmapbutton_focus_data( FL_OBJECT * ob,
char ** bits );
FL_EXPORT void fl_set_pixmapbutton_focus_file( FL_OBJECT * ob,
const char * fname );
FL_EXPORT void fl_set_pixmapbutton_focus_pixmap( FL_OBJECT * ob,
Pixmap id,
Pixmap mask );
FL_EXPORT int fl_get_button( FL_OBJECT * ob );
FL_EXPORT void fl_set_button( FL_OBJECT * ob,
int pushed );
FL_EXPORT int fl_get_button_numb( FL_OBJECT * ob );
#define fl_set_button_shortcut fl_set_object_shortcut
FL_EXPORT FL_OBJECT * fl_create_generic_button( int objclass,
int type,
FL_Coord x,
FL_Coord y,
FL_Coord w,
FL_Coord h,
const char * label );
FL_EXPORT void fl_add_button_class( int bclass,
FL_DrawButton drawit,
FL_CleanupButton cleanup );
FL_EXPORT void fl_set_button_mouse_buttons( FL_OBJECT * ob,
unsigned int buttons );
FL_EXPORT void fl_get_button_mouse_buttons( FL_OBJECT * ob,
unsigned int * buttons );
#endif /* ! defined FL_BUTTON_H */
|