Browse Source

Move QuantityWidget to ui

tags/v1.0.0
Andrew Belt 6 years ago
parent
commit
25779027a8
9 changed files with 16 additions and 7 deletions
  1. +1
    -0
      include/ui.hpp
  2. +1
    -0
      include/ui/ProgressBar.hpp
  3. +1
    -1
      include/ui/QuantityWidget.hpp
  4. +1
    -0
      include/ui/RadioButton.hpp
  5. +1
    -0
      include/ui/Slider.hpp
  6. +0
    -1
      include/widgets.hpp
  7. +1
    -0
      include/widgets/TransparentWidget.hpp
  8. +5
    -5
      include/widgets/ZoomWidget.hpp
  9. +5
    -0
      src/widgets/Widget.cpp

+ 1
- 0
include/ui.hpp View File

@@ -1,5 +1,6 @@
#pragma once #pragma once
#include "ui/common.hpp" #include "ui/common.hpp"
#include "ui/QuantityWidget.hpp"
#include "ui/SequentialLayout.hpp" #include "ui/SequentialLayout.hpp"
#include "ui/Label.hpp" #include "ui/Label.hpp"
#include "ui/List.hpp" #include "ui/List.hpp"


+ 1
- 0
include/ui/ProgressBar.hpp View File

@@ -1,5 +1,6 @@
#pragma once #pragma once
#include "ui/common.hpp" #include "ui/common.hpp"
#include "ui/QuantityWidget.hpp"




namespace rack { namespace rack {


include/widgets/QuantityWidget.hpp → include/ui/QuantityWidget.hpp View File

@@ -1,5 +1,5 @@
#pragma once #pragma once
#include "widgets/Widget.hpp"
#include "ui/common.hpp"




namespace rack { namespace rack {

+ 1
- 0
include/ui/RadioButton.hpp View File

@@ -1,5 +1,6 @@
#pragma once #pragma once
#include "ui/common.hpp" #include "ui/common.hpp"
#include "ui/QuantityWidget.hpp"




namespace rack { namespace rack {


+ 1
- 0
include/ui/Slider.hpp View File

@@ -1,5 +1,6 @@
#pragma once #pragma once
#include "ui/common.hpp" #include "ui/common.hpp"
#include "ui/QuantityWidget.hpp"




namespace rack { namespace rack {


+ 0
- 1
include/widgets.hpp View File

@@ -6,4 +6,3 @@
#include "widgets/ZoomWidget.hpp" #include "widgets/ZoomWidget.hpp"
#include "widgets/SVGWidget.hpp" #include "widgets/SVGWidget.hpp"
#include "widgets/FramebufferWidget.hpp" #include "widgets/FramebufferWidget.hpp"
#include "widgets/QuantityWidget.hpp"

+ 1
- 0
include/widgets/TransparentWidget.hpp View File

@@ -13,6 +13,7 @@ struct TransparentWidget : virtual Widget {
void onHoverKey(event::HoverKey &e) override {} void onHoverKey(event::HoverKey &e) override {}
void onHoverText(event::HoverText &e) override {} void onHoverText(event::HoverText &e) override {}
void onHoverScroll(event::HoverScroll &e) override {} void onHoverScroll(event::HoverScroll &e) override {}
void onDragHover(event::DragHover &e) override {}
void onPathDrop(event::PathDrop &e) override {} void onPathDrop(event::PathDrop &e) override {}
}; };




+ 5
- 5
include/widgets/ZoomWidget.hpp View File

@@ -40,31 +40,31 @@ struct ZoomWidget : virtual Widget {
e2.pos = e.pos.div(zoom); e2.pos = e.pos.div(zoom);
Widget::onHover(e2); Widget::onHover(e2);
} }

void onButton(event::Button &e) override { void onButton(event::Button &e) override {
event::Button e2 = e; event::Button e2 = e;
e2.pos = e.pos.div(zoom); e2.pos = e.pos.div(zoom);
Widget::onButton(e2); Widget::onButton(e2);
} }

void onHoverKey(event::HoverKey &e) override { void onHoverKey(event::HoverKey &e) override {
event::HoverKey e2 = e; event::HoverKey e2 = e;
e2.pos = e.pos.div(zoom); e2.pos = e.pos.div(zoom);
Widget::onHoverKey(e2); Widget::onHoverKey(e2);
} }

void onHoverText(event::HoverText &e) override { void onHoverText(event::HoverText &e) override {
event::HoverText e2 = e; event::HoverText e2 = e;
e2.pos = e.pos.div(zoom); e2.pos = e.pos.div(zoom);
Widget::onHoverText(e2); Widget::onHoverText(e2);
} }

void onHoverScroll(event::HoverScroll &e) override { void onHoverScroll(event::HoverScroll &e) override {
event::HoverScroll e2 = e; event::HoverScroll e2 = e;
e2.pos = e.pos.div(zoom); e2.pos = e.pos.div(zoom);
Widget::onHoverScroll(e2); Widget::onHoverScroll(e2);
} }

void onDragHover(event::DragHover &e) override {
event::DragHover e2 = e;
e2.pos = e.pos.div(zoom);
Widget::onDragHover(e2);
}
void onPathDrop(event::PathDrop &e) override { void onPathDrop(event::PathDrop &e) override {
event::PathDrop e2 = e; event::PathDrop e2 = e;
e2.pos = e.pos.div(zoom); e2.pos = e.pos.div(zoom);


+ 5
- 0
src/widgets/Widget.cpp View File

@@ -89,8 +89,13 @@ void Widget::step() {


void Widget::draw(NVGcontext *vg) { void Widget::draw(NVGcontext *vg) {
for (Widget *child : children) { for (Widget *child : children) {
// Don't draw if invisible
if (!child->visible) if (!child->visible)
continue; continue;
// Don't draw if child is outside bounding box
if (!box.zeroPos().intersects(child->box))
continue;

nvgSave(vg); nvgSave(vg);
nvgTranslate(vg, child->box.pos.x, child->box.pos.y); nvgTranslate(vg, child->box.pos.x, child->box.pos.y);
child->draw(vg); child->draw(vg);


Loading…
Cancel
Save