From 756da05c384e3d9258fc07cf9441d899238503f1 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 3 Jan 2021 11:50:41 +0100 Subject: Add dggui namespace to libdggui components. --- test/uitests/benchmarktest.cc | 26 +++++++++--------- test/uitests/filebrowsertest.cc | 14 +++++----- test/uitests/framewidgettest.cc | 60 ++++++++++++++++++++--------------------- test/uitests/powerwidgettest.cc | 12 ++++----- test/uitests/resizetest.cc | 16 +++++------ test/uitests/tabwidgettest.cc | 48 ++++++++++++++++----------------- 6 files changed, 88 insertions(+), 88 deletions(-) (limited to 'test/uitests') diff --git a/test/uitests/benchmarktest.cc b/test/uitests/benchmarktest.cc index 5566942..59a6968 100644 --- a/test/uitests/benchmarktest.cc +++ b/test/uitests/benchmarktest.cc @@ -34,10 +34,10 @@ #include class TimedCanvas - : public GUI::Canvas + : public dggui::Canvas { public: - GUI::PixelBufferAlpha& getPixelBuffer() override + dggui::PixelBufferAlpha& getPixelBuffer() override { return pixbuf; } @@ -48,7 +48,7 @@ public: } private: - GUI::PixelBufferAlpha pixbuf{800, 600}; + dggui::PixelBufferAlpha pixbuf{800, 600}; }; class TimedScope @@ -82,16 +82,16 @@ private: int main() { TimedCanvas canvas; - GUI::Painter painter(canvas); - GUI::Image image_no_alpha(":benchmarktest_resources/image_no_alpha.png"); - GUI::Image image_full_alpha(":benchmarktest_resources/image_full_alpha.png"); - GUI::Image image_edge_alpha(":benchmarktest_resources/image_edge_alpha.png"); - GUI::Image image_inner_alpha(":benchmarktest_resources/image_inner_alpha.png"); + dggui::Painter painter(canvas); + dggui::Image image_no_alpha(":benchmarktest_resources/image_no_alpha.png"); + dggui::Image image_full_alpha(":benchmarktest_resources/image_full_alpha.png"); + dggui::Image image_edge_alpha(":benchmarktest_resources/image_edge_alpha.png"); + dggui::Image image_inner_alpha(":benchmarktest_resources/image_inner_alpha.png"); { TimedCanvas canvas; TimedScope timed("Pixelbuffer resize", 100000); - painter.setColour(GUI::Colour(1.f, 1.f, 1.f, 1.f)); + painter.setColour(dggui::Colour(1.f, 1.f, 1.f, 1.f)); for(int i = 0; i < 100000; ++i) { canvas.resize(i % 1000 + 100, i % 1000 + 100); @@ -108,7 +108,7 @@ int main() { TimedScope timed("Filled rect, with alpha", 100000); - painter.setColour(GUI::Colour(1.f, 1.f, 1.f, 0.5f)); + painter.setColour(dggui::Colour(1.f, 1.f, 1.f, 0.5f)); for(int i = 0; i < 100000; ++i) { painter.drawRectangle(0, 0, 800, 600); @@ -148,11 +148,11 @@ int main() } { - GUI::PixelBuffer wpixbuf(800, 600); - std::vector children; + dggui::PixelBuffer wpixbuf(800, 600); + std::vector children; for(int i = 0; i < 100; ++i) { - auto child = new GUI::PixelBufferAlpha(300, 300); + auto child = new dggui::PixelBufferAlpha(300, 300); child->x = i * 2; child->y = i * 2; children.push_back(child); diff --git a/test/uitests/filebrowsertest.cc b/test/uitests/filebrowsertest.cc index 7c309d9..8cede7e 100644 --- a/test/uitests/filebrowsertest.cc +++ b/test/uitests/filebrowsertest.cc @@ -36,11 +36,11 @@ #include class TestWindow - : public GUI::Window + : public dggui::Window { public: TestWindow() - : GUI::Window(nullptr) + : dggui::Window(nullptr) { setCaption("FileBrowserTest Window"); CONNECT(eventHandler(), closeNotifier, @@ -100,22 +100,22 @@ public: return !closing; } - void repaintEvent(GUI::RepaintEvent* repaintEvent) + void repaintEvent(dggui::RepaintEvent* repaintEvent) { - GUI::Painter painter(*this); + dggui::Painter painter(*this); label.resize(width(), 30); //painter.clear(); - painter.setColour(GUI::Colour(0,1,0)); + painter.setColour(dggui::Colour(0,1,0)); painter.drawFilledRectangle(0, 0, width(), height()); } private: bool closing{false}; - GUI::Button button{this}; - GUI::Label label{this}; + dggui::Button button{this}; + dggui::Label label{this}; GUI::FileBrowser file_browser{this}; }; diff --git a/test/uitests/framewidgettest.cc b/test/uitests/framewidgettest.cc index 4f0e0fd..97f9ed0 100644 --- a/test/uitests/framewidgettest.cc +++ b/test/uitests/framewidgettest.cc @@ -40,65 +40,65 @@ // TODO: fix segfault on close -class Widget1 : public GUI::Widget +class Widget1 : public dggui::Widget { public: - Widget1(GUI::Widget* parent) : GUI::Widget(parent) + Widget1(dggui::Widget* parent) : dggui::Widget(parent) { layout.setResizeChildren(true); - layout.setHAlignment(GUI::HAlignment::center); + layout.setHAlignment(dggui::HAlignment::center); label1.setText("Label1"); - label1.setAlignment(GUI::TextAlignment::left); + label1.setAlignment(dggui::TextAlignment::left); layout.addItem(&label1); label2.setText("Label2"); - label2.setAlignment(GUI::TextAlignment::center); + label2.setAlignment(dggui::TextAlignment::center); layout.addItem(&label2); label3.setText("Label3"); - label3.setAlignment(GUI::TextAlignment::right); + label3.setAlignment(dggui::TextAlignment::right); layout.addItem(&label3); } private: - GUI::VBoxLayout layout{this}; - GUI::Label label1{this}; - GUI::Label label2{this}; - GUI::Label label3{this}; + dggui::VBoxLayout layout{this}; + dggui::Label label1{this}; + dggui::Label label2{this}; + dggui::Label label3{this}; }; -class Widget2 : public GUI::Widget +class Widget2 : public dggui::Widget { public: - Widget2(GUI::Widget* parent) : GUI::Widget(parent) + Widget2(dggui::Widget* parent) : dggui::Widget(parent) { layout.setSpacing(10); layout.setResizeChildren(true); - layout.setVAlignment(GUI::VAlignment::top); + layout.setVAlignment(dggui::VAlignment::top); label1.setText("Label1"); - label1.setAlignment(GUI::TextAlignment::right); + label1.setAlignment(dggui::TextAlignment::right); layout.addItem(&label1); label2.setText("Label2"); - label2.setAlignment(GUI::TextAlignment::left); + label2.setAlignment(dggui::TextAlignment::left); layout.addItem(&label2); layout.addItem(&checkbox); } private: - GUI::HBoxLayout layout{this}; - GUI::Label label1{this}; - GUI::Label label2{this}; - GUI::CheckBox checkbox{this}; + dggui::HBoxLayout layout{this}; + dggui::Label label1{this}; + dggui::Label label2{this}; + dggui::CheckBox checkbox{this}; }; -class TestWindow : public GUI::Window +class TestWindow : public dggui::Window { public: - TestWindow() : GUI::Window(nullptr) + TestWindow() : dggui::Window(nullptr) { setCaption("FrameWidgetTest Window"); CONNECT(eventHandler(), closeNotifier, this, @@ -107,7 +107,7 @@ public: layout.setSpacing(10); layout.setResizeChildren(true); - layout.setHAlignment(GUI::HAlignment::center); + layout.setHAlignment(dggui::HAlignment::center); layout.addItem(&frame1); layout.addItem(&frame2); @@ -141,22 +141,22 @@ public: return !closing; } - void repaintEvent(GUI::RepaintEvent* repaintEvent) override + void repaintEvent(dggui::RepaintEvent* repaintEvent) override { - GUI::Painter painter(*this); - painter.setColour(GUI::Colour(0.85)); + dggui::Painter painter(*this); + painter.setColour(dggui::Colour(0.85)); painter.drawFilledRectangle(0, 0, width() - 1, height() - 1); } private: bool closing{false}; - GUI::VBoxLayout layout{this}; + dggui::VBoxLayout layout{this}; - GUI::FrameWidget frame1{this, true}; - GUI::FrameWidget frame2{this, false}; - GUI::FrameWidget frame3{this, true}; - GUI::FrameWidget frame4{this, false}; + dggui::FrameWidget frame1{this, true}; + dggui::FrameWidget frame2{this, false}; + dggui::FrameWidget frame3{this, true}; + dggui::FrameWidget frame4{this, false}; Widget1 w1_1{this}; Widget1 w1_2{this}; diff --git a/test/uitests/powerwidgettest.cc b/test/uitests/powerwidgettest.cc index 41aff67..4d01168 100644 --- a/test/uitests/powerwidgettest.cc +++ b/test/uitests/powerwidgettest.cc @@ -43,11 +43,11 @@ #include class TestWindow - : public GUI::Window + : public dggui::Window { public: TestWindow() - : GUI::Window() + : dggui::Window() { setCaption("PowerWidgetTest Window"); CONNECT(eventHandler(), closeNotifier, this, @@ -96,10 +96,10 @@ public: return !closing; } - void repaintEvent(GUI::RepaintEvent* repaintEvent) override + void repaintEvent(dggui::RepaintEvent* repaintEvent) override { - GUI::Painter painter(*this); - painter.setColour(GUI::Colour(0.85)); + dggui::Painter painter(*this); + painter.setColour(dggui::Colour(0.85)); painter.drawFilledRectangle(0, 0, width() - 1, height() - 1); } @@ -108,7 +108,7 @@ private: Settings settings; SettingsNotifier settings_notifier{settings}; - PowerWidget w{this, settings, settings_notifier}; + GUI::PowerWidget w{this, settings, settings_notifier}; }; int main() diff --git a/test/uitests/resizetest.cc b/test/uitests/resizetest.cc index 28439d1..17748bf 100644 --- a/test/uitests/resizetest.cc +++ b/test/uitests/resizetest.cc @@ -35,11 +35,11 @@ #include class TestWindow - : public GUI::Window + : public dggui::Window { public: TestWindow() - : GUI::Window(nullptr) + : dggui::Window(nullptr) { setCaption("ResizeTest Window"); CONNECT(eventHandler(), closeNotifier, @@ -71,19 +71,19 @@ public: return !closing; } - void repaintEvent(GUI::RepaintEvent* repaintEvent) + void repaintEvent(dggui::RepaintEvent* repaintEvent) { - GUI::Painter painter(*this); + dggui::Painter painter(*this); //painter.clear(); - painter.setColour(GUI::Colour(0,1,0)); + painter.setColour(dggui::Colour(0,1,0)); painter.drawFilledRectangle(0, 0, width(), height()); auto currentSize = std::make_pair(width(), height()); auto currentPosition = std::make_pair(x(), y()); { - painter.setColour(GUI::Colour(1,0,0)); + painter.setColour(dggui::Colour(1,0,0)); char str[64]; sprintf(str, "reported: (%d, %d); (%d, %d)", (int)reportedPosition.first, @@ -98,7 +98,7 @@ public: } { - painter.setColour(GUI::Colour(1,0,0)); + painter.setColour(dggui::Colour(1,0,0)); char str[64]; sprintf(str, "current: (%d, %d); (%d, %d)", (int)currentPosition.first, @@ -115,7 +115,7 @@ public: private: bool closing{false}; - GUI::Font font{":resources/font.png"}; + dggui::Font font{":resources/font.png"}; std::pair reportedSize; std::pair reportedPosition; }; diff --git a/test/uitests/tabwidgettest.cc b/test/uitests/tabwidgettest.cc index 36a69cc..804e979 100644 --- a/test/uitests/tabwidgettest.cc +++ b/test/uitests/tabwidgettest.cc @@ -38,67 +38,67 @@ #include class Widget1 - : public GUI::Widget + : public dggui::Widget { public: - Widget1(GUI::Widget* parent) - : GUI::Widget(parent) + Widget1(dggui::Widget* parent) + : dggui::Widget(parent) { layout.setResizeChildren(true); - layout.setHAlignment(GUI::HAlignment::center); + layout.setHAlignment(dggui::HAlignment::center); label1.setText("Label1"); - label1.setAlignment(GUI::TextAlignment::left); + label1.setAlignment(dggui::TextAlignment::left); layout.addItem(&label1); label2.setText("Label2"); - label2.setAlignment(GUI::TextAlignment::center); + label2.setAlignment(dggui::TextAlignment::center); layout.addItem(&label2); label3.setText("Label3"); - label3.setAlignment(GUI::TextAlignment::right); + label3.setAlignment(dggui::TextAlignment::right); layout.addItem(&label3); } private: - GUI::VBoxLayout layout{this}; - GUI::Label label1{this}; - GUI::Label label2{this}; - GUI::Label label3{this}; + dggui::VBoxLayout layout{this}; + dggui::Label label1{this}; + dggui::Label label2{this}; + dggui::Label label3{this}; }; class Widget2 - : public GUI::Button + : public dggui::Button { public: - Widget2(GUI::Widget* parent) - : GUI::Button(parent) + Widget2(dggui::Widget* parent) + : dggui::Button(parent) { setText("Widget2"); } }; class Widget3 - : public GUI::Widget + : public dggui::Widget { public: - Widget3(GUI::Widget* parent) - : GUI::Widget(parent) + Widget3(dggui::Widget* parent) + : dggui::Widget(parent) { label.move(100, 80); label.resize(100, 20); label.setText("Widget3"); } private: - GUI::Label label{this}; + dggui::Label label{this}; }; class TestWindow - : public GUI::Window + : public dggui::Window { public: TestWindow() - : GUI::Window(nullptr) + : dggui::Window(nullptr) { setCaption("TabWidgetTest Window"); CONNECT(eventHandler(), closeNotifier, @@ -126,16 +126,16 @@ public: return !closing; } - void repaintEvent(GUI::RepaintEvent* repaintEvent) override + void repaintEvent(dggui::RepaintEvent* repaintEvent) override { - GUI::Painter painter(*this); - painter.setColour(GUI::Colour(0.85)); + dggui::Painter painter(*this); + painter.setColour(dggui::Colour(0.85)); painter.drawFilledRectangle(0, 0, width() - 1, height() - 1); } private: bool closing{false}; - GUI::TabWidget tabs{this}; + dggui::TabWidget tabs{this}; Widget1 widget1{this}; Widget2 widget2{this}; Widget3 widget3{this}; -- cgit v1.2.3