}
+static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+{
+ uiWidgetBase wtb;
+
+ widget_init(&wtb);
+
+ /* half rounded */
+ round_box_edges(&wtb, roundboxalign, rect, 4.0f);
+
+ widgetbase_draw(&wtb, wcol);
+
+ /* store the box bg as gl clearcolor, to retrieve later when drawing semi-transparent rects
+ * over the top to indicate disabled buttons */
+ glClearColor(wcol->inner[0]/255.0, wcol->inner[1]/255.0, wcol->inner[2]/255.0, 1.0);
+}
+
static void widget_but(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
{
uiWidgetBase wtb;
/* can't use theme TH_BACK or TH_PANEL... undefined */
glGetFloatv(GL_COLOR_CLEAR_VALUE, col);
glColor4f(col[0], col[1], col[2], 0.5f);
+
/* need -1 and +1 to make it work right for aligned buttons,
* but problem may be somewhere else? */
- glRectf(rect->xmin-1, rect->ymin, rect->xmax, rect->ymax+1);
-
+ glRectf(rect->xmin-1, rect->ymin-1, rect->xmax, rect->ymax+1);
+
glDisable(GL_BLEND);
}
break;
case UI_WTYPE_BOX:
+ wt.custom= widget_box;
wt.wcol_theme= &btheme->tui.wcol_box;
break;