mirror of https://github.com/bsnes-emu/bsnes.git
48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
|
namespace phoenix {
|
||
|
|
||
|
Size pVerticalScroller::minimumSize() {
|
||
|
return {15, 0};
|
||
|
}
|
||
|
|
||
|
unsigned pVerticalScroller::position() {
|
||
|
return qtScroller->value();
|
||
|
}
|
||
|
|
||
|
void pVerticalScroller::setLength(unsigned length) {
|
||
|
length += length == 0;
|
||
|
qtScroller->setRange(0, length - 1);
|
||
|
qtScroller->setPageStep(length >> 3);
|
||
|
}
|
||
|
|
||
|
void pVerticalScroller::setPosition(unsigned position) {
|
||
|
qtScroller->setValue(position);
|
||
|
}
|
||
|
|
||
|
void pVerticalScroller::constructor() {
|
||
|
qtWidget = qtScroller = new QScrollBar(Qt::Vertical);
|
||
|
qtScroller->setRange(0, 100);
|
||
|
qtScroller->setPageStep(101 >> 3);
|
||
|
connect(qtScroller, SIGNAL(valueChanged(int)), SLOT(onChange()));
|
||
|
|
||
|
pWidget::synchronizeState();
|
||
|
setLength(verticalScroller.state.length);
|
||
|
setPosition(verticalScroller.state.position);
|
||
|
}
|
||
|
|
||
|
void pVerticalScroller::destructor() {
|
||
|
delete qtScroller;
|
||
|
qtWidget = qtScroller = nullptr;
|
||
|
}
|
||
|
|
||
|
void pVerticalScroller::orphan() {
|
||
|
destructor();
|
||
|
constructor();
|
||
|
}
|
||
|
|
||
|
void pVerticalScroller::onChange() {
|
||
|
verticalScroller.state.position = position();
|
||
|
if(verticalScroller.onChange) verticalScroller.onChange();
|
||
|
}
|
||
|
|
||
|
}
|