2054 |
} |
} |
2055 |
|
|
2056 |
static widget_value * |
static widget_value * |
2057 |
find_first_selectable (mw, item, skip_no_call_data) |
find_first_selectable (mw, item, skip_titles) |
2058 |
XlwMenuWidget mw; |
XlwMenuWidget mw; |
2059 |
widget_value *item; |
widget_value *item; |
2060 |
int skip_no_call_data; |
int skip_titles; |
2061 |
{ |
{ |
2062 |
widget_value *current = item; |
widget_value *current = item; |
2063 |
enum menu_separator separator; |
enum menu_separator separator; |
2064 |
|
|
2065 |
while (lw_separator_p (current->name, &separator, 0) || !current->enabled |
while (lw_separator_p (current->name, &separator, 0) || !current->enabled |
2066 |
|| (skip_no_call_data && !current->call_data)) |
|| (skip_titles && !current->call_data && !current->contents)) |
2067 |
if (current->next) |
if (current->next) |
2068 |
current=current->next; |
current=current->next; |
2069 |
else |
else |
2070 |
return NULL; |
return NULL; |
2071 |
|
|
2072 |
return current; |
return current; |
2073 |
} |
} |
2074 |
|
|
2075 |
static widget_value * |
static widget_value * |
2076 |
find_next_selectable (mw, item, skip_no_call_data) |
find_next_selectable (mw, item, skip_titles) |
2077 |
XlwMenuWidget mw; |
XlwMenuWidget mw; |
2078 |
widget_value *item; |
widget_value *item; |
2079 |
{ |
{ |
2082 |
|
|
2083 |
while (current->next && (current=current->next) && |
while (current->next && (current=current->next) && |
2084 |
(lw_separator_p (current->name, &separator, 0) || !current->enabled |
(lw_separator_p (current->name, &separator, 0) || !current->enabled |
2085 |
|| (skip_no_call_data && !current->call_data))) |
|| (skip_titles && !current->call_data && !current->contents))) |
2086 |
; |
; |
2087 |
|
|
2088 |
if (current == item) |
if (current == item) |
2093 |
|
|
2094 |
while (lw_separator_p (current->name, &separator, 0) |
while (lw_separator_p (current->name, &separator, 0) |
2095 |
|| !current->enabled |
|| !current->enabled |
2096 |
|| (skip_no_call_data && !current->call_data)) |
|| (skip_titles && !current->call_data |
2097 |
|
&& !current->contents)) |
2098 |
{ |
{ |
2099 |
if (current->next) |
if (current->next) |
2100 |
current=current->next; |
current=current->next; |
2109 |
} |
} |
2110 |
|
|
2111 |
static widget_value * |
static widget_value * |
2112 |
find_prev_selectable (mw, item, skip_no_call_data) |
find_prev_selectable (mw, item, skip_titles) |
2113 |
XlwMenuWidget mw; |
XlwMenuWidget mw; |
2114 |
widget_value *item; |
widget_value *item; |
2115 |
{ |
{ |
2116 |
widget_value *current = item; |
widget_value *current = item; |
2117 |
widget_value *prev = item; |
widget_value *prev = item; |
2118 |
|
|
2119 |
while ((current=find_next_selectable (mw, current, skip_no_call_data)) |
while ((current=find_next_selectable (mw, current, skip_titles)) |
2120 |
!= item) |
!= item) |
2121 |
{ |
{ |
2122 |
if (prev == current) |
if (prev == current) |
2142 |
if (mw->menu.old_depth == mw->menu.top_depth) |
if (mw->menu.old_depth == mw->menu.top_depth) |
2143 |
/* When <down> in the menu-bar is pressed, display the corresponding |
/* When <down> in the menu-bar is pressed, display the corresponding |
2144 |
sub-menu and select the first selectable menu item there. |
sub-menu and select the first selectable menu item there. |
2145 |
If this is a popup menu, skip items with zero call data (title of |
If this is a popup menu, skip title item of the popup. */ |
|
the popup). */ |
|
2146 |
set_new_state (mw, |
set_new_state (mw, |
2147 |
find_first_selectable (mw, |
find_first_selectable (mw, |
2148 |
selected_item->contents, |
selected_item->contents, |
2174 |
last selectable item in the list. So we select the first |
last selectable item in the list. So we select the first |
2175 |
selectable one and find the previous selectable item. Is there |
selectable one and find the previous selectable item. Is there |
2176 |
a better way? */ |
a better way? */ |
2177 |
/* If this is a popup menu, skip items with zero call data (title of |
/* If this is a popup menu, skip title item of the popup. */ |
|
the popup). */ |
|
2178 |
set_new_state (mw, |
set_new_state (mw, |
2179 |
find_first_selectable (mw, |
find_first_selectable (mw, |
2180 |
selected_item->contents, |
selected_item->contents, |