@girs/amtk-5 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -0
- package/amtk-5-ambient.d.ts +12 -0
- package/amtk-5-ambient.js +2 -0
- package/amtk-5-import.d.ts +12 -0
- package/amtk-5-import.js +3 -0
- package/amtk-5.d.ts +1219 -0
- package/amtk-5.js +5 -0
- package/index.d.ts +16 -0
- package/index.js +5 -0
- package/package.json +65 -0
- package/tsconfig.json +68 -0
- package/typedoc.json +9 -0
package/amtk-5.d.ts
ADDED
|
@@ -0,0 +1,1219 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Type Definitions for Gjs (https://gjs.guide/)
|
|
4
|
+
*
|
|
5
|
+
* These type definitions are automatically generated, do not edit them by hand.
|
|
6
|
+
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
|
|
7
|
+
*
|
|
8
|
+
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import '@girs/gjs';
|
|
12
|
+
|
|
13
|
+
// Module dependencies
|
|
14
|
+
import type Gtk from '@girs/gtk-3.0';
|
|
15
|
+
import type xlib from '@girs/xlib-2.0';
|
|
16
|
+
import type Gdk from '@girs/gdk-3.0';
|
|
17
|
+
import type cairo from 'cairo';
|
|
18
|
+
import type GObject from '@girs/gobject-2.0';
|
|
19
|
+
import type GLib from '@girs/glib-2.0';
|
|
20
|
+
import type Pango from '@girs/pango-1.0';
|
|
21
|
+
import type HarfBuzz from '@girs/harfbuzz-0.0';
|
|
22
|
+
import type freetype2 from '@girs/freetype2-2.0';
|
|
23
|
+
import type Gio from '@girs/gio-2.0';
|
|
24
|
+
import type GModule from '@girs/gmodule-2.0';
|
|
25
|
+
import type GdkPixbuf from '@girs/gdkpixbuf-2.0';
|
|
26
|
+
import type Atk from '@girs/atk-1.0';
|
|
27
|
+
|
|
28
|
+
export namespace Amtk {
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Amtk-5
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A wrapper function for `g_action_map_add_action_entries()` that checks
|
|
37
|
+
* duplicates.
|
|
38
|
+
*
|
|
39
|
+
* This function first checks - for each entry - that the `action_map` doesn't
|
|
40
|
+
* already contain a {@link Gio.Action} with the same name. A warning is printed if an old
|
|
41
|
+
* action will be dropped. In any case, it then calls
|
|
42
|
+
* `g_action_map_add_action_entries()` with the same arguments as passed to this
|
|
43
|
+
* function.
|
|
44
|
+
*
|
|
45
|
+
* This function also checks if there are duplicates in the `entries` array
|
|
46
|
+
* itself.
|
|
47
|
+
* @param action_map a {@link Gio.ActionMap}.
|
|
48
|
+
* @param entries a pointer to the first item in an array of {@link Gio.ActionEntry} structs.
|
|
49
|
+
* @param user_data the user data for signal connections.
|
|
50
|
+
* @since 2.0
|
|
51
|
+
*/
|
|
52
|
+
function action_map_add_action_entries_check_dups(action_map: Gio.ActionMap, entries: Gio.ActionEntry[], user_data: null): void;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Free the resources allocated by Amtk. For example it unrefs the singleton
|
|
56
|
+
* objects.
|
|
57
|
+
*
|
|
58
|
+
* It is not mandatory to call this function, it's just to be friendlier to
|
|
59
|
+
* memory debugging tools. This function is meant to be called at the end of
|
|
60
|
+
* `main()`. It can be called several times.
|
|
61
|
+
* @since 3.0
|
|
62
|
+
*/
|
|
63
|
+
function finalize(): void;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Like `g_menu_append_item()` but with (transfer full) for the `item` parameter.
|
|
67
|
+
* @param menu a {@link Gio.Menu}.
|
|
68
|
+
* @param item a {@link Gio.MenuItem} to append.
|
|
69
|
+
* @since 5.0
|
|
70
|
+
*/
|
|
71
|
+
function gmenu_append_item(menu: Gio.Menu, item: Gio.MenuItem): void;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Like `g_menu_append_section()` but with (transfer full) and a different type
|
|
75
|
+
* for the `section` parameter, and calls `g_menu_freeze()` on `section`.
|
|
76
|
+
* @param menu a {@link Gio.Menu}.
|
|
77
|
+
* @param label the section label, or `null`.
|
|
78
|
+
* @param section a {@link Gio.Menu} with the items of the section.
|
|
79
|
+
* @since 5.0
|
|
80
|
+
*/
|
|
81
|
+
function gmenu_append_section(menu: Gio.Menu, label: string | null, section: Gio.Menu): void;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Initializes the Amtk library (e.g. for the internationalization).
|
|
85
|
+
*
|
|
86
|
+
* This function can be called several times, but is meant to be called at the
|
|
87
|
+
* beginning of `main()`, before any other Amtk function call.
|
|
88
|
+
* @since 3.0
|
|
89
|
+
*/
|
|
90
|
+
function init(): void;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @param menu_item a {@link Gtk.MenuItem}.
|
|
94
|
+
* @returns the long description of `menu_item`, previously set with `amtk_menu_item_set_long_description()`.
|
|
95
|
+
* @since 2.0
|
|
96
|
+
*/
|
|
97
|
+
function menu_item_get_long_description(menu_item: Gtk.MenuItem): string | null;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Sets an icon to a {@link Gtk.MenuItem}.
|
|
101
|
+
*
|
|
102
|
+
* If the child widget of `item` is already a {@link Gtk.Box}, all {@link Gtk.Image} widgets
|
|
103
|
+
* inside that box are first destroyed. A {@link Gtk.Image} for `icon_name` is then
|
|
104
|
+
* inserted to the box.
|
|
105
|
+
*
|
|
106
|
+
* If the child widget of `item` is not a {@link Gtk.Box} (it's usually the
|
|
107
|
+
* {@link Gtk.AccelLabel}), it is replaced by a new {@link Gtk.Box} and the initial child widget
|
|
108
|
+
* is inserted to the {@link Gtk.Box}, alongside the icon.
|
|
109
|
+
*
|
|
110
|
+
* As a consequence, if you want to call functions on the {@link Gtk.AccelLabel}, it's
|
|
111
|
+
* easier to do it before calling this function.
|
|
112
|
+
* @param item a {@link Gtk.MenuItem}.
|
|
113
|
+
* @param icon_name an icon name.
|
|
114
|
+
* @since 2.0
|
|
115
|
+
* @deprecated since 5.9: Use {@link Gtk.ImageMenuItem} instead, even if deprecated. This function doesn't place the icon at the right place.
|
|
116
|
+
*/
|
|
117
|
+
function menu_item_set_icon_name(item: Gtk.MenuItem, icon_name: string): void;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Sets the long description of `menu_item`. A possible use-case is to display it
|
|
121
|
+
* in a {@link Gtk.Statusbar}, or as a tooltip.
|
|
122
|
+
* @param menu_item a {@link Gtk.MenuItem}.
|
|
123
|
+
* @param long_description the long description, or `null` to unset it.
|
|
124
|
+
* @since 2.0
|
|
125
|
+
*/
|
|
126
|
+
function menu_item_set_long_description(menu_item: Gtk.MenuItem, long_description: string | null): void;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @param title the {@link Gtk.ShortcutsGroup.title}.
|
|
130
|
+
* @returns a new {@link Gtk.ShortcutsGroup}.
|
|
131
|
+
* @since 5.0
|
|
132
|
+
*/
|
|
133
|
+
function shortcuts_group_new(title: string): Gtk.Container;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @param title the {@link Gtk.ShortcutsSection.title}.
|
|
137
|
+
* @returns a new {@link Gtk.ShortcutsSection}.
|
|
138
|
+
* @since 5.0
|
|
139
|
+
*/
|
|
140
|
+
function shortcuts_section_new(title: string): Gtk.Container;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Creates a new {@link Gtk.ShortcutsWindow}. The {@link Gtk.Window.modal} property is set to
|
|
144
|
+
* `true`.
|
|
145
|
+
*
|
|
146
|
+
* It is on purpose that the return type is {@link Gtk.ShortcutsWindow}, not {@link Gtk.Widget}
|
|
147
|
+
* or something else, so in C when you declare the variable as
|
|
148
|
+
* {@link Gtk.ShortcutsWindow} it's easier to find it later (searching "GtkShortcuts"
|
|
149
|
+
* will return something in your codebase).
|
|
150
|
+
* @param parent the {@link Gtk.Window.transient_for}.
|
|
151
|
+
* @returns a new {@link Gtk.ShortcutsWindow}.
|
|
152
|
+
* @since 5.0
|
|
153
|
+
*/
|
|
154
|
+
function shortcuts_window_new(parent: Gtk.Window): Gtk.ShortcutsWindow;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Utility function to be able to port an application gradually to {@link Gio.Action},
|
|
158
|
+
* when {@link Gtk.UIManager} and {@link Gtk.Action} are still used. Porting to {@link Gio.Action} should
|
|
159
|
+
* be the first step.
|
|
160
|
+
*
|
|
161
|
+
* For `detailed_g_action_name_without_prefix`, see the
|
|
162
|
+
* `g_action_parse_detailed_name()` function. The `"app."` or `"win."` prefix (or
|
|
163
|
+
* any other {@link Gio.ActionMap} prefix) must not be included in
|
|
164
|
+
* `detailed_g_action_name_without_prefix`. For example a valid
|
|
165
|
+
* `detailed_g_action_name_without_prefix` is `"open"` or
|
|
166
|
+
* `"insert-command::foobar"`.
|
|
167
|
+
*
|
|
168
|
+
* The same {@link Gio.Action} can be bound to several {@link Gtk.Action}'s (with different
|
|
169
|
+
* parameter values for the {@link Gio.Action}), but the reverse is not true, one
|
|
170
|
+
* {@link Gtk.Action} cannot be bound to several {@link Gio.Action}'s.
|
|
171
|
+
*
|
|
172
|
+
* This function:
|
|
173
|
+
* - Calls `g_action_activate()` when the {@link Gtk.Action} {@link Gtk.Action.SignalSignatures.activate | Gtk.Action::activate} signal
|
|
174
|
+
* is emitted.
|
|
175
|
+
* - Binds the {@link Gio.Action} {@link Gio.Action.enabled} property to the {@link Gtk.Action}
|
|
176
|
+
* {@link Gtk.Action.sensitive} property. The binding is done with the
|
|
177
|
+
* {@link GObject.BindingFlags.BIDIRECTIONAL} and {@link GObject.BindingFlags.SYNC_CREATE} flags, the source is
|
|
178
|
+
* the {@link Gio.Action} and the target is the {@link Gtk.Action}.
|
|
179
|
+
*
|
|
180
|
+
* When using this function, you should set the callback to `null` in the
|
|
181
|
+
* corresponding {@link Gtk.ActionEntry}.
|
|
182
|
+
* @param g_action_map a {@link Gio.ActionMap}.
|
|
183
|
+
* @param detailed_g_action_name_without_prefix a detailed {@link Gio.Action} name without the {@link Gio.ActionMap} prefix; the {@link Gio.Action} must be present in `g_action_map`.
|
|
184
|
+
* @param gtk_action_group a {@link Gtk.ActionGroup}.
|
|
185
|
+
* @param gtk_action_name a {@link Gtk.Action} name present in `gtk_action_group`.
|
|
186
|
+
* @since 4.0
|
|
187
|
+
*/
|
|
188
|
+
function utils_bind_g_action_to_gtk_action(g_action_map: Gio.ActionMap, detailed_g_action_name_without_prefix: string, gtk_action_group: Gtk.ActionGroup, gtk_action_name: string): void;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Utility function to be able to port an application gradually to {@link Gio.Action} and
|
|
192
|
+
* {@link Amtk.ActionInfo}, when {@link Gtk.UIManager} is still used. This function goes one
|
|
193
|
+
* step further compared to `amtk_utils_bind_g_action_to_gtk_action()`. With
|
|
194
|
+
* `amtk_utils_bind_g_action_to_gtk_action()`, only the {@link Gio.Action} must exist. With
|
|
195
|
+
* `amtk_utils_create_gtk_action()`, both the {@link Gio.Action} and {@link Amtk.ActionInfo} must
|
|
196
|
+
* exist (so typically you need to convert the {@link Gtk.ActionEntry}'s into
|
|
197
|
+
* {@link Amtk.ActionInfoEntry}'s).
|
|
198
|
+
*
|
|
199
|
+
* This function creates a {@link Gtk.Action} from a {@link Gio.Action} plus its corresponding
|
|
200
|
+
* {@link Amtk.ActionInfo}.
|
|
201
|
+
*
|
|
202
|
+
* The {@link Gtk.Action} is created with the information provided by the
|
|
203
|
+
* {@link Amtk.ActionInfo} (retrieved with `amtk_action_info_central_store_lookup()` with
|
|
204
|
+
* `detailed_g_action_name_with_prefix` as argument). Only the first accelerator
|
|
205
|
+
* is taken into account.
|
|
206
|
+
*
|
|
207
|
+
* Once the {@link Gtk.Action} is created, it is added to the `gtk_action_group`, and
|
|
208
|
+
* `amtk_utils_bind_g_action_to_gtk_action()` is called.
|
|
209
|
+
* @param g_action_map a {@link Gio.ActionMap}.
|
|
210
|
+
* @param detailed_g_action_name_with_prefix a detailed {@link Gio.Action} name with the {@link Gio.ActionMap} prefix; the {@link Gio.Action} must be present in `g_action_map`.
|
|
211
|
+
* @param gtk_action_group a {@link Gtk.ActionGroup}.
|
|
212
|
+
* @param gtk_action_name the name of the {@link Gtk.Action} to create and add to `gtk_action_group`.
|
|
213
|
+
* @since 4.0
|
|
214
|
+
*/
|
|
215
|
+
function utils_create_gtk_action(g_action_map: Gio.ActionMap, detailed_g_action_name_with_prefix: string, gtk_action_group: Gtk.ActionGroup, gtk_action_name: string): void;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* This function wraps `menubar` into a container, to allow the menubar to shrink
|
|
219
|
+
* below its minimum width.
|
|
220
|
+
*
|
|
221
|
+
* A possible use-case: have two applications side-by-side on a single screen.
|
|
222
|
+
* @param menubar a {@link Gtk.MenuBar}.
|
|
223
|
+
* @returns a new widget that contains `menubar`.
|
|
224
|
+
* @since 5.6
|
|
225
|
+
*/
|
|
226
|
+
function utils_get_shrinkable_menubar(menubar: Gtk.MenuBar): Gtk.Widget;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Gets the URI of `item`. `item` must be a child of `menu`. `menu` must be a
|
|
230
|
+
* {@link Gtk.RecentChooserMenu}.
|
|
231
|
+
*
|
|
232
|
+
* This function has been written because the value returned by
|
|
233
|
+
* `gtk_recent_chooser_get_current_uri()` is not updated when {@link Gtk.MenuItem}'s of a
|
|
234
|
+
* {@link Gtk.RecentChooserMenu} are selected/deselected.
|
|
235
|
+
* @param menu a {@link Gtk.RecentChooserMenu}.
|
|
236
|
+
* @param item a {@link Gtk.MenuItem}.
|
|
237
|
+
* @returns the URI of `item`. Free with `g_free()` when no longer needed.
|
|
238
|
+
* @since 2.0
|
|
239
|
+
*/
|
|
240
|
+
function utils_recent_chooser_menu_get_item_uri(menu: Gtk.RecentChooserMenu, item: Gtk.MenuItem): string;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Removes the mnemonics from `str`. Single underscores are removed, and two
|
|
244
|
+
* consecutive underscores are replaced by one underscore (see the documentation
|
|
245
|
+
* of `gtk_label_new_with_mnemonic()`).
|
|
246
|
+
* @param str a string.
|
|
247
|
+
* @returns the new string with the mnemonics removed. Free with `g_free()` when no longer needed.
|
|
248
|
+
* @since 5.0
|
|
249
|
+
*/
|
|
250
|
+
function utils_remove_mnemonic(str: string): string;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* @gir-type Flags
|
|
254
|
+
*/
|
|
255
|
+
export namespace FactoryFlags {
|
|
256
|
+
export const $gtype: GObject.GType<FactoryFlags>;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* {@link Amtk.FactoryFlags} permits to control how a factory function creates the
|
|
261
|
+
* object, to ignore some steps.
|
|
262
|
+
* @gir-type Flags
|
|
263
|
+
* @since 3.0
|
|
264
|
+
*/
|
|
265
|
+
enum FactoryFlags {
|
|
266
|
+
/**
|
|
267
|
+
* No flags.
|
|
268
|
+
*/
|
|
269
|
+
FLAGS_NONE,
|
|
270
|
+
/**
|
|
271
|
+
* Do not associate the created object with the
|
|
272
|
+
* {@link Gio.Action}. For example if the object to create is a {@link Gtk.Actionable}, do not
|
|
273
|
+
* call `gtk_actionable_set_detailed_action_name()`.
|
|
274
|
+
*/
|
|
275
|
+
IGNORE_GACTION,
|
|
276
|
+
/**
|
|
277
|
+
* Do not set an icon.
|
|
278
|
+
*/
|
|
279
|
+
IGNORE_ICON,
|
|
280
|
+
/**
|
|
281
|
+
* Do not set a label/short description.
|
|
282
|
+
*/
|
|
283
|
+
IGNORE_LABEL,
|
|
284
|
+
/**
|
|
285
|
+
* Do not set a tooltip/long description.
|
|
286
|
+
*/
|
|
287
|
+
IGNORE_TOOLTIP,
|
|
288
|
+
/**
|
|
289
|
+
* Ignore completely the accelerators.
|
|
290
|
+
*/
|
|
291
|
+
IGNORE_ACCELS,
|
|
292
|
+
/**
|
|
293
|
+
* Ignore the accelerators for
|
|
294
|
+
* documentation purposes only. For example do not add/configure a
|
|
295
|
+
* {@link Gtk.AccelLabel}.
|
|
296
|
+
*/
|
|
297
|
+
IGNORE_ACCELS_FOR_DOC,
|
|
298
|
+
/**
|
|
299
|
+
* Do not call
|
|
300
|
+
* `gtk_application_set_accels_for_action()`.
|
|
301
|
+
*/
|
|
302
|
+
IGNORE_ACCELS_FOR_APP,
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
namespace ActionInfoCentralStore {
|
|
307
|
+
// Signal signatures
|
|
308
|
+
interface SignalSignatures extends GObject.Object.SignalSignatures {}
|
|
309
|
+
|
|
310
|
+
// Constructor properties interface
|
|
311
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* @gir-type Class
|
|
316
|
+
*/
|
|
317
|
+
class ActionInfoCentralStore extends GObject.Object {
|
|
318
|
+
static $gtype: GObject.GType<ActionInfoCentralStore>;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Compile-time signal type information.
|
|
322
|
+
*
|
|
323
|
+
* This instance property is generated only for TypeScript type checking.
|
|
324
|
+
* It is not defined at runtime and should not be accessed in JS code.
|
|
325
|
+
* @internal
|
|
326
|
+
*/
|
|
327
|
+
$signals: ActionInfoCentralStore.SignalSignatures;
|
|
328
|
+
|
|
329
|
+
// Constructors
|
|
330
|
+
constructor(properties?: Partial<ActionInfoCentralStore.ConstructorProps>, ...args: any[]);
|
|
331
|
+
|
|
332
|
+
_init(...args: any[]): void;
|
|
333
|
+
|
|
334
|
+
// Signals
|
|
335
|
+
/** @signal */
|
|
336
|
+
connect<K extends keyof ActionInfoCentralStore.SignalSignatures>(signal: K, callback: GObject.SignalCallback<this, ActionInfoCentralStore.SignalSignatures[K]>): number;
|
|
337
|
+
connect(signal: string, callback: (...args: any[]) => any): number;
|
|
338
|
+
|
|
339
|
+
/** @signal */
|
|
340
|
+
connect_after<K extends keyof ActionInfoCentralStore.SignalSignatures>(signal: K, callback: GObject.SignalCallback<this, ActionInfoCentralStore.SignalSignatures[K]>): number;
|
|
341
|
+
connect_after(signal: string, callback: (...args: any[]) => any): number;
|
|
342
|
+
|
|
343
|
+
/** @signal */
|
|
344
|
+
emit<K extends keyof ActionInfoCentralStore.SignalSignatures>(signal: K, ...args: GObject.GjsParameters<ActionInfoCentralStore.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never): void;
|
|
345
|
+
emit(signal: string, ...args: any[]): void;
|
|
346
|
+
|
|
347
|
+
// Static methods
|
|
348
|
+
static get_singleton(): ActionInfoCentralStore;
|
|
349
|
+
|
|
350
|
+
// Methods
|
|
351
|
+
/**
|
|
352
|
+
* @param action_name an action name.
|
|
353
|
+
* @returns the found {@link Amtk.ActionInfo}, or `null`.
|
|
354
|
+
*/
|
|
355
|
+
lookup(action_name: string): ActionInfo;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
namespace ActionInfoStore {
|
|
360
|
+
// Signal signatures
|
|
361
|
+
interface SignalSignatures extends GObject.Object.SignalSignatures {}
|
|
362
|
+
|
|
363
|
+
// Constructor properties interface
|
|
364
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* @gir-type Class
|
|
369
|
+
*/
|
|
370
|
+
class ActionInfoStore extends GObject.Object {
|
|
371
|
+
static $gtype: GObject.GType<ActionInfoStore>;
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Compile-time signal type information.
|
|
375
|
+
*
|
|
376
|
+
* This instance property is generated only for TypeScript type checking.
|
|
377
|
+
* It is not defined at runtime and should not be accessed in JS code.
|
|
378
|
+
* @internal
|
|
379
|
+
*/
|
|
380
|
+
$signals: ActionInfoStore.SignalSignatures;
|
|
381
|
+
|
|
382
|
+
// Constructors
|
|
383
|
+
constructor(properties?: Partial<ActionInfoStore.ConstructorProps>, ...args: any[]);
|
|
384
|
+
|
|
385
|
+
_init(...args: any[]): void;
|
|
386
|
+
|
|
387
|
+
static ["new"](): ActionInfoStore;
|
|
388
|
+
|
|
389
|
+
// Signals
|
|
390
|
+
/** @signal */
|
|
391
|
+
connect<K extends keyof ActionInfoStore.SignalSignatures>(signal: K, callback: GObject.SignalCallback<this, ActionInfoStore.SignalSignatures[K]>): number;
|
|
392
|
+
connect(signal: string, callback: (...args: any[]) => any): number;
|
|
393
|
+
|
|
394
|
+
/** @signal */
|
|
395
|
+
connect_after<K extends keyof ActionInfoStore.SignalSignatures>(signal: K, callback: GObject.SignalCallback<this, ActionInfoStore.SignalSignatures[K]>): number;
|
|
396
|
+
connect_after(signal: string, callback: (...args: any[]) => any): number;
|
|
397
|
+
|
|
398
|
+
/** @signal */
|
|
399
|
+
emit<K extends keyof ActionInfoStore.SignalSignatures>(signal: K, ...args: GObject.GjsParameters<ActionInfoStore.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never): void;
|
|
400
|
+
emit(signal: string, ...args: any[]): void;
|
|
401
|
+
|
|
402
|
+
// Methods
|
|
403
|
+
/**
|
|
404
|
+
* Inserts `info` into `store` and into the {@link Amtk.ActionInfoCentralStore}. Both the
|
|
405
|
+
* `store` and central store must <emphasis>not</emphasis> already contain an
|
|
406
|
+
* {@link Amtk.ActionInfo} with the same action name. The stores take their own
|
|
407
|
+
* reference on `info`.
|
|
408
|
+
* @param info an {@link Amtk.ActionInfo}.
|
|
409
|
+
*/
|
|
410
|
+
add(info: ActionInfo): void;
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Calls `amtk_action_info_store_add()` for each entry.
|
|
414
|
+
*
|
|
415
|
+
* If `translation_domain` is not `null`, `g_dgettext()` is used to translate the
|
|
416
|
+
* `label` and `tooltip` of each entry before setting them to the {@link Amtk.ActionInfo}.
|
|
417
|
+
*
|
|
418
|
+
* An API similar to `g_action_map_add_action_entries()`.
|
|
419
|
+
* @param entries a pointer to the first item in an array of {@link Amtk.ActionInfoEntry} structs.
|
|
420
|
+
* @param translation_domain a gettext domain, or `null`.
|
|
421
|
+
*/
|
|
422
|
+
add_entries(entries: ActionInfoEntry[], translation_domain: string | null): void;
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Checks for each {@link Amtk.ActionInfo} of `store` that it has been used (see
|
|
426
|
+
* `amtk_action_info_has_been_used()`). If an {@link Amtk.ActionInfo} has not been used, a
|
|
427
|
+
* warning is printed and might indicate dead code.
|
|
428
|
+
*
|
|
429
|
+
* You probably want to call this function on the application store after
|
|
430
|
+
* creating the menu and toolbar. But it can also be useful for a store provided
|
|
431
|
+
* by a library, to easily see which actions are not used by the application.
|
|
432
|
+
*/
|
|
433
|
+
check_all_used(): void;
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* @param action_name an action name.
|
|
437
|
+
* @returns the found {@link Amtk.ActionInfo}, or `null`.
|
|
438
|
+
*/
|
|
439
|
+
lookup(action_name: string): ActionInfo;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Calls `gtk_application_set_accels_for_action()` for all {@link Amtk.ActionInfo}'s part
|
|
443
|
+
* of `store` with the accelerators returned by `amtk_action_info_get_accels()`.
|
|
444
|
+
* This function does *not* call `amtk_action_info_mark_as_used()`, because if it
|
|
445
|
+
* did it would not be possible to detect dead code in `store` with
|
|
446
|
+
* `amtk_action_info_store_check_all_used()`.
|
|
447
|
+
*
|
|
448
|
+
* This function is not recommended if `store` is provided by a library, because
|
|
449
|
+
* a future version of the library may add accelerators that are not wanted in
|
|
450
|
+
* the application. So for a library store, you should let {@link Amtk.Factory} call
|
|
451
|
+
* `gtk_application_set_accels_for_action()`.
|
|
452
|
+
*
|
|
453
|
+
* This function can be convenient for an application store, in combination with
|
|
454
|
+
* {@link Amtk.FactoryFlags.IGNORE_ACCELS_FOR_APP} (and/or having a `null` {@link Gtk.Application} in
|
|
455
|
+
* {@link Amtk.Factory}). It has the advantage that
|
|
456
|
+
* `gtk_application_set_accels_for_action()` is called only once per action, not
|
|
457
|
+
* each time that a {@link Gtk.ApplicationWindow} is created.
|
|
458
|
+
*
|
|
459
|
+
* This function can also be useful if – for some actions – the objects are not
|
|
460
|
+
* created directly with {@link Amtk.Factory} on application startup, but are created
|
|
461
|
+
* later, on demand. For example to create a {@link Gtk.ShortcutsWindow} with
|
|
462
|
+
* {@link Amtk.Factory}, containing information about actions that are not added to any
|
|
463
|
+
* menu or toolbar.
|
|
464
|
+
* @param application a {@link Gtk.Application}.
|
|
465
|
+
*/
|
|
466
|
+
set_all_accels_to_app(application: Gtk.Application): void;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
namespace ApplicationWindow {
|
|
471
|
+
// Signal signatures
|
|
472
|
+
interface SignalSignatures extends GObject.Object.SignalSignatures {
|
|
473
|
+
"notify::application-window": (pspec: GObject.ParamSpec) => void;
|
|
474
|
+
"notify::statusbar": (pspec: GObject.ParamSpec) => void;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// Constructor properties interface
|
|
478
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
479
|
+
application_window: Gtk.ApplicationWindow;
|
|
480
|
+
applicationWindow: Gtk.ApplicationWindow;
|
|
481
|
+
statusbar: Gtk.Statusbar | null;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* @gir-type Class
|
|
487
|
+
*/
|
|
488
|
+
class ApplicationWindow extends GObject.Object {
|
|
489
|
+
static $gtype: GObject.GType<ApplicationWindow>;
|
|
490
|
+
|
|
491
|
+
// Properties
|
|
492
|
+
/**
|
|
493
|
+
* The {@link Gtk.ApplicationWindow}.
|
|
494
|
+
* @since 2.0
|
|
495
|
+
* @construct-only
|
|
496
|
+
*/
|
|
497
|
+
get application_window(): Gtk.ApplicationWindow;
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* The {@link Gtk.ApplicationWindow}.
|
|
501
|
+
* @since 2.0
|
|
502
|
+
* @construct-only
|
|
503
|
+
*/
|
|
504
|
+
get applicationWindow(): Gtk.ApplicationWindow;
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* The {@link Gtk.Statusbar}. `null` by default.
|
|
508
|
+
* @since 2.0
|
|
509
|
+
*/
|
|
510
|
+
get statusbar(): Gtk.Statusbar | null;
|
|
511
|
+
set statusbar(val: Gtk.Statusbar | null);
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Compile-time signal type information.
|
|
515
|
+
*
|
|
516
|
+
* This instance property is generated only for TypeScript type checking.
|
|
517
|
+
* It is not defined at runtime and should not be accessed in JS code.
|
|
518
|
+
* @internal
|
|
519
|
+
*/
|
|
520
|
+
$signals: ApplicationWindow.SignalSignatures;
|
|
521
|
+
|
|
522
|
+
// Constructors
|
|
523
|
+
constructor(properties?: Partial<ApplicationWindow.ConstructorProps>, ...args: any[]);
|
|
524
|
+
|
|
525
|
+
_init(...args: any[]): void;
|
|
526
|
+
|
|
527
|
+
// Signals
|
|
528
|
+
/** @signal */
|
|
529
|
+
connect<K extends keyof ApplicationWindow.SignalSignatures>(signal: K, callback: GObject.SignalCallback<this, ApplicationWindow.SignalSignatures[K]>): number;
|
|
530
|
+
connect(signal: string, callback: (...args: any[]) => any): number;
|
|
531
|
+
|
|
532
|
+
/** @signal */
|
|
533
|
+
connect_after<K extends keyof ApplicationWindow.SignalSignatures>(signal: K, callback: GObject.SignalCallback<this, ApplicationWindow.SignalSignatures[K]>): number;
|
|
534
|
+
connect_after(signal: string, callback: (...args: any[]) => any): number;
|
|
535
|
+
|
|
536
|
+
/** @signal */
|
|
537
|
+
emit<K extends keyof ApplicationWindow.SignalSignatures>(signal: K, ...args: GObject.GjsParameters<ApplicationWindow.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never): void;
|
|
538
|
+
emit(signal: string, ...args: any[]): void;
|
|
539
|
+
|
|
540
|
+
// Static methods
|
|
541
|
+
/**
|
|
542
|
+
* Creates the base of a simple and generic {@link Gtk.RecentChooserMenu}.
|
|
543
|
+
*
|
|
544
|
+
* The {@link Gtk.RecentChooser} is configured to show files only recently used with the
|
|
545
|
+
* current application, as returned by `g_get_application_name()`. If recent files
|
|
546
|
+
* are added to the default {@link Gtk.RecentManager} with
|
|
547
|
+
* `gtk_recent_manager_add_item()`, the files will normally show up in the
|
|
548
|
+
* {@link Gtk.RecentChooserMenu}.
|
|
549
|
+
*/
|
|
550
|
+
static create_open_recent_menu_base(): Gtk.RecentChooserMenu;
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Returns the {@link Amtk.ApplicationWindow} of `gtk_window`. The returned object is
|
|
554
|
+
* guaranteed to be the same for the lifetime of `gtk_window`.
|
|
555
|
+
* @param gtk_window a {@link Gtk.ApplicationWindow}.
|
|
556
|
+
*/
|
|
557
|
+
static get_from_gtk_application_window(gtk_window: Gtk.ApplicationWindow): ApplicationWindow;
|
|
558
|
+
|
|
559
|
+
// Methods
|
|
560
|
+
/**
|
|
561
|
+
* Connects to the {@link Amtk.MenuShell.SignalSignatures.menu_item_selected | Amtk.MenuShell::menu-item-selected} and
|
|
562
|
+
* {@link Amtk.MenuShell.SignalSignatures.menu_item_deselected | Amtk.MenuShell::menu-item-deselected} signals of `menu_shell` to push/pop the
|
|
563
|
+
* long description of {@link Gtk.MenuItem}'s to the {@link Amtk.ApplicationWindow.statusbar}.
|
|
564
|
+
*
|
|
565
|
+
* The long description is retrieved with `amtk_menu_item_get_long_description()`.
|
|
566
|
+
* So `amtk_menu_item_set_long_description()` must have been called, which is the
|
|
567
|
+
* case if the {@link Gtk.MenuItem} has been created with {@link Amtk.Factory}.
|
|
568
|
+
* @param menu_shell a {@link Gtk.MenuShell}.
|
|
569
|
+
*/
|
|
570
|
+
connect_menu_to_statusbar(menu_shell: Gtk.MenuShell): void;
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* An alternative to `gtk_recent_chooser_set_show_tips()`. Shows the full path in
|
|
574
|
+
* the {@link Amtk.ApplicationWindow.statusbar} when a {@link Gtk.MenuItem} of `menu` is
|
|
575
|
+
* selected.
|
|
576
|
+
*
|
|
577
|
+
* The full path is retrieved with
|
|
578
|
+
* `amtk_utils_recent_chooser_menu_get_item_uri()`.
|
|
579
|
+
* @param menu a {@link Gtk.RecentChooserMenu}.
|
|
580
|
+
*/
|
|
581
|
+
connect_recent_chooser_menu_to_statusbar(menu: Gtk.RecentChooserMenu): void;
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* This function creates a {@link Gtk.RecentChooserMenu} with
|
|
585
|
+
* `amtk_application_window_create_open_recent_menu_base()`, and setup these
|
|
586
|
+
* additional things:
|
|
587
|
+
*
|
|
588
|
+
* - The {@link Gtk.RecentChooserMenu} is connected to the statusbar with
|
|
589
|
+
* `amtk_application_window_connect_recent_chooser_menu_to_statusbar()`.
|
|
590
|
+
*
|
|
591
|
+
* - When the {@link Gtk.RecentChooser.SignalSignatures.item_activated | Gtk.RecentChooser::item-activated} signal is emitted,
|
|
592
|
+
* `g_application_open()` is called (with an empty hint), so the {@link Gio.Application}
|
|
593
|
+
* must have the {@link Gio.ApplicationFlags.HANDLES_OPEN} flag set.
|
|
594
|
+
* @returns a new {@link Gtk.RecentChooserMenu}.
|
|
595
|
+
*/
|
|
596
|
+
create_open_recent_menu(): Gtk.Widget;
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Creates a {@link Gtk.MenuItem} with a simple and generic {@link Gtk.RecentChooserMenu} as
|
|
600
|
+
* submenu. The {@link Gtk.RecentChooserMenu} is created with
|
|
601
|
+
* `amtk_application_window_create_open_recent_menu()`.
|
|
602
|
+
* @returns a new {@link Gtk.MenuItem}.
|
|
603
|
+
*/
|
|
604
|
+
create_open_recent_menu_item(): Gtk.Widget;
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* @returns the {@link Gtk.ApplicationWindow} of `amtk_window`.
|
|
608
|
+
*/
|
|
609
|
+
get_application_window(): Gtk.ApplicationWindow;
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* @returns the {@link Amtk.ApplicationWindow.statusbar}.
|
|
613
|
+
*/
|
|
614
|
+
get_statusbar(): Gtk.Statusbar | null;
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Sets the {@link Amtk.ApplicationWindow.statusbar} property.
|
|
618
|
+
* @param statusbar a {@link Gtk.Statusbar}, or `null`.
|
|
619
|
+
*/
|
|
620
|
+
set_statusbar(statusbar: Gtk.Statusbar | null): void;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
namespace Factory {
|
|
625
|
+
// Signal signatures
|
|
626
|
+
interface SignalSignatures extends GObject.Object.SignalSignatures {
|
|
627
|
+
"notify::application": (pspec: GObject.ParamSpec) => void;
|
|
628
|
+
"notify::default-flags": (pspec: GObject.ParamSpec) => void;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
// Constructor properties interface
|
|
632
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
633
|
+
application: Gtk.Application | null;
|
|
634
|
+
default_flags: FactoryFlags;
|
|
635
|
+
defaultFlags: FactoryFlags;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* @gir-type Class
|
|
641
|
+
*/
|
|
642
|
+
class Factory extends GObject.Object {
|
|
643
|
+
static $gtype: GObject.GType<Factory>;
|
|
644
|
+
|
|
645
|
+
// Properties
|
|
646
|
+
/**
|
|
647
|
+
* The associated {@link Gtk.Application} (it is optional, it can be `null`).
|
|
648
|
+
* {@link Amtk.Factory} has a weak reference to the {@link Gtk.Application}.
|
|
649
|
+
* @since 3.0
|
|
650
|
+
* @construct-only
|
|
651
|
+
*/
|
|
652
|
+
get application(): Gtk.Application | null;
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* The default {@link Amtk.FactoryFlags}.
|
|
656
|
+
* @since 3.0
|
|
657
|
+
* @default Amtk.FactoryFlags.FLAGS_NONE
|
|
658
|
+
*/
|
|
659
|
+
get default_flags(): FactoryFlags;
|
|
660
|
+
set default_flags(val: FactoryFlags);
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* The default {@link Amtk.FactoryFlags}.
|
|
664
|
+
* @since 3.0
|
|
665
|
+
* @default Amtk.FactoryFlags.FLAGS_NONE
|
|
666
|
+
*/
|
|
667
|
+
get defaultFlags(): FactoryFlags;
|
|
668
|
+
set defaultFlags(val: FactoryFlags);
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Compile-time signal type information.
|
|
672
|
+
*
|
|
673
|
+
* This instance property is generated only for TypeScript type checking.
|
|
674
|
+
* It is not defined at runtime and should not be accessed in JS code.
|
|
675
|
+
* @internal
|
|
676
|
+
*/
|
|
677
|
+
$signals: Factory.SignalSignatures;
|
|
678
|
+
|
|
679
|
+
// Constructors
|
|
680
|
+
constructor(properties?: Partial<Factory.ConstructorProps>, ...args: any[]);
|
|
681
|
+
|
|
682
|
+
_init(...args: any[]): void;
|
|
683
|
+
|
|
684
|
+
static ["new"](application: Gtk.Application | null): Factory;
|
|
685
|
+
|
|
686
|
+
static new_with_default_application(): Factory;
|
|
687
|
+
|
|
688
|
+
// Signals
|
|
689
|
+
/** @signal */
|
|
690
|
+
connect<K extends keyof Factory.SignalSignatures>(signal: K, callback: GObject.SignalCallback<this, Factory.SignalSignatures[K]>): number;
|
|
691
|
+
connect(signal: string, callback: (...args: any[]) => any): number;
|
|
692
|
+
|
|
693
|
+
/** @signal */
|
|
694
|
+
connect_after<K extends keyof Factory.SignalSignatures>(signal: K, callback: GObject.SignalCallback<this, Factory.SignalSignatures[K]>): number;
|
|
695
|
+
connect_after(signal: string, callback: (...args: any[]) => any): number;
|
|
696
|
+
|
|
697
|
+
/** @signal */
|
|
698
|
+
emit<K extends keyof Factory.SignalSignatures>(signal: K, ...args: GObject.GjsParameters<Factory.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never): void;
|
|
699
|
+
emit(signal: string, ...args: any[]): void;
|
|
700
|
+
|
|
701
|
+
// Methods
|
|
702
|
+
/**
|
|
703
|
+
* Creates a new {@link Gtk.CheckMenuItem} for `action_name` with the
|
|
704
|
+
* {@link Amtk.Factory.default_flags}.
|
|
705
|
+
*
|
|
706
|
+
* See the documentation of `amtk_factory_create_check_menu_item_full()` for more
|
|
707
|
+
* information.
|
|
708
|
+
* @param action_name an action name.
|
|
709
|
+
* @returns a new {@link Gtk.CheckMenuItem} for `action_name`.
|
|
710
|
+
*/
|
|
711
|
+
create_check_menu_item(action_name: string): Gtk.Widget;
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* This function ignores the {@link Amtk.Factory.default_flags} property and takes the
|
|
715
|
+
* `flags` argument instead.
|
|
716
|
+
*
|
|
717
|
+
* Note that since it is a {@link Gtk.CheckMenuItem} the icon is not set, even if it
|
|
718
|
+
* would be possible with `amtk_menu_item_set_icon_name()`.
|
|
719
|
+
*
|
|
720
|
+
* If the action controls a boolean property, think about using
|
|
721
|
+
* {@link Gio.PropertyAction}.
|
|
722
|
+
* @param action_name an action name.
|
|
723
|
+
* @param flags {@link Amtk.FactoryFlags}.
|
|
724
|
+
* @returns a new {@link Gtk.CheckMenuItem} for `action_name`.
|
|
725
|
+
*/
|
|
726
|
+
create_check_menu_item_full(action_name: string, flags: FactoryFlags): Gtk.Widget;
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Calls `amtk_factory_create_gmenu_item_full()` with the
|
|
730
|
+
* {@link Amtk.Factory.default_flags}.
|
|
731
|
+
* @param action_name an action name.
|
|
732
|
+
* @returns a new {@link Gio.MenuItem} for `action_name`.
|
|
733
|
+
*/
|
|
734
|
+
create_gmenu_item(action_name: string): Gio.MenuItem;
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* This function ignores the {@link Amtk.Factory.default_flags} property and takes the
|
|
738
|
+
* `flags` argument instead.
|
|
739
|
+
*
|
|
740
|
+
* Creates a new {@link Gio.MenuItem} for `action_name`. It ignores the tooltip, i.e. the
|
|
741
|
+
* return value of `amtk_action_info_get_tooltip()`.
|
|
742
|
+
* @param action_name an action name.
|
|
743
|
+
* @param flags {@link Amtk.FactoryFlags}.
|
|
744
|
+
* @returns a new {@link Gio.MenuItem} for `action_name`.
|
|
745
|
+
*/
|
|
746
|
+
create_gmenu_item_full(action_name: string, flags: FactoryFlags): Gio.MenuItem;
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* Creates a new {@link Gtk.MenuItem} for `action_name` with the
|
|
750
|
+
* {@link Amtk.Factory.default_flags}.
|
|
751
|
+
* @param action_name an action name.
|
|
752
|
+
* @returns a new {@link Gtk.MenuItem} for `action_name`.
|
|
753
|
+
*/
|
|
754
|
+
create_menu_item(action_name: string): Gtk.Widget;
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* This function ignores the {@link Amtk.Factory.default_flags} property and takes the
|
|
758
|
+
* `flags` argument instead.
|
|
759
|
+
* @param action_name an action name.
|
|
760
|
+
* @param flags {@link Amtk.FactoryFlags}.
|
|
761
|
+
* @returns a new {@link Gtk.MenuItem} for `action_name`.
|
|
762
|
+
*/
|
|
763
|
+
create_menu_item_full(action_name: string, flags: FactoryFlags): Gtk.Widget;
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Creates a new {@link Gtk.MenuToolButton} for `action_name` with the
|
|
767
|
+
* {@link Amtk.Factory.default_flags}.
|
|
768
|
+
*
|
|
769
|
+
* See the documentation of `amtk_factory_create_menu_tool_button_full()` for more
|
|
770
|
+
* information.
|
|
771
|
+
* @param action_name an action name.
|
|
772
|
+
* @returns a new {@link Gtk.MenuToolButton} for `action_name`.
|
|
773
|
+
*/
|
|
774
|
+
create_menu_tool_button(action_name: string): Gtk.MenuToolButton;
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* This function ignores the {@link Amtk.Factory.default_flags} property and takes the
|
|
778
|
+
* `flags` argument instead.
|
|
779
|
+
*
|
|
780
|
+
* After calling this function, you need to use the {@link Gtk.MenuToolButton} API to
|
|
781
|
+
* set the menu and also possibly set a tooltip to the arrow.
|
|
782
|
+
* @param action_name an action name.
|
|
783
|
+
* @param flags {@link Amtk.FactoryFlags}.
|
|
784
|
+
* @returns a new {@link Gtk.MenuToolButton} for `action_name`.
|
|
785
|
+
*/
|
|
786
|
+
create_menu_tool_button_full(action_name: string, flags: FactoryFlags): Gtk.MenuToolButton;
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Calls `amtk_factory_create_shortcut_full()` with the
|
|
790
|
+
* {@link Amtk.Factory.default_flags}.
|
|
791
|
+
* @param action_name an action name.
|
|
792
|
+
* @returns a new {@link Gtk.ShortcutsShortcut} for `action_name`.
|
|
793
|
+
*/
|
|
794
|
+
create_shortcut(action_name: string): Gtk.Widget;
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* This function ignores the {@link Amtk.Factory.default_flags} property and takes the
|
|
798
|
+
* `flags` argument instead.
|
|
799
|
+
*
|
|
800
|
+
* This function creates a new {@link Gtk.ShortcutsShortcut} for `action_name`.
|
|
801
|
+
*
|
|
802
|
+
* For the {@link Gtk.ShortcutsShortcut.title}, the tooltip has the priorioty, with the
|
|
803
|
+
* label as fallback if the tooltip is `null` (the mnemonic is removed from the
|
|
804
|
+
* label with `amtk_utils_remove_mnemonic()`). This can be controlled with the
|
|
805
|
+
* {@link Amtk.FactoryFlags.IGNORE_TOOLTIP} and {@link Amtk.FactoryFlags.IGNORE_LABEL} flags.
|
|
806
|
+
*
|
|
807
|
+
* The {@link Gtk.ShortcutsShortcut.accelerator} property is set with only the *first*
|
|
808
|
+
* accel returned by `amtk_action_info_get_accels()`. This step can be ignored
|
|
809
|
+
* with {@link Amtk.FactoryFlags.IGNORE_ACCELS} or {@link Amtk.FactoryFlags.IGNORE_ACCELS_FOR_DOC}.
|
|
810
|
+
*
|
|
811
|
+
* The {@link Gtk.ShortcutsShortcut.action_name} property is set to `action_name` if the
|
|
812
|
+
* {@link Amtk.FactoryFlags.IGNORE_GACTION} flag isn't set. Note that with
|
|
813
|
+
* {@link Gtk.ShortcutsShortcut.action_name} all accelerators are displayed (if set to
|
|
814
|
+
* the {@link Gtk.Application}).
|
|
815
|
+
*
|
|
816
|
+
* So depending on whether you want to show only the first accelerator or all
|
|
817
|
+
* accelerators, you need to set `flags` appropriately.
|
|
818
|
+
* @param action_name an action name.
|
|
819
|
+
* @param flags {@link Amtk.FactoryFlags}.
|
|
820
|
+
* @returns a new {@link Gtk.ShortcutsShortcut} for `action_name`.
|
|
821
|
+
*/
|
|
822
|
+
create_shortcut_full(action_name: string, flags: FactoryFlags): Gtk.Widget;
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Calls `amtk_factory_create_simple_menu_full()` with the
|
|
826
|
+
* {@link Amtk.Factory.default_flags}.
|
|
827
|
+
* @param entries a pointer to the first item in an array of {@link Amtk.ActionInfoEntry} structs.
|
|
828
|
+
* @returns a new simple {@link Gtk.Menu} for `entries`.
|
|
829
|
+
*/
|
|
830
|
+
create_simple_menu(entries: ActionInfoEntry[]): Gtk.Widget;
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* This function ignores the {@link Amtk.Factory.default_flags} property and takes the
|
|
834
|
+
* `flags` argument instead.
|
|
835
|
+
*
|
|
836
|
+
* This function:
|
|
837
|
+
* - Creates a {@link Gtk.Menu};
|
|
838
|
+
* - For each {@link Amtk.ActionInfoEntry} action name from `entries`, creates a
|
|
839
|
+
* {@link Gtk.MenuItem} with `amtk_factory_create_menu_item_full()` with the same `flags`
|
|
840
|
+
* as passed in to this function, and appends it to the {@link Gtk.Menu}, in the same
|
|
841
|
+
* order as provided by the `entries` array.
|
|
842
|
+
*
|
|
843
|
+
* So this function is useful only if the {@link Gtk.Menu} contains only simple
|
|
844
|
+
* {@link Gtk.MenuItem}'s, not {@link Gtk.CheckMenuItem}'s nor {@link Gtk.RadioMenuItem}'s.
|
|
845
|
+
* @param entries a pointer to the first item in an array of {@link Amtk.ActionInfoEntry} structs.
|
|
846
|
+
* @param flags {@link Amtk.FactoryFlags}.
|
|
847
|
+
* @returns a new simple {@link Gtk.Menu} for `entries`.
|
|
848
|
+
*/
|
|
849
|
+
create_simple_menu_full(entries: ActionInfoEntry[], flags: FactoryFlags): Gtk.Widget;
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* Creates a new {@link Gtk.ToolButton} for `action_name` with the
|
|
853
|
+
* {@link Amtk.Factory.default_flags}.
|
|
854
|
+
* @param action_name an action name.
|
|
855
|
+
* @returns a new {@link Gtk.ToolButton} for `action_name`.
|
|
856
|
+
*/
|
|
857
|
+
create_tool_button(action_name: string): Gtk.ToolItem;
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* This function ignores the {@link Amtk.Factory.default_flags} property and takes the
|
|
861
|
+
* `flags` argument instead.
|
|
862
|
+
* @param action_name an action name.
|
|
863
|
+
* @param flags {@link Amtk.FactoryFlags}.
|
|
864
|
+
* @returns a new {@link Gtk.ToolButton} for `action_name`.
|
|
865
|
+
*/
|
|
866
|
+
create_tool_button_full(action_name: string, flags: FactoryFlags): Gtk.ToolItem;
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* @returns the {@link Amtk.Factory.application}.
|
|
870
|
+
*/
|
|
871
|
+
get_application(): Gtk.Application | null;
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* @returns the {@link Amtk.Factory.default_flags}.
|
|
875
|
+
*/
|
|
876
|
+
get_default_flags(): FactoryFlags;
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* Sets the {@link Amtk.Factory.default_flags} property.
|
|
880
|
+
* @param default_flags the new value.
|
|
881
|
+
*/
|
|
882
|
+
set_default_flags(default_flags: FactoryFlags): void;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
namespace MenuShell {
|
|
887
|
+
// Signal signatures
|
|
888
|
+
interface SignalSignatures extends GObject.Object.SignalSignatures {
|
|
889
|
+
/**
|
|
890
|
+
* The ::menu-item-deselected signal is emitted when the
|
|
891
|
+
* {@link Gtk.MenuItem.SignalSignatures.deselect | Gtk.MenuItem::deselect} signal is emitted on a {@link Gtk.MenuItem} belonging
|
|
892
|
+
* (directly or indirectly through submenus) to `amtk_menu_shell`.
|
|
893
|
+
* @signal
|
|
894
|
+
* @since 2.0
|
|
895
|
+
* @run-first
|
|
896
|
+
*/
|
|
897
|
+
"menu-item-deselected": (arg0: Gtk.MenuItem) => void;
|
|
898
|
+
/**
|
|
899
|
+
* The ::menu-item-selected signal is emitted when the
|
|
900
|
+
* {@link Gtk.MenuItem.SignalSignatures.select | Gtk.MenuItem::select} signal is emitted on a {@link Gtk.MenuItem} belonging
|
|
901
|
+
* (directly or indirectly through submenus) to `amtk_menu_shell`.
|
|
902
|
+
* @signal
|
|
903
|
+
* @since 2.0
|
|
904
|
+
* @run-first
|
|
905
|
+
*/
|
|
906
|
+
"menu-item-selected": (arg0: Gtk.MenuItem) => void;
|
|
907
|
+
"notify::menu-shell": (pspec: GObject.ParamSpec) => void;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
// Constructor properties interface
|
|
911
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
912
|
+
menu_shell: Gtk.MenuShell;
|
|
913
|
+
menuShell: Gtk.MenuShell;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* @gir-type Class
|
|
919
|
+
*/
|
|
920
|
+
class MenuShell extends GObject.Object {
|
|
921
|
+
static $gtype: GObject.GType<MenuShell>;
|
|
922
|
+
|
|
923
|
+
// Properties
|
|
924
|
+
/**
|
|
925
|
+
* The {@link Gtk.MenuShell}.
|
|
926
|
+
* @since 2.0
|
|
927
|
+
* @construct-only
|
|
928
|
+
*/
|
|
929
|
+
get menu_shell(): Gtk.MenuShell;
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* The {@link Gtk.MenuShell}.
|
|
933
|
+
* @since 2.0
|
|
934
|
+
* @construct-only
|
|
935
|
+
*/
|
|
936
|
+
get menuShell(): Gtk.MenuShell;
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* Compile-time signal type information.
|
|
940
|
+
*
|
|
941
|
+
* This instance property is generated only for TypeScript type checking.
|
|
942
|
+
* It is not defined at runtime and should not be accessed in JS code.
|
|
943
|
+
* @internal
|
|
944
|
+
*/
|
|
945
|
+
$signals: MenuShell.SignalSignatures;
|
|
946
|
+
|
|
947
|
+
// Constructors
|
|
948
|
+
constructor(properties?: Partial<MenuShell.ConstructorProps>, ...args: any[]);
|
|
949
|
+
|
|
950
|
+
_init(...args: any[]): void;
|
|
951
|
+
|
|
952
|
+
// Signals
|
|
953
|
+
/** @signal */
|
|
954
|
+
connect<K extends keyof MenuShell.SignalSignatures>(signal: K, callback: GObject.SignalCallback<this, MenuShell.SignalSignatures[K]>): number;
|
|
955
|
+
connect(signal: string, callback: (...args: any[]) => any): number;
|
|
956
|
+
|
|
957
|
+
/** @signal */
|
|
958
|
+
connect_after<K extends keyof MenuShell.SignalSignatures>(signal: K, callback: GObject.SignalCallback<this, MenuShell.SignalSignatures[K]>): number;
|
|
959
|
+
connect_after(signal: string, callback: (...args: any[]) => any): number;
|
|
960
|
+
|
|
961
|
+
/** @signal */
|
|
962
|
+
emit<K extends keyof MenuShell.SignalSignatures>(signal: K, ...args: GObject.GjsParameters<MenuShell.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never): void;
|
|
963
|
+
emit(signal: string, ...args: any[]): void;
|
|
964
|
+
|
|
965
|
+
// Static methods
|
|
966
|
+
/**
|
|
967
|
+
* Returns the {@link Amtk.MenuShell} of `gtk_menu_shell`. The returned object is
|
|
968
|
+
* guaranteed to be the same for the lifetime of `gtk_menu_shell`.
|
|
969
|
+
* @param gtk_menu_shell a {@link Gtk.MenuShell}.
|
|
970
|
+
*/
|
|
971
|
+
static get_from_gtk_menu_shell(gtk_menu_shell: Gtk.MenuShell): MenuShell;
|
|
972
|
+
|
|
973
|
+
// Virtual methods
|
|
974
|
+
/**
|
|
975
|
+
* @param menu_item
|
|
976
|
+
* @virtual
|
|
977
|
+
*/
|
|
978
|
+
vfunc_menu_item_deselected(menu_item: Gtk.MenuItem): void;
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* @param menu_item
|
|
982
|
+
* @virtual
|
|
983
|
+
*/
|
|
984
|
+
vfunc_menu_item_selected(menu_item: Gtk.MenuItem): void;
|
|
985
|
+
|
|
986
|
+
// Methods
|
|
987
|
+
/**
|
|
988
|
+
* @returns the {@link Gtk.MenuShell} of `amtk_menu_shell`.
|
|
989
|
+
*/
|
|
990
|
+
get_menu_shell(): Gtk.MenuShell;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* @gir-type Struct
|
|
996
|
+
*/
|
|
997
|
+
class ActionInfo {
|
|
998
|
+
static $gtype: GObject.GType<ActionInfo>;
|
|
999
|
+
|
|
1000
|
+
// Constructors
|
|
1001
|
+
constructor(properties?: Partial<{}>);
|
|
1002
|
+
|
|
1003
|
+
static ["new"](): ActionInfo;
|
|
1004
|
+
|
|
1005
|
+
static new_from_entry(info_entry: ActionInfoEntry, translation_domain: string | null): ActionInfo;
|
|
1006
|
+
|
|
1007
|
+
// Methods
|
|
1008
|
+
/**
|
|
1009
|
+
* @returns a copy of `info`. The copy will have a reference count of one.
|
|
1010
|
+
*/
|
|
1011
|
+
copy(): ActionInfo;
|
|
1012
|
+
|
|
1013
|
+
/**
|
|
1014
|
+
* Returns the accelerators. This function never returns `null`, it always
|
|
1015
|
+
* returns a `null`-terminated array, to be suitable for
|
|
1016
|
+
* `gtk_application_set_accels_for_action()`.
|
|
1017
|
+
* @returns a `null`-terminated array of accelerators in the format understood by `gtk_accelerator_parse()`.
|
|
1018
|
+
*/
|
|
1019
|
+
get_accels(): string[];
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* @returns the action name, or `null`. Example: `"win.save"`. Can be a detailed action name, see `g_action_parse_detailed_name()`.
|
|
1023
|
+
*/
|
|
1024
|
+
get_action_name(): string | null;
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* @returns the icon name, or `null`.
|
|
1028
|
+
*/
|
|
1029
|
+
get_icon_name(): string | null;
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
* Gets the label. The label has normally a mnemonic. To remove the mnemonic,
|
|
1033
|
+
* there is the `amtk_utils_remove_mnemonic()` function.
|
|
1034
|
+
* @returns the label (i.e. a short description), or `null`.
|
|
1035
|
+
*/
|
|
1036
|
+
get_label(): string | null;
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* @returns the tooltip (i.e. a long description), or `null`.
|
|
1040
|
+
*/
|
|
1041
|
+
get_tooltip(): string | null;
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* Returns whether `info` has been used (for example by an {@link Amtk.Factory}
|
|
1045
|
+
* function). See also `amtk_action_info_store_check_all_used()`.
|
|
1046
|
+
* @returns whether `info` has been used.
|
|
1047
|
+
*/
|
|
1048
|
+
has_been_used(): boolean;
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* Mark `info` as used. An {@link Amtk.Factory} function that uses an {@link Amtk.ActionInfo}
|
|
1052
|
+
* should call this function. See `amtk_action_info_store_check_all_used()`.
|
|
1053
|
+
*/
|
|
1054
|
+
mark_as_used(): void;
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
* Increments the reference count of `info` by one.
|
|
1058
|
+
* @returns the passed in `info`.
|
|
1059
|
+
*/
|
|
1060
|
+
ref(): ActionInfo;
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* A function similar to `gtk_application_set_accels_for_action()`.
|
|
1064
|
+
*
|
|
1065
|
+
* `accels` must not be `null`, it must be a `null`-terminated array, to be
|
|
1066
|
+
* consistent with `gtk_application_set_accels_for_action()`.
|
|
1067
|
+
* @param accels a `null`-terminated array of accelerators in the format understood by `gtk_accelerator_parse()`.
|
|
1068
|
+
*/
|
|
1069
|
+
set_accels(accels: string[]): void;
|
|
1070
|
+
|
|
1071
|
+
/**
|
|
1072
|
+
* Sets the action name, for example `"win.save"`. Can be a detailed action
|
|
1073
|
+
* name, see `g_action_parse_detailed_name()`.
|
|
1074
|
+
* @param action_name the action name.
|
|
1075
|
+
*/
|
|
1076
|
+
set_action_name(action_name: string): void;
|
|
1077
|
+
|
|
1078
|
+
/**
|
|
1079
|
+
* @param icon_name the icon name, or `null`.
|
|
1080
|
+
*/
|
|
1081
|
+
set_icon_name(icon_name: string | null): void;
|
|
1082
|
+
|
|
1083
|
+
/**
|
|
1084
|
+
* Sets the label with a mnemonic. To know how to encode the mnemonic, see the
|
|
1085
|
+
* documentation of `gtk_label_new_with_mnemonic()`.
|
|
1086
|
+
* @param label the label (i.e. a short description), or `null`.
|
|
1087
|
+
*/
|
|
1088
|
+
set_label(label: string | null): void;
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* @param tooltip the tooltip (i.e. a long description), or `null`.
|
|
1092
|
+
*/
|
|
1093
|
+
set_tooltip(tooltip: string | null): void;
|
|
1094
|
+
|
|
1095
|
+
/**
|
|
1096
|
+
* Decrements the reference count of `info` by one. If the reference count drops
|
|
1097
|
+
* to 0, `info` is freed.
|
|
1098
|
+
*/
|
|
1099
|
+
unref(): void;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* @gir-type Alias
|
|
1105
|
+
*/
|
|
1106
|
+
type ActionInfoCentralStoreClass = typeof ActionInfoCentralStore;
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* @gir-type Struct
|
|
1110
|
+
*/
|
|
1111
|
+
abstract class ActionInfoCentralStorePrivate {
|
|
1112
|
+
static $gtype: GObject.GType<ActionInfoCentralStorePrivate>;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
|
|
1116
|
+
/**
|
|
1117
|
+
* This struct defines a set of information for a single action. It is for use
|
|
1118
|
+
* with `amtk_action_info_store_add_entries()`.
|
|
1119
|
+
*
|
|
1120
|
+
* Like {@link Gio.ActionEntry}, it is permissible to use an incomplete initialiser in
|
|
1121
|
+
* order to leave some of the later values as `null`. Additional optional fields
|
|
1122
|
+
* may be added in the future.
|
|
1123
|
+
* @gir-type Struct
|
|
1124
|
+
* @since 2.0
|
|
1125
|
+
*/
|
|
1126
|
+
class ActionInfoEntry {
|
|
1127
|
+
static $gtype: GObject.GType<ActionInfoEntry>;
|
|
1128
|
+
|
|
1129
|
+
// Fields
|
|
1130
|
+
action_name: string;
|
|
1131
|
+
|
|
1132
|
+
icon_name: string;
|
|
1133
|
+
|
|
1134
|
+
label: string;
|
|
1135
|
+
|
|
1136
|
+
accel: string;
|
|
1137
|
+
|
|
1138
|
+
tooltip: string;
|
|
1139
|
+
|
|
1140
|
+
// Constructors
|
|
1141
|
+
|
|
1142
|
+
constructor(properties?: Partial<{
|
|
1143
|
+
action_name: string;
|
|
1144
|
+
icon_name: string;
|
|
1145
|
+
label: string;
|
|
1146
|
+
accel: string;
|
|
1147
|
+
tooltip: string;
|
|
1148
|
+
}>);
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
/**
|
|
1153
|
+
* @gir-type Alias
|
|
1154
|
+
*/
|
|
1155
|
+
type ActionInfoStoreClass = typeof ActionInfoStore;
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* @gir-type Struct
|
|
1159
|
+
*/
|
|
1160
|
+
abstract class ActionInfoStorePrivate {
|
|
1161
|
+
static $gtype: GObject.GType<ActionInfoStorePrivate>;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
/**
|
|
1166
|
+
* @gir-type Alias
|
|
1167
|
+
*/
|
|
1168
|
+
type ApplicationWindowClass = typeof ApplicationWindow;
|
|
1169
|
+
|
|
1170
|
+
/**
|
|
1171
|
+
* @gir-type Struct
|
|
1172
|
+
*/
|
|
1173
|
+
abstract class ApplicationWindowPrivate {
|
|
1174
|
+
static $gtype: GObject.GType<ApplicationWindowPrivate>;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
/**
|
|
1179
|
+
* @gir-type Alias
|
|
1180
|
+
*/
|
|
1181
|
+
type FactoryClass = typeof Factory;
|
|
1182
|
+
|
|
1183
|
+
/**
|
|
1184
|
+
* @gir-type Struct
|
|
1185
|
+
*/
|
|
1186
|
+
abstract class FactoryPrivate {
|
|
1187
|
+
static $gtype: GObject.GType<FactoryPrivate>;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
|
|
1191
|
+
/**
|
|
1192
|
+
* @gir-type Alias
|
|
1193
|
+
*/
|
|
1194
|
+
type MenuShellClass = typeof MenuShell;
|
|
1195
|
+
|
|
1196
|
+
/**
|
|
1197
|
+
* @gir-type Struct
|
|
1198
|
+
*/
|
|
1199
|
+
abstract class MenuShellPrivate {
|
|
1200
|
+
static $gtype: GObject.GType<MenuShellPrivate>;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
|
|
1204
|
+
/**
|
|
1205
|
+
* Name of the imported GIR library
|
|
1206
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
1207
|
+
*/
|
|
1208
|
+
const __name__: string;
|
|
1209
|
+
|
|
1210
|
+
/**
|
|
1211
|
+
* Version of the imported GIR library
|
|
1212
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
1213
|
+
*/
|
|
1214
|
+
const __version__: string;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
export default Amtk;
|
|
1218
|
+
|
|
1219
|
+
// END
|