al_toggle_menu_item_flags(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’… al_toggle_menu_item_flags β€” the Allegro 5 API page, bestie edition πŸŽ€

okay so this is a page from the Allegro reference manual (that's the 3alleg5 manual, iykyk) and we're talking about one little function that flips menu item flags like a light switch. sit down, get comfy, we're doing this πŸ’–


✨ NAME ✨

al_toggle_menu_item_flags β€” Allegro 5 API


🌸 SYNOPSIS 🌸

#include <allegro5/allegro_native_dialog.h>

int al_toggle_menu_item_flags(ALLEGRO_MENU *menu, int pos, int flags)

πŸ¦‹ DESCRIPTION πŸ¦‹

So basically, this function toggles the specified menu item's flags. Flip flip flip πŸ’…

Wanna know what flags even exist to toggle? Go read al_insert_menu_item(3alleg5) β€” that's where all the available flags get described. not me sending you on a lil side quest but it's necessary fr fr.

Now here's the part you need to clock: it returns a bitfield of only the specified flags that are set after the toggle. Read that again, bestie. If you didn't toggle a flag, it will not be returned, even if it happens to be set. The return value is not "all the flags that are set," it's "the ones you named, and only the ones that ended up set after the flip." the way that's so specific of it 😭

And if the id is invalid, it returns -1. that's your little "nope, didn't work" signal 🚩


πŸ‘‘ SINCE πŸ‘‘

5.1.0

[Unstable API]: Redundant with al_get/set_menu_item_flags.

like... yeah. it's giving "we have getters and setters at home." but it's here, it exists, and it's marked unstable, so don't build your whole personality on it, okay? πŸ’€


πŸ’œ SEE ALSO πŸ’œ


that's the whole page, gorgeous 🫢 it lives in the Allegro reference manual under the name al_toggle_menu_item_flags(3alleg5), and yes the footer says the same thing because manpages love to repeat themselves. go toggle some flags, you absolute icon β­πŸŒˆπŸŽ€

πŸ“¦ where this page comes from