2013-03-15 13:11:33 +00:00
|
|
|
namespace phoenix {
|
|
|
|
|
|
|
|
Size pHorizontalScroller::minimumSize() {
|
|
|
|
return {0, 15};
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHorizontalScroller::setLength(unsigned length) {
|
|
|
|
length += length == 0;
|
|
|
|
qtScroller->setRange(0, length - 1);
|
|
|
|
qtScroller->setPageStep(length >> 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHorizontalScroller::setPosition(unsigned position) {
|
|
|
|
qtScroller->setValue(position);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHorizontalScroller::constructor() {
|
|
|
|
qtWidget = qtScroller = new QScrollBar(Qt::Horizontal);
|
|
|
|
qtScroller->setRange(0, 100);
|
|
|
|
qtScroller->setPageStep(101 >> 3);
|
|
|
|
connect(qtScroller, SIGNAL(valueChanged(int)), SLOT(onChange()));
|
|
|
|
|
|
|
|
pWidget::synchronizeState();
|
|
|
|
setLength(horizontalScroller.state.length);
|
|
|
|
setPosition(horizontalScroller.state.position);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHorizontalScroller::destructor() {
|
|
|
|
delete qtScroller;
|
|
|
|
qtWidget = qtScroller = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHorizontalScroller::orphan() {
|
|
|
|
destructor();
|
|
|
|
constructor();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHorizontalScroller::onChange() {
|
2013-11-28 10:29:01 +00:00
|
|
|
horizontalScroller.state.position = qtScroller->value();
|
2013-03-15 13:11:33 +00:00
|
|
|
if(horizontalScroller.onChange) horizontalScroller.onChange();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|