| 11 | } |
| 12 | |
| 13 | UISpinBox::UISpinBox() : |
| 14 | UIWidget( "spinbox" ), |
| 15 | mMinValue( 0.f ), |
| 16 | mMaxValue( std::numeric_limits<double>::max() ), |
| 17 | mValue( 0 ), |
| 18 | mClickStep( 1.f ), |
| 19 | mModifyingVal( false ) { |
| 20 | mFlags |= UI_SCROLLABLE; |
| 21 | mInput = UITextInput::NewWithTag( "spinbox::input" ); |
| 22 | mInput->setVisible( true ); |
| 23 | mInput->setEnabled( true ); |
| 24 | mInput->setParent( this ); |
| 25 | |
| 26 | auto cb = [this]( const Event* ) { adjustChildren(); }; |
| 27 | |
| 28 | mPushUp = UIWidget::NewWithTag( "spinbox::btnup" ); |
| 29 | mPushUp->setVisible( true ); |
| 30 | mPushUp->setEnabled( true ); |
| 31 | mPushUp->setParent( this ); |
| 32 | mPushUp->setSize( 8, 8 ); |
| 33 | mPushUp->on( Event::OnSizeChange, cb ); |
| 34 | |
| 35 | mPushDown = UIWidget::NewWithTag( "spinbox::btndown" ); |
| 36 | mPushDown->setVisible( true ); |
| 37 | mPushDown->setEnabled( true ); |
| 38 | mPushDown->setParent( this ); |
| 39 | mPushDown->setSize( 8, 8 ); |
| 40 | mPushDown->on( Event::OnSizeChange, cb ); |
| 41 | |
| 42 | mInput->setAllowOnlyNumbers( true, false ); |
| 43 | mInput->on( Event::OnBufferChange, [this]( auto event ) { onBufferChange( event ); } ); |
| 44 | double val = mValue; |
| 45 | mValue += 1; |
| 46 | setValue( val ); |
| 47 | |
| 48 | applyDefaultTheme(); |
| 49 | } |
| 50 | |
| 51 | UISpinBox::~UISpinBox() {} |
| 52 |
nothing calls this directly
no test coverage detected