From c51962a648b3f38fc378ad0081b1d1aa037142d5 Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Fri, 16 Feb 2024 23:26:32 +0000 Subject: Implement mouse menus Setup a menu/some menus by writing to an elements props/menus file --- guifs.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'guifs.h') diff --git a/guifs.h b/guifs.h index 1121c3c..d66c58d 100644 --- a/guifs.h +++ b/guifs.h @@ -7,11 +7,12 @@ enum { Pbordercolour, Ptext, Ptextcolour, + Pmenus, Pmax, }; enum { - nbaseprops = 5 + nbaseprops = 6 }; enum { @@ -32,12 +33,14 @@ enum { Xmouseup, Xmouseclick, Xmousescroll, + Xmenuhit, Xkeyboard, Xmax, }; typedef struct Colour Colour; typedef struct Spacing Spacing; +typedef struct MenuSpec MenuSpec; typedef union PropVal PropVal; typedef struct PropSpec PropSpec; typedef struct Prop Prop; @@ -57,9 +60,15 @@ struct Spacing { int left; }; +struct MenuSpec { + char seps[3]; + Menu *menus[3]; +}; + union PropVal { Colour *colour; Spacing *spacing; + MenuSpec *menus; int orientation; Rune *text; }; @@ -80,9 +89,15 @@ struct Prop { struct Event { int type; union { + int i; Mouse m; Rune r; int direction; + struct { + char button; + int which; + char *text; + } hit; }; }; @@ -130,8 +145,10 @@ extern GuiElement *root; extern PropSpec propspecs[Pmax]; extern GuiSpec guispecs[Gmax]; extern int baseprops[nbaseprops]; +extern Mousectl *mousectl; void *emalloc(ulong); +void *erealloc(void *, ulong); int allspace(char *); Colour *mkcolour(ulong); -- cgit v1.2.3