diff options
| author | Jan Djärv | 2004-10-26 19:48:07 +0000 |
|---|---|---|
| committer | Jan Djärv | 2004-10-26 19:48:07 +0000 |
| commit | 71bacd4863b61424e331e9fc5762d5d9aa047faa (patch) | |
| tree | e295272762c173d91edae43001af8eed1875d6eb /src | |
| parent | 9db6ae810de05cfbb9e3de3518532035bf256523 (diff) | |
| download | emacs-71bacd4863b61424e331e9fc5762d5d9aa047faa.tar.gz emacs-71bacd4863b61424e331e9fc5762d5d9aa047faa.zip | |
* gtkutil.c: Put empty line between comment and function body.
(xg_destroy_widgets): Renamed from remove_from_container. Just
destroy all widgets in list. Argument wcont removed.
(xg_update_menubar, xg_update_submenu): Call xg_destroy_widgets
instead of remove_from_container.
(xg_display_close, xg_create_tool_bar, update_frame_tool_bar)
(free_frame_tool_bar): Add comment.
Diffstat (limited to 'src')
| -rw-r--r-- | src/gtkutil.c | 105 |
1 files changed, 90 insertions, 15 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c index 8182ff45766..dc091c1a09b 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -48,6 +48,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 48 | #ifdef HAVE_GTK_MULTIDISPLAY | 48 | #ifdef HAVE_GTK_MULTIDISPLAY |
| 49 | 49 | ||
| 50 | /* Return the GdkDisplay that corresponds to the X display DPY. */ | 50 | /* Return the GdkDisplay that corresponds to the X display DPY. */ |
| 51 | |||
| 51 | static GdkDisplay * | 52 | static GdkDisplay * |
| 52 | xg_get_gdk_display (dpy) | 53 | xg_get_gdk_display (dpy) |
| 53 | Display *dpy; | 54 | Display *dpy; |
| @@ -58,6 +59,7 @@ xg_get_gdk_display (dpy) | |||
| 58 | /* When the GTK widget W is to be created on a display for F that | 59 | /* When the GTK widget W is to be created on a display for F that |
| 59 | is not the default display, set the display for W. | 60 | is not the default display, set the display for W. |
| 60 | W can be a GtkMenu or a GtkWindow widget. */ | 61 | W can be a GtkMenu or a GtkWindow widget. */ |
| 62 | |||
| 61 | static void | 63 | static void |
| 62 | xg_set_screen (w, f) | 64 | xg_set_screen (w, f) |
| 63 | GtkWidget *w; | 65 | GtkWidget *w; |
| @@ -80,6 +82,7 @@ xg_set_screen (w, f) | |||
| 80 | 82 | ||
| 81 | /* Make some defines so we can use the GTK 2.2 functions when | 83 | /* Make some defines so we can use the GTK 2.2 functions when |
| 82 | compiling with GTK 2.0. */ | 84 | compiling with GTK 2.0. */ |
| 85 | |||
| 83 | #define xg_set_screen(w, f) | 86 | #define xg_set_screen(w, f) |
| 84 | #define gdk_xid_table_lookup_for_display(dpy, w) gdk_xid_table_lookup (w) | 87 | #define gdk_xid_table_lookup_for_display(dpy, w) gdk_xid_table_lookup (w) |
| 85 | #define gdk_pixmap_foreign_new_for_display(dpy, p) gdk_pixmap_foreign_new (p) | 88 | #define gdk_pixmap_foreign_new_for_display(dpy, p) gdk_pixmap_foreign_new (p) |
| @@ -95,6 +98,7 @@ xg_set_screen (w, f) | |||
| 95 | Returns non-zero if display could be opened, zero if display could not | 98 | Returns non-zero if display could be opened, zero if display could not |
| 96 | be opened, and less than zero if the GTK version doesn't support | 99 | be opened, and less than zero if the GTK version doesn't support |
| 97 | multipe displays. */ | 100 | multipe displays. */ |
| 101 | |||
| 98 | int | 102 | int |
| 99 | xg_display_open (display_name, dpy) | 103 | xg_display_open (display_name, dpy) |
| 100 | char *display_name; | 104 | char *display_name; |
| @@ -115,6 +119,8 @@ xg_display_open (display_name, dpy) | |||
| 115 | } | 119 | } |
| 116 | 120 | ||
| 117 | 121 | ||
| 122 | /* Close display DPY. */ | ||
| 123 | |||
| 118 | void | 124 | void |
| 119 | xg_display_close (Display *dpy) | 125 | xg_display_close (Display *dpy) |
| 120 | { | 126 | { |
| @@ -176,6 +182,7 @@ static int malloc_cpt; | |||
| 176 | widget_value_free_list or by malloc:ing a new one. | 182 | widget_value_free_list or by malloc:ing a new one. |
| 177 | 183 | ||
| 178 | Return a pointer to the allocated structure. */ | 184 | Return a pointer to the allocated structure. */ |
| 185 | |||
| 179 | widget_value * | 186 | widget_value * |
| 180 | malloc_widget_value () | 187 | malloc_widget_value () |
| 181 | { | 188 | { |
| @@ -197,6 +204,7 @@ malloc_widget_value () | |||
| 197 | 204 | ||
| 198 | /* This is analogous to free. It frees only what was allocated | 205 | /* This is analogous to free. It frees only what was allocated |
| 199 | by malloc_widget_value, and no substructures. */ | 206 | by malloc_widget_value, and no substructures. */ |
| 207 | |||
| 200 | void | 208 | void |
| 201 | free_widget_value (wv) | 209 | free_widget_value (wv) |
| 202 | widget_value *wv; | 210 | widget_value *wv; |
| @@ -221,6 +229,7 @@ free_widget_value (wv) | |||
| 221 | 229 | ||
| 222 | /* Create and return the cursor to be used for popup menus and | 230 | /* Create and return the cursor to be used for popup menus and |
| 223 | scroll bars on display DPY. */ | 231 | scroll bars on display DPY. */ |
| 232 | |||
| 224 | GdkCursor * | 233 | GdkCursor * |
| 225 | xg_create_default_cursor (dpy) | 234 | xg_create_default_cursor (dpy) |
| 226 | Display *dpy; | 235 | Display *dpy; |
| @@ -239,6 +248,7 @@ xg_create_default_cursor (dpy) | |||
| 239 | WIDGET is used to find the GdkColormap to use for the GdkPixbuf. | 248 | WIDGET is used to find the GdkColormap to use for the GdkPixbuf. |
| 240 | If OLD_WIDGET is NULL, a new widget is constructed and returned. | 249 | If OLD_WIDGET is NULL, a new widget is constructed and returned. |
| 241 | If OLD_WIDGET is not NULL, that widget is modified. */ | 250 | If OLD_WIDGET is not NULL, that widget is modified. */ |
| 251 | |||
| 242 | static GtkWidget * | 252 | static GtkWidget * |
| 243 | xg_get_image_for_pixmap (f, img, widget, old_widget) | 253 | xg_get_image_for_pixmap (f, img, widget, old_widget) |
| 244 | FRAME_PTR f; | 254 | FRAME_PTR f; |
| @@ -373,6 +383,7 @@ xg_get_image_for_pixmap (f, img, widget, old_widget) | |||
| 373 | /* Set CURSOR on W and all widgets W contain. We must do like this | 383 | /* Set CURSOR on W and all widgets W contain. We must do like this |
| 374 | for scroll bars and menu because they create widgets internally, | 384 | for scroll bars and menu because they create widgets internally, |
| 375 | and it is those widgets that are visible. */ | 385 | and it is those widgets that are visible. */ |
| 386 | |||
| 376 | static void | 387 | static void |
| 377 | xg_set_cursor (w, cursor) | 388 | xg_set_cursor (w, cursor) |
| 378 | GtkWidget *w; | 389 | GtkWidget *w; |
| @@ -400,6 +411,7 @@ xg_set_cursor (w, cursor) | |||
| 400 | has expired by calling the GTK event loop. | 411 | has expired by calling the GTK event loop. |
| 401 | Also, when a menu is active, it has a small timeout before it | 412 | Also, when a menu is active, it has a small timeout before it |
| 402 | pops down the sub menu under it. */ | 413 | pops down the sub menu under it. */ |
| 414 | |||
| 403 | static void | 415 | static void |
| 404 | xg_process_timeouts (timer) | 416 | xg_process_timeouts (timer) |
| 405 | struct atimer *timer; | 417 | struct atimer *timer; |
| @@ -415,6 +427,7 @@ xg_process_timeouts (timer) | |||
| 415 | /* Start the xg_timer with an interval of 0.1 seconds, if not already started. | 427 | /* Start the xg_timer with an interval of 0.1 seconds, if not already started. |
| 416 | xg_process_timeouts is called when the timer expires. The timer | 428 | xg_process_timeouts is called when the timer expires. The timer |
| 417 | started is continuous, i.e. runs until xg_stop_timer is called. */ | 429 | started is continuous, i.e. runs until xg_stop_timer is called. */ |
| 430 | |||
| 418 | static void | 431 | static void |
| 419 | xg_start_timer () | 432 | xg_start_timer () |
| 420 | { | 433 | { |
| @@ -430,6 +443,7 @@ xg_start_timer () | |||
| 430 | } | 443 | } |
| 431 | 444 | ||
| 432 | /* Stop the xg_timer if started. */ | 445 | /* Stop the xg_timer if started. */ |
| 446 | |||
| 433 | static void | 447 | static void |
| 434 | xg_stop_timer () | 448 | xg_stop_timer () |
| 435 | { | 449 | { |
| @@ -441,6 +455,7 @@ xg_stop_timer () | |||
| 441 | } | 455 | } |
| 442 | 456 | ||
| 443 | /* Insert NODE into linked LIST. */ | 457 | /* Insert NODE into linked LIST. */ |
| 458 | |||
| 444 | static void | 459 | static void |
| 445 | xg_list_insert (xg_list_node *list, xg_list_node *node) | 460 | xg_list_insert (xg_list_node *list, xg_list_node *node) |
| 446 | { | 461 | { |
| @@ -453,6 +468,7 @@ xg_list_insert (xg_list_node *list, xg_list_node *node) | |||
| 453 | } | 468 | } |
| 454 | 469 | ||
| 455 | /* Remove NODE from linked LIST. */ | 470 | /* Remove NODE from linked LIST. */ |
| 471 | |||
| 456 | static void | 472 | static void |
| 457 | xg_list_remove (xg_list_node *list, xg_list_node *node) | 473 | xg_list_remove (xg_list_node *list, xg_list_node *node) |
| 458 | { | 474 | { |
| @@ -473,6 +489,7 @@ xg_list_remove (xg_list_node *list, xg_list_node *node) | |||
| 473 | utf8 or NULL, just return STR. | 489 | utf8 or NULL, just return STR. |
| 474 | If not, a new string is allocated and the caller must free the result | 490 | If not, a new string is allocated and the caller must free the result |
| 475 | with g_free. */ | 491 | with g_free. */ |
| 492 | |||
| 476 | static char * | 493 | static char * |
| 477 | get_utf8_string (str) | 494 | get_utf8_string (str) |
| 478 | char *str; | 495 | char *str; |
| @@ -496,6 +513,7 @@ get_utf8_string (str) | |||
| 496 | only way to get geometry position right if the user explicitly | 513 | only way to get geometry position right if the user explicitly |
| 497 | asked for a position when starting Emacs. | 514 | asked for a position when starting Emacs. |
| 498 | F is the frame we shall set geometry for. */ | 515 | F is the frame we shall set geometry for. */ |
| 516 | |||
| 499 | static void | 517 | static void |
| 500 | xg_set_geometry (f) | 518 | xg_set_geometry (f) |
| 501 | FRAME_PTR f; | 519 | FRAME_PTR f; |
| @@ -529,6 +547,7 @@ xg_set_geometry (f) | |||
| 529 | /* Resize the outer window of frame F after chainging the height. | 547 | /* Resize the outer window of frame F after chainging the height. |
| 530 | This happend when the menu bar or the tool bar is added or removed. | 548 | This happend when the menu bar or the tool bar is added or removed. |
| 531 | COLUMNS/ROWS is the size the edit area shall have after the resize. */ | 549 | COLUMNS/ROWS is the size the edit area shall have after the resize. */ |
| 550 | |||
| 532 | static void | 551 | static void |
| 533 | xg_resize_outer_widget (f, columns, rows) | 552 | xg_resize_outer_widget (f, columns, rows) |
| 534 | FRAME_PTR f; | 553 | FRAME_PTR f; |
| @@ -555,6 +574,7 @@ xg_resize_outer_widget (f, columns, rows) | |||
| 555 | manually. | 574 | manually. |
| 556 | F is the frame to resize. | 575 | F is the frame to resize. |
| 557 | PIXELWIDTH, PIXELHEIGHT is the new size in pixels. */ | 576 | PIXELWIDTH, PIXELHEIGHT is the new size in pixels. */ |
| 577 | |||
| 558 | void | 578 | void |
| 559 | xg_resize_widgets (f, pixelwidth, pixelheight) | 579 | xg_resize_widgets (f, pixelwidth, pixelheight) |
| 560 | FRAME_PTR f; | 580 | FRAME_PTR f; |
| @@ -591,6 +611,7 @@ xg_resize_widgets (f, pixelwidth, pixelheight) | |||
| 591 | 611 | ||
| 592 | 612 | ||
| 593 | /* Update our widget size to be COLS/ROWS characters for frame F. */ | 613 | /* Update our widget size to be COLS/ROWS characters for frame F. */ |
| 614 | |||
| 594 | void | 615 | void |
| 595 | xg_frame_set_char_size (f, cols, rows) | 616 | xg_frame_set_char_size (f, cols, rows) |
| 596 | FRAME_PTR f; | 617 | FRAME_PTR f; |
| @@ -630,6 +651,7 @@ xg_frame_set_char_size (f, cols, rows) | |||
| 630 | X Window that aren't accessible. | 651 | X Window that aren't accessible. |
| 631 | 652 | ||
| 632 | Return 0 if no widget match WDESC. */ | 653 | Return 0 if no widget match WDESC. */ |
| 654 | |||
| 633 | GtkWidget * | 655 | GtkWidget * |
| 634 | xg_win_to_widget (dpy, wdesc) | 656 | xg_win_to_widget (dpy, wdesc) |
| 635 | Display *dpy; | 657 | Display *dpy; |
| @@ -655,6 +677,7 @@ xg_win_to_widget (dpy, wdesc) | |||
| 655 | 677 | ||
| 656 | /* Fill in the GdkColor C so that it represents PIXEL. | 678 | /* Fill in the GdkColor C so that it represents PIXEL. |
| 657 | W is the widget that color will be used for. Used to find colormap. */ | 679 | W is the widget that color will be used for. Used to find colormap. */ |
| 680 | |||
| 658 | static void | 681 | static void |
| 659 | xg_pix_to_gcolor (w, pixel, c) | 682 | xg_pix_to_gcolor (w, pixel, c) |
| 660 | GtkWidget *w; | 683 | GtkWidget *w; |
| @@ -667,6 +690,7 @@ xg_pix_to_gcolor (w, pixel, c) | |||
| 667 | 690 | ||
| 668 | /* Create and set up the GTK widgets for frame F. | 691 | /* Create and set up the GTK widgets for frame F. |
| 669 | Return 0 if creation failed, non-zero otherwise. */ | 692 | Return 0 if creation failed, non-zero otherwise. */ |
| 693 | |||
| 670 | int | 694 | int |
| 671 | xg_create_frame_widgets (f) | 695 | xg_create_frame_widgets (f) |
| 672 | FRAME_PTR f; | 696 | FRAME_PTR f; |
| @@ -802,6 +826,7 @@ xg_create_frame_widgets (f) | |||
| 802 | that the window now has. | 826 | that the window now has. |
| 803 | If USER_POSITION is nonzero, we set the User Position | 827 | If USER_POSITION is nonzero, we set the User Position |
| 804 | flag (this is useful when FLAGS is 0). */ | 828 | flag (this is useful when FLAGS is 0). */ |
| 829 | |||
| 805 | void | 830 | void |
| 806 | x_wm_set_size_hint (f, flags, user_position) | 831 | x_wm_set_size_hint (f, flags, user_position) |
| 807 | FRAME_PTR f; | 832 | FRAME_PTR f; |
| @@ -900,6 +925,7 @@ x_wm_set_size_hint (f, flags, user_position) | |||
| 900 | keep the GTK and X colors in sync. | 925 | keep the GTK and X colors in sync. |
| 901 | F is the frame to change, | 926 | F is the frame to change, |
| 902 | BG is the pixel value to change to. */ | 927 | BG is the pixel value to change to. */ |
| 928 | |||
| 903 | void | 929 | void |
| 904 | xg_set_background_color (f, bg) | 930 | xg_set_background_color (f, bg) |
| 905 | FRAME_PTR f; | 931 | FRAME_PTR f; |
| @@ -923,6 +949,7 @@ xg_set_background_color (f, bg) | |||
| 923 | ***********************************************************************/ | 949 | ***********************************************************************/ |
| 924 | /* Return the dialog title to use for a dialog of type KEY. | 950 | /* Return the dialog title to use for a dialog of type KEY. |
| 925 | This is the encoding used by lwlib. We use the same for GTK. */ | 951 | This is the encoding used by lwlib. We use the same for GTK. */ |
| 952 | |||
| 926 | static char * | 953 | static char * |
| 927 | get_dialog_title (char key) | 954 | get_dialog_title (char key) |
| 928 | { | 955 | { |
| @@ -963,6 +990,7 @@ get_dialog_title (char key) | |||
| 963 | user_data is NULL (not used). | 990 | user_data is NULL (not used). |
| 964 | 991 | ||
| 965 | Returns TRUE to end propagation of event. */ | 992 | Returns TRUE to end propagation of event. */ |
| 993 | |||
| 966 | static gboolean | 994 | static gboolean |
| 967 | dialog_delete_callback (w, event, user_data) | 995 | dialog_delete_callback (w, event, user_data) |
| 968 | GtkWidget *w; | 996 | GtkWidget *w; |
| @@ -979,6 +1007,7 @@ dialog_delete_callback (w, event, user_data) | |||
| 979 | DEACTIVATE_CB is the callback to use when the dialog pops down. | 1007 | DEACTIVATE_CB is the callback to use when the dialog pops down. |
| 980 | 1008 | ||
| 981 | Returns the GTK dialog widget. */ | 1009 | Returns the GTK dialog widget. */ |
| 1010 | |||
| 982 | static GtkWidget * | 1011 | static GtkWidget * |
| 983 | create_dialog (wv, select_cb, deactivate_cb) | 1012 | create_dialog (wv, select_cb, deactivate_cb) |
| 984 | widget_value *wv; | 1013 | widget_value *wv; |
| @@ -1101,6 +1130,7 @@ enum | |||
| 1101 | a file dialog. | 1130 | a file dialog. |
| 1102 | W is the file dialog widget, | 1131 | W is the file dialog widget, |
| 1103 | ARG points to an integer where we record what has happend. */ | 1132 | ARG points to an integer where we record what has happend. */ |
| 1133 | |||
| 1104 | static void | 1134 | static void |
| 1105 | xg_file_sel_ok (w, arg) | 1135 | xg_file_sel_ok (w, arg) |
| 1106 | GtkWidget *w; | 1136 | GtkWidget *w; |
| @@ -1113,6 +1143,7 @@ xg_file_sel_ok (w, arg) | |||
| 1113 | a file dialog. | 1143 | a file dialog. |
| 1114 | W is the file dialog widget, | 1144 | W is the file dialog widget, |
| 1115 | ARG points to an integer where we record what has happend. */ | 1145 | ARG points to an integer where we record what has happend. */ |
| 1146 | |||
| 1116 | static void | 1147 | static void |
| 1117 | xg_file_sel_cancel (w, arg) | 1148 | xg_file_sel_cancel (w, arg) |
| 1118 | GtkWidget *w; | 1149 | GtkWidget *w; |
| @@ -1127,6 +1158,7 @@ xg_file_sel_cancel (w, arg) | |||
| 1127 | the dialog is popped down, but the dialog widget is not destroyed. | 1158 | the dialog is popped down, but the dialog widget is not destroyed. |
| 1128 | W is the file dialog widget, | 1159 | W is the file dialog widget, |
| 1129 | ARG points to an integer where we record what has happend. */ | 1160 | ARG points to an integer where we record what has happend. */ |
| 1161 | |||
| 1130 | static void | 1162 | static void |
| 1131 | xg_file_sel_destroy (w, arg) | 1163 | xg_file_sel_destroy (w, arg) |
| 1132 | GtkWidget *w; | 1164 | GtkWidget *w; |
| @@ -1144,6 +1176,7 @@ xg_file_sel_destroy (w, arg) | |||
| 1144 | 1176 | ||
| 1145 | Returns a file name or NULL if no file was selected. | 1177 | Returns a file name or NULL if no file was selected. |
| 1146 | The returned string must be freed by the caller. */ | 1178 | The returned string must be freed by the caller. */ |
| 1179 | |||
| 1147 | char * | 1180 | char * |
| 1148 | xg_get_file_name (f, prompt, default_filename, mustmatch_p) | 1181 | xg_get_file_name (f, prompt, default_filename, mustmatch_p) |
| 1149 | FRAME_PTR f; | 1182 | FRAME_PTR f; |
| @@ -1234,6 +1267,7 @@ static xg_list_node xg_menu_item_cb_list; | |||
| 1234 | 1267 | ||
| 1235 | Returns CL_DATA if CL_DATA is not NULL, or a pointer to a newly | 1268 | Returns CL_DATA if CL_DATA is not NULL, or a pointer to a newly |
| 1236 | allocated xg_menu_cb_data if CL_DATA is NULL. */ | 1269 | allocated xg_menu_cb_data if CL_DATA is NULL. */ |
| 1270 | |||
| 1237 | static xg_menu_cb_data * | 1271 | static xg_menu_cb_data * |
| 1238 | make_cl_data (cl_data, f, highlight_cb) | 1272 | make_cl_data (cl_data, f, highlight_cb) |
| 1239 | xg_menu_cb_data *cl_data; | 1273 | xg_menu_cb_data *cl_data; |
| @@ -1267,6 +1301,7 @@ make_cl_data (cl_data, f, highlight_cb) | |||
| 1267 | HIGHLIGHT_CB could change, there is no check that the same | 1301 | HIGHLIGHT_CB could change, there is no check that the same |
| 1268 | function is given when modifying a menu bar as was given when | 1302 | function is given when modifying a menu bar as was given when |
| 1269 | creating the menu bar. */ | 1303 | creating the menu bar. */ |
| 1304 | |||
| 1270 | static void | 1305 | static void |
| 1271 | update_cl_data (cl_data, f, highlight_cb) | 1306 | update_cl_data (cl_data, f, highlight_cb) |
| 1272 | xg_menu_cb_data *cl_data; | 1307 | xg_menu_cb_data *cl_data; |
| @@ -1284,6 +1319,7 @@ update_cl_data (cl_data, f, highlight_cb) | |||
| 1284 | 1319 | ||
| 1285 | /* Decrease reference count for CL_DATA. | 1320 | /* Decrease reference count for CL_DATA. |
| 1286 | If reference count is zero, free CL_DATA. */ | 1321 | If reference count is zero, free CL_DATA. */ |
| 1322 | |||
| 1287 | static void | 1323 | static void |
| 1288 | unref_cl_data (cl_data) | 1324 | unref_cl_data (cl_data) |
| 1289 | xg_menu_cb_data *cl_data; | 1325 | xg_menu_cb_data *cl_data; |
| @@ -1300,6 +1336,7 @@ unref_cl_data (cl_data) | |||
| 1300 | } | 1336 | } |
| 1301 | 1337 | ||
| 1302 | /* Function that marks all lisp data during GC. */ | 1338 | /* Function that marks all lisp data during GC. */ |
| 1339 | |||
| 1303 | void | 1340 | void |
| 1304 | xg_mark_data () | 1341 | xg_mark_data () |
| 1305 | { | 1342 | { |
| @@ -1321,6 +1358,7 @@ xg_mark_data () | |||
| 1321 | /* Callback called when a menu item is destroyed. Used to free data. | 1358 | /* Callback called when a menu item is destroyed. Used to free data. |
| 1322 | W is the widget that is being destroyed (not used). | 1359 | W is the widget that is being destroyed (not used). |
| 1323 | CLIENT_DATA points to the xg_menu_item_cb_data associated with the W. */ | 1360 | CLIENT_DATA points to the xg_menu_item_cb_data associated with the W. */ |
| 1361 | |||
| 1324 | static void | 1362 | static void |
| 1325 | menuitem_destroy_callback (w, client_data) | 1363 | menuitem_destroy_callback (w, client_data) |
| 1326 | GtkWidget *w; | 1364 | GtkWidget *w; |
| @@ -1340,6 +1378,7 @@ menuitem_destroy_callback (w, client_data) | |||
| 1340 | CLIENT_DATA points to the xg_menu_item_cb_data associated with the W. | 1378 | CLIENT_DATA points to the xg_menu_item_cb_data associated with the W. |
| 1341 | 1379 | ||
| 1342 | Returns FALSE to tell GTK to keep processing this event. */ | 1380 | Returns FALSE to tell GTK to keep processing this event. */ |
| 1381 | |||
| 1343 | static gboolean | 1382 | static gboolean |
| 1344 | menuitem_highlight_callback (w, event, client_data) | 1383 | menuitem_highlight_callback (w, event, client_data) |
| 1345 | GtkWidget *w; | 1384 | GtkWidget *w; |
| @@ -1364,6 +1403,7 @@ menuitem_highlight_callback (w, event, client_data) | |||
| 1364 | /* Callback called when a menu is destroyed. Used to free data. | 1403 | /* Callback called when a menu is destroyed. Used to free data. |
| 1365 | W is the widget that is being destroyed (not used). | 1404 | W is the widget that is being destroyed (not used). |
| 1366 | CLIENT_DATA points to the xg_menu_cb_data associated with W. */ | 1405 | CLIENT_DATA points to the xg_menu_cb_data associated with W. */ |
| 1406 | |||
| 1367 | static void | 1407 | static void |
| 1368 | menu_destroy_callback (w, client_data) | 1408 | menu_destroy_callback (w, client_data) |
| 1369 | GtkWidget *w; | 1409 | GtkWidget *w; |
| @@ -1379,6 +1419,7 @@ menu_destroy_callback (w, client_data) | |||
| 1379 | W is the widget that does the grab (not used). | 1419 | W is the widget that does the grab (not used). |
| 1380 | UNGRAB_P is TRUE if this is an ungrab, FALSE if it is a grab. | 1420 | UNGRAB_P is TRUE if this is an ungrab, FALSE if it is a grab. |
| 1381 | CLIENT_DATA is NULL (not used). */ | 1421 | CLIENT_DATA is NULL (not used). */ |
| 1422 | |||
| 1382 | static void | 1423 | static void |
| 1383 | menu_grab_callback (GtkWidget *widget, | 1424 | menu_grab_callback (GtkWidget *widget, |
| 1384 | gboolean ungrab_p, | 1425 | gboolean ungrab_p, |
| @@ -1398,6 +1439,7 @@ menu_grab_callback (GtkWidget *widget, | |||
| 1398 | must be non-NULL) and can be inserted into a menu item. | 1439 | must be non-NULL) and can be inserted into a menu item. |
| 1399 | 1440 | ||
| 1400 | Returns the GtkHBox. */ | 1441 | Returns the GtkHBox. */ |
| 1442 | |||
| 1401 | static GtkWidget * | 1443 | static GtkWidget * |
| 1402 | make_widget_for_menu_item (utf8_label, utf8_key) | 1444 | make_widget_for_menu_item (utf8_label, utf8_key) |
| 1403 | char *utf8_label; | 1445 | char *utf8_label; |
| @@ -1437,6 +1479,7 @@ make_widget_for_menu_item (utf8_label, utf8_key) | |||
| 1437 | 1479 | ||
| 1438 | Unfortunately, keys don't line up as nicely as in Motif, | 1480 | Unfortunately, keys don't line up as nicely as in Motif, |
| 1439 | but the MacOS X version doesn't either, so I guess that is OK. */ | 1481 | but the MacOS X version doesn't either, so I guess that is OK. */ |
| 1482 | |||
| 1440 | static GtkWidget * | 1483 | static GtkWidget * |
| 1441 | make_menu_item (utf8_label, utf8_key, item, group) | 1484 | make_menu_item (utf8_label, utf8_key, item, group) |
| 1442 | char *utf8_label; | 1485 | char *utf8_label; |
| @@ -1486,6 +1529,7 @@ make_menu_item (utf8_label, utf8_key, item, group) | |||
| 1486 | 1529 | ||
| 1487 | /* Return non-zero if LABEL specifies a separator (GTK only has one | 1530 | /* Return non-zero if LABEL specifies a separator (GTK only has one |
| 1488 | separator type) */ | 1531 | separator type) */ |
| 1532 | |||
| 1489 | static int | 1533 | static int |
| 1490 | xg_separator_p (char *label) | 1534 | xg_separator_p (char *label) |
| 1491 | { | 1535 | { |
| @@ -1534,6 +1578,7 @@ xg_separator_p (char *label) | |||
| 1534 | static int xg_detached_menus; | 1578 | static int xg_detached_menus; |
| 1535 | 1579 | ||
| 1536 | /* Returns non-zero if there are detached menus. */ | 1580 | /* Returns non-zero if there are detached menus. */ |
| 1581 | |||
| 1537 | int | 1582 | int |
| 1538 | xg_have_tear_offs () | 1583 | xg_have_tear_offs () |
| 1539 | { | 1584 | { |
| @@ -1544,6 +1589,7 @@ xg_have_tear_offs () | |||
| 1544 | decrease the xg_detached_menus count. | 1589 | decrease the xg_detached_menus count. |
| 1545 | WIDGET is the top level window that is removed (the parent of the menu). | 1590 | WIDGET is the top level window that is removed (the parent of the menu). |
| 1546 | CLIENT_DATA is not used. */ | 1591 | CLIENT_DATA is not used. */ |
| 1592 | |||
| 1547 | static void | 1593 | static void |
| 1548 | tearoff_remove (widget, client_data) | 1594 | tearoff_remove (widget, client_data) |
| 1549 | GtkWidget *widget; | 1595 | GtkWidget *widget; |
| @@ -1556,6 +1602,7 @@ tearoff_remove (widget, client_data) | |||
| 1556 | xg_detached_menus count. | 1602 | xg_detached_menus count. |
| 1557 | WIDGET is the GtkTearoffMenuItem. | 1603 | WIDGET is the GtkTearoffMenuItem. |
| 1558 | CLIENT_DATA is not used. */ | 1604 | CLIENT_DATA is not used. */ |
| 1605 | |||
| 1559 | static void | 1606 | static void |
| 1560 | tearoff_activate (widget, client_data) | 1607 | tearoff_activate (widget, client_data) |
| 1561 | GtkWidget *widget; | 1608 | GtkWidget *widget; |
| @@ -1585,6 +1632,7 @@ tearoff_activate (widget, client_data) | |||
| 1585 | in the group. On exit, *GROUP contains the radio item group. | 1632 | in the group. On exit, *GROUP contains the radio item group. |
| 1586 | 1633 | ||
| 1587 | Returns the created GtkWidget. */ | 1634 | Returns the created GtkWidget. */ |
| 1635 | |||
| 1588 | static GtkWidget * | 1636 | static GtkWidget * |
| 1589 | xg_create_one_menuitem (item, f, select_cb, highlight_cb, cl_data, group) | 1637 | xg_create_one_menuitem (item, f, select_cb, highlight_cb, cl_data, group) |
| 1590 | widget_value *item; | 1638 | widget_value *item; |
| @@ -1802,6 +1850,7 @@ create_menus (data, f, select_cb, deactivate_cb, highlight_cb, | |||
| 1802 | HIGHLIGHT_CB is the callback to call when entering/leaving menu items. | 1850 | HIGHLIGHT_CB is the callback to call when entering/leaving menu items. |
| 1803 | 1851 | ||
| 1804 | Returns the widget created. */ | 1852 | Returns the widget created. */ |
| 1853 | |||
| 1805 | GtkWidget * | 1854 | GtkWidget * |
| 1806 | xg_create_widget (type, name, f, val, | 1855 | xg_create_widget (type, name, f, val, |
| 1807 | select_cb, deactivate_cb, highlight_cb) | 1856 | select_cb, deactivate_cb, highlight_cb) |
| @@ -1859,6 +1908,7 @@ xg_create_widget (type, name, f, val, | |||
| 1859 | } | 1908 | } |
| 1860 | 1909 | ||
| 1861 | /* Return the label for menu item WITEM. */ | 1910 | /* Return the label for menu item WITEM. */ |
| 1911 | |||
| 1862 | static const char * | 1912 | static const char * |
| 1863 | xg_get_menu_item_label (witem) | 1913 | xg_get_menu_item_label (witem) |
| 1864 | GtkMenuItem *witem; | 1914 | GtkMenuItem *witem; |
| @@ -1868,6 +1918,7 @@ xg_get_menu_item_label (witem) | |||
| 1868 | } | 1918 | } |
| 1869 | 1919 | ||
| 1870 | /* Return non-zero if the menu item WITEM has the text LABEL. */ | 1920 | /* Return non-zero if the menu item WITEM has the text LABEL. */ |
| 1921 | |||
| 1871 | static int | 1922 | static int |
| 1872 | xg_item_label_same_p (witem, label) | 1923 | xg_item_label_same_p (witem, label) |
| 1873 | GtkMenuItem *witem; | 1924 | GtkMenuItem *witem; |
| @@ -1887,10 +1938,10 @@ xg_item_label_same_p (witem, label) | |||
| 1887 | return is_same; | 1938 | return is_same; |
| 1888 | } | 1939 | } |
| 1889 | 1940 | ||
| 1890 | /* Remove widgets in LIST from container WCONT. */ | 1941 | /* Destroy widgets in LIST. */ |
| 1942 | |||
| 1891 | static void | 1943 | static void |
| 1892 | remove_from_container (wcont, list) | 1944 | xg_destroy_widgets (list) |
| 1893 | GtkWidget *wcont; | ||
| 1894 | GList *list; | 1945 | GList *list; |
| 1895 | { | 1946 | { |
| 1896 | GList *iter; | 1947 | GList *iter; |
| @@ -1899,15 +1950,7 @@ remove_from_container (wcont, list) | |||
| 1899 | { | 1950 | { |
| 1900 | GtkWidget *w = GTK_WIDGET (iter->data); | 1951 | GtkWidget *w = GTK_WIDGET (iter->data); |
| 1901 | 1952 | ||
| 1902 | /* Add a ref to w so we can explicitly destroy it later. */ | 1953 | /* Destroying the widget will remove it from the container it is in. */ |
| 1903 | gtk_widget_ref (w); | ||
| 1904 | gtk_container_remove (GTK_CONTAINER (wcont), w); | ||
| 1905 | |||
| 1906 | /* If there is a menu under this widget that has been detached, | ||
| 1907 | there is a reference to it, and just removing w from the | ||
| 1908 | container does not destroy the submenu. By explicitly | ||
| 1909 | destroying w we make sure the submenu is destroyed, thus | ||
| 1910 | removing the detached window also if there was one. */ | ||
| 1911 | gtk_widget_destroy (w); | 1954 | gtk_widget_destroy (w); |
| 1912 | } | 1955 | } |
| 1913 | } | 1956 | } |
| @@ -1923,6 +1966,7 @@ remove_from_container (wcont, list) | |||
| 1923 | CL_DATA points to the callback data to be used for this menu bar. | 1966 | CL_DATA points to the callback data to be used for this menu bar. |
| 1924 | 1967 | ||
| 1925 | This function calls itself to walk through the menu bar names. */ | 1968 | This function calls itself to walk through the menu bar names. */ |
| 1969 | |||
| 1926 | static void | 1970 | static void |
| 1927 | xg_update_menubar (menubar, f, list, iter, pos, val, | 1971 | xg_update_menubar (menubar, f, list, iter, pos, val, |
| 1928 | select_cb, highlight_cb, cl_data) | 1972 | select_cb, highlight_cb, cl_data) |
| @@ -1941,7 +1985,7 @@ xg_update_menubar (menubar, f, list, iter, pos, val, | |||
| 1941 | else if (iter && ! val) | 1985 | else if (iter && ! val) |
| 1942 | { | 1986 | { |
| 1943 | /* Item(s) have been removed. Remove all remaining items. */ | 1987 | /* Item(s) have been removed. Remove all remaining items. */ |
| 1944 | remove_from_container (menubar, iter); | 1988 | xg_destroy_widgets (iter); |
| 1945 | 1989 | ||
| 1946 | /* All updated. */ | 1990 | /* All updated. */ |
| 1947 | val = 0; | 1991 | val = 0; |
| @@ -2095,6 +2139,7 @@ xg_update_menubar (menubar, f, list, iter, pos, val, | |||
| 2095 | SELECT_CB is the callback to use when a menu item is selected. | 2139 | SELECT_CB is the callback to use when a menu item is selected. |
| 2096 | HIGHLIGHT_CB is the callback to call when entering/leaving menu items. | 2140 | HIGHLIGHT_CB is the callback to call when entering/leaving menu items. |
| 2097 | CL_DATA is the data to set in the widget for menu invokation. */ | 2141 | CL_DATA is the data to set in the widget for menu invokation. */ |
| 2142 | |||
| 2098 | static void | 2143 | static void |
| 2099 | xg_update_menu_item (val, w, select_cb, highlight_cb, cl_data) | 2144 | xg_update_menu_item (val, w, select_cb, highlight_cb, cl_data) |
| 2100 | widget_value *val; | 2145 | widget_value *val; |
| @@ -2229,6 +2274,7 @@ xg_update_menu_item (val, w, select_cb, highlight_cb, cl_data) | |||
| 2229 | } | 2274 | } |
| 2230 | 2275 | ||
| 2231 | /* Update the toggle menu item W so it corresponds to VAL. */ | 2276 | /* Update the toggle menu item W so it corresponds to VAL. */ |
| 2277 | |||
| 2232 | static void | 2278 | static void |
| 2233 | xg_update_toggle_item (val, w) | 2279 | xg_update_toggle_item (val, w) |
| 2234 | widget_value *val; | 2280 | widget_value *val; |
| @@ -2238,6 +2284,7 @@ xg_update_toggle_item (val, w) | |||
| 2238 | } | 2284 | } |
| 2239 | 2285 | ||
| 2240 | /* Update the radio menu item W so it corresponds to VAL. */ | 2286 | /* Update the radio menu item W so it corresponds to VAL. */ |
| 2287 | |||
| 2241 | static void | 2288 | static void |
| 2242 | xg_update_radio_item (val, w) | 2289 | xg_update_radio_item (val, w) |
| 2243 | widget_value *val; | 2290 | widget_value *val; |
| @@ -2367,8 +2414,8 @@ xg_update_submenu (submenu, f, val, | |||
| 2367 | { | 2414 | { |
| 2368 | /* If we are adding new menu items below, we must remove from | 2415 | /* If we are adding new menu items below, we must remove from |
| 2369 | first radio button so that radio groups become correct. */ | 2416 | first radio button so that radio groups become correct. */ |
| 2370 | if (cur && first_radio) remove_from_container (submenu, first_radio); | 2417 | if (cur && first_radio) xg_destroy_widgets (first_radio); |
| 2371 | else remove_from_container (submenu, iter); | 2418 | else xg_destroy_widgets (iter); |
| 2372 | } | 2419 | } |
| 2373 | 2420 | ||
| 2374 | if (cur) | 2421 | if (cur) |
| @@ -2400,6 +2447,7 @@ xg_update_submenu (submenu, f, val, | |||
| 2400 | SELECT_CB is the callback to use when a menu item is selected. | 2447 | SELECT_CB is the callback to use when a menu item is selected. |
| 2401 | DEACTIVATE_CB is the callback to use when a sub menu is not shown anymore. | 2448 | DEACTIVATE_CB is the callback to use when a sub menu is not shown anymore. |
| 2402 | HIGHLIGHT_CB is the callback to call when entering/leaving menu items. */ | 2449 | HIGHLIGHT_CB is the callback to call when entering/leaving menu items. */ |
| 2450 | |||
| 2403 | void | 2451 | void |
| 2404 | xg_modify_menubar_widgets (menubar, f, val, deep_p, | 2452 | xg_modify_menubar_widgets (menubar, f, val, deep_p, |
| 2405 | select_cb, deactivate_cb, highlight_cb) | 2453 | select_cb, deactivate_cb, highlight_cb) |
| @@ -2544,12 +2592,14 @@ free_frame_menubar (f) | |||
| 2544 | 2592 | ||
| 2545 | /* Setting scroll bar values invokes the callback. Use this variable | 2593 | /* Setting scroll bar values invokes the callback. Use this variable |
| 2546 | to indicate that callback should do nothing. */ | 2594 | to indicate that callback should do nothing. */ |
| 2595 | |||
| 2547 | int xg_ignore_gtk_scrollbar; | 2596 | int xg_ignore_gtk_scrollbar; |
| 2548 | 2597 | ||
| 2549 | /* SET_SCROLL_BAR_X_WINDOW assumes the second argument fits in | 2598 | /* SET_SCROLL_BAR_X_WINDOW assumes the second argument fits in |
| 2550 | 32 bits. But we want to store pointers, and they may be larger | 2599 | 32 bits. But we want to store pointers, and they may be larger |
| 2551 | than 32 bits. Keep a mapping from integer index to widget pointers | 2600 | than 32 bits. Keep a mapping from integer index to widget pointers |
| 2552 | to get around the 32 bit limitation. */ | 2601 | to get around the 32 bit limitation. */ |
| 2602 | |||
| 2553 | static struct | 2603 | static struct |
| 2554 | { | 2604 | { |
| 2555 | GtkWidget **widgets; | 2605 | GtkWidget **widgets; |
| @@ -2558,9 +2608,11 @@ static struct | |||
| 2558 | } id_to_widget; | 2608 | } id_to_widget; |
| 2559 | 2609 | ||
| 2560 | /* Grow this much every time we need to allocate more */ | 2610 | /* Grow this much every time we need to allocate more */ |
| 2611 | |||
| 2561 | #define ID_TO_WIDGET_INCR 32 | 2612 | #define ID_TO_WIDGET_INCR 32 |
| 2562 | 2613 | ||
| 2563 | /* Store the widget pointer W in id_to_widget and return the integer index. */ | 2614 | /* Store the widget pointer W in id_to_widget and return the integer index. */ |
| 2615 | |||
| 2564 | static int | 2616 | static int |
| 2565 | xg_store_widget_in_map (w) | 2617 | xg_store_widget_in_map (w) |
| 2566 | GtkWidget *w; | 2618 | GtkWidget *w; |
| @@ -2599,6 +2651,7 @@ xg_store_widget_in_map (w) | |||
| 2599 | 2651 | ||
| 2600 | /* Remove pointer at IDX from id_to_widget. | 2652 | /* Remove pointer at IDX from id_to_widget. |
| 2601 | Called when scroll bar is destroyed. */ | 2653 | Called when scroll bar is destroyed. */ |
| 2654 | |||
| 2602 | static void | 2655 | static void |
| 2603 | xg_remove_widget_from_map (idx) | 2656 | xg_remove_widget_from_map (idx) |
| 2604 | int idx; | 2657 | int idx; |
| @@ -2611,6 +2664,7 @@ xg_remove_widget_from_map (idx) | |||
| 2611 | } | 2664 | } |
| 2612 | 2665 | ||
| 2613 | /* Get the widget pointer at IDX from id_to_widget. */ | 2666 | /* Get the widget pointer at IDX from id_to_widget. */ |
| 2667 | |||
| 2614 | static GtkWidget * | 2668 | static GtkWidget * |
| 2615 | xg_get_widget_from_map (idx) | 2669 | xg_get_widget_from_map (idx) |
| 2616 | int idx; | 2670 | int idx; |
| @@ -2623,6 +2677,7 @@ xg_get_widget_from_map (idx) | |||
| 2623 | 2677 | ||
| 2624 | /* Return the scrollbar id for X Window WID on display DPY. | 2678 | /* Return the scrollbar id for X Window WID on display DPY. |
| 2625 | Return -1 if WID not in id_to_widget. */ | 2679 | Return -1 if WID not in id_to_widget. */ |
| 2680 | |||
| 2626 | int | 2681 | int |
| 2627 | xg_get_scroll_id_for_window (dpy, wid) | 2682 | xg_get_scroll_id_for_window (dpy, wid) |
| 2628 | Display *dpy; | 2683 | Display *dpy; |
| @@ -2646,6 +2701,7 @@ xg_get_scroll_id_for_window (dpy, wid) | |||
| 2646 | /* Callback invoked when scroll bar WIDGET is destroyed. | 2701 | /* Callback invoked when scroll bar WIDGET is destroyed. |
| 2647 | DATA is the index into id_to_widget for WIDGET. | 2702 | DATA is the index into id_to_widget for WIDGET. |
| 2648 | We free pointer to last scroll bar values here and remove the index. */ | 2703 | We free pointer to last scroll bar values here and remove the index. */ |
| 2704 | |||
| 2649 | static void | 2705 | static void |
| 2650 | xg_gtk_scroll_destroy (widget, data) | 2706 | xg_gtk_scroll_destroy (widget, data) |
| 2651 | GtkWidget *widget; | 2707 | GtkWidget *widget; |
| @@ -2668,6 +2724,7 @@ xg_gtk_scroll_destroy (widget, data) | |||
| 2668 | 2724 | ||
| 2669 | Returns FALSE to tell GTK that it shall continue propagate the event | 2725 | Returns FALSE to tell GTK that it shall continue propagate the event |
| 2670 | to widgets. */ | 2726 | to widgets. */ |
| 2727 | |||
| 2671 | static gboolean | 2728 | static gboolean |
| 2672 | scroll_bar_button_cb (widget, event, user_data) | 2729 | scroll_bar_button_cb (widget, event, user_data) |
| 2673 | GtkWidget *widget; | 2730 | GtkWidget *widget; |
| @@ -2692,6 +2749,7 @@ scroll_bar_button_cb (widget, event, user_data) | |||
| 2692 | bar changes. | 2749 | bar changes. |
| 2693 | SCROLL_BAR_NAME is the name we use for the scroll bar. Can be used | 2750 | SCROLL_BAR_NAME is the name we use for the scroll bar. Can be used |
| 2694 | to set resources for the widget. */ | 2751 | to set resources for the widget. */ |
| 2752 | |||
| 2695 | void | 2753 | void |
| 2696 | xg_create_scroll_bar (f, bar, scroll_callback, scroll_bar_name) | 2754 | xg_create_scroll_bar (f, bar, scroll_callback, scroll_bar_name) |
| 2697 | FRAME_PTR f; | 2755 | FRAME_PTR f; |
| @@ -2753,6 +2811,7 @@ xg_create_scroll_bar (f, bar, scroll_callback, scroll_bar_name) | |||
| 2753 | } | 2811 | } |
| 2754 | 2812 | ||
| 2755 | /* Make the scroll bar represented by SCROLLBAR_ID visible. */ | 2813 | /* Make the scroll bar represented by SCROLLBAR_ID visible. */ |
| 2814 | |||
| 2756 | void | 2815 | void |
| 2757 | xg_show_scroll_bar (scrollbar_id) | 2816 | xg_show_scroll_bar (scrollbar_id) |
| 2758 | int scrollbar_id; | 2817 | int scrollbar_id; |
| @@ -2763,6 +2822,7 @@ xg_show_scroll_bar (scrollbar_id) | |||
| 2763 | } | 2822 | } |
| 2764 | 2823 | ||
| 2765 | /* Remove the scroll bar represented by SCROLLBAR_ID from the frame F. */ | 2824 | /* Remove the scroll bar represented by SCROLLBAR_ID from the frame F. */ |
| 2825 | |||
| 2766 | void | 2826 | void |
| 2767 | xg_remove_scroll_bar (f, scrollbar_id) | 2827 | xg_remove_scroll_bar (f, scrollbar_id) |
| 2768 | FRAME_PTR f; | 2828 | FRAME_PTR f; |
| @@ -2782,6 +2842,7 @@ xg_remove_scroll_bar (f, scrollbar_id) | |||
| 2782 | in frame F. | 2842 | in frame F. |
| 2783 | TOP/LEFT are the new pixel positions where the bar shall appear. | 2843 | TOP/LEFT are the new pixel positions where the bar shall appear. |
| 2784 | WIDTH, HEIGHT is the size in pixels the bar shall have. */ | 2844 | WIDTH, HEIGHT is the size in pixels the bar shall have. */ |
| 2845 | |||
| 2785 | void | 2846 | void |
| 2786 | xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height) | 2847 | xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height) |
| 2787 | FRAME_PTR f; | 2848 | FRAME_PTR f; |
| @@ -2810,6 +2871,7 @@ xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height) | |||
| 2810 | 2871 | ||
| 2811 | /* Set the thumb size and position of scroll bar BAR. We are currently | 2872 | /* Set the thumb size and position of scroll bar BAR. We are currently |
| 2812 | displaying PORTION out of a whole WHOLE, and our position POSITION. */ | 2873 | displaying PORTION out of a whole WHOLE, and our position POSITION. */ |
| 2874 | |||
| 2813 | void | 2875 | void |
| 2814 | xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) | 2876 | xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) |
| 2815 | struct scroll_bar *bar; | 2877 | struct scroll_bar *bar; |
| @@ -2902,6 +2964,7 @@ xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) | |||
| 2902 | W is the button widget in the tool bar that got pressed, | 2964 | W is the button widget in the tool bar that got pressed, |
| 2903 | CLIENT_DATA is an integer that is the index of the button in the | 2965 | CLIENT_DATA is an integer that is the index of the button in the |
| 2904 | tool bar. 0 is the first button. */ | 2966 | tool bar. 0 is the first button. */ |
| 2967 | |||
| 2905 | static void | 2968 | static void |
| 2906 | xg_tool_bar_callback (w, client_data) | 2969 | xg_tool_bar_callback (w, client_data) |
| 2907 | GtkWidget *w; | 2970 | GtkWidget *w; |
| @@ -2938,6 +3001,7 @@ xg_tool_bar_callback (w, client_data) | |||
| 2938 | WBOX is the handle box widget that enables detach/attach of the tool bar. | 3001 | WBOX is the handle box widget that enables detach/attach of the tool bar. |
| 2939 | W is the tool bar widget. | 3002 | W is the tool bar widget. |
| 2940 | CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ | 3003 | CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ |
| 3004 | |||
| 2941 | static void | 3005 | static void |
| 2942 | xg_tool_bar_detach_callback (wbox, w, client_data) | 3006 | xg_tool_bar_detach_callback (wbox, w, client_data) |
| 2943 | GtkHandleBox *wbox; | 3007 | GtkHandleBox *wbox; |
| @@ -2966,6 +3030,7 @@ xg_tool_bar_detach_callback (wbox, w, client_data) | |||
| 2966 | WBOX is the handle box widget that enables detach/attach of the tool bar. | 3030 | WBOX is the handle box widget that enables detach/attach of the tool bar. |
| 2967 | W is the tool bar widget. | 3031 | W is the tool bar widget. |
| 2968 | CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ | 3032 | CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ |
| 3033 | |||
| 2969 | static void | 3034 | static void |
| 2970 | xg_tool_bar_attach_callback (wbox, w, client_data) | 3035 | xg_tool_bar_attach_callback (wbox, w, client_data) |
| 2971 | GtkHandleBox *wbox; | 3036 | GtkHandleBox *wbox; |
| @@ -2995,6 +3060,7 @@ xg_tool_bar_attach_callback (wbox, w, client_data) | |||
| 2995 | tool bar. 0 is the first button. | 3060 | tool bar. 0 is the first button. |
| 2996 | 3061 | ||
| 2997 | Returns FALSE to tell GTK to keep processing this event. */ | 3062 | Returns FALSE to tell GTK to keep processing this event. */ |
| 3063 | |||
| 2998 | static gboolean | 3064 | static gboolean |
| 2999 | xg_tool_bar_help_callback (w, event, client_data) | 3065 | xg_tool_bar_help_callback (w, event, client_data) |
| 3000 | GtkWidget *w; | 3066 | GtkWidget *w; |
| @@ -3040,6 +3106,7 @@ xg_tool_bar_help_callback (w, event, client_data) | |||
| 3040 | CLIENT_DATA is unused. | 3106 | CLIENT_DATA is unused. |
| 3041 | 3107 | ||
| 3042 | Returns FALSE to tell GTK to keep processing this event. */ | 3108 | Returns FALSE to tell GTK to keep processing this event. */ |
| 3109 | |||
| 3043 | static gboolean | 3110 | static gboolean |
| 3044 | xg_tool_bar_item_expose_callback (w, event, client_data) | 3111 | xg_tool_bar_item_expose_callback (w, event, client_data) |
| 3045 | GtkWidget *w; | 3112 | GtkWidget *w; |
| @@ -3070,6 +3137,7 @@ xg_tool_bar_item_expose_callback (w, event, client_data) | |||
| 3070 | CLIENT_DATA is pointing to the frame for this tool bar. | 3137 | CLIENT_DATA is pointing to the frame for this tool bar. |
| 3071 | 3138 | ||
| 3072 | Returns FALSE to tell GTK to keep processing this event. */ | 3139 | Returns FALSE to tell GTK to keep processing this event. */ |
| 3140 | |||
| 3073 | static gboolean | 3141 | static gboolean |
| 3074 | xg_tool_bar_expose_callback (w, event, client_data) | 3142 | xg_tool_bar_expose_callback (w, event, client_data) |
| 3075 | GtkWidget *w; | 3143 | GtkWidget *w; |
| @@ -3080,6 +3148,8 @@ xg_tool_bar_expose_callback (w, event, client_data) | |||
| 3080 | return FALSE; | 3148 | return FALSE; |
| 3081 | } | 3149 | } |
| 3082 | 3150 | ||
| 3151 | /* Create a tool bar for frame F. */ | ||
| 3152 | |||
| 3083 | static void | 3153 | static void |
| 3084 | xg_create_tool_bar (f) | 3154 | xg_create_tool_bar (f) |
| 3085 | FRAME_PTR f; | 3155 | FRAME_PTR f; |
| @@ -3133,6 +3203,8 @@ xg_create_tool_bar (f) | |||
| 3133 | SET_FRAME_GARBAGED (f); | 3203 | SET_FRAME_GARBAGED (f); |
| 3134 | } | 3204 | } |
| 3135 | 3205 | ||
| 3206 | /* Update the tool bar for frame F. Add new buttons and remove old. */ | ||
| 3207 | |||
| 3136 | void | 3208 | void |
| 3137 | update_frame_tool_bar (f) | 3209 | update_frame_tool_bar (f) |
| 3138 | FRAME_PTR f; | 3210 | FRAME_PTR f; |
| @@ -3300,6 +3372,9 @@ update_frame_tool_bar (f) | |||
| 3300 | UNBLOCK_INPUT; | 3372 | UNBLOCK_INPUT; |
| 3301 | } | 3373 | } |
| 3302 | 3374 | ||
| 3375 | /* Deallocate all resources for the tool bar on frame F. | ||
| 3376 | Remove the tool bar. */ | ||
| 3377 | |||
| 3303 | void | 3378 | void |
| 3304 | free_frame_tool_bar (f) | 3379 | free_frame_tool_bar (f) |
| 3305 | FRAME_PTR f; | 3380 | FRAME_PTR f; |