summaryrefslogtreecommitdiff
path: root/adw/include/adwaitamm/dialog.hpp
blob: 82e1cd13de94c46f7a5e93b60f10553e1d285dc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/**
 * @author Felix Morgner (felix.morgner@gmail.com)
 * @copyright Copyright (c) 2025
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#ifndef LIBADWAITAMM_DIALOG_HPP
#define LIBADWAITAMM_DIALOG_HPP

#include "adwaitamm/breakpoint.hpp"
#include "adwaitamm/enums.hpp"
#include "helpers/gobj_mixin.hpp"

#include <glibmm/object.h>
#include <glibmm/propertyproxy.h>
#include <glibmm/refptr.h>
#include <glibmm/signalproxy.h>
#include <glibmm/ustring.h>

#include <gtkmm/shortcutmanager.h>
#include <gtkmm/widget.h>

#include <glib-object.h>

#define _ADWAITA_INSIDE
#include <adw-dialog.h>
#undef _ADWAITA_INSIDE

namespace Adwaita
{
  struct Dialog : Gtk::Widget,
                  Gtk::ShortcutManager,
                  helpers::gobj_mixin<Dialog, AdwDialog>
  {

    using BaseObjectType = AdwDialog;
    using BaseClassType = AdwDialogClass;
    using CppObjectType = Dialog;
    using CppClassType = struct Dialog_Class;

    using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj;
    using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj_copy;

#pragma mark - Special Member Functions
    explicit Dialog();
    Dialog(Dialog const & other) = delete;
    Dialog(Dialog && other) noexcept = default;

    auto operator=(Dialog const & other) noexcept -> Dialog & = delete;
    auto operator=(Dialog && other) noexcept -> Dialog & = default;

#pragma mark - GObject Support
    auto static get_type() -> GType;
    auto static get_base_type() -> GType;

#pragma mark - Functions
    auto add_breakpoint(Glib::RefPtr<Breakpoint> const & breakpoint) -> void;
    auto close() -> void;
    auto force_close() -> void;
    auto present(Gtk::Widget * parent) -> void;

#pragma mark - Getters
    [[nodiscard]] auto get_can_close() const -> bool;
    [[nodiscard]] auto get_child() const -> Gtk::Widget *;
    [[nodiscard]] auto get_content_height() const -> int;
    [[nodiscard]] auto get_content_width() const -> int;
    [[nodiscard]] auto get_current_breakpoint() const -> Glib::RefPtr<Breakpoint>;
    [[nodiscard]] auto get_default_widget() const -> Gtk::Widget *;
    [[nodiscard]] auto get_focus() const -> Gtk::Widget *;
    [[nodiscard]] auto get_follows_content_size() const -> bool;
    [[nodiscard]] auto get_presentation_mode() const -> PresentationMode;
    [[nodiscard]] auto get_title() const -> Glib::ustring;

#pragma mark - Setters
    auto set_can_close(bool value) -> void;
    auto set_child(Gtk::Widget & value) -> void;
    auto set_content_height(int value) -> void;
    auto set_content_width(int value) -> void;
    auto set_default_widget(Gtk::Widget & value) -> void;
    auto set_focus(Gtk::Widget & value) -> void;
    auto set_follows_content_size(bool value) -> void;
    auto set_presentation_mode(PresentationMode value) -> void;
    auto set_title(Glib::ustring const & str) -> void;

#pragma mark - Properties
    [[nodiscard]] auto property_can_close() -> Glib::PropertyProxy<bool>;
    [[nodiscard]] auto property_can_close() const -> Glib::PropertyProxy_ReadOnly<bool>;
    [[nodiscard]] auto property_child() -> Glib::PropertyProxy<Gtk::Widget *>;
    [[nodiscard]] auto property_child() const -> Glib::PropertyProxy_ReadOnly<Gtk::Widget *>;
    [[nodiscard]] auto property_content_height() -> Glib::PropertyProxy<int>;
    [[nodiscard]] auto property_content_height() const -> Glib::PropertyProxy_ReadOnly<int>;
    [[nodiscard]] auto property_content_width() -> Glib::PropertyProxy<int>;
    [[nodiscard]] auto property_content_width() const -> Glib::PropertyProxy_ReadOnly<int>;
    [[nodiscard]] auto property_current_breakpoint() const -> Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Breakpoint>>;
    [[nodiscard]] auto property_default_widget() -> Glib::PropertyProxy<Gtk::Widget *>;
    [[nodiscard]] auto property_default_widget() const -> Glib::PropertyProxy_ReadOnly<Gtk::Widget *>;
    [[nodiscard]] auto property_focus_widget() -> Glib::PropertyProxy<Gtk::Widget *>;
    [[nodiscard]] auto property_focus_widget() const -> Glib::PropertyProxy_ReadOnly<Gtk::Widget *>;
    [[nodiscard]] auto property_follows_content_size() -> Glib::PropertyProxy<bool>;
    [[nodiscard]] auto property_follows_content_size() const -> Glib::PropertyProxy_ReadOnly<bool>;
    [[nodiscard]] auto property_presentation_mode() -> Glib::PropertyProxy<PresentationMode>;
    [[nodiscard]] auto property_presentation_mode() const -> Glib::PropertyProxy_ReadOnly<PresentationMode>;
    [[nodiscard]] auto property_title() -> Glib::PropertyProxy<Glib::ustring>;
    [[nodiscard]] auto property_title() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring>;

#pragma mark - Signals
    [[nodiscard]] auto signal_close_attempt() -> Glib::SignalProxy<void()>;
    [[nodiscard]] auto signal_closed() -> Glib::SignalProxy<void()>;

  protected:
    friend Dialog_Class;

#pragma mark - Default Signal Handlers
    auto virtual on_close_attempt() -> void;
    auto virtual on_closed() -> void;

#pragma mark - Internal Constructors
    explicit Dialog(Glib::ConstructParams const & params);
    explicit Dialog(BaseObjectType * gobj);
  };
}  // namespace Adwaita

namespace Glib
{
  auto wrap(AdwDialog * object, bool copy = false) -> Adwaita::Dialog *;
}  // namespace Glib

#endif