diff options
Diffstat (limited to 'src/ui/widget.h')
-rw-r--r-- | src/ui/widget.h | 79 |
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) | |||
44 | iEndDeclareClass(Widget) | 44 | iEndDeclareClass(Widget) |
45 | 45 | ||
46 | enum iWidgetFlag { | 46 | enum 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 | ||
85 | enum 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 | ||
89 | enum iWidgetAddPos { | 88 | enum iWidgetAddPos { |
90 | back_WidgetAddPos, | 89 | back_WidgetAddPos, |
@@ -99,8 +98,7 @@ enum iWidgetFocusDir { | |||
99 | struct Impl_Widget { | 98 | struct 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 */ | |||
136 | void destroyPending_Widget(void); | 134 | void destroyPending_Widget(void); |
137 | 135 | ||
138 | const iString *id_Widget (const iWidget *); | 136 | const iString *id_Widget (const iWidget *); |
139 | int flags_Widget (const iWidget *); | 137 | int64_t flags_Widget (const iWidget *); |
140 | iRect bounds_Widget (const iWidget *); /* outer bounds */ | 138 | iRect bounds_Widget (const iWidget *); /* outer bounds */ |
141 | iRect innerBounds_Widget (const iWidget *); | 139 | iRect innerBounds_Widget (const iWidget *); |
142 | iInt2 localCoord_Widget (const iWidget *, iInt2 coord); | 140 | iInt2 localCoord_Widget (const iWidget *, iInt2 coord); |
@@ -170,8 +168,7 @@ iBool isSelected_Widget (const iAnyObject *); | |||
170 | iBool isCommand_Widget (const iWidget *d, const SDL_Event *ev, const char *cmd); | 168 | iBool isCommand_Widget (const iWidget *d, const SDL_Event *ev, const char *cmd); |
171 | iBool hasParent_Widget (const iWidget *d, const iWidget *someParent); | 169 | iBool hasParent_Widget (const iWidget *d, const iWidget *someParent); |
172 | void setId_Widget (iWidget *, const char *id); | 170 | void setId_Widget (iWidget *, const char *id); |
173 | void setFlags_Widget (iWidget *, int flags, iBool set); | 171 | void setFlags_Widget (iWidget *, int64_t flags, iBool set); |
174 | void setFlags2_Widget (iWidget *, int flags2, iBool set); | ||
175 | void setPos_Widget (iWidget *, iInt2 pos); | 172 | void setPos_Widget (iWidget *, iInt2 pos); |
176 | void setSize_Widget (iWidget *, iInt2 size); | 173 | void setSize_Widget (iWidget *, iInt2 size); |
177 | void setPadding_Widget (iWidget *, int left, int top, int right, int bottom); | 174 | void setPadding_Widget (iWidget *, int left, int top, int right, int bottom); |
@@ -181,7 +178,7 @@ void setFrameColor_Widget (iWidget *, int frameColor); | |||
181 | void setCommandHandler_Widget (iWidget *, iBool (*handler)(iWidget *, const char *)); | 178 | void setCommandHandler_Widget (iWidget *, iBool (*handler)(iWidget *, const char *)); |
182 | iAny * addChild_Widget (iWidget *, iAnyObject *child); /* holds a ref */ | 179 | iAny * addChild_Widget (iWidget *, iAnyObject *child); /* holds a ref */ |
183 | iAny * addChildPos_Widget (iWidget *, iAnyObject *child, enum iWidgetAddPos addPos); | 180 | iAny * addChildPos_Widget (iWidget *, iAnyObject *child, enum iWidgetAddPos addPos); |
184 | iAny * addChildFlags_Widget(iWidget *, iAnyObject *child, int childFlags); /* holds a ref */ | 181 | iAny * addChildFlags_Widget(iWidget *, iAnyObject *child, int64_t childFlags); /* holds a ref */ |
185 | iAny * removeChild_Widget (iWidget *, iAnyObject *child); /* returns a ref */ | 182 | iAny * removeChild_Widget (iWidget *, iAnyObject *child); /* returns a ref */ |
186 | iAny * child_Widget (iWidget *, size_t index); /* O(n) */ | 183 | iAny * child_Widget (iWidget *, size_t index); /* O(n) */ |
187 | size_t childIndex_Widget (const iWidget *, const iAnyObject *child); /* O(n) */ | 184 | size_t childIndex_Widget (const iWidget *, const iAnyObject *child); /* O(n) */ |