diff --git a/dgl/ImageBase.hpp b/dgl/ImageBase.hpp index 36c2ab28..e7e84792 100644 --- a/dgl/ImageBase.hpp +++ b/dgl/ImageBase.hpp @@ -39,7 +39,7 @@ enum ImageFormat { It is an abstract class that provides the common methods to build on top. Cairo and OpenGL Image classes are based upon this one. - @see Image + @see CairoImage, OpenGLImage */ class ImageBase { diff --git a/dgl/ImageBaseWidgets.hpp b/dgl/ImageBaseWidgets.hpp index 44011a92..1a4fbbea 100644 --- a/dgl/ImageBaseWidgets.hpp +++ b/dgl/ImageBaseWidgets.hpp @@ -25,13 +25,36 @@ START_NAMESPACE_DGL // -------------------------------------------------------------------------------------------------------------------- +/** + DGL Image About Window class. + + This is a Window attached (transient) to another Window that simply shows an Image as its content. + It is typically used for "about this project" style pop-up Windows. + + Pressing 'Esc' or clicking anywhere on the window will automatically close it. + + @see CairoImageAboutWindow, OpenGLImageAboutWindow, Window::runAsModal(bool) + */ template class ImageBaseAboutWindow : public StandaloneWindow { public: - explicit ImageBaseAboutWindow(Window& parentWindow, const ImageType& image = ImageType()); - explicit ImageBaseAboutWindow(TopLevelWidget* parentTopLevelWidget, const ImageType& image = ImageType()); - + /** + Constructor taking an existing Window as the parent transient window and an optional image. + If @a image is valid, the about window size will match the image size. + */ + explicit ImageBaseAboutWindow(Window& transientParentWindow, const ImageType& image = ImageType()); + + /** + Constructor taking a top-level-widget's Window as the parent transient window and an optional image. + If @a image is valid, the about window size will match the image size. + */ + explicit ImageBaseAboutWindow(TopLevelWidget* topLevelWidget, const ImageType& image = ImageType()); + + /** + Set a new image to use as background for this window. + Window size will adjust to match the image size. + */ void setImage(const ImageType& image); protected: @@ -47,6 +70,16 @@ private: // -------------------------------------------------------------------------------------------------------------------- +/** + DGL Image Button class. + + This is a typical button, where the drawing comes from a pregenerated set of images. + The button can be under "normal", "hover" and "down" states, with one separate image possible for each. + + The event logic for this button comes from the ButtonEventHandler class. + + @see CairoImageButton, OpenGLImageButton + */ template class ImageBaseButton : public SubWidget, public ButtonEventHandler @@ -81,6 +114,18 @@ private: // -------------------------------------------------------------------------------------------------------------------- +/** + DGL Image Knob class. + + This is a typical knob/dial, where the drawing comes from a pregenerated image "filmstrip". + The knob's "filmstrip" image can be either horizontal or vertical, + with the number of steps automatically based on the largest value (ie, horizontal if width>height, vertical if height>width). + There are no different images for "hover" or "down" states. + + The event logic for this knob comes from the KnobEventHandler class. + + @see CairoImageKnob, OpenGLImageKnob + */ template class ImageBaseKnob : public SubWidget, public KnobEventHandler diff --git a/dgl/NanoVG.hpp b/dgl/NanoVG.hpp index e7f96f13..b3483e97 100644 --- a/dgl/NanoVG.hpp +++ b/dgl/NanoVG.hpp @@ -444,6 +444,11 @@ public: */ void globalAlpha(float alpha); + /** + Sets the color tint applied to all rendered shapes. + */ + void globalTint(Color tint); + /* -------------------------------------------------------------------- * Transforms */ @@ -943,7 +948,6 @@ private: inline void onDisplay() override { // NOTE maybe should use BaseWidget::getWindow().getScaleFactor() as 3rd arg ? - NanoVG::reset(); NanoVG::beginFrame(BaseWidget::getWidth(), BaseWidget::getHeight()); onNanoDisplay(); NanoVG::endFrame(); diff --git a/dgl/src/ImageBaseWidgets.cpp b/dgl/src/ImageBaseWidgets.cpp index 039f7f15..bb16f0ce 100644 --- a/dgl/src/ImageBaseWidgets.cpp +++ b/dgl/src/ImageBaseWidgets.cpp @@ -22,8 +22,8 @@ START_NAMESPACE_DGL // -------------------------------------------------------------------------------------------------------------------- template -ImageBaseAboutWindow::ImageBaseAboutWindow(Window& parentWindow, const ImageType& image) - : StandaloneWindow(parentWindow.getApp(), parentWindow), +ImageBaseAboutWindow::ImageBaseAboutWindow(Window& transientParentWindow, const ImageType& image) + : StandaloneWindow(transientParentWindow.getApp(), transientParentWindow), img(image) { setResizable(false); @@ -39,8 +39,8 @@ ImageBaseAboutWindow::ImageBaseAboutWindow(Window& parentWindow, cons } template -ImageBaseAboutWindow::ImageBaseAboutWindow(TopLevelWidget* const parentTopLevelWidget, const ImageType& image) - : StandaloneWindow(parentTopLevelWidget->getApp(), parentTopLevelWidget->getWindow()), +ImageBaseAboutWindow::ImageBaseAboutWindow(TopLevelWidget* const topLevelWidget, const ImageType& image) + : StandaloneWindow(topLevelWidget->getApp(), topLevelWidget->getWindow()), img(image) { setResizable(false); diff --git a/dgl/src/NanoVG.cpp b/dgl/src/NanoVG.cpp index 1faa60f1..8f6fa854 100644 --- a/dgl/src/NanoVG.cpp +++ b/dgl/src/NanoVG.cpp @@ -513,6 +513,12 @@ void NanoVG::globalAlpha(float alpha) nvgGlobalAlpha(fContext, alpha); } +void NanoVG::globalTint(Color tint) +{ + if (fContext != nullptr) + nvgGlobalTint(fContext, tint); +} + // ----------------------------------------------------------------------- // Transforms