Foenix A2650 OS/f Library
 
Loading...
Searching...
No Matches
menu.h File Reference
#include "a2560k.h"
#include "event.h"

Go to the source code of this file.

Data Structures

struct  MenuItem
 
struct  MenuGroup
 
struct  Menu
 

Functions

MenuMenu_New (void)
 Creates a new Menu object, allocating space from the heap return Returns a complete Menu object with bitmap allocation, and all properties set to default. More...
 
void Menu_Destroy (Menu **the_menu)
 
void Menu_Render (Menu *the_menu)
 Renders the menu and blits entire menu or required cliprects to the screen. More...
 
void Menu_Open (Menu *the_menu, MenuGroup *the_menu_group, int16_t x, int16_t y)
 Replaces current menu_group_ reference with a new one, calculates widths, rects, and renders the menu at an appropriate place based on x, y passed and size of menu NOTE: this sets mouse mode to mouseMenuOpen. More...
 
void Menu_CancelOpen (Menu *the_menu)
 Cancels the opening of a menu before it is shown NOTE: this sets mouse mode back to mouseFree. More...
 
void Menu_Hide (Menu *the_menu)
 Hides the menu by damaging and distributing damage rects to all other windows, and re-rendering screen. More...
 
void Menu_SetVisible (Menu *the_menu, bool is_visible)
 Set the menu's visibility flag. More...
 
int16_t Menu_AcceptClick (Menu *the_menu, int16_t x, int16_t y)
 Accept a right or left mouse click while a menu is open, identify which, if any, menu item should be selected as a result. More...
 
void Menu_AcceptMouseMove (Menu *the_menu, int16_t x, int16_t y)
 Accept a new mouse x/y while a menu is open, identify which, if any, menu item should be shown as selected. More...
 
bool Menu_SetFont (Menu *the_menu, Font *the_font)
 Set the font used for drawing menu text This also sets the font of the menu's bitmap. More...
 

Function Documentation

◆ Menu_AcceptClick()

int16_t Menu_AcceptClick ( Menu the_menu,
int16_t  x,
int16_t  y 
)

Accept a right or left mouse click while a menu is open, identify which, if any, menu item should be selected as a result.

Parameters
the_menu– reference to a valid Menu object.
x– Global horizontal coordinate when the mouse was clicked
y– Global vertical coordinate when the mouse was clicked
Returns
Returns MENU_ID_NO_SELECTION if no menu item was under the mouse. Returns ID of menu item if one was selected.

◆ Menu_AcceptMouseMove()

void Menu_AcceptMouseMove ( Menu the_menu,
int16_t  x,
int16_t  y 
)

Accept a new mouse x/y while a menu is open, identify which, if any, menu item should be shown as selected.

Parameters
the_menu– reference to a valid Menu object.
x– Global horizontal coordinate of current mouse loc
y– Global vertical coordinate of current mouse loc

◆ Menu_CancelOpen()

void Menu_CancelOpen ( Menu the_menu)

Cancels the opening of a menu before it is shown NOTE: this sets mouse mode back to mouseFree.

Parameters
the_menu– reference to a valid Menu object.

◆ Menu_Destroy()

void Menu_Destroy ( Menu **  the_menu)
Parameters
the_menu– pointer to the pointer for the Menu object to be destroyed

◆ Menu_Hide()

void Menu_Hide ( Menu the_menu)

Hides the menu by damaging and distributing damage rects to all other windows, and re-rendering screen.

Parameters
the_menu– reference to a valid Menu object.

◆ Menu_New()

Menu * Menu_New ( void  )

Creates a new Menu object, allocating space from the heap return Returns a complete Menu object with bitmap allocation, and all properties set to default.

Returns NULL on any error.

◆ Menu_Open()

void Menu_Open ( Menu the_menu,
MenuGroup the_menu_group,
int16_t  x,
int16_t  y 
)

Replaces current menu_group_ reference with a new one, calculates widths, rects, and renders the menu at an appropriate place based on x, y passed and size of menu NOTE: this sets mouse mode to mouseMenuOpen.

Parameters
the_menu– reference to a valid Menu object.
the_menu_group– reference to a valid MenuGroup object. The menu will be assigned to this group.
x– Global horizontal coordinate when the mouse was clicked
y– Global vertical coordinate when the mouse was clicked

◆ Menu_Render()

void Menu_Render ( Menu the_menu)

Renders the menu and blits entire menu or required cliprects to the screen.

Parameters
the_menu– reference to a valid Menu object.

◆ Menu_SetFont()

bool Menu_SetFont ( Menu the_menu,
Font the_font 
)

Set the font used for drawing menu text This also sets the font of the menu's bitmap.

Parameters
the_menu– reference to a valid Menu object.
the_font– reference to a complete, loaded Font object.
Returns
Returns false on any error condition

◆ Menu_SetVisible()

void Menu_SetVisible ( Menu the_menu,
bool  is_visible 
)

Set the menu's visibility flag.

This does not immediately cause the menu to render. The menu will be rendered on the next rendering pass.

Parameters
the_menu– reference to a valid Menu object.
is_visible– if true, the menu will no longer be rendered on subsequent render passes. If false, the menu will be rendered on the next rendering pass.