MCPcopy Create free account
hub / github.com/VCVRack/Rack / draw

Method draw

src/ui/Slider.cpp:16–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14}
15
16void Slider::draw(const DrawArgs& args) {
17 BNDwidgetState state = BND_DEFAULT;
18 if (APP->event->hoveredWidget == this)
19 state = BND_HOVER;
20 if (APP->event->draggedWidget == this)
21 state = BND_ACTIVE;
22
23 float progress = quantity ? quantity->getScaledValue() : 0.f;
24 std::string text = quantity ? quantity->getString() : "";
25
26 // If parent is a Menu, make corners sharp
27 ui::Menu* parentMenu = dynamic_cast<ui::Menu*>(getParent());
28 int flags = parentMenu ? BND_CORNER_ALL : BND_CORNER_NONE;
29 bndSlider(args.vg, 0.0, 0.0, box.size.x, box.size.y, flags, state, progress, text.c_str(), NULL);
30}
31
32void Slider::onDragStart(const DragStartEvent& e) {
33 if (e.button != GLFW_MOUSE_BUTTON_LEFT)

Callers

nothing calls this directly

Calls 2

getScaledValueMethod · 0.80
getStringMethod · 0.80

Tested by

no test coverage detected