summaryrefslogtreecommitdiff
path: root/adw/include/adwaitamm/entryrow.hpp
blob: 16f0f3b446cdfda80a6fea406c31cb7eb157ae75 (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
/**
 * @author Felix Morgner (felix.morgner@gmail.com)
 * @copyright Copyright (c) 2025
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#ifndef LIBADWAITAMM_ENTRY_ROW_HPP
#define LIBADWAITAMM_ENTRY_ROW_HPP

#include "adwaitamm/helpers/gobj_mixin.hpp"
#include "adwaitamm/preferencesrow.hpp"

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

#include <giomm/listmodel.h>

#include <gtkmm/editable.h>
#include <gtkmm/enums.h>
#include <gtkmm/expression.h>
#include <gtkmm/listitemfactory.h>
#include <gtkmm/stringfilter.h>
#include <gtkmm/widget.h>

#include <glib-object.h>
#include <pangomm/attrlist.h>

#define _ADWAITA_INSIDE
#include <adw-entry-row.h>
#undef _ADWAITA_INSIDE

namespace Adwaita
{
  struct EntryRow : PreferencesRow,
                    Gtk::Editable,
                    helpers::gobj_mixin<EntryRow, AdwEntryRow>
  {
    using BaseObjectType = AdwEntryRow;
    using BaseClassType = AdwEntryRowClass;
    using CppObjectType = struct EntryRow;
    using CppClassType = struct EntryRow_Class;

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

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

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

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

#pragma mark - Functions
    auto add_prefix(Gtk::Widget & widget) -> void;
    auto add_suffix(Gtk::Widget & widget) -> void;
    auto grab_focus_without_selecting() -> bool;
    auto remove(Gtk::Widget & widget) -> void;

#pragma mark - Getters
    [[nodiscard]] auto get_activates_default() const -> bool;
    [[nodiscard]] auto get_attributes() const -> Pango::AttrList;
    [[nodiscard]] auto get_enable_emoji_completion() const -> bool;
    [[nodiscard]] auto get_input_hints() const -> Gtk::InputHints;
    [[nodiscard]] auto get_input_purpose() const -> Gtk::InputPurpose;
    [[nodiscard]] auto get_max_length() const -> int;
    [[nodiscard]] auto get_show_apply_button() const -> bool;
    [[nodiscard]] auto get_text_length() const -> unsigned int;

#pragma mark - Setters
    auto set_activates_default(bool value) -> void;
    auto set_attributes(Pango::AttrList & value) -> void;
    auto set_enable_emoji_completion(bool value) -> void;
    auto set_input_hints(Gtk::InputHints value) -> void;
    auto set_input_purpose(Gtk::InputPurpose value) -> void;
    auto set_max_length(int value) -> void;
    auto set_show_apply_button(bool value) -> void;

#pragma mark - Properties
    [[nodiscard]] auto property_activates_default() -> Glib::PropertyProxy<bool>;
    [[nodiscard]] auto property_activates_default() const -> Glib::PropertyProxy_ReadOnly<bool>;
    [[nodiscard]] auto property_attributes() -> Glib::PropertyProxy<Pango::AttrList>;
    [[nodiscard]] auto property_attributes() const -> Glib::PropertyProxy_ReadOnly<Pango::AttrList>;
    [[nodiscard]] auto property_enable_emoji_completion() -> Glib::PropertyProxy<bool>;
    [[nodiscard]] auto property_enable_emoji_completion() const -> Glib::PropertyProxy_ReadOnly<bool>;
    [[nodiscard]] auto property_input_hints() -> Glib::PropertyProxy<Gtk::InputHints>;
    [[nodiscard]] auto property_input_hints() const -> Glib::PropertyProxy_ReadOnly<Gtk::InputHints>;
    [[nodiscard]] auto property_input_purpose() -> Glib::PropertyProxy<Gtk::InputPurpose>;
    [[nodiscard]] auto property_input_purpose() const -> Glib::PropertyProxy_ReadOnly<Gtk::InputPurpose>;
    [[nodiscard]] auto property_max_length() -> Glib::PropertyProxy<int>;
    [[nodiscard]] auto property_max_length() const -> Glib::PropertyProxy_ReadOnly<int>;
    [[nodiscard]] auto property_show_apply_button() -> Glib::PropertyProxy<bool>;
    [[nodiscard]] auto property_show_apply_button() const -> Glib::PropertyProxy_ReadOnly<bool>;
    [[nodiscard]] auto property_text_length() -> Glib::PropertyProxy_ReadOnly<unsigned int>;

#pragma mark - Signals
    auto signal_apply() -> Glib::SignalProxy<void()>;
    auto signal_entry_activated() -> Glib::SignalProxy<void()>;

  protected:
    friend EntryRow_Class;

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

}  // namespace Adwaita

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

#endif