mousetrap v0.2.0
Loading...
Searching...
No Matches
fixed.hpp
1//
2// Copyright 2022 Clemens Cords
3// Created on 10/27/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 Fixed;
14 namespace detail
15 {
16 using FixedInternal = GtkFixed;
17 DEFINE_INTERNAL_MAPPING(Fixed);
18 }
19 #endif
20
21 /// @brief container that positions a widget at a specific pixel position
22 /// \signals
23 /// \widget_signals{Fixed}
24 class Fixed : public detail::notify_if_gtk_uninitialized,
25 public Widget,
26 HAS_SIGNAL(Fixed, realize),
27 HAS_SIGNAL(Fixed, unrealize),
28 HAS_SIGNAL(Fixed, destroy),
29 HAS_SIGNAL(Fixed, hide),
30 HAS_SIGNAL(Fixed, show),
31 HAS_SIGNAL(Fixed, map),
32 HAS_SIGNAL(Fixed, unmap)
33 {
34 public:
35 /// @brief construct
36 Fixed();
37
38 /// @brief construct from internal
39 Fixed(detail::FixedInternal*);
40
41 /// @brief destructor
42 ~Fixed();
43
44 /// @brief get internal
45 NativeObject get_internal() const override;
46
47 /// @brief add child at specified position
48 /// @param widget
49 /// @param position top left corner, in absolute widget-coordinates, in pixels
50 void add_child(const Widget& widget, Vector2f position);
51
52 /// @brief remove child
53 /// @param widget
54 void remove_child(const Widget& widget);
55
56 /// @brief set child position
57 /// @param widget
58 /// @param position top left corner, in pixels
59 void set_child_position(const Widget& widget, Vector2f position);
60
61 private:
62 detail::FixedInternal* _internal = nullptr;
63 };
64}
container that positions a widget at a specific pixel position
Definition: fixed.hpp:33
void remove_child(const Widget &widget)
remove child
Definition: fixed.cpp:55
~Fixed()
destructor
Definition: fixed.cpp:36
NativeObject get_internal() const override
get internal
Definition: fixed.cpp:41
Fixed()
construct
Definition: fixed.cpp:10
void add_child(const Widget &widget, Vector2f position)
add child at specified position
Definition: fixed.cpp:46
void set_child_position(const Widget &widget, Vector2f position)
set child position
Definition: fixed.cpp:60
Widget, super class of all renderable entities.
Definition: widget.hpp:67