MCPcopy Create free account
hub / github.com/SpartanJ/eepp / UISpinBox

Method UISpinBox

src/eepp/ui/uispinbox.cpp:13–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11}
12
13UISpinBox::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
51UISpinBox::~UISpinBox() {}
52

Callers

nothing calls this directly

Calls 7

setValueFunction · 0.85
setParentMethod · 0.80
setAllowOnlyNumbersMethod · 0.80
setVisibleMethod · 0.45
setEnabledMethod · 0.45
setSizeMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected