void CheckboxStyle::draw() { // todo Widget *w = getWidget(); iuiGetRenderer()->drawRect(Rect(w->getPosition(), w->getSize()), getBGColor()); iuiGetRenderer()->drawOutlineRect(Rect(w->getPosition(), w->getSize()), getBorderColor()); }
void Scrollable::setPattern(int _matrix[]) { Serial.println("Setting Pattern!"); // int pattern[] = { // 0,0,0, // 0,1,0, // 1,0,1, // 1,1,1, // 1,0,1, // 1,0,1, // }; //int numDots = 18; //int numCols = 3; //columns.clear(); //for (int i = 0; i < numCols; i++) //{ // columns.push_back(new Column()); //} //for (int i = 0; i < numDots; i++) //{ // CRGB* color = (pattern[i] != 0) ? getFGColor() : getBGColor(); // columns[numDots%numCols]->pushPixel(color); //} Column* c1 = new Column(); c1->pushPixel(getBGColor()); c1->pushPixel(getBGColor()); c1->pushPixel(getFGColor()); c1->pushPixel(getFGColor()); c1->pushPixel(getFGColor()); c1->pushPixel(getFGColor()); columns.push_back(c1); Column* c2 = new Column(); c2->pushPixel(getBGColor()); c2->pushPixel(getFGColor()); c2->pushPixel(getBGColor()); c2->pushPixel(getFGColor()); c2->pushPixel(getBGColor()); c2->pushPixel(getBGColor()); columns.push_back(c2); Column* c3 = new Column(); c3->pushPixel(getBGColor()); c3->pushPixel(getBGColor()); c3->pushPixel(getFGColor()); c3->pushPixel(getFGColor()); c3->pushPixel(getFGColor()); c3->pushPixel(getFGColor()); columns.push_back(c3); Serial.println("Done Setting Pattern!"); }
void LabelStyle::draw() { Label *w = static_cast<Label*>(getWidget()); Rect rect(Position(), w->getSize()); Color bg = getBGColor(); TextPosition tpos(rect, getTextHAlign(), getTextVAlign(), getTextHSpacing(), getTextVSpacing()); //iuiGetRenderer()->drawRect(rect, bg); iuiGetRenderer()->drawFont(tpos, getFontColor(), w->getText().c_str(), w->getText().size()); }
// -------------------------------------------------------------------------------------------------------- void KWidget::render () { loadId(); if (flags[KDL_WIDGET_FLAG_FRAMED]) { KSize ws = getSize(); if (getBGColor()) { glPushAttrib (GL_CURRENT_BIT | GL_POLYGON_BIT); glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); getBGColor()->glColor(); glRecti (0, -ws.h, ws.w, 0); glPopAttrib(); } glRecti(0, -ws.h, ws.w, 0); } }
int TextLabel::drawText(QPainter *p, int x, int y, int width, int height, const QString &text) { if (shadow != 0) { p->setPen(getBGColor()); p->drawText(x + shadow, y + shadow, width, height, alignment | clip | Qt::TextExpandTabs, text); } p->setPen(getColor()); p->drawText(x, y, width, height, alignment | clip | Qt::TextExpandTabs, text); return 0; }
void ToggleButtonStyle::draw() { ToggleButton *w = static_cast<ToggleButton*>(getWidget()); Rect rect(Position(), w->getSize()); TextPosition tpos(rect, getTextHAlign(), getTextVAlign(), getTextHSpacing(), getTextVSpacing()); Color bg = getBGColor(); if(w->isPressing() || w->isPressed()) { bg += vec4(0.4f, 0.4f, 0.4f, 0.0f); } else if(w->isHovered()) { bg += vec4(0.2f, 0.2f, 0.2f, 0.0f); } iuiGetRenderer()->drawRect(rect, bg); iuiGetRenderer()->drawOutlineRect(rect, getBorderColor()); iuiGetRenderer()->drawFont(tpos, getFontColor(), w->getText().c_str(), w->getText().size()); }
void EditboxStyle::draw() { Editbox *w = static_cast<Editbox*>(getWidget()); Rect rect(Position(), w->getSize()); TextPosition tpos(rect, getTextHAlign(), getTextVAlign(), getTextHSpacing(), getTextVSpacing()); Color bg = getBGColor(); if(w->isFocused()) { bg += vec4(0.4f, 0.4f, 0.4f, 0.0f); } else if(w->isHovered()) { bg += vec4(0.2f, 0.2f, 0.2f, 0.0f); } iuiGetRenderer()->drawRect(rect, bg); iuiGetRenderer()->drawOutlineRect(rect, getBorderColor()); iuiGetRenderer()->drawFont(tpos, getFontColor(), w->getText().c_str(), w->getText().size()); if(w->isFocused() && ist::GetTick()%1000<500) { vec2 tsize = iuiGetRenderer()->computeTextSize(w->getText().c_str(), w->getCursorPos()); Line l(Position(tsize.x, 0.0f), Position(tsize.x, tsize.y)); iuiGetRenderer()->drawLine(l, getBorderColor()); } }
void EditboxMultilineStyle::draw() { Widget *w = getWidget(); iuiGetRenderer()->drawRect(Rect(w->getPosition(), w->getSize()), getBGColor()); iuiGetRenderer()->drawOutlineRect(Rect(w->getPosition(), w->getSize()), getBorderColor()); }