mirror of
https://git.planet-casio.com/Lephenixnoir/JustUI.git
synced 2024-12-28 04:23:40 +01:00
jscene: add an option to control main menu manually
This commit is contained in:
parent
32ef1536d7
commit
6464074c12
3 changed files with 17 additions and 6 deletions
|
@ -17,8 +17,6 @@
|
|||
only consists of a scrolling list of names showing a section of a folder's
|
||||
entries.
|
||||
|
||||
TODO: jfileselect: Select a new file to write to
|
||||
|
||||
Events:
|
||||
* JFILESELECT_LOADED when a folder is loaded into the view
|
||||
* JFILESELECT_VALIDATED when a file has been selected
|
||||
|
|
|
@ -31,6 +31,8 @@ typedef struct {
|
|||
|
||||
/* Number of events lots */
|
||||
uint16_t lost_events;
|
||||
/* Whether jscene_run() returns to the main menu */
|
||||
bool mainmenu;
|
||||
|
||||
} jscene;
|
||||
|
||||
|
@ -103,6 +105,10 @@ bool jscene_process_key_event(jscene *scene, key_event_t event);
|
|||
Returns true if the event was accepted along the way, false if ignored. */
|
||||
bool jscene_process_event(jscene *scene, jevent event);
|
||||
|
||||
/* jscene_set_mainmenu(): Set whether jscene_run() will return to main menu
|
||||
Disabling this is useful if you want to catch the MENU key or clean up
|
||||
resources before invoking the main menu. */
|
||||
void jscene_set_mainmenu(jscene *scene, bool mainmenu);
|
||||
|
||||
/* jscene_run(): Run a scene's main loop
|
||||
|
||||
|
|
15
src/jscene.c
15
src/jscene.c
|
@ -52,6 +52,7 @@ jscene *jscene_create(int x, int y, int w, int h, void *parent)
|
|||
s->queue_first = 0;
|
||||
s->queue_next = 0;
|
||||
s->lost_events = 0;
|
||||
s->mainmenu = true;
|
||||
|
||||
/* Prepare first layout/paint operation */
|
||||
s->widget.dirty = 1;
|
||||
|
@ -192,7 +193,11 @@ bool jscene_process_event(GUNUSED jscene *scene, jevent event)
|
|||
return false;
|
||||
}
|
||||
|
||||
/* jscene_run(): Run a scene's main loop */
|
||||
void jscene_set_mainmenu(jscene *scene, bool mainmenu)
|
||||
{
|
||||
scene->mainmenu = mainmenu;
|
||||
}
|
||||
|
||||
jevent jscene_run(jscene *s)
|
||||
{
|
||||
keydev_t *d = keydev_std();
|
||||
|
@ -214,9 +219,11 @@ jevent jscene_run(jscene *s)
|
|||
key_event_t k = keydev_read(d);
|
||||
|
||||
if(k.type == KEYEV_DOWN && k.key == KEY_MENU && !k.shift && !k.alpha) {
|
||||
gint_osmenu();
|
||||
jscene_queue_event(s, (jevent){ .type = JSCENE_PAINT });
|
||||
continue;
|
||||
if(s->mainmenu) {
|
||||
gint_osmenu();
|
||||
jscene_queue_event(s, (jevent){ .type = JSCENE_PAINT });
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#ifdef FX9860G
|
||||
if(k.type == KEYEV_DOWN && k.key == KEY_OPTN && k.shift && !k.alpha) {
|
||||
|
|
Loading…
Reference in a new issue