mousetrap v0.2.0
Loading...
Searching...
No Matches
overlay.hpp
1//
2// Copyright 2022 Clemens Cords
3// Created on 7/31/22 by clem (mail@clemens-cords.com)
4//
5
6#pragma once
7
8#include <mousetrap/widget.hpp>
9
10namespace mousetrap
11{
12 #ifndef DOXYGEN
13 class Overlay;
14 namespace detail
15 {
16 using OverlayInternal = GtkOverlay;
17 DEFINE_INTERNAL_MAPPING(Overlay);
18 }
19 #endif
20
21 /// @brief a widget that allows to display multiple widgets above a common child
22 /// \signals
23 /// \widget_signals{Overlay}
24 class Overlay : public detail::notify_if_gtk_uninitialized,
25 public Widget,
26 HAS_SIGNAL(Overlay, realize),
27 HAS_SIGNAL(Overlay, unrealize),
28 HAS_SIGNAL(Overlay, destroy),
29 HAS_SIGNAL(Overlay, hide),
30 HAS_SIGNAL(Overlay, show),
31 HAS_SIGNAL(Overlay, map),
32 HAS_SIGNAL(Overlay, unmap)
33 {
34 public:
35 /// @brief construct empty
36 Overlay();
37
38 /// @brief construct from internal
39 Overlay(detail::OverlayInternal*);
40
41 /// @brief destructor
42 ~Overlay();
43
44 /// @brief expose internal
45 NativeObject get_internal() const override;
46
47 /// @brief set the bottom-most widget
48 /// @param widget
49 void set_child(const Widget& widget);
50
51 /// @brief remove the bottom-most widget
52 void remove_child();
53
54 /// @brief add a widget on top
55 /// @param widget
56 /// @param included_in_measurement should the entire stacked overlay of widgets be resized if <tt>widget</tt> size exceeds that of the base childs size
57 /// @param clip should the widget be clipped if the overlays size is smaller than that of the overlaid widget
58 void add_overlay(const Widget& widget, bool included_in_measurement = true, bool clip = false);
59
60 /// @brief remove a widget from the overlay, this does not affect the bottom-most child widget
61 /// @param widget
62 void remove_overlay(const Widget& widget);
63
64 private:
65 detail::OverlayInternal* _internal = nullptr;
66 };
67}
68
69
a widget that allows to display multiple widgets above a common child
Definition: overlay.hpp:33
void remove_child()
remove the bottom-most widget
Definition: overlay.cpp:73
void remove_overlay(const Widget &widget)
remove a widget from the overlay, this does not affect the bottom-most child widget
Definition: overlay.cpp:68
Overlay()
construct empty
Definition: overlay.cpp:11
void set_child(const Widget &widget)
set the bottom-most widget
Definition: overlay.cpp:47
void add_overlay(const Widget &widget, bool included_in_measurement=true, bool clip=false)
add a widget on top
Definition: overlay.cpp:56
NativeObject get_internal() const override
expose internal
Definition: overlay.cpp:42
~Overlay()
destructor
Definition: overlay.cpp:37
Widget, super class of all renderable entities.
Definition: widget.hpp:67