Thread: [Libufo-commits] ufo-0.5/src/ui ubasicstyle.cpp,1.7,1.8
Status: Beta
Brought to you by:
schmidtjf
|
From: Johannes S. <sch...@us...> - 2005-10-11 20:23:10
|
Update of /cvsroot/libufo/ufo-0.5/src/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4937/src/ui Modified Files: ubasicstyle.cpp Log Message: Changed radio button indicator, check box indicator and the slider knob. Index: ubasicstyle.cpp =================================================================== RCS file: /cvsroot/libufo/ufo-0.5/src/ui/ubasicstyle.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ubasicstyle.cpp 30 Sep 2005 12:37:20 -0000 1.7 --- ubasicstyle.cpp 11 Oct 2005 20:22:56 -0000 1.8 *************** *** 28,33 **** #include "ufo/ui/ubasicstyle.hpp" - //#include "ufo/gl/ugl_driver.hpp" - #include "ufo/ui/ustyle.hpp" #include "ufo/ui/ustylehints.hpp" --- 28,31 ---- *************** *** 170,174 **** case PE_IndicatorCheckBox: - case PE_IndicatorRadioButton: if (widgetState & WidgetDisabled) { g->setColor(UColor::gray); --- 168,171 ---- *************** *** 180,183 **** --- 177,197 ---- g->fillRect(rect - UInsets(1, 1, 1, 1)); break; + case PE_IndicatorRadioButton: { + UVertexArray array; + array.add(rect.x + 4, rect.y + 0); + array.add(rect.x + 0, rect.y + 4); + array.add(rect.x + 0, rect.y + 6); + array.add(rect.x + 4, rect.y + 10); + array.add(rect.x + 6, rect.y + 10); + array.add(rect.x + 10, rect.y + 6); + array.add(rect.x + 10, rect.y + 4); + array.add(rect.x + 6, rect.y + 0); + array.add(rect.x + 4, rect.y + 0); + g->setColor(UColor::white); + g->drawVertexArray(UGraphics::TriangleFan, &array); + g->setColor(UColor::gray); + g->drawVertexArray(UGraphics::LineStrip, &array); + } + break; case PE_IndicatorCheckBoxMask: if (widgetState & WidgetDisabled) { *************** *** 187,192 **** } if (widgetState & WidgetSelected) { g->drawLine(rect.x + 2, rect.y + 2, rect.x + rect.w - 3, rect.y + rect.h - 3); ! g->drawLine(rect.x + rect.w - 4, rect.y + 2, rect.x + 1, rect.y + rect.h - 3); } break; --- 201,208 ---- } if (widgetState & WidgetSelected) { + g->setLineWidth(2); g->drawLine(rect.x + 2, rect.y + 2, rect.x + rect.w - 3, rect.y + rect.h - 3); ! g->drawLine(rect.x + rect.w - 4, rect.y + 3, rect.x + 1, rect.y + rect.h - 2); ! g->setLineWidth(1); } break; *************** *** 209,212 **** --- 225,229 ---- array.add(rect.x + 4, rect.y + 2); g->drawVertexArray(UGraphics::LineStrip, &array); + g->drawVertexArray(UGraphics::TriangleFan, &array); } break; *************** *** 614,617 **** --- 631,641 ---- return ret + UInsets(0, 0, 0, 16); break; + case CE_Slider: + if (hints->orientation == Vertical) { + return ret + UInsets(0, 0, 0, 12); + } else { + return ret + UInsets(12, 0, 0, 0); + } + break; case CE_MenuItem: { const UMenuItemModel * item = static_cast<const UMenuItemModel*>(model); *************** *** 710,714 **** case CE_MenuItem: { const UMenuItemModel * menuItem = static_cast<const UMenuItemModel*>(model); ! //paintPrimitive(g, PE_WidgetBackground, model, w); if (menuItem->widgetState & WidgetHasMouseFocus || menuItem->widgetState & WidgetHighlighted) { --- 734,738 ---- case CE_MenuItem: { const UMenuItemModel * menuItem = static_cast<const UMenuItemModel*>(model); ! //paintPrimitive(g, PE_PanelWidget, rect, hints, model->widgetState); if (menuItem->widgetState & WidgetHasMouseFocus || menuItem->widgetState & WidgetHighlighted) { *************** *** 947,956 **** paintPrimitive(g, PE_PanelWidget, rect, hints, model->widgetState); ! // slider knob if (sliderModel->subControls & SC_SliderGroove) { UPoint left(5, rect.h / 2); UPoint right(rect.w - 5, left.y); g->setColor(hints->palette.dark()); g->drawLine(left, right); } --- 971,985 ---- paintPrimitive(g, PE_PanelWidget, rect, hints, model->widgetState); ! // slider groove if (sliderModel->subControls & SC_SliderGroove) { + /* UPoint left(5, rect.h / 2); UPoint right(rect.w - 5, left.y); g->setColor(hints->palette.dark()); g->drawLine(left, right); + */ + int mid_y = rect.h / 2; + g->setColor(hints->palette.background().darker()); + g->drawRect(URectangle(0, mid_y - 2, rect.w, 4)); } *************** *** 960,963 **** --- 989,993 ---- hints, model, SC_SliderHandle) ); + /* if (sliderModel->activeSubControls & SC_SliderHandle) { g->setColor(hints->palette.highlight().brighter()); *************** *** 968,971 **** --- 998,1026 ---- g->setColor(hints->palette.highlight().darker()); g->drawRect(slider_rect); + */ + //g->setEnabled(UGraphics::LineAntialiasing, true); + float arr_height = slider_rect.h * 0.7; + float arr_height_2 = slider_rect.h * 0.9; + g->setColor(hints->palette.background().darker()); + UVertexArray array; + array.add(slider_rect.x + 1, slider_rect.y); + array.add(slider_rect.x - 1 + slider_rect.w, slider_rect.y); + array.add(slider_rect.x + slider_rect.w, slider_rect.y + 1); + array.add(slider_rect.x + slider_rect.w, slider_rect.y + arr_height); + + array.add(slider_rect.x + slider_rect.w * 0.75f, slider_rect.y + arr_height_2); + array.add(slider_rect.x + slider_rect.w / 2, slider_rect.y + slider_rect.h); + array.add(slider_rect.x + slider_rect.w * 0.25f, slider_rect.y + arr_height_2); + + array.add(slider_rect.x, slider_rect.y + arr_height); + array.add(slider_rect.x, slider_rect.y + 1); + array.add(slider_rect.x + 1, slider_rect.y); + g->setColor(hints->palette.background()); + g->drawVertexArray(UGraphics::TriangleFan, &array); + g->setColor(hints->palette.dark()); + g->drawVertexArray(UGraphics::LineStrip, &array); + + g->drawRect(slider_rect.x + 2, slider_rect.y + 3, 2, 2); + g->drawRect(slider_rect.x + slider_rect.w - 3, slider_rect.y + 3, 2, 2); } } *************** *** 1291,1295 **** case CE_Slider: { const USliderModel * sliderModel = static_cast<const USliderModel*>(model); ! int width = 10; int maxlen = (hints->orientation == Vertical) ? rect.h : rect.w; int pos = basicstyle_sliderModelToView( --- 1346,1351 ---- case CE_Slider: { const USliderModel * sliderModel = static_cast<const USliderModel*>(model); ! int width = 8; ! int height = 12; int maxlen = (hints->orientation == Vertical) ? rect.h : rect.w; int pos = basicstyle_sliderModelToView( *************** *** 1301,1309 **** case SC_SliderHandle: { if (hints->orientation == Vertical) { ! ret.setBounds(rect.x + rect.w / 2 - width / 2, pos, ! width, width); } else { ! ret.setBounds(pos, rect.y + rect.h / 2 - width / 2, ! width, width); } } --- 1357,1365 ---- case SC_SliderHandle: { if (hints->orientation == Vertical) { ! ret.setBounds(rect.x + rect.w / 2 - height / 2, pos, ! height, width); } else { ! ret.setBounds(pos, rect.y + rect.h / 2 - height / 2, ! width, height); } } |