diff --git a/include/justui/jfkeys.h b/include/justui/jfkeys.h index 4a72e7b..a8b88fe 100644 --- a/include/justui/jfkeys.h +++ b/include/justui/jfkeys.h @@ -17,7 +17,7 @@ * MENU KEYS are used for functions that open menus or navigate between tabs on a same application. The name comes from their primary usage in the - system apps. Navigation functions should be easilty reversible and fairly + system apps. Navigation functions should be easily reversible and fairly failproof. Menu keys are black rectangular keys with a chipped corner. * ENTRY KEYS are used for catalog entries such as the leaves of PRGM's many @@ -29,8 +29,8 @@ * SPECIAL KEYS are used for special functions, such as scrolling to the next set of functions keys when there are several pages, important functions - that should catch attention, or particulary unsafe actions. They are round - white keys. + that should catch attention, or particularly unsafe actions. They are + round white keys. On fx-CG 50, the keys are drawn dynamically using gint's default font, and specified using 6 strings that give the type and name of the keys: @@ -40,10 +40,10 @@ * "@NAME" for an action key; " "#NAME" for a special key. - The names are separated by semicolons, eg "/F1;;/F3;.F4;@F5;#F6". Several + The names are separated by semicolons, eg. "/F1;;/F3;.F4;@F5;#F6". Several sets of function keys can be defined if separated by a '|' character. For instance, "/F1;#F2|/F1" represents a function bar where the F2 - function can be hidden by swithing from level 0 to level 1. + function can be hidden by switching from level 0 to level 1. On fx-9860G, there is not enough space to generate keys on-the-fly, so the full specification is just an image. The convention for the image is to be diff --git a/include/justui/jscene.h b/include/justui/jscene.h index 4622d3b..bfb979b 100644 --- a/include/justui/jscene.h +++ b/include/justui/jscene.h @@ -46,6 +46,11 @@ jscene *jscene_create(int x, int y, int w, int h, void *parent); The position is (0,0) and the size is (DWIDTH,DHEIGHT). */ jscene *jscene_create_fullscreen(void *parent); +/* jscene_owning(): Find the scene that manages a widget (if any) + This functions walks up the widget tree and locates the scene owning the + specified widget, if there is one; otherwise returns NULL. */ +jscene *jscene_owning(void *widget); + /* jscene_layout(): Layout a scene This is automatically called by jscene_render(), but may be useful if you need to know the size of your widgets before rendering. The layout is diff --git a/src/jscene.c b/src/jscene.c index 41e78ea..275bff0 100644 --- a/src/jscene.c +++ b/src/jscene.c @@ -64,6 +64,17 @@ jscene *jscene_create_fullscreen(void *parent) return jscene_create(0, 0, DWIDTH, DHEIGHT, parent); } +jscene *jscene_owning(void *w0) +{ + J_CAST(w) + + while(w) { + if(w->type == jscene_type_id) return (void *)w; + w = w->parent; + } + return NULL; +} + void jscene_render(jscene *scene) { jwidget_layout(scene);