Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
item_factory.h
1// SPDX-FileCopyrightText: © 2021-2024 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
9
10#ifndef __GUI_WIDGETS_ITEM_FACTORY_H__
11#define __GUI_WIDGETS_ITEM_FACTORY_H__
12
13#include <memory>
14#include <string>
15#include <vector>
16
17#include "gui/backend/gtk_widgets/gtk_wrapper.h"
18
29{
30public:
34 enum class Type
35 {
36 Toggle,
37 Text,
38
41
44
47
50
52 Color,
53 };
54
55public:
63 ItemFactory (Type type, bool editable, std::string column_name);
64 ~ItemFactory ();
65
69 static std::unique_ptr<ItemFactory> &generate_and_append_column (
70 GtkColumnView * column_view,
71 std::vector<std::unique_ptr<ItemFactory>> &item_factories,
72 Type type,
73 bool editable,
74 bool resizable,
75 GtkSorter * sorter,
76 std::string column_name);
77
78public:
82 GtkListItemFactory * list_item_factory_ = nullptr;
83
84 Type type_ = Type::Text;
85
86 bool editable_ = false;
87
88 bool ellipsize_label_ = true;
89
90 gulong setup_id_ = 0;
91 gulong bind_id_ = 0;
92 gulong unbind_id_ = 0;
93 gulong teardown_id_ = 0;
94
96 std::string column_name_;
97};
98
99using ItemFactoryPtrVector = std::vector<std::unique_ptr<ItemFactory>>;
100
104
105#endif
ItemFactory(Type type, bool editable, std::string column_name)
Creates a new item factory.
GtkListItemFactory * list_item_factory_
An owned GtkListItemFactory.
static std::unique_ptr< ItemFactory > & generate_and_append_column(GtkColumnView *column_view, std::vector< std::unique_ptr< ItemFactory > > &item_factories, Type type, bool editable, bool resizable, GtkSorter *sorter, std::string column_name)
Shorthand to generate and append a column to a column view.
std::string column_name_
Column name, or empty if used for list views.
Type
Item factory column type.
@ IconAndText
Composite type (eg, used in plugin browser).
@ Position
Position.
@ Integer
Integer display.