adw-tab-view.h 9.83 KB
Newer Older
Alexander Mikhaylenko's avatar
Alexander Mikhaylenko committed
1
2
3
/*
 * Copyright (C) 2020 Purism SPC
 *
4
 * SPDX-License-Identifier: LGPL-2.1-or-later
Alexander Mikhaylenko's avatar
Alexander Mikhaylenko committed
5
6
7
8
9
10
11
12
13
14
15
16
17
 *
 * Author: Alexander Mikhaylenko <alexander.mikhaylenko@puri.sm>
 */

#pragma once

#if !defined(_ADWAITA_INSIDE) && !defined(ADWAITA_COMPILATION)
#error "Only <adwaita.h> can be included directly."
#endif

#include "adw-version.h"

#include <gtk/gtk.h>
18
#include "adw-enums.h"
Alexander Mikhaylenko's avatar
Alexander Mikhaylenko committed
19
20
21

G_BEGIN_DECLS

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
typedef enum /*< flags >*/ {
  ADW_TAB_VIEW_SHORTCUT_NONE                    = 0,
  ADW_TAB_VIEW_SHORTCUT_CONTROL_TAB             = 1 << 0,
  ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_TAB       = 1 << 1,
  ADW_TAB_VIEW_SHORTCUT_CONTROL_PAGE_UP         = 1 << 2,
  ADW_TAB_VIEW_SHORTCUT_CONTROL_PAGE_DOWN       = 1 << 3,
  ADW_TAB_VIEW_SHORTCUT_CONTROL_HOME            = 1 << 4,
  ADW_TAB_VIEW_SHORTCUT_CONTROL_END             = 1 << 5,
  ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_PAGE_UP   = 1 << 6,
  ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_PAGE_DOWN = 1 << 7,
  ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_HOME      = 1 << 8,
  ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_END       = 1 << 9,
  ADW_TAB_VIEW_SHORTCUT_ALT_DIGITS              = 1 << 10,
  ADW_TAB_VIEW_SHORTCUT_ALT_ZERO                = 1 << 11,
  ADW_TAB_VIEW_SHORTCUT_ALL_SHORTCUTS           = 0xFFF
} AdwTabViewShortcuts;

Alexander Mikhaylenko's avatar
Alexander Mikhaylenko committed
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#define ADW_TYPE_TAB_PAGE (adw_tab_page_get_type())

ADW_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (AdwTabPage, adw_tab_page, ADW, TAB_PAGE, GObject)

ADW_AVAILABLE_IN_ALL
GtkWidget *adw_tab_page_get_child (AdwTabPage *self);

ADW_AVAILABLE_IN_ALL
AdwTabPage *adw_tab_page_get_parent (AdwTabPage *self);

ADW_AVAILABLE_IN_ALL
gboolean adw_tab_page_get_selected (AdwTabPage *self);

ADW_AVAILABLE_IN_ALL
gboolean adw_tab_page_get_pinned (AdwTabPage *self);

ADW_AVAILABLE_IN_ALL
const char *adw_tab_page_get_title (AdwTabPage *self);
ADW_AVAILABLE_IN_ALL
void        adw_tab_page_set_title (AdwTabPage *self,
                                    const char *title);

ADW_AVAILABLE_IN_ALL
63
const char *adw_tab_page_get_tooltip (AdwTabPage *self);
Alexander Mikhaylenko's avatar
Alexander Mikhaylenko committed
64
ADW_AVAILABLE_IN_ALL
65
66
void        adw_tab_page_set_tooltip (AdwTabPage *self,
                                      const char *tooltip);
Alexander Mikhaylenko's avatar
Alexander Mikhaylenko committed
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

ADW_AVAILABLE_IN_ALL
GIcon *adw_tab_page_get_icon (AdwTabPage *self);
ADW_AVAILABLE_IN_ALL
void   adw_tab_page_set_icon (AdwTabPage *self,
                              GIcon      *icon);

ADW_AVAILABLE_IN_ALL
gboolean adw_tab_page_get_loading (AdwTabPage *self);
ADW_AVAILABLE_IN_ALL
void     adw_tab_page_set_loading (AdwTabPage *self,
                                   gboolean    loading);

ADW_AVAILABLE_IN_ALL
GIcon *adw_tab_page_get_indicator_icon (AdwTabPage *self);
ADW_AVAILABLE_IN_ALL
void   adw_tab_page_set_indicator_icon (AdwTabPage *self,
                                        GIcon      *indicator_icon);

86
87
88
89
90
91
ADW_AVAILABLE_IN_1_2
const char *adw_tab_page_get_indicator_tooltip (AdwTabPage *self);
ADW_AVAILABLE_IN_1_2
void        adw_tab_page_set_indicator_tooltip (AdwTabPage *self,
                                                const char *tooltip);

Alexander Mikhaylenko's avatar
Alexander Mikhaylenko committed
92
93
94
95
96
97
98
99
100
101
102
103
ADW_AVAILABLE_IN_ALL
gboolean adw_tab_page_get_indicator_activatable (AdwTabPage *self);
ADW_AVAILABLE_IN_ALL
void     adw_tab_page_set_indicator_activatable (AdwTabPage *self,
                                                 gboolean    activatable);

ADW_AVAILABLE_IN_ALL
gboolean adw_tab_page_get_needs_attention (AdwTabPage *self);
ADW_AVAILABLE_IN_ALL
void     adw_tab_page_set_needs_attention (AdwTabPage *self,
                                           gboolean    needs_attention);

Alexander Mikhaylenko's avatar
Alexander Mikhaylenko committed
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
129
130
ADW_AVAILABLE_IN_1_3
const char *adw_tab_page_get_keyword (AdwTabPage *self);
ADW_AVAILABLE_IN_1_3
void        adw_tab_page_set_keyword (AdwTabPage *self,
                                      const char *keyword);

ADW_AVAILABLE_IN_1_3
float adw_tab_page_get_thumbnail_xalign (AdwTabPage *self);
ADW_AVAILABLE_IN_1_3
void  adw_tab_page_set_thumbnail_xalign (AdwTabPage *self,
                                         float       xalign);

ADW_AVAILABLE_IN_1_3
float adw_tab_page_get_thumbnail_yalign (AdwTabPage *self);
ADW_AVAILABLE_IN_1_3
void  adw_tab_page_set_thumbnail_yalign (AdwTabPage *self,
                                         float       yalign);

ADW_AVAILABLE_IN_1_3
gboolean adw_tab_page_get_live_thumbnail (AdwTabPage *self);
ADW_AVAILABLE_IN_1_3
void     adw_tab_page_set_live_thumbnail (AdwTabPage *self,
                                          gboolean    live_thumbnail);

ADW_AVAILABLE_IN_1_3
void adw_tab_page_invalidate_thumbnail (AdwTabPage *self);

Alexander Mikhaylenko's avatar
Alexander Mikhaylenko committed
131
132
133
134
135
136
#define ADW_TYPE_TAB_VIEW (adw_tab_view_get_type())

ADW_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (AdwTabView, adw_tab_view, ADW, TAB_VIEW, GtkWidget)

ADW_AVAILABLE_IN_ALL
137
AdwTabView *adw_tab_view_new (void) G_GNUC_WARN_UNUSED_RESULT;
Alexander Mikhaylenko's avatar
Alexander Mikhaylenko committed
138
139

ADW_AVAILABLE_IN_ALL
140
int adw_tab_view_get_n_pages        (AdwTabView *self);
Alexander Mikhaylenko's avatar
Alexander Mikhaylenko committed
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
ADW_AVAILABLE_IN_ALL
int adw_tab_view_get_n_pinned_pages (AdwTabView *self);

ADW_AVAILABLE_IN_ALL
gboolean adw_tab_view_get_is_transferring_page (AdwTabView *self);

ADW_AVAILABLE_IN_ALL
AdwTabPage *adw_tab_view_get_selected_page (AdwTabView *self);
ADW_AVAILABLE_IN_ALL
void        adw_tab_view_set_selected_page (AdwTabView *self,
                                            AdwTabPage *selected_page);

ADW_AVAILABLE_IN_ALL
gboolean adw_tab_view_select_previous_page (AdwTabView *self);
ADW_AVAILABLE_IN_ALL
gboolean adw_tab_view_select_next_page     (AdwTabView *self);

ADW_AVAILABLE_IN_ALL
GIcon *adw_tab_view_get_default_icon (AdwTabView *self);
ADW_AVAILABLE_IN_ALL
void   adw_tab_view_set_default_icon (AdwTabView *self,
                                      GIcon      *default_icon);

ADW_AVAILABLE_IN_ALL
GMenuModel *adw_tab_view_get_menu_model (AdwTabView *self);
ADW_AVAILABLE_IN_ALL
void        adw_tab_view_set_menu_model (AdwTabView *self,
                                         GMenuModel *menu_model);

170
171
172
173
174
175
176
177
178
179
180
181
ADW_AVAILABLE_IN_1_2
AdwTabViewShortcuts adw_tab_view_get_shortcuts    (AdwTabView          *self);
ADW_AVAILABLE_IN_1_2
void                adw_tab_view_set_shortcuts    (AdwTabView          *self,
                                                   AdwTabViewShortcuts  shortcuts);
ADW_AVAILABLE_IN_1_2
void                adw_tab_view_add_shortcuts    (AdwTabView          *self,
                                                   AdwTabViewShortcuts  shortcuts);
ADW_AVAILABLE_IN_1_2
void                adw_tab_view_remove_shortcuts (AdwTabView          *self,
                                                   AdwTabViewShortcuts  shortcuts);

Alexander Mikhaylenko's avatar
Alexander Mikhaylenko committed
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
ADW_AVAILABLE_IN_ALL
void adw_tab_view_set_page_pinned (AdwTabView *self,
                                   AdwTabPage *page,
                                   gboolean    pinned);

ADW_AVAILABLE_IN_ALL
AdwTabPage *adw_tab_view_get_page (AdwTabView *self,
                                   GtkWidget  *child);

ADW_AVAILABLE_IN_ALL
AdwTabPage *adw_tab_view_get_nth_page (AdwTabView *self,
                                       int         position);

ADW_AVAILABLE_IN_ALL
int adw_tab_view_get_page_position (AdwTabView *self,
                                    AdwTabPage *page);

ADW_AVAILABLE_IN_ALL
AdwTabPage *adw_tab_view_add_page (AdwTabView *self,
                                   GtkWidget  *child,
                                   AdwTabPage *parent);

ADW_AVAILABLE_IN_ALL
AdwTabPage *adw_tab_view_insert  (AdwTabView *self,
                                  GtkWidget  *child,
                                  int         position);
ADW_AVAILABLE_IN_ALL
AdwTabPage *adw_tab_view_prepend (AdwTabView *self,
                                  GtkWidget  *child);
ADW_AVAILABLE_IN_ALL
AdwTabPage *adw_tab_view_append  (AdwTabView *self,
                                  GtkWidget  *child);

ADW_AVAILABLE_IN_ALL
AdwTabPage *adw_tab_view_insert_pinned  (AdwTabView *self,
                                         GtkWidget  *child,
                                         int         position);
ADW_AVAILABLE_IN_ALL
AdwTabPage *adw_tab_view_prepend_pinned (AdwTabView *self,
                                         GtkWidget  *child);
ADW_AVAILABLE_IN_ALL
AdwTabPage *adw_tab_view_append_pinned  (AdwTabView *self,
                                         GtkWidget  *child);

ADW_AVAILABLE_IN_ALL
void adw_tab_view_close_page        (AdwTabView *self,
                                     AdwTabPage *page);
ADW_AVAILABLE_IN_ALL
void adw_tab_view_close_page_finish (AdwTabView *self,
                                     AdwTabPage *page,
                                     gboolean    confirm);

ADW_AVAILABLE_IN_ALL
void adw_tab_view_close_other_pages  (AdwTabView *self,
                                      AdwTabPage *page);
ADW_AVAILABLE_IN_ALL
void adw_tab_view_close_pages_before (AdwTabView *self,
                                      AdwTabPage *page);
ADW_AVAILABLE_IN_ALL
void adw_tab_view_close_pages_after  (AdwTabView *self,
                                      AdwTabPage *page);

ADW_AVAILABLE_IN_ALL
gboolean adw_tab_view_reorder_page     (AdwTabView *self,
                                        AdwTabPage *page,
                                        int         position);
ADW_AVAILABLE_IN_ALL
gboolean adw_tab_view_reorder_backward (AdwTabView *self,
                                        AdwTabPage *page);
ADW_AVAILABLE_IN_ALL
gboolean adw_tab_view_reorder_forward  (AdwTabView *self,
                                        AdwTabPage *page);
ADW_AVAILABLE_IN_ALL
gboolean adw_tab_view_reorder_first    (AdwTabView *self,
                                        AdwTabPage *page);
ADW_AVAILABLE_IN_ALL
gboolean adw_tab_view_reorder_last     (AdwTabView *self,
                                        AdwTabPage *page);

ADW_AVAILABLE_IN_ALL
void adw_tab_view_transfer_page (AdwTabView *self,
                                 AdwTabPage *page,
                                 AdwTabView *other_view,
                                 int         position);

ADW_AVAILABLE_IN_ALL
268
GtkSelectionModel *adw_tab_view_get_pages (AdwTabView *self) G_GNUC_WARN_UNUSED_RESULT;
Alexander Mikhaylenko's avatar
Alexander Mikhaylenko committed
269

Alexander Mikhaylenko's avatar
Alexander Mikhaylenko committed
270
271
272
ADW_AVAILABLE_IN_1_3
void adw_tab_view_invalidate_thumbnails (AdwTabView *self);

Alexander Mikhaylenko's avatar
Alexander Mikhaylenko committed
273
G_END_DECLS