summaryrefslogtreecommitdiff
path: root/src/ui/widget.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/widget.h')
-rw-r--r--src/ui/widget.h79
1 files changed, 38 insertions, 41 deletions
diff --git a/src/ui/widget.h b/src/ui/widget.h
index 34e46c0b..a2be30e9 100644
--- a/src/ui/widget.h
+++ b/src/ui/widget.h
@@ -44,47 +44,46 @@ iBeginDeclareClass(Widget)
44iEndDeclareClass(Widget) 44iEndDeclareClass(Widget)
45 45
46enum iWidgetFlag { 46enum iWidgetFlag {
47 hidden_WidgetFlag = iBit(1), 47 hidden_WidgetFlag = iBit(1),
48 disabled_WidgetFlag = iBit(2), 48 disabled_WidgetFlag = iBit(2),
49 hover_WidgetFlag = iBit(3), /* eligible for mouse hover */ 49 hover_WidgetFlag = iBit(3), /* eligible for mouse hover */
50 selected_WidgetFlag = iBit(4), 50 selected_WidgetFlag = iBit(4),
51 pressed_WidgetFlag = iBit(5), 51 pressed_WidgetFlag = iBit(5),
52 alignLeft_WidgetFlag = iBit(6), 52 alignLeft_WidgetFlag = iBit(6),
53 alignRight_WidgetFlag = iBit(7), 53 alignRight_WidgetFlag = iBit(7),
54 frameless_WidgetFlag = iBit(8), 54 frameless_WidgetFlag = iBit(8),
55 commandOnClick_WidgetFlag = iBit(9), 55 commandOnClick_WidgetFlag = iBit(9),
56 drawKey_WidgetFlag = iBit(10), 56 commandOnMouseMiss_WidgetFlag = iBit(10),
57 focusable_WidgetFlag = iBit(11), 57 drawKey_WidgetFlag = iBit(11),
58 tight_WidgetFlag = iBit(12), /* smaller padding */ 58 focusable_WidgetFlag = iBit(12),
59 keepOnTop_WidgetFlag = iBit(13), /* gets events first; drawn last */ 59 tight_WidgetFlag = iBit(13), /* smaller padding */
60 mouseModal_WidgetFlag = iBit(14), /* eats all unprocessed mouse events */ 60 keepOnTop_WidgetFlag = iBit(14), /* gets events first; drawn last */
61 commandOnMouseMiss_WidgetFlag = iBit(15), 61 mouseModal_WidgetFlag = iBit(15), /* eats all unprocessed mouse events */
62 /* arrange behavior */ 62 /* arrangement */
63 fixedPosition_WidgetFlag = iBit(16), 63 fixedPosition_WidgetFlag = iBit(17),
64 arrangeHorizontal_WidgetFlag = iBit(17), /* arrange children horizontally */ 64 arrangeHorizontal_WidgetFlag = iBit(18), /* arrange children horizontally */
65 arrangeVertical_WidgetFlag = iBit(18), /* arrange children vertically */ 65 arrangeVertical_WidgetFlag = iBit(19), /* arrange children vertically */
66 arrangeWidth_WidgetFlag = iBit(19), /* area of children becomes parent size */ 66 arrangeWidth_WidgetFlag = iBit(20), /* area of children becomes parent size */
67 arrangeHeight_WidgetFlag = iBit(20), /* area of children becomes parent size */ 67 arrangeHeight_WidgetFlag = iBit(21), /* area of children becomes parent size */
68 resizeWidthOfChildren_WidgetFlag = iBit(21), 68 resizeWidthOfChildren_WidgetFlag = iBit(22),
69 resizeHeightOfChildren_WidgetFlag = iBit(22), 69 resizeHeightOfChildren_WidgetFlag = iBit(23),
70 expand_WidgetFlag = iBit(23), 70 expand_WidgetFlag = iBit(24),
71 fixedWidth_WidgetFlag = iBit(24), 71 fixedWidth_WidgetFlag = iBit(25),
72 fixedHeight_WidgetFlag = iBit(25), 72 fixedHeight_WidgetFlag = iBit(26),
73 resizeChildrenToWidestChild_WidgetFlag = iBit(26), 73 resizeChildrenToWidestChild_WidgetFlag = iBit(27),
74 resizeToParentWidth_WidgetFlag = iBit(27), 74 resizeToParentWidth_WidgetFlag = iBit(28),
75 resizeToParentHeight_WidgetFlag = iBit(28), 75 resizeToParentHeight_WidgetFlag = iBit(29),
76 moveToParentRightEdge_WidgetFlag = iBit(29), 76 collapse_WidgetFlag = iBit(30), /* if hidden, arrange size to zero */
77 collapse_WidgetFlag = iBit(30), /* when hidden, arrange size to zero */
78 wasCollapsed_WidgetFlag = iBit(31),
79 /* combinations */ 77 /* combinations */
80 arrangeSize_WidgetFlag = arrangeWidth_WidgetFlag | arrangeHeight_WidgetFlag, 78 arrangeSize_WidgetFlag = arrangeWidth_WidgetFlag | arrangeHeight_WidgetFlag,
81 resizeChildren_WidgetFlag = resizeWidthOfChildren_WidgetFlag | resizeHeightOfChildren_WidgetFlag, 79 resizeChildren_WidgetFlag = resizeWidthOfChildren_WidgetFlag | resizeHeightOfChildren_WidgetFlag,
82 fixedSize_WidgetFlag = fixedWidth_WidgetFlag | fixedHeight_WidgetFlag, 80 fixedSize_WidgetFlag = fixedWidth_WidgetFlag | fixedHeight_WidgetFlag,
83}; 81};
84 82
85enum iWidgetFlag2 { 83/* 64-bit extended flags */
86 centerHorizontal_WidgetFlag2 = iBit(1), 84#define wasCollapsed_WidgetFlag iBit64(32)
87}; 85#define centerHorizontal_WidgetFlag iBit64(33)
86#define moveToParentRightEdge_WidgetFlag iBit64(34)
88 87
89enum iWidgetAddPos { 88enum iWidgetAddPos {
90 back_WidgetAddPos, 89 back_WidgetAddPos,
@@ -99,8 +98,7 @@ enum iWidgetFocusDir {
99struct Impl_Widget { 98struct Impl_Widget {
100 iObject object; 99 iObject object;
101 iString id; 100 iString id;
102 int flags; 101 int64_t flags;
103 int flags2;
104 iRect rect; 102 iRect rect;
105 int padding[4]; /* left, top, right, bottom */ 103 int padding[4]; /* left, top, right, bottom */
106 int bgColor; 104 int bgColor;
@@ -136,7 +134,7 @@ void destroy_Widget (iWidget *); /* widget removed and deleted later */
136void destroyPending_Widget(void); 134void destroyPending_Widget(void);
137 135
138const iString *id_Widget (const iWidget *); 136const iString *id_Widget (const iWidget *);
139int flags_Widget (const iWidget *); 137int64_t flags_Widget (const iWidget *);
140iRect bounds_Widget (const iWidget *); /* outer bounds */ 138iRect bounds_Widget (const iWidget *); /* outer bounds */
141iRect innerBounds_Widget (const iWidget *); 139iRect innerBounds_Widget (const iWidget *);
142iInt2 localCoord_Widget (const iWidget *, iInt2 coord); 140iInt2 localCoord_Widget (const iWidget *, iInt2 coord);
@@ -170,8 +168,7 @@ iBool isSelected_Widget (const iAnyObject *);
170iBool isCommand_Widget (const iWidget *d, const SDL_Event *ev, const char *cmd); 168iBool isCommand_Widget (const iWidget *d, const SDL_Event *ev, const char *cmd);
171iBool hasParent_Widget (const iWidget *d, const iWidget *someParent); 169iBool hasParent_Widget (const iWidget *d, const iWidget *someParent);
172void setId_Widget (iWidget *, const char *id); 170void setId_Widget (iWidget *, const char *id);
173void setFlags_Widget (iWidget *, int flags, iBool set); 171void setFlags_Widget (iWidget *, int64_t flags, iBool set);
174void setFlags2_Widget (iWidget *, int flags2, iBool set);
175void setPos_Widget (iWidget *, iInt2 pos); 172void setPos_Widget (iWidget *, iInt2 pos);
176void setSize_Widget (iWidget *, iInt2 size); 173void setSize_Widget (iWidget *, iInt2 size);
177void setPadding_Widget (iWidget *, int left, int top, int right, int bottom); 174void setPadding_Widget (iWidget *, int left, int top, int right, int bottom);
@@ -181,7 +178,7 @@ void setFrameColor_Widget (iWidget *, int frameColor);
181void setCommandHandler_Widget (iWidget *, iBool (*handler)(iWidget *, const char *)); 178void setCommandHandler_Widget (iWidget *, iBool (*handler)(iWidget *, const char *));
182iAny * addChild_Widget (iWidget *, iAnyObject *child); /* holds a ref */ 179iAny * addChild_Widget (iWidget *, iAnyObject *child); /* holds a ref */
183iAny * addChildPos_Widget (iWidget *, iAnyObject *child, enum iWidgetAddPos addPos); 180iAny * addChildPos_Widget (iWidget *, iAnyObject *child, enum iWidgetAddPos addPos);
184iAny * addChildFlags_Widget(iWidget *, iAnyObject *child, int childFlags); /* holds a ref */ 181iAny * addChildFlags_Widget(iWidget *, iAnyObject *child, int64_t childFlags); /* holds a ref */
185iAny * removeChild_Widget (iWidget *, iAnyObject *child); /* returns a ref */ 182iAny * removeChild_Widget (iWidget *, iAnyObject *child); /* returns a ref */
186iAny * child_Widget (iWidget *, size_t index); /* O(n) */ 183iAny * child_Widget (iWidget *, size_t index); /* O(n) */
187size_t childIndex_Widget (const iWidget *, const iAnyObject *child); /* O(n) */ 184size_t childIndex_Widget (const iWidget *, const iAnyObject *child); /* O(n) */