Handle widget outline in base class.

master
Peter Nelson 2013-02-05 19:15:41 +00:00
parent cac5f476d5
commit ceafbff5f4
4 changed files with 16 additions and 10 deletions

View File

@ -144,5 +144,6 @@ void Knob::OnPaint(const PUi *pui) const
pui->font->Render(tmp);
glPopMatrix();
Widget::OnPaint(pui);
}

View File

@ -232,14 +232,6 @@ void VSlider::OnPaint(const PUi *pui) const
pui->font->Render(tmp);
glPopMatrix();
if (this->active) {
glBegin(GL_LINE_LOOP);
glColor4f(1.f, 1.f, 1.0f, 0.25f);
glVertex2f( x + .5f, y + .5f);
glVertex2f( x + .5f, h + y - .5f);
glVertex2f(w + x - .5f, h + y - .5f);
glVertex2f(w + x - .5f, y + .5f);
glEnd();
}
Widget::OnPaint(pui);
}

View File

@ -24,6 +24,19 @@ void Widget::Pad(int xpad, int ypad)
this->h -= ypad + ypad;
}
void Widget::OnPaint(const PUi *pui) const
{
if (this->active) {
glBegin(GL_LINE_LOOP);
glColor4f(1.f, 1.f, 1.0f, 0.25f);
glVertex2f( x + .5f, y + .5f);
glVertex2f( x + .5f, h + y - .5f);
glVertex2f(w + x - .5f, h + y - .5f);
glVertex2f(w + x - .5f, y + .5f);
glEnd();
}
}
void Frame::OnPaint(const PUi *pui) const
{
glBegin(GL_QUADS);

View File

@ -47,7 +47,7 @@ struct Widget : Rect {
virtual float GetNewValue(int x, int y) { return this->value; }
virtual bool SetValue(float newvalue);
virtual void OnPaint(const PUi *pui) const {}
virtual void OnPaint(const PUi *pui) const;
void Pad(int xpad, int ypad);
};