1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "github.com/ebitengine/purego"
6
7 "github.com/bnema/puregotk/pkg/core"
8 "github.com/bnema/puregotk/v4/gdk"
9 "github.com/bnema/puregotk/v4/gobject"
10 "github.com/bnema/puregotk/v4/gobject/types"
11 "github.com/bnema/puregotk/v4/gsk"
12)
13
14// A dialog for choosing a color.
15//
16// <picture>
17//
18// <source srcset="colorchooser-dark.png" media="(prefers-color-scheme: dark)">
19// <img alt="An example GtkColorChooserDialog" src="colorchooser.png">
20//
21// </picture>
22//
23// `GtkColorChooserDialog` implements the [iface@Gtk.ColorChooser] interface
24// and does not provide much API of its own.
25//
26// To create a `GtkColorChooserDialog`, use [ctor@Gtk.ColorChooserDialog.new].
27//
28// To change the initially selected color, use
29// [method@Gtk.ColorChooser.set_rgba]. To get the selected color use
30// [method@Gtk.ColorChooser.get_rgba].
31//
32// `GtkColorChooserDialog` has been deprecated in favor of [class@Gtk.ColorDialog].
33//
34// ## CSS nodes
35//
36// `GtkColorChooserDialog` has a single CSS node with the name `window` and style
37// class `.colorchooser`.
38type ColorChooserDialog struct {
39 Dialog
40}
41
42var xColorChooserDialogGLibType func() types.GType
43
44func ColorChooserDialogGLibType() types.GType {
45 return xColorChooserDialogGLibType()
46}
47
48func ColorChooserDialogNewFromInternalPtr(ptr uintptr) *ColorChooserDialog {
49 cls := &ColorChooserDialog{}
50 cls.Ptr = ptr
51 return cls
52}
53
54var xNewColorChooserDialog func(uintptr, uintptr) uintptr
55
56// Creates a new `GtkColorChooserDialog`.
57func NewColorChooserDialog(TitleVar *string, ParentVar *Window) *ColorChooserDialog {
58 var cls *ColorChooserDialog
59
60 TitleVarPtr := core.GStrdupNullable(TitleVar)
61 defer core.GFreeNullable(TitleVarPtr)
62
63 cret := xNewColorChooserDialog(TitleVarPtr, ParentVar.GoPointer())
64
65 if cret == 0 {
66 return nil
67 }
68 gobject.IncreaseRef(cret)
69 cls = &ColorChooserDialog{}
70 cls.Ptr = cret
71 return cls
72}
73
74func (c *ColorChooserDialog) GoPointer() uintptr {
75 if c == nil {
76 return 0
77 }
78 return c.Ptr
79}
80
81func (c *ColorChooserDialog) SetGoPointer(ptr uintptr) {
82 c.Ptr = ptr
83}
84
85// SetPropertyShowEditor sets the "show-editor" property.
86// Whether the color chooser dialog is showing the single-color editor.
87//
88// It can be set to switch the color chooser into single-color editing mode.
89func (x *ColorChooserDialog) SetPropertyShowEditor(value bool) {
90 var v gobject.Value
91 v.Init(gobject.TypeBooleanVal)
92 v.SetBoolean(value)
93 x.SetProperty("show-editor", &v)
94}
95
96// GetPropertyShowEditor gets the "show-editor" property.
97// Whether the color chooser dialog is showing the single-color editor.
98//
99// It can be set to switch the color chooser into single-color editing mode.
100func (x *ColorChooserDialog) GetPropertyShowEditor() bool {
101 var v gobject.Value
102 x.GetProperty("show-editor", &v)
103 return v.GetBoolean()
104}
105
106// Requests the user's screen reader to announce the given message.
107//
108// This kind of notification is useful for messages that
109// either have only a visual representation or that are not
110// exposed visually at all, e.g. a notification about a
111// successful operation.
112//
113// Also, by using this API, you can ensure that the message
114// does not interrupts the user's current screen reader output.
115func (x *ColorChooserDialog) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
116
117 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
118
119}
120
121// Retrieves the accessible parent for an accessible object.
122//
123// This function returns `NULL` for top level widgets.
124func (x *ColorChooserDialog) GetAccessibleParent() *AccessibleBase {
125 var cls *AccessibleBase
126
127 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
128
129 if cret == 0 {
130 return nil
131 }
132 cls = &AccessibleBase{}
133 cls.Ptr = cret
134 return cls
135}
136
137// Retrieves the accessible role of an accessible object.
138func (x *ColorChooserDialog) GetAccessibleRole() AccessibleRole {
139
140 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
141 return cret
142}
143
144// Retrieves the implementation for the given accessible object.
145func (x *ColorChooserDialog) GetAtContext() *ATContext {
146 var cls *ATContext
147
148 cret := XGtkAccessibleGetAtContext(x.GoPointer())
149
150 if cret == 0 {
151 return nil
152 }
153 cls = &ATContext{}
154 cls.Ptr = cret
155 return cls
156}
157
158// Queries the coordinates and dimensions of this accessible
159//
160// This functionality can be overridden by `GtkAccessible`
161// implementations, e.g. to get the bounds from an ignored
162// child widget.
163func (x *ColorChooserDialog) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
164
165 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
166 return cret
167}
168
169// Retrieves the first accessible child of an accessible object.
170func (x *ColorChooserDialog) GetFirstAccessibleChild() *AccessibleBase {
171 var cls *AccessibleBase
172
173 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
174
175 if cret == 0 {
176 return nil
177 }
178 cls = &AccessibleBase{}
179 cls.Ptr = cret
180 return cls
181}
182
183// Retrieves the next accessible sibling of an accessible object
184func (x *ColorChooserDialog) GetNextAccessibleSibling() *AccessibleBase {
185 var cls *AccessibleBase
186
187 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
188
189 if cret == 0 {
190 return nil
191 }
192 cls = &AccessibleBase{}
193 cls.Ptr = cret
194 return cls
195}
196
197// Queries a platform state, such as focus.
198//
199// This functionality can be overridden by `GtkAccessible`
200// implementations, e.g. to get platform state from an ignored
201// child widget, as is the case for `GtkText` wrappers.
202func (x *ColorChooserDialog) GetPlatformState(StateVar AccessiblePlatformState) bool {
203
204 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
205 return cret
206}
207
208// Resets the accessible property to its default value.
209func (x *ColorChooserDialog) ResetProperty(PropertyVar AccessibleProperty) {
210
211 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
212
213}
214
215// Resets the accessible relation to its default value.
216func (x *ColorChooserDialog) ResetRelation(RelationVar AccessibleRelation) {
217
218 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
219
220}
221
222// Resets the accessible state to its default value.
223func (x *ColorChooserDialog) ResetState(StateVar AccessibleState) {
224
225 XGtkAccessibleResetState(x.GoPointer(), StateVar)
226
227}
228
229// Sets the parent and sibling of an accessible object.
230//
231// This function is meant to be used by accessible implementations that are
232// not part of the widget hierarchy, and but act as a logical bridge between
233// widgets. For instance, if a widget creates an object that holds metadata
234// for each child, and you want that object to implement the `GtkAccessible`
235// interface, you will use this function to ensure that the parent of each
236// child widget is the metadata object, and the parent of each metadata
237// object is the container widget.
238func (x *ColorChooserDialog) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
239
240 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
241
242}
243
244// Updates the next accessible sibling.
245//
246// That might be useful when a new child of a custom accessible
247// is created, and it needs to be linked to a previous child.
248func (x *ColorChooserDialog) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
249
250 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
251
252}
253
254// Informs ATs that the platform state has changed.
255//
256// This function should be used by `GtkAccessible` implementations that
257// have a platform state but are not widgets. Widgets handle platform
258// states automatically.
259func (x *ColorChooserDialog) UpdatePlatformState(StateVar AccessiblePlatformState) {
260
261 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
262
263}
264
265// Updates a list of accessible properties.
266//
267// See the [enum@Gtk.AccessibleProperty] documentation for the
268// value types of accessible properties.
269//
270// This function should be called by `GtkWidget` types whenever
271// an accessible property change must be communicated to assistive
272// technologies.
273//
274// Example:
275// ```c
276// value = gtk_adjustment_get_value (adjustment);
277// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
278//
279// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
280// -1);
281//
282// ```
283func (x *ColorChooserDialog) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
284
285 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
286
287}
288
289// Updates an array of accessible properties.
290//
291// This function should be called by `GtkWidget` types whenever an accessible
292// property change must be communicated to assistive technologies.
293//
294// This function is meant to be used by language bindings.
295func (x *ColorChooserDialog) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
296
297 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
298
299}
300
301// Updates a list of accessible relations.
302//
303// This function should be called by `GtkWidget` types whenever an accessible
304// relation change must be communicated to assistive technologies.
305//
306// If the [enum@Gtk.AccessibleRelation] requires a list of references,
307// you should pass each reference individually, followed by `NULL`, e.g.
308//
309// ```c
310// gtk_accessible_update_relation (accessible,
311//
312// GTK_ACCESSIBLE_RELATION_CONTROLS,
313// ref1, NULL,
314// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
315// ref1, ref2, ref3, NULL,
316// -1);
317//
318// ```
319func (x *ColorChooserDialog) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
320
321 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
322
323}
324
325// Updates an array of accessible relations.
326//
327// This function should be called by `GtkWidget` types whenever an accessible
328// relation change must be communicated to assistive technologies.
329//
330// This function is meant to be used by language bindings.
331func (x *ColorChooserDialog) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
332
333 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
334
335}
336
337// Updates a list of accessible states.
338//
339// See the [enum@Gtk.AccessibleState] documentation for the
340// value types of accessible states.
341//
342// This function should be called by `GtkWidget` types whenever
343// an accessible state change must be communicated to assistive
344// technologies.
345//
346// Example:
347//
348// ```c
349// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
350// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
351//
352// GTK_ACCESSIBLE_STATE_CHECKED, value,
353// -1);
354//
355// ```
356func (x *ColorChooserDialog) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
357
358 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
359
360}
361
362// Updates an array of accessible states.
363//
364// This function should be called by `GtkWidget` types whenever an accessible
365// state change must be communicated to assistive technologies.
366//
367// This function is meant to be used by language bindings.
368func (x *ColorChooserDialog) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
369
370 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
371
372}
373
374// Gets the ID of the @buildable object.
375//
376// `GtkBuilder` sets the name based on the ID attribute
377// of the `<object>` tag used to construct the @buildable.
378func (x *ColorChooserDialog) GetBuildableId() string {
379
380 cret := XGtkBuildableGetBuildableId(x.GoPointer())
381 return cret
382}
383
384// Adds a palette to the color chooser.
385//
386// If @orientation is horizontal, the colors are grouped in rows,
387// with @colors_per_line colors in each row. If @horizontal is %FALSE,
388// the colors are grouped in columns instead.
389//
390// The default color palette of [class@Gtk.ColorChooserWidget] has
391// 45 colors, organized in columns of 5 colors (this includes some
392// grays).
393//
394// The layout of the color chooser widget works best when the
395// palettes have 9-10 columns.
396//
397// Calling this function for the first time has the side effect
398// of removing the default color palette from the color chooser.
399//
400// If @colors is %NULL, removes all previously added palettes.
401func (x *ColorChooserDialog) AddPalette(OrientationVar Orientation, ColorsPerLineVar int, NColorsVar int, ColorsVar []gdk.RGBA) {
402
403 XGtkColorChooserAddPalette(x.GoPointer(), OrientationVar, ColorsPerLineVar, NColorsVar, ColorsVar)
404
405}
406
407// Gets the currently-selected color.
408func (x *ColorChooserDialog) GetRgba(ColorVar *gdk.RGBA) {
409
410 XGtkColorChooserGetRgba(x.GoPointer(), ColorVar)
411
412}
413
414// Returns whether the color chooser shows the alpha channel.
415func (x *ColorChooserDialog) GetUseAlpha() bool {
416
417 cret := XGtkColorChooserGetUseAlpha(x.GoPointer())
418 return cret
419}
420
421// Sets the color.
422func (x *ColorChooserDialog) SetRgba(ColorVar *gdk.RGBA) {
423
424 XGtkColorChooserSetRgba(x.GoPointer(), ColorVar)
425
426}
427
428// Sets whether or not the color chooser should use the alpha channel.
429func (x *ColorChooserDialog) SetUseAlpha(UseAlphaVar bool) {
430
431 XGtkColorChooserSetUseAlpha(x.GoPointer(), UseAlphaVar)
432
433}
434
435// Returns the renderer that is used for this `GtkNative`.
436func (x *ColorChooserDialog) GetRenderer() *gsk.Renderer {
437 var cls *gsk.Renderer
438
439 cret := XGtkNativeGetRenderer(x.GoPointer())
440
441 if cret == 0 {
442 return nil
443 }
444 gobject.IncreaseRef(cret)
445 cls = &gsk.Renderer{}
446 cls.Ptr = cret
447 return cls
448}
449
450// Returns the surface of this `GtkNative`.
451func (x *ColorChooserDialog) GetSurface() *gdk.Surface {
452 var cls *gdk.Surface
453
454 cret := XGtkNativeGetSurface(x.GoPointer())
455
456 if cret == 0 {
457 return nil
458 }
459 gobject.IncreaseRef(cret)
460 cls = &gdk.Surface{}
461 cls.Ptr = cret
462 return cls
463}
464
465// Retrieves the surface transform of @self.
466//
467// This is the translation from @self's surface coordinates into
468// @self's widget coordinates.
469func (x *ColorChooserDialog) GetSurfaceTransform(XVar *float64, YVar *float64) {
470
471 XGtkNativeGetSurfaceTransform(x.GoPointer(), XVar, YVar)
472
473}
474
475// Realizes a `GtkNative`.
476//
477// This should only be used by subclasses.
478func (x *ColorChooserDialog) Realize() {
479
480 XGtkNativeRealize(x.GoPointer())
481
482}
483
484// Unrealizes a `GtkNative`.
485//
486// This should only be used by subclasses.
487func (x *ColorChooserDialog) Unrealize() {
488
489 XGtkNativeUnrealize(x.GoPointer())
490
491}
492
493// Returns the display that this `GtkRoot` is on.
494func (x *ColorChooserDialog) GetDisplay() *gdk.Display {
495 var cls *gdk.Display
496
497 cret := XGtkRootGetDisplay(x.GoPointer())
498
499 if cret == 0 {
500 return nil
501 }
502 gobject.IncreaseRef(cret)
503 cls = &gdk.Display{}
504 cls.Ptr = cret
505 return cls
506}
507
508// Retrieves the current focused widget within the root.
509//
510// Note that this is the widget that would have the focus
511// if the root is active; if the root is not focused then
512// `gtk_widget_has_focus (widget)` will be %FALSE for the
513// widget.
514func (x *ColorChooserDialog) GetFocus() *Widget {
515 var cls *Widget
516
517 cret := XGtkRootGetFocus(x.GoPointer())
518
519 if cret == 0 {
520 return nil
521 }
522 gobject.IncreaseRef(cret)
523 cls = &Widget{}
524 cls.Ptr = cret
525 return cls
526}
527
528// If @focus is not the current focus widget, and is focusable, sets
529// it as the focus widget for the root.
530//
531// If @focus is %NULL, unsets the focus widget for the root.
532//
533// To set the focus to a particular widget in the root, it is usually
534// more convenient to use [method@Gtk.Widget.grab_focus] instead of
535// this function.
536func (x *ColorChooserDialog) SetFocus(FocusVar *Widget) {
537
538 XGtkRootSetFocus(x.GoPointer(), FocusVar.GoPointer())
539
540}
541
542func init() {
543 core.SetPackageName("GTK", "gtk4")
544 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
545 var libs []uintptr
546 for _, libPath := range core.GetPaths("GTK") {
547 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
548 if err != nil {
549 panic(err)
550 }
551 libs = append(libs, lib)
552 }
553
554 core.PuregoSafeRegister(&xColorChooserDialogGLibType, libs, "gtk_color_chooser_dialog_get_type")
555
556 core.PuregoSafeRegister(&xNewColorChooserDialog, libs, "gtk_color_chooser_dialog_new")
557
558}