1 /* 2 SAR Menus and Menu Objects 3 */ 4 5 #ifndef MENU_H 6 #define MENU_H 7 8 #include <sys/types.h> 9 #include "v3dtex.h" 10 #include "gw.h" 11 #include "image.h" 12 13 14 /* 15 * Flags: 16 */ 17 #define sar_menu_flags_t unsigned long 18 19 /* 20 * Menu Types: 21 */ 22 typedef enum { 23 SAR_MENU_TYPE_STANDARD 24 } sar_menu_type; 25 26 /* 27 * Object Types: 28 */ 29 typedef enum { 30 SAR_MENU_OBJECT_TYPE_LABEL, 31 SAR_MENU_OBJECT_TYPE_BUTTON, 32 SAR_MENU_OBJECT_TYPE_PROGRESS, 33 SAR_MENU_OBJECT_TYPE_MESSAGE_BOX, 34 SAR_MENU_OBJECT_TYPE_LIST, 35 SAR_MENU_OBJECT_TYPE_MDISPLAY, 36 SAR_MENU_OBJECT_TYPE_SWITCH, 37 SAR_MENU_OBJECT_TYPE_SPIN, 38 SAR_MENU_OBJECT_TYPE_SLIDER, 39 SAR_MENU_OBJECT_TYPE_MAP, 40 SAR_MENU_OBJECT_TYPE_OBJVIEW 41 } sar_menu_object_type; 42 #define SAR_MENU_OBJECT_TYPE(p) (((p) != NULL) ? \ 43 (*(sar_menu_object_type *)p) : -1) 44 45 46 /* 47 * Color: 48 */ 49 typedef struct { 50 float a, r, g, b; /* 0.0 to 1.0 */ 51 } sar_menu_color_struct; 52 #define SAR_MENU_COLOR(p) ((sar_menu_color_struct *)(p)) 53 54 55 /* 56 * Label: 57 * 58 * A plain label with an optional background image. 59 */ 60 typedef struct { 61 62 sar_menu_object_type type; /* SAR_MENU_OBJECT_TYPE_LABEL */ 63 int id; /* Value used to identify this object */ 64 void *client_data; /* User data */ 65 66 float x, y; /* Position coefficient */ 67 int offset_x, /* Offset from center in pixels */ 68 offset_y; 69 int width, /* Size in pixels */ 70 height; 71 Boolean sensitive; 72 const sar_image_struct *image; /* Shared bg image */ 73 74 GWFont *font; 75 sar_menu_color_struct color; 76 char *label; 77 #define SAR_MENU_LABEL_ALIGN_CENTER 0 78 #define SAR_MENU_LABEL_ALIGN_LEFT 1 79 #define SAR_MENU_LABEL_ALIGN_RIGHT 2 80 int align; /* One of SAR_MENU_LABEL_ALIGN_* */ 81 82 } sar_menu_label_struct; 83 #define SAR_MENU_LABEL(p) ((sar_menu_label_struct *)(p)) 84 #define SAR_MENU_IS_LABEL(p) (SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_LABEL) 85 86 /* 87 * Button: 88 * 89 * Push button with label, the label is to the right of the button. 90 * Both the button and label are of fixed width. 91 */ 92 typedef struct { 93 94 sar_menu_object_type type; /* SAR_MENU_OBJECT_TYPE_BUTTON */ 95 int id; /* Value used to identify this object */ 96 void *client_data; /* User data */ 97 98 float x, y; /* Position coefficient */ 99 int offset_x, /* Offset from center in pixels */ 100 offset_y; 101 int width, /* Size in pixels */ 102 height; 103 Boolean sensitive; 104 105 #define SAR_MENU_BUTTON_STATE_UNARMED 0 106 #define SAR_MENU_BUTTON_STATE_ARMED 1 107 #define SAR_MENU_BUTTON_STATE_HIGHLIGHTED 2 108 int state; /* One of SAR_MENU_BUTTON_STATE_* */ 109 const sar_image_struct *unarmed_image, /* Shared images */ 110 *armed_image, 111 *highlighted_image; 112 113 GWFont *font; 114 sar_menu_color_struct color; 115 char *label; /* Button label */ 116 117 void (*func_cb)( 118 void *, /* This Object */ 119 int, /* ID Code */ 120 void * /* Data */ 121 ); 122 123 } sar_menu_button_struct; 124 #define SAR_MENU_BUTTON(p) ((sar_menu_button_struct *)(p)) 125 #define SAR_MENU_IS_BUTTON(p) (SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_BUTTON) 126 127 /* 128 * Progress Bar: 129 * 130 * A left to right progress bar, the width and height can be -1 to 131 * indicate the entire width of the window and a default height 132 * (respectively). 133 */ 134 typedef struct { 135 136 sar_menu_object_type type; /* SAR_MENU_OBJECT_TYPE_PROGRESS */ 137 int id; /* Value used to identify this object */ 138 void *client_data; /* User data */ 139 140 float x, y; /* Position coefficient */ 141 int width, /* Size in pixels */ 142 height; 143 Boolean sensitive; 144 145 const sar_image_struct *bg_image, /* Shared images */ 146 *fg_image; 147 148 GWFont *font; 149 sar_menu_color_struct color; 150 char *label; 151 152 float progress; /* 0.0 to 1.0 */ 153 154 } sar_menu_progress_struct; 155 #define SAR_MENU_PROGRESS(p) ((sar_menu_progress_struct *)(p)) 156 #define SAR_MENU_IS_PROGRESS(p) (SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_PROGRESS) 157 158 /* 159 * Message Box: 160 * 161 * A message box displaying several lines of text and capable of 162 * scrolling. Uses XML-like tags for font color and style. 163 */ 164 typedef struct { 165 166 sar_menu_object_type type; /* SAR_MENU_OBJECT_TYPE_MESSAGE_BOX */ 167 int id; /* Value used to identify this object */ 168 void *client_data; /* User data */ 169 170 float x, y; /* Position coefficient */ 171 float width, /* Size coefficient */ 172 height; 173 Boolean sensitive; 174 175 GWFont *font; 176 sar_menu_color_struct color, /* Foreground */ 177 bg_color, /* Background */ 178 bold_color, 179 underline_color; 180 181 #define MENU_MESSAGE_BOX_BG_TOTAL_IMAGES 9 182 const sar_image_struct **bg_image; /* Pointer to array of 9 shared images */ 183 184 int scrolled_line; 185 char *message; 186 187 } sar_menu_message_box_struct; 188 #define SAR_MENU_MESSAGE_BOX(p) ((sar_menu_message_box_struct *)(p)) 189 #define SAR_MENU_IS_MESSAGE_BOX(p) (SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_MESSAGE_BOX) 190 191 /* 192 * List Item: 193 */ 194 typedef struct { 195 196 sar_menu_flags_t flags; 197 char *name; 198 void *client_data; /* User data */ 199 200 } sar_menu_list_item_struct; 201 #define SAR_MENU_LIST_ITEM(p) ((sar_menu_list_item_struct *)(p)) 202 203 /* 204 * List: 205 * 206 * A list displaying items and capable of scrolling. 207 */ 208 typedef struct { 209 210 sar_menu_object_type type; /* SAR_MENU_OBJECT_TYPE_LIST */ 211 int id; /* Value used to identify this object */ 212 void *client_data; /* User data */ 213 214 float x, y; /* Position coefficient */ 215 float width, /* Size coefficient */ 216 height; 217 Boolean sensitive; 218 219 #define MENU_LIST_BG_TOTAL_IMAGES 9 220 const sar_image_struct **bg_image; /* Pointer to array of 9 shared images */ 221 222 GWFont *font; 223 sar_menu_color_struct color; 224 char *label; 225 226 sar_menu_list_item_struct **item; 227 int total_items, 228 items_visable, /* Number of items visible */ 229 scrolled_item, /* First visible item */ 230 selected_item; /* Selected item */ 231 232 void (*select_cb)( 233 void *, /* This Object */ 234 int, /* ID Code */ 235 void *, /* Data */ 236 int, /* Item Number */ 237 void *, /* Item Pointer */ 238 void * /* Item Data */ 239 ); 240 241 void (*activate_cb)( 242 void *, /* This Object */ 243 int, /* ID Code */ 244 void *, /* Data */ 245 int, /* Item Number */ 246 void *, /* Item Pointer */ 247 void * /* Item Data */ 248 ); 249 250 } sar_menu_list_struct; 251 #define SAR_MENU_LIST(p) ((sar_menu_list_struct *)(p)) 252 #define SAR_MENU_IS_LIST(p) (SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_LIST) 253 254 /* 255 * Multi-Purpose DIsplay: 256 * 257 * This is basically a drawing area that allows you to draw 258 * anything you want on to it when the draw_cb() is called. 259 */ 260 typedef struct { 261 262 sar_menu_object_type type; /* SAR_MENU_OBJECT_TYPE_MDISPLAY */ 263 int id; /* Value used to identify this object */ 264 void *client_data; /* User data */ 265 266 float x, y; /* Position coefficient */ 267 float width, /* Size coefficient */ 268 height; 269 Boolean sensitive; 270 271 #define MENU_MDISPLAY_BG_TOTAL_IMAGES 9 272 const sar_image_struct **bg_image; /* Pointer to array of 9 shared images */ 273 274 void (*draw_cb)( 275 void *, /* Display */ 276 void *, /* Menu */ 277 void *, /* This Object */ 278 int, /* ID Code */ 279 void *, /* Data */ 280 int, int, int, int /* x_min, y_min, x_max, y_max */ 281 ); 282 283 } sar_menu_mdisplay_struct; 284 #define SAR_MENU_MDISPLAY(p) ((sar_menu_mdisplay_struct *)(p)) 285 #define SAR_MENU_IS_MDISPLAY(p) (SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_MDISPLAY) 286 287 /* 288 * Switch: 289 * 290 * A toggle switch that holds a boolean value. 291 */ 292 typedef struct { 293 294 sar_menu_object_type type; /* SAR_MENU_OBJECT_TYPE_SWITCH */ 295 int id; /* Value used to identify this object */ 296 void *client_data; /* User data */ 297 298 float x, y; /* Position coefficient */ 299 int width, /* Size coefficient */ 300 height; 301 Boolean sensitive; 302 303 const sar_image_struct *bg_image, /* Shared images */ 304 *switch_off_image, 305 *switch_on_image; 306 307 GWFont *font; 308 sar_menu_color_struct color; 309 char *label; 310 311 Boolean state; 312 313 void (*switch_cb)( 314 void *, /* This Object */ 315 int, /* ID Code */ 316 void *, /* Data */ 317 Boolean /* Value */ 318 ); 319 320 } sar_menu_switch_struct; 321 #define SAR_MENU_SWITCH(p) ((sar_menu_switch_struct *)(p)) 322 #define SAR_MENU_IS_SWITCH(p) (SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_SWITCH) 323 324 /* 325 * Spin: 326 * 327 * A box with an array of values that can be selected by 328 * "spinning". 329 */ 330 typedef struct { 331 332 sar_menu_object_type type; /* SAR_MENU_OBJECT_TYPE_SPIN */ 333 int id; /* Value used to identify this object */ 334 void *client_data; /* User data */ 335 336 float x, y; /* Position coefficient */ 337 float width, /* Size coefficient */ 338 height; 339 Boolean sensitive; 340 341 const sar_image_struct *label_image, /* Shared images */ 342 *value_image, 343 *dec_armed_image, 344 *dec_unarmed_image, 345 *inc_armed_image, 346 *inc_unarmed_image; 347 348 GWFont *font, /* Label font */ 349 *value_font; /* Value font */ 350 sar_menu_color_struct label_color, 351 value_color; 352 353 int dec_state, /* One of SAR_MENU_BUTTON_STATE_* */ 354 inc_state; 355 356 char *label; 357 358 #define SAR_MENU_SPIN_TYPE_STRING 0 359 #define SAR_MENU_SPIN_TYPE_NUMERIC 1 360 int value_type; /* One of SAR_MENU_SPIN_TYPE_* */ 361 362 Boolean allow_warp; /* Allow end to beginning cycle warping */ 363 364 float step; /* Increment step (for SAR_MENU_SPIN_TYPE_NUMERIC) */ 365 366 367 /* List of values, if the value_type is set to 368 * SAR_MENU_SPIN_TYPE_NUMERIC then there will only be one value. 369 * However if value_type is set to SAR_MENU_SPIN_TYPE_STRING then 370 * there may be one or more values in this list. 371 */ 372 char **value; 373 int total_values, 374 cur_value; 375 376 void (*change_cb)( 377 void *, /* This Object */ 378 int, /* ID Code */ 379 void *, /* Data */ 380 char * /* Value */ 381 ); 382 383 } sar_menu_spin_struct; 384 #define SAR_MENU_SPIN(p) ((sar_menu_spin_struct *)(p)) 385 #define SAR_MENU_IS_SPIN(p) (SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_SPIN) 386 387 /* 388 * Slider: 389 * 390 * A "slideable" scale that can hold a gradient value. 391 */ 392 typedef struct { 393 394 sar_menu_object_type type; /* SAR_MENU_OBJECT_TYPE_SLIDER */ 395 int id; /* Value used to identify this object */ 396 void *client_data; /* User data */ 397 398 float x, y; /* Position coefficient */ 399 float width, /* Size coefficient */ 400 height; 401 Boolean sensitive; 402 403 const sar_image_struct *label_image, /* Shared images */ 404 *trough_image, 405 *handle_image; 406 407 GWFont *font; 408 sar_menu_color_struct label_color; 409 410 char *label; 411 412 float value, /* Current value */ 413 lower, /* Lowest value */ 414 upper; /* Highest value */ 415 416 int drag_button; /* Pointer button that is currently 417 * dragging or 0 for none 418 */ 419 420 void (*change_cb)( 421 void *, /* This Object */ 422 int, /* ID Code */ 423 void *, /* Data */ 424 float /* Value */ 425 ); 426 427 } sar_menu_slider_struct; 428 #define SAR_MENU_SLIDER(p) ((sar_menu_slider_struct *)(p)) 429 #define SAR_MENU_IS_SLIDER(p) (SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_SLIDER) 430 431 432 /* 433 * Map Marking Types: 434 */ 435 typedef enum { 436 SAR_MENU_MAP_MARKING_TYPE_ICON, 437 SAR_MENU_MAP_MARKING_TYPE_INTERCEPT_LINE 438 } sar_menu_map_marking_type; 439 440 /* 441 * Map Marking: 442 */ 443 typedef struct { 444 445 sar_menu_map_marking_type type; 446 sar_menu_color_struct fg_color; 447 float x, y; /* In meters */ 448 float x_end, y_end; /* In meters (for intercept line) */ 449 450 const sar_image_struct *icon; /* Shared icon image */ 451 char *desc; /* Description (preferably short one-liner) */ 452 453 } sar_menu_map_marking_struct; 454 #define SAR_MENU_MAP_MARKING(p) ((sar_menu_map_marking_struct *)(p)) 455 456 /* 457 * Map: 458 */ 459 typedef struct { 460 461 sar_menu_object_type type; /* SAR_MENU_OBJECT_TYPE_MAP */ 462 int id; /* Value used to identify this object */ 463 void *client_data; /* User data */ 464 465 float x, y; /* Position coefficient */ 466 float width, /* Size coefficient */ 467 height; 468 Boolean sensitive; 469 470 GWFont *font; 471 sar_menu_color_struct color; 472 473 const sar_image_struct **bg_image; /* Pointer to array of 9 shared images */ 474 475 char *title; 476 477 int scroll_x, /* Scroll position, upper left corner, in pixels */ 478 scroll_y; 479 480 float m_to_pixels_coeff; /* Meters to pixels coefficient */ 481 482 v3d_texture_ref_struct *bg_tex; /* Background texture */ 483 float bg_tex_width, /* Intended size of texture in meters */ 484 bg_tex_height; 485 486 487 #define SAR_MENU_MAP_SHOW_MARKING_ALL 0 /* Show all markings */ 488 #define SAR_MENU_MAP_SHOW_MARKING_SELECTED 1 /* Show only selected marking */ 489 int show_markings_policy; /* One of SAR_MENU_MAP_SHOW_MARKING_* */ 490 491 sar_menu_map_marking_struct **marking; 492 int total_markings; 493 494 /* Marking that pointer is over, show desc of this marking. 495 * Can be -1 for none 496 */ 497 int selected_marking; 498 499 } sar_menu_map_struct; 500 #define SAR_MENU_MAP(p) ((sar_menu_map_struct *)(p)) 501 #define SAR_MENU_IS_MAP(p) (SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_MAP) 502 503 504 /* 505 * Object Viewer: 506 * 507 * Displays an OpenGL object in 3D and allows interactive rotate 508 * and zoom. 509 */ 510 typedef struct { 511 512 sar_menu_object_type type; /* SAR_MENU_OBJECT_TYPE_OBJVIEW */ 513 int id; /* Value used to identify this object */ 514 void *client_data; /* User data */ 515 516 float x, y; /* Position coefficient */ 517 float width, /* Size coefficient */ 518 height; 519 Boolean sensitive; 520 521 GWFont *font; 522 sar_menu_color_struct color, /* Foreground */ 523 bg_color, /* Background */ 524 bold_color, 525 underline_color; 526 527 #define MENU_OBJVIEW_BG_TOTAL_IMAGES 9 528 const sar_image_struct **bg_image; /* Pointer to array of 9 shared images */ 529 530 /* Pointer drag info */ 531 Boolean rotate_drag_state, 532 bank_drag_state; 533 int prev_motion_x, prev_motion_y; 534 time_t last_motion_time; 535 536 /* Render options */ 537 Boolean render_lighting, 538 render_antialias; 539 540 char *title; 541 char *message; 542 Boolean show_message; 543 544 void *obj_list; /* GL list of the 3d object */ 545 void *obj_glres; /* libv3d GL resources for the 3d 546 * object (v3d_glresource_struct *). 547 */ 548 549 float camera_distance; /* Camera distance from object in meters */ 550 float obj_size_radius; /* Size of object's radius in meters */ 551 552 /* Rotation of object in radians */ 553 float obj_heading, 554 obj_pitch, 555 obj_bank; 556 557 /* Position of light in radians */ 558 float light_heading, 559 light_pitch, 560 light_bank; 561 562 /* Last drawn gl image pixels of the 3d object, we buffer it 563 * instead of drawing the list each time. So we draw this image 564 * (which has transparent pixels) to speed things up. The format 565 * is GL_RGBA and the data type is GL_UNSIGNED_BYTE (so 4 bytes 566 * per pixel) 567 */ 568 void *objimg; 569 int objimg_width, 570 objimg_height; 571 572 } sar_menu_objview_struct; 573 #define SAR_MENU_OBJVIEW(p) ((sar_menu_objview_struct *)(p)) 574 #define SAR_MENU_IS_OBJVIEW(p) (SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_OBJVIEW) 575 576 /* 577 * Menu: 578 */ 579 typedef struct { 580 581 sar_menu_type type; 582 char *name; /* Name of this menu (for matching) */ 583 584 Boolean always_full_redraw; /* Always perform complete menu 585 * redraws even if only a part of 586 * the menu has changed (for some 587 * fixing problems on some of the 588 * accelerated video cards 589 */ 590 591 char *bg_image_path; /* Path to background image file */ 592 sar_image_struct *bg_image; /* Background image (not shared) */ 593 594 /* List of menu objects */ 595 void **object; 596 int total_objects, 597 selected_object; 598 599 } sar_menu_struct; 600 #define SAR_MENU(p) ((sar_menu_struct *)(p)) 601 602 603 /* In menu.c */ 604 /* Utility functions */ 605 extern void SARMenuGLStateReset(gw_display_struct *display); 606 extern void *SARMenuGetObject(sar_menu_struct *m, int n); 607 extern void *SARMenuGetObjectByID(sar_menu_struct *m, int id, int *n); 608 extern Boolean SARMenuObjectIsSensitive(sar_menu_struct *m, int n); 609 610 /* Menu functions */ 611 extern sar_menu_struct *SARMenuNew( 612 sar_menu_type type, const char *name, const char *bg_image 613 ); 614 extern void SARMenuLoadBackgroundImage(sar_menu_struct *m); 615 extern void SARMenuUnloadBackgroundImage(sar_menu_struct *m); 616 extern void SARMenuDelete(sar_menu_struct *m); 617 618 /* Label */ 619 extern int SARMenuLabelNew( 620 sar_menu_struct *m, 621 float x, float y, 622 int width, int height, 623 const char *label, 624 sar_menu_color_struct *fg_color, GWFont *font, 625 const sar_image_struct *image 626 ); 627 628 /* Button */ 629 extern int SARMenuButtonNew( 630 sar_menu_struct *m, 631 float x, float y, 632 int width, int height, 633 const char *label, 634 sar_menu_color_struct *fg_color, 635 GWFont *font, 636 const sar_image_struct *unarmed_image, 637 const sar_image_struct *armed_image, 638 const sar_image_struct *highlighted_image, 639 void *client_data, int id, 640 void (*func_cb)(void *, int, void *) 641 ); 642 643 /* Progress Bar */ 644 extern int SARMenuProgressNew( 645 sar_menu_struct *m, 646 float x, float y, 647 int width, int height, 648 const char *label, 649 sar_menu_color_struct *fg_color, 650 GWFont *font, 651 const sar_image_struct *bg_image, 652 const sar_image_struct *fg_image, 653 float progress 654 ); 655 extern void SARMenuProgressSet( 656 gw_display_struct *display, sar_menu_struct *m, int n, 657 float progress, Boolean redraw 658 ); 659 660 /* Message Box */ 661 extern int SARMenuMessageBoxNew( 662 sar_menu_struct *m, 663 float x, float y, 664 float width, float height, 665 sar_menu_color_struct *fg_color, GWFont *font, 666 const sar_image_struct **bg_image, /* Pointer to 9 images */ 667 void *client_data, int id, 668 const char *message 669 ); 670 extern void SARMenuMessageBoxSet( 671 gw_display_struct *display, sar_menu_struct *m, int n, 672 const char *message, Boolean redraw 673 ); 674 675 /* List */ 676 extern int SARMenuListNew( 677 sar_menu_struct *m, 678 float x, float y, 679 float width, float height, 680 sar_menu_color_struct *fg_color, GWFont *font, 681 const char *label, 682 const sar_image_struct **bg_image, 683 void *client_data, int id, 684 void (*select_cb)(void *, int, void *, int, void *, void *), 685 void (*activate_cb)(void *, int, void *, int, void *, void *) 686 ); 687 extern int SARMenuListAppendItem( 688 sar_menu_struct *m, int n, 689 const char *name, 690 void *client_data, 691 sar_menu_flags_t flags 692 ); 693 extern sar_menu_list_item_struct *SARMenuListGetItemByNumber( 694 sar_menu_list_struct *list, int i 695 ); 696 extern void SARMenuListSelect( 697 gw_display_struct *display, sar_menu_struct *m, int n, 698 int i, 699 Boolean scroll, Boolean redraw 700 ); 701 extern void SARMenuListDeleteAllItems( 702 sar_menu_struct *m, 703 int n /* List object number on m */ 704 ); 705 706 /* Multi-purpose Display */ 707 extern int SARMenuMDisplayNew( 708 sar_menu_struct *m, 709 float x, float y, 710 float width, float height, 711 const sar_image_struct **bg_image, /* Pointer to 9 images */ 712 void *client_data, int id, 713 void (*draw_cb)( 714 void *, /* Display */ 715 void *, /* Menu */ 716 void *, /* This Object */ 717 int, /* ID Code */ 718 void *, /* Data */ 719 int, int, int, int /* x_min, y_min, x_max, y_max */ 720 ) 721 ); 722 extern void SARMenuMDisplayDraw( 723 gw_display_struct *display, sar_menu_struct *m, int n 724 ); 725 726 /* Switch */ 727 extern int SARMenuSwitchNew( 728 sar_menu_struct *m, 729 float x, float y, 730 int width, int height, 731 sar_menu_color_struct *fg_color, GWFont *font, 732 const char *label, 733 const sar_image_struct *bg_image, 734 const sar_image_struct *switch_off_image, 735 const sar_image_struct *switch_on_image, 736 Boolean state, 737 void *client_data, int id, 738 void (*switch_cb)(void *, int, void *, Boolean) 739 ); 740 extern Boolean SARMenuSwitchGetValue(sar_menu_struct *m, int n); 741 extern void SARMenuSwitchSetValue( 742 gw_display_struct *display, sar_menu_struct *m, int n, 743 Boolean state, Boolean redraw 744 ); 745 746 /* Spin */ 747 extern int SARMenuSpinNew( 748 sar_menu_struct *m, 749 float x, float y, 750 float width, float height, 751 sar_menu_color_struct *label_color, 752 sar_menu_color_struct *value_color, 753 GWFont *font, GWFont *value_font, 754 const char *label, 755 const sar_image_struct *label_image, 756 const sar_image_struct *value_image, 757 const sar_image_struct *dec_armed_image, 758 const sar_image_struct *dec_unarmed_image, 759 const sar_image_struct *inc_armed_image, 760 const sar_image_struct *inc_unarmed_image, 761 void *client_data, int id, 762 void (*change_cb)(void *, int, void *, char *) 763 ); 764 extern void SARMenuSpinSetValueType( 765 sar_menu_struct *m, int n, int type 766 ); 767 extern int SARMenuSpinAddValue( 768 sar_menu_struct *m, int n, const char *value 769 ); 770 extern char *SARMenuSpinGetCurrentValue( 771 sar_menu_struct *m, int n, int *sel_num 772 ); 773 extern void SARMenuSpinSelectValueIndex( 774 gw_display_struct *display, sar_menu_struct *m, int n, 775 int value_num, 776 Boolean redraw 777 ); 778 extern void SARMenuSpinSetValueIndex( 779 gw_display_struct *display, sar_menu_struct *m, int n, 780 int value_num, const char *value, 781 Boolean redraw 782 ); 783 extern void SARMenuSpinDeleteAllValues(sar_menu_struct *m, int n); 784 extern void SARMenuSpinDoInc( 785 gw_display_struct *display, sar_menu_struct *m, int n, 786 Boolean redraw 787 ); 788 extern void SARMenuSpinDoInc( 789 gw_display_struct *display, sar_menu_struct *m, int n, 790 Boolean redraw 791 ); 792 793 /* Slider */ 794 extern int SARMenuSliderNew( 795 sar_menu_struct *m, 796 float x, float y, 797 float width, float height, 798 sar_menu_color_struct *label_color, 799 GWFont *font, 800 const char *label, 801 const sar_image_struct *label_image, 802 const sar_image_struct *trough_image, 803 const sar_image_struct *handle_image, 804 void *client_data, int id, 805 void (*change_cb)(void *, int, void *, float) 806 ); 807 extern void SARMenuSliderSetValueBounds( 808 gw_display_struct *display, sar_menu_struct *m, int n, 809 float lower, float upper, 810 Boolean redraw 811 ); 812 extern void SARMenuSliderSetValue( 813 gw_display_struct *display, sar_menu_struct *m, int n, 814 float value, 815 Boolean redraw 816 ); 817 extern float SARMenuSliderGetValue(sar_menu_struct *m, int n); 818 819 /* Common object functions */ 820 extern void SARMenuObjectSetSensitive( 821 gw_display_struct *display, sar_menu_struct *m, int n, 822 Boolean sensitive, Boolean redraw 823 ); 824 extern void SARMenuObjectDelete(sar_menu_struct *m, int n); 825 826 /* Drawing */ 827 extern void SARMenuDrawWindowBG( 828 gw_display_struct *display, 829 const sar_image_struct **bg_image, /* Total 9 images */ 830 const sar_menu_color_struct *base_color, /* Set NULL to use image as base */ 831 int x, int y, 832 int width, int height, 833 Boolean draw_base, 834 Boolean draw_shadow, 835 Boolean is_selected 836 ); 837 extern void SARMenuDrawObject( 838 gw_display_struct *display, 839 sar_menu_struct *m, 840 int n 841 ); 842 extern void SARMenuDrawAll( 843 gw_display_struct *display, 844 sar_menu_struct *m 845 ); 846 extern int SARMenuManagePointer( 847 gw_display_struct *display, sar_menu_struct *m, 848 int x, int y, gw_event_type type, int btn_num 849 ); 850 extern int SARMenuManageKey( 851 gw_display_struct *display, 852 sar_menu_struct *m, 853 int key, Boolean state 854 ); 855 856 857 /* In menumap.c */ 858 extern sar_menu_map_marking_struct *SARMenuMapGetMarkingPtr( 859 sar_menu_map_struct *map, int i 860 ); 861 extern int SARMenuMapNew( 862 sar_menu_struct *m, 863 float x, float y, 864 float width, float height, 865 GWFont *font, 866 sar_menu_color_struct *color, 867 const sar_image_struct **bg_image, /* Total 9 images */ 868 float scroll_x, float scroll_y, /* In meters */ 869 float m_to_pixels_coeff, /* Meters to pixels coeff */ 870 int show_markings_policy 871 ); 872 extern int SARMenuMapAppendMarking( 873 sar_menu_map_struct *map, 874 int type, /* One of SAR_MENU_MAP_MARKING_TYPE_* */ 875 const sar_menu_color_struct *fg_color, 876 float x, float y, /* In meters */ 877 float x_end, float y_end, /* In meters (for intercept line) */ 878 const sar_image_struct *icon, /* Shared icon image */ 879 const char *desc 880 ); 881 extern void SARMenuMapDeleteAllMarkings(sar_menu_map_struct *map); 882 extern void SARMenuMapMarkingSelectNext( 883 sar_menu_map_struct *map, Boolean allow_warp 884 ); 885 extern void SARMenuMapMarkingSelectPrev( 886 sar_menu_map_struct *map, Boolean allow_warp 887 ); 888 extern void SARMenuMapDraw( 889 gw_display_struct *display, 890 sar_menu_struct *m, 891 sar_menu_map_struct *map, 892 int map_num 893 ); 894 extern int SARMenuMapManagePointer( 895 gw_display_struct *display, sar_menu_struct *m, 896 sar_menu_map_struct *map, int menu_obj_num, 897 int x, int y, gw_event_type type, int btn_num 898 ); 899 900 /* In menuobjview.c */ 901 extern int SARMenuObjViewNew( 902 sar_menu_struct *m, 903 float x, float y, 904 float width, float height, 905 GWFont *font, 906 sar_menu_color_struct *color, 907 const sar_image_struct **bg_image, /* Pointer to 9 images */ 908 const char *title 909 ); 910 extern int SARMenuObjViewManagePointer( 911 gw_display_struct *display, sar_menu_struct *m, 912 sar_menu_objview_struct *ov_ptr, int ov_num, 913 int x, int y, gw_event_type type, int btn_num 914 ); 915 extern int SARMenuObjViewManageKey( 916 gw_display_struct *display, sar_menu_struct *m, 917 sar_menu_objview_struct *ov_ptr, int ov_num, 918 int key, Boolean state 919 ); 920 extern int SARMenuObjViewLoad( 921 gw_display_struct *display, sar_menu_struct *m, 922 sar_menu_objview_struct *ov_ptr, int ov_num, 923 const char *filename 924 ); 925 extern void SARMenuObjViewRebufferImage( 926 gw_display_struct *display, sar_menu_struct *m, 927 sar_menu_objview_struct *ov_ptr, int ov_num 928 ); 929 930 931 #endif /* MENU_H */ 932