MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / Slider

Method Slider

src/Interface/Slider.cpp:37–60  ·  view source on GitHub ↗

* Sets up a slider with the specified size and position. * @param width Width in pixels. * @param height Height in pixels. * @param x X position in pixels. * @param y Y position in pixels. */

Source from the content-addressed store, hash-verified

35 * @param y Y position in pixels.
36 */
37Slider::Slider(int width, int height, int x, int y) : InteractiveSurface(width, height, x, y), _pos(0.0), _min(0), _max(100), _pressed(false), _change(0), _offsetX(0)
38{
39 _thickness = 5;
40 _textness = 8;
41 _txtMinus = new Text(_textness, height - 2, x - 1, y);
42 _txtPlus = new Text(_textness, height - 2, x + width - _textness, y);
43 _frame = new Frame(width - _textness*2, _thickness, x + _textness, y + (height - _thickness) / 2);
44 _button = new TextButton(10, height, x, y);
45
46 _frame->setThickness(_thickness);
47
48 _txtMinus->setAlign(ALIGN_CENTER);
49 _txtMinus->setVerticalAlign(ALIGN_MIDDLE);
50 _txtMinus->setText(L"-");
51
52 _txtPlus->setAlign(ALIGN_CENTER);
53 _txtPlus->setVerticalAlign(ALIGN_MIDDLE);
54 _txtPlus->setText(L"+");
55
56 _minX = _frame->getX();
57 _maxX = _frame->getX() + _frame->getWidth() - _button->getWidth();
58
59 setValue(_pos);
60}
61
62/**
63 * Deletes contents.

Callers

nothing calls this directly

Calls 6

setThicknessMethod · 0.80
setAlignMethod · 0.45
setVerticalAlignMethod · 0.45
setTextMethod · 0.45
getXMethod · 0.45
getWidthMethod · 0.45

Tested by

no test coverage detected