-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactor]: Add submenu.c for refactor the menu system.
- Loading branch information
Showing
10 changed files
with
235 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#ifndef __SUBMENU_H | ||
#define __SUBMENU_H | ||
|
||
/// a single submenu item | ||
typedef struct submenu_item | ||
{ | ||
/// Icon used for rendering of this item | ||
int icon_id; | ||
|
||
/// item description | ||
char *text; | ||
|
||
/// item description in localized form (used if value is not negative) | ||
int text_id; | ||
|
||
/// item id (MUST BE VALID, we assert it is != -1 to optimize rendering) | ||
int id; | ||
|
||
int *cache_id; | ||
int *cache_uid; | ||
} submenu_item_t; | ||
|
||
typedef struct submenu_list | ||
{ | ||
struct submenu_item item; | ||
|
||
struct submenu_list *prev, *next; | ||
} submenu_list_t; | ||
|
||
void submenuRebuildCache(submenu_list_t *submenu); | ||
submenu_list_t *submenuAppendItem(submenu_list_t **submenu, int icon_id, char *text, int id, int text_id); | ||
void submenuRemoveItem(submenu_list_t **submenu, int id); | ||
void submenuDestroy(submenu_list_t **submenu); | ||
void submenuSort(submenu_list_t **submenu); | ||
|
||
char *submenuItemGetText(submenu_item_t *it); | ||
|
||
void submenuDestroyItem(submenu_list_t *submenu); | ||
|
||
submenu_list_t *submenuAllocItem(int icon_id, char *text, int id, int text_id); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.