Accessor for the select menu control pointer

This commit is contained in:
Chris Young 2019-05-08 00:16:06 +01:00
parent ca1a519cfa
commit 4713e1c8af
3 changed files with 30 additions and 2 deletions

View File

@ -389,6 +389,24 @@ void ami_gui2_set_menu(struct gui_window_2 *gwin, struct Menu *menu)
}
}
struct form_control *ami_gui_get_control(struct gui_window *gw)
{
/* TODO: does this need to be in the shared window? */
assert(gw != NULL);
return gw->shared->control;
}
/**
* Set control (for select menu) to gui_window
*/
void ami_gui_set_control(struct gui_window *gw, struct form_control *control)
{
/* TODO: does this need to be in the shared window? */
assert(gw != NULL);
gw->shared->control = control;
}
STRPTR ami_locale_langs(int *codeset)
{
struct Locale *locale;

View File

@ -338,5 +338,15 @@ struct Menu *ami_gui_get_menu(struct gui_window *gw);
*/
void ami_gui2_set_menu(struct gui_window_2 *gwin, struct Menu *menu);
/**
* Get control (for select menu) from gui_window
*/
struct form_control *ami_gui_get_control(struct gui_window *gw);
/**
* Set control (for select menu) to gui_window
*/
void ami_gui_set_control(struct gui_window *gw, struct form_control *control);
#endif

View File

@ -74,7 +74,7 @@ HOOKF(uint32, ami_popup_hook, Object *, item, APTR)
struct gui_window *gwin = hook->h_Data;
if(GetAttr(PMIA_ID, item, &itemid)) {
form_select_process_selection(ami_gui_get_gui_window_2(gwin)->control, itemid);
form_select_process_selection(ami_gui_get_control(gwin), itemid);
}
return itemid;
@ -111,7 +111,7 @@ void gui_create_form_select_menu(struct gui_window *g,
selectmenuhook.h_SubEntry = NULL;
selectmenuhook.h_Data = g;
ami_gui_get_gui_window_2(g)->control = control;
ami_gui_set_control(g, control);
selectmenuobj = PMMENU(form_control_get_name(control)),
PMA_MenuHandler, &selectmenuhook, End;