comparison lwlib/xlwmenu.c @ 90043:e24e2e78deda

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-69 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-643 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-649 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-650 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-651 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-655 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-656 Update from CVS: lisp/man.el (Man-xref-normal-file): Fix help-echo. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-657 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-658 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-659 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-660 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-661 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-667 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-668 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-61 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-68 Update from CVS
author Miles Bader <miles@gnu.org>
date Thu, 04 Nov 2004 08:55:40 +0000
parents 68c22ea6027c 2c65a9fc7dec
children 95879cc1ed20
comparison
equal deleted inserted replaced
90042:003d95404d71 90043:e24e2e78deda
2052 Cardinal *num_params; 2052 Cardinal *num_params;
2053 { 2053 {
2054 } 2054 }
2055 2055
2056 static widget_value * 2056 static widget_value *
2057 find_first_selectable (mw, item, skip_no_call_data) 2057 find_first_selectable (mw, item, skip_titles)
2058 XlwMenuWidget mw; 2058 XlwMenuWidget mw;
2059 widget_value *item; 2059 widget_value *item;
2060 int skip_no_call_data; 2060 int skip_titles;
2061 { 2061 {
2062 widget_value *current = item; 2062 widget_value *current = item;
2063 enum menu_separator separator; 2063 enum menu_separator separator;
2064 2064
2065 while (lw_separator_p (current->name, &separator, 0) || !current->enabled 2065 while (lw_separator_p (current->name, &separator, 0) || !current->enabled
2066 || (skip_no_call_data && !current->call_data)) 2066 || (skip_titles && !current->call_data && !current->contents))
2067 if (current->next) 2067 if (current->next)
2068 current=current->next; 2068 current=current->next;
2069 else 2069 else
2070 return NULL; 2070 return NULL;
2071 2071
2072 return current; 2072 return current;
2073 } 2073 }
2074 2074
2075 static widget_value * 2075 static widget_value *
2076 find_next_selectable (mw, item, skip_no_call_data) 2076 find_next_selectable (mw, item, skip_titles)
2077 XlwMenuWidget mw; 2077 XlwMenuWidget mw;
2078 widget_value *item; 2078 widget_value *item;
2079 { 2079 {
2080 widget_value *current = item; 2080 widget_value *current = item;
2081 enum menu_separator separator; 2081 enum menu_separator separator;
2082 2082
2083 while (current->next && (current=current->next) && 2083 while (current->next && (current=current->next) &&
2084 (lw_separator_p (current->name, &separator, 0) || !current->enabled 2084 (lw_separator_p (current->name, &separator, 0) || !current->enabled
2085 || (skip_no_call_data && !current->call_data))) 2085 || (skip_titles && !current->call_data && !current->contents)))
2086 ; 2086 ;
2087 2087
2088 if (current == item) 2088 if (current == item)
2089 { 2089 {
2090 if (mw->menu.old_depth < 2) 2090 if (mw->menu.old_depth < 2)
2091 return current; 2091 return current;
2092 current = mw->menu.old_stack [mw->menu.old_depth - 2]->contents; 2092 current = mw->menu.old_stack [mw->menu.old_depth - 2]->contents;
2093 2093
2094 while (lw_separator_p (current->name, &separator, 0) 2094 while (lw_separator_p (current->name, &separator, 0)
2095 || !current->enabled 2095 || !current->enabled
2096 || (skip_no_call_data && !current->call_data)) 2096 || (skip_titles && !current->call_data
2097 && !current->contents))
2097 { 2098 {
2098 if (current->next) 2099 if (current->next)
2099 current=current->next; 2100 current=current->next;
2100 2101
2101 if (current == item) 2102 if (current == item)
2106 2107
2107 return current; 2108 return current;
2108 } 2109 }
2109 2110
2110 static widget_value * 2111 static widget_value *
2111 find_prev_selectable (mw, item, skip_no_call_data) 2112 find_prev_selectable (mw, item, skip_titles)
2112 XlwMenuWidget mw; 2113 XlwMenuWidget mw;
2113 widget_value *item; 2114 widget_value *item;
2114 { 2115 {
2115 widget_value *current = item; 2116 widget_value *current = item;
2116 widget_value *prev = item; 2117 widget_value *prev = item;
2117 2118
2118 while ((current=find_next_selectable (mw, current, skip_no_call_data)) 2119 while ((current=find_next_selectable (mw, current, skip_titles))
2119 != item) 2120 != item)
2120 { 2121 {
2121 if (prev == current) 2122 if (prev == current)
2122 break; 2123 break;
2123 prev=current; 2124 prev=current;
2139 2140
2140 /* Inside top-level menu-bar? */ 2141 /* Inside top-level menu-bar? */
2141 if (mw->menu.old_depth == mw->menu.top_depth) 2142 if (mw->menu.old_depth == mw->menu.top_depth)
2142 /* When <down> in the menu-bar is pressed, display the corresponding 2143 /* When <down> in the menu-bar is pressed, display the corresponding
2143 sub-menu and select the first selectable menu item there. 2144 sub-menu and select the first selectable menu item there.
2144 If this is a popup menu, skip items with zero call data (title of 2145 If this is a popup menu, skip title item of the popup. */
2145 the popup). */
2146 set_new_state (mw, 2146 set_new_state (mw,
2147 find_first_selectable (mw, 2147 find_first_selectable (mw,
2148 selected_item->contents, 2148 selected_item->contents,
2149 popup_menu_p), 2149 popup_menu_p),
2150 mw->menu.old_depth); 2150 mw->menu.old_depth);
2172 { 2172 {
2173 /* FIXME: this is tricky. <up> in the menu-bar should select the 2173 /* FIXME: this is tricky. <up> in the menu-bar should select the
2174 last selectable item in the list. So we select the first 2174 last selectable item in the list. So we select the first
2175 selectable one and find the previous selectable item. Is there 2175 selectable one and find the previous selectable item. Is there
2176 a better way? */ 2176 a better way? */
2177 /* If this is a popup menu, skip items with zero call data (title of 2177 /* If this is a popup menu, skip title item of the popup. */
2178 the popup). */
2179 set_new_state (mw, 2178 set_new_state (mw,
2180 find_first_selectable (mw, 2179 find_first_selectable (mw,
2181 selected_item->contents, 2180 selected_item->contents,
2182 popup_menu_p), 2181 popup_menu_p),
2183 mw->menu.old_depth); 2182 mw->menu.old_depth);