[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Wed, Jun 29, 2011 at 4:49 PM, Jon Rafkind <workmin@xxxxxxxxxx> wrote:
> Implementation question: if you remove a menu do the existing indicies
> remain valid?
>
No. But it would be safe to do something like:
al_set_menu_item_flags(menu, al_get_menu_index_by_id(menu, MY_ID), 0);
But generally speaking, you should know what the index is (because you
created the menu). So for simple things, you could just hardcode the
index if you prefer.
I could make it work something like:
#define ALLEGRO_MENU_ID (1 << 31)
al_remove_menu_item(menu, index);
al_remove_menu_item(menu, id | ALLEGRO_MENU_ID);
Or IDs could simply be a required parameter, and then you never work
with indexes.
But it's really a rather simple implementation detail that is easy to
adjust whenever.
> And what exactly are the semantics of insert_item?
>
Insert before that indexed item.
--
Matthew Leverton