1// Package adw was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package adw
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/gobject"
12 "github.com/bnema/puregotk/v4/gobject/types"
13 "github.com/bnema/puregotk/v4/gtk"
14)
15
16type ShortcutsItemClass struct {
17 _ structs.HostLayout
18
19 ParentClass gobject.ObjectClass
20}
21
22func (x *ShortcutsItemClass) GoPointer() uintptr {
23 return uintptr(unsafe.Pointer(x))
24}
25
26// An object representing an individual shortcut in [class@ShortcutsSection].
27//
28// A shortcut has a title, an optional subtitle, and an accelerator.
29//
30// Accelerator must be specified in the format [class@ShortcutLabel] accepts.
31//
32// Alternatively, the [property@ShortcutsItem:action-name] property can be used
33// to automatically get accelerator associated with the specified action, as set
34// via [method@Gtk.Application.set_accels_for_action].
35//
36// If both are specified, the accelerator will be used if the action couldn't
37// be found or doesn't have an accelerator associated for it.
38//
39// If [property@ShortcutsItem:direction] is set, the shortcut will only be
40// displayed for the specified text direction. This allows to display different
41// shortcuts for different text directions.
42type ShortcutsItem struct {
43 gobject.Object
44}
45
46var xShortcutsItemGLibType func() types.GType
47
48func ShortcutsItemGLibType() types.GType {
49 return xShortcutsItemGLibType()
50}
51
52func ShortcutsItemNewFromInternalPtr(ptr uintptr) *ShortcutsItem {
53 cls := &ShortcutsItem{}
54 cls.Ptr = ptr
55 return cls
56}
57
58var xNewShortcutsItem func(string, string) uintptr
59
60// Creates a new `AdwShortcutsItem` with @title and @accelerator.
61func NewShortcutsItem(TitleVar string, AcceleratorVar string) *ShortcutsItem {
62 var cls *ShortcutsItem
63
64 cret := xNewShortcutsItem(TitleVar, AcceleratorVar)
65
66 if cret == 0 {
67 return nil
68 }
69 cls = &ShortcutsItem{}
70 cls.Ptr = cret
71 return cls
72}
73
74var xNewShortcutsItemFromAction func(string, string) uintptr
75
76// Creates a new `AdwShortcutsItem` with @title and @action_name.
77func NewShortcutsItemFromAction(TitleVar string, ActionNameVar string) *ShortcutsItem {
78 var cls *ShortcutsItem
79
80 cret := xNewShortcutsItemFromAction(TitleVar, ActionNameVar)
81
82 if cret == 0 {
83 return nil
84 }
85 cls = &ShortcutsItem{}
86 cls.Ptr = cret
87 return cls
88}
89
90var xShortcutsItemGetAccelerator func(uintptr) string
91
92// Gets the accelerator of @self.
93func (x *ShortcutsItem) GetAccelerator() string {
94
95 cret := xShortcutsItemGetAccelerator(x.GoPointer())
96 return cret
97}
98
99var xShortcutsItemGetActionName func(uintptr) string
100
101// Gets the action name to get the accelerator from.
102func (x *ShortcutsItem) GetActionName() string {
103
104 cret := xShortcutsItemGetActionName(x.GoPointer())
105 return cret
106}
107
108var xShortcutsItemGetDirection func(uintptr) gtk.TextDirection
109
110// Gets the direction of @self.
111func (x *ShortcutsItem) GetDirection() gtk.TextDirection {
112
113 cret := xShortcutsItemGetDirection(x.GoPointer())
114 return cret
115}
116
117var xShortcutsItemGetSubtitle func(uintptr) string
118
119// Gets the subtitle of @self.
120func (x *ShortcutsItem) GetSubtitle() string {
121
122 cret := xShortcutsItemGetSubtitle(x.GoPointer())
123 return cret
124}
125
126var xShortcutsItemGetTitle func(uintptr) string
127
128// Gets the title of @self.
129func (x *ShortcutsItem) GetTitle() string {
130
131 cret := xShortcutsItemGetTitle(x.GoPointer())
132 return cret
133}
134
135var xShortcutsItemSetAccelerator func(uintptr, string)
136
137// Sets the accelerator of @self.
138//
139// @accelerator must be in the format [class@ShortcutLabel] accepts.
140func (x *ShortcutsItem) SetAccelerator(AcceleratorVar string) {
141
142 xShortcutsItemSetAccelerator(x.GoPointer(), AcceleratorVar)
143
144}
145
146var xShortcutsItemSetActionName func(uintptr, string)
147
148// Sets the action name to get the accelerator from.
149func (x *ShortcutsItem) SetActionName(ActionNameVar string) {
150
151 xShortcutsItemSetActionName(x.GoPointer(), ActionNameVar)
152
153}
154
155var xShortcutsItemSetDirection func(uintptr, gtk.TextDirection)
156
157// Sets the direction of @self.
158//
159// If set to [enum@Gtk.TextDirection.LTR] or [enum@Gtk.TextDirection.RTL], the
160// shortcut will only be displayed for this direction.
161func (x *ShortcutsItem) SetDirection(DirectionVar gtk.TextDirection) {
162
163 xShortcutsItemSetDirection(x.GoPointer(), DirectionVar)
164
165}
166
167var xShortcutsItemSetSubtitle func(uintptr, string)
168
169// Sets the subtitle of @self.
170func (x *ShortcutsItem) SetSubtitle(SubtitleVar string) {
171
172 xShortcutsItemSetSubtitle(x.GoPointer(), SubtitleVar)
173
174}
175
176var xShortcutsItemSetTitle func(uintptr, string)
177
178// Sets the title of @self.
179func (x *ShortcutsItem) SetTitle(TitleVar string) {
180
181 xShortcutsItemSetTitle(x.GoPointer(), TitleVar)
182
183}
184
185func (c *ShortcutsItem) GoPointer() uintptr {
186 if c == nil {
187 return 0
188 }
189 return c.Ptr
190}
191
192func (c *ShortcutsItem) SetGoPointer(ptr uintptr) {
193 c.Ptr = ptr
194}
195
196// SetPropertyAccelerator sets the "accelerator" property.
197// The shortcut accelerator.
198//
199// Accelerator must be in the format [class@ShortcutLabel] accepts.
200func (x *ShortcutsItem) SetPropertyAccelerator(value string) {
201 var v gobject.Value
202 v.Init(gobject.TypeStringVal)
203 v.SetString(&value)
204 x.SetProperty("accelerator", &v)
205}
206
207// GetPropertyAccelerator gets the "accelerator" property.
208// The shortcut accelerator.
209//
210// Accelerator must be in the format [class@ShortcutLabel] accepts.
211func (x *ShortcutsItem) GetPropertyAccelerator() string {
212 var v gobject.Value
213 x.GetProperty("accelerator", &v)
214 return v.GetString()
215}
216
217// SetPropertyActionName sets the "action-name" property.
218// Fully qualified action name to get the accelerator from.
219func (x *ShortcutsItem) SetPropertyActionName(value string) {
220 var v gobject.Value
221 v.Init(gobject.TypeStringVal)
222 v.SetString(&value)
223 x.SetProperty("action-name", &v)
224}
225
226// GetPropertyActionName gets the "action-name" property.
227// Fully qualified action name to get the accelerator from.
228func (x *ShortcutsItem) GetPropertyActionName() string {
229 var v gobject.Value
230 x.GetProperty("action-name", &v)
231 return v.GetString()
232}
233
234// SetPropertySubtitle sets the "subtitle" property.
235// The subtitle of the shortcut.
236func (x *ShortcutsItem) SetPropertySubtitle(value string) {
237 var v gobject.Value
238 v.Init(gobject.TypeStringVal)
239 v.SetString(&value)
240 x.SetProperty("subtitle", &v)
241}
242
243// GetPropertySubtitle gets the "subtitle" property.
244// The subtitle of the shortcut.
245func (x *ShortcutsItem) GetPropertySubtitle() string {
246 var v gobject.Value
247 x.GetProperty("subtitle", &v)
248 return v.GetString()
249}
250
251// SetPropertyTitle sets the "title" property.
252// The title of the shortcut.
253func (x *ShortcutsItem) SetPropertyTitle(value string) {
254 var v gobject.Value
255 v.Init(gobject.TypeStringVal)
256 v.SetString(&value)
257 x.SetProperty("title", &v)
258}
259
260// GetPropertyTitle gets the "title" property.
261// The title of the shortcut.
262func (x *ShortcutsItem) GetPropertyTitle() string {
263 var v gobject.Value
264 x.GetProperty("title", &v)
265 return v.GetString()
266}
267
268func init() {
269 core.SetPackageName("ADW", "libadwaita-1")
270 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
271 var libs []uintptr
272 for _, libPath := range core.GetPaths("ADW") {
273 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
274 if err != nil {
275 panic(err)
276 }
277 libs = append(libs, lib)
278 }
279
280 core.PuregoSafeRegister(&xShortcutsItemGLibType, libs, "adw_shortcuts_item_get_type")
281
282 core.PuregoSafeRegister(&xNewShortcutsItem, libs, "adw_shortcuts_item_new")
283 core.PuregoSafeRegister(&xNewShortcutsItemFromAction, libs, "adw_shortcuts_item_new_from_action")
284
285 core.PuregoSafeRegister(&xShortcutsItemGetAccelerator, libs, "adw_shortcuts_item_get_accelerator")
286 core.PuregoSafeRegister(&xShortcutsItemGetActionName, libs, "adw_shortcuts_item_get_action_name")
287 core.PuregoSafeRegister(&xShortcutsItemGetDirection, libs, "adw_shortcuts_item_get_direction")
288 core.PuregoSafeRegister(&xShortcutsItemGetSubtitle, libs, "adw_shortcuts_item_get_subtitle")
289 core.PuregoSafeRegister(&xShortcutsItemGetTitle, libs, "adw_shortcuts_item_get_title")
290 core.PuregoSafeRegister(&xShortcutsItemSetAccelerator, libs, "adw_shortcuts_item_set_accelerator")
291 core.PuregoSafeRegister(&xShortcutsItemSetActionName, libs, "adw_shortcuts_item_set_action_name")
292 core.PuregoSafeRegister(&xShortcutsItemSetDirection, libs, "adw_shortcuts_item_set_direction")
293 core.PuregoSafeRegister(&xShortcutsItemSetSubtitle, libs, "adw_shortcuts_item_set_subtitle")
294 core.PuregoSafeRegister(&xShortcutsItemSetTitle, libs, "adw_shortcuts_item_set_title")
295
296}