summaryrefslogtreecommitdiff
path: root/guifs.h
diff options
context:
space:
mode:
authorPeter Mikkelsen <petermikkelsen10@gmail.com>2024-02-16 23:26:32 +0000
committerPeter Mikkelsen <petermikkelsen10@gmail.com>2024-02-16 23:26:32 +0000
commitc51962a648b3f38fc378ad0081b1d1aa037142d5 (patch)
tree4cf448275064f7ddbd0ac2a429d9fe5449755102 /guifs.h
parentab90a480eb5233abc4d7122739c24656dd42cc94 (diff)
Implement mouse menus
Setup a menu/some menus by writing to an elements props/menus file
Diffstat (limited to 'guifs.h')
-rw-r--r--guifs.h19
1 files changed, 18 insertions, 1 deletions
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);