1 #include <lib/gui/eslider.h>
3 eSlider::eSlider(eWidget *parent): eWidget(parent)
7 int eSlider::event(int event, void *data, void *data2)
13 ePtr<eWindowStyle> style;
14 gPainter &painter = *(gPainter*)data2;
18 style->paintBackground(painter, ePoint(0, 0), size());
19 style->setStyle(painter, eWindowStyle::styleLabel); // TODO - own style
20 painter.fill(m_currently_filled);
24 case evtChangedSlider:
29 num_pix = size().width() * m_value / (m_max - m_min);
30 gRegion old_currently_filled = m_currently_filled;
31 m_currently_filled = eRect(0, 0, num_pix, size().height());
33 // redraw what *was* filled before and now isn't.
34 invalidate(m_currently_filled - old_currently_filled);
35 // redraw what wasn't filled before and is now.
36 invalidate(old_currently_filled - m_currently_filled);
41 return eWidget::event(event, data, data2);
45 void eSlider::setValue(int value)
48 event(evtChangedSlider);
51 void eSlider::setRange(int min, int max)
55 event(evtChangedSlider);