Mercurial > emacs
comparison src/xmenu.c @ 36933:01f8906fa0fd
Include widget.h.
(single_submenu): Return int. Some cleanup.
(set_frame_menubar): Call x_set_menu_resources_from_menu_face.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Thu, 22 Mar 2001 13:33:32 +0000 |
parents | a3c8e30deddd |
children | 010e601743d5 |
comparison
equal
deleted
inserted
replaced
36932:798523f71b16 | 36933:01f8906fa0fd |
---|---|
42 #include "keyboard.h" | 42 #include "keyboard.h" |
43 #include "frame.h" | 43 #include "frame.h" |
44 #include "window.h" | 44 #include "window.h" |
45 #include "blockinput.h" | 45 #include "blockinput.h" |
46 #include "buffer.h" | 46 #include "buffer.h" |
47 #include "widget.h" | |
47 | 48 |
48 #ifdef MSDOS | 49 #ifdef MSDOS |
49 #include "msdos.h" | 50 #include "msdos.h" |
50 #endif | 51 #endif |
51 | 52 |
121 #endif | 122 #endif |
122 | 123 |
123 static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, | 124 static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
124 Lisp_Object, Lisp_Object, Lisp_Object, | 125 Lisp_Object, Lisp_Object, Lisp_Object, |
125 Lisp_Object, Lisp_Object)); | 126 Lisp_Object, Lisp_Object)); |
126 static Lisp_Object xmenu_show (); | 127 static int update_frame_menubar P_ ((struct frame *)); |
127 static void keymap_panes (); | 128 static Lisp_Object xmenu_show P_ ((struct frame *, int, int, int, int, |
128 static void single_keymap_panes (); | 129 Lisp_Object, char **)); |
129 static void single_menu_item (); | 130 static void keymap_panes P_ ((Lisp_Object *, int, int)); |
130 static void list_of_panes (); | 131 static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
131 static void list_of_items (); | 132 int, int)); |
133 static void single_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object *, | |
134 int, int, int *)); | |
135 static void list_of_panes P_ ((Lisp_Object)); | |
136 static void list_of_items P_ ((Lisp_Object)); | |
132 | 137 |
133 /* This holds a Lisp vector that holds the results of decoding | 138 /* This holds a Lisp vector that holds the results of decoding |
134 the keymaps or alist-of-alists that specify a menu. | 139 the keymaps or alist-of-alists that specify a menu. |
135 | 140 |
136 It describes the panes and items within the panes. | 141 It describes the panes and items within the panes. |
1537 return wv; | 1542 return wv; |
1538 } | 1543 } |
1539 | 1544 |
1540 return first_wv; | 1545 return first_wv; |
1541 } | 1546 } |
1547 | |
1548 | |
1542 | 1549 |
1543 extern void EmacsFrameSetCharSize (); | 1550 /* Recompute all the widgets of frame F, when the menu bar has been |
1544 | 1551 changed. Value is non-zero if widgets were updated. */ |
1545 /* Recompute all the widgets of frame F, when the menu bar | 1552 |
1546 has been changed. */ | 1553 static int |
1547 | |
1548 static void | |
1549 update_frame_menubar (f) | 1554 update_frame_menubar (f) |
1550 FRAME_PTR f; | 1555 FRAME_PTR f; |
1551 { | 1556 { |
1552 struct x_output *x = f->output_data.x; | 1557 struct x_output *x = f->output_data.x; |
1553 int columns, rows; | 1558 int columns, rows; |
1554 int menubar_changed; | |
1555 | 1559 |
1556 /* We assume the menubar contents has changed if the global flag is set, | 1560 if (!x->menubar_widget || XtIsManaged (x->menubar_widget)) |
1557 or if the current buffer has changed, or if the menubar has never | 1561 return 0; |
1558 been updated before. | |
1559 */ | |
1560 menubar_changed = (x->menubar_widget | |
1561 && !XtIsManaged (x->menubar_widget)); | |
1562 | |
1563 if (! (menubar_changed)) | |
1564 return; | |
1565 | 1562 |
1566 BLOCK_INPUT; | 1563 BLOCK_INPUT; |
1567 /* Save the size of the frame because the pane widget doesn't accept to | 1564 /* Save the size of the frame because the pane widget doesn't accept |
1568 resize itself. So force it. */ | 1565 to resize itself. So force it. */ |
1569 columns = f->width; | 1566 columns = f->width; |
1570 rows = f->height; | 1567 rows = f->height; |
1571 | 1568 |
1572 /* Do the voodoo which means "I'm changing lots of things, don't try to | 1569 /* Do the voodoo which means "I'm changing lots of things, don't try |
1573 refigure sizes until I'm done." */ | 1570 to refigure sizes until I'm done." */ |
1574 lw_refigure_widget (x->column_widget, False); | 1571 lw_refigure_widget (x->column_widget, False); |
1575 | 1572 |
1576 /* the order in which children are managed is the top to | 1573 /* The order in which children are managed is the top to bottom |
1577 bottom order in which they are displayed in the paned window. | 1574 order in which they are displayed in the paned window. First, |
1578 First, remove the text-area widget. | 1575 remove the text-area widget. */ |
1579 */ | |
1580 XtUnmanageChild (x->edit_widget); | 1576 XtUnmanageChild (x->edit_widget); |
1581 | 1577 |
1582 /* remove the menubar that is there now, and put up the menubar that | 1578 /* Remove the menubar that is there now, and put up the menubar that |
1583 should be there. | 1579 should be there. */ |
1584 */ | 1580 XtManageChild (x->menubar_widget); |
1585 if (menubar_changed) | 1581 XtMapWidget (x->menubar_widget); |
1586 { | 1582 XtVaSetValues (x->menubar_widget, XtNmappedWhenManaged, 1, NULL); |
1587 XtManageChild (x->menubar_widget); | |
1588 XtMapWidget (x->menubar_widget); | |
1589 XtVaSetValues (x->menubar_widget, XtNmappedWhenManaged, 1, NULL); | |
1590 } | |
1591 | 1583 |
1592 /* Re-manage the text-area widget, and then thrash the sizes. */ | 1584 /* Re-manage the text-area widget, and then thrash the sizes. */ |
1593 XtManageChild (x->edit_widget); | 1585 XtManageChild (x->edit_widget); |
1594 x_set_menu_resources_from_menu_face (f, x->menubar_widget); | 1586 x_set_menu_resources_from_menu_face (f, x->menubar_widget); |
1595 lw_refigure_widget (x->column_widget, True); | 1587 lw_refigure_widget (x->column_widget, True); |
1596 | 1588 |
1597 /* Force the pane widget to resize itself with the right values. */ | 1589 /* Force the pane widget to resize itself with the right values. */ |
1598 EmacsFrameSetCharSize (x->edit_widget, columns, rows); | 1590 EmacsFrameSetCharSize (x->edit_widget, columns, rows); |
1599 UNBLOCK_INPUT; | 1591 UNBLOCK_INPUT; |
1592 return 1; | |
1600 } | 1593 } |
1601 | 1594 |
1602 /* Set the contents of the menubar widgets of frame F. | 1595 /* Set the contents of the menubar widgets of frame F. |
1603 The argument FIRST_TIME is currently ignored; | 1596 The argument FIRST_TIME is currently ignored; |
1604 it is set the first time this is called, from initialize_frame_menubar. */ | 1597 it is set the first time this is called, from initialize_frame_menubar. */ |
1840 | 1833 |
1841 f->output_data.x->menubar_height = menubar_size; | 1834 f->output_data.x->menubar_height = menubar_size; |
1842 } | 1835 } |
1843 | 1836 |
1844 free_menubar_widget_value_tree (first_wv); | 1837 free_menubar_widget_value_tree (first_wv); |
1845 update_frame_menubar (f); | 1838 if (!update_frame_menubar (f)) |
1839 x_set_menu_resources_from_menu_face (f, menubar_widget); | |
1846 | 1840 |
1847 UNBLOCK_INPUT; | 1841 UNBLOCK_INPUT; |
1848 } | 1842 } |
1849 | 1843 |
1850 /* Called from Fx_create_frame to create the initial menubar of a frame | 1844 /* Called from Fx_create_frame to create the initial menubar of a frame |