MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / GUI_Widget_Draw

Function GUI_Widget_Draw

src/gui/widget.c:143–232  ·  view source on GitHub ↗

* Draw a widget to the display. * * @param w The widget to draw. */

Source from the content-addressed store, hash-verified

141 * @param w The widget to draw.
142 */
143void GUI_Widget_Draw(Widget *w)
144{
145 uint16 positionLeft, positionRight;
146 uint16 positionTop, positionBottom;
147 uint16 offsetX, offsetY;
148 uint16 drawMode;
149 uint8 fgColour, bgColour;
150 WidgetDrawParameter drawParam;
151
152 if (w == NULL) return;
153
154 if (w->flags.invisible) {
155 if (!w->flags.greyWhenInvisible) return;
156
157 GUI_Widget_DrawBlocked(w, 12);
158 return;
159 }
160
161 if (!w->state.hover2) {
162 if (!w->state.selected) {
163 drawMode = w->drawModeNormal;
164 drawParam = w->drawParameterNormal;
165 fgColour = w->fgColourNormal;
166 bgColour = w->bgColourNormal;
167 } else {
168 drawMode = w->drawModeSelected;
169 drawParam = w->drawParameterSelected;
170 fgColour = w->fgColourSelected;
171 bgColour = w->bgColourSelected;
172
173 }
174 } else {
175 drawMode = w->drawModeDown;
176 drawParam = w->drawParameterDown;
177 fgColour = w->fgColourDown;
178 bgColour = w->bgColourDown;
179 }
180
181 offsetX = w->offsetX;
182 if (w->offsetX < 0) {
183 offsetX = (g_widgetProperties[w->parentID].width << 3) + w->offsetX;
184 }
185 positionLeft = (g_widgetProperties[w->parentID].xBase << 3) + offsetX;
186 positionRight = positionLeft + w->width - 1;
187
188 offsetY = w->offsetY;
189 if (w->offsetY < 0) {
190 offsetY = g_widgetProperties[w->parentID].height + w->offsetY;
191 }
192 positionTop = g_widgetProperties[w->parentID].yBase + offsetY;
193 positionBottom = positionTop + w->height - 1;
194
195 assert(drawMode < DRAW_MODE_MAX);
196 if (drawMode != DRAW_MODE_NONE && drawMode != DRAW_MODE_CUSTOM_PROC && GFX_Screen_IsActive(SCREEN_0)) {
197 GUI_Mouse_Hide_InRegion(positionLeft, positionTop, positionRight, positionBottom);
198 }
199
200 switch (drawMode) {

Callers 14

GUI_ChangeSelectionTypeFunction · 0.85
GUI_Widget_MakeInvisibleFunction · 0.85
GUI_Widget_MakeVisibleFunction · 0.85
GUI_Widget_HandleEventsFunction · 0.85
GUI_Widget_MakeSelectedFunction · 0.85
GUI_Widget_MakeNormalFunction · 0.85
GUI_Widget_DrawAllFunction · 0.85
GUI_Mentat_DrawFunction · 0.85
GUI_Mentat_List_ClickFunction · 0.85

Calls 9

GUI_Widget_DrawBlockedFunction · 0.85
GFX_Screen_IsActiveFunction · 0.85
GUI_Mouse_Hide_InRegionFunction · 0.85
GUI_DrawSpriteFunction · 0.85
GUI_DrawTextFunction · 0.85
GFX_DrawTileFunction · 0.85
GUI_DrawWiredRectangleFunction · 0.85
GUI_Mouse_Show_InRegionFunction · 0.85

Tested by

no test coverage detected