From e1aae68ef4c5c6360815cf05519c5af3a61acc0c Mon Sep 17 00:00:00 2001 From: kunitoki Date: Thu, 26 Jun 2025 12:53:24 +0200 Subject: [PATCH 01/33] Fix Component tests --- examples/graphics/source/examples/Widgets.h | 196 +++++ examples/graphics/source/main.cpp | 14 + .../primitives/yup_AffineTransform.h | 19 + modules/yup_graphics/primitives/yup_Size.h | 2 +- modules/yup_gui/component/yup_Component.cpp | 68 +- modules/yup_gui/component/yup_Component.h | 49 +- modules/yup_gui/menus/yup_PopupMenu.cpp | 3 +- modules/yup_gui/widgets/yup_ComboBox.cpp | 324 ++++++++ modules/yup_gui/widgets/yup_ComboBox.h | 200 +++++ modules/yup_gui/yup_gui.cpp | 1 + modules/yup_gui/yup_gui.h | 1 + tests/CMakeLists.txt | 5 +- tests/yup_gui/yup_Component.cpp | 765 ++++++++++++++++++ 13 files changed, 1634 insertions(+), 13 deletions(-) create mode 100644 examples/graphics/source/examples/Widgets.h create mode 100644 modules/yup_gui/widgets/yup_ComboBox.cpp create mode 100644 modules/yup_gui/widgets/yup_ComboBox.h create mode 100644 tests/yup_gui/yup_Component.cpp diff --git a/examples/graphics/source/examples/Widgets.h b/examples/graphics/source/examples/Widgets.h new file mode 100644 index 000000000..f34613050 --- /dev/null +++ b/examples/graphics/source/examples/Widgets.h @@ -0,0 +1,196 @@ +/* + ============================================================================== + + This file is part of the YUP library. + Copyright (c) 2025 - kunitoki@gmail.com + + YUP is an open source library subject to open-source licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + to use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace yup +{ + +//============================================================================== +class WidgetsDemo : public Component +{ +public: + WidgetsDemo() + { + auto theme = ApplicationTheme::getGlobalTheme(); + exampleFont = theme->getDefaultFont(); + + setupWidgets(); + setupLayout(); + } + +private: + void setupWidgets() + { + // Text Button (uses componentID as text) + textButton = std::make_unique ("Text Button"); + textButton->onClick = [this] { updateStatus ("Text Button clicked!"); }; + addAndMakeVisible (textButton.get()); + + // Toggle Button + /* + toggleButton = std::make_unique ("toggleButton"); + toggleButton->setButtonText ("Toggle Button"); + toggleButton->onClick = [this] { updateStatus ("Toggle Button: " + String (toggleButton->getToggleState() ? "ON" : "OFF")); }; + addAndMakeVisible (toggleButton.get()); + */ + + // Drawable Button + /* + drawableButton = std::make_unique ("drawableButton"); + // Note: You would set images here with setImages() + addAndMakeVisible (drawableButton.get()); + */ + + // Labels + titleLabel = std::make_unique