Gen: Re-run script
- commit
- bc1a52f44fd4c491947f7af85296c66173da17ba
- author
- Jeroen Wijenbergh · · 2025-04-07 12:39 UTC
- committer
- Jeroen Wijenbergh · · 2025-04-07 12:41 UTC
- parent
- dfb3f40
- signature
- unsigned
54 files · +12400 -172
A v4/adw/adw-about-dialog.go +1187 -0
| @@ -0,0 +1,1187 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 13 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 14 | + | ) | |
| 15 | + | ||
| 16 | + | type AboutDialogClass struct { | |
| 17 | + | _ structs.HostLayout | |
| 18 | + | ||
| 19 | + | ParentClass uintptr | |
| 20 | + | } | |
| 21 | + | ||
| 22 | + | func (x *AboutDialogClass) GoPointer() uintptr { | |
| 23 | + | return uintptr(unsafe.Pointer(x)) | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | var xShowAboutDialog func(uintptr, string, ...interface{}) | |
| 27 | + | ||
| 28 | + | // A convenience function for showing an application’s about dialog. | |
| 29 | + | func ShowAboutDialog(ParentVar *gtk.Widget, FirstPropertyNameVar string, varArgs ...interface{}) { | |
| 30 | + | ||
| 31 | + | xShowAboutDialog(ParentVar.GoPointer(), FirstPropertyNameVar, varArgs...) | |
| 32 | + | ||
| 33 | + | } | |
| 34 | + | ||
| 35 | + | var xShowAboutDialogFromAppdata func(uintptr, string, string, string, ...interface{}) | |
| 36 | + | ||
| 37 | + | // A convenience function for showing an application’s about dialog from | |
| 38 | + | // AppStream metadata. | |
| 39 | + | // | |
| 40 | + | // See [ctor@AboutDialog.new_from_appdata] for details. | |
| 41 | + | func ShowAboutDialogFromAppdata(ParentVar *gtk.Widget, ResourcePathVar string, ReleaseNotesVersionVar string, FirstPropertyNameVar string, varArgs ...interface{}) { | |
| 42 | + | ||
| 43 | + | xShowAboutDialogFromAppdata(ParentVar.GoPointer(), ResourcePathVar, ReleaseNotesVersionVar, FirstPropertyNameVar, varArgs...) | |
| 44 | + | ||
| 45 | + | } | |
| 46 | + | ||
| 47 | + | // A dialog showing information about the application. | |
| 48 | + | // | |
| 49 | + | // <picture> | |
| 50 | + | // | |
| 51 | + | // <source srcset="about-dialog-dark.png" media="(prefers-color-scheme: dark)"> | |
| 52 | + | // <img src="about-dialog.png" alt="about-dialog"> | |
| 53 | + | // | |
| 54 | + | // </picture> | |
| 55 | + | // | |
| 56 | + | // an about dialog is typically opened when the user activates the `About …` | |
| 57 | + | // item in the application's primary menu. All parts of the dialog are optional. | |
| 58 | + | // | |
| 59 | + | // ## Main page | |
| 60 | + | // | |
| 61 | + | // `AdwAboutDialog` prominently displays the application's icon, name, developer | |
| 62 | + | // name and version. They can be set with the [property@AboutDialog:application-icon], | |
| 63 | + | // [property@AboutDialog:application-name], | |
| 64 | + | // [property@AboutDialog:developer-name] and [property@AboutDialog:version] | |
| 65 | + | // respectively. | |
| 66 | + | // | |
| 67 | + | // ## What's New | |
| 68 | + | // | |
| 69 | + | // `AdwAboutDialog` provides a way for applications to display their release | |
| 70 | + | // notes, set with the [property@AboutDialog:release-notes] property. | |
| 71 | + | // | |
| 72 | + | // Release notes are formatted the same way as | |
| 73 | + | // [AppStream descriptions](https://freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-description). | |
| 74 | + | // | |
| 75 | + | // The supported formatting options are: | |
| 76 | + | // | |
| 77 | + | // * Paragraph (`<p>`) | |
| 78 | + | // * Ordered list (`<ol>`), with list items (`<li>`) | |
| 79 | + | // * Unordered list (`<ul>`), with list items (`<li>`) | |
| 80 | + | // | |
| 81 | + | // Within paragraphs and list items, emphasis (`<em>`) and inline code | |
| 82 | + | // (`<code>`) text styles are supported. The emphasis is rendered in italic, | |
| 83 | + | // while inline code is shown in a monospaced font. | |
| 84 | + | // | |
| 85 | + | // Any text outside paragraphs or list items is ignored. | |
| 86 | + | // | |
| 87 | + | // Nested lists are not supported. | |
| 88 | + | // | |
| 89 | + | // Only one version can be shown at a time. By default, the displayed version | |
| 90 | + | // number matches [property@AboutDialog:version]. Use | |
| 91 | + | // [property@AboutDialog:release-notes-version] to override it. | |
| 92 | + | // | |
| 93 | + | // ## Details | |
| 94 | + | // | |
| 95 | + | // The Details page displays the application comments and links. | |
| 96 | + | // | |
| 97 | + | // The comments can be set with the [property@AboutDialog:comments] property. | |
| 98 | + | // Unlike [property@Gtk.AboutDialog:comments], this string can be long and | |
| 99 | + | // detailed. It can also contain links and Pango markup. | |
| 100 | + | // | |
| 101 | + | // To set the application website, use [property@AboutDialog:website]. | |
| 102 | + | // To add extra links below the website, use [method@AboutDialog.add_link]. | |
| 103 | + | // | |
| 104 | + | // If the Details page doesn't have any other content besides website, the | |
| 105 | + | // website will be displayed on the main page instead. | |
| 106 | + | // | |
| 107 | + | // ## Troubleshooting | |
| 108 | + | // | |
| 109 | + | // `AdwAboutDialog` displays the following two links on the main page: | |
| 110 | + | // | |
| 111 | + | // * Support Questions, set with the [property@AboutDialog:support-url] property, | |
| 112 | + | // * Report an Issue, set with the [property@AboutDialog:issue-url] property. | |
| 113 | + | // | |
| 114 | + | // Additionally, applications can provide debugging information. It will be | |
| 115 | + | // shown separately on the Troubleshooting page. Use the | |
| 116 | + | // [property@AboutDialog:debug-info] property to specify it. | |
| 117 | + | // | |
| 118 | + | // It's intended to be attached to issue reports when reporting issues against | |
| 119 | + | // the application. As such, it cannot contain markup or links. | |
| 120 | + | // | |
| 121 | + | // `AdwAboutDialog` provides a quick way to save debug information to a file. | |
| 122 | + | // When saving, [property@AboutDialog:debug-info-filename] would be used as | |
| 123 | + | // the suggested filename. | |
| 124 | + | // | |
| 125 | + | // ## Credits and Acknowledgements | |
| 126 | + | // | |
| 127 | + | // The Credits page has the following default sections: | |
| 128 | + | // | |
| 129 | + | // * Developers, set with the [property@AboutDialog:developers] property, | |
| 130 | + | // * Designers, set with the [property@AboutDialog:designers] property, | |
| 131 | + | // * Artists, set with the [property@AboutDialog:artists] property, | |
| 132 | + | // * Documenters, set with the [property@AboutDialog:documenters] property, | |
| 133 | + | // * Translators, set with the [property@AboutDialog:translator-credits] property. | |
| 134 | + | // | |
| 135 | + | // When setting translator credits, use the strings `"translator-credits"` or | |
| 136 | + | // `"translator_credits"` and mark them as translatable. | |
| 137 | + | // | |
| 138 | + | // The default sections that don't contain any names won't be displayed. | |
| 139 | + | // | |
| 140 | + | // The Credits page can also contain an arbitrary number of extra sections below | |
| 141 | + | // the default ones. Use [method@AboutDialog.add_credit_section] to add them. | |
| 142 | + | // | |
| 143 | + | // The Acknowledgements page can be used to acknowledge additional people and | |
| 144 | + | // organizations for their non-development contributions. Use | |
| 145 | + | // [method@AboutDialog.add_acknowledgement_section] to add sections to it. For | |
| 146 | + | // example, it can be used to list backers in a crowdfunded project or to give | |
| 147 | + | // special thanks. | |
| 148 | + | // | |
| 149 | + | // Each of the people or organizations can have an email address or a website | |
| 150 | + | // specified. To add a email address, use a string like | |
| 151 | + | // `Edgar Allan Poe <edgar@poe.com>`. To specify a website with a title, use a | |
| 152 | + | // string like `The GNOME Project https://www.gnome.org`: | |
| 153 | + | // | |
| 154 | + | // <picture> | |
| 155 | + | // | |
| 156 | + | // <source srcset="about-dialog-credits-dark.png" media="(prefers-color-scheme: dark)"> | |
| 157 | + | // <img src="about-dialog-credits.png" alt="about-dialog-credits"> | |
| 158 | + | // | |
| 159 | + | // </picture> | |
| 160 | + | // | |
| 161 | + | // ## Legal | |
| 162 | + | // | |
| 163 | + | // The Legal page displays the copyright and licensing information for the | |
| 164 | + | // application and other modules. | |
| 165 | + | // | |
| 166 | + | // The copyright string is set with the [property@AboutDialog:copyright] | |
| 167 | + | // property and should be a short string of one or two lines, for example: | |
| 168 | + | // `© 2022 Example`. | |
| 169 | + | // | |
| 170 | + | // Licensing information can be quickly set from a list of known licenses with | |
| 171 | + | // the [property@AboutDialog:license-type] property. If the application's | |
| 172 | + | // license is not in the list, [property@AboutDialog:license] can be used | |
| 173 | + | // instead. | |
| 174 | + | // | |
| 175 | + | // To add information about other modules, such as application dependencies or | |
| 176 | + | // data, use [method@AboutDialog.add_legal_section]. | |
| 177 | + | // | |
| 178 | + | // ## Constructing | |
| 179 | + | // | |
| 180 | + | // To make constructing an `AdwAboutDialog` as convenient as possible, you can | |
| 181 | + | // use the function [func@show_about_dialog] which constructs and shows a | |
| 182 | + | // dialog. | |
| 183 | + | // | |
| 184 | + | // ```c | |
| 185 | + | // static void | |
| 186 | + | // show_about (GtkApplication *app) | |
| 187 | + | // | |
| 188 | + | // { | |
| 189 | + | // const char *developers[] = { | |
| 190 | + | // "Angela Avery", | |
| 191 | + | // NULL | |
| 192 | + | // }; | |
| 193 | + | // | |
| 194 | + | // const char *designers[] = { | |
| 195 | + | // "GNOME Design Team", | |
| 196 | + | // NULL | |
| 197 | + | // }; | |
| 198 | + | // | |
| 199 | + | // adw_show_about_dialog (GTK_WIDGET (gtk_application_get_active_window (app)), | |
| 200 | + | // "application-name", _("Example"), | |
| 201 | + | // "application-icon", "org.example.App", | |
| 202 | + | // "version", "1.2.3", | |
| 203 | + | // "copyright", "© 2022 Angela Avery", | |
| 204 | + | // "issue-url", "https://gitlab.gnome.org/example/example/-/issues/", | |
| 205 | + | // "license-type", GTK_LICENSE_GPL_3_0, | |
| 206 | + | // "developers", developers, | |
| 207 | + | // "designers", designers, | |
| 208 | + | // "translator-credits", _("translator-credits"), | |
| 209 | + | // NULL); | |
| 210 | + | // } | |
| 211 | + | // | |
| 212 | + | // ``` | |
| 213 | + | // | |
| 214 | + | // ## CSS nodes | |
| 215 | + | // | |
| 216 | + | // `AdwAboutDialog` has a main CSS node with the name `dialog` and the | |
| 217 | + | // style class `.about`. | |
| 218 | + | type AboutDialog struct { | |
| 219 | + | Dialog | |
| 220 | + | } | |
| 221 | + | ||
| 222 | + | var xAboutDialogGLibType func() types.GType | |
| 223 | + | ||
| 224 | + | func AboutDialogGLibType() types.GType { | |
| 225 | + | return xAboutDialogGLibType() | |
| 226 | + | } | |
| 227 | + | ||
| 228 | + | func AboutDialogNewFromInternalPtr(ptr uintptr) *AboutDialog { | |
| 229 | + | cls := &AboutDialog{} | |
| 230 | + | cls.Ptr = ptr | |
| 231 | + | return cls | |
| 232 | + | } | |
| 233 | + | ||
| 234 | + | var xNewAboutDialog func() uintptr | |
| 235 | + | ||
| 236 | + | // Creates a new `AdwAboutDialog`. | |
| 237 | + | func NewAboutDialog() *AboutDialog { | |
| 238 | + | var cls *AboutDialog | |
| 239 | + | ||
| 240 | + | cret := xNewAboutDialog() | |
| 241 | + | ||
| 242 | + | if cret == 0 { | |
| 243 | + | return nil | |
| 244 | + | } | |
| 245 | + | gobject.IncreaseRef(cret) | |
| 246 | + | cls = &AboutDialog{} | |
| 247 | + | cls.Ptr = cret | |
| 248 | + | return cls | |
| 249 | + | } | |
| 250 | + | ||
| 251 | + | var xNewAboutDialogFromAppdata func(string, string) uintptr | |
| 252 | + | ||
| 253 | + | // Creates a new `AdwAboutDialog` using AppStream metadata. | |
| 254 | + | // | |
| 255 | + | // This automatically sets the following properties with the following AppStream | |
| 256 | + | // values: | |
| 257 | + | // | |
| 258 | + | // - [property@AboutDialog:application-icon] is set from the `<id>` | |
| 259 | + | // - [property@AboutDialog:application-name] is set from the `<name>` | |
| 260 | + | // - [property@AboutDialog:developer-name] is set from the `<name>` within | |
| 261 | + | // `<developer>` | |
| 262 | + | // - [property@AboutDialog:version] is set from the version of the latest release | |
| 263 | + | // - [property@AboutDialog:website] is set from the `<url type="homepage">` | |
| 264 | + | // - [property@AboutDialog:support-url] is set from the `<url type="help">` | |
| 265 | + | // - [property@AboutDialog:issue-url] is set from the `<url type="bugtracker">` | |
| 266 | + | // - [property@AboutDialog:license-type] is set from the `<project_license>`. | |
| 267 | + | // If the license type retrieved from AppStream is not listed in | |
| 268 | + | // [enum@Gtk.License], it will be set to `GTK_LICENCE_CUSTOM`. | |
| 269 | + | // | |
| 270 | + | // If @release_notes_version is not `NULL`, | |
| 271 | + | // [property@AboutDialog:release-notes-version] is set to match it, while | |
| 272 | + | // [property@AboutDialog:release-notes] is set from the AppStream release | |
| 273 | + | // description for that version. | |
| 274 | + | func NewAboutDialogFromAppdata(ResourcePathVar string, ReleaseNotesVersionVar string) *AboutDialog { | |
| 275 | + | var cls *AboutDialog | |
| 276 | + | ||
| 277 | + | cret := xNewAboutDialogFromAppdata(ResourcePathVar, ReleaseNotesVersionVar) | |
| 278 | + | ||
| 279 | + | if cret == 0 { | |
| 280 | + | return nil | |
| 281 | + | } | |
| 282 | + | gobject.IncreaseRef(cret) | |
| 283 | + | cls = &AboutDialog{} | |
| 284 | + | cls.Ptr = cret | |
| 285 | + | return cls | |
| 286 | + | } | |
| 287 | + | ||
| 288 | + | var xAboutDialogAddAcknowledgementSection func(uintptr, string, []string) | |
| 289 | + | ||
| 290 | + | // Adds a section to the Acknowledgements page. | |
| 291 | + | // | |
| 292 | + | // This can be used to acknowledge additional people and organizations for their | |
| 293 | + | // non-development contributions - for example, backers in a crowdfunded | |
| 294 | + | // project. | |
| 295 | + | // | |
| 296 | + | // Each name may contain email addresses and URLs, see the introduction for more | |
| 297 | + | // details. | |
| 298 | + | // | |
| 299 | + | // See also: | |
| 300 | + | // | |
| 301 | + | // * [property@AboutDialog:developers] | |
| 302 | + | // * [property@AboutDialog:designers] | |
| 303 | + | // * [property@AboutDialog:artists] | |
| 304 | + | // * [property@AboutDialog:documenters] | |
| 305 | + | // * [property@AboutDialog:translator-credits] | |
| 306 | + | // * [method@AboutDialog.add_credit_section] | |
| 307 | + | func (x *AboutDialog) AddAcknowledgementSection(NameVar string, PeopleVar []string) { | |
| 308 | + | ||
| 309 | + | xAboutDialogAddAcknowledgementSection(x.GoPointer(), NameVar, PeopleVar) | |
| 310 | + | ||
| 311 | + | } | |
| 312 | + | ||
| 313 | + | var xAboutDialogAddCreditSection func(uintptr, string, []string) | |
| 314 | + | ||
| 315 | + | // Adds an extra section to the Credits page. | |
| 316 | + | // | |
| 317 | + | // Extra sections are displayed below the standard categories. | |
| 318 | + | // | |
| 319 | + | // Each name may contain email addresses and URLs, see the introduction for more | |
| 320 | + | // details. | |
| 321 | + | // | |
| 322 | + | // See also: | |
| 323 | + | // | |
| 324 | + | // * [property@AboutDialog:developers] | |
| 325 | + | // * [property@AboutDialog:designers] | |
| 326 | + | // * [property@AboutDialog:artists] | |
| 327 | + | // * [property@AboutDialog:documenters] | |
| 328 | + | // * [property@AboutDialog:translator-credits] | |
| 329 | + | // * [method@AboutDialog.add_acknowledgement_section] | |
| 330 | + | func (x *AboutDialog) AddCreditSection(NameVar string, PeopleVar []string) { | |
| 331 | + | ||
| 332 | + | xAboutDialogAddCreditSection(x.GoPointer(), NameVar, PeopleVar) | |
| 333 | + | ||
| 334 | + | } | |
| 335 | + | ||
| 336 | + | var xAboutDialogAddLegalSection func(uintptr, string, string, gtk.License, string) | |
| 337 | + | ||
| 338 | + | // Adds an extra section to the Legal page. | |
| 339 | + | // | |
| 340 | + | // Extra sections will be displayed below the application's own information. | |
| 341 | + | // | |
| 342 | + | // The parameters @copyright, @license_type and @license will be used to present | |
| 343 | + | // the it the same way as [property@AboutDialog:copyright], | |
| 344 | + | // [property@AboutDialog:license-type] and [property@AboutDialog:license] are | |
| 345 | + | // for the application's own information. | |
| 346 | + | // | |
| 347 | + | // See those properties for more details. | |
| 348 | + | // | |
| 349 | + | // This can be useful to attribute the application dependencies or data. | |
| 350 | + | // | |
| 351 | + | // Examples: | |
| 352 | + | // | |
| 353 | + | // ```c | |
| 354 | + | // adw_about_dialog_add_legal_section (ADW_ABOUT_DIALOG (about), | |
| 355 | + | // | |
| 356 | + | // _("Copyright and a known license"), | |
| 357 | + | // "© 2022 Example", | |
| 358 | + | // GTK_LICENSE_LGPL_2_1, | |
| 359 | + | // NULL); | |
| 360 | + | // | |
| 361 | + | // adw_about_dialog_add_legal_section (ADW_ABOUT_DIALOG (about), | |
| 362 | + | // | |
| 363 | + | // _("Copyright and custom license"), | |
| 364 | + | // "© 2022 Example", | |
| 365 | + | // GTK_LICENSE_CUSTOM, | |
| 366 | + | // "Custom license text"); | |
| 367 | + | // | |
| 368 | + | // adw_about_dialog_add_legal_section (ADW_ABOUT_DIALOG (about), | |
| 369 | + | // | |
| 370 | + | // _("Copyright only"), | |
| 371 | + | // "© 2022 Example", | |
| 372 | + | // GTK_LICENSE_UNKNOWN, | |
| 373 | + | // NULL); | |
| 374 | + | // | |
| 375 | + | // adw_about_dialog_add_legal_section (ADW_ABOUT_DIALOG (about), | |
| 376 | + | // | |
| 377 | + | // _("Custom license only"), | |
| 378 | + | // NULL, | |
| 379 | + | // GTK_LICENSE_CUSTOM, | |
| 380 | + | // "Something completely custom here."); | |
| 381 | + | // | |
| 382 | + | // ``` | |
| 383 | + | func (x *AboutDialog) AddLegalSection(TitleVar string, CopyrightVar string, LicenseTypeVar gtk.License, LicenseVar string) { | |
| 384 | + | ||
| 385 | + | xAboutDialogAddLegalSection(x.GoPointer(), TitleVar, CopyrightVar, LicenseTypeVar, LicenseVar) | |
| 386 | + | ||
| 387 | + | } | |
| 388 | + | ||
| 389 | + | var xAboutDialogAddLink func(uintptr, string, string) | |
| 390 | + | ||
| 391 | + | // Adds an extra link to the Details page. | |
| 392 | + | // | |
| 393 | + | // Extra links are displayed under the comment and website. | |
| 394 | + | // | |
| 395 | + | // Underlines in @title will be interpreted as indicating a mnemonic. | |
| 396 | + | // | |
| 397 | + | // See [property@AboutDialog:website]. | |
| 398 | + | func (x *AboutDialog) AddLink(TitleVar string, UrlVar string) { | |
| 399 | + | ||
| 400 | + | xAboutDialogAddLink(x.GoPointer(), TitleVar, UrlVar) | |
| 401 | + | ||
| 402 | + | } | |
| 403 | + | ||
| 404 | + | var xAboutDialogGetApplicationIcon func(uintptr) string | |
| 405 | + | ||
| 406 | + | // Gets the name of the application icon for @self. | |
| 407 | + | func (x *AboutDialog) GetApplicationIcon() string { | |
| 408 | + | ||
| 409 | + | cret := xAboutDialogGetApplicationIcon(x.GoPointer()) | |
| 410 | + | return cret | |
| 411 | + | } | |
| 412 | + | ||
| 413 | + | var xAboutDialogGetApplicationName func(uintptr) string | |
| 414 | + | ||
| 415 | + | // Gets the application name for @self. | |
| 416 | + | func (x *AboutDialog) GetApplicationName() string { | |
| 417 | + | ||
| 418 | + | cret := xAboutDialogGetApplicationName(x.GoPointer()) | |
| 419 | + | return cret | |
| 420 | + | } | |
| 421 | + | ||
| 422 | + | var xAboutDialogGetArtists func(uintptr) []string | |
| 423 | + | ||
| 424 | + | // Gets the list of artists of the application. | |
| 425 | + | func (x *AboutDialog) GetArtists() []string { | |
| 426 | + | ||
| 427 | + | cret := xAboutDialogGetArtists(x.GoPointer()) | |
| 428 | + | return cret | |
| 429 | + | } | |
| 430 | + | ||
| 431 | + | var xAboutDialogGetComments func(uintptr) string | |
| 432 | + | ||
| 433 | + | // Gets the comments about the application. | |
| 434 | + | func (x *AboutDialog) GetComments() string { | |
| 435 | + | ||
| 436 | + | cret := xAboutDialogGetComments(x.GoPointer()) | |
| 437 | + | return cret | |
| 438 | + | } | |
| 439 | + | ||
| 440 | + | var xAboutDialogGetCopyright func(uintptr) string | |
| 441 | + | ||
| 442 | + | // Gets the copyright information for @self. | |
| 443 | + | func (x *AboutDialog) GetCopyright() string { | |
| 444 | + | ||
| 445 | + | cret := xAboutDialogGetCopyright(x.GoPointer()) | |
| 446 | + | return cret | |
| 447 | + | } | |
| 448 | + | ||
| 449 | + | var xAboutDialogGetDebugInfo func(uintptr) string | |
| 450 | + | ||
| 451 | + | // Gets the debug information for @self. | |
| 452 | + | func (x *AboutDialog) GetDebugInfo() string { | |
| 453 | + | ||
| 454 | + | cret := xAboutDialogGetDebugInfo(x.GoPointer()) | |
| 455 | + | return cret | |
| 456 | + | } | |
| 457 | + | ||
| 458 | + | var xAboutDialogGetDebugInfoFilename func(uintptr) string | |
| 459 | + | ||
| 460 | + | // Gets the debug information filename for @self. | |
| 461 | + | func (x *AboutDialog) GetDebugInfoFilename() string { | |
| 462 | + | ||
| 463 | + | cret := xAboutDialogGetDebugInfoFilename(x.GoPointer()) | |
| 464 | + | return cret | |
| 465 | + | } | |
| 466 | + | ||
| 467 | + | var xAboutDialogGetDesigners func(uintptr) []string | |
| 468 | + | ||
| 469 | + | // Gets the list of designers of the application. | |
| 470 | + | func (x *AboutDialog) GetDesigners() []string { | |
| 471 | + | ||
| 472 | + | cret := xAboutDialogGetDesigners(x.GoPointer()) | |
| 473 | + | return cret | |
| 474 | + | } | |
| 475 | + | ||
| 476 | + | var xAboutDialogGetDeveloperName func(uintptr) string | |
| 477 | + | ||
| 478 | + | // Gets the developer name for @self. | |
| 479 | + | func (x *AboutDialog) GetDeveloperName() string { | |
| 480 | + | ||
| 481 | + | cret := xAboutDialogGetDeveloperName(x.GoPointer()) | |
| 482 | + | return cret | |
| 483 | + | } | |
| 484 | + | ||
| 485 | + | var xAboutDialogGetDevelopers func(uintptr) []string | |
| 486 | + | ||
| 487 | + | // Gets the list of developers of the application. | |
| 488 | + | func (x *AboutDialog) GetDevelopers() []string { | |
| 489 | + | ||
| 490 | + | cret := xAboutDialogGetDevelopers(x.GoPointer()) | |
| 491 | + | return cret | |
| 492 | + | } | |
| 493 | + | ||
| 494 | + | var xAboutDialogGetDocumenters func(uintptr) []string | |
| 495 | + | ||
| 496 | + | // Gets the list of documenters of the application. | |
| 497 | + | func (x *AboutDialog) GetDocumenters() []string { | |
| 498 | + | ||
| 499 | + | cret := xAboutDialogGetDocumenters(x.GoPointer()) | |
| 500 | + | return cret | |
| 501 | + | } | |
| 502 | + | ||
| 503 | + | var xAboutDialogGetIssueUrl func(uintptr) string | |
| 504 | + | ||
| 505 | + | // Gets the issue tracker URL for @self. | |
| 506 | + | func (x *AboutDialog) GetIssueUrl() string { | |
| 507 | + | ||
| 508 | + | cret := xAboutDialogGetIssueUrl(x.GoPointer()) | |
| 509 | + | return cret | |
| 510 | + | } | |
| 511 | + | ||
| 512 | + | var xAboutDialogGetLicense func(uintptr) string | |
| 513 | + | ||
| 514 | + | // Gets the license for @self. | |
| 515 | + | func (x *AboutDialog) GetLicense() string { | |
| 516 | + | ||
| 517 | + | cret := xAboutDialogGetLicense(x.GoPointer()) | |
| 518 | + | return cret | |
| 519 | + | } | |
| 520 | + | ||
| 521 | + | var xAboutDialogGetLicenseType func(uintptr) gtk.License | |
| 522 | + | ||
| 523 | + | // Gets the license type for @self. | |
| 524 | + | func (x *AboutDialog) GetLicenseType() gtk.License { | |
| 525 | + | ||
| 526 | + | cret := xAboutDialogGetLicenseType(x.GoPointer()) | |
| 527 | + | return cret | |
| 528 | + | } | |
| 529 | + | ||
| 530 | + | var xAboutDialogGetReleaseNotes func(uintptr) string | |
| 531 | + | ||
| 532 | + | // Gets the release notes for @self. | |
| 533 | + | func (x *AboutDialog) GetReleaseNotes() string { | |
| 534 | + | ||
| 535 | + | cret := xAboutDialogGetReleaseNotes(x.GoPointer()) | |
| 536 | + | return cret | |
| 537 | + | } | |
| 538 | + | ||
| 539 | + | var xAboutDialogGetReleaseNotesVersion func(uintptr) string | |
| 540 | + | ||
| 541 | + | // Gets the version described by the application's release notes. | |
| 542 | + | func (x *AboutDialog) GetReleaseNotesVersion() string { | |
| 543 | + | ||
| 544 | + | cret := xAboutDialogGetReleaseNotesVersion(x.GoPointer()) | |
| 545 | + | return cret | |
| 546 | + | } | |
| 547 | + | ||
| 548 | + | var xAboutDialogGetSupportUrl func(uintptr) string | |
| 549 | + | ||
| 550 | + | // Gets the URL of the support page for @self. | |
| 551 | + | func (x *AboutDialog) GetSupportUrl() string { | |
| 552 | + | ||
| 553 | + | cret := xAboutDialogGetSupportUrl(x.GoPointer()) | |
| 554 | + | return cret | |
| 555 | + | } | |
| 556 | + | ||
| 557 | + | var xAboutDialogGetTranslatorCredits func(uintptr) string | |
| 558 | + | ||
| 559 | + | // Gets the translator credits string. | |
| 560 | + | func (x *AboutDialog) GetTranslatorCredits() string { | |
| 561 | + | ||
| 562 | + | cret := xAboutDialogGetTranslatorCredits(x.GoPointer()) | |
| 563 | + | return cret | |
| 564 | + | } | |
| 565 | + | ||
| 566 | + | var xAboutDialogGetVersion func(uintptr) string | |
| 567 | + | ||
| 568 | + | // Gets the version for @self. | |
| 569 | + | func (x *AboutDialog) GetVersion() string { | |
| 570 | + | ||
| 571 | + | cret := xAboutDialogGetVersion(x.GoPointer()) | |
| 572 | + | return cret | |
| 573 | + | } | |
| 574 | + | ||
| 575 | + | var xAboutDialogGetWebsite func(uintptr) string | |
| 576 | + | ||
| 577 | + | // Gets the application website URL for @self. | |
| 578 | + | func (x *AboutDialog) GetWebsite() string { | |
| 579 | + | ||
| 580 | + | cret := xAboutDialogGetWebsite(x.GoPointer()) | |
| 581 | + | return cret | |
| 582 | + | } | |
| 583 | + | ||
| 584 | + | var xAboutDialogSetApplicationIcon func(uintptr, string) | |
| 585 | + | ||
| 586 | + | // Sets the name of the application icon for @self. | |
| 587 | + | // | |
| 588 | + | // The icon is displayed at the top of the main page. | |
| 589 | + | func (x *AboutDialog) SetApplicationIcon(ApplicationIconVar string) { | |
| 590 | + | ||
| 591 | + | xAboutDialogSetApplicationIcon(x.GoPointer(), ApplicationIconVar) | |
| 592 | + | ||
| 593 | + | } | |
| 594 | + | ||
| 595 | + | var xAboutDialogSetApplicationName func(uintptr, string) | |
| 596 | + | ||
| 597 | + | // Sets the application name for @self. | |
| 598 | + | // | |
| 599 | + | // The name is displayed at the top of the main page. | |
| 600 | + | func (x *AboutDialog) SetApplicationName(ApplicationNameVar string) { | |
| 601 | + | ||
| 602 | + | xAboutDialogSetApplicationName(x.GoPointer(), ApplicationNameVar) | |
| 603 | + | ||
| 604 | + | } | |
| 605 | + | ||
| 606 | + | var xAboutDialogSetArtists func(uintptr, []string) | |
| 607 | + | ||
| 608 | + | // Sets the list of artists of the application. | |
| 609 | + | // | |
| 610 | + | // It will be displayed on the Credits page. | |
| 611 | + | // | |
| 612 | + | // Each name may contain email addresses and URLs, see the introduction for more | |
| 613 | + | // details. | |
| 614 | + | // | |
| 615 | + | // See also: | |
| 616 | + | // | |
| 617 | + | // * [property@AboutDialog:developers] | |
| 618 | + | // * [property@AboutDialog:designers] | |
| 619 | + | // * [property@AboutDialog:documenters] | |
| 620 | + | // * [property@AboutDialog:translator-credits] | |
| 621 | + | // * [method@AboutDialog.add_credit_section] | |
| 622 | + | // * [method@AboutDialog.add_acknowledgement_section] | |
| 623 | + | func (x *AboutDialog) SetArtists(ArtistsVar []string) { | |
| 624 | + | ||
| 625 | + | xAboutDialogSetArtists(x.GoPointer(), ArtistsVar) | |
| 626 | + | ||
| 627 | + | } | |
| 628 | + | ||
| 629 | + | var xAboutDialogSetComments func(uintptr, string) | |
| 630 | + | ||
| 631 | + | // Sets the comments about the application. | |
| 632 | + | // | |
| 633 | + | // Comments will be shown on the Details page, above links. | |
| 634 | + | // | |
| 635 | + | // Unlike [property@Gtk.AboutDialog:comments], this string can be long and | |
| 636 | + | // detailed. It can also contain links and Pango markup. | |
| 637 | + | func (x *AboutDialog) SetComments(CommentsVar string) { | |
| 638 | + | ||
| 639 | + | xAboutDialogSetComments(x.GoPointer(), CommentsVar) | |
| 640 | + | ||
| 641 | + | } | |
| 642 | + | ||
| 643 | + | var xAboutDialogSetCopyright func(uintptr, string) | |
| 644 | + | ||
| 645 | + | // Sets the copyright information for @self. | |
| 646 | + | // | |
| 647 | + | // This should be a short string of one or two lines, for example: | |
| 648 | + | // `© 2022 Example`. | |
| 649 | + | // | |
| 650 | + | // The copyright information will be displayed on the Legal page, before the | |
| 651 | + | // application license. | |
| 652 | + | // | |
| 653 | + | // [method@AboutDialog.add_legal_section] can be used to add copyright | |
| 654 | + | // information for the application dependencies or other components. | |
| 655 | + | func (x *AboutDialog) SetCopyright(CopyrightVar string) { | |
| 656 | + | ||
| 657 | + | xAboutDialogSetCopyright(x.GoPointer(), CopyrightVar) | |
| 658 | + | ||
| 659 | + | } | |
| 660 | + | ||
| 661 | + | var xAboutDialogSetDebugInfo func(uintptr, string) | |
| 662 | + | ||
| 663 | + | // Sets the debug information for @self. | |
| 664 | + | // | |
| 665 | + | // Debug information will be shown on the Troubleshooting page. It's intended | |
| 666 | + | // to be attached to issue reports when reporting issues against the | |
| 667 | + | // application. | |
| 668 | + | // | |
| 669 | + | // `AdwAboutDialog` provides a quick way to save debug information to a file. | |
| 670 | + | // When saving, [property@AboutDialog:debug-info-filename] would be used as | |
| 671 | + | // the suggested filename. | |
| 672 | + | // | |
| 673 | + | // Debug information cannot contain markup or links. | |
| 674 | + | func (x *AboutDialog) SetDebugInfo(DebugInfoVar string) { | |
| 675 | + | ||
| 676 | + | xAboutDialogSetDebugInfo(x.GoPointer(), DebugInfoVar) | |
| 677 | + | ||
| 678 | + | } | |
| 679 | + | ||
| 680 | + | var xAboutDialogSetDebugInfoFilename func(uintptr, string) | |
| 681 | + | ||
| 682 | + | // Sets the debug information filename for @self. | |
| 683 | + | // | |
| 684 | + | // It will be used as the suggested filename when saving debug information to a | |
| 685 | + | // file. | |
| 686 | + | // | |
| 687 | + | // See [property@AboutDialog:debug-info]. | |
| 688 | + | func (x *AboutDialog) SetDebugInfoFilename(FilenameVar string) { | |
| 689 | + | ||
| 690 | + | xAboutDialogSetDebugInfoFilename(x.GoPointer(), FilenameVar) | |
| 691 | + | ||
| 692 | + | } | |
| 693 | + | ||
| 694 | + | var xAboutDialogSetDesigners func(uintptr, []string) | |
| 695 | + | ||
| 696 | + | // Sets the list of designers of the application. | |
| 697 | + | // | |
| 698 | + | // It will be displayed on the Credits page. | |
| 699 | + | // | |
| 700 | + | // Each name may contain email addresses and URLs, see the introduction for more | |
| 701 | + | // details. | |
| 702 | + | // | |
| 703 | + | // See also: | |
| 704 | + | // | |
| 705 | + | // * [property@AboutDialog:developers] | |
| 706 | + | // * [property@AboutDialog:artists] | |
| 707 | + | // * [property@AboutDialog:documenters] | |
| 708 | + | // * [property@AboutDialog:translator-credits] | |
| 709 | + | // * [method@AboutDialog.add_credit_section] | |
| 710 | + | // * [method@AboutDialog.add_acknowledgement_section] | |
| 711 | + | func (x *AboutDialog) SetDesigners(DesignersVar []string) { | |
| 712 | + | ||
| 713 | + | xAboutDialogSetDesigners(x.GoPointer(), DesignersVar) | |
| 714 | + | ||
| 715 | + | } | |
| 716 | + | ||
| 717 | + | var xAboutDialogSetDeveloperName func(uintptr, string) | |
| 718 | + | ||
| 719 | + | // Sets the developer name for @self. | |
| 720 | + | // | |
| 721 | + | // The developer name is displayed on the main page, under the application name. | |
| 722 | + | // | |
| 723 | + | // If the application is developed by multiple people, the developer name can be | |
| 724 | + | // set to values like "AppName team", "AppName developers" or | |
| 725 | + | // "The AppName project", and the individual contributors can be listed on the | |
| 726 | + | // Credits page, with [property@AboutDialog:developers] and related properties. | |
| 727 | + | func (x *AboutDialog) SetDeveloperName(DeveloperNameVar string) { | |
| 728 | + | ||
| 729 | + | xAboutDialogSetDeveloperName(x.GoPointer(), DeveloperNameVar) | |
| 730 | + | ||
| 731 | + | } | |
| 732 | + | ||
| 733 | + | var xAboutDialogSetDevelopers func(uintptr, []string) | |
| 734 | + | ||
| 735 | + | // Sets the list of developers of the application. | |
| 736 | + | // | |
| 737 | + | // It will be displayed on the Credits page. | |
| 738 | + | // | |
| 739 | + | // Each name may contain email addresses and URLs, see the introduction for more | |
| 740 | + | // details. | |
| 741 | + | // | |
| 742 | + | // See also: | |
| 743 | + | // | |
| 744 | + | // * [property@AboutDialog:designers] | |
| 745 | + | // * [property@AboutDialog:artists] | |
| 746 | + | // * [property@AboutDialog:documenters] | |
| 747 | + | // * [property@AboutDialog:translator-credits] | |
| 748 | + | // * [method@AboutDialog.add_credit_section] | |
| 749 | + | // * [method@AboutDialog.add_acknowledgement_section] | |
| 750 | + | func (x *AboutDialog) SetDevelopers(DevelopersVar []string) { | |
| 751 | + | ||
| 752 | + | xAboutDialogSetDevelopers(x.GoPointer(), DevelopersVar) | |
| 753 | + | ||
| 754 | + | } | |
| 755 | + | ||
| 756 | + | var xAboutDialogSetDocumenters func(uintptr, []string) | |
| 757 | + | ||
| 758 | + | // Sets the list of documenters of the application. | |
| 759 | + | // | |
| 760 | + | // It will be displayed on the Credits page. | |
| 761 | + | // | |
| 762 | + | // Each name may contain email addresses and URLs, see the introduction for more | |
| 763 | + | // details. | |
| 764 | + | // | |
| 765 | + | // See also: | |
| 766 | + | // | |
| 767 | + | // * [property@AboutDialog:developers] | |
| 768 | + | // * [property@AboutDialog:designers] | |
| 769 | + | // * [property@AboutDialog:artists] | |
| 770 | + | // * [property@AboutDialog:translator-credits] | |
| 771 | + | // * [method@AboutDialog.add_credit_section] | |
| 772 | + | // * [method@AboutDialog.add_acknowledgement_section] | |
| 773 | + | func (x *AboutDialog) SetDocumenters(DocumentersVar []string) { | |
| 774 | + | ||
| 775 | + | xAboutDialogSetDocumenters(x.GoPointer(), DocumentersVar) | |
| 776 | + | ||
| 777 | + | } | |
| 778 | + | ||
| 779 | + | var xAboutDialogSetIssueUrl func(uintptr, string) | |
| 780 | + | ||
| 781 | + | // Sets the issue tracker URL for @self. | |
| 782 | + | // | |
| 783 | + | // The issue tracker link is displayed on the main page. | |
| 784 | + | func (x *AboutDialog) SetIssueUrl(IssueUrlVar string) { | |
| 785 | + | ||
| 786 | + | xAboutDialogSetIssueUrl(x.GoPointer(), IssueUrlVar) | |
| 787 | + | ||
| 788 | + | } | |
| 789 | + | ||
| 790 | + | var xAboutDialogSetLicense func(uintptr, string) | |
| 791 | + | ||
| 792 | + | // Sets the license for @self. | |
| 793 | + | // | |
| 794 | + | // This can be used to set a custom text for the license if it can't be set via | |
| 795 | + | // [property@AboutDialog:license-type]. | |
| 796 | + | // | |
| 797 | + | // When set, [property@AboutDialog:license-type] will be set to | |
| 798 | + | // `GTK_LICENSE_CUSTOM`. | |
| 799 | + | // | |
| 800 | + | // The license text will be displayed on the Legal page, below the copyright | |
| 801 | + | // information. | |
| 802 | + | // | |
| 803 | + | // License text can contain Pango markup and links. | |
| 804 | + | // | |
| 805 | + | // [method@AboutDialog.add_legal_section] can be used to add license information | |
| 806 | + | // for the application dependencies or other components. | |
| 807 | + | func (x *AboutDialog) SetLicense(LicenseVar string) { | |
| 808 | + | ||
| 809 | + | xAboutDialogSetLicense(x.GoPointer(), LicenseVar) | |
| 810 | + | ||
| 811 | + | } | |
| 812 | + | ||
| 813 | + | var xAboutDialogSetLicenseType func(uintptr, gtk.License) | |
| 814 | + | ||
| 815 | + | // Sets the license for @self from a list of known licenses. | |
| 816 | + | // | |
| 817 | + | // If the application's license is not in the list, | |
| 818 | + | // [property@AboutDialog:license] can be used instead. The license type will be | |
| 819 | + | // automatically set to `GTK_LICENSE_CUSTOM` in that case. | |
| 820 | + | // | |
| 821 | + | // If @license_type is `GTK_LICENSE_UNKNOWN`, no information will be displayed. | |
| 822 | + | // | |
| 823 | + | // If @license_type is different from `GTK_LICENSE_CUSTOM`. | |
| 824 | + | // [property@AboutDialog:license] will be cleared out. | |
| 825 | + | // | |
| 826 | + | // The license description will be displayed on the Legal page, below the | |
| 827 | + | // copyright information. | |
| 828 | + | // | |
| 829 | + | // [method@AboutDialog.add_legal_section] can be used to add license information | |
| 830 | + | // for the application dependencies or other components. | |
| 831 | + | func (x *AboutDialog) SetLicenseType(LicenseTypeVar gtk.License) { | |
| 832 | + | ||
| 833 | + | xAboutDialogSetLicenseType(x.GoPointer(), LicenseTypeVar) | |
| 834 | + | ||
| 835 | + | } | |
| 836 | + | ||
| 837 | + | var xAboutDialogSetReleaseNotes func(uintptr, string) | |
| 838 | + | ||
| 839 | + | // Sets the release notes for @self. | |
| 840 | + | // | |
| 841 | + | // Release notes are displayed on the the What's New page. | |
| 842 | + | // | |
| 843 | + | // Release notes are formatted the same way as | |
| 844 | + | // [AppStream descriptions](https://freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-description). | |
| 845 | + | // | |
| 846 | + | // The supported formatting options are: | |
| 847 | + | // | |
| 848 | + | // * Paragraph (`<p>`) | |
| 849 | + | // * Ordered list (`<ol>`), with list items (`<li>`) | |
| 850 | + | // * Unordered list (`<ul>`), with list items (`<li>`) | |
| 851 | + | // | |
| 852 | + | // Within paragraphs and list items, emphasis (`<em>`) and inline code | |
| 853 | + | // (`<code>`) text styles are supported. The emphasis is rendered in italic, | |
| 854 | + | // while inline code is shown in a monospaced font. | |
| 855 | + | // | |
| 856 | + | // Any text outside paragraphs or list items is ignored. | |
| 857 | + | // | |
| 858 | + | // Nested lists are not supported. | |
| 859 | + | // | |
| 860 | + | // `AdwAboutDialog` displays the version above the release notes. If set, the | |
| 861 | + | // [property@AboutDialog:release-notes-version] of the property will be used | |
| 862 | + | // as the version; otherwise, [property@AboutDialog:version] is used. | |
| 863 | + | func (x *AboutDialog) SetReleaseNotes(ReleaseNotesVar string) { | |
| 864 | + | ||
| 865 | + | xAboutDialogSetReleaseNotes(x.GoPointer(), ReleaseNotesVar) | |
| 866 | + | ||
| 867 | + | } | |
| 868 | + | ||
| 869 | + | var xAboutDialogSetReleaseNotesVersion func(uintptr, string) | |
| 870 | + | ||
| 871 | + | // Sets the version described by the application's release notes. | |
| 872 | + | // | |
| 873 | + | // The release notes version is displayed on the What's New page, above the | |
| 874 | + | // release notes. | |
| 875 | + | // | |
| 876 | + | // If not set, [property@AboutDialog:version] will be used instead. | |
| 877 | + | // | |
| 878 | + | // For example, an application with the current version 2.0.2 might want to | |
| 879 | + | // keep the release notes from 2.0.0, and set the release notes version | |
| 880 | + | // accordingly. | |
| 881 | + | // | |
| 882 | + | // See [property@AboutDialog:release-notes]. | |
| 883 | + | func (x *AboutDialog) SetReleaseNotesVersion(VersionVar string) { | |
| 884 | + | ||
| 885 | + | xAboutDialogSetReleaseNotesVersion(x.GoPointer(), VersionVar) | |
| 886 | + | ||
| 887 | + | } | |
| 888 | + | ||
| 889 | + | var xAboutDialogSetSupportUrl func(uintptr, string) | |
| 890 | + | ||
| 891 | + | // Sets the URL of the support page for @self. | |
| 892 | + | // | |
| 893 | + | // The support page link is displayed on the main page. | |
| 894 | + | func (x *AboutDialog) SetSupportUrl(SupportUrlVar string) { | |
| 895 | + | ||
| 896 | + | xAboutDialogSetSupportUrl(x.GoPointer(), SupportUrlVar) | |
| 897 | + | ||
| 898 | + | } | |
| 899 | + | ||
| 900 | + | var xAboutDialogSetTranslatorCredits func(uintptr, string) | |
| 901 | + | ||
| 902 | + | // Sets the translator credits string. | |
| 903 | + | // | |
| 904 | + | // It will be displayed on the Credits page. | |
| 905 | + | // | |
| 906 | + | // This string should be `"translator-credits"` or `"translator_credits"` and | |
| 907 | + | // should be marked as translatable. | |
| 908 | + | // | |
| 909 | + | // The string may contain email addresses and URLs, see the introduction for | |
| 910 | + | // more details. | |
| 911 | + | // | |
| 912 | + | // See also: | |
| 913 | + | // | |
| 914 | + | // * [property@AboutDialog:developers] | |
| 915 | + | // * [property@AboutDialog:designers] | |
| 916 | + | // * [property@AboutDialog:artists] | |
| 917 | + | // * [property@AboutDialog:documenters] | |
| 918 | + | // * [method@AboutDialog.add_credit_section] | |
| 919 | + | // * [method@AboutDialog.add_acknowledgement_section] | |
| 920 | + | func (x *AboutDialog) SetTranslatorCredits(TranslatorCreditsVar string) { | |
| 921 | + | ||
| 922 | + | xAboutDialogSetTranslatorCredits(x.GoPointer(), TranslatorCreditsVar) | |
| 923 | + | ||
| 924 | + | } | |
| 925 | + | ||
| 926 | + | var xAboutDialogSetVersion func(uintptr, string) | |
| 927 | + | ||
| 928 | + | // Sets the version for @self. | |
| 929 | + | // | |
| 930 | + | // The version is displayed on the main page. | |
| 931 | + | // | |
| 932 | + | // If [property@AboutDialog:release-notes-version] is not set, the version will | |
| 933 | + | // also be displayed above the release notes on the What's New page. | |
| 934 | + | func (x *AboutDialog) SetVersion(VersionVar string) { | |
| 935 | + | ||
| 936 | + | xAboutDialogSetVersion(x.GoPointer(), VersionVar) | |
| 937 | + | ||
| 938 | + | } | |
| 939 | + | ||
| 940 | + | var xAboutDialogSetWebsite func(uintptr, string) | |
| 941 | + | ||
| 942 | + | // Sets the application website URL for @self. | |
| 943 | + | // | |
| 944 | + | // Website is displayed on the Details page, below comments, or on the main page | |
| 945 | + | // if the Details page doesn't have any other content. | |
| 946 | + | // | |
| 947 | + | // Applications can add other links below, see [method@AboutDialog.add_link]. | |
| 948 | + | func (x *AboutDialog) SetWebsite(WebsiteVar string) { | |
| 949 | + | ||
| 950 | + | xAboutDialogSetWebsite(x.GoPointer(), WebsiteVar) | |
| 951 | + | ||
| 952 | + | } | |
| 953 | + | ||
| 954 | + | func (c *AboutDialog) GoPointer() uintptr { | |
| 955 | + | return c.Ptr | |
| 956 | + | } | |
| 957 | + | ||
| 958 | + | func (c *AboutDialog) SetGoPointer(ptr uintptr) { | |
| 959 | + | c.Ptr = ptr | |
| 960 | + | } | |
| 961 | + | ||
| 962 | + | // Emitted when a URL is activated. | |
| 963 | + | // | |
| 964 | + | // Applications may connect to it to override the default behavior, which is | |
| 965 | + | // to call [func@Gtk.show_uri]. | |
| 966 | + | func (x *AboutDialog) ConnectActivateLink(cb *func(AboutDialog, string) bool) uint32 { | |
| 967 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 968 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 969 | + | return gobject.SignalConnect(x.GoPointer(), "activate-link", cbRefPtr) | |
| 970 | + | } | |
| 971 | + | ||
| 972 | + | fcb := func(clsPtr uintptr, UriVarp string) bool { | |
| 973 | + | fa := AboutDialog{} | |
| 974 | + | fa.Ptr = clsPtr | |
| 975 | + | cbFn := *cb | |
| 976 | + | ||
| 977 | + | return cbFn(fa, UriVarp) | |
| 978 | + | ||
| 979 | + | } | |
| 980 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 981 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 982 | + | return gobject.SignalConnect(x.GoPointer(), "activate-link", cbRefPtr) | |
| 983 | + | } | |
| 984 | + | ||
| 985 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 986 | + | func (x *AboutDialog) GetAccessibleRole() gtk.AccessibleRole { | |
| 987 | + | ||
| 988 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 989 | + | return cret | |
| 990 | + | } | |
| 991 | + | ||
| 992 | + | // Resets the accessible @property to its default value. | |
| 993 | + | func (x *AboutDialog) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 994 | + | ||
| 995 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 996 | + | ||
| 997 | + | } | |
| 998 | + | ||
| 999 | + | // Resets the accessible @relation to its default value. | |
| 1000 | + | func (x *AboutDialog) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 1001 | + | ||
| 1002 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 1003 | + | ||
| 1004 | + | } | |
| 1005 | + | ||
| 1006 | + | // Resets the accessible @state to its default value. | |
| 1007 | + | func (x *AboutDialog) ResetState(StateVar gtk.AccessibleState) { | |
| 1008 | + | ||
| 1009 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 1010 | + | ||
| 1011 | + | } | |
| 1012 | + | ||
| 1013 | + | // Updates a list of accessible properties. | |
| 1014 | + | // | |
| 1015 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 1016 | + | // value types of accessible properties. | |
| 1017 | + | // | |
| 1018 | + | // This function should be called by `GtkWidget` types whenever | |
| 1019 | + | // an accessible property change must be communicated to assistive | |
| 1020 | + | // technologies. | |
| 1021 | + | // | |
| 1022 | + | // Example: | |
| 1023 | + | // ```c | |
| 1024 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 1025 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 1026 | + | // | |
| 1027 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 1028 | + | // -1); | |
| 1029 | + | // | |
| 1030 | + | // ``` | |
| 1031 | + | func (x *AboutDialog) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 1032 | + | ||
| 1033 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 1034 | + | ||
| 1035 | + | } | |
| 1036 | + | ||
| 1037 | + | // Updates an array of accessible properties. | |
| 1038 | + | // | |
| 1039 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 1040 | + | // property change must be communicated to assistive technologies. | |
| 1041 | + | // | |
| 1042 | + | // This function is meant to be used by language bindings. | |
| 1043 | + | func (x *AboutDialog) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 1044 | + | ||
| 1045 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 1046 | + | ||
| 1047 | + | } | |
| 1048 | + | ||
| 1049 | + | // Updates a list of accessible relations. | |
| 1050 | + | // | |
| 1051 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 1052 | + | // relation change must be communicated to assistive technologies. | |
| 1053 | + | // | |
| 1054 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 1055 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 1056 | + | // | |
| 1057 | + | // ```c | |
| 1058 | + | // gtk_accessible_update_relation (accessible, | |
| 1059 | + | // | |
| 1060 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 1061 | + | // ref1, NULL, | |
| 1062 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 1063 | + | // ref1, ref2, ref3, NULL, | |
| 1064 | + | // -1); | |
| 1065 | + | // | |
| 1066 | + | // ``` | |
| 1067 | + | func (x *AboutDialog) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 1068 | + | ||
| 1069 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 1070 | + | ||
| 1071 | + | } | |
| 1072 | + | ||
| 1073 | + | // Updates an array of accessible relations. | |
| 1074 | + | // | |
| 1075 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 1076 | + | // relation change must be communicated to assistive technologies. | |
| 1077 | + | // | |
| 1078 | + | // This function is meant to be used by language bindings. | |
| 1079 | + | func (x *AboutDialog) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 1080 | + | ||
| 1081 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 1082 | + | ||
| 1083 | + | } | |
| 1084 | + | ||
| 1085 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 1086 | + | // documentation for the value types of accessible states. | |
| 1087 | + | // | |
| 1088 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 1089 | + | // state change must be communicated to assistive technologies. | |
| 1090 | + | // | |
| 1091 | + | // Example: | |
| 1092 | + | // ```c | |
| 1093 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 1094 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 1095 | + | // | |
| 1096 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 1097 | + | // -1); | |
| 1098 | + | // | |
| 1099 | + | // ``` | |
| 1100 | + | func (x *AboutDialog) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 1101 | + | ||
| 1102 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 1103 | + | ||
| 1104 | + | } | |
| 1105 | + | ||
| 1106 | + | // Updates an array of accessible states. | |
| 1107 | + | // | |
| 1108 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 1109 | + | // state change must be communicated to assistive technologies. | |
| 1110 | + | // | |
| 1111 | + | // This function is meant to be used by language bindings. | |
| 1112 | + | func (x *AboutDialog) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 1113 | + | ||
| 1114 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 1115 | + | ||
| 1116 | + | } | |
| 1117 | + | ||
| 1118 | + | // Gets the ID of the @buildable object. | |
| 1119 | + | // | |
| 1120 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 1121 | + | // of the <object> tag used to construct the @buildable. | |
| 1122 | + | func (x *AboutDialog) GetBuildableId() string { | |
| 1123 | + | ||
| 1124 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 1125 | + | return cret | |
| 1126 | + | } | |
| 1127 | + | ||
| 1128 | + | func init() { | |
| 1129 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 1130 | + | if err != nil { | |
| 1131 | + | panic(err) | |
| 1132 | + | } | |
| 1133 | + | ||
| 1134 | + | core.PuregoSafeRegister(&xShowAboutDialog, lib, "adw_show_about_dialog") | |
| 1135 | + | core.PuregoSafeRegister(&xShowAboutDialogFromAppdata, lib, "adw_show_about_dialog_from_appdata") | |
| 1136 | + | ||
| 1137 | + | core.PuregoSafeRegister(&xAboutDialogGLibType, lib, "adw_about_dialog_get_type") | |
| 1138 | + | ||
| 1139 | + | core.PuregoSafeRegister(&xNewAboutDialog, lib, "adw_about_dialog_new") | |
| 1140 | + | core.PuregoSafeRegister(&xNewAboutDialogFromAppdata, lib, "adw_about_dialog_new_from_appdata") | |
| 1141 | + | ||
| 1142 | + | core.PuregoSafeRegister(&xAboutDialogAddAcknowledgementSection, lib, "adw_about_dialog_add_acknowledgement_section") | |
| 1143 | + | core.PuregoSafeRegister(&xAboutDialogAddCreditSection, lib, "adw_about_dialog_add_credit_section") | |
| 1144 | + | core.PuregoSafeRegister(&xAboutDialogAddLegalSection, lib, "adw_about_dialog_add_legal_section") | |
| 1145 | + | core.PuregoSafeRegister(&xAboutDialogAddLink, lib, "adw_about_dialog_add_link") | |
| 1146 | + | core.PuregoSafeRegister(&xAboutDialogGetApplicationIcon, lib, "adw_about_dialog_get_application_icon") | |
| 1147 | + | core.PuregoSafeRegister(&xAboutDialogGetApplicationName, lib, "adw_about_dialog_get_application_name") | |
| 1148 | + | core.PuregoSafeRegister(&xAboutDialogGetArtists, lib, "adw_about_dialog_get_artists") | |
| 1149 | + | core.PuregoSafeRegister(&xAboutDialogGetComments, lib, "adw_about_dialog_get_comments") | |
| 1150 | + | core.PuregoSafeRegister(&xAboutDialogGetCopyright, lib, "adw_about_dialog_get_copyright") | |
| 1151 | + | core.PuregoSafeRegister(&xAboutDialogGetDebugInfo, lib, "adw_about_dialog_get_debug_info") | |
| 1152 | + | core.PuregoSafeRegister(&xAboutDialogGetDebugInfoFilename, lib, "adw_about_dialog_get_debug_info_filename") | |
| 1153 | + | core.PuregoSafeRegister(&xAboutDialogGetDesigners, lib, "adw_about_dialog_get_designers") | |
| 1154 | + | core.PuregoSafeRegister(&xAboutDialogGetDeveloperName, lib, "adw_about_dialog_get_developer_name") | |
| 1155 | + | core.PuregoSafeRegister(&xAboutDialogGetDevelopers, lib, "adw_about_dialog_get_developers") | |
| 1156 | + | core.PuregoSafeRegister(&xAboutDialogGetDocumenters, lib, "adw_about_dialog_get_documenters") | |
| 1157 | + | core.PuregoSafeRegister(&xAboutDialogGetIssueUrl, lib, "adw_about_dialog_get_issue_url") | |
| 1158 | + | core.PuregoSafeRegister(&xAboutDialogGetLicense, lib, "adw_about_dialog_get_license") | |
| 1159 | + | core.PuregoSafeRegister(&xAboutDialogGetLicenseType, lib, "adw_about_dialog_get_license_type") | |
| 1160 | + | core.PuregoSafeRegister(&xAboutDialogGetReleaseNotes, lib, "adw_about_dialog_get_release_notes") | |
| 1161 | + | core.PuregoSafeRegister(&xAboutDialogGetReleaseNotesVersion, lib, "adw_about_dialog_get_release_notes_version") | |
| 1162 | + | core.PuregoSafeRegister(&xAboutDialogGetSupportUrl, lib, "adw_about_dialog_get_support_url") | |
| 1163 | + | core.PuregoSafeRegister(&xAboutDialogGetTranslatorCredits, lib, "adw_about_dialog_get_translator_credits") | |
| 1164 | + | core.PuregoSafeRegister(&xAboutDialogGetVersion, lib, "adw_about_dialog_get_version") | |
| 1165 | + | core.PuregoSafeRegister(&xAboutDialogGetWebsite, lib, "adw_about_dialog_get_website") | |
| 1166 | + | core.PuregoSafeRegister(&xAboutDialogSetApplicationIcon, lib, "adw_about_dialog_set_application_icon") | |
| 1167 | + | core.PuregoSafeRegister(&xAboutDialogSetApplicationName, lib, "adw_about_dialog_set_application_name") | |
| 1168 | + | core.PuregoSafeRegister(&xAboutDialogSetArtists, lib, "adw_about_dialog_set_artists") | |
| 1169 | + | core.PuregoSafeRegister(&xAboutDialogSetComments, lib, "adw_about_dialog_set_comments") | |
| 1170 | + | core.PuregoSafeRegister(&xAboutDialogSetCopyright, lib, "adw_about_dialog_set_copyright") | |
| 1171 | + | core.PuregoSafeRegister(&xAboutDialogSetDebugInfo, lib, "adw_about_dialog_set_debug_info") | |
| 1172 | + | core.PuregoSafeRegister(&xAboutDialogSetDebugInfoFilename, lib, "adw_about_dialog_set_debug_info_filename") | |
| 1173 | + | core.PuregoSafeRegister(&xAboutDialogSetDesigners, lib, "adw_about_dialog_set_designers") | |
| 1174 | + | core.PuregoSafeRegister(&xAboutDialogSetDeveloperName, lib, "adw_about_dialog_set_developer_name") | |
| 1175 | + | core.PuregoSafeRegister(&xAboutDialogSetDevelopers, lib, "adw_about_dialog_set_developers") | |
| 1176 | + | core.PuregoSafeRegister(&xAboutDialogSetDocumenters, lib, "adw_about_dialog_set_documenters") | |
| 1177 | + | core.PuregoSafeRegister(&xAboutDialogSetIssueUrl, lib, "adw_about_dialog_set_issue_url") | |
| 1178 | + | core.PuregoSafeRegister(&xAboutDialogSetLicense, lib, "adw_about_dialog_set_license") | |
| 1179 | + | core.PuregoSafeRegister(&xAboutDialogSetLicenseType, lib, "adw_about_dialog_set_license_type") | |
| 1180 | + | core.PuregoSafeRegister(&xAboutDialogSetReleaseNotes, lib, "adw_about_dialog_set_release_notes") | |
| 1181 | + | core.PuregoSafeRegister(&xAboutDialogSetReleaseNotesVersion, lib, "adw_about_dialog_set_release_notes_version") | |
| 1182 | + | core.PuregoSafeRegister(&xAboutDialogSetSupportUrl, lib, "adw_about_dialog_set_support_url") | |
| 1183 | + | core.PuregoSafeRegister(&xAboutDialogSetTranslatorCredits, lib, "adw_about_dialog_set_translator_credits") | |
| 1184 | + | core.PuregoSafeRegister(&xAboutDialogSetVersion, lib, "adw_about_dialog_set_version") | |
| 1185 | + | core.PuregoSafeRegister(&xAboutDialogSetWebsite, lib, "adw_about_dialog_set_website") | |
| 1186 | + | ||
| 1187 | + | } | |
M v4/adw/adw-about-window.go +52 -1
| @@ -34,6 +34,18 @@ func ShowAboutWindow(ParentVar *gtk.Window, FirstPropertyNameVar string, varArgs | |||
| 34 | 34 | ||
| 35 | 35 | } | |
| 36 | 36 | ||
| 37 | + | var xShowAboutWindowFromAppdata func(uintptr, string, string, string, ...interface{}) | |
| 38 | + | ||
| 39 | + | // A convenience function for showing an application’s about window from | |
| 40 | + | // AppStream metadata. | |
| 41 | + | // | |
| 42 | + | // See [ctor@AboutWindow.new_from_appdata] for details. | |
| 43 | + | func ShowAboutWindowFromAppdata(ParentVar *gtk.Window, ResourcePathVar string, ReleaseNotesVersionVar string, FirstPropertyNameVar string, varArgs ...interface{}) { | |
| 44 | + | ||
| 45 | + | xShowAboutWindowFromAppdata(ParentVar.GoPointer(), ResourcePathVar, ReleaseNotesVersionVar, FirstPropertyNameVar, varArgs...) | |
| 46 | + | ||
| 47 | + | } | |
| 48 | + | ||
| 37 | 49 | // A window showing information about the application. | |
| 38 | 50 | // | |
| 39 | 51 | // <picture> | |
| @@ -191,7 +203,7 @@ func ShowAboutWindow(ParentVar *gtk.Window, FirstPropertyNameVar string, varArgs | |||
| 191 | 203 | // "application-icon", "org.example.App", | |
| 192 | 204 | // "version", "1.2.3", | |
| 193 | 205 | // "copyright", "© 2022 Angela Avery", | |
| 194 | - | // "issue-url", "https://gitlab.gnome.org/example/example/-/issues/new", | |
| 206 | + | // "issue-url", "https://gitlab.gnome.org/example/example/-/issues/", | |
| 195 | 207 | // "license-type", GTK_LICENSE_GPL_3_0, | |
| 196 | 208 | // "developers", developers, | |
| 197 | 209 | // "designers", designers, | |
| @@ -238,6 +250,43 @@ func NewAboutWindow() *AboutWindow { | |||
| 238 | 250 | return cls | |
| 239 | 251 | } | |
| 240 | 252 | ||
| 253 | + | var xNewAboutWindowFromAppdata func(string, string) uintptr | |
| 254 | + | ||
| 255 | + | // Creates a new `AdwAboutWindow` using AppStream metadata. | |
| 256 | + | // | |
| 257 | + | // This automatically sets the following properties with the following AppStream | |
| 258 | + | // values: | |
| 259 | + | // | |
| 260 | + | // - [property@AboutWindow:application-icon] is set from the `<id>` | |
| 261 | + | // - [property@AboutWindow:application-name] is set from the `<name>` | |
| 262 | + | // - [property@AboutWindow:developer-name] is set from the `<name>` within | |
| 263 | + | // `<developer>` | |
| 264 | + | // - [property@AboutWindow:version] is set from the version of the latest release | |
| 265 | + | // - [property@AboutWindow:website] is set from the `<url type="homepage">` | |
| 266 | + | // - [property@AboutWindow:support-url] is set from the `<url type="help">` | |
| 267 | + | // - [property@AboutWindow:issue-url] is set from the `<url type="bugtracker">` | |
| 268 | + | // - [property@AboutWindow:license-type] is set from the `<project_license>`. | |
| 269 | + | // If the license type retrieved from AppStream is not listed in | |
| 270 | + | // [enum@Gtk.License], it will be set to `GTK_LICENCE_CUSTOM`. | |
| 271 | + | // | |
| 272 | + | // If @release_notes_version is not `NULL`, | |
| 273 | + | // [property@AboutWindow:release-notes-version] is set to match it, while | |
| 274 | + | // [property@AboutWindow:release-notes] is set from the AppStream release | |
| 275 | + | // description for that version. | |
| 276 | + | func NewAboutWindowFromAppdata(ResourcePathVar string, ReleaseNotesVersionVar string) *AboutWindow { | |
| 277 | + | var cls *AboutWindow | |
| 278 | + | ||
| 279 | + | cret := xNewAboutWindowFromAppdata(ResourcePathVar, ReleaseNotesVersionVar) | |
| 280 | + | ||
| 281 | + | if cret == 0 { | |
| 282 | + | return nil | |
| 283 | + | } | |
| 284 | + | gobject.IncreaseRef(cret) | |
| 285 | + | cls = &AboutWindow{} | |
| 286 | + | cls.Ptr = cret | |
| 287 | + | return cls | |
| 288 | + | } | |
| 289 | + | ||
| 241 | 290 | var xAboutWindowAddAcknowledgementSection func(uintptr, string, []string) | |
| 242 | 291 | ||
| 243 | 292 | // Adds a section to the Acknowledgements page. | |
| @@ -1192,10 +1241,12 @@ func init() { | |||
| 1192 | 1241 | } | |
| 1193 | 1242 | ||
| 1194 | 1243 | core.PuregoSafeRegister(&xShowAboutWindow, lib, "adw_show_about_window") | |
| 1244 | + | core.PuregoSafeRegister(&xShowAboutWindowFromAppdata, lib, "adw_show_about_window_from_appdata") | |
| 1195 | 1245 | ||
| 1196 | 1246 | core.PuregoSafeRegister(&xAboutWindowGLibType, lib, "adw_about_window_get_type") | |
| 1197 | 1247 | ||
| 1198 | 1248 | core.PuregoSafeRegister(&xNewAboutWindow, lib, "adw_about_window_new") | |
| 1249 | + | core.PuregoSafeRegister(&xNewAboutWindowFromAppdata, lib, "adw_about_window_new_from_appdata") | |
| 1199 | 1250 | ||
| 1200 | 1251 | core.PuregoSafeRegister(&xAboutWindowAddAcknowledgementSection, lib, "adw_about_window_add_acknowledgement_section") | |
| 1201 | 1252 | core.PuregoSafeRegister(&xAboutWindowAddCreditSection, lib, "adw_about_window_add_credit_section") | |
A v4/adw/adw-accent-color.go +89 -0
| @@ -0,0 +1,89 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "github.com/jwijenbergh/purego" | |
| 6 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 7 | + | "github.com/jwijenbergh/puregotk/v4/gdk" | |
| 8 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 9 | + | ) | |
| 10 | + | ||
| 11 | + | // Describes the available system accent colors. | |
| 12 | + | type AccentColor int | |
| 13 | + | ||
| 14 | + | var xAccentColorGLibType func() types.GType | |
| 15 | + | ||
| 16 | + | func AccentColorGLibType() types.GType { | |
| 17 | + | return xAccentColorGLibType() | |
| 18 | + | } | |
| 19 | + | ||
| 20 | + | const ( | |
| 21 | + | ||
| 22 | + | // Use a blue color (`#3584e4`). This is the default value. | |
| 23 | + | AccentColorBlueValue AccentColor = 0 | |
| 24 | + | // Use a teal color (`#2190a4`). | |
| 25 | + | AccentColorTealValue AccentColor = 1 | |
| 26 | + | // Use a green color (`#3a944a`). | |
| 27 | + | AccentColorGreenValue AccentColor = 2 | |
| 28 | + | // Use a yellow color (`#c88800`). | |
| 29 | + | AccentColorYellowValue AccentColor = 3 | |
| 30 | + | // Use a orange color (`#ed5b00`). | |
| 31 | + | AccentColorOrangeValue AccentColor = 4 | |
| 32 | + | // Use a red color (`#e62d42`). | |
| 33 | + | AccentColorRedValue AccentColor = 5 | |
| 34 | + | // Use a pink color (`#d56199`). | |
| 35 | + | AccentColorPinkValue AccentColor = 6 | |
| 36 | + | // Use a purple color (`#9141ac`). | |
| 37 | + | AccentColorPurpleValue AccentColor = 7 | |
| 38 | + | // Use a slate color (`#6f8396`). | |
| 39 | + | AccentColorSlateValue AccentColor = 8 | |
| 40 | + | ) | |
| 41 | + | ||
| 42 | + | var xAccentColorToRgba func(AccentColor, *gdk.RGBA) | |
| 43 | + | ||
| 44 | + | // Converts @self to a `GdkRGBA` representing its background color. | |
| 45 | + | // | |
| 46 | + | // The matching foreground color is white. | |
| 47 | + | func AccentColorToRgba(SelfVar AccentColor, RgbaVar *gdk.RGBA) { | |
| 48 | + | ||
| 49 | + | xAccentColorToRgba(SelfVar, RgbaVar) | |
| 50 | + | ||
| 51 | + | } | |
| 52 | + | ||
| 53 | + | var xAccentColorToStandaloneRgba func(AccentColor, bool, *gdk.RGBA) | |
| 54 | + | ||
| 55 | + | // Converts @self to a `GdkRGBA` representing its standalone color. | |
| 56 | + | // | |
| 57 | + | // It will typically be darker for light background, and lighter for dark | |
| 58 | + | // background, ensuring contrast. | |
| 59 | + | func AccentColorToStandaloneRgba(SelfVar AccentColor, DarkVar bool, RgbaVar *gdk.RGBA) { | |
| 60 | + | ||
| 61 | + | xAccentColorToStandaloneRgba(SelfVar, DarkVar, RgbaVar) | |
| 62 | + | ||
| 63 | + | } | |
| 64 | + | ||
| 65 | + | var xRgbaToStandalone func(*gdk.RGBA, bool, *gdk.RGBA) | |
| 66 | + | ||
| 67 | + | // Adjusts @rgba to be suitable as a standalone color. | |
| 68 | + | // | |
| 69 | + | // It will typically be darker for light background, and lighter for dark | |
| 70 | + | // background, ensuring contrast. | |
| 71 | + | func RgbaToStandalone(RgbaVar *gdk.RGBA, DarkVar bool, StandaloneRgbaVar *gdk.RGBA) { | |
| 72 | + | ||
| 73 | + | xRgbaToStandalone(RgbaVar, DarkVar, StandaloneRgbaVar) | |
| 74 | + | ||
| 75 | + | } | |
| 76 | + | ||
| 77 | + | func init() { | |
| 78 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 79 | + | if err != nil { | |
| 80 | + | panic(err) | |
| 81 | + | } | |
| 82 | + | ||
| 83 | + | core.PuregoSafeRegister(&xAccentColorGLibType, lib, "adw_accent_color_get_type") | |
| 84 | + | ||
| 85 | + | core.PuregoSafeRegister(&xAccentColorToRgba, lib, "adw_accent_color_to_rgba") | |
| 86 | + | core.PuregoSafeRegister(&xAccentColorToStandaloneRgba, lib, "adw_accent_color_to_standalone_rgba") | |
| 87 | + | core.PuregoSafeRegister(&xRgbaToStandalone, lib, "adw_rgba_to_standalone") | |
| 88 | + | ||
| 89 | + | } | |
M v4/adw/adw-action-row.go +16 -0
| @@ -61,6 +61,22 @@ func (x *ActionRowClass) GoPointer() uintptr { | |||
| 61 | 61 | // | |
| 62 | 62 | // It contains subnodes `label.title` and `label.subtitle` representing | |
| 63 | 63 | // respectively the title label and subtitle label. | |
| 64 | + | // | |
| 65 | + | // ## Style classes | |
| 66 | + | // | |
| 67 | + | // `AdwActionRow` can use the [`.property`](style-classes.html#property-rows) | |
| 68 | + | // style class to emphasize the row subtitle instead of the row title, which is | |
| 69 | + | // useful for displaying read-only properties. | |
| 70 | + | // | |
| 71 | + | // <picture> | |
| 72 | + | // | |
| 73 | + | // <source srcset="property-row-dark.png" media="(prefers-color-scheme: dark)"> | |
| 74 | + | // <img src="property-row.png" alt="property-row"> | |
| 75 | + | // | |
| 76 | + | // </picture> | |
| 77 | + | // | |
| 78 | + | // When used together with the `.monospace` style class, only the subtitle | |
| 79 | + | // becomes monospace, not the title or any extra widgets. | |
| 64 | 80 | type ActionRow struct { | |
| 65 | 81 | PreferencesRow | |
| 66 | 82 | } | |
A v4/adw/adw-alert-dialog.go +872 -0
| @@ -0,0 +1,872 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gio" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 13 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 14 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 15 | + | ) | |
| 16 | + | ||
| 17 | + | type AlertDialogClass struct { | |
| 18 | + | _ structs.HostLayout | |
| 19 | + | ||
| 20 | + | ParentClass uintptr | |
| 21 | + | ||
| 22 | + | Padding [4]uintptr | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | func (x *AlertDialogClass) GoPointer() uintptr { | |
| 26 | + | return uintptr(unsafe.Pointer(x)) | |
| 27 | + | } | |
| 28 | + | ||
| 29 | + | // Describes the possible styles of [class@AlertDialog] response buttons. | |
| 30 | + | // | |
| 31 | + | // See [method@AlertDialog.set_response_appearance]. | |
| 32 | + | type ResponseAppearance int | |
| 33 | + | ||
| 34 | + | var xResponseAppearanceGLibType func() types.GType | |
| 35 | + | ||
| 36 | + | func ResponseAppearanceGLibType() types.GType { | |
| 37 | + | return xResponseAppearanceGLibType() | |
| 38 | + | } | |
| 39 | + | ||
| 40 | + | const ( | |
| 41 | + | ||
| 42 | + | // the default appearance. | |
| 43 | + | ResponseDefaultValue ResponseAppearance = 0 | |
| 44 | + | // used to denote important responses such as the | |
| 45 | + | // affirmative action. | |
| 46 | + | ResponseSuggestedValue ResponseAppearance = 1 | |
| 47 | + | // used to draw attention to the potentially damaging | |
| 48 | + | // consequences of using the response. This appearance acts as a warning to | |
| 49 | + | // the user. | |
| 50 | + | ResponseDestructiveValue ResponseAppearance = 2 | |
| 51 | + | ) | |
| 52 | + | ||
| 53 | + | // A dialog presenting a message or a question. | |
| 54 | + | // | |
| 55 | + | // <picture> | |
| 56 | + | // | |
| 57 | + | // <source srcset="alert-dialog-dark.png" media="(prefers-color-scheme: dark)"> | |
| 58 | + | // <img src="alert-dialog.png" alt="alert-dialog"> | |
| 59 | + | // | |
| 60 | + | // </picture> | |
| 61 | + | // | |
| 62 | + | // Alert dialogs have a heading, a body, an optional child widget, and one or | |
| 63 | + | // multiple responses, each presented as a button. | |
| 64 | + | // | |
| 65 | + | // Each response has a unique string ID, and a button label. Additionally, each | |
| 66 | + | // response can be enabled or disabled, and can have a suggested or destructive | |
| 67 | + | // appearance. | |
| 68 | + | // | |
| 69 | + | // When one of the responses is activated, or the dialog is closed, the | |
| 70 | + | // [signal@AlertDialog::response] signal will be emitted. This signal is | |
| 71 | + | // detailed, and the detail, as well as the `response` parameter will be set to | |
| 72 | + | // the ID of the activated response, or to the value of the | |
| 73 | + | // [property@AlertDialog:close-response] property if the dialog had been closed | |
| 74 | + | // without activating any of the responses. | |
| 75 | + | // | |
| 76 | + | // Response buttons can be presented horizontally or vertically depending on | |
| 77 | + | // available space. | |
| 78 | + | // | |
| 79 | + | // When a response is activated, `AdwAlertDialog` is closed automatically. | |
| 80 | + | // | |
| 81 | + | // An example of using an alert dialog: | |
| 82 | + | // | |
| 83 | + | // ```c | |
| 84 | + | // AdwDialog *dialog; | |
| 85 | + | // | |
| 86 | + | // dialog = adw_alert_dialog_new (_("Replace File?"), NULL); | |
| 87 | + | // | |
| 88 | + | // adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog), | |
| 89 | + | // | |
| 90 | + | // _("A file named “%s” already exists. Do you want to replace it?"), | |
| 91 | + | // filename); | |
| 92 | + | // | |
| 93 | + | // adw_alert_dialog_add_responses (ADW_ALERT_DIALOG (dialog), | |
| 94 | + | // | |
| 95 | + | // "cancel", _("_Cancel"), | |
| 96 | + | // "replace", _("_Replace"), | |
| 97 | + | // NULL); | |
| 98 | + | // | |
| 99 | + | // adw_alert_dialog_set_response_appearance (ADW_ALERT_DIALOG (dialog), | |
| 100 | + | // | |
| 101 | + | // "replace", | |
| 102 | + | // ADW_RESPONSE_DESTRUCTIVE); | |
| 103 | + | // | |
| 104 | + | // adw_alert_dialog_set_default_response (ADW_ALERT_DIALOG (dialog), "cancel"); | |
| 105 | + | // adw_alert_dialog_set_close_response (ADW_ALERT_DIALOG (dialog), "cancel"); | |
| 106 | + | // | |
| 107 | + | // g_signal_connect (dialog, "response", G_CALLBACK (response_cb), self); | |
| 108 | + | // | |
| 109 | + | // adw_dialog_present (dialog, parent); | |
| 110 | + | // ``` | |
| 111 | + | // | |
| 112 | + | // ## Async API | |
| 113 | + | // | |
| 114 | + | // `AdwAlertDialog` can also be used via the [method@AlertDialog.choose] method. | |
| 115 | + | // This API follows the GIO async pattern, for example: | |
| 116 | + | // | |
| 117 | + | // ```c | |
| 118 | + | // static void | |
| 119 | + | // dialog_cb (AdwAlertDialog *dialog, | |
| 120 | + | // | |
| 121 | + | // GAsyncResult *result, | |
| 122 | + | // MyWindow *self) | |
| 123 | + | // | |
| 124 | + | // { | |
| 125 | + | // const char *response = adw_alert_dialog_choose_finish (dialog, result); | |
| 126 | + | // | |
| 127 | + | // // ... | |
| 128 | + | // } | |
| 129 | + | // | |
| 130 | + | // static void | |
| 131 | + | // show_dialog (MyWindow *self) | |
| 132 | + | // | |
| 133 | + | // { | |
| 134 | + | // AdwDialog *dialog; | |
| 135 | + | // | |
| 136 | + | // dialog = adw_alert_dialog_new (_("Replace File?"), NULL); | |
| 137 | + | // | |
| 138 | + | // adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog), | |
| 139 | + | // _("A file named “%s” already exists. Do you want to replace it?"), | |
| 140 | + | // filename); | |
| 141 | + | // | |
| 142 | + | // adw_alert_dialog_add_responses (ADW_ALERT_DIALOG (dialog), | |
| 143 | + | // "cancel", _("_Cancel"), | |
| 144 | + | // "replace", _("_Replace"), | |
| 145 | + | // NULL); | |
| 146 | + | // | |
| 147 | + | // adw_alert_dialog_set_response_appearance (ADW_ALERT_DIALOG (dialog), | |
| 148 | + | // "replace", | |
| 149 | + | // ADW_RESPONSE_DESTRUCTIVE); | |
| 150 | + | // | |
| 151 | + | // adw_alert_dialog_set_default_response (ADW_ALERT_DIALOG (dialog), "cancel"); | |
| 152 | + | // adw_alert_dialog_set_close_response (ADW_ALERT_DIALOG (dialog), "cancel"); | |
| 153 | + | // | |
| 154 | + | // adw_alert_dialog_choose (ADW_ALERT_DIALOG (dialog), GTK_WIDGET (self), | |
| 155 | + | // NULL, (GAsyncReadyCallback) dialog_cb, self); | |
| 156 | + | // } | |
| 157 | + | // | |
| 158 | + | // ``` | |
| 159 | + | // | |
| 160 | + | // ## AdwAlertDialog as GtkBuildable | |
| 161 | + | // | |
| 162 | + | // `AdwAlertDialog` supports adding responses in UI definitions by via the | |
| 163 | + | // `<responses>` element that may contain multiple `<response>` elements, each | |
| 164 | + | // representing a response. | |
| 165 | + | // | |
| 166 | + | // Each of the `<response>` elements must have the `id` attribute specifying the | |
| 167 | + | // response ID. The contents of the element are used as the response label. | |
| 168 | + | // | |
| 169 | + | // Response labels can be translated with the usual `translatable`, `context` | |
| 170 | + | // and `comments` attributes. | |
| 171 | + | // | |
| 172 | + | // The `<response>` elements can also have `enabled` and/or `appearance` | |
| 173 | + | // attributes. See [method@AlertDialog.set_response_enabled] and | |
| 174 | + | // [method@AlertDialog.set_response_appearance] for details. | |
| 175 | + | // | |
| 176 | + | // Example of an `AdwAlertDialog` UI definition: | |
| 177 | + | // | |
| 178 | + | // ```xml | |
| 179 | + | // <object class="AdwAlertDialog" id="dialog"> | |
| 180 | + | // | |
| 181 | + | // <property name="heading" translatable="yes">Save Changes?</property> | |
| 182 | + | // <property name="body" translatable="yes">Open documents contain unsaved changes. Changes which are not saved will be permanently lost.</property> | |
| 183 | + | // <property name="default-response">save</property> | |
| 184 | + | // <property name="close-response">cancel</property> | |
| 185 | + | // <signal name="response" handler="response_cb"/> | |
| 186 | + | // <responses> | |
| 187 | + | // <response id="cancel" translatable="yes">_Cancel</response> | |
| 188 | + | // <response id="discard" translatable="yes" appearance="destructive">_Discard</response> | |
| 189 | + | // <response id="save" translatable="yes" appearance="suggested" enabled="false">_Save</response> | |
| 190 | + | // </responses> | |
| 191 | + | // | |
| 192 | + | // </object> | |
| 193 | + | // ``` | |
| 194 | + | type AlertDialog struct { | |
| 195 | + | Dialog | |
| 196 | + | } | |
| 197 | + | ||
| 198 | + | var xAlertDialogGLibType func() types.GType | |
| 199 | + | ||
| 200 | + | func AlertDialogGLibType() types.GType { | |
| 201 | + | return xAlertDialogGLibType() | |
| 202 | + | } | |
| 203 | + | ||
| 204 | + | func AlertDialogNewFromInternalPtr(ptr uintptr) *AlertDialog { | |
| 205 | + | cls := &AlertDialog{} | |
| 206 | + | cls.Ptr = ptr | |
| 207 | + | return cls | |
| 208 | + | } | |
| 209 | + | ||
| 210 | + | var xNewAlertDialog func(string, string) uintptr | |
| 211 | + | ||
| 212 | + | // Creates a new `AdwAlertDialog`. | |
| 213 | + | // | |
| 214 | + | // @heading and @body can be set to `NULL`. This can be useful if they need to | |
| 215 | + | // be formatted or use markup. In that case, set them to `NULL` and call | |
| 216 | + | // [method@AlertDialog.format_body] or similar methods afterwards: | |
| 217 | + | // | |
| 218 | + | // ```c | |
| 219 | + | // AdwDialog *dialog; | |
| 220 | + | // | |
| 221 | + | // dialog = adw_alert_dialog_new (_("Replace File?"), NULL); | |
| 222 | + | // adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog), | |
| 223 | + | // | |
| 224 | + | // _("A file named “%s” already exists. Do you want to replace it?"), | |
| 225 | + | // filename); | |
| 226 | + | // | |
| 227 | + | // ``` | |
| 228 | + | func NewAlertDialog(HeadingVar string, BodyVar string) *AlertDialog { | |
| 229 | + | var cls *AlertDialog | |
| 230 | + | ||
| 231 | + | cret := xNewAlertDialog(HeadingVar, BodyVar) | |
| 232 | + | ||
| 233 | + | if cret == 0 { | |
| 234 | + | return nil | |
| 235 | + | } | |
| 236 | + | gobject.IncreaseRef(cret) | |
| 237 | + | cls = &AlertDialog{} | |
| 238 | + | cls.Ptr = cret | |
| 239 | + | return cls | |
| 240 | + | } | |
| 241 | + | ||
| 242 | + | var xAlertDialogAddResponse func(uintptr, string, string) | |
| 243 | + | ||
| 244 | + | // Adds a response with @id and @label to @self. | |
| 245 | + | // | |
| 246 | + | // Responses are represented as buttons in the dialog. | |
| 247 | + | // | |
| 248 | + | // Response ID must be unique. It will be used in [signal@AlertDialog::response] | |
| 249 | + | // to tell which response had been activated, as well as to inspect and modify | |
| 250 | + | // the response later. | |
| 251 | + | // | |
| 252 | + | // An embedded underline in @label indicates a mnemonic. | |
| 253 | + | // | |
| 254 | + | // [method@AlertDialog.set_response_label] can be used to change the response | |
| 255 | + | // label after it had been added. | |
| 256 | + | // | |
| 257 | + | // [method@AlertDialog.set_response_enabled] and | |
| 258 | + | // [method@AlertDialog.set_response_appearance] can be used to customize the | |
| 259 | + | // responses further. | |
| 260 | + | func (x *AlertDialog) AddResponse(IdVar string, LabelVar string) { | |
| 261 | + | ||
| 262 | + | xAlertDialogAddResponse(x.GoPointer(), IdVar, LabelVar) | |
| 263 | + | ||
| 264 | + | } | |
| 265 | + | ||
| 266 | + | var xAlertDialogAddResponses func(uintptr, string, ...interface{}) | |
| 267 | + | ||
| 268 | + | // Adds multiple responses to @self. | |
| 269 | + | // | |
| 270 | + | // This is the same as calling [method@AlertDialog.add_response] repeatedly. The | |
| 271 | + | // variable argument list should be `NULL`-terminated list of response IDs and | |
| 272 | + | // labels. | |
| 273 | + | // | |
| 274 | + | // Example: | |
| 275 | + | // | |
| 276 | + | // ```c | |
| 277 | + | // adw_alert_dialog_add_responses (dialog, | |
| 278 | + | // | |
| 279 | + | // "cancel", _("_Cancel"), | |
| 280 | + | // "discard", _("_Discard"), | |
| 281 | + | // "save", _("_Save"), | |
| 282 | + | // NULL); | |
| 283 | + | // | |
| 284 | + | // ``` | |
| 285 | + | func (x *AlertDialog) AddResponses(FirstIdVar string, varArgs ...interface{}) { | |
| 286 | + | ||
| 287 | + | xAlertDialogAddResponses(x.GoPointer(), FirstIdVar, varArgs...) | |
| 288 | + | ||
| 289 | + | } | |
| 290 | + | ||
| 291 | + | var xAlertDialogChoose func(uintptr, uintptr, uintptr, uintptr, uintptr) | |
| 292 | + | ||
| 293 | + | // This function shows @self to the user. | |
| 294 | + | // | |
| 295 | + | // If the window is an [class@Window] or [class@ApplicationWindow], the dialog | |
| 296 | + | // will be shown within it. Otherwise, it will be a separate window. | |
| 297 | + | func (x *AlertDialog) Choose(ParentVar *gtk.Widget, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { | |
| 298 | + | ||
| 299 | + | xAlertDialogChoose(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) | |
| 300 | + | ||
| 301 | + | } | |
| 302 | + | ||
| 303 | + | var xAlertDialogChooseFinish func(uintptr, uintptr) string | |
| 304 | + | ||
| 305 | + | // Finishes the [method@AlertDialog.choose] call and returns the response ID. | |
| 306 | + | func (x *AlertDialog) ChooseFinish(ResultVar gio.AsyncResult) string { | |
| 307 | + | ||
| 308 | + | cret := xAlertDialogChooseFinish(x.GoPointer(), ResultVar.GoPointer()) | |
| 309 | + | return cret | |
| 310 | + | } | |
| 311 | + | ||
| 312 | + | var xAlertDialogFormatBody func(uintptr, string, ...interface{}) | |
| 313 | + | ||
| 314 | + | // Sets the formatted body text of @self. | |
| 315 | + | // | |
| 316 | + | // See [property@AlertDialog:body]. | |
| 317 | + | func (x *AlertDialog) FormatBody(FormatVar string, varArgs ...interface{}) { | |
| 318 | + | ||
| 319 | + | xAlertDialogFormatBody(x.GoPointer(), FormatVar, varArgs...) | |
| 320 | + | ||
| 321 | + | } | |
| 322 | + | ||
| 323 | + | var xAlertDialogFormatBodyMarkup func(uintptr, string, ...interface{}) | |
| 324 | + | ||
| 325 | + | // Sets the formatted body text of @self with Pango markup. | |
| 326 | + | // | |
| 327 | + | // The @format is assumed to contain Pango markup. | |
| 328 | + | // | |
| 329 | + | // Special XML characters in the `printf()` arguments passed to this function | |
| 330 | + | // will automatically be escaped as necessary, see | |
| 331 | + | // [func@GLib.markup_printf_escaped]. | |
| 332 | + | // | |
| 333 | + | // See [property@AlertDialog:body]. | |
| 334 | + | func (x *AlertDialog) FormatBodyMarkup(FormatVar string, varArgs ...interface{}) { | |
| 335 | + | ||
| 336 | + | xAlertDialogFormatBodyMarkup(x.GoPointer(), FormatVar, varArgs...) | |
| 337 | + | ||
| 338 | + | } | |
| 339 | + | ||
| 340 | + | var xAlertDialogFormatHeading func(uintptr, string, ...interface{}) | |
| 341 | + | ||
| 342 | + | // Sets the formatted heading of @self. | |
| 343 | + | // | |
| 344 | + | // See [property@AlertDialog:heading]. | |
| 345 | + | func (x *AlertDialog) FormatHeading(FormatVar string, varArgs ...interface{}) { | |
| 346 | + | ||
| 347 | + | xAlertDialogFormatHeading(x.GoPointer(), FormatVar, varArgs...) | |
| 348 | + | ||
| 349 | + | } | |
| 350 | + | ||
| 351 | + | var xAlertDialogFormatHeadingMarkup func(uintptr, string, ...interface{}) | |
| 352 | + | ||
| 353 | + | // Sets the formatted heading of @self with Pango markup. | |
| 354 | + | // | |
| 355 | + | // The @format is assumed to contain Pango markup. | |
| 356 | + | // | |
| 357 | + | // Special XML characters in the `printf()` arguments passed to this function | |
| 358 | + | // will automatically be escaped as necessary, see | |
| 359 | + | // [func@GLib.markup_printf_escaped]. | |
| 360 | + | // | |
| 361 | + | // See [property@AlertDialog:heading]. | |
| 362 | + | func (x *AlertDialog) FormatHeadingMarkup(FormatVar string, varArgs ...interface{}) { | |
| 363 | + | ||
| 364 | + | xAlertDialogFormatHeadingMarkup(x.GoPointer(), FormatVar, varArgs...) | |
| 365 | + | ||
| 366 | + | } | |
| 367 | + | ||
| 368 | + | var xAlertDialogGetBody func(uintptr) string | |
| 369 | + | ||
| 370 | + | // Gets the body text of @self. | |
| 371 | + | func (x *AlertDialog) GetBody() string { | |
| 372 | + | ||
| 373 | + | cret := xAlertDialogGetBody(x.GoPointer()) | |
| 374 | + | return cret | |
| 375 | + | } | |
| 376 | + | ||
| 377 | + | var xAlertDialogGetBodyUseMarkup func(uintptr) bool | |
| 378 | + | ||
| 379 | + | // Gets whether the body text of @self includes Pango markup. | |
| 380 | + | func (x *AlertDialog) GetBodyUseMarkup() bool { | |
| 381 | + | ||
| 382 | + | cret := xAlertDialogGetBodyUseMarkup(x.GoPointer()) | |
| 383 | + | return cret | |
| 384 | + | } | |
| 385 | + | ||
| 386 | + | var xAlertDialogGetCloseResponse func(uintptr) string | |
| 387 | + | ||
| 388 | + | // Gets the ID of the close response of @self. | |
| 389 | + | func (x *AlertDialog) GetCloseResponse() string { | |
| 390 | + | ||
| 391 | + | cret := xAlertDialogGetCloseResponse(x.GoPointer()) | |
| 392 | + | return cret | |
| 393 | + | } | |
| 394 | + | ||
| 395 | + | var xAlertDialogGetDefaultResponse func(uintptr) string | |
| 396 | + | ||
| 397 | + | // Gets the ID of the default response of @self. | |
| 398 | + | func (x *AlertDialog) GetDefaultResponse() string { | |
| 399 | + | ||
| 400 | + | cret := xAlertDialogGetDefaultResponse(x.GoPointer()) | |
| 401 | + | return cret | |
| 402 | + | } | |
| 403 | + | ||
| 404 | + | var xAlertDialogGetExtraChild func(uintptr) uintptr | |
| 405 | + | ||
| 406 | + | // Gets the child widget of @self. | |
| 407 | + | func (x *AlertDialog) GetExtraChild() *gtk.Widget { | |
| 408 | + | var cls *gtk.Widget | |
| 409 | + | ||
| 410 | + | cret := xAlertDialogGetExtraChild(x.GoPointer()) | |
| 411 | + | ||
| 412 | + | if cret == 0 { | |
| 413 | + | return nil | |
| 414 | + | } | |
| 415 | + | gobject.IncreaseRef(cret) | |
| 416 | + | cls = >k.Widget{} | |
| 417 | + | cls.Ptr = cret | |
| 418 | + | return cls | |
| 419 | + | } | |
| 420 | + | ||
| 421 | + | var xAlertDialogGetHeading func(uintptr) string | |
| 422 | + | ||
| 423 | + | // Gets the heading of @self. | |
| 424 | + | func (x *AlertDialog) GetHeading() string { | |
| 425 | + | ||
| 426 | + | cret := xAlertDialogGetHeading(x.GoPointer()) | |
| 427 | + | return cret | |
| 428 | + | } | |
| 429 | + | ||
| 430 | + | var xAlertDialogGetHeadingUseMarkup func(uintptr) bool | |
| 431 | + | ||
| 432 | + | // Gets whether the heading of @self includes Pango markup. | |
| 433 | + | func (x *AlertDialog) GetHeadingUseMarkup() bool { | |
| 434 | + | ||
| 435 | + | cret := xAlertDialogGetHeadingUseMarkup(x.GoPointer()) | |
| 436 | + | return cret | |
| 437 | + | } | |
| 438 | + | ||
| 439 | + | var xAlertDialogGetPreferWideLayout func(uintptr) bool | |
| 440 | + | ||
| 441 | + | // Gets whether @self prefers wide layout. | |
| 442 | + | func (x *AlertDialog) GetPreferWideLayout() bool { | |
| 443 | + | ||
| 444 | + | cret := xAlertDialogGetPreferWideLayout(x.GoPointer()) | |
| 445 | + | return cret | |
| 446 | + | } | |
| 447 | + | ||
| 448 | + | var xAlertDialogGetResponseAppearance func(uintptr, string) ResponseAppearance | |
| 449 | + | ||
| 450 | + | // Gets the appearance of @response. | |
| 451 | + | // | |
| 452 | + | // See [method@AlertDialog.set_response_appearance]. | |
| 453 | + | func (x *AlertDialog) GetResponseAppearance(ResponseVar string) ResponseAppearance { | |
| 454 | + | ||
| 455 | + | cret := xAlertDialogGetResponseAppearance(x.GoPointer(), ResponseVar) | |
| 456 | + | return cret | |
| 457 | + | } | |
| 458 | + | ||
| 459 | + | var xAlertDialogGetResponseEnabled func(uintptr, string) bool | |
| 460 | + | ||
| 461 | + | // Gets whether @response is enabled. | |
| 462 | + | // | |
| 463 | + | // See [method@AlertDialog.set_response_enabled]. | |
| 464 | + | func (x *AlertDialog) GetResponseEnabled(ResponseVar string) bool { | |
| 465 | + | ||
| 466 | + | cret := xAlertDialogGetResponseEnabled(x.GoPointer(), ResponseVar) | |
| 467 | + | return cret | |
| 468 | + | } | |
| 469 | + | ||
| 470 | + | var xAlertDialogGetResponseLabel func(uintptr, string) string | |
| 471 | + | ||
| 472 | + | // Gets the label of @response. | |
| 473 | + | // | |
| 474 | + | // See [method@AlertDialog.set_response_label]. | |
| 475 | + | func (x *AlertDialog) GetResponseLabel(ResponseVar string) string { | |
| 476 | + | ||
| 477 | + | cret := xAlertDialogGetResponseLabel(x.GoPointer(), ResponseVar) | |
| 478 | + | return cret | |
| 479 | + | } | |
| 480 | + | ||
| 481 | + | var xAlertDialogHasResponse func(uintptr, string) bool | |
| 482 | + | ||
| 483 | + | // Gets whether @self has a response with the ID @response. | |
| 484 | + | func (x *AlertDialog) HasResponse(ResponseVar string) bool { | |
| 485 | + | ||
| 486 | + | cret := xAlertDialogHasResponse(x.GoPointer(), ResponseVar) | |
| 487 | + | return cret | |
| 488 | + | } | |
| 489 | + | ||
| 490 | + | var xAlertDialogRemoveResponse func(uintptr, string) | |
| 491 | + | ||
| 492 | + | // Removes a response from @self. | |
| 493 | + | func (x *AlertDialog) RemoveResponse(IdVar string) { | |
| 494 | + | ||
| 495 | + | xAlertDialogRemoveResponse(x.GoPointer(), IdVar) | |
| 496 | + | ||
| 497 | + | } | |
| 498 | + | ||
| 499 | + | var xAlertDialogSetBody func(uintptr, string) | |
| 500 | + | ||
| 501 | + | // Sets the body text of @self. | |
| 502 | + | func (x *AlertDialog) SetBody(BodyVar string) { | |
| 503 | + | ||
| 504 | + | xAlertDialogSetBody(x.GoPointer(), BodyVar) | |
| 505 | + | ||
| 506 | + | } | |
| 507 | + | ||
| 508 | + | var xAlertDialogSetBodyUseMarkup func(uintptr, bool) | |
| 509 | + | ||
| 510 | + | // Sets whether the body text of @self includes Pango markup. | |
| 511 | + | // | |
| 512 | + | // See [func@Pango.parse_markup]. | |
| 513 | + | func (x *AlertDialog) SetBodyUseMarkup(UseMarkupVar bool) { | |
| 514 | + | ||
| 515 | + | xAlertDialogSetBodyUseMarkup(x.GoPointer(), UseMarkupVar) | |
| 516 | + | ||
| 517 | + | } | |
| 518 | + | ||
| 519 | + | var xAlertDialogSetCloseResponse func(uintptr, string) | |
| 520 | + | ||
| 521 | + | // Sets the ID of the close response of @self. | |
| 522 | + | // | |
| 523 | + | // It will be passed to [signal@AlertDialog::response] if the dialog is closed | |
| 524 | + | // by pressing <kbd>Escape</kbd> or with a system action. | |
| 525 | + | // | |
| 526 | + | // It doesn't have to correspond to any of the responses in the dialog. | |
| 527 | + | // | |
| 528 | + | // The default close response is `close`. | |
| 529 | + | func (x *AlertDialog) SetCloseResponse(ResponseVar string) { | |
| 530 | + | ||
| 531 | + | xAlertDialogSetCloseResponse(x.GoPointer(), ResponseVar) | |
| 532 | + | ||
| 533 | + | } | |
| 534 | + | ||
| 535 | + | var xAlertDialogSetDefaultResponse func(uintptr, string) | |
| 536 | + | ||
| 537 | + | // Sets the ID of the default response of @self. | |
| 538 | + | // | |
| 539 | + | // If set, pressing <kbd>Enter</kbd> will activate the corresponding button. | |
| 540 | + | // | |
| 541 | + | // If set to `NULL` or to a non-existent response ID, pressing <kbd>Enter</kbd> | |
| 542 | + | // will do nothing. | |
| 543 | + | func (x *AlertDialog) SetDefaultResponse(ResponseVar string) { | |
| 544 | + | ||
| 545 | + | xAlertDialogSetDefaultResponse(x.GoPointer(), ResponseVar) | |
| 546 | + | ||
| 547 | + | } | |
| 548 | + | ||
| 549 | + | var xAlertDialogSetExtraChild func(uintptr, uintptr) | |
| 550 | + | ||
| 551 | + | // Sets the child widget of @self. | |
| 552 | + | // | |
| 553 | + | // The child widget is displayed below the heading and body. | |
| 554 | + | func (x *AlertDialog) SetExtraChild(ChildVar *gtk.Widget) { | |
| 555 | + | ||
| 556 | + | xAlertDialogSetExtraChild(x.GoPointer(), ChildVar.GoPointer()) | |
| 557 | + | ||
| 558 | + | } | |
| 559 | + | ||
| 560 | + | var xAlertDialogSetHeading func(uintptr, string) | |
| 561 | + | ||
| 562 | + | // Sets the heading of @self. | |
| 563 | + | func (x *AlertDialog) SetHeading(HeadingVar string) { | |
| 564 | + | ||
| 565 | + | xAlertDialogSetHeading(x.GoPointer(), HeadingVar) | |
| 566 | + | ||
| 567 | + | } | |
| 568 | + | ||
| 569 | + | var xAlertDialogSetHeadingUseMarkup func(uintptr, bool) | |
| 570 | + | ||
| 571 | + | // Sets whether the heading of @self includes Pango markup. | |
| 572 | + | // | |
| 573 | + | // See [func@Pango.parse_markup]. | |
| 574 | + | func (x *AlertDialog) SetHeadingUseMarkup(UseMarkupVar bool) { | |
| 575 | + | ||
| 576 | + | xAlertDialogSetHeadingUseMarkup(x.GoPointer(), UseMarkupVar) | |
| 577 | + | ||
| 578 | + | } | |
| 579 | + | ||
| 580 | + | var xAlertDialogSetPreferWideLayout func(uintptr, bool) | |
| 581 | + | ||
| 582 | + | // Sets whether @self prefers wide layout. | |
| 583 | + | // | |
| 584 | + | // Prefer horizontal button layout when possible, and wider dialog width | |
| 585 | + | // otherwise. | |
| 586 | + | func (x *AlertDialog) SetPreferWideLayout(PreferWideLayoutVar bool) { | |
| 587 | + | ||
| 588 | + | xAlertDialogSetPreferWideLayout(x.GoPointer(), PreferWideLayoutVar) | |
| 589 | + | ||
| 590 | + | } | |
| 591 | + | ||
| 592 | + | var xAlertDialogSetResponseAppearance func(uintptr, string, ResponseAppearance) | |
| 593 | + | ||
| 594 | + | // Sets the appearance for @response. | |
| 595 | + | // | |
| 596 | + | // <picture> | |
| 597 | + | // | |
| 598 | + | // <source srcset="alert-dialog-appearance-dark.png" media="(prefers-color-scheme: dark)"> | |
| 599 | + | // <img src="alert-dialog-appearance.png" alt="alert-dialog-appearance"> | |
| 600 | + | // | |
| 601 | + | // </picture> | |
| 602 | + | // | |
| 603 | + | // Use `ADW_RESPONSE_SUGGESTED` to mark important responses such as the | |
| 604 | + | // affirmative action, like the Save button in the example. | |
| 605 | + | // | |
| 606 | + | // Use `ADW_RESPONSE_DESTRUCTIVE` to draw attention to the potentially damaging | |
| 607 | + | // consequences of using @response. This appearance acts as a warning to the | |
| 608 | + | // user. The Discard button in the example is using this appearance. | |
| 609 | + | // | |
| 610 | + | // The default appearance is `ADW_RESPONSE_DEFAULT`. | |
| 611 | + | // | |
| 612 | + | // Negative responses like Cancel or Close should use the default appearance. | |
| 613 | + | func (x *AlertDialog) SetResponseAppearance(ResponseVar string, AppearanceVar ResponseAppearance) { | |
| 614 | + | ||
| 615 | + | xAlertDialogSetResponseAppearance(x.GoPointer(), ResponseVar, AppearanceVar) | |
| 616 | + | ||
| 617 | + | } | |
| 618 | + | ||
| 619 | + | var xAlertDialogSetResponseEnabled func(uintptr, string, bool) | |
| 620 | + | ||
| 621 | + | // Sets whether @response is enabled. | |
| 622 | + | // | |
| 623 | + | // If @response is not enabled, the corresponding button will have | |
| 624 | + | // [property@Gtk.Widget:sensitive] set to `FALSE` and it can't be activated as | |
| 625 | + | // a default response. | |
| 626 | + | // | |
| 627 | + | // @response can still be used as [property@AlertDialog:close-response] while | |
| 628 | + | // it's not enabled. | |
| 629 | + | // | |
| 630 | + | // Responses are enabled by default. | |
| 631 | + | func (x *AlertDialog) SetResponseEnabled(ResponseVar string, EnabledVar bool) { | |
| 632 | + | ||
| 633 | + | xAlertDialogSetResponseEnabled(x.GoPointer(), ResponseVar, EnabledVar) | |
| 634 | + | ||
| 635 | + | } | |
| 636 | + | ||
| 637 | + | var xAlertDialogSetResponseLabel func(uintptr, string, string) | |
| 638 | + | ||
| 639 | + | // Sets the label of @response to @label. | |
| 640 | + | // | |
| 641 | + | // Labels are displayed on the dialog buttons. An embedded underline in @label | |
| 642 | + | // indicates a mnemonic. | |
| 643 | + | func (x *AlertDialog) SetResponseLabel(ResponseVar string, LabelVar string) { | |
| 644 | + | ||
| 645 | + | xAlertDialogSetResponseLabel(x.GoPointer(), ResponseVar, LabelVar) | |
| 646 | + | ||
| 647 | + | } | |
| 648 | + | ||
| 649 | + | func (c *AlertDialog) GoPointer() uintptr { | |
| 650 | + | return c.Ptr | |
| 651 | + | } | |
| 652 | + | ||
| 653 | + | func (c *AlertDialog) SetGoPointer(ptr uintptr) { | |
| 654 | + | c.Ptr = ptr | |
| 655 | + | } | |
| 656 | + | ||
| 657 | + | // This signal is emitted when the dialog is closed. | |
| 658 | + | // | |
| 659 | + | // @response will be set to the response ID of the button that had been | |
| 660 | + | // activated. | |
| 661 | + | // | |
| 662 | + | // if the dialog was closed by pressing <kbd>Escape</kbd> or with a system | |
| 663 | + | // action, @response will be set to the value of | |
| 664 | + | // [property@AlertDialog:close-response]. | |
| 665 | + | func (x *AlertDialog) ConnectResponse(cb *func(AlertDialog, string)) uint32 { | |
| 666 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 667 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 668 | + | return gobject.SignalConnect(x.GoPointer(), "response", cbRefPtr) | |
| 669 | + | } | |
| 670 | + | ||
| 671 | + | fcb := func(clsPtr uintptr, ResponseVarp string) { | |
| 672 | + | fa := AlertDialog{} | |
| 673 | + | fa.Ptr = clsPtr | |
| 674 | + | cbFn := *cb | |
| 675 | + | ||
| 676 | + | cbFn(fa, ResponseVarp) | |
| 677 | + | ||
| 678 | + | } | |
| 679 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 680 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 681 | + | return gobject.SignalConnect(x.GoPointer(), "response", cbRefPtr) | |
| 682 | + | } | |
| 683 | + | ||
| 684 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 685 | + | func (x *AlertDialog) GetAccessibleRole() gtk.AccessibleRole { | |
| 686 | + | ||
| 687 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 688 | + | return cret | |
| 689 | + | } | |
| 690 | + | ||
| 691 | + | // Resets the accessible @property to its default value. | |
| 692 | + | func (x *AlertDialog) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 693 | + | ||
| 694 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 695 | + | ||
| 696 | + | } | |
| 697 | + | ||
| 698 | + | // Resets the accessible @relation to its default value. | |
| 699 | + | func (x *AlertDialog) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 700 | + | ||
| 701 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 702 | + | ||
| 703 | + | } | |
| 704 | + | ||
| 705 | + | // Resets the accessible @state to its default value. | |
| 706 | + | func (x *AlertDialog) ResetState(StateVar gtk.AccessibleState) { | |
| 707 | + | ||
| 708 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 709 | + | ||
| 710 | + | } | |
| 711 | + | ||
| 712 | + | // Updates a list of accessible properties. | |
| 713 | + | // | |
| 714 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 715 | + | // value types of accessible properties. | |
| 716 | + | // | |
| 717 | + | // This function should be called by `GtkWidget` types whenever | |
| 718 | + | // an accessible property change must be communicated to assistive | |
| 719 | + | // technologies. | |
| 720 | + | // | |
| 721 | + | // Example: | |
| 722 | + | // ```c | |
| 723 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 724 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 725 | + | // | |
| 726 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 727 | + | // -1); | |
| 728 | + | // | |
| 729 | + | // ``` | |
| 730 | + | func (x *AlertDialog) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 731 | + | ||
| 732 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 733 | + | ||
| 734 | + | } | |
| 735 | + | ||
| 736 | + | // Updates an array of accessible properties. | |
| 737 | + | // | |
| 738 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 739 | + | // property change must be communicated to assistive technologies. | |
| 740 | + | // | |
| 741 | + | // This function is meant to be used by language bindings. | |
| 742 | + | func (x *AlertDialog) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 743 | + | ||
| 744 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 745 | + | ||
| 746 | + | } | |
| 747 | + | ||
| 748 | + | // Updates a list of accessible relations. | |
| 749 | + | // | |
| 750 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 751 | + | // relation change must be communicated to assistive technologies. | |
| 752 | + | // | |
| 753 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 754 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 755 | + | // | |
| 756 | + | // ```c | |
| 757 | + | // gtk_accessible_update_relation (accessible, | |
| 758 | + | // | |
| 759 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 760 | + | // ref1, NULL, | |
| 761 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 762 | + | // ref1, ref2, ref3, NULL, | |
| 763 | + | // -1); | |
| 764 | + | // | |
| 765 | + | // ``` | |
| 766 | + | func (x *AlertDialog) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 767 | + | ||
| 768 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 769 | + | ||
| 770 | + | } | |
| 771 | + | ||
| 772 | + | // Updates an array of accessible relations. | |
| 773 | + | // | |
| 774 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 775 | + | // relation change must be communicated to assistive technologies. | |
| 776 | + | // | |
| 777 | + | // This function is meant to be used by language bindings. | |
| 778 | + | func (x *AlertDialog) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 779 | + | ||
| 780 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 781 | + | ||
| 782 | + | } | |
| 783 | + | ||
| 784 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 785 | + | // documentation for the value types of accessible states. | |
| 786 | + | // | |
| 787 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 788 | + | // state change must be communicated to assistive technologies. | |
| 789 | + | // | |
| 790 | + | // Example: | |
| 791 | + | // ```c | |
| 792 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 793 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 794 | + | // | |
| 795 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 796 | + | // -1); | |
| 797 | + | // | |
| 798 | + | // ``` | |
| 799 | + | func (x *AlertDialog) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 800 | + | ||
| 801 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 802 | + | ||
| 803 | + | } | |
| 804 | + | ||
| 805 | + | // Updates an array of accessible states. | |
| 806 | + | // | |
| 807 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 808 | + | // state change must be communicated to assistive technologies. | |
| 809 | + | // | |
| 810 | + | // This function is meant to be used by language bindings. | |
| 811 | + | func (x *AlertDialog) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 812 | + | ||
| 813 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 814 | + | ||
| 815 | + | } | |
| 816 | + | ||
| 817 | + | // Gets the ID of the @buildable object. | |
| 818 | + | // | |
| 819 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 820 | + | // of the <object> tag used to construct the @buildable. | |
| 821 | + | func (x *AlertDialog) GetBuildableId() string { | |
| 822 | + | ||
| 823 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 824 | + | return cret | |
| 825 | + | } | |
| 826 | + | ||
| 827 | + | func init() { | |
| 828 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 829 | + | if err != nil { | |
| 830 | + | panic(err) | |
| 831 | + | } | |
| 832 | + | ||
| 833 | + | core.PuregoSafeRegister(&xResponseAppearanceGLibType, lib, "adw_response_appearance_get_type") | |
| 834 | + | ||
| 835 | + | core.PuregoSafeRegister(&xAlertDialogGLibType, lib, "adw_alert_dialog_get_type") | |
| 836 | + | ||
| 837 | + | core.PuregoSafeRegister(&xNewAlertDialog, lib, "adw_alert_dialog_new") | |
| 838 | + | ||
| 839 | + | core.PuregoSafeRegister(&xAlertDialogAddResponse, lib, "adw_alert_dialog_add_response") | |
| 840 | + | core.PuregoSafeRegister(&xAlertDialogAddResponses, lib, "adw_alert_dialog_add_responses") | |
| 841 | + | core.PuregoSafeRegister(&xAlertDialogChoose, lib, "adw_alert_dialog_choose") | |
| 842 | + | core.PuregoSafeRegister(&xAlertDialogChooseFinish, lib, "adw_alert_dialog_choose_finish") | |
| 843 | + | core.PuregoSafeRegister(&xAlertDialogFormatBody, lib, "adw_alert_dialog_format_body") | |
| 844 | + | core.PuregoSafeRegister(&xAlertDialogFormatBodyMarkup, lib, "adw_alert_dialog_format_body_markup") | |
| 845 | + | core.PuregoSafeRegister(&xAlertDialogFormatHeading, lib, "adw_alert_dialog_format_heading") | |
| 846 | + | core.PuregoSafeRegister(&xAlertDialogFormatHeadingMarkup, lib, "adw_alert_dialog_format_heading_markup") | |
| 847 | + | core.PuregoSafeRegister(&xAlertDialogGetBody, lib, "adw_alert_dialog_get_body") | |
| 848 | + | core.PuregoSafeRegister(&xAlertDialogGetBodyUseMarkup, lib, "adw_alert_dialog_get_body_use_markup") | |
| 849 | + | core.PuregoSafeRegister(&xAlertDialogGetCloseResponse, lib, "adw_alert_dialog_get_close_response") | |
| 850 | + | core.PuregoSafeRegister(&xAlertDialogGetDefaultResponse, lib, "adw_alert_dialog_get_default_response") | |
| 851 | + | core.PuregoSafeRegister(&xAlertDialogGetExtraChild, lib, "adw_alert_dialog_get_extra_child") | |
| 852 | + | core.PuregoSafeRegister(&xAlertDialogGetHeading, lib, "adw_alert_dialog_get_heading") | |
| 853 | + | core.PuregoSafeRegister(&xAlertDialogGetHeadingUseMarkup, lib, "adw_alert_dialog_get_heading_use_markup") | |
| 854 | + | core.PuregoSafeRegister(&xAlertDialogGetPreferWideLayout, lib, "adw_alert_dialog_get_prefer_wide_layout") | |
| 855 | + | core.PuregoSafeRegister(&xAlertDialogGetResponseAppearance, lib, "adw_alert_dialog_get_response_appearance") | |
| 856 | + | core.PuregoSafeRegister(&xAlertDialogGetResponseEnabled, lib, "adw_alert_dialog_get_response_enabled") | |
| 857 | + | core.PuregoSafeRegister(&xAlertDialogGetResponseLabel, lib, "adw_alert_dialog_get_response_label") | |
| 858 | + | core.PuregoSafeRegister(&xAlertDialogHasResponse, lib, "adw_alert_dialog_has_response") | |
| 859 | + | core.PuregoSafeRegister(&xAlertDialogRemoveResponse, lib, "adw_alert_dialog_remove_response") | |
| 860 | + | core.PuregoSafeRegister(&xAlertDialogSetBody, lib, "adw_alert_dialog_set_body") | |
| 861 | + | core.PuregoSafeRegister(&xAlertDialogSetBodyUseMarkup, lib, "adw_alert_dialog_set_body_use_markup") | |
| 862 | + | core.PuregoSafeRegister(&xAlertDialogSetCloseResponse, lib, "adw_alert_dialog_set_close_response") | |
| 863 | + | core.PuregoSafeRegister(&xAlertDialogSetDefaultResponse, lib, "adw_alert_dialog_set_default_response") | |
| 864 | + | core.PuregoSafeRegister(&xAlertDialogSetExtraChild, lib, "adw_alert_dialog_set_extra_child") | |
| 865 | + | core.PuregoSafeRegister(&xAlertDialogSetHeading, lib, "adw_alert_dialog_set_heading") | |
| 866 | + | core.PuregoSafeRegister(&xAlertDialogSetHeadingUseMarkup, lib, "adw_alert_dialog_set_heading_use_markup") | |
| 867 | + | core.PuregoSafeRegister(&xAlertDialogSetPreferWideLayout, lib, "adw_alert_dialog_set_prefer_wide_layout") | |
| 868 | + | core.PuregoSafeRegister(&xAlertDialogSetResponseAppearance, lib, "adw_alert_dialog_set_response_appearance") | |
| 869 | + | core.PuregoSafeRegister(&xAlertDialogSetResponseEnabled, lib, "adw_alert_dialog_set_response_enabled") | |
| 870 | + | core.PuregoSafeRegister(&xAlertDialogSetResponseLabel, lib, "adw_alert_dialog_set_response_label") | |
| 871 | + | ||
| 872 | + | } | |
M v4/adw/adw-application-window.go +84 -0
| @@ -42,6 +42,25 @@ func (x *ApplicationWindowClass) GoPointer() uintptr { | |||
| 42 | 42 | // | |
| 43 | 43 | // See [class@Window] for details. | |
| 44 | 44 | // | |
| 45 | + | // Example of an `AdwApplicationWindow` UI definition: | |
| 46 | + | // | |
| 47 | + | // ```xml | |
| 48 | + | // <object class="AdwApplicationWindow"> | |
| 49 | + | // | |
| 50 | + | // <property name="content"> | |
| 51 | + | // <object class="AdwToolbarView"> | |
| 52 | + | // <child type="top"> | |
| 53 | + | // <object class="AdwHeaderBar"/> | |
| 54 | + | // </child> | |
| 55 | + | // <property name="content"> | |
| 56 | + | // <!-- ... --> | |
| 57 | + | // </property> | |
| 58 | + | // </object> | |
| 59 | + | // </property> | |
| 60 | + | // | |
| 61 | + | // </object> | |
| 62 | + | // ``` | |
| 63 | + | // | |
| 45 | 64 | // Using [property@Gtk.Application:menubar] is not supported and may result in | |
| 46 | 65 | // visual glitches. | |
| 47 | 66 | type ApplicationWindow struct { | |
| @@ -77,6 +96,15 @@ func NewApplicationWindow(AppVar *gtk.Application) *ApplicationWindow { | |||
| 77 | 96 | return cls | |
| 78 | 97 | } | |
| 79 | 98 | ||
| 99 | + | var xApplicationWindowAddBreakpoint func(uintptr, uintptr) | |
| 100 | + | ||
| 101 | + | // Adds @breakpoint to @self. | |
| 102 | + | func (x *ApplicationWindow) AddBreakpoint(BreakpointVar *Breakpoint) { | |
| 103 | + | ||
| 104 | + | xApplicationWindowAddBreakpoint(x.GoPointer(), BreakpointVar.GoPointer()) | |
| 105 | + | ||
| 106 | + | } | |
| 107 | + | ||
| 80 | 108 | var xApplicationWindowGetContent func(uintptr) uintptr | |
| 81 | 109 | ||
| 82 | 110 | // Gets the content widget of @self. | |
| @@ -96,6 +124,58 @@ func (x *ApplicationWindow) GetContent() *gtk.Widget { | |||
| 96 | 124 | return cls | |
| 97 | 125 | } | |
| 98 | 126 | ||
| 127 | + | var xApplicationWindowGetCurrentBreakpoint func(uintptr) uintptr | |
| 128 | + | ||
| 129 | + | // Gets the current breakpoint. | |
| 130 | + | func (x *ApplicationWindow) GetCurrentBreakpoint() *Breakpoint { | |
| 131 | + | var cls *Breakpoint | |
| 132 | + | ||
| 133 | + | cret := xApplicationWindowGetCurrentBreakpoint(x.GoPointer()) | |
| 134 | + | ||
| 135 | + | if cret == 0 { | |
| 136 | + | return nil | |
| 137 | + | } | |
| 138 | + | gobject.IncreaseRef(cret) | |
| 139 | + | cls = &Breakpoint{} | |
| 140 | + | cls.Ptr = cret | |
| 141 | + | return cls | |
| 142 | + | } | |
| 143 | + | ||
| 144 | + | var xApplicationWindowGetDialogs func(uintptr) uintptr | |
| 145 | + | ||
| 146 | + | // Returns a [iface@Gio.ListModel] that contains the open dialogs of @self. | |
| 147 | + | // | |
| 148 | + | // This can be used to keep an up-to-date view. | |
| 149 | + | func (x *ApplicationWindow) GetDialogs() *gio.ListModelBase { | |
| 150 | + | var cls *gio.ListModelBase | |
| 151 | + | ||
| 152 | + | cret := xApplicationWindowGetDialogs(x.GoPointer()) | |
| 153 | + | ||
| 154 | + | if cret == 0 { | |
| 155 | + | return nil | |
| 156 | + | } | |
| 157 | + | cls = &gio.ListModelBase{} | |
| 158 | + | cls.Ptr = cret | |
| 159 | + | return cls | |
| 160 | + | } | |
| 161 | + | ||
| 162 | + | var xApplicationWindowGetVisibleDialog func(uintptr) uintptr | |
| 163 | + | ||
| 164 | + | // Returns the currently visible dialog in @self, if there's one. | |
| 165 | + | func (x *ApplicationWindow) GetVisibleDialog() *Dialog { | |
| 166 | + | var cls *Dialog | |
| 167 | + | ||
| 168 | + | cret := xApplicationWindowGetVisibleDialog(x.GoPointer()) | |
| 169 | + | ||
| 170 | + | if cret == 0 { | |
| 171 | + | return nil | |
| 172 | + | } | |
| 173 | + | gobject.IncreaseRef(cret) | |
| 174 | + | cls = &Dialog{} | |
| 175 | + | cls.Ptr = cret | |
| 176 | + | return cls | |
| 177 | + | } | |
| 178 | + | ||
| 99 | 179 | var xApplicationWindowSetContent func(uintptr, uintptr) | |
| 100 | 180 | ||
| 101 | 181 | // Sets the content widget of @self. | |
| @@ -693,7 +773,11 @@ func init() { | |||
| 693 | 773 | ||
| 694 | 774 | core.PuregoSafeRegister(&xNewApplicationWindow, lib, "adw_application_window_new") | |
| 695 | 775 | ||
| 776 | + | core.PuregoSafeRegister(&xApplicationWindowAddBreakpoint, lib, "adw_application_window_add_breakpoint") | |
| 696 | 777 | core.PuregoSafeRegister(&xApplicationWindowGetContent, lib, "adw_application_window_get_content") | |
| 778 | + | core.PuregoSafeRegister(&xApplicationWindowGetCurrentBreakpoint, lib, "adw_application_window_get_current_breakpoint") | |
| 779 | + | core.PuregoSafeRegister(&xApplicationWindowGetDialogs, lib, "adw_application_window_get_dialogs") | |
| 780 | + | core.PuregoSafeRegister(&xApplicationWindowGetVisibleDialog, lib, "adw_application_window_get_visible_dialog") | |
| 697 | 781 | core.PuregoSafeRegister(&xApplicationWindowSetContent, lib, "adw_application_window_set_content") | |
| 698 | 782 | ||
| 699 | 783 | } | |
A v4/adw/adw-bottom-sheet.go +650 -0
| @@ -0,0 +1,650 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gdk" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 13 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 14 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 15 | + | ) | |
| 16 | + | ||
| 17 | + | type BottomSheetClass struct { | |
| 18 | + | _ structs.HostLayout | |
| 19 | + | ||
| 20 | + | ParentClass uintptr | |
| 21 | + | } | |
| 22 | + | ||
| 23 | + | func (x *BottomSheetClass) GoPointer() uintptr { | |
| 24 | + | return uintptr(unsafe.Pointer(x)) | |
| 25 | + | } | |
| 26 | + | ||
| 27 | + | // A bottom sheet with an optional bottom bar. | |
| 28 | + | // | |
| 29 | + | // <picture> | |
| 30 | + | // | |
| 31 | + | // <source srcset="bottom-sheet-dark.png" media="(prefers-color-scheme: dark)"> | |
| 32 | + | // <img src="bottom-sheet.png" alt="bottom-sheet"> | |
| 33 | + | // | |
| 34 | + | // </picture> | |
| 35 | + | // | |
| 36 | + | // `AdwBottomSheet` has three child widgets. [property@BottomSheet:content] is | |
| 37 | + | // shown persistently. [property@BottomSheet:sheet] is displayed above it when | |
| 38 | + | // it's open, and [property@BottomSheet:bottom-bar] is displayed when it's not. | |
| 39 | + | // | |
| 40 | + | // Bottom sheet and bottom bar are attached to the bottom edge of the widget. | |
| 41 | + | // They take the full width by default, but can only take a portion of it if | |
| 42 | + | // [property@BottomSheet:full-width] is set to `FALSE`. In this case, | |
| 43 | + | // [property@BottomSheet:align] determines where along the bottom edge they are | |
| 44 | + | // placed. | |
| 45 | + | // | |
| 46 | + | // `AdwBottomSheet` can be useful for applications such as music players, that | |
| 47 | + | // want to have a persistent bottom bar that expands into a bottom sheet when | |
| 48 | + | // clicked. It's meant for cases where a bottom sheet is tightly integrated into | |
| 49 | + | // the UI. For more transient bottom sheets, see [class@Dialog]. | |
| 50 | + | // | |
| 51 | + | // To open or close the bottom sheet, use the [property@BottomSheet:open] | |
| 52 | + | // property. | |
| 53 | + | // | |
| 54 | + | // By default, the bottom sheet has an overlaid drag handle. It can be disabled | |
| 55 | + | // by setting [property@BottomSheet:show-drag-handle] to `FALSE`. Note that the | |
| 56 | + | // handle also controls whether the sheet can be dragged using a pointer. | |
| 57 | + | // | |
| 58 | + | // Bottom sheets are modal by default, meaning that the content is dimmed and | |
| 59 | + | // cannot be accessed while the sheet is open. Set [property@BottomSheet:modal] | |
| 60 | + | // to `FALSE` if this behavior is unwanted. | |
| 61 | + | // | |
| 62 | + | // To disable user interactions for opening or closing the bottom sheet (such as | |
| 63 | + | // swipes or clicking the bottom bar or close button), set | |
| 64 | + | // [property@BottomSheet:can-open] or [property@BottomSheet:can-close] to | |
| 65 | + | // `FALSE`. | |
| 66 | + | // | |
| 67 | + | // In some cases, particularly when using a full-width bottom bar, it may be | |
| 68 | + | // necessary to shift [property@BottomSheet:content] upwards. Use the | |
| 69 | + | // [property@BottomSheet:bottom-bar-height] and | |
| 70 | + | // [property@BottomSheet:sheet-height] for that. | |
| 71 | + | // | |
| 72 | + | // `AdwBottomSheet` is not adaptive, and for larger window sizes applications | |
| 73 | + | // may want to replace it with another UI, such as a sidebar. This can be done | |
| 74 | + | // using [class@MultiLayoutView]. | |
| 75 | + | // | |
| 76 | + | // ## Sizing | |
| 77 | + | // | |
| 78 | + | // Unlike [class@Dialog] presented as a bottom sheet, `AdwBottomSheet` just | |
| 79 | + | // follows the content's natural size, and it's up to the applications to make | |
| 80 | + | // sure their content provides one. For example, when using | |
| 81 | + | // [class@Gtk.ScrolledWindow], make sure to set | |
| 82 | + | // [property@Gtk.ScrolledWindow:propagate-natural-height] to `TRUE`. | |
| 83 | + | // | |
| 84 | + | // ## Header Bar Integration | |
| 85 | + | // | |
| 86 | + | // When placed inside an `AdwBottomSheet`, [class@HeaderBar] will not show the | |
| 87 | + | // title when [property@BottomSheet:show-drag-handle] is `TRUE`, regardless of | |
| 88 | + | // [property@HeaderBar:show-title]. This only applies to the default title, | |
| 89 | + | // titles set with [property@HeaderBar:title-widget] will still be shown. | |
| 90 | + | // | |
| 91 | + | // ## `AdwBottomSheet` as `GtkBuildable`: | |
| 92 | + | // | |
| 93 | + | // The `AdwBottomSheet` implementation of the [iface@Gtk.Buildable] interface | |
| 94 | + | // supports setting the sheet widget by specifying “sheet” as the “type” | |
| 95 | + | // attribute of a `<child>` element, and the bottom bar by specifying | |
| 96 | + | // “bottom-bar”. Specifying “content” or omitting the child type results in | |
| 97 | + | // setting the content child. | |
| 98 | + | type BottomSheet struct { | |
| 99 | + | gtk.Widget | |
| 100 | + | } | |
| 101 | + | ||
| 102 | + | var xBottomSheetGLibType func() types.GType | |
| 103 | + | ||
| 104 | + | func BottomSheetGLibType() types.GType { | |
| 105 | + | return xBottomSheetGLibType() | |
| 106 | + | } | |
| 107 | + | ||
| 108 | + | func BottomSheetNewFromInternalPtr(ptr uintptr) *BottomSheet { | |
| 109 | + | cls := &BottomSheet{} | |
| 110 | + | cls.Ptr = ptr | |
| 111 | + | return cls | |
| 112 | + | } | |
| 113 | + | ||
| 114 | + | var xNewBottomSheet func() uintptr | |
| 115 | + | ||
| 116 | + | // Creates a new `AdwBottomSheet`. | |
| 117 | + | func NewBottomSheet() *BottomSheet { | |
| 118 | + | var cls *BottomSheet | |
| 119 | + | ||
| 120 | + | cret := xNewBottomSheet() | |
| 121 | + | ||
| 122 | + | if cret == 0 { | |
| 123 | + | return nil | |
| 124 | + | } | |
| 125 | + | gobject.IncreaseRef(cret) | |
| 126 | + | cls = &BottomSheet{} | |
| 127 | + | cls.Ptr = cret | |
| 128 | + | return cls | |
| 129 | + | } | |
| 130 | + | ||
| 131 | + | var xBottomSheetGetAlign func(uintptr) float32 | |
| 132 | + | ||
| 133 | + | // Gets horizontal alignment of the bottom sheet. | |
| 134 | + | func (x *BottomSheet) GetAlign() float32 { | |
| 135 | + | ||
| 136 | + | cret := xBottomSheetGetAlign(x.GoPointer()) | |
| 137 | + | return cret | |
| 138 | + | } | |
| 139 | + | ||
| 140 | + | var xBottomSheetGetBottomBar func(uintptr) uintptr | |
| 141 | + | ||
| 142 | + | // Gets the bottom bar widget for @self. | |
| 143 | + | func (x *BottomSheet) GetBottomBar() *gtk.Widget { | |
| 144 | + | var cls *gtk.Widget | |
| 145 | + | ||
| 146 | + | cret := xBottomSheetGetBottomBar(x.GoPointer()) | |
| 147 | + | ||
| 148 | + | if cret == 0 { | |
| 149 | + | return nil | |
| 150 | + | } | |
| 151 | + | gobject.IncreaseRef(cret) | |
| 152 | + | cls = >k.Widget{} | |
| 153 | + | cls.Ptr = cret | |
| 154 | + | return cls | |
| 155 | + | } | |
| 156 | + | ||
| 157 | + | var xBottomSheetGetBottomBarHeight func(uintptr) int | |
| 158 | + | ||
| 159 | + | // Gets the current bottom bar height. | |
| 160 | + | // | |
| 161 | + | // It can be used to shift the content upwards permanently to accommodate for | |
| 162 | + | // the bottom bar. | |
| 163 | + | func (x *BottomSheet) GetBottomBarHeight() int { | |
| 164 | + | ||
| 165 | + | cret := xBottomSheetGetBottomBarHeight(x.GoPointer()) | |
| 166 | + | return cret | |
| 167 | + | } | |
| 168 | + | ||
| 169 | + | var xBottomSheetGetCanClose func(uintptr) bool | |
| 170 | + | ||
| 171 | + | // Gets whether the bottom sheet can be closed by user. | |
| 172 | + | func (x *BottomSheet) GetCanClose() bool { | |
| 173 | + | ||
| 174 | + | cret := xBottomSheetGetCanClose(x.GoPointer()) | |
| 175 | + | return cret | |
| 176 | + | } | |
| 177 | + | ||
| 178 | + | var xBottomSheetGetCanOpen func(uintptr) bool | |
| 179 | + | ||
| 180 | + | // Gets whether the bottom sheet can be opened by user. | |
| 181 | + | func (x *BottomSheet) GetCanOpen() bool { | |
| 182 | + | ||
| 183 | + | cret := xBottomSheetGetCanOpen(x.GoPointer()) | |
| 184 | + | return cret | |
| 185 | + | } | |
| 186 | + | ||
| 187 | + | var xBottomSheetGetContent func(uintptr) uintptr | |
| 188 | + | ||
| 189 | + | // Gets the content widget for @self. | |
| 190 | + | func (x *BottomSheet) GetContent() *gtk.Widget { | |
| 191 | + | var cls *gtk.Widget | |
| 192 | + | ||
| 193 | + | cret := xBottomSheetGetContent(x.GoPointer()) | |
| 194 | + | ||
| 195 | + | if cret == 0 { | |
| 196 | + | return nil | |
| 197 | + | } | |
| 198 | + | gobject.IncreaseRef(cret) | |
| 199 | + | cls = >k.Widget{} | |
| 200 | + | cls.Ptr = cret | |
| 201 | + | return cls | |
| 202 | + | } | |
| 203 | + | ||
| 204 | + | var xBottomSheetGetFullWidth func(uintptr) bool | |
| 205 | + | ||
| 206 | + | // Gets whether the bottom sheet takes the full width. | |
| 207 | + | func (x *BottomSheet) GetFullWidth() bool { | |
| 208 | + | ||
| 209 | + | cret := xBottomSheetGetFullWidth(x.GoPointer()) | |
| 210 | + | return cret | |
| 211 | + | } | |
| 212 | + | ||
| 213 | + | var xBottomSheetGetModal func(uintptr) bool | |
| 214 | + | ||
| 215 | + | // Gets whether the bottom sheet is modal. | |
| 216 | + | func (x *BottomSheet) GetModal() bool { | |
| 217 | + | ||
| 218 | + | cret := xBottomSheetGetModal(x.GoPointer()) | |
| 219 | + | return cret | |
| 220 | + | } | |
| 221 | + | ||
| 222 | + | var xBottomSheetGetOpen func(uintptr) bool | |
| 223 | + | ||
| 224 | + | // Gets whether the bottom sheet is open. | |
| 225 | + | func (x *BottomSheet) GetOpen() bool { | |
| 226 | + | ||
| 227 | + | cret := xBottomSheetGetOpen(x.GoPointer()) | |
| 228 | + | return cret | |
| 229 | + | } | |
| 230 | + | ||
| 231 | + | var xBottomSheetGetSheet func(uintptr) uintptr | |
| 232 | + | ||
| 233 | + | // Gets the bottom sheet widget for @self. | |
| 234 | + | func (x *BottomSheet) GetSheet() *gtk.Widget { | |
| 235 | + | var cls *gtk.Widget | |
| 236 | + | ||
| 237 | + | cret := xBottomSheetGetSheet(x.GoPointer()) | |
| 238 | + | ||
| 239 | + | if cret == 0 { | |
| 240 | + | return nil | |
| 241 | + | } | |
| 242 | + | gobject.IncreaseRef(cret) | |
| 243 | + | cls = >k.Widget{} | |
| 244 | + | cls.Ptr = cret | |
| 245 | + | return cls | |
| 246 | + | } | |
| 247 | + | ||
| 248 | + | var xBottomSheetGetSheetHeight func(uintptr) int | |
| 249 | + | ||
| 250 | + | // Gets the current bottom sheet height. | |
| 251 | + | // | |
| 252 | + | // It can be used to shift the content upwards when the bottom sheet is open. | |
| 253 | + | func (x *BottomSheet) GetSheetHeight() int { | |
| 254 | + | ||
| 255 | + | cret := xBottomSheetGetSheetHeight(x.GoPointer()) | |
| 256 | + | return cret | |
| 257 | + | } | |
| 258 | + | ||
| 259 | + | var xBottomSheetGetShowDragHandle func(uintptr) bool | |
| 260 | + | ||
| 261 | + | // Gets whether to show a drag handle in the bottom sheet. | |
| 262 | + | func (x *BottomSheet) GetShowDragHandle() bool { | |
| 263 | + | ||
| 264 | + | cret := xBottomSheetGetShowDragHandle(x.GoPointer()) | |
| 265 | + | return cret | |
| 266 | + | } | |
| 267 | + | ||
| 268 | + | var xBottomSheetSetAlign func(uintptr, float32) | |
| 269 | + | ||
| 270 | + | // Sets horizontal alignment of the bottom sheet. | |
| 271 | + | // | |
| 272 | + | // 0 means the bottom sheet is flush with the start edge, 1 means it's flush | |
| 273 | + | // with the end edge. 0.5 means it's centered. | |
| 274 | + | // | |
| 275 | + | // Only used when [property@BottomSheet:full-width] is set to `FALSE`. | |
| 276 | + | func (x *BottomSheet) SetAlign(AlignVar float32) { | |
| 277 | + | ||
| 278 | + | xBottomSheetSetAlign(x.GoPointer(), AlignVar) | |
| 279 | + | ||
| 280 | + | } | |
| 281 | + | ||
| 282 | + | var xBottomSheetSetBottomBar func(uintptr, uintptr) | |
| 283 | + | ||
| 284 | + | // Sets the bottom bar widget for @self. | |
| 285 | + | // | |
| 286 | + | // Shown when [property@BottomSheet:open] is `FALSE`. When open, morphs into | |
| 287 | + | // the [property@BottomSheet:sheet]. | |
| 288 | + | func (x *BottomSheet) SetBottomBar(BottomBarVar *gtk.Widget) { | |
| 289 | + | ||
| 290 | + | xBottomSheetSetBottomBar(x.GoPointer(), BottomBarVar.GoPointer()) | |
| 291 | + | ||
| 292 | + | } | |
| 293 | + | ||
| 294 | + | var xBottomSheetSetCanClose func(uintptr, bool) | |
| 295 | + | ||
| 296 | + | // Sets whether the bottom sheet can be closed by user. | |
| 297 | + | // | |
| 298 | + | // It can be closed via the close button, swiping down, pressing | |
| 299 | + | // <kbd>Escape</kbd> or clicking the content dimming (when modal). | |
| 300 | + | // | |
| 301 | + | // Bottom sheet can still be closed using [property@BottomSheet:open]. | |
| 302 | + | func (x *BottomSheet) SetCanClose(CanCloseVar bool) { | |
| 303 | + | ||
| 304 | + | xBottomSheetSetCanClose(x.GoPointer(), CanCloseVar) | |
| 305 | + | ||
| 306 | + | } | |
| 307 | + | ||
| 308 | + | var xBottomSheetSetCanOpen func(uintptr, bool) | |
| 309 | + | ||
| 310 | + | // Sets whether the bottom sheet can be opened by user. | |
| 311 | + | // | |
| 312 | + | // It can be opened via clicking or swiping up from the bottom bar. | |
| 313 | + | // | |
| 314 | + | // Does nothing if [property@BottomSheet:bottom-bar] is not set. | |
| 315 | + | // | |
| 316 | + | // Bottom sheet can still be opened using [property@BottomSheet:open]. | |
| 317 | + | func (x *BottomSheet) SetCanOpen(CanOpenVar bool) { | |
| 318 | + | ||
| 319 | + | xBottomSheetSetCanOpen(x.GoPointer(), CanOpenVar) | |
| 320 | + | ||
| 321 | + | } | |
| 322 | + | ||
| 323 | + | var xBottomSheetSetContent func(uintptr, uintptr) | |
| 324 | + | ||
| 325 | + | // Sets the content widget for @self. | |
| 326 | + | // | |
| 327 | + | // It's always shown, and the bottom sheet is overlaid over it. | |
| 328 | + | func (x *BottomSheet) SetContent(ContentVar *gtk.Widget) { | |
| 329 | + | ||
| 330 | + | xBottomSheetSetContent(x.GoPointer(), ContentVar.GoPointer()) | |
| 331 | + | ||
| 332 | + | } | |
| 333 | + | ||
| 334 | + | var xBottomSheetSetFullWidth func(uintptr, bool) | |
| 335 | + | ||
| 336 | + | // Sets whether the bottom sheet takes the full width. | |
| 337 | + | // | |
| 338 | + | // When full width, [property@BottomSheet:align] is ignored. | |
| 339 | + | func (x *BottomSheet) SetFullWidth(FullWidthVar bool) { | |
| 340 | + | ||
| 341 | + | xBottomSheetSetFullWidth(x.GoPointer(), FullWidthVar) | |
| 342 | + | ||
| 343 | + | } | |
| 344 | + | ||
| 345 | + | var xBottomSheetSetModal func(uintptr, bool) | |
| 346 | + | ||
| 347 | + | // Sets whether the bottom sheet is modal. | |
| 348 | + | // | |
| 349 | + | // When modal, [property@BottomSheet:content] will be dimmed when the bottom | |
| 350 | + | // sheet is open, and clicking it will close the bottom sheet. It also cannot be | |
| 351 | + | // focused with keyboard. | |
| 352 | + | // | |
| 353 | + | // Otherwise, the content is accessible even when the bottom sheet is open. | |
| 354 | + | func (x *BottomSheet) SetModal(ModalVar bool) { | |
| 355 | + | ||
| 356 | + | xBottomSheetSetModal(x.GoPointer(), ModalVar) | |
| 357 | + | ||
| 358 | + | } | |
| 359 | + | ||
| 360 | + | var xBottomSheetSetOpen func(uintptr, bool) | |
| 361 | + | ||
| 362 | + | // Sets whether the bottom sheet is open. | |
| 363 | + | func (x *BottomSheet) SetOpen(OpenVar bool) { | |
| 364 | + | ||
| 365 | + | xBottomSheetSetOpen(x.GoPointer(), OpenVar) | |
| 366 | + | ||
| 367 | + | } | |
| 368 | + | ||
| 369 | + | var xBottomSheetSetSheet func(uintptr, uintptr) | |
| 370 | + | ||
| 371 | + | // Sets the bottom sheet widget for @self. | |
| 372 | + | // | |
| 373 | + | // Only shown when [property@BottomSheet:open] is `TRUE`. | |
| 374 | + | func (x *BottomSheet) SetSheet(SheetVar *gtk.Widget) { | |
| 375 | + | ||
| 376 | + | xBottomSheetSetSheet(x.GoPointer(), SheetVar.GoPointer()) | |
| 377 | + | ||
| 378 | + | } | |
| 379 | + | ||
| 380 | + | var xBottomSheetSetShowDragHandle func(uintptr, bool) | |
| 381 | + | ||
| 382 | + | // Sets whether to show a drag handle in the bottom sheet. | |
| 383 | + | // | |
| 384 | + | // The handle will be overlaid over [property@BottomSheet:sheet]. | |
| 385 | + | // | |
| 386 | + | // When the handle is shown, [class@HeaderBar] will hide its default title, and | |
| 387 | + | // [class@ToolbarView] will reserve space if there are no top bars. | |
| 388 | + | // | |
| 389 | + | // Showing drag handle also allows to swipe the bottom sheet down (and to swipe | |
| 390 | + | // the bottom bar up) with a pointer, instead of just touchscreen. | |
| 391 | + | func (x *BottomSheet) SetShowDragHandle(ShowDragHandleVar bool) { | |
| 392 | + | ||
| 393 | + | xBottomSheetSetShowDragHandle(x.GoPointer(), ShowDragHandleVar) | |
| 394 | + | ||
| 395 | + | } | |
| 396 | + | ||
| 397 | + | func (c *BottomSheet) GoPointer() uintptr { | |
| 398 | + | return c.Ptr | |
| 399 | + | } | |
| 400 | + | ||
| 401 | + | func (c *BottomSheet) SetGoPointer(ptr uintptr) { | |
| 402 | + | c.Ptr = ptr | |
| 403 | + | } | |
| 404 | + | ||
| 405 | + | // Emitted when the close button or shortcut is used while | |
| 406 | + | // [property@Dialog:can-close] is set to `FALSE`. | |
| 407 | + | func (x *BottomSheet) ConnectCloseAttempt(cb *func(BottomSheet)) uint32 { | |
| 408 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 409 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 410 | + | return gobject.SignalConnect(x.GoPointer(), "close-attempt", cbRefPtr) | |
| 411 | + | } | |
| 412 | + | ||
| 413 | + | fcb := func(clsPtr uintptr) { | |
| 414 | + | fa := BottomSheet{} | |
| 415 | + | fa.Ptr = clsPtr | |
| 416 | + | cbFn := *cb | |
| 417 | + | ||
| 418 | + | cbFn(fa) | |
| 419 | + | ||
| 420 | + | } | |
| 421 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 422 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 423 | + | return gobject.SignalConnect(x.GoPointer(), "close-attempt", cbRefPtr) | |
| 424 | + | } | |
| 425 | + | ||
| 426 | + | // Gets the progress @self will snap back to after the gesture is canceled. | |
| 427 | + | func (x *BottomSheet) GetCancelProgress() float64 { | |
| 428 | + | ||
| 429 | + | cret := XAdwSwipeableGetCancelProgress(x.GoPointer()) | |
| 430 | + | return cret | |
| 431 | + | } | |
| 432 | + | ||
| 433 | + | // Gets the swipe distance of @self. | |
| 434 | + | // | |
| 435 | + | // This corresponds to how many pixels 1 unit represents. | |
| 436 | + | func (x *BottomSheet) GetDistance() float64 { | |
| 437 | + | ||
| 438 | + | cret := XAdwSwipeableGetDistance(x.GoPointer()) | |
| 439 | + | return cret | |
| 440 | + | } | |
| 441 | + | ||
| 442 | + | // Gets the current progress of @self. | |
| 443 | + | func (x *BottomSheet) GetProgress() float64 { | |
| 444 | + | ||
| 445 | + | cret := XAdwSwipeableGetProgress(x.GoPointer()) | |
| 446 | + | return cret | |
| 447 | + | } | |
| 448 | + | ||
| 449 | + | // Gets the snap points of @self. | |
| 450 | + | // | |
| 451 | + | // Each snap point represents a progress value that is considered acceptable to | |
| 452 | + | // end the swipe on. | |
| 453 | + | func (x *BottomSheet) GetSnapPoints(NSnapPointsVar int) []float64 { | |
| 454 | + | ||
| 455 | + | cret := XAdwSwipeableGetSnapPoints(x.GoPointer(), NSnapPointsVar) | |
| 456 | + | return cret | |
| 457 | + | } | |
| 458 | + | ||
| 459 | + | // Gets the area @self can start a swipe from for the given direction and | |
| 460 | + | // gesture type. | |
| 461 | + | // | |
| 462 | + | // This can be used to restrict swipes to only be possible from a certain area, | |
| 463 | + | // for example, to only allow edge swipes, or to have a draggable element and | |
| 464 | + | // ignore swipes elsewhere. | |
| 465 | + | // | |
| 466 | + | // If not implemented, the default implementation returns the allocation of | |
| 467 | + | // @self, allowing swipes from anywhere. | |
| 468 | + | func (x *BottomSheet) GetSwipeArea(NavigationDirectionVar NavigationDirection, IsDragVar bool, RectVar *gdk.Rectangle) { | |
| 469 | + | ||
| 470 | + | XAdwSwipeableGetSwipeArea(x.GoPointer(), NavigationDirectionVar, IsDragVar, RectVar) | |
| 471 | + | ||
| 472 | + | } | |
| 473 | + | ||
| 474 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 475 | + | func (x *BottomSheet) GetAccessibleRole() gtk.AccessibleRole { | |
| 476 | + | ||
| 477 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 478 | + | return cret | |
| 479 | + | } | |
| 480 | + | ||
| 481 | + | // Resets the accessible @property to its default value. | |
| 482 | + | func (x *BottomSheet) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 483 | + | ||
| 484 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 485 | + | ||
| 486 | + | } | |
| 487 | + | ||
| 488 | + | // Resets the accessible @relation to its default value. | |
| 489 | + | func (x *BottomSheet) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 490 | + | ||
| 491 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 492 | + | ||
| 493 | + | } | |
| 494 | + | ||
| 495 | + | // Resets the accessible @state to its default value. | |
| 496 | + | func (x *BottomSheet) ResetState(StateVar gtk.AccessibleState) { | |
| 497 | + | ||
| 498 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 499 | + | ||
| 500 | + | } | |
| 501 | + | ||
| 502 | + | // Updates a list of accessible properties. | |
| 503 | + | // | |
| 504 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 505 | + | // value types of accessible properties. | |
| 506 | + | // | |
| 507 | + | // This function should be called by `GtkWidget` types whenever | |
| 508 | + | // an accessible property change must be communicated to assistive | |
| 509 | + | // technologies. | |
| 510 | + | // | |
| 511 | + | // Example: | |
| 512 | + | // ```c | |
| 513 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 514 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 515 | + | // | |
| 516 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 517 | + | // -1); | |
| 518 | + | // | |
| 519 | + | // ``` | |
| 520 | + | func (x *BottomSheet) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 521 | + | ||
| 522 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 523 | + | ||
| 524 | + | } | |
| 525 | + | ||
| 526 | + | // Updates an array of accessible properties. | |
| 527 | + | // | |
| 528 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 529 | + | // property change must be communicated to assistive technologies. | |
| 530 | + | // | |
| 531 | + | // This function is meant to be used by language bindings. | |
| 532 | + | func (x *BottomSheet) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 533 | + | ||
| 534 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 535 | + | ||
| 536 | + | } | |
| 537 | + | ||
| 538 | + | // Updates a list of accessible relations. | |
| 539 | + | // | |
| 540 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 541 | + | // relation change must be communicated to assistive technologies. | |
| 542 | + | // | |
| 543 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 544 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 545 | + | // | |
| 546 | + | // ```c | |
| 547 | + | // gtk_accessible_update_relation (accessible, | |
| 548 | + | // | |
| 549 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 550 | + | // ref1, NULL, | |
| 551 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 552 | + | // ref1, ref2, ref3, NULL, | |
| 553 | + | // -1); | |
| 554 | + | // | |
| 555 | + | // ``` | |
| 556 | + | func (x *BottomSheet) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 557 | + | ||
| 558 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 559 | + | ||
| 560 | + | } | |
| 561 | + | ||
| 562 | + | // Updates an array of accessible relations. | |
| 563 | + | // | |
| 564 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 565 | + | // relation change must be communicated to assistive technologies. | |
| 566 | + | // | |
| 567 | + | // This function is meant to be used by language bindings. | |
| 568 | + | func (x *BottomSheet) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 569 | + | ||
| 570 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 571 | + | ||
| 572 | + | } | |
| 573 | + | ||
| 574 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 575 | + | // documentation for the value types of accessible states. | |
| 576 | + | // | |
| 577 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 578 | + | // state change must be communicated to assistive technologies. | |
| 579 | + | // | |
| 580 | + | // Example: | |
| 581 | + | // ```c | |
| 582 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 583 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 584 | + | // | |
| 585 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 586 | + | // -1); | |
| 587 | + | // | |
| 588 | + | // ``` | |
| 589 | + | func (x *BottomSheet) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 590 | + | ||
| 591 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 592 | + | ||
| 593 | + | } | |
| 594 | + | ||
| 595 | + | // Updates an array of accessible states. | |
| 596 | + | // | |
| 597 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 598 | + | // state change must be communicated to assistive technologies. | |
| 599 | + | // | |
| 600 | + | // This function is meant to be used by language bindings. | |
| 601 | + | func (x *BottomSheet) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 602 | + | ||
| 603 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 604 | + | ||
| 605 | + | } | |
| 606 | + | ||
| 607 | + | // Gets the ID of the @buildable object. | |
| 608 | + | // | |
| 609 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 610 | + | // of the <object> tag used to construct the @buildable. | |
| 611 | + | func (x *BottomSheet) GetBuildableId() string { | |
| 612 | + | ||
| 613 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 614 | + | return cret | |
| 615 | + | } | |
| 616 | + | ||
| 617 | + | func init() { | |
| 618 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 619 | + | if err != nil { | |
| 620 | + | panic(err) | |
| 621 | + | } | |
| 622 | + | ||
| 623 | + | core.PuregoSafeRegister(&xBottomSheetGLibType, lib, "adw_bottom_sheet_get_type") | |
| 624 | + | ||
| 625 | + | core.PuregoSafeRegister(&xNewBottomSheet, lib, "adw_bottom_sheet_new") | |
| 626 | + | ||
| 627 | + | core.PuregoSafeRegister(&xBottomSheetGetAlign, lib, "adw_bottom_sheet_get_align") | |
| 628 | + | core.PuregoSafeRegister(&xBottomSheetGetBottomBar, lib, "adw_bottom_sheet_get_bottom_bar") | |
| 629 | + | core.PuregoSafeRegister(&xBottomSheetGetBottomBarHeight, lib, "adw_bottom_sheet_get_bottom_bar_height") | |
| 630 | + | core.PuregoSafeRegister(&xBottomSheetGetCanClose, lib, "adw_bottom_sheet_get_can_close") | |
| 631 | + | core.PuregoSafeRegister(&xBottomSheetGetCanOpen, lib, "adw_bottom_sheet_get_can_open") | |
| 632 | + | core.PuregoSafeRegister(&xBottomSheetGetContent, lib, "adw_bottom_sheet_get_content") | |
| 633 | + | core.PuregoSafeRegister(&xBottomSheetGetFullWidth, lib, "adw_bottom_sheet_get_full_width") | |
| 634 | + | core.PuregoSafeRegister(&xBottomSheetGetModal, lib, "adw_bottom_sheet_get_modal") | |
| 635 | + | core.PuregoSafeRegister(&xBottomSheetGetOpen, lib, "adw_bottom_sheet_get_open") | |
| 636 | + | core.PuregoSafeRegister(&xBottomSheetGetSheet, lib, "adw_bottom_sheet_get_sheet") | |
| 637 | + | core.PuregoSafeRegister(&xBottomSheetGetSheetHeight, lib, "adw_bottom_sheet_get_sheet_height") | |
| 638 | + | core.PuregoSafeRegister(&xBottomSheetGetShowDragHandle, lib, "adw_bottom_sheet_get_show_drag_handle") | |
| 639 | + | core.PuregoSafeRegister(&xBottomSheetSetAlign, lib, "adw_bottom_sheet_set_align") | |
| 640 | + | core.PuregoSafeRegister(&xBottomSheetSetBottomBar, lib, "adw_bottom_sheet_set_bottom_bar") | |
| 641 | + | core.PuregoSafeRegister(&xBottomSheetSetCanClose, lib, "adw_bottom_sheet_set_can_close") | |
| 642 | + | core.PuregoSafeRegister(&xBottomSheetSetCanOpen, lib, "adw_bottom_sheet_set_can_open") | |
| 643 | + | core.PuregoSafeRegister(&xBottomSheetSetContent, lib, "adw_bottom_sheet_set_content") | |
| 644 | + | core.PuregoSafeRegister(&xBottomSheetSetFullWidth, lib, "adw_bottom_sheet_set_full_width") | |
| 645 | + | core.PuregoSafeRegister(&xBottomSheetSetModal, lib, "adw_bottom_sheet_set_modal") | |
| 646 | + | core.PuregoSafeRegister(&xBottomSheetSetOpen, lib, "adw_bottom_sheet_set_open") | |
| 647 | + | core.PuregoSafeRegister(&xBottomSheetSetSheet, lib, "adw_bottom_sheet_set_sheet") | |
| 648 | + | core.PuregoSafeRegister(&xBottomSheetSetShowDragHandle, lib, "adw_bottom_sheet_set_show_drag_handle") | |
| 649 | + | ||
| 650 | + | } | |
A v4/adw/adw-breakpoint-bin.go +405 -0
| @@ -0,0 +1,405 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 13 | + | ) | |
| 14 | + | ||
| 15 | + | type BreakpointBinClass struct { | |
| 16 | + | _ structs.HostLayout | |
| 17 | + | ||
| 18 | + | ParentClass uintptr | |
| 19 | + | ||
| 20 | + | Padding [4]uintptr | |
| 21 | + | } | |
| 22 | + | ||
| 23 | + | func (x *BreakpointBinClass) GoPointer() uintptr { | |
| 24 | + | return uintptr(unsafe.Pointer(x)) | |
| 25 | + | } | |
| 26 | + | ||
| 27 | + | // A widget that changes layout based on available size. | |
| 28 | + | // | |
| 29 | + | // <picture> | |
| 30 | + | // | |
| 31 | + | // <source srcset="breakpoint-bin-dark.png" media="(prefers-color-scheme: dark)"> | |
| 32 | + | // <img src="breakpoint-bin.png" alt="breakpoint-bin"> | |
| 33 | + | // | |
| 34 | + | // </picture> | |
| 35 | + | // | |
| 36 | + | // `AdwBreakpointBin` provides a way to use breakpoints without [class@Window], | |
| 37 | + | // [class@ApplicationWindow] or [class@Dialog]. It can be useful for limiting | |
| 38 | + | // breakpoints to a single page and similar purposes. Most applications | |
| 39 | + | // shouldn't need it. | |
| 40 | + | // | |
| 41 | + | // `AdwBreakpointBin` is similar to [class@Bin]. It has one child, set via the | |
| 42 | + | // [property@BreakpointBin:child] property. | |
| 43 | + | // | |
| 44 | + | // When `AdwBreakpointBin` is resized, its child widget can rearrange its layout | |
| 45 | + | // at specific thresholds. | |
| 46 | + | // | |
| 47 | + | // The thresholds and layout changes are defined via [class@Breakpoint] objects. | |
| 48 | + | // They can be added using [method@BreakpointBin.add_breakpoint]. | |
| 49 | + | // | |
| 50 | + | // Each breakpoint has a condition, specifying the bin's size and/or aspect | |
| 51 | + | // ratio, and setters that automatically set object properties when that | |
| 52 | + | // happens. The [signal@Breakpoint::apply] and [signal@Breakpoint::unapply] can | |
| 53 | + | // be used instead for more complex scenarios. | |
| 54 | + | // | |
| 55 | + | // Breakpoints are only allowed to modify widgets inside the `AdwBreakpointBin`, | |
| 56 | + | // but not on the `AdwBreakpointBin` itself or any other widgets. | |
| 57 | + | // | |
| 58 | + | // If multiple breakpoints can be used for the current size, the last one is | |
| 59 | + | // always picked. The current breakpoint can be tracked using the | |
| 60 | + | // [property@BreakpointBin:current-breakpoint] property. | |
| 61 | + | // | |
| 62 | + | // If none of the breakpoints can be used, that property will be set to `NULL`, | |
| 63 | + | // and the original property values will be used instead. | |
| 64 | + | // | |
| 65 | + | // ## Minimum Size | |
| 66 | + | // | |
| 67 | + | // Adding a breakpoint to `AdwBreakpointBin` will result in it having no minimum | |
| 68 | + | // size. The [property@Gtk.Widget:width-request] and | |
| 69 | + | // [property@Gtk.Widget:height-request] properties must always be set when using | |
| 70 | + | // breakpoints, indicating the smallest size you want to support. | |
| 71 | + | // | |
| 72 | + | // The minimum size and breakpoint conditions must be carefully selected so that | |
| 73 | + | // the child widget completely fits. If it doesn't, it will overflow and a | |
| 74 | + | // warning message will be printed. | |
| 75 | + | // | |
| 76 | + | // When choosing minimum size, consider translations and text scale factor | |
| 77 | + | // changes. Make sure to leave enough space for text labels, and enable | |
| 78 | + | // ellipsizing or wrapping if they might not fit. | |
| 79 | + | // | |
| 80 | + | // For [class@Gtk.Label] this can be done via [property@Gtk.Label:ellipsize], or | |
| 81 | + | // via [property@Gtk.Label:wrap] together with [property@Gtk.Label:wrap-mode]. | |
| 82 | + | // | |
| 83 | + | // For buttons, use [property@Gtk.Button:can-shrink], | |
| 84 | + | // [property@Gtk.MenuButton:can-shrink], [property@Adw.SplitButton:can-shrink], | |
| 85 | + | // or [property@Adw.ButtonContent:can-shrink]. | |
| 86 | + | // | |
| 87 | + | // ## Example | |
| 88 | + | // | |
| 89 | + | // ```c | |
| 90 | + | // GtkWidget *bin, *child; | |
| 91 | + | // AdwBreakpoint *breakpoint; | |
| 92 | + | // | |
| 93 | + | // bin = adw_breakpoint_bin_new (); | |
| 94 | + | // gtk_widget_set_size_request (bin, 150, 150); | |
| 95 | + | // | |
| 96 | + | // child = gtk_label_new ("Wide"); | |
| 97 | + | // gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END); | |
| 98 | + | // gtk_widget_add_css_class (child, "title-1"); | |
| 99 | + | // adw_breakpoint_bin_set_child (ADW_BREAKPOINT_BIN (bin), child); | |
| 100 | + | // | |
| 101 | + | // breakpoint = adw_breakpoint_new (adw_breakpoint_condition_parse ("max-width: 200px")); | |
| 102 | + | // adw_breakpoint_add_setters (breakpoint, | |
| 103 | + | // | |
| 104 | + | // G_OBJECT (child), "label", "Narrow", | |
| 105 | + | // NULL); | |
| 106 | + | // | |
| 107 | + | // adw_breakpoint_bin_add_breakpoint (ADW_BREAKPOINT_BIN (bin), breakpoint); | |
| 108 | + | // ``` | |
| 109 | + | // | |
| 110 | + | // The bin has a single label inside it, displaying "Wide". When the bin's width | |
| 111 | + | // is smaller than or equal to 200px, it changes to "Narrow". | |
| 112 | + | // | |
| 113 | + | // ## `AdwBreakpointBin` as `GtkBuildable` | |
| 114 | + | // | |
| 115 | + | // `AdwBreakpointBin` allows adding `AdwBreakpoint` objects as children. | |
| 116 | + | // | |
| 117 | + | // Example of an `AdwBreakpointBin` UI definition: | |
| 118 | + | // | |
| 119 | + | // ```xml | |
| 120 | + | // <object class="AdwBreakpointBin"> | |
| 121 | + | // | |
| 122 | + | // <property name="width-request">150</property> | |
| 123 | + | // <property name="height-request">150</property> | |
| 124 | + | // <property name="child"> | |
| 125 | + | // <object class="GtkLabel" id="child"> | |
| 126 | + | // <property name="label">Wide</property> | |
| 127 | + | // <property name="ellipsize">end</property> | |
| 128 | + | // <style> | |
| 129 | + | // <class name="title-1"/> | |
| 130 | + | // </style> | |
| 131 | + | // </object> | |
| 132 | + | // </property> | |
| 133 | + | // <child> | |
| 134 | + | // <object class="AdwBreakpoint"> | |
| 135 | + | // <condition>max-width: 200px</condition> | |
| 136 | + | // <setter object="child" property="label">Narrow</setter> | |
| 137 | + | // </object> | |
| 138 | + | // </child> | |
| 139 | + | // | |
| 140 | + | // </object> | |
| 141 | + | // ``` | |
| 142 | + | // | |
| 143 | + | // See [class@Breakpoint] documentation for details. | |
| 144 | + | type BreakpointBin struct { | |
| 145 | + | gtk.Widget | |
| 146 | + | } | |
| 147 | + | ||
| 148 | + | var xBreakpointBinGLibType func() types.GType | |
| 149 | + | ||
| 150 | + | func BreakpointBinGLibType() types.GType { | |
| 151 | + | return xBreakpointBinGLibType() | |
| 152 | + | } | |
| 153 | + | ||
| 154 | + | func BreakpointBinNewFromInternalPtr(ptr uintptr) *BreakpointBin { | |
| 155 | + | cls := &BreakpointBin{} | |
| 156 | + | cls.Ptr = ptr | |
| 157 | + | return cls | |
| 158 | + | } | |
| 159 | + | ||
| 160 | + | var xNewBreakpointBin func() uintptr | |
| 161 | + | ||
| 162 | + | // Creates a new `AdwBreakpointBin`. | |
| 163 | + | func NewBreakpointBin() *BreakpointBin { | |
| 164 | + | var cls *BreakpointBin | |
| 165 | + | ||
| 166 | + | cret := xNewBreakpointBin() | |
| 167 | + | ||
| 168 | + | if cret == 0 { | |
| 169 | + | return nil | |
| 170 | + | } | |
| 171 | + | gobject.IncreaseRef(cret) | |
| 172 | + | cls = &BreakpointBin{} | |
| 173 | + | cls.Ptr = cret | |
| 174 | + | return cls | |
| 175 | + | } | |
| 176 | + | ||
| 177 | + | var xBreakpointBinAddBreakpoint func(uintptr, uintptr) | |
| 178 | + | ||
| 179 | + | // Adds @breakpoint to @self. | |
| 180 | + | func (x *BreakpointBin) AddBreakpoint(BreakpointVar *Breakpoint) { | |
| 181 | + | ||
| 182 | + | xBreakpointBinAddBreakpoint(x.GoPointer(), BreakpointVar.GoPointer()) | |
| 183 | + | ||
| 184 | + | } | |
| 185 | + | ||
| 186 | + | var xBreakpointBinGetChild func(uintptr) uintptr | |
| 187 | + | ||
| 188 | + | // Gets the child widget of @self. | |
| 189 | + | func (x *BreakpointBin) GetChild() *gtk.Widget { | |
| 190 | + | var cls *gtk.Widget | |
| 191 | + | ||
| 192 | + | cret := xBreakpointBinGetChild(x.GoPointer()) | |
| 193 | + | ||
| 194 | + | if cret == 0 { | |
| 195 | + | return nil | |
| 196 | + | } | |
| 197 | + | gobject.IncreaseRef(cret) | |
| 198 | + | cls = >k.Widget{} | |
| 199 | + | cls.Ptr = cret | |
| 200 | + | return cls | |
| 201 | + | } | |
| 202 | + | ||
| 203 | + | var xBreakpointBinGetCurrentBreakpoint func(uintptr) uintptr | |
| 204 | + | ||
| 205 | + | // Gets the current breakpoint. | |
| 206 | + | func (x *BreakpointBin) GetCurrentBreakpoint() *Breakpoint { | |
| 207 | + | var cls *Breakpoint | |
| 208 | + | ||
| 209 | + | cret := xBreakpointBinGetCurrentBreakpoint(x.GoPointer()) | |
| 210 | + | ||
| 211 | + | if cret == 0 { | |
| 212 | + | return nil | |
| 213 | + | } | |
| 214 | + | gobject.IncreaseRef(cret) | |
| 215 | + | cls = &Breakpoint{} | |
| 216 | + | cls.Ptr = cret | |
| 217 | + | return cls | |
| 218 | + | } | |
| 219 | + | ||
| 220 | + | var xBreakpointBinRemoveBreakpoint func(uintptr, uintptr) | |
| 221 | + | ||
| 222 | + | // Removes @breakpoint from @self. | |
| 223 | + | func (x *BreakpointBin) RemoveBreakpoint(BreakpointVar *Breakpoint) { | |
| 224 | + | ||
| 225 | + | xBreakpointBinRemoveBreakpoint(x.GoPointer(), BreakpointVar.GoPointer()) | |
| 226 | + | ||
| 227 | + | } | |
| 228 | + | ||
| 229 | + | var xBreakpointBinSetChild func(uintptr, uintptr) | |
| 230 | + | ||
| 231 | + | // Sets the child widget of @self. | |
| 232 | + | func (x *BreakpointBin) SetChild(ChildVar *gtk.Widget) { | |
| 233 | + | ||
| 234 | + | xBreakpointBinSetChild(x.GoPointer(), ChildVar.GoPointer()) | |
| 235 | + | ||
| 236 | + | } | |
| 237 | + | ||
| 238 | + | func (c *BreakpointBin) GoPointer() uintptr { | |
| 239 | + | return c.Ptr | |
| 240 | + | } | |
| 241 | + | ||
| 242 | + | func (c *BreakpointBin) SetGoPointer(ptr uintptr) { | |
| 243 | + | c.Ptr = ptr | |
| 244 | + | } | |
| 245 | + | ||
| 246 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 247 | + | func (x *BreakpointBin) GetAccessibleRole() gtk.AccessibleRole { | |
| 248 | + | ||
| 249 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 250 | + | return cret | |
| 251 | + | } | |
| 252 | + | ||
| 253 | + | // Resets the accessible @property to its default value. | |
| 254 | + | func (x *BreakpointBin) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 255 | + | ||
| 256 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 257 | + | ||
| 258 | + | } | |
| 259 | + | ||
| 260 | + | // Resets the accessible @relation to its default value. | |
| 261 | + | func (x *BreakpointBin) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 262 | + | ||
| 263 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 264 | + | ||
| 265 | + | } | |
| 266 | + | ||
| 267 | + | // Resets the accessible @state to its default value. | |
| 268 | + | func (x *BreakpointBin) ResetState(StateVar gtk.AccessibleState) { | |
| 269 | + | ||
| 270 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 271 | + | ||
| 272 | + | } | |
| 273 | + | ||
| 274 | + | // Updates a list of accessible properties. | |
| 275 | + | // | |
| 276 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 277 | + | // value types of accessible properties. | |
| 278 | + | // | |
| 279 | + | // This function should be called by `GtkWidget` types whenever | |
| 280 | + | // an accessible property change must be communicated to assistive | |
| 281 | + | // technologies. | |
| 282 | + | // | |
| 283 | + | // Example: | |
| 284 | + | // ```c | |
| 285 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 286 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 287 | + | // | |
| 288 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 289 | + | // -1); | |
| 290 | + | // | |
| 291 | + | // ``` | |
| 292 | + | func (x *BreakpointBin) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 293 | + | ||
| 294 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 295 | + | ||
| 296 | + | } | |
| 297 | + | ||
| 298 | + | // Updates an array of accessible properties. | |
| 299 | + | // | |
| 300 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 301 | + | // property change must be communicated to assistive technologies. | |
| 302 | + | // | |
| 303 | + | // This function is meant to be used by language bindings. | |
| 304 | + | func (x *BreakpointBin) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 305 | + | ||
| 306 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 307 | + | ||
| 308 | + | } | |
| 309 | + | ||
| 310 | + | // Updates a list of accessible relations. | |
| 311 | + | // | |
| 312 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 313 | + | // relation change must be communicated to assistive technologies. | |
| 314 | + | // | |
| 315 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 316 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 317 | + | // | |
| 318 | + | // ```c | |
| 319 | + | // gtk_accessible_update_relation (accessible, | |
| 320 | + | // | |
| 321 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 322 | + | // ref1, NULL, | |
| 323 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 324 | + | // ref1, ref2, ref3, NULL, | |
| 325 | + | // -1); | |
| 326 | + | // | |
| 327 | + | // ``` | |
| 328 | + | func (x *BreakpointBin) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 329 | + | ||
| 330 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 331 | + | ||
| 332 | + | } | |
| 333 | + | ||
| 334 | + | // Updates an array of accessible relations. | |
| 335 | + | // | |
| 336 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 337 | + | // relation change must be communicated to assistive technologies. | |
| 338 | + | // | |
| 339 | + | // This function is meant to be used by language bindings. | |
| 340 | + | func (x *BreakpointBin) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 341 | + | ||
| 342 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 343 | + | ||
| 344 | + | } | |
| 345 | + | ||
| 346 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 347 | + | // documentation for the value types of accessible states. | |
| 348 | + | // | |
| 349 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 350 | + | // state change must be communicated to assistive technologies. | |
| 351 | + | // | |
| 352 | + | // Example: | |
| 353 | + | // ```c | |
| 354 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 355 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 356 | + | // | |
| 357 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 358 | + | // -1); | |
| 359 | + | // | |
| 360 | + | // ``` | |
| 361 | + | func (x *BreakpointBin) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 362 | + | ||
| 363 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 364 | + | ||
| 365 | + | } | |
| 366 | + | ||
| 367 | + | // Updates an array of accessible states. | |
| 368 | + | // | |
| 369 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 370 | + | // state change must be communicated to assistive technologies. | |
| 371 | + | // | |
| 372 | + | // This function is meant to be used by language bindings. | |
| 373 | + | func (x *BreakpointBin) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 374 | + | ||
| 375 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 376 | + | ||
| 377 | + | } | |
| 378 | + | ||
| 379 | + | // Gets the ID of the @buildable object. | |
| 380 | + | // | |
| 381 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 382 | + | // of the <object> tag used to construct the @buildable. | |
| 383 | + | func (x *BreakpointBin) GetBuildableId() string { | |
| 384 | + | ||
| 385 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 386 | + | return cret | |
| 387 | + | } | |
| 388 | + | ||
| 389 | + | func init() { | |
| 390 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 391 | + | if err != nil { | |
| 392 | + | panic(err) | |
| 393 | + | } | |
| 394 | + | ||
| 395 | + | core.PuregoSafeRegister(&xBreakpointBinGLibType, lib, "adw_breakpoint_bin_get_type") | |
| 396 | + | ||
| 397 | + | core.PuregoSafeRegister(&xNewBreakpointBin, lib, "adw_breakpoint_bin_new") | |
| 398 | + | ||
| 399 | + | core.PuregoSafeRegister(&xBreakpointBinAddBreakpoint, lib, "adw_breakpoint_bin_add_breakpoint") | |
| 400 | + | core.PuregoSafeRegister(&xBreakpointBinGetChild, lib, "adw_breakpoint_bin_get_child") | |
| 401 | + | core.PuregoSafeRegister(&xBreakpointBinGetCurrentBreakpoint, lib, "adw_breakpoint_bin_get_current_breakpoint") | |
| 402 | + | core.PuregoSafeRegister(&xBreakpointBinRemoveBreakpoint, lib, "adw_breakpoint_bin_remove_breakpoint") | |
| 403 | + | core.PuregoSafeRegister(&xBreakpointBinSetChild, lib, "adw_breakpoint_bin_set_child") | |
| 404 | + | ||
| 405 | + | } | |
A v4/adw/adw-breakpoint.go +519 -0
| @@ -0,0 +1,519 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 13 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 14 | + | ) | |
| 15 | + | ||
| 16 | + | type BreakpointClass struct { | |
| 17 | + | _ structs.HostLayout | |
| 18 | + | ||
| 19 | + | ParentClass uintptr | |
| 20 | + | } | |
| 21 | + | ||
| 22 | + | func (x *BreakpointClass) GoPointer() uintptr { | |
| 23 | + | return uintptr(unsafe.Pointer(x)) | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | // Describes condition for an [class@Breakpoint]. | |
| 27 | + | type BreakpointCondition struct { | |
| 28 | + | _ structs.HostLayout | |
| 29 | + | } | |
| 30 | + | ||
| 31 | + | var xBreakpointConditionGLibType func() types.GType | |
| 32 | + | ||
| 33 | + | func BreakpointConditionGLibType() types.GType { | |
| 34 | + | return xBreakpointConditionGLibType() | |
| 35 | + | } | |
| 36 | + | ||
| 37 | + | func (x *BreakpointCondition) GoPointer() uintptr { | |
| 38 | + | return uintptr(unsafe.Pointer(x)) | |
| 39 | + | } | |
| 40 | + | ||
| 41 | + | var xNewBreakpointConditionAnd func(*BreakpointCondition, *BreakpointCondition) *BreakpointCondition | |
| 42 | + | ||
| 43 | + | // Creates a condition that triggers when @condition_1 and @condition_2 are both | |
| 44 | + | // true. | |
| 45 | + | func NewBreakpointConditionAnd(Condition1Var *BreakpointCondition, Condition2Var *BreakpointCondition) *BreakpointCondition { | |
| 46 | + | ||
| 47 | + | cret := xNewBreakpointConditionAnd(Condition1Var, Condition2Var) | |
| 48 | + | return cret | |
| 49 | + | } | |
| 50 | + | ||
| 51 | + | var xNewBreakpointConditionLength func(BreakpointConditionLengthType, float64, LengthUnit) *BreakpointCondition | |
| 52 | + | ||
| 53 | + | // Creates a condition that triggers on length changes. | |
| 54 | + | func NewBreakpointConditionLength(TypeVar BreakpointConditionLengthType, ValueVar float64, UnitVar LengthUnit) *BreakpointCondition { | |
| 55 | + | ||
| 56 | + | cret := xNewBreakpointConditionLength(TypeVar, ValueVar, UnitVar) | |
| 57 | + | return cret | |
| 58 | + | } | |
| 59 | + | ||
| 60 | + | var xNewBreakpointConditionOr func(*BreakpointCondition, *BreakpointCondition) *BreakpointCondition | |
| 61 | + | ||
| 62 | + | // Creates a condition that triggers when either @condition_1 or @condition_2 is | |
| 63 | + | // true. | |
| 64 | + | func NewBreakpointConditionOr(Condition1Var *BreakpointCondition, Condition2Var *BreakpointCondition) *BreakpointCondition { | |
| 65 | + | ||
| 66 | + | cret := xNewBreakpointConditionOr(Condition1Var, Condition2Var) | |
| 67 | + | return cret | |
| 68 | + | } | |
| 69 | + | ||
| 70 | + | var xNewBreakpointConditionRatio func(BreakpointConditionRatioType, int, int) *BreakpointCondition | |
| 71 | + | ||
| 72 | + | // Creates a condition that triggers on ratio changes. | |
| 73 | + | // | |
| 74 | + | // The ratio is represented as @width divided by @height. | |
| 75 | + | func NewBreakpointConditionRatio(TypeVar BreakpointConditionRatioType, WidthVar int, HeightVar int) *BreakpointCondition { | |
| 76 | + | ||
| 77 | + | cret := xNewBreakpointConditionRatio(TypeVar, WidthVar, HeightVar) | |
| 78 | + | return cret | |
| 79 | + | } | |
| 80 | + | ||
| 81 | + | var xBreakpointConditionCopy func(uintptr) *BreakpointCondition | |
| 82 | + | ||
| 83 | + | // Copies @self. | |
| 84 | + | func (x *BreakpointCondition) Copy() *BreakpointCondition { | |
| 85 | + | ||
| 86 | + | cret := xBreakpointConditionCopy(x.GoPointer()) | |
| 87 | + | return cret | |
| 88 | + | } | |
| 89 | + | ||
| 90 | + | var xBreakpointConditionFree func(uintptr) | |
| 91 | + | ||
| 92 | + | // Frees @self. | |
| 93 | + | func (x *BreakpointCondition) Free() { | |
| 94 | + | ||
| 95 | + | xBreakpointConditionFree(x.GoPointer()) | |
| 96 | + | ||
| 97 | + | } | |
| 98 | + | ||
| 99 | + | var xBreakpointConditionToString func(uintptr) string | |
| 100 | + | ||
| 101 | + | // Returns a textual representation of @self. | |
| 102 | + | // | |
| 103 | + | // The returned string can be parsed by [func@BreakpointCondition.parse]. | |
| 104 | + | func (x *BreakpointCondition) ToString() string { | |
| 105 | + | ||
| 106 | + | cret := xBreakpointConditionToString(x.GoPointer()) | |
| 107 | + | return cret | |
| 108 | + | } | |
| 109 | + | ||
| 110 | + | // Describes length types for [struct@BreakpointCondition]. | |
| 111 | + | // | |
| 112 | + | // See [ctor@BreakpointCondition.new_length]. | |
| 113 | + | // | |
| 114 | + | // New values may be added to this enumeration over time. | |
| 115 | + | type BreakpointConditionLengthType int | |
| 116 | + | ||
| 117 | + | var xBreakpointConditionLengthTypeGLibType func() types.GType | |
| 118 | + | ||
| 119 | + | func BreakpointConditionLengthTypeGLibType() types.GType { | |
| 120 | + | return xBreakpointConditionLengthTypeGLibType() | |
| 121 | + | } | |
| 122 | + | ||
| 123 | + | const ( | |
| 124 | + | ||
| 125 | + | // true if the width is greater than or | |
| 126 | + | // equal to the condition value | |
| 127 | + | BreakpointConditionMinWidthValue BreakpointConditionLengthType = 0 | |
| 128 | + | // true if the width is less than or | |
| 129 | + | // equal to the condition value | |
| 130 | + | BreakpointConditionMaxWidthValue BreakpointConditionLengthType = 1 | |
| 131 | + | // true if the height is greater than or | |
| 132 | + | // equal to the condition value | |
| 133 | + | BreakpointConditionMinHeightValue BreakpointConditionLengthType = 2 | |
| 134 | + | // true if the height is less than or | |
| 135 | + | // equal to the condition value | |
| 136 | + | BreakpointConditionMaxHeightValue BreakpointConditionLengthType = 3 | |
| 137 | + | ) | |
| 138 | + | ||
| 139 | + | // Describes ratio types for [struct@BreakpointCondition]. | |
| 140 | + | // | |
| 141 | + | // See [ctor@BreakpointCondition.new_ratio]. | |
| 142 | + | // | |
| 143 | + | // New values may be added to this enumeration over time. | |
| 144 | + | type BreakpointConditionRatioType int | |
| 145 | + | ||
| 146 | + | var xBreakpointConditionRatioTypeGLibType func() types.GType | |
| 147 | + | ||
| 148 | + | func BreakpointConditionRatioTypeGLibType() types.GType { | |
| 149 | + | return xBreakpointConditionRatioTypeGLibType() | |
| 150 | + | } | |
| 151 | + | ||
| 152 | + | const ( | |
| 153 | + | ||
| 154 | + | // true if the aspect ratio is | |
| 155 | + | // greater than or equal to the condition value | |
| 156 | + | BreakpointConditionMinAspectRatioValue BreakpointConditionRatioType = 0 | |
| 157 | + | // true if the aspect ratio is | |
| 158 | + | // less than or equal to the condition value | |
| 159 | + | BreakpointConditionMaxAspectRatioValue BreakpointConditionRatioType = 1 | |
| 160 | + | ) | |
| 161 | + | ||
| 162 | + | var xBreakpointConditionParse func(string) *BreakpointCondition | |
| 163 | + | ||
| 164 | + | // Parses a condition from a string. | |
| 165 | + | // | |
| 166 | + | // Length conditions are specified as `<type>: <value>[<unit>]`, where: | |
| 167 | + | // | |
| 168 | + | // - `<type>` can be `min-width`, `max-width`, `min-height` or `max-height` | |
| 169 | + | // - `<value>` is a fractional number | |
| 170 | + | // - `<unit>` can be `px`, `pt` or `sp` | |
| 171 | + | // | |
| 172 | + | // If the unit is omitted, `px` is assumed. | |
| 173 | + | // | |
| 174 | + | // See [ctor@BreakpointCondition.new_length]. | |
| 175 | + | // | |
| 176 | + | // Examples: | |
| 177 | + | // | |
| 178 | + | // - `min-width: 500px` | |
| 179 | + | // - `min-height: 400pt` | |
| 180 | + | // - `max-width: 100sp` | |
| 181 | + | // - `max-height: 500` | |
| 182 | + | // | |
| 183 | + | // Ratio conditions are specified as `<type>: <width>[/<height>]`, where: | |
| 184 | + | // | |
| 185 | + | // - `<type>` can be `min-aspect-ratio` or `max-aspect-ratio` | |
| 186 | + | // - `<width>` and `<height>` are integer numbers | |
| 187 | + | // | |
| 188 | + | // See [ctor@BreakpointCondition.new_ratio]. | |
| 189 | + | // | |
| 190 | + | // The ratio is represented as `<width>` divided by `<height>`. | |
| 191 | + | // | |
| 192 | + | // If `<height>` is omitted, it's assumed to be 1. | |
| 193 | + | // | |
| 194 | + | // Examples: | |
| 195 | + | // | |
| 196 | + | // - `min-aspect-ratio: 4/3` | |
| 197 | + | // - `max-aspect-ratio: 1` | |
| 198 | + | // | |
| 199 | + | // The logical operators `and`, `or` can be used to compose a complex condition | |
| 200 | + | // as follows: | |
| 201 | + | // | |
| 202 | + | // - `<condition> and <condition>`: the condition is true when both | |
| 203 | + | // `<condition>`s are true, same as when using | |
| 204 | + | // [ctor@BreakpointCondition.new_and] | |
| 205 | + | // - `<condition> or <condition>`: the condition is true when either of the | |
| 206 | + | // `<condition>`s is true, same as when using | |
| 207 | + | // [ctor@BreakpointCondition.new_or] | |
| 208 | + | // | |
| 209 | + | // Examples: | |
| 210 | + | // | |
| 211 | + | // - `min-width: 400px and max-aspect-ratio: 4/3` | |
| 212 | + | // - `max-width: 360sp or max-width: 360px` | |
| 213 | + | // | |
| 214 | + | // Conditions can be further nested using parentheses, for example: | |
| 215 | + | // | |
| 216 | + | // - `min-width: 400px and (max-aspect-ratio: 4/3 or max-height: 400px)` | |
| 217 | + | // | |
| 218 | + | // If parentheses are omitted, the first operator takes priority. | |
| 219 | + | func BreakpointConditionParse(StrVar string) *BreakpointCondition { | |
| 220 | + | ||
| 221 | + | cret := xBreakpointConditionParse(StrVar) | |
| 222 | + | return cret | |
| 223 | + | } | |
| 224 | + | ||
| 225 | + | // Describes a breakpoint for [class@Window] or [class@Dialog]. | |
| 226 | + | // | |
| 227 | + | // Breakpoints are used to create adaptive UI, allowing to change the layout | |
| 228 | + | // depending on available size. | |
| 229 | + | // | |
| 230 | + | // Breakpoint is a size threshold, specified by its condition, as well as one or | |
| 231 | + | // more setters. | |
| 232 | + | // | |
| 233 | + | // Each setter has a target object, a property and a value. When a breakpoint | |
| 234 | + | // is applied, each setter sets the target property on their target object to | |
| 235 | + | // the specified value, and reset it back to the original value when it's | |
| 236 | + | // unapplied. | |
| 237 | + | // | |
| 238 | + | // For more complicated scenarios, [signal@Breakpoint::apply] and | |
| 239 | + | // [signal@Breakpoint::unapply] can be used instead. | |
| 240 | + | // | |
| 241 | + | // Breakpoints can be used within [class@Window], [class@ApplicationWindow], | |
| 242 | + | // [class@Dialog] or [class@BreakpointBin]. | |
| 243 | + | // | |
| 244 | + | // ## `AdwBreakpoint` as `GtkBuildable`: | |
| 245 | + | // | |
| 246 | + | // `AdwBreakpoint` supports specifying its condition via the `<condition>` | |
| 247 | + | // element. The contents of the element must be a string in a format accepted by | |
| 248 | + | // [func@BreakpointCondition.parse]. | |
| 249 | + | // | |
| 250 | + | // It also supports adding setters via the `<setter>` element. Each `<setter>` | |
| 251 | + | // element must have the `object` attribute specifying the target object, and | |
| 252 | + | // the `property` attribute specifying the property name. The contents of the | |
| 253 | + | // element are used as the setter value. | |
| 254 | + | // | |
| 255 | + | // For `G_TYPE_OBJECT` and `G_TYPE_BOXED` derived properties, empty contents are | |
| 256 | + | // treated as `NULL`. | |
| 257 | + | // | |
| 258 | + | // Setter values can be translated with the usual `translatable`, `context` and | |
| 259 | + | // `comments` attributes. | |
| 260 | + | // | |
| 261 | + | // Example of an `AdwBreakpoint` UI definition: | |
| 262 | + | // | |
| 263 | + | // ```xml | |
| 264 | + | // <object class="AdwBreakpoint"> | |
| 265 | + | // | |
| 266 | + | // <condition>max-width: 400px</condition> | |
| 267 | + | // <setter object="button" property="visible">True</setter> | |
| 268 | + | // <setter object="box" property="orientation">vertical</setter> | |
| 269 | + | // <setter object="page" property="title" translatable="yes">Example</setter> | |
| 270 | + | // | |
| 271 | + | // </object> | |
| 272 | + | // ``` | |
| 273 | + | type Breakpoint struct { | |
| 274 | + | gobject.Object | |
| 275 | + | } | |
| 276 | + | ||
| 277 | + | var xBreakpointGLibType func() types.GType | |
| 278 | + | ||
| 279 | + | func BreakpointGLibType() types.GType { | |
| 280 | + | return xBreakpointGLibType() | |
| 281 | + | } | |
| 282 | + | ||
| 283 | + | func BreakpointNewFromInternalPtr(ptr uintptr) *Breakpoint { | |
| 284 | + | cls := &Breakpoint{} | |
| 285 | + | cls.Ptr = ptr | |
| 286 | + | return cls | |
| 287 | + | } | |
| 288 | + | ||
| 289 | + | var xNewBreakpoint func(*BreakpointCondition) uintptr | |
| 290 | + | ||
| 291 | + | // Creates a new `AdwBreakpoint` with @condition. | |
| 292 | + | func NewBreakpoint(ConditionVar *BreakpointCondition) *Breakpoint { | |
| 293 | + | var cls *Breakpoint | |
| 294 | + | ||
| 295 | + | cret := xNewBreakpoint(ConditionVar) | |
| 296 | + | ||
| 297 | + | if cret == 0 { | |
| 298 | + | return nil | |
| 299 | + | } | |
| 300 | + | cls = &Breakpoint{} | |
| 301 | + | cls.Ptr = cret | |
| 302 | + | return cls | |
| 303 | + | } | |
| 304 | + | ||
| 305 | + | var xBreakpointAddSetter func(uintptr, uintptr, string, *gobject.Value) | |
| 306 | + | ||
| 307 | + | // Adds a setter to @self. | |
| 308 | + | // | |
| 309 | + | // The setter will automatically set @property on @object to @value when | |
| 310 | + | // applying the breakpoint, and set it back to its original value upon | |
| 311 | + | // unapplying it. | |
| 312 | + | // | |
| 313 | + | // ::: note | |
| 314 | + | // | |
| 315 | + | // Setting properties to their original values does not work for properties | |
| 316 | + | // that have irreversible side effects. For example, changing | |
| 317 | + | // [property@Gtk.Button:label] while [property@Gtk.Button:icon-name] is set | |
| 318 | + | // will reset the icon. However, resetting the label will not set | |
| 319 | + | // `icon-name` to its original value. | |
| 320 | + | // | |
| 321 | + | // Use the [signal@Breakpoint::apply] and [signal@Breakpoint::unapply] signals | |
| 322 | + | // for those properties instead, as follows: | |
| 323 | + | // | |
| 324 | + | // ```c | |
| 325 | + | // static void | |
| 326 | + | // breakpoint_apply_cb (MyWidget *self) | |
| 327 | + | // | |
| 328 | + | // { | |
| 329 | + | // gtk_button_set_icon_name (self->button, "go-previous-symbolic"); | |
| 330 | + | // } | |
| 331 | + | // | |
| 332 | + | // static void | |
| 333 | + | // breakpoint_apply_cb (MyWidget *self) | |
| 334 | + | // | |
| 335 | + | // { | |
| 336 | + | // gtk_button_set_label (self->button, _("_Back")); | |
| 337 | + | // } | |
| 338 | + | // | |
| 339 | + | // // ... | |
| 340 | + | // | |
| 341 | + | // g_signal_connect_swapped (breakpoint, "apply", | |
| 342 | + | // | |
| 343 | + | // G_CALLBACK (breakpoint_apply_cb), self); | |
| 344 | + | // | |
| 345 | + | // g_signal_connect_swapped (breakpoint, "unapply", | |
| 346 | + | // | |
| 347 | + | // G_CALLBACK (breakpoint_unapply_cb), self); | |
| 348 | + | // | |
| 349 | + | // ``` | |
| 350 | + | func (x *Breakpoint) AddSetter(ObjectVar *gobject.Object, PropertyVar string, ValueVar *gobject.Value) { | |
| 351 | + | ||
| 352 | + | xBreakpointAddSetter(x.GoPointer(), ObjectVar.GoPointer(), PropertyVar, ValueVar) | |
| 353 | + | ||
| 354 | + | } | |
| 355 | + | ||
| 356 | + | var xBreakpointAddSetters func(uintptr, uintptr, string, ...interface{}) | |
| 357 | + | ||
| 358 | + | // Adds multiple setters to @self. | |
| 359 | + | // | |
| 360 | + | // See [method@Breakpoint.add_setter]. | |
| 361 | + | // | |
| 362 | + | // Example: | |
| 363 | + | // | |
| 364 | + | // ```c | |
| 365 | + | // adw_breakpoint_add_setters (breakpoint, | |
| 366 | + | // | |
| 367 | + | // G_OBJECT (box), "orientation", GTK_ORIENTATION_VERTICAL, | |
| 368 | + | // G_OBJECT (button), "halign", GTK_ALIGN_FILL, | |
| 369 | + | // G_OBJECT (button), "valign", GTK_ALIGN_END, | |
| 370 | + | // NULL); | |
| 371 | + | // | |
| 372 | + | // ``` | |
| 373 | + | func (x *Breakpoint) AddSetters(FirstObjectVar *gobject.Object, FirstPropertyVar string, varArgs ...interface{}) { | |
| 374 | + | ||
| 375 | + | xBreakpointAddSetters(x.GoPointer(), FirstObjectVar.GoPointer(), FirstPropertyVar, varArgs...) | |
| 376 | + | ||
| 377 | + | } | |
| 378 | + | ||
| 379 | + | var xBreakpointAddSettersValist func(uintptr, uintptr, string, []interface{}) | |
| 380 | + | ||
| 381 | + | // Adds multiple setters to @self. | |
| 382 | + | // | |
| 383 | + | // See [method@Breakpoint.add_setters]. | |
| 384 | + | func (x *Breakpoint) AddSettersValist(FirstObjectVar *gobject.Object, FirstPropertyVar string, ArgsVar []interface{}) { | |
| 385 | + | ||
| 386 | + | xBreakpointAddSettersValist(x.GoPointer(), FirstObjectVar.GoPointer(), FirstPropertyVar, ArgsVar) | |
| 387 | + | ||
| 388 | + | } | |
| 389 | + | ||
| 390 | + | var xBreakpointAddSettersv func(uintptr, int, uintptr, []string, uintptr) | |
| 391 | + | ||
| 392 | + | // Adds @n_setters setters to @self. | |
| 393 | + | // | |
| 394 | + | // This is a convenience function for adding multiple setters at once. | |
| 395 | + | // | |
| 396 | + | // See [method@Breakpoint.add_setter]. | |
| 397 | + | // | |
| 398 | + | // This function is meant to be used by language bindings. | |
| 399 | + | func (x *Breakpoint) AddSettersv(NSettersVar int, ObjectsVar uintptr, NamesVar []string, ValuesVar uintptr) { | |
| 400 | + | ||
| 401 | + | xBreakpointAddSettersv(x.GoPointer(), NSettersVar, ObjectsVar, NamesVar, ValuesVar) | |
| 402 | + | ||
| 403 | + | } | |
| 404 | + | ||
| 405 | + | var xBreakpointGetCondition func(uintptr) *BreakpointCondition | |
| 406 | + | ||
| 407 | + | // Gets the condition for @self. | |
| 408 | + | func (x *Breakpoint) GetCondition() *BreakpointCondition { | |
| 409 | + | ||
| 410 | + | cret := xBreakpointGetCondition(x.GoPointer()) | |
| 411 | + | return cret | |
| 412 | + | } | |
| 413 | + | ||
| 414 | + | var xBreakpointSetCondition func(uintptr, *BreakpointCondition) | |
| 415 | + | ||
| 416 | + | // Sets the condition for @self. | |
| 417 | + | func (x *Breakpoint) SetCondition(ConditionVar *BreakpointCondition) { | |
| 418 | + | ||
| 419 | + | xBreakpointSetCondition(x.GoPointer(), ConditionVar) | |
| 420 | + | ||
| 421 | + | } | |
| 422 | + | ||
| 423 | + | func (c *Breakpoint) GoPointer() uintptr { | |
| 424 | + | return c.Ptr | |
| 425 | + | } | |
| 426 | + | ||
| 427 | + | func (c *Breakpoint) SetGoPointer(ptr uintptr) { | |
| 428 | + | c.Ptr = ptr | |
| 429 | + | } | |
| 430 | + | ||
| 431 | + | // Emitted when the breakpoint is applied. | |
| 432 | + | // | |
| 433 | + | // This signal is emitted after the setters have been applied. | |
| 434 | + | func (x *Breakpoint) ConnectApply(cb *func(Breakpoint)) uint32 { | |
| 435 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 436 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 437 | + | return gobject.SignalConnect(x.GoPointer(), "apply", cbRefPtr) | |
| 438 | + | } | |
| 439 | + | ||
| 440 | + | fcb := func(clsPtr uintptr) { | |
| 441 | + | fa := Breakpoint{} | |
| 442 | + | fa.Ptr = clsPtr | |
| 443 | + | cbFn := *cb | |
| 444 | + | ||
| 445 | + | cbFn(fa) | |
| 446 | + | ||
| 447 | + | } | |
| 448 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 449 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 450 | + | return gobject.SignalConnect(x.GoPointer(), "apply", cbRefPtr) | |
| 451 | + | } | |
| 452 | + | ||
| 453 | + | // Emitted when the breakpoint is unapplied. | |
| 454 | + | // | |
| 455 | + | // This signal is emitted before resetting the setter values. | |
| 456 | + | func (x *Breakpoint) ConnectUnapply(cb *func(Breakpoint)) uint32 { | |
| 457 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 458 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 459 | + | return gobject.SignalConnect(x.GoPointer(), "unapply", cbRefPtr) | |
| 460 | + | } | |
| 461 | + | ||
| 462 | + | fcb := func(clsPtr uintptr) { | |
| 463 | + | fa := Breakpoint{} | |
| 464 | + | fa.Ptr = clsPtr | |
| 465 | + | cbFn := *cb | |
| 466 | + | ||
| 467 | + | cbFn(fa) | |
| 468 | + | ||
| 469 | + | } | |
| 470 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 471 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 472 | + | return gobject.SignalConnect(x.GoPointer(), "unapply", cbRefPtr) | |
| 473 | + | } | |
| 474 | + | ||
| 475 | + | // Gets the ID of the @buildable object. | |
| 476 | + | // | |
| 477 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 478 | + | // of the <object> tag used to construct the @buildable. | |
| 479 | + | func (x *Breakpoint) GetBuildableId() string { | |
| 480 | + | ||
| 481 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 482 | + | return cret | |
| 483 | + | } | |
| 484 | + | ||
| 485 | + | func init() { | |
| 486 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 487 | + | if err != nil { | |
| 488 | + | panic(err) | |
| 489 | + | } | |
| 490 | + | ||
| 491 | + | core.PuregoSafeRegister(&xBreakpointConditionLengthTypeGLibType, lib, "adw_breakpoint_condition_length_type_get_type") | |
| 492 | + | ||
| 493 | + | core.PuregoSafeRegister(&xBreakpointConditionRatioTypeGLibType, lib, "adw_breakpoint_condition_ratio_type_get_type") | |
| 494 | + | ||
| 495 | + | core.PuregoSafeRegister(&xBreakpointConditionParse, lib, "adw_breakpoint_condition_parse") | |
| 496 | + | ||
| 497 | + | core.PuregoSafeRegister(&xBreakpointConditionGLibType, lib, "adw_breakpoint_condition_get_type") | |
| 498 | + | ||
| 499 | + | core.PuregoSafeRegister(&xNewBreakpointConditionAnd, lib, "adw_breakpoint_condition_new_and") | |
| 500 | + | core.PuregoSafeRegister(&xNewBreakpointConditionLength, lib, "adw_breakpoint_condition_new_length") | |
| 501 | + | core.PuregoSafeRegister(&xNewBreakpointConditionOr, lib, "adw_breakpoint_condition_new_or") | |
| 502 | + | core.PuregoSafeRegister(&xNewBreakpointConditionRatio, lib, "adw_breakpoint_condition_new_ratio") | |
| 503 | + | ||
| 504 | + | core.PuregoSafeRegister(&xBreakpointConditionCopy, lib, "adw_breakpoint_condition_copy") | |
| 505 | + | core.PuregoSafeRegister(&xBreakpointConditionFree, lib, "adw_breakpoint_condition_free") | |
| 506 | + | core.PuregoSafeRegister(&xBreakpointConditionToString, lib, "adw_breakpoint_condition_to_string") | |
| 507 | + | ||
| 508 | + | core.PuregoSafeRegister(&xBreakpointGLibType, lib, "adw_breakpoint_get_type") | |
| 509 | + | ||
| 510 | + | core.PuregoSafeRegister(&xNewBreakpoint, lib, "adw_breakpoint_new") | |
| 511 | + | ||
| 512 | + | core.PuregoSafeRegister(&xBreakpointAddSetter, lib, "adw_breakpoint_add_setter") | |
| 513 | + | core.PuregoSafeRegister(&xBreakpointAddSetters, lib, "adw_breakpoint_add_setters") | |
| 514 | + | core.PuregoSafeRegister(&xBreakpointAddSettersValist, lib, "adw_breakpoint_add_setters_valist") | |
| 515 | + | core.PuregoSafeRegister(&xBreakpointAddSettersv, lib, "adw_breakpoint_add_settersv") | |
| 516 | + | core.PuregoSafeRegister(&xBreakpointGetCondition, lib, "adw_breakpoint_get_condition") | |
| 517 | + | core.PuregoSafeRegister(&xBreakpointSetCondition, lib, "adw_breakpoint_set_condition") | |
| 518 | + | ||
| 519 | + | } | |
M v4/adw/adw-button-content.go +31 -4
| @@ -58,12 +58,15 @@ func (x *ButtonContentClass) GoPointer() uintptr { | |||
| 58 | 58 | // | |
| 59 | 59 | // ``` | |
| 60 | 60 | // buttoncontent | |
| 61 | - | // ├── image | |
| 62 | - | // ╰── label | |
| 61 | + | // ╰── box | |
| 62 | + | // | |
| 63 | + | // ├── image | |
| 64 | + | // ╰── label | |
| 65 | + | // | |
| 63 | 66 | // ``` | |
| 64 | 67 | // | |
| 65 | - | // `AdwButtonContent`'s CSS node is called `buttoncontent`. It contains the | |
| 66 | - | // subnodes `image` and `label`. | |
| 68 | + | // `AdwButtonContent`'s CSS node is called `buttoncontent`. It contains a `box` | |
| 69 | + | // subnode that serves as a container for the `image` and `label` nodes. | |
| 67 | 70 | // | |
| 68 | 71 | // When inside a `GtkButton` or `AdwSplitButton`, the button will receive the | |
| 69 | 72 | // `.image-text-button` style class. When inside a `GtkMenuButton`, the | |
| @@ -105,6 +108,15 @@ func NewButtonContent() *ButtonContent { | |||
| 105 | 108 | return cls | |
| 106 | 109 | } | |
| 107 | 110 | ||
| 111 | + | var xButtonContentGetCanShrink func(uintptr) bool | |
| 112 | + | ||
| 113 | + | // gets whether the button can be smaller than the natural size of its contents. | |
| 114 | + | func (x *ButtonContent) GetCanShrink() bool { | |
| 115 | + | ||
| 116 | + | cret := xButtonContentGetCanShrink(x.GoPointer()) | |
| 117 | + | return cret | |
| 118 | + | } | |
| 119 | + | ||
| 108 | 120 | var xButtonContentGetIconName func(uintptr) string | |
| 109 | 121 | ||
| 110 | 122 | // Gets the name of the displayed icon. | |
| @@ -132,6 +144,19 @@ func (x *ButtonContent) GetUseUnderline() bool { | |||
| 132 | 144 | return cret | |
| 133 | 145 | } | |
| 134 | 146 | ||
| 147 | + | var xButtonContentSetCanShrink func(uintptr, bool) | |
| 148 | + | ||
| 149 | + | // Sets whether the button can be smaller than the natural size of its contents. | |
| 150 | + | // | |
| 151 | + | // If set to `TRUE`, the label will ellipsize. | |
| 152 | + | // | |
| 153 | + | // See [method@Gtk.Button.set_can_shrink]. | |
| 154 | + | func (x *ButtonContent) SetCanShrink(CanShrinkVar bool) { | |
| 155 | + | ||
| 156 | + | xButtonContentSetCanShrink(x.GoPointer(), CanShrinkVar) | |
| 157 | + | ||
| 158 | + | } | |
| 159 | + | ||
| 135 | 160 | var xButtonContentSetIconName func(uintptr, string) | |
| 136 | 161 | ||
| 137 | 162 | // Sets the name of the displayed icon. | |
| @@ -326,9 +351,11 @@ func init() { | |||
| 326 | 351 | ||
| 327 | 352 | core.PuregoSafeRegister(&xNewButtonContent, lib, "adw_button_content_new") | |
| 328 | 353 | ||
| 354 | + | core.PuregoSafeRegister(&xButtonContentGetCanShrink, lib, "adw_button_content_get_can_shrink") | |
| 329 | 355 | core.PuregoSafeRegister(&xButtonContentGetIconName, lib, "adw_button_content_get_icon_name") | |
| 330 | 356 | core.PuregoSafeRegister(&xButtonContentGetLabel, lib, "adw_button_content_get_label") | |
| 331 | 357 | core.PuregoSafeRegister(&xButtonContentGetUseUnderline, lib, "adw_button_content_get_use_underline") | |
| 358 | + | core.PuregoSafeRegister(&xButtonContentSetCanShrink, lib, "adw_button_content_set_can_shrink") | |
| 332 | 359 | core.PuregoSafeRegister(&xButtonContentSetIconName, lib, "adw_button_content_set_icon_name") | |
| 333 | 360 | core.PuregoSafeRegister(&xButtonContentSetLabel, lib, "adw_button_content_set_label") | |
| 334 | 361 | core.PuregoSafeRegister(&xButtonContentSetUseUnderline, lib, "adw_button_content_set_use_underline") | |
A v4/adw/adw-button-row.go +414 -0
| @@ -0,0 +1,414 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 13 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 14 | + | ) | |
| 15 | + | ||
| 16 | + | type ButtonRowClass struct { | |
| 17 | + | _ structs.HostLayout | |
| 18 | + | ||
| 19 | + | ParentClass uintptr | |
| 20 | + | } | |
| 21 | + | ||
| 22 | + | func (x *ButtonRowClass) GoPointer() uintptr { | |
| 23 | + | return uintptr(unsafe.Pointer(x)) | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | // A [class@Gtk.ListBoxRow] that looks like a button. | |
| 27 | + | // | |
| 28 | + | // <picture> | |
| 29 | + | // | |
| 30 | + | // <source srcset="button-rows-dark.png" media="(prefers-color-scheme: dark)"> | |
| 31 | + | // <img src="button-rows.png" alt="button-rows"> | |
| 32 | + | // | |
| 33 | + | // </picture> | |
| 34 | + | // | |
| 35 | + | // The `AdwButtonRow` widget has a title and two icons: before and after the | |
| 36 | + | // title. | |
| 37 | + | // | |
| 38 | + | // It is convenient for presenting actions like "Delete" at the end of a boxed | |
| 39 | + | // list. | |
| 40 | + | // | |
| 41 | + | // `AdwButtonRow` is always activatable. | |
| 42 | + | // | |
| 43 | + | // ## CSS nodes | |
| 44 | + | // | |
| 45 | + | // `AdwButtonRow` has a main CSS node with name `row` and the style class | |
| 46 | + | // `.button`. | |
| 47 | + | // | |
| 48 | + | // It contains the subnode `box` for its main horizontal box, which contains the | |
| 49 | + | // nodes: `image.icon.start` for the start icon, `label.title` for the title, | |
| 50 | + | // and `image.icon.end` for the end icon. | |
| 51 | + | // | |
| 52 | + | // ## Style classes | |
| 53 | + | // | |
| 54 | + | // The [`.suggested-action`](style-classes.html#suggested-action) style class | |
| 55 | + | // makes `AdwButtonRow` use accent color for its background. It should be used | |
| 56 | + | // very sparingly to denote important buttons. | |
| 57 | + | // | |
| 58 | + | // <picture> | |
| 59 | + | // | |
| 60 | + | // <source srcset="button-row-suggested-action-dark.png" media="(prefers-color-scheme: dark)"> | |
| 61 | + | // <img src="button-row-suggested-action.png" alt="button-row-suggested-action"> | |
| 62 | + | // | |
| 63 | + | // </picture> | |
| 64 | + | // | |
| 65 | + | // The [`.destructive-action`](style-classes.html#destructive-action) style | |
| 66 | + | // makes the row use destructive colors. It can be used to draw attention to the | |
| 67 | + | // potentially damaging consequences of using it. This style acts as a warning | |
| 68 | + | // to the user. | |
| 69 | + | // | |
| 70 | + | // <picture> | |
| 71 | + | // | |
| 72 | + | // <source srcset="button-row-destructive-action-dark.png" media="(prefers-color-scheme: dark)"> | |
| 73 | + | // <img src="button-row-destructive-action.png" alt="button-row-destructive-action"> | |
| 74 | + | // | |
| 75 | + | // </picture> | |
| 76 | + | type ButtonRow struct { | |
| 77 | + | PreferencesRow | |
| 78 | + | } | |
| 79 | + | ||
| 80 | + | var xButtonRowGLibType func() types.GType | |
| 81 | + | ||
| 82 | + | func ButtonRowGLibType() types.GType { | |
| 83 | + | return xButtonRowGLibType() | |
| 84 | + | } | |
| 85 | + | ||
| 86 | + | func ButtonRowNewFromInternalPtr(ptr uintptr) *ButtonRow { | |
| 87 | + | cls := &ButtonRow{} | |
| 88 | + | cls.Ptr = ptr | |
| 89 | + | return cls | |
| 90 | + | } | |
| 91 | + | ||
| 92 | + | var xNewButtonRow func() uintptr | |
| 93 | + | ||
| 94 | + | // Creates a new `AdwButtonRow`. | |
| 95 | + | func NewButtonRow() *ButtonRow { | |
| 96 | + | var cls *ButtonRow | |
| 97 | + | ||
| 98 | + | cret := xNewButtonRow() | |
| 99 | + | ||
| 100 | + | if cret == 0 { | |
| 101 | + | return nil | |
| 102 | + | } | |
| 103 | + | gobject.IncreaseRef(cret) | |
| 104 | + | cls = &ButtonRow{} | |
| 105 | + | cls.Ptr = cret | |
| 106 | + | return cls | |
| 107 | + | } | |
| 108 | + | ||
| 109 | + | var xButtonRowGetEndIconName func(uintptr) string | |
| 110 | + | ||
| 111 | + | // Gets the end icon name for @self. | |
| 112 | + | func (x *ButtonRow) GetEndIconName() string { | |
| 113 | + | ||
| 114 | + | cret := xButtonRowGetEndIconName(x.GoPointer()) | |
| 115 | + | return cret | |
| 116 | + | } | |
| 117 | + | ||
| 118 | + | var xButtonRowGetStartIconName func(uintptr) string | |
| 119 | + | ||
| 120 | + | // Gets the start icon name for @self. | |
| 121 | + | func (x *ButtonRow) GetStartIconName() string { | |
| 122 | + | ||
| 123 | + | cret := xButtonRowGetStartIconName(x.GoPointer()) | |
| 124 | + | return cret | |
| 125 | + | } | |
| 126 | + | ||
| 127 | + | var xButtonRowSetEndIconName func(uintptr, string) | |
| 128 | + | ||
| 129 | + | // Sets the end icon name for @self. | |
| 130 | + | func (x *ButtonRow) SetEndIconName(IconNameVar string) { | |
| 131 | + | ||
| 132 | + | xButtonRowSetEndIconName(x.GoPointer(), IconNameVar) | |
| 133 | + | ||
| 134 | + | } | |
| 135 | + | ||
| 136 | + | var xButtonRowSetStartIconName func(uintptr, string) | |
| 137 | + | ||
| 138 | + | // Sets the start icon name for @self. | |
| 139 | + | func (x *ButtonRow) SetStartIconName(IconNameVar string) { | |
| 140 | + | ||
| 141 | + | xButtonRowSetStartIconName(x.GoPointer(), IconNameVar) | |
| 142 | + | ||
| 143 | + | } | |
| 144 | + | ||
| 145 | + | func (c *ButtonRow) GoPointer() uintptr { | |
| 146 | + | return c.Ptr | |
| 147 | + | } | |
| 148 | + | ||
| 149 | + | func (c *ButtonRow) SetGoPointer(ptr uintptr) { | |
| 150 | + | c.Ptr = ptr | |
| 151 | + | } | |
| 152 | + | ||
| 153 | + | // This signal is emitted after the row has been activated. | |
| 154 | + | func (x *ButtonRow) ConnectActivated(cb *func(ButtonRow)) uint32 { | |
| 155 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 156 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 157 | + | return gobject.SignalConnect(x.GoPointer(), "activated", cbRefPtr) | |
| 158 | + | } | |
| 159 | + | ||
| 160 | + | fcb := func(clsPtr uintptr) { | |
| 161 | + | fa := ButtonRow{} | |
| 162 | + | fa.Ptr = clsPtr | |
| 163 | + | cbFn := *cb | |
| 164 | + | ||
| 165 | + | cbFn(fa) | |
| 166 | + | ||
| 167 | + | } | |
| 168 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 169 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 170 | + | return gobject.SignalConnect(x.GoPointer(), "activated", cbRefPtr) | |
| 171 | + | } | |
| 172 | + | ||
| 173 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 174 | + | func (x *ButtonRow) GetAccessibleRole() gtk.AccessibleRole { | |
| 175 | + | ||
| 176 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 177 | + | return cret | |
| 178 | + | } | |
| 179 | + | ||
| 180 | + | // Resets the accessible @property to its default value. | |
| 181 | + | func (x *ButtonRow) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 182 | + | ||
| 183 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 184 | + | ||
| 185 | + | } | |
| 186 | + | ||
| 187 | + | // Resets the accessible @relation to its default value. | |
| 188 | + | func (x *ButtonRow) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 189 | + | ||
| 190 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 191 | + | ||
| 192 | + | } | |
| 193 | + | ||
| 194 | + | // Resets the accessible @state to its default value. | |
| 195 | + | func (x *ButtonRow) ResetState(StateVar gtk.AccessibleState) { | |
| 196 | + | ||
| 197 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 198 | + | ||
| 199 | + | } | |
| 200 | + | ||
| 201 | + | // Updates a list of accessible properties. | |
| 202 | + | // | |
| 203 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 204 | + | // value types of accessible properties. | |
| 205 | + | // | |
| 206 | + | // This function should be called by `GtkWidget` types whenever | |
| 207 | + | // an accessible property change must be communicated to assistive | |
| 208 | + | // technologies. | |
| 209 | + | // | |
| 210 | + | // Example: | |
| 211 | + | // ```c | |
| 212 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 213 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 214 | + | // | |
| 215 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 216 | + | // -1); | |
| 217 | + | // | |
| 218 | + | // ``` | |
| 219 | + | func (x *ButtonRow) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 220 | + | ||
| 221 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 222 | + | ||
| 223 | + | } | |
| 224 | + | ||
| 225 | + | // Updates an array of accessible properties. | |
| 226 | + | // | |
| 227 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 228 | + | // property change must be communicated to assistive technologies. | |
| 229 | + | // | |
| 230 | + | // This function is meant to be used by language bindings. | |
| 231 | + | func (x *ButtonRow) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 232 | + | ||
| 233 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 234 | + | ||
| 235 | + | } | |
| 236 | + | ||
| 237 | + | // Updates a list of accessible relations. | |
| 238 | + | // | |
| 239 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 240 | + | // relation change must be communicated to assistive technologies. | |
| 241 | + | // | |
| 242 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 243 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 244 | + | // | |
| 245 | + | // ```c | |
| 246 | + | // gtk_accessible_update_relation (accessible, | |
| 247 | + | // | |
| 248 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 249 | + | // ref1, NULL, | |
| 250 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 251 | + | // ref1, ref2, ref3, NULL, | |
| 252 | + | // -1); | |
| 253 | + | // | |
| 254 | + | // ``` | |
| 255 | + | func (x *ButtonRow) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 256 | + | ||
| 257 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 258 | + | ||
| 259 | + | } | |
| 260 | + | ||
| 261 | + | // Updates an array of accessible relations. | |
| 262 | + | // | |
| 263 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 264 | + | // relation change must be communicated to assistive technologies. | |
| 265 | + | // | |
| 266 | + | // This function is meant to be used by language bindings. | |
| 267 | + | func (x *ButtonRow) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 268 | + | ||
| 269 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 270 | + | ||
| 271 | + | } | |
| 272 | + | ||
| 273 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 274 | + | // documentation for the value types of accessible states. | |
| 275 | + | // | |
| 276 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 277 | + | // state change must be communicated to assistive technologies. | |
| 278 | + | // | |
| 279 | + | // Example: | |
| 280 | + | // ```c | |
| 281 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 282 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 283 | + | // | |
| 284 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 285 | + | // -1); | |
| 286 | + | // | |
| 287 | + | // ``` | |
| 288 | + | func (x *ButtonRow) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 289 | + | ||
| 290 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 291 | + | ||
| 292 | + | } | |
| 293 | + | ||
| 294 | + | // Updates an array of accessible states. | |
| 295 | + | // | |
| 296 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 297 | + | // state change must be communicated to assistive technologies. | |
| 298 | + | // | |
| 299 | + | // This function is meant to be used by language bindings. | |
| 300 | + | func (x *ButtonRow) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 301 | + | ||
| 302 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 303 | + | ||
| 304 | + | } | |
| 305 | + | ||
| 306 | + | // Gets the action name for @actionable. | |
| 307 | + | func (x *ButtonRow) GetActionName() string { | |
| 308 | + | ||
| 309 | + | cret := gtk.XGtkActionableGetActionName(x.GoPointer()) | |
| 310 | + | return cret | |
| 311 | + | } | |
| 312 | + | ||
| 313 | + | // Gets the current target value of @actionable. | |
| 314 | + | func (x *ButtonRow) GetActionTargetValue() *glib.Variant { | |
| 315 | + | ||
| 316 | + | cret := gtk.XGtkActionableGetActionTargetValue(x.GoPointer()) | |
| 317 | + | return cret | |
| 318 | + | } | |
| 319 | + | ||
| 320 | + | // Specifies the name of the action with which this widget should be | |
| 321 | + | // associated. | |
| 322 | + | // | |
| 323 | + | // If @action_name is %NULL then the widget will be unassociated from | |
| 324 | + | // any previous action. | |
| 325 | + | // | |
| 326 | + | // Usually this function is used when the widget is located (or will be | |
| 327 | + | // located) within the hierarchy of a `GtkApplicationWindow`. | |
| 328 | + | // | |
| 329 | + | // Names are of the form “win.save” or “app.quit” for actions on the | |
| 330 | + | // containing [class@ApplicationWindow] or its associated [class@Application], | |
| 331 | + | // respectively. This is the same form used for actions in the [class@Gio.Menu] | |
| 332 | + | // associated with the window. | |
| 333 | + | func (x *ButtonRow) SetActionName(ActionNameVar string) { | |
| 334 | + | ||
| 335 | + | gtk.XGtkActionableSetActionName(x.GoPointer(), ActionNameVar) | |
| 336 | + | ||
| 337 | + | } | |
| 338 | + | ||
| 339 | + | // Sets the target of an actionable widget. | |
| 340 | + | // | |
| 341 | + | // This is a convenience function that calls [ctor@GLib.Variant.new] for | |
| 342 | + | // @format_string and uses the result to call | |
| 343 | + | // [method@Gtk.Actionable.set_action_target_value]. | |
| 344 | + | // | |
| 345 | + | // If you are setting a string-valued target and want to set | |
| 346 | + | // the action name at the same time, you can use | |
| 347 | + | // [method@Gtk.Actionable.set_detailed_action_name]. | |
| 348 | + | func (x *ButtonRow) SetActionTarget(FormatStringVar string, varArgs ...interface{}) { | |
| 349 | + | ||
| 350 | + | gtk.XGtkActionableSetActionTarget(x.GoPointer(), FormatStringVar, varArgs...) | |
| 351 | + | ||
| 352 | + | } | |
| 353 | + | ||
| 354 | + | // Sets the target value of an actionable widget. | |
| 355 | + | // | |
| 356 | + | // If @target_value is %NULL then the target value is unset. | |
| 357 | + | // | |
| 358 | + | // The target value has two purposes. First, it is used as the parameter | |
| 359 | + | // to activation of the action associated with the `GtkActionable` widget. | |
| 360 | + | // Second, it is used to determine if the widget should be rendered as | |
| 361 | + | // “active” — the widget is active if the state is equal to the given target. | |
| 362 | + | // | |
| 363 | + | // Consider the example of associating a set of buttons with a [iface@Gio.Action] | |
| 364 | + | // with string state in a typical “radio button” situation. Each button | |
| 365 | + | // will be associated with the same action, but with a different target | |
| 366 | + | // value for that action. Clicking on a particular button will activate | |
| 367 | + | // the action with the target of that button, which will typically cause | |
| 368 | + | // the action’s state to change to that value. Since the action’s state | |
| 369 | + | // is now equal to the target value of the button, the button will now | |
| 370 | + | // be rendered as active (and the other buttons, with different targets, | |
| 371 | + | // rendered inactive). | |
| 372 | + | func (x *ButtonRow) SetActionTargetValue(TargetValueVar *glib.Variant) { | |
| 373 | + | ||
| 374 | + | gtk.XGtkActionableSetActionTargetValue(x.GoPointer(), TargetValueVar) | |
| 375 | + | ||
| 376 | + | } | |
| 377 | + | ||
| 378 | + | // Sets the action-name and associated string target value of an | |
| 379 | + | // actionable widget. | |
| 380 | + | // | |
| 381 | + | // @detailed_action_name is a string in the format accepted by | |
| 382 | + | // [func@Gio.Action.parse_detailed_name]. | |
| 383 | + | func (x *ButtonRow) SetDetailedActionName(DetailedActionNameVar string) { | |
| 384 | + | ||
| 385 | + | gtk.XGtkActionableSetDetailedActionName(x.GoPointer(), DetailedActionNameVar) | |
| 386 | + | ||
| 387 | + | } | |
| 388 | + | ||
| 389 | + | // Gets the ID of the @buildable object. | |
| 390 | + | // | |
| 391 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 392 | + | // of the <object> tag used to construct the @buildable. | |
| 393 | + | func (x *ButtonRow) GetBuildableId() string { | |
| 394 | + | ||
| 395 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 396 | + | return cret | |
| 397 | + | } | |
| 398 | + | ||
| 399 | + | func init() { | |
| 400 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 401 | + | if err != nil { | |
| 402 | + | panic(err) | |
| 403 | + | } | |
| 404 | + | ||
| 405 | + | core.PuregoSafeRegister(&xButtonRowGLibType, lib, "adw_button_row_get_type") | |
| 406 | + | ||
| 407 | + | core.PuregoSafeRegister(&xNewButtonRow, lib, "adw_button_row_new") | |
| 408 | + | ||
| 409 | + | core.PuregoSafeRegister(&xButtonRowGetEndIconName, lib, "adw_button_row_get_end_icon_name") | |
| 410 | + | core.PuregoSafeRegister(&xButtonRowGetStartIconName, lib, "adw_button_row_get_start_icon_name") | |
| 411 | + | core.PuregoSafeRegister(&xButtonRowSetEndIconName, lib, "adw_button_row_set_end_icon_name") | |
| 412 | + | core.PuregoSafeRegister(&xButtonRowSetStartIconName, lib, "adw_button_row_set_start_icon_name") | |
| 413 | + | ||
| 414 | + | } | |
M v4/adw/adw-carousel.go +5 -2
| @@ -329,8 +329,11 @@ func (c *Carousel) SetGoPointer(ptr uintptr) { | |||
| 329 | 329 | // This signal is emitted after a page has been changed. | |
| 330 | 330 | // | |
| 331 | 331 | // It can be used to implement "infinite scrolling" by amending the pages | |
| 332 | - | // after every scroll. Note that an empty carousel is indicated by | |
| 333 | - | // `(int)index == -1`. | |
| 332 | + | // after every scroll. | |
| 333 | + | // | |
| 334 | + | // ::: note | |
| 335 | + | // | |
| 336 | + | // An empty carousel is indicated by `(int)index == -1`. | |
| 334 | 337 | func (x *Carousel) ConnectPageChanged(cb *func(Carousel, uint)) uint32 { | |
| 335 | 338 | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 336 | 339 | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
M v4/adw/adw-clamp-layout.go +26 -3
| @@ -44,9 +44,10 @@ func (x *ClampLayoutClass) GoPointer() uintptr { | |||
| 44 | 44 | // If a child requires more than the requested maximum size, it will be | |
| 45 | 45 | // allocated the minimum size it can fit in instead. | |
| 46 | 46 | // | |
| 47 | - | // Each child will get the style classes .large when it reached its maximum | |
| 48 | - | // size, .small when it's allocated the full size, .medium in-between, or none | |
| 49 | - | // if it hasn't been allocated yet. | |
| 47 | + | // `AdwClampLayout` can scale with the text scale factor, use the | |
| 48 | + | // [property@ClampLayout:unit] property to enable that behavior. | |
| 49 | + | // | |
| 50 | + | // See also: [class@Clamp], [class@ClampScrollable]. | |
| 50 | 51 | type ClampLayout struct { | |
| 51 | 52 | gtk.LayoutManager | |
| 52 | 53 | } | |
| @@ -97,6 +98,15 @@ func (x *ClampLayout) GetTighteningThreshold() int { | |||
| 97 | 98 | return cret | |
| 98 | 99 | } | |
| 99 | 100 | ||
| 101 | + | var xClampLayoutGetUnit func(uintptr) LengthUnit | |
| 102 | + | ||
| 103 | + | // Gets the length unit for maximum size and tightening threshold. | |
| 104 | + | func (x *ClampLayout) GetUnit() LengthUnit { | |
| 105 | + | ||
| 106 | + | cret := xClampLayoutGetUnit(x.GoPointer()) | |
| 107 | + | return cret | |
| 108 | + | } | |
| 109 | + | ||
| 100 | 110 | var xClampLayoutSetMaximumSize func(uintptr, int) | |
| 101 | 111 | ||
| 102 | 112 | // Sets the maximum size allocated to the children. | |
| @@ -130,6 +140,17 @@ func (x *ClampLayout) SetTighteningThreshold(TighteningThresholdVar int) { | |||
| 130 | 140 | ||
| 131 | 141 | } | |
| 132 | 142 | ||
| 143 | + | var xClampLayoutSetUnit func(uintptr, LengthUnit) | |
| 144 | + | ||
| 145 | + | // Sets the length unit for maximum size and tightening threshold. | |
| 146 | + | // | |
| 147 | + | // Allows the sizes to vary depending on the text scale factor. | |
| 148 | + | func (x *ClampLayout) SetUnit(UnitVar LengthUnit) { | |
| 149 | + | ||
| 150 | + | xClampLayoutSetUnit(x.GoPointer(), UnitVar) | |
| 151 | + | ||
| 152 | + | } | |
| 153 | + | ||
| 133 | 154 | func (c *ClampLayout) GoPointer() uintptr { | |
| 134 | 155 | return c.Ptr | |
| 135 | 156 | } | |
| @@ -164,7 +185,9 @@ func init() { | |||
| 164 | 185 | ||
| 165 | 186 | core.PuregoSafeRegister(&xClampLayoutGetMaximumSize, lib, "adw_clamp_layout_get_maximum_size") | |
| 166 | 187 | core.PuregoSafeRegister(&xClampLayoutGetTighteningThreshold, lib, "adw_clamp_layout_get_tightening_threshold") | |
| 188 | + | core.PuregoSafeRegister(&xClampLayoutGetUnit, lib, "adw_clamp_layout_get_unit") | |
| 167 | 189 | core.PuregoSafeRegister(&xClampLayoutSetMaximumSize, lib, "adw_clamp_layout_set_maximum_size") | |
| 168 | 190 | core.PuregoSafeRegister(&xClampLayoutSetTighteningThreshold, lib, "adw_clamp_layout_set_tightening_threshold") | |
| 191 | + | core.PuregoSafeRegister(&xClampLayoutSetUnit, lib, "adw_clamp_layout_set_unit") | |
| 169 | 192 | ||
| 170 | 193 | } | |
M v4/adw/adw-clamp-scrollable.go +24 -0
| @@ -29,6 +29,8 @@ func (x *ClampScrollableClass) GoPointer() uintptr { | |||
| 29 | 29 | // | |
| 30 | 30 | // The primary use case for `AdwClampScrollable` is clamping | |
| 31 | 31 | // [class@Gtk.ListView]. | |
| 32 | + | // | |
| 33 | + | // See also: [class@ClampLayout]. | |
| 32 | 34 | type ClampScrollable struct { | |
| 33 | 35 | gtk.Widget | |
| 34 | 36 | } | |
| @@ -97,6 +99,15 @@ func (x *ClampScrollable) GetTighteningThreshold() int { | |||
| 97 | 99 | return cret | |
| 98 | 100 | } | |
| 99 | 101 | ||
| 102 | + | var xClampScrollableGetUnit func(uintptr) LengthUnit | |
| 103 | + | ||
| 104 | + | // Gets the length unit for maximum size and tightening threshold. | |
| 105 | + | func (x *ClampScrollable) GetUnit() LengthUnit { | |
| 106 | + | ||
| 107 | + | cret := xClampScrollableGetUnit(x.GoPointer()) | |
| 108 | + | return cret | |
| 109 | + | } | |
| 110 | + | ||
| 100 | 111 | var xClampScrollableSetChild func(uintptr, uintptr) | |
| 101 | 112 | ||
| 102 | 113 | // Sets the child widget of @self. | |
| @@ -139,6 +150,17 @@ func (x *ClampScrollable) SetTighteningThreshold(TighteningThresholdVar int) { | |||
| 139 | 150 | ||
| 140 | 151 | } | |
| 141 | 152 | ||
| 153 | + | var xClampScrollableSetUnit func(uintptr, LengthUnit) | |
| 154 | + | ||
| 155 | + | // Sets the length unit for maximum size and tightening threshold. | |
| 156 | + | // | |
| 157 | + | // Allows the sizes to vary depending on the text scale factor. | |
| 158 | + | func (x *ClampScrollable) SetUnit(UnitVar LengthUnit) { | |
| 159 | + | ||
| 160 | + | xClampScrollableSetUnit(x.GoPointer(), UnitVar) | |
| 161 | + | ||
| 162 | + | } | |
| 163 | + | ||
| 142 | 164 | func (c *ClampScrollable) GoPointer() uintptr { | |
| 143 | 165 | return c.Ptr | |
| 144 | 166 | } | |
| @@ -407,8 +429,10 @@ func init() { | |||
| 407 | 429 | core.PuregoSafeRegister(&xClampScrollableGetChild, lib, "adw_clamp_scrollable_get_child") | |
| 408 | 430 | core.PuregoSafeRegister(&xClampScrollableGetMaximumSize, lib, "adw_clamp_scrollable_get_maximum_size") | |
| 409 | 431 | core.PuregoSafeRegister(&xClampScrollableGetTighteningThreshold, lib, "adw_clamp_scrollable_get_tightening_threshold") | |
| 432 | + | core.PuregoSafeRegister(&xClampScrollableGetUnit, lib, "adw_clamp_scrollable_get_unit") | |
| 410 | 433 | core.PuregoSafeRegister(&xClampScrollableSetChild, lib, "adw_clamp_scrollable_set_child") | |
| 411 | 434 | core.PuregoSafeRegister(&xClampScrollableSetMaximumSize, lib, "adw_clamp_scrollable_set_maximum_size") | |
| 412 | 435 | core.PuregoSafeRegister(&xClampScrollableSetTighteningThreshold, lib, "adw_clamp_scrollable_set_tightening_threshold") | |
| 436 | + | core.PuregoSafeRegister(&xClampScrollableSetUnit, lib, "adw_clamp_scrollable_set_unit") | |
| 413 | 437 | ||
| 414 | 438 | } | |
M v4/adw/adw-clamp.go +27 -4
| @@ -45,13 +45,14 @@ func (x *ClampClass) GoPointer() uintptr { | |||
| 45 | 45 | // If the child requires more than the requested maximum size, it will be | |
| 46 | 46 | // allocated the minimum size it can fit in instead. | |
| 47 | 47 | // | |
| 48 | + | // `AdwClamp` can scale with the text scale factor, use the | |
| 49 | + | // [property@Clamp:unit] property to enable that behavior. | |
| 50 | + | // | |
| 51 | + | // See also: [class@ClampLayout], [class@ClampScrollable]. | |
| 52 | + | // | |
| 48 | 53 | // ## CSS nodes | |
| 49 | 54 | // | |
| 50 | 55 | // `AdwClamp` has a single CSS node with name `clamp`. | |
| 51 | - | // | |
| 52 | - | // Its children will receive the style classes `.large` when the child reached | |
| 53 | - | // its maximum size, `.small` when the clamp allocates its full size to the | |
| 54 | - | // child, `.medium` in-between, or none if it hasn't computed its size yet. | |
| 55 | 56 | type Clamp struct { | |
| 56 | 57 | gtk.Widget | |
| 57 | 58 | } | |
| @@ -120,6 +121,15 @@ func (x *Clamp) GetTighteningThreshold() int { | |||
| 120 | 121 | return cret | |
| 121 | 122 | } | |
| 122 | 123 | ||
| 124 | + | var xClampGetUnit func(uintptr) LengthUnit | |
| 125 | + | ||
| 126 | + | // Gets the length unit for maximum size and tightening threshold. | |
| 127 | + | func (x *Clamp) GetUnit() LengthUnit { | |
| 128 | + | ||
| 129 | + | cret := xClampGetUnit(x.GoPointer()) | |
| 130 | + | return cret | |
| 131 | + | } | |
| 132 | + | ||
| 123 | 133 | var xClampSetChild func(uintptr, uintptr) | |
| 124 | 134 | ||
| 125 | 135 | // Sets the child widget of @self. | |
| @@ -162,6 +172,17 @@ func (x *Clamp) SetTighteningThreshold(TighteningThresholdVar int) { | |||
| 162 | 172 | ||
| 163 | 173 | } | |
| 164 | 174 | ||
| 175 | + | var xClampSetUnit func(uintptr, LengthUnit) | |
| 176 | + | ||
| 177 | + | // Sets the length unit for maximum size and tightening threshold. | |
| 178 | + | // | |
| 179 | + | // Allows the sizes to vary depending on the text scale factor. | |
| 180 | + | func (x *Clamp) SetUnit(UnitVar LengthUnit) { | |
| 181 | + | ||
| 182 | + | xClampSetUnit(x.GoPointer(), UnitVar) | |
| 183 | + | ||
| 184 | + | } | |
| 185 | + | ||
| 165 | 186 | func (c *Clamp) GoPointer() uintptr { | |
| 166 | 187 | return c.Ptr | |
| 167 | 188 | } | |
| @@ -340,8 +361,10 @@ func init() { | |||
| 340 | 361 | core.PuregoSafeRegister(&xClampGetChild, lib, "adw_clamp_get_child") | |
| 341 | 362 | core.PuregoSafeRegister(&xClampGetMaximumSize, lib, "adw_clamp_get_maximum_size") | |
| 342 | 363 | core.PuregoSafeRegister(&xClampGetTighteningThreshold, lib, "adw_clamp_get_tightening_threshold") | |
| 364 | + | core.PuregoSafeRegister(&xClampGetUnit, lib, "adw_clamp_get_unit") | |
| 343 | 365 | core.PuregoSafeRegister(&xClampSetChild, lib, "adw_clamp_set_child") | |
| 344 | 366 | core.PuregoSafeRegister(&xClampSetMaximumSize, lib, "adw_clamp_set_maximum_size") | |
| 345 | 367 | core.PuregoSafeRegister(&xClampSetTighteningThreshold, lib, "adw_clamp_set_tightening_threshold") | |
| 368 | + | core.PuregoSafeRegister(&xClampSetUnit, lib, "adw_clamp_set_unit") | |
| 346 | 369 | ||
| 347 | 370 | } | |
M v4/adw/adw-combo-row.go +78 -0
| @@ -110,6 +110,20 @@ func NewComboRow() *ComboRow { | |||
| 110 | 110 | return cls | |
| 111 | 111 | } | |
| 112 | 112 | ||
| 113 | + | var xComboRowGetEnableSearch func(uintptr) bool | |
| 114 | + | ||
| 115 | + | // Gets whether search is enabled. | |
| 116 | + | // | |
| 117 | + | // If set to `TRUE`, a search entry will be shown in the popup that | |
| 118 | + | // allows to search for items in the list. | |
| 119 | + | // | |
| 120 | + | // Search requires [property@ComboRow:expression] to be set. | |
| 121 | + | func (x *ComboRow) GetEnableSearch() bool { | |
| 122 | + | ||
| 123 | + | cret := xComboRowGetEnableSearch(x.GoPointer()) | |
| 124 | + | return cret | |
| 125 | + | } | |
| 126 | + | ||
| 113 | 127 | var xComboRowGetExpression func(uintptr) uintptr | |
| 114 | 128 | ||
| 115 | 129 | // Gets the expression used to obtain strings from items. | |
| @@ -144,6 +158,23 @@ func (x *ComboRow) GetFactory() *gtk.ListItemFactory { | |||
| 144 | 158 | return cls | |
| 145 | 159 | } | |
| 146 | 160 | ||
| 161 | + | var xComboRowGetHeaderFactory func(uintptr) uintptr | |
| 162 | + | ||
| 163 | + | // Gets the factory that's currently used to create header widgets for the popup. | |
| 164 | + | func (x *ComboRow) GetHeaderFactory() *gtk.ListItemFactory { | |
| 165 | + | var cls *gtk.ListItemFactory | |
| 166 | + | ||
| 167 | + | cret := xComboRowGetHeaderFactory(x.GoPointer()) | |
| 168 | + | ||
| 169 | + | if cret == 0 { | |
| 170 | + | return nil | |
| 171 | + | } | |
| 172 | + | gobject.IncreaseRef(cret) | |
| 173 | + | cls = >k.ListItemFactory{} | |
| 174 | + | cls.Ptr = cret | |
| 175 | + | return cls | |
| 176 | + | } | |
| 177 | + | ||
| 147 | 178 | var xComboRowGetListFactory func(uintptr) uintptr | |
| 148 | 179 | ||
| 149 | 180 | // Gets the factory for populating list items in the popup. | |
| @@ -178,6 +209,15 @@ func (x *ComboRow) GetModel() *gio.ListModelBase { | |||
| 178 | 209 | return cls | |
| 179 | 210 | } | |
| 180 | 211 | ||
| 212 | + | var xComboRowGetSearchMatchMode func(uintptr) gtk.StringFilterMatchMode | |
| 213 | + | ||
| 214 | + | // Returns the match mode that the search filter is using. | |
| 215 | + | func (x *ComboRow) GetSearchMatchMode() gtk.StringFilterMatchMode { | |
| 216 | + | ||
| 217 | + | cret := xComboRowGetSearchMatchMode(x.GoPointer()) | |
| 218 | + | return cret | |
| 219 | + | } | |
| 220 | + | ||
| 181 | 221 | var xComboRowGetSelected func(uintptr) uint | |
| 182 | 222 | ||
| 183 | 223 | // Gets the position of the selected item. | |
| @@ -213,6 +253,20 @@ func (x *ComboRow) GetUseSubtitle() bool { | |||
| 213 | 253 | return cret | |
| 214 | 254 | } | |
| 215 | 255 | ||
| 256 | + | var xComboRowSetEnableSearch func(uintptr, bool) | |
| 257 | + | ||
| 258 | + | // Sets whether to enable search. | |
| 259 | + | // | |
| 260 | + | // If set to `TRUE`, a search entry will be shown in the popup that | |
| 261 | + | // allows to search for items in the list. | |
| 262 | + | // | |
| 263 | + | // Search requires [property@ComboRow:expression] to be set. | |
| 264 | + | func (x *ComboRow) SetEnableSearch(EnableSearchVar bool) { | |
| 265 | + | ||
| 266 | + | xComboRowSetEnableSearch(x.GoPointer(), EnableSearchVar) | |
| 267 | + | ||
| 268 | + | } | |
| 269 | + | ||
| 216 | 270 | var xComboRowSetExpression func(uintptr, uintptr) | |
| 217 | 271 | ||
| 218 | 272 | // Sets the expression used to obtain strings from items. | |
| @@ -240,6 +294,15 @@ func (x *ComboRow) SetFactory(FactoryVar *gtk.ListItemFactory) { | |||
| 240 | 294 | ||
| 241 | 295 | } | |
| 242 | 296 | ||
| 297 | + | var xComboRowSetHeaderFactory func(uintptr, uintptr) | |
| 298 | + | ||
| 299 | + | // Sets the factory to use for creating header widgets for the popup. | |
| 300 | + | func (x *ComboRow) SetHeaderFactory(FactoryVar *gtk.ListItemFactory) { | |
| 301 | + | ||
| 302 | + | xComboRowSetHeaderFactory(x.GoPointer(), FactoryVar.GoPointer()) | |
| 303 | + | ||
| 304 | + | } | |
| 305 | + | ||
| 243 | 306 | var xComboRowSetListFactory func(uintptr, uintptr) | |
| 244 | 307 | ||
| 245 | 308 | // Sets the factory for populating list items in the popup. | |
| @@ -260,6 +323,15 @@ func (x *ComboRow) SetModel(ModelVar gio.ListModel) { | |||
| 260 | 323 | ||
| 261 | 324 | } | |
| 262 | 325 | ||
| 326 | + | var xComboRowSetSearchMatchMode func(uintptr, gtk.StringFilterMatchMode) | |
| 327 | + | ||
| 328 | + | // Sets the match mode for the search filter. | |
| 329 | + | func (x *ComboRow) SetSearchMatchMode(SearchMatchModeVar gtk.StringFilterMatchMode) { | |
| 330 | + | ||
| 331 | + | xComboRowSetSearchMatchMode(x.GoPointer(), SearchMatchModeVar) | |
| 332 | + | ||
| 333 | + | } | |
| 334 | + | ||
| 263 | 335 | var xComboRowSetSelected func(uintptr, uint) | |
| 264 | 336 | ||
| 265 | 337 | // Selects the item at the given position. | |
| @@ -530,17 +602,23 @@ func init() { | |||
| 530 | 602 | ||
| 531 | 603 | core.PuregoSafeRegister(&xNewComboRow, lib, "adw_combo_row_new") | |
| 532 | 604 | ||
| 605 | + | core.PuregoSafeRegister(&xComboRowGetEnableSearch, lib, "adw_combo_row_get_enable_search") | |
| 533 | 606 | core.PuregoSafeRegister(&xComboRowGetExpression, lib, "adw_combo_row_get_expression") | |
| 534 | 607 | core.PuregoSafeRegister(&xComboRowGetFactory, lib, "adw_combo_row_get_factory") | |
| 608 | + | core.PuregoSafeRegister(&xComboRowGetHeaderFactory, lib, "adw_combo_row_get_header_factory") | |
| 535 | 609 | core.PuregoSafeRegister(&xComboRowGetListFactory, lib, "adw_combo_row_get_list_factory") | |
| 536 | 610 | core.PuregoSafeRegister(&xComboRowGetModel, lib, "adw_combo_row_get_model") | |
| 611 | + | core.PuregoSafeRegister(&xComboRowGetSearchMatchMode, lib, "adw_combo_row_get_search_match_mode") | |
| 537 | 612 | core.PuregoSafeRegister(&xComboRowGetSelected, lib, "adw_combo_row_get_selected") | |
| 538 | 613 | core.PuregoSafeRegister(&xComboRowGetSelectedItem, lib, "adw_combo_row_get_selected_item") | |
| 539 | 614 | core.PuregoSafeRegister(&xComboRowGetUseSubtitle, lib, "adw_combo_row_get_use_subtitle") | |
| 615 | + | core.PuregoSafeRegister(&xComboRowSetEnableSearch, lib, "adw_combo_row_set_enable_search") | |
| 540 | 616 | core.PuregoSafeRegister(&xComboRowSetExpression, lib, "adw_combo_row_set_expression") | |
| 541 | 617 | core.PuregoSafeRegister(&xComboRowSetFactory, lib, "adw_combo_row_set_factory") | |
| 618 | + | core.PuregoSafeRegister(&xComboRowSetHeaderFactory, lib, "adw_combo_row_set_header_factory") | |
| 542 | 619 | core.PuregoSafeRegister(&xComboRowSetListFactory, lib, "adw_combo_row_set_list_factory") | |
| 543 | 620 | core.PuregoSafeRegister(&xComboRowSetModel, lib, "adw_combo_row_set_model") | |
| 621 | + | core.PuregoSafeRegister(&xComboRowSetSearchMatchMode, lib, "adw_combo_row_set_search_match_mode") | |
| 544 | 622 | core.PuregoSafeRegister(&xComboRowSetSelected, lib, "adw_combo_row_set_selected") | |
| 545 | 623 | core.PuregoSafeRegister(&xComboRowSetUseSubtitle, lib, "adw_combo_row_set_use_subtitle") | |
| 546 | 624 | ||
A v4/adw/adw-dialog.go +665 -0
| @@ -0,0 +1,665 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 13 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 14 | + | ) | |
| 15 | + | ||
| 16 | + | type DialogClass struct { | |
| 17 | + | _ structs.HostLayout | |
| 18 | + | ||
| 19 | + | ParentClass uintptr | |
| 20 | + | ||
| 21 | + | Padding [4]uintptr | |
| 22 | + | } | |
| 23 | + | ||
| 24 | + | func (x *DialogClass) GoPointer() uintptr { | |
| 25 | + | return uintptr(unsafe.Pointer(x)) | |
| 26 | + | } | |
| 27 | + | ||
| 28 | + | // Describes the available presentation modes for [class@Dialog]. | |
| 29 | + | // | |
| 30 | + | // New values may be added to this enumeration over time. | |
| 31 | + | // | |
| 32 | + | // See [property@Dialog:presentation-mode]. | |
| 33 | + | type DialogPresentationMode int | |
| 34 | + | ||
| 35 | + | var xDialogPresentationModeGLibType func() types.GType | |
| 36 | + | ||
| 37 | + | func DialogPresentationModeGLibType() types.GType { | |
| 38 | + | return xDialogPresentationModeGLibType() | |
| 39 | + | } | |
| 40 | + | ||
| 41 | + | const ( | |
| 42 | + | ||
| 43 | + | // Switch between `ADW_DIALOG_FLOATING` and | |
| 44 | + | // `ADW_DIALOG_BOTTOM_SHEET` depending on available size. | |
| 45 | + | DialogAutoValue DialogPresentationMode = 0 | |
| 46 | + | // Present dialog as a centered floating window. | |
| 47 | + | DialogFloatingValue DialogPresentationMode = 1 | |
| 48 | + | // Present dialog as a bottom sheet. | |
| 49 | + | DialogBottomSheetValue DialogPresentationMode = 2 | |
| 50 | + | ) | |
| 51 | + | ||
| 52 | + | // An adaptive dialog container. | |
| 53 | + | // | |
| 54 | + | // <picture> | |
| 55 | + | // | |
| 56 | + | // <source srcset="dialog-floating-dark.png" media="(prefers-color-scheme: dark)"> | |
| 57 | + | // <img src="dialog-floating.png" alt="dialog-floating"> | |
| 58 | + | // | |
| 59 | + | // </picture> | |
| 60 | + | // <picture> | |
| 61 | + | // | |
| 62 | + | // <source srcset="dialog-bottom-dark.png" media="(prefers-color-scheme: dark)"> | |
| 63 | + | // <img src="dialog-bottom.png" alt="dialog-bottom"> | |
| 64 | + | // | |
| 65 | + | // </picture> | |
| 66 | + | // | |
| 67 | + | // `AdwDialog` is similar to a window, but is shown within another window. It | |
| 68 | + | // can be used with [class@Window] and [class@ApplicationWindow], use | |
| 69 | + | // [method@Dialog.present] to show it. | |
| 70 | + | // | |
| 71 | + | // `AdwDialog` is not resizable. Use the [property@Dialog:content-width] and | |
| 72 | + | // [property@Dialog:content-height] properties to set its size, or set | |
| 73 | + | // [property@Dialog:follows-content-size] to `TRUE` to make the dialog track the | |
| 74 | + | // content's size as it changes. `AdwDialog` can never be larger than its parent | |
| 75 | + | // window. | |
| 76 | + | // | |
| 77 | + | // `AdwDialog` can be presented as a centered floating window or a bottom sheet. | |
| 78 | + | // By default it's automatic depending on the available size. | |
| 79 | + | // [property@Dialog:presentation-mode] can be used to change that. | |
| 80 | + | // | |
| 81 | + | // `AdwDialog` can be closed via [method@Dialog.close]. | |
| 82 | + | // | |
| 83 | + | // When presented as a bottom sheet, `AdwDialog` can also be closed via swiping | |
| 84 | + | // it down. | |
| 85 | + | // | |
| 86 | + | // The [property@Dialog:can-close] can be used to prevent closing. In that case, | |
| 87 | + | // [signal@Dialog::close-attempt] gets emitted instead. | |
| 88 | + | // | |
| 89 | + | // Use [method@Dialog.force_close] to close the dialog even when `can-close` is set to | |
| 90 | + | // `FALSE`. | |
| 91 | + | // | |
| 92 | + | // `AdwDialog` is transient and doesn't integrate with the window below it, for | |
| 93 | + | // example it's not possible to collapse it into a bottom bar. See | |
| 94 | + | // [class@BottomSheet] for persistent and more tightly integrated bottom sheets. | |
| 95 | + | // | |
| 96 | + | // ## Header Bar Integration | |
| 97 | + | // | |
| 98 | + | // When placed inside an `AdwDialog`, [class@HeaderBar] will display the dialog | |
| 99 | + | // title instead of window title. It will also adjust the decoration layout to | |
| 100 | + | // ensure it always has a close button and nothing else. Set | |
| 101 | + | // [property@HeaderBar:show-start-title-buttons] and | |
| 102 | + | // [property@HeaderBar:show-end-title-buttons] to `FALSE` to remove it if it's | |
| 103 | + | // unwanted. | |
| 104 | + | // | |
| 105 | + | // ## Breakpoints | |
| 106 | + | // | |
| 107 | + | // `AdwDialog` can be used with [class@Breakpoint] the same way as | |
| 108 | + | // [class@BreakpointBin]. Refer to that widget's documentation for details. | |
| 109 | + | // | |
| 110 | + | // Like `AdwBreakpointBin`, if breakpoints are used, `AdwDialog` doesn't have a | |
| 111 | + | // minimum size, and [property@Gtk.Widget:width-request] and | |
| 112 | + | // [property@Gtk.Widget:height-request] properties must be set manually. | |
| 113 | + | type Dialog struct { | |
| 114 | + | gtk.Widget | |
| 115 | + | } | |
| 116 | + | ||
| 117 | + | var xDialogGLibType func() types.GType | |
| 118 | + | ||
| 119 | + | func DialogGLibType() types.GType { | |
| 120 | + | return xDialogGLibType() | |
| 121 | + | } | |
| 122 | + | ||
| 123 | + | func DialogNewFromInternalPtr(ptr uintptr) *Dialog { | |
| 124 | + | cls := &Dialog{} | |
| 125 | + | cls.Ptr = ptr | |
| 126 | + | return cls | |
| 127 | + | } | |
| 128 | + | ||
| 129 | + | var xNewDialog func() uintptr | |
| 130 | + | ||
| 131 | + | // Creates a new `AdwDialog`. | |
| 132 | + | func NewDialog() *Dialog { | |
| 133 | + | var cls *Dialog | |
| 134 | + | ||
| 135 | + | cret := xNewDialog() | |
| 136 | + | ||
| 137 | + | if cret == 0 { | |
| 138 | + | return nil | |
| 139 | + | } | |
| 140 | + | gobject.IncreaseRef(cret) | |
| 141 | + | cls = &Dialog{} | |
| 142 | + | cls.Ptr = cret | |
| 143 | + | return cls | |
| 144 | + | } | |
| 145 | + | ||
| 146 | + | var xDialogAddBreakpoint func(uintptr, uintptr) | |
| 147 | + | ||
| 148 | + | // Adds @breakpoint to @self. | |
| 149 | + | func (x *Dialog) AddBreakpoint(BreakpointVar *Breakpoint) { | |
| 150 | + | ||
| 151 | + | xDialogAddBreakpoint(x.GoPointer(), BreakpointVar.GoPointer()) | |
| 152 | + | ||
| 153 | + | } | |
| 154 | + | ||
| 155 | + | var xDialogClose func(uintptr) bool | |
| 156 | + | ||
| 157 | + | // Attempts to close @self. | |
| 158 | + | // | |
| 159 | + | // If the [property@Dialog:can-close] property is set to `FALSE`, the | |
| 160 | + | // [signal@Dialog::close-attempt] signal is emitted. | |
| 161 | + | // | |
| 162 | + | // See also: [method@Dialog.force_close]. | |
| 163 | + | func (x *Dialog) Close() bool { | |
| 164 | + | ||
| 165 | + | cret := xDialogClose(x.GoPointer()) | |
| 166 | + | return cret | |
| 167 | + | } | |
| 168 | + | ||
| 169 | + | var xDialogForceClose func(uintptr) | |
| 170 | + | ||
| 171 | + | // Closes @self. | |
| 172 | + | // | |
| 173 | + | // Unlike [method@Dialog.close], it succeeds even if [property@Dialog:can-close] | |
| 174 | + | // is set to `FALSE`. | |
| 175 | + | func (x *Dialog) ForceClose() { | |
| 176 | + | ||
| 177 | + | xDialogForceClose(x.GoPointer()) | |
| 178 | + | ||
| 179 | + | } | |
| 180 | + | ||
| 181 | + | var xDialogGetCanClose func(uintptr) bool | |
| 182 | + | ||
| 183 | + | // Gets whether @self can be closed. | |
| 184 | + | func (x *Dialog) GetCanClose() bool { | |
| 185 | + | ||
| 186 | + | cret := xDialogGetCanClose(x.GoPointer()) | |
| 187 | + | return cret | |
| 188 | + | } | |
| 189 | + | ||
| 190 | + | var xDialogGetChild func(uintptr) uintptr | |
| 191 | + | ||
| 192 | + | // Gets the child widget of @self. | |
| 193 | + | func (x *Dialog) GetChild() *gtk.Widget { | |
| 194 | + | var cls *gtk.Widget | |
| 195 | + | ||
| 196 | + | cret := xDialogGetChild(x.GoPointer()) | |
| 197 | + | ||
| 198 | + | if cret == 0 { | |
| 199 | + | return nil | |
| 200 | + | } | |
| 201 | + | gobject.IncreaseRef(cret) | |
| 202 | + | cls = >k.Widget{} | |
| 203 | + | cls.Ptr = cret | |
| 204 | + | return cls | |
| 205 | + | } | |
| 206 | + | ||
| 207 | + | var xDialogGetContentHeight func(uintptr) int | |
| 208 | + | ||
| 209 | + | // Gets the height of the dialog's contents. | |
| 210 | + | func (x *Dialog) GetContentHeight() int { | |
| 211 | + | ||
| 212 | + | cret := xDialogGetContentHeight(x.GoPointer()) | |
| 213 | + | return cret | |
| 214 | + | } | |
| 215 | + | ||
| 216 | + | var xDialogGetContentWidth func(uintptr) int | |
| 217 | + | ||
| 218 | + | // Gets the width of the dialog's contents. | |
| 219 | + | func (x *Dialog) GetContentWidth() int { | |
| 220 | + | ||
| 221 | + | cret := xDialogGetContentWidth(x.GoPointer()) | |
| 222 | + | return cret | |
| 223 | + | } | |
| 224 | + | ||
| 225 | + | var xDialogGetCurrentBreakpoint func(uintptr) uintptr | |
| 226 | + | ||
| 227 | + | // Gets the current breakpoint. | |
| 228 | + | func (x *Dialog) GetCurrentBreakpoint() *Breakpoint { | |
| 229 | + | var cls *Breakpoint | |
| 230 | + | ||
| 231 | + | cret := xDialogGetCurrentBreakpoint(x.GoPointer()) | |
| 232 | + | ||
| 233 | + | if cret == 0 { | |
| 234 | + | return nil | |
| 235 | + | } | |
| 236 | + | gobject.IncreaseRef(cret) | |
| 237 | + | cls = &Breakpoint{} | |
| 238 | + | cls.Ptr = cret | |
| 239 | + | return cls | |
| 240 | + | } | |
| 241 | + | ||
| 242 | + | var xDialogGetDefaultWidget func(uintptr) uintptr | |
| 243 | + | ||
| 244 | + | // Gets the default widget for @self. | |
| 245 | + | func (x *Dialog) GetDefaultWidget() *gtk.Widget { | |
| 246 | + | var cls *gtk.Widget | |
| 247 | + | ||
| 248 | + | cret := xDialogGetDefaultWidget(x.GoPointer()) | |
| 249 | + | ||
| 250 | + | if cret == 0 { | |
| 251 | + | return nil | |
| 252 | + | } | |
| 253 | + | gobject.IncreaseRef(cret) | |
| 254 | + | cls = >k.Widget{} | |
| 255 | + | cls.Ptr = cret | |
| 256 | + | return cls | |
| 257 | + | } | |
| 258 | + | ||
| 259 | + | var xDialogGetFocus func(uintptr) uintptr | |
| 260 | + | ||
| 261 | + | // Gets the focus widget for @self. | |
| 262 | + | func (x *Dialog) GetFocus() *gtk.Widget { | |
| 263 | + | var cls *gtk.Widget | |
| 264 | + | ||
| 265 | + | cret := xDialogGetFocus(x.GoPointer()) | |
| 266 | + | ||
| 267 | + | if cret == 0 { | |
| 268 | + | return nil | |
| 269 | + | } | |
| 270 | + | gobject.IncreaseRef(cret) | |
| 271 | + | cls = >k.Widget{} | |
| 272 | + | cls.Ptr = cret | |
| 273 | + | return cls | |
| 274 | + | } | |
| 275 | + | ||
| 276 | + | var xDialogGetFollowsContentSize func(uintptr) bool | |
| 277 | + | ||
| 278 | + | // Gets whether to size content of @self automatically. | |
| 279 | + | func (x *Dialog) GetFollowsContentSize() bool { | |
| 280 | + | ||
| 281 | + | cret := xDialogGetFollowsContentSize(x.GoPointer()) | |
| 282 | + | return cret | |
| 283 | + | } | |
| 284 | + | ||
| 285 | + | var xDialogGetPresentationMode func(uintptr) DialogPresentationMode | |
| 286 | + | ||
| 287 | + | // Gets presentation mode for @self. | |
| 288 | + | func (x *Dialog) GetPresentationMode() DialogPresentationMode { | |
| 289 | + | ||
| 290 | + | cret := xDialogGetPresentationMode(x.GoPointer()) | |
| 291 | + | return cret | |
| 292 | + | } | |
| 293 | + | ||
| 294 | + | var xDialogGetTitle func(uintptr) string | |
| 295 | + | ||
| 296 | + | // Gets the title of @self. | |
| 297 | + | func (x *Dialog) GetTitle() string { | |
| 298 | + | ||
| 299 | + | cret := xDialogGetTitle(x.GoPointer()) | |
| 300 | + | return cret | |
| 301 | + | } | |
| 302 | + | ||
| 303 | + | var xDialogPresent func(uintptr, uintptr) | |
| 304 | + | ||
| 305 | + | // Presents @self within @parent's window. | |
| 306 | + | // | |
| 307 | + | // If @self is already shown, raises it to the top instead. | |
| 308 | + | // | |
| 309 | + | // If the window is an [class@Window] or [class@ApplicationWindow], the dialog | |
| 310 | + | // will be shown within it. Otherwise, it will be a separate window. | |
| 311 | + | func (x *Dialog) Present(ParentVar *gtk.Widget) { | |
| 312 | + | ||
| 313 | + | xDialogPresent(x.GoPointer(), ParentVar.GoPointer()) | |
| 314 | + | ||
| 315 | + | } | |
| 316 | + | ||
| 317 | + | var xDialogSetCanClose func(uintptr, bool) | |
| 318 | + | ||
| 319 | + | // Sets whether @self can be closed. | |
| 320 | + | // | |
| 321 | + | // If set to `FALSE`, the close button, shortcuts and | |
| 322 | + | // [method@Dialog.close] will result in [signal@Dialog::close-attempt] being | |
| 323 | + | // emitted instead, and bottom sheet close swipe will be disabled. | |
| 324 | + | // [method@Dialog.force_close] still works. | |
| 325 | + | func (x *Dialog) SetCanClose(CanCloseVar bool) { | |
| 326 | + | ||
| 327 | + | xDialogSetCanClose(x.GoPointer(), CanCloseVar) | |
| 328 | + | ||
| 329 | + | } | |
| 330 | + | ||
| 331 | + | var xDialogSetChild func(uintptr, uintptr) | |
| 332 | + | ||
| 333 | + | // Sets the child widget of @self. | |
| 334 | + | func (x *Dialog) SetChild(ChildVar *gtk.Widget) { | |
| 335 | + | ||
| 336 | + | xDialogSetChild(x.GoPointer(), ChildVar.GoPointer()) | |
| 337 | + | ||
| 338 | + | } | |
| 339 | + | ||
| 340 | + | var xDialogSetContentHeight func(uintptr, int) | |
| 341 | + | ||
| 342 | + | // Sets the height of the dialog's contents. | |
| 343 | + | // | |
| 344 | + | // Set it to -1 to reset it to the content's natural height. | |
| 345 | + | // | |
| 346 | + | // See also: [property@Gtk.Window:default-height] | |
| 347 | + | func (x *Dialog) SetContentHeight(ContentHeightVar int) { | |
| 348 | + | ||
| 349 | + | xDialogSetContentHeight(x.GoPointer(), ContentHeightVar) | |
| 350 | + | ||
| 351 | + | } | |
| 352 | + | ||
| 353 | + | var xDialogSetContentWidth func(uintptr, int) | |
| 354 | + | ||
| 355 | + | // Sets the width of the dialog's contents. | |
| 356 | + | // | |
| 357 | + | // Set it to -1 to reset it to the content's natural width. | |
| 358 | + | // | |
| 359 | + | // See also: [property@Gtk.Window:default-width] | |
| 360 | + | func (x *Dialog) SetContentWidth(ContentWidthVar int) { | |
| 361 | + | ||
| 362 | + | xDialogSetContentWidth(x.GoPointer(), ContentWidthVar) | |
| 363 | + | ||
| 364 | + | } | |
| 365 | + | ||
| 366 | + | var xDialogSetDefaultWidget func(uintptr, uintptr) | |
| 367 | + | ||
| 368 | + | // Sets the default widget for @self. | |
| 369 | + | // | |
| 370 | + | // It's activated when the user presses Enter. | |
| 371 | + | func (x *Dialog) SetDefaultWidget(DefaultWidgetVar *gtk.Widget) { | |
| 372 | + | ||
| 373 | + | xDialogSetDefaultWidget(x.GoPointer(), DefaultWidgetVar.GoPointer()) | |
| 374 | + | ||
| 375 | + | } | |
| 376 | + | ||
| 377 | + | var xDialogSetFocus func(uintptr, uintptr) | |
| 378 | + | ||
| 379 | + | // Sets the focus widget for @self. | |
| 380 | + | // | |
| 381 | + | // If @focus is not the current focus widget, and is focusable, sets it as the | |
| 382 | + | // focus widget for the dialog. | |
| 383 | + | // | |
| 384 | + | // If focus is `NULL`, unsets the focus widget for this dialog. To set the focus | |
| 385 | + | // to a particular widget in the dialog, it is usually more convenient to use | |
| 386 | + | // [method@Gtk.Widget.grab_focus] instead of this function. | |
| 387 | + | func (x *Dialog) SetFocus(FocusVar *gtk.Widget) { | |
| 388 | + | ||
| 389 | + | xDialogSetFocus(x.GoPointer(), FocusVar.GoPointer()) | |
| 390 | + | ||
| 391 | + | } | |
| 392 | + | ||
| 393 | + | var xDialogSetFollowsContentSize func(uintptr, bool) | |
| 394 | + | ||
| 395 | + | // Sets whether to size content of @self automatically. | |
| 396 | + | // | |
| 397 | + | // If set to `TRUE`, always use the content's natural size instead of | |
| 398 | + | // [property@Dialog:content-width] and [property@Dialog:content-height]. If | |
| 399 | + | // the content resizes, the dialog will immediately resize as well. | |
| 400 | + | // | |
| 401 | + | // See also: [property@Gtk.Window:resizable] | |
| 402 | + | func (x *Dialog) SetFollowsContentSize(FollowsContentSizeVar bool) { | |
| 403 | + | ||
| 404 | + | xDialogSetFollowsContentSize(x.GoPointer(), FollowsContentSizeVar) | |
| 405 | + | ||
| 406 | + | } | |
| 407 | + | ||
| 408 | + | var xDialogSetPresentationMode func(uintptr, DialogPresentationMode) | |
| 409 | + | ||
| 410 | + | // Sets presentation mode for @self. | |
| 411 | + | // | |
| 412 | + | // When set to `ADW_DIALOG_AUTO`, the dialog appears as a bottom sheet when the | |
| 413 | + | // following condition is met: `max-width: 450px or max-height: 360px`, and as a | |
| 414 | + | // floating window otherwise. | |
| 415 | + | // | |
| 416 | + | // Set it to `ADW_DIALOG_FLOATING` or `ADW_DIALOG_BOTTOM_SHEET` to always | |
| 417 | + | // present it a floating window or a bottom sheet respectively, regardless of | |
| 418 | + | // available size. | |
| 419 | + | // | |
| 420 | + | // Presentation mode does nothing for dialogs presented as a window. | |
| 421 | + | func (x *Dialog) SetPresentationMode(PresentationModeVar DialogPresentationMode) { | |
| 422 | + | ||
| 423 | + | xDialogSetPresentationMode(x.GoPointer(), PresentationModeVar) | |
| 424 | + | ||
| 425 | + | } | |
| 426 | + | ||
| 427 | + | var xDialogSetTitle func(uintptr, string) | |
| 428 | + | ||
| 429 | + | // Sets the title of @self. | |
| 430 | + | func (x *Dialog) SetTitle(TitleVar string) { | |
| 431 | + | ||
| 432 | + | xDialogSetTitle(x.GoPointer(), TitleVar) | |
| 433 | + | ||
| 434 | + | } | |
| 435 | + | ||
| 436 | + | func (c *Dialog) GoPointer() uintptr { | |
| 437 | + | return c.Ptr | |
| 438 | + | } | |
| 439 | + | ||
| 440 | + | func (c *Dialog) SetGoPointer(ptr uintptr) { | |
| 441 | + | c.Ptr = ptr | |
| 442 | + | } | |
| 443 | + | ||
| 444 | + | // Emitted when the close button or shortcut is used, or | |
| 445 | + | // [method@Dialog.close] is called while [property@Dialog:can-close] is set to | |
| 446 | + | // `FALSE`. | |
| 447 | + | func (x *Dialog) ConnectCloseAttempt(cb *func(Dialog)) uint32 { | |
| 448 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 449 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 450 | + | return gobject.SignalConnect(x.GoPointer(), "close-attempt", cbRefPtr) | |
| 451 | + | } | |
| 452 | + | ||
| 453 | + | fcb := func(clsPtr uintptr) { | |
| 454 | + | fa := Dialog{} | |
| 455 | + | fa.Ptr = clsPtr | |
| 456 | + | cbFn := *cb | |
| 457 | + | ||
| 458 | + | cbFn(fa) | |
| 459 | + | ||
| 460 | + | } | |
| 461 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 462 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 463 | + | return gobject.SignalConnect(x.GoPointer(), "close-attempt", cbRefPtr) | |
| 464 | + | } | |
| 465 | + | ||
| 466 | + | // Emitted when the dialog is successfully closed. | |
| 467 | + | func (x *Dialog) ConnectClosed(cb *func(Dialog)) uint32 { | |
| 468 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 469 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 470 | + | return gobject.SignalConnect(x.GoPointer(), "closed", cbRefPtr) | |
| 471 | + | } | |
| 472 | + | ||
| 473 | + | fcb := func(clsPtr uintptr) { | |
| 474 | + | fa := Dialog{} | |
| 475 | + | fa.Ptr = clsPtr | |
| 476 | + | cbFn := *cb | |
| 477 | + | ||
| 478 | + | cbFn(fa) | |
| 479 | + | ||
| 480 | + | } | |
| 481 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 482 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 483 | + | return gobject.SignalConnect(x.GoPointer(), "closed", cbRefPtr) | |
| 484 | + | } | |
| 485 | + | ||
| 486 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 487 | + | func (x *Dialog) GetAccessibleRole() gtk.AccessibleRole { | |
| 488 | + | ||
| 489 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 490 | + | return cret | |
| 491 | + | } | |
| 492 | + | ||
| 493 | + | // Resets the accessible @property to its default value. | |
| 494 | + | func (x *Dialog) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 495 | + | ||
| 496 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 497 | + | ||
| 498 | + | } | |
| 499 | + | ||
| 500 | + | // Resets the accessible @relation to its default value. | |
| 501 | + | func (x *Dialog) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 502 | + | ||
| 503 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 504 | + | ||
| 505 | + | } | |
| 506 | + | ||
| 507 | + | // Resets the accessible @state to its default value. | |
| 508 | + | func (x *Dialog) ResetState(StateVar gtk.AccessibleState) { | |
| 509 | + | ||
| 510 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 511 | + | ||
| 512 | + | } | |
| 513 | + | ||
| 514 | + | // Updates a list of accessible properties. | |
| 515 | + | // | |
| 516 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 517 | + | // value types of accessible properties. | |
| 518 | + | // | |
| 519 | + | // This function should be called by `GtkWidget` types whenever | |
| 520 | + | // an accessible property change must be communicated to assistive | |
| 521 | + | // technologies. | |
| 522 | + | // | |
| 523 | + | // Example: | |
| 524 | + | // ```c | |
| 525 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 526 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 527 | + | // | |
| 528 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 529 | + | // -1); | |
| 530 | + | // | |
| 531 | + | // ``` | |
| 532 | + | func (x *Dialog) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 533 | + | ||
| 534 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 535 | + | ||
| 536 | + | } | |
| 537 | + | ||
| 538 | + | // Updates an array of accessible properties. | |
| 539 | + | // | |
| 540 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 541 | + | // property change must be communicated to assistive technologies. | |
| 542 | + | // | |
| 543 | + | // This function is meant to be used by language bindings. | |
| 544 | + | func (x *Dialog) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 545 | + | ||
| 546 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 547 | + | ||
| 548 | + | } | |
| 549 | + | ||
| 550 | + | // Updates a list of accessible relations. | |
| 551 | + | // | |
| 552 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 553 | + | // relation change must be communicated to assistive technologies. | |
| 554 | + | // | |
| 555 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 556 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 557 | + | // | |
| 558 | + | // ```c | |
| 559 | + | // gtk_accessible_update_relation (accessible, | |
| 560 | + | // | |
| 561 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 562 | + | // ref1, NULL, | |
| 563 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 564 | + | // ref1, ref2, ref3, NULL, | |
| 565 | + | // -1); | |
| 566 | + | // | |
| 567 | + | // ``` | |
| 568 | + | func (x *Dialog) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 569 | + | ||
| 570 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 571 | + | ||
| 572 | + | } | |
| 573 | + | ||
| 574 | + | // Updates an array of accessible relations. | |
| 575 | + | // | |
| 576 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 577 | + | // relation change must be communicated to assistive technologies. | |
| 578 | + | // | |
| 579 | + | // This function is meant to be used by language bindings. | |
| 580 | + | func (x *Dialog) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 581 | + | ||
| 582 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 583 | + | ||
| 584 | + | } | |
| 585 | + | ||
| 586 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 587 | + | // documentation for the value types of accessible states. | |
| 588 | + | // | |
| 589 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 590 | + | // state change must be communicated to assistive technologies. | |
| 591 | + | // | |
| 592 | + | // Example: | |
| 593 | + | // ```c | |
| 594 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 595 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 596 | + | // | |
| 597 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 598 | + | // -1); | |
| 599 | + | // | |
| 600 | + | // ``` | |
| 601 | + | func (x *Dialog) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 602 | + | ||
| 603 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 604 | + | ||
| 605 | + | } | |
| 606 | + | ||
| 607 | + | // Updates an array of accessible states. | |
| 608 | + | // | |
| 609 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 610 | + | // state change must be communicated to assistive technologies. | |
| 611 | + | // | |
| 612 | + | // This function is meant to be used by language bindings. | |
| 613 | + | func (x *Dialog) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 614 | + | ||
| 615 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 616 | + | ||
| 617 | + | } | |
| 618 | + | ||
| 619 | + | // Gets the ID of the @buildable object. | |
| 620 | + | // | |
| 621 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 622 | + | // of the <object> tag used to construct the @buildable. | |
| 623 | + | func (x *Dialog) GetBuildableId() string { | |
| 624 | + | ||
| 625 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 626 | + | return cret | |
| 627 | + | } | |
| 628 | + | ||
| 629 | + | func init() { | |
| 630 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 631 | + | if err != nil { | |
| 632 | + | panic(err) | |
| 633 | + | } | |
| 634 | + | ||
| 635 | + | core.PuregoSafeRegister(&xDialogPresentationModeGLibType, lib, "adw_dialog_presentation_mode_get_type") | |
| 636 | + | ||
| 637 | + | core.PuregoSafeRegister(&xDialogGLibType, lib, "adw_dialog_get_type") | |
| 638 | + | ||
| 639 | + | core.PuregoSafeRegister(&xNewDialog, lib, "adw_dialog_new") | |
| 640 | + | ||
| 641 | + | core.PuregoSafeRegister(&xDialogAddBreakpoint, lib, "adw_dialog_add_breakpoint") | |
| 642 | + | core.PuregoSafeRegister(&xDialogClose, lib, "adw_dialog_close") | |
| 643 | + | core.PuregoSafeRegister(&xDialogForceClose, lib, "adw_dialog_force_close") | |
| 644 | + | core.PuregoSafeRegister(&xDialogGetCanClose, lib, "adw_dialog_get_can_close") | |
| 645 | + | core.PuregoSafeRegister(&xDialogGetChild, lib, "adw_dialog_get_child") | |
| 646 | + | core.PuregoSafeRegister(&xDialogGetContentHeight, lib, "adw_dialog_get_content_height") | |
| 647 | + | core.PuregoSafeRegister(&xDialogGetContentWidth, lib, "adw_dialog_get_content_width") | |
| 648 | + | core.PuregoSafeRegister(&xDialogGetCurrentBreakpoint, lib, "adw_dialog_get_current_breakpoint") | |
| 649 | + | core.PuregoSafeRegister(&xDialogGetDefaultWidget, lib, "adw_dialog_get_default_widget") | |
| 650 | + | core.PuregoSafeRegister(&xDialogGetFocus, lib, "adw_dialog_get_focus") | |
| 651 | + | core.PuregoSafeRegister(&xDialogGetFollowsContentSize, lib, "adw_dialog_get_follows_content_size") | |
| 652 | + | core.PuregoSafeRegister(&xDialogGetPresentationMode, lib, "adw_dialog_get_presentation_mode") | |
| 653 | + | core.PuregoSafeRegister(&xDialogGetTitle, lib, "adw_dialog_get_title") | |
| 654 | + | core.PuregoSafeRegister(&xDialogPresent, lib, "adw_dialog_present") | |
| 655 | + | core.PuregoSafeRegister(&xDialogSetCanClose, lib, "adw_dialog_set_can_close") | |
| 656 | + | core.PuregoSafeRegister(&xDialogSetChild, lib, "adw_dialog_set_child") | |
| 657 | + | core.PuregoSafeRegister(&xDialogSetContentHeight, lib, "adw_dialog_set_content_height") | |
| 658 | + | core.PuregoSafeRegister(&xDialogSetContentWidth, lib, "adw_dialog_set_content_width") | |
| 659 | + | core.PuregoSafeRegister(&xDialogSetDefaultWidget, lib, "adw_dialog_set_default_widget") | |
| 660 | + | core.PuregoSafeRegister(&xDialogSetFocus, lib, "adw_dialog_set_focus") | |
| 661 | + | core.PuregoSafeRegister(&xDialogSetFollowsContentSize, lib, "adw_dialog_set_follows_content_size") | |
| 662 | + | core.PuregoSafeRegister(&xDialogSetPresentationMode, lib, "adw_dialog_set_presentation_mode") | |
| 663 | + | core.PuregoSafeRegister(&xDialogSetTitle, lib, "adw_dialog_set_title") | |
| 664 | + | ||
| 665 | + | } | |
M v4/adw/adw-entry-row.go +30 -0
| @@ -156,6 +156,15 @@ func (x *EntryRow) GetInputPurpose() gtk.InputPurpose { | |||
| 156 | 156 | return cret | |
| 157 | 157 | } | |
| 158 | 158 | ||
| 159 | + | var xEntryRowGetMaxLength func(uintptr) int | |
| 160 | + | ||
| 161 | + | // Retrieves the maximum length of the entry. | |
| 162 | + | func (x *EntryRow) GetMaxLength() int { | |
| 163 | + | ||
| 164 | + | cret := xEntryRowGetMaxLength(x.GoPointer()) | |
| 165 | + | return cret | |
| 166 | + | } | |
| 167 | + | ||
| 159 | 168 | var xEntryRowGetShowApplyButton func(uintptr) bool | |
| 160 | 169 | ||
| 161 | 170 | // Gets whether @self can show the apply button. | |
| @@ -165,6 +174,15 @@ func (x *EntryRow) GetShowApplyButton() bool { | |||
| 165 | 174 | return cret | |
| 166 | 175 | } | |
| 167 | 176 | ||
| 177 | + | var xEntryRowGetTextLength func(uintptr) uint | |
| 178 | + | ||
| 179 | + | // Retrieves the current length of the text in @self. | |
| 180 | + | func (x *EntryRow) GetTextLength() uint { | |
| 181 | + | ||
| 182 | + | cret := xEntryRowGetTextLength(x.GoPointer()) | |
| 183 | + | return cret | |
| 184 | + | } | |
| 185 | + | ||
| 168 | 186 | var xEntryRowGrabFocusWithoutSelecting func(uintptr) bool | |
| 169 | 187 | ||
| 170 | 188 | // Causes @self to have keyboard focus without selecting the text. | |
| @@ -241,6 +259,15 @@ func (x *EntryRow) SetInputPurpose(PurposeVar gtk.InputPurpose) { | |||
| 241 | 259 | ||
| 242 | 260 | } | |
| 243 | 261 | ||
| 262 | + | var xEntryRowSetMaxLength func(uintptr, int) | |
| 263 | + | ||
| 264 | + | // Sets the maximum length of the entry. | |
| 265 | + | func (x *EntryRow) SetMaxLength(MaxLengthVar int) { | |
| 266 | + | ||
| 267 | + | xEntryRowSetMaxLength(x.GoPointer(), MaxLengthVar) | |
| 268 | + | ||
| 269 | + | } | |
| 270 | + | ||
| 244 | 271 | var xEntryRowSetShowApplyButton func(uintptr, bool) | |
| 245 | 272 | ||
| 246 | 273 | // Sets whether @self can show the apply button. | |
| @@ -793,7 +820,9 @@ func init() { | |||
| 793 | 820 | core.PuregoSafeRegister(&xEntryRowGetEnableEmojiCompletion, lib, "adw_entry_row_get_enable_emoji_completion") | |
| 794 | 821 | core.PuregoSafeRegister(&xEntryRowGetInputHints, lib, "adw_entry_row_get_input_hints") | |
| 795 | 822 | core.PuregoSafeRegister(&xEntryRowGetInputPurpose, lib, "adw_entry_row_get_input_purpose") | |
| 823 | + | core.PuregoSafeRegister(&xEntryRowGetMaxLength, lib, "adw_entry_row_get_max_length") | |
| 796 | 824 | core.PuregoSafeRegister(&xEntryRowGetShowApplyButton, lib, "adw_entry_row_get_show_apply_button") | |
| 825 | + | core.PuregoSafeRegister(&xEntryRowGetTextLength, lib, "adw_entry_row_get_text_length") | |
| 797 | 826 | core.PuregoSafeRegister(&xEntryRowGrabFocusWithoutSelecting, lib, "adw_entry_row_grab_focus_without_selecting") | |
| 798 | 827 | core.PuregoSafeRegister(&xEntryRowRemove, lib, "adw_entry_row_remove") | |
| 799 | 828 | core.PuregoSafeRegister(&xEntryRowSetActivatesDefault, lib, "adw_entry_row_set_activates_default") | |
| @@ -801,6 +830,7 @@ func init() { | |||
| 801 | 830 | core.PuregoSafeRegister(&xEntryRowSetEnableEmojiCompletion, lib, "adw_entry_row_set_enable_emoji_completion") | |
| 802 | 831 | core.PuregoSafeRegister(&xEntryRowSetInputHints, lib, "adw_entry_row_set_input_hints") | |
| 803 | 832 | core.PuregoSafeRegister(&xEntryRowSetInputPurpose, lib, "adw_entry_row_set_input_purpose") | |
| 833 | + | core.PuregoSafeRegister(&xEntryRowSetMaxLength, lib, "adw_entry_row_set_max_length") | |
| 804 | 834 | core.PuregoSafeRegister(&xEntryRowSetShowApplyButton, lib, "adw_entry_row_set_show_apply_button") | |
| 805 | 835 | ||
| 806 | 836 | } | |
M v4/adw/adw-enum-list-model.go +2 -0
| @@ -122,6 +122,8 @@ func NewEnumListModel(EnumTypeVar types.GType) *EnumListModel { | |||
| 122 | 122 | var xEnumListModelFindPosition func(uintptr, int) uint | |
| 123 | 123 | ||
| 124 | 124 | // Finds the position of a given enum value in @self. | |
| 125 | + | // | |
| 126 | + | // If the value is not found, `GTK_INVALID_LIST_POSITION` is returned. | |
| 125 | 127 | func (x *EnumListModel) FindPosition(ValueVar int) uint { | |
| 126 | 128 | ||
| 127 | 129 | cret := xEnumListModelFindPosition(x.GoPointer(), ValueVar) | |
M v4/adw/adw-expander-row.go +25 -5
| @@ -41,7 +41,7 @@ func (x *ExpanderRowClass) GoPointer() uintptr { | |||
| 41 | 41 | // ## AdwExpanderRow as GtkBuildable | |
| 42 | 42 | // | |
| 43 | 43 | // The `AdwExpanderRow` implementation of the [iface@Gtk.Buildable] interface | |
| 44 | - | // supports adding a child as an action widget by specifying “action” as the | |
| 44 | + | // supports adding a child as an suffix widget by specifying “suffix” as the | |
| 45 | 45 | // “type” attribute of a <child> element. | |
| 46 | 46 | // | |
| 47 | 47 | // It also supports adding it as a prefix widget by specifying “prefix” as the | |
| @@ -55,6 +55,15 @@ func (x *ExpanderRowClass) GoPointer() uintptr { | |||
| 55 | 55 | // It contains the subnodes `row.header` for its main embedded row, | |
| 56 | 56 | // `list.nested` for the list it can expand, and `image.expander-row-arrow` for | |
| 57 | 57 | // its arrow. | |
| 58 | + | // | |
| 59 | + | // ## Style classes | |
| 60 | + | // | |
| 61 | + | // `AdwExpanderRow` can use the [`.`](style-classes.html#property-rows) | |
| 62 | + | // style class to emphasize the row subtitle instead of the row title, which is | |
| 63 | + | // useful for displaying read-only properties. | |
| 64 | + | // | |
| 65 | + | // When used together with the `.monospace` style class, only the subtitle | |
| 66 | + | // becomes monospace, not the title or any extra widgets. | |
| 58 | 67 | type ExpanderRow struct { | |
| 59 | 68 | PreferencesRow | |
| 60 | 69 | } | |
| @@ -117,6 +126,15 @@ func (x *ExpanderRow) AddRow(ChildVar *gtk.Widget) { | |||
| 117 | 126 | ||
| 118 | 127 | } | |
| 119 | 128 | ||
| 129 | + | var xExpanderRowAddSuffix func(uintptr, uintptr) | |
| 130 | + | ||
| 131 | + | // Adds an suffix widget to @self. | |
| 132 | + | func (x *ExpanderRow) AddSuffix(WidgetVar *gtk.Widget) { | |
| 133 | + | ||
| 134 | + | xExpanderRowAddSuffix(x.GoPointer(), WidgetVar.GoPointer()) | |
| 135 | + | ||
| 136 | + | } | |
| 137 | + | ||
| 120 | 138 | var xExpanderRowGetEnableExpansion func(uintptr) bool | |
| 121 | 139 | ||
| 122 | 140 | // Gets whether the expansion of @self is enabled. | |
| @@ -162,21 +180,21 @@ func (x *ExpanderRow) GetSubtitle() string { | |||
| 162 | 180 | return cret | |
| 163 | 181 | } | |
| 164 | 182 | ||
| 165 | - | var xExpanderRowGetSubtitleLines func(uintptr) bool | |
| 183 | + | var xExpanderRowGetSubtitleLines func(uintptr) int | |
| 166 | 184 | ||
| 167 | 185 | // Gets the number of lines at the end of which the subtitle label will be | |
| 168 | 186 | // ellipsized. | |
| 169 | - | func (x *ExpanderRow) GetSubtitleLines() bool { | |
| 187 | + | func (x *ExpanderRow) GetSubtitleLines() int { | |
| 170 | 188 | ||
| 171 | 189 | cret := xExpanderRowGetSubtitleLines(x.GoPointer()) | |
| 172 | 190 | return cret | |
| 173 | 191 | } | |
| 174 | 192 | ||
| 175 | - | var xExpanderRowGetTitleLines func(uintptr) bool | |
| 193 | + | var xExpanderRowGetTitleLines func(uintptr) int | |
| 176 | 194 | ||
| 177 | 195 | // Gets the number of lines at the end of which the title label will be | |
| 178 | 196 | // ellipsized. | |
| 179 | - | func (x *ExpanderRow) GetTitleLines() bool { | |
| 197 | + | func (x *ExpanderRow) GetTitleLines() int { | |
| 180 | 198 | ||
| 181 | 199 | cret := xExpanderRowGetTitleLines(x.GoPointer()) | |
| 182 | 200 | return cret | |
| @@ -184,6 +202,7 @@ func (x *ExpanderRow) GetTitleLines() bool { | |||
| 184 | 202 | ||
| 185 | 203 | var xExpanderRowRemove func(uintptr, uintptr) | |
| 186 | 204 | ||
| 205 | + | // Removes a child from @self. | |
| 187 | 206 | func (x *ExpanderRow) Remove(ChildVar *gtk.Widget) { | |
| 188 | 207 | ||
| 189 | 208 | xExpanderRowRemove(x.GoPointer(), ChildVar.GoPointer()) | |
| @@ -509,6 +528,7 @@ func init() { | |||
| 509 | 528 | core.PuregoSafeRegister(&xExpanderRowAddAction, lib, "adw_expander_row_add_action") | |
| 510 | 529 | core.PuregoSafeRegister(&xExpanderRowAddPrefix, lib, "adw_expander_row_add_prefix") | |
| 511 | 530 | core.PuregoSafeRegister(&xExpanderRowAddRow, lib, "adw_expander_row_add_row") | |
| 531 | + | core.PuregoSafeRegister(&xExpanderRowAddSuffix, lib, "adw_expander_row_add_suffix") | |
| 512 | 532 | core.PuregoSafeRegister(&xExpanderRowGetEnableExpansion, lib, "adw_expander_row_get_enable_expansion") | |
| 513 | 533 | core.PuregoSafeRegister(&xExpanderRowGetExpanded, lib, "adw_expander_row_get_expanded") | |
| 514 | 534 | core.PuregoSafeRegister(&xExpanderRowGetIconName, lib, "adw_expander_row_get_icon_name") | |
M v4/adw/adw-flap.go +0 -2
| @@ -49,8 +49,6 @@ const ( | |||
| 49 | 49 | // It determines the type of animation when transitioning between children in a | |
| 50 | 50 | // [class@Flap] widget, as well as which areas can be swiped via | |
| 51 | 51 | // [property@Flap:swipe-to-open] and [property@Flap:swipe-to-close]. | |
| 52 | - | // | |
| 53 | - | // New values may be added to this enum over time. | |
| 54 | 52 | type FlapTransitionType int | |
| 55 | 53 | ||
| 56 | 54 | var xFlapTransitionTypeGLibType func() types.GType | |
M v4/adw/adw-header-bar.go +96 -47
| @@ -49,56 +49,55 @@ const ( | |||
| 49 | 49 | // </picture> | |
| 50 | 50 | // | |
| 51 | 51 | // `AdwHeaderBar` is similar to [class@Gtk.HeaderBar], but provides additional | |
| 52 | - | // features compared to it. Refer to `GtkHeaderBar` for details. | |
| 52 | + | // features compared to it. Refer to `GtkHeaderBar` for details. It is typically | |
| 53 | + | // used as a top bar within [class@ToolbarView]. | |
| 53 | 54 | // | |
| 54 | - | // [property@HeaderBar:centering-policy] allows to enforce strict centering of | |
| 55 | - | // the title widget, this is useful for [class@ViewSwitcherTitle]. | |
| 55 | + | // ## Dialog Integration | |
| 56 | 56 | // | |
| 57 | + | // When placed inside an [class@Dialog], `AdwHeaderBar` will display the dialog | |
| 58 | + | // title instead of window title. It will also adjust the decoration layout to | |
| 59 | + | // ensure it always has a close button and nothing else. Set | |
| 57 | 60 | // [property@HeaderBar:show-start-title-buttons] and | |
| 58 | - | // [property@HeaderBar:show-end-title-buttons] allow to easily create split | |
| 59 | - | // header bar layouts using [class@Leaflet], as follows: | |
| 61 | + | // [property@HeaderBar:show-end-title-buttons] to `FALSE` to remove it if it's | |
| 62 | + | // unwanted. | |
| 60 | 63 | // | |
| 61 | - | // ```xml | |
| 62 | - | // <object class="AdwLeaflet" id="leaflet"> | |
| 63 | - | // | |
| 64 | - | // <child> | |
| 65 | - | // <object class="GtkBox"> | |
| 66 | - | // <property name="orientation">vertical</property> | |
| 67 | - | // <child> | |
| 68 | - | // <object class="AdwHeaderBar"> | |
| 69 | - | // <binding name="show-end-title-buttons"> | |
| 70 | - | // <lookup name="folded">leaflet</lookup> | |
| 71 | - | // </binding> | |
| 72 | - | // </object> | |
| 73 | - | // </child> | |
| 74 | - | // <!-- ... --> | |
| 75 | - | // </object> | |
| 76 | - | // </child> | |
| 77 | - | // <!-- ... --> | |
| 78 | - | // <child> | |
| 79 | - | // <object class="GtkBox"> | |
| 80 | - | // <property name="orientation">vertical</property> | |
| 81 | - | // <property name="hexpand">True</property> | |
| 82 | - | // <child> | |
| 83 | - | // <object class="AdwHeaderBar"> | |
| 84 | - | // <binding name="show-start-title-buttons"> | |
| 85 | - | // <lookup name="folded">leaflet</lookup> | |
| 86 | - | // </binding> | |
| 87 | - | // </object> | |
| 88 | - | // </child> | |
| 89 | - | // <!-- ... --> | |
| 90 | - | // </object> | |
| 91 | - | // </child> | |
| 64 | + | // ## Navigation View Integration | |
| 92 | 65 | // | |
| 93 | - | // </object> | |
| 94 | - | // ``` | |
| 66 | + | // When placed inside an [class@NavigationPage], `AdwHeaderBar` will display the | |
| 67 | + | // page title instead of window title. | |
| 95 | 68 | // | |
| 96 | - | // <picture> | |
| 69 | + | // When used together with [class@NavigationView] or [class@NavigationSplitView], | |
| 70 | + | // it will also display a back button that can be used to go back to the previous | |
| 71 | + | // page. The button also has a context menu, allowing to pop multiple pages at | |
| 72 | + | // once, potentially across multiple navigation views. | |
| 97 | 73 | // | |
| 98 | - | // <source srcset="header-bar-split-dark.png" media="(prefers-color-scheme: dark)"> | |
| 99 | - | // <img src="header-bar-split.png" alt="header-bar-split"> | |
| 74 | + | // Set [property@HeaderBar:show-back-button] to `FALSE` to disable this behavior | |
| 75 | + | // in rare scenarios where it's unwanted. | |
| 100 | 76 | // | |
| 101 | - | // </picture> | |
| 77 | + | // ## Split View Integration | |
| 78 | + | // | |
| 79 | + | // When placed inside [class@NavigationSplitView] or [class@OverlaySplitView], | |
| 80 | + | // `AdwHeaderBar` will automatically hide the title buttons other than at the | |
| 81 | + | // edges of the window. | |
| 82 | + | // | |
| 83 | + | // ## Bottom Sheet Integration | |
| 84 | + | // | |
| 85 | + | // When played inside [class@BottomSheet], `AdwHeaderBar` will not show the title | |
| 86 | + | // unless [property@BottomSheet:show-drag-handle] is set to `FALSE`, regardless | |
| 87 | + | // of [property@HeaderBar:show-title]. This only applies to the default title, | |
| 88 | + | // titles set with [property@HeaderBar:title-widget] will still be shown. | |
| 89 | + | // | |
| 90 | + | // ## Centering Policy | |
| 91 | + | // | |
| 92 | + | // [property@HeaderBar:centering-policy] allows to enforce strict centering of | |
| 93 | + | // the title widget. This can be useful for entries inside [class@Clamp]. | |
| 94 | + | // | |
| 95 | + | // ## Title Buttons | |
| 96 | + | // | |
| 97 | + | // Unlike `GtkHeaderBar`, `AdwHeaderBar` allows to toggle title button | |
| 98 | + | // visibility for each side individually, using the | |
| 99 | + | // [property@HeaderBar:show-start-title-buttons] and | |
| 100 | + | // [property@HeaderBar:show-end-title-buttons] properties. | |
| 102 | 101 | // | |
| 103 | 102 | // ## CSS nodes | |
| 104 | 103 | // | |
| @@ -110,8 +109,11 @@ const ( | |||
| 110 | 109 | // ├── widget | |
| 111 | 110 | // │ ╰── box.start | |
| 112 | 111 | // │ ├── windowcontrols.start | |
| 112 | + | // │ ├── widget | |
| 113 | + | // │ │ ╰── [button.back] | |
| 113 | 114 | // │ ╰── [other children] | |
| 114 | - | // ├── [Title Widget] | |
| 115 | + | // ├── widget | |
| 116 | + | // │ ╰── [Title Widget] | |
| 115 | 117 | // ╰── widget | |
| 116 | 118 | // ╰── box.end | |
| 117 | 119 | // ├── [other children] | |
| @@ -120,14 +122,18 @@ const ( | |||
| 120 | 122 | // ``` | |
| 121 | 123 | // | |
| 122 | 124 | // `AdwHeaderBar`'s CSS node is called `headerbar`. It contains a `windowhandle` | |
| 123 | - | // subnode, which contains a `box` subnode, which contains two `widget` subnodes | |
| 124 | - | // at the start and end of the header bar, each of which contains a `box` | |
| 125 | - | // subnode with the `.start` and `.end` style classes respectively, as well as a | |
| 126 | - | // center node that represents the title. | |
| 125 | + | // subnode, which contains a `box` subnode, which contains three `widget` | |
| 126 | + | // subnodes at the start, center and end of the header bar. The start and end | |
| 127 | + | // subnodes contain a `box` subnode with the `.start` and `.end` style classes | |
| 128 | + | // respectively, and the center node contains a node that represents the title. | |
| 127 | 129 | // | |
| 128 | 130 | // Each of the boxes contains a `windowcontrols` subnode, see | |
| 129 | 131 | // [class@Gtk.WindowControls] for details, as well as other children. | |
| 130 | 132 | // | |
| 133 | + | // When [property@HeaderBar:show-back-button] is `TRUE`, the start box also | |
| 134 | + | // contains a node with the name `widget` that contains a node with the name | |
| 135 | + | // `button` and `.back` style class. | |
| 136 | + | // | |
| 131 | 137 | // ## Accessibility | |
| 132 | 138 | // | |
| 133 | 139 | // `AdwHeaderBar` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role. | |
| @@ -182,6 +188,15 @@ func (x *HeaderBar) GetDecorationLayout() string { | |||
| 182 | 188 | return cret | |
| 183 | 189 | } | |
| 184 | 190 | ||
| 191 | + | var xHeaderBarGetShowBackButton func(uintptr) bool | |
| 192 | + | ||
| 193 | + | // Gets whether @self can show the back button. | |
| 194 | + | func (x *HeaderBar) GetShowBackButton() bool { | |
| 195 | + | ||
| 196 | + | cret := xHeaderBarGetShowBackButton(x.GoPointer()) | |
| 197 | + | return cret | |
| 198 | + | } | |
| 199 | + | ||
| 185 | 200 | var xHeaderBarGetShowEndTitleButtons func(uintptr) bool | |
| 186 | 201 | ||
| 187 | 202 | // Gets whether to show title buttons at the end of @self. | |
| @@ -200,6 +215,15 @@ func (x *HeaderBar) GetShowStartTitleButtons() bool { | |||
| 200 | 215 | return cret | |
| 201 | 216 | } | |
| 202 | 217 | ||
| 218 | + | var xHeaderBarGetShowTitle func(uintptr) bool | |
| 219 | + | ||
| 220 | + | // Gets whether the title widget should be shown. | |
| 221 | + | func (x *HeaderBar) GetShowTitle() bool { | |
| 222 | + | ||
| 223 | + | cret := xHeaderBarGetShowTitle(x.GoPointer()) | |
| 224 | + | return cret | |
| 225 | + | } | |
| 226 | + | ||
| 203 | 227 | var xHeaderBarGetTitleWidget func(uintptr) uintptr | |
| 204 | 228 | ||
| 205 | 229 | // Gets the title widget widget of @self. | |
| @@ -276,6 +300,18 @@ func (x *HeaderBar) SetDecorationLayout(LayoutVar string) { | |||
| 276 | 300 | ||
| 277 | 301 | } | |
| 278 | 302 | ||
| 303 | + | var xHeaderBarSetShowBackButton func(uintptr, bool) | |
| 304 | + | ||
| 305 | + | // Sets whether @self can show the back button. | |
| 306 | + | // | |
| 307 | + | // The back button will never be shown unless the header bar is placed inside an | |
| 308 | + | // [class@NavigationView]. Usually, there is no reason to set it to `FALSE`. | |
| 309 | + | func (x *HeaderBar) SetShowBackButton(ShowBackButtonVar bool) { | |
| 310 | + | ||
| 311 | + | xHeaderBarSetShowBackButton(x.GoPointer(), ShowBackButtonVar) | |
| 312 | + | ||
| 313 | + | } | |
| 314 | + | ||
| 279 | 315 | var xHeaderBarSetShowEndTitleButtons func(uintptr, bool) | |
| 280 | 316 | ||
| 281 | 317 | // Sets whether to show title buttons at the end of @self. | |
| @@ -306,6 +342,15 @@ func (x *HeaderBar) SetShowStartTitleButtons(SettingVar bool) { | |||
| 306 | 342 | ||
| 307 | 343 | } | |
| 308 | 344 | ||
| 345 | + | var xHeaderBarSetShowTitle func(uintptr, bool) | |
| 346 | + | ||
| 347 | + | // Sets whether the title widget should be shown. | |
| 348 | + | func (x *HeaderBar) SetShowTitle(ShowTitleVar bool) { | |
| 349 | + | ||
| 350 | + | xHeaderBarSetShowTitle(x.GoPointer(), ShowTitleVar) | |
| 351 | + | ||
| 352 | + | } | |
| 353 | + | ||
| 309 | 354 | var xHeaderBarSetTitleWidget func(uintptr, uintptr) | |
| 310 | 355 | ||
| 311 | 356 | // Sets the title widget for @self. | |
| @@ -497,16 +542,20 @@ func init() { | |||
| 497 | 542 | ||
| 498 | 543 | core.PuregoSafeRegister(&xHeaderBarGetCenteringPolicy, lib, "adw_header_bar_get_centering_policy") | |
| 499 | 544 | core.PuregoSafeRegister(&xHeaderBarGetDecorationLayout, lib, "adw_header_bar_get_decoration_layout") | |
| 545 | + | core.PuregoSafeRegister(&xHeaderBarGetShowBackButton, lib, "adw_header_bar_get_show_back_button") | |
| 500 | 546 | core.PuregoSafeRegister(&xHeaderBarGetShowEndTitleButtons, lib, "adw_header_bar_get_show_end_title_buttons") | |
| 501 | 547 | core.PuregoSafeRegister(&xHeaderBarGetShowStartTitleButtons, lib, "adw_header_bar_get_show_start_title_buttons") | |
| 548 | + | core.PuregoSafeRegister(&xHeaderBarGetShowTitle, lib, "adw_header_bar_get_show_title") | |
| 502 | 549 | core.PuregoSafeRegister(&xHeaderBarGetTitleWidget, lib, "adw_header_bar_get_title_widget") | |
| 503 | 550 | core.PuregoSafeRegister(&xHeaderBarPackEnd, lib, "adw_header_bar_pack_end") | |
| 504 | 551 | core.PuregoSafeRegister(&xHeaderBarPackStart, lib, "adw_header_bar_pack_start") | |
| 505 | 552 | core.PuregoSafeRegister(&xHeaderBarRemove, lib, "adw_header_bar_remove") | |
| 506 | 553 | core.PuregoSafeRegister(&xHeaderBarSetCenteringPolicy, lib, "adw_header_bar_set_centering_policy") | |
| 507 | 554 | core.PuregoSafeRegister(&xHeaderBarSetDecorationLayout, lib, "adw_header_bar_set_decoration_layout") | |
| 555 | + | core.PuregoSafeRegister(&xHeaderBarSetShowBackButton, lib, "adw_header_bar_set_show_back_button") | |
| 508 | 556 | core.PuregoSafeRegister(&xHeaderBarSetShowEndTitleButtons, lib, "adw_header_bar_set_show_end_title_buttons") | |
| 509 | 557 | core.PuregoSafeRegister(&xHeaderBarSetShowStartTitleButtons, lib, "adw_header_bar_set_show_start_title_buttons") | |
| 558 | + | core.PuregoSafeRegister(&xHeaderBarSetShowTitle, lib, "adw_header_bar_set_show_title") | |
| 510 | 559 | core.PuregoSafeRegister(&xHeaderBarSetTitleWidget, lib, "adw_header_bar_set_title_widget") | |
| 511 | 560 | ||
| 512 | 561 | } | |
A v4/adw/adw-layout-slot.go +236 -0
| @@ -0,0 +1,236 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 13 | + | ) | |
| 14 | + | ||
| 15 | + | type LayoutSlotClass struct { | |
| 16 | + | _ structs.HostLayout | |
| 17 | + | ||
| 18 | + | ParentClass uintptr | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | func (x *LayoutSlotClass) GoPointer() uintptr { | |
| 22 | + | return uintptr(unsafe.Pointer(x)) | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | // A child slot within [class@Layout]. | |
| 26 | + | // | |
| 27 | + | // While it contains a layout child, the [property@Gtk.Widget:visible] property | |
| 28 | + | // of the slot is updated to match that of the layout child. | |
| 29 | + | // | |
| 30 | + | // See [class@MultiLayoutView]. | |
| 31 | + | type LayoutSlot struct { | |
| 32 | + | gtk.Widget | |
| 33 | + | } | |
| 34 | + | ||
| 35 | + | var xLayoutSlotGLibType func() types.GType | |
| 36 | + | ||
| 37 | + | func LayoutSlotGLibType() types.GType { | |
| 38 | + | return xLayoutSlotGLibType() | |
| 39 | + | } | |
| 40 | + | ||
| 41 | + | func LayoutSlotNewFromInternalPtr(ptr uintptr) *LayoutSlot { | |
| 42 | + | cls := &LayoutSlot{} | |
| 43 | + | cls.Ptr = ptr | |
| 44 | + | return cls | |
| 45 | + | } | |
| 46 | + | ||
| 47 | + | var xNewLayoutSlot func(string) uintptr | |
| 48 | + | ||
| 49 | + | // Creates a new `AdwLayoutSlot` with its ID set to @id. | |
| 50 | + | func NewLayoutSlot(IdVar string) *LayoutSlot { | |
| 51 | + | var cls *LayoutSlot | |
| 52 | + | ||
| 53 | + | cret := xNewLayoutSlot(IdVar) | |
| 54 | + | ||
| 55 | + | if cret == 0 { | |
| 56 | + | return nil | |
| 57 | + | } | |
| 58 | + | gobject.IncreaseRef(cret) | |
| 59 | + | cls = &LayoutSlot{} | |
| 60 | + | cls.Ptr = cret | |
| 61 | + | return cls | |
| 62 | + | } | |
| 63 | + | ||
| 64 | + | var xLayoutSlotGetSlotId func(uintptr) string | |
| 65 | + | ||
| 66 | + | // Gets the slot id of @self. | |
| 67 | + | func (x *LayoutSlot) GetSlotId() string { | |
| 68 | + | ||
| 69 | + | cret := xLayoutSlotGetSlotId(x.GoPointer()) | |
| 70 | + | return cret | |
| 71 | + | } | |
| 72 | + | ||
| 73 | + | func (c *LayoutSlot) GoPointer() uintptr { | |
| 74 | + | return c.Ptr | |
| 75 | + | } | |
| 76 | + | ||
| 77 | + | func (c *LayoutSlot) SetGoPointer(ptr uintptr) { | |
| 78 | + | c.Ptr = ptr | |
| 79 | + | } | |
| 80 | + | ||
| 81 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 82 | + | func (x *LayoutSlot) GetAccessibleRole() gtk.AccessibleRole { | |
| 83 | + | ||
| 84 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 85 | + | return cret | |
| 86 | + | } | |
| 87 | + | ||
| 88 | + | // Resets the accessible @property to its default value. | |
| 89 | + | func (x *LayoutSlot) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 90 | + | ||
| 91 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 92 | + | ||
| 93 | + | } | |
| 94 | + | ||
| 95 | + | // Resets the accessible @relation to its default value. | |
| 96 | + | func (x *LayoutSlot) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 97 | + | ||
| 98 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 99 | + | ||
| 100 | + | } | |
| 101 | + | ||
| 102 | + | // Resets the accessible @state to its default value. | |
| 103 | + | func (x *LayoutSlot) ResetState(StateVar gtk.AccessibleState) { | |
| 104 | + | ||
| 105 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 106 | + | ||
| 107 | + | } | |
| 108 | + | ||
| 109 | + | // Updates a list of accessible properties. | |
| 110 | + | // | |
| 111 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 112 | + | // value types of accessible properties. | |
| 113 | + | // | |
| 114 | + | // This function should be called by `GtkWidget` types whenever | |
| 115 | + | // an accessible property change must be communicated to assistive | |
| 116 | + | // technologies. | |
| 117 | + | // | |
| 118 | + | // Example: | |
| 119 | + | // ```c | |
| 120 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 121 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 122 | + | // | |
| 123 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 124 | + | // -1); | |
| 125 | + | // | |
| 126 | + | // ``` | |
| 127 | + | func (x *LayoutSlot) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 128 | + | ||
| 129 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 130 | + | ||
| 131 | + | } | |
| 132 | + | ||
| 133 | + | // Updates an array of accessible properties. | |
| 134 | + | // | |
| 135 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 136 | + | // property change must be communicated to assistive technologies. | |
| 137 | + | // | |
| 138 | + | // This function is meant to be used by language bindings. | |
| 139 | + | func (x *LayoutSlot) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 140 | + | ||
| 141 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 142 | + | ||
| 143 | + | } | |
| 144 | + | ||
| 145 | + | // Updates a list of accessible relations. | |
| 146 | + | // | |
| 147 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 148 | + | // relation change must be communicated to assistive technologies. | |
| 149 | + | // | |
| 150 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 151 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 152 | + | // | |
| 153 | + | // ```c | |
| 154 | + | // gtk_accessible_update_relation (accessible, | |
| 155 | + | // | |
| 156 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 157 | + | // ref1, NULL, | |
| 158 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 159 | + | // ref1, ref2, ref3, NULL, | |
| 160 | + | // -1); | |
| 161 | + | // | |
| 162 | + | // ``` | |
| 163 | + | func (x *LayoutSlot) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 164 | + | ||
| 165 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 166 | + | ||
| 167 | + | } | |
| 168 | + | ||
| 169 | + | // Updates an array of accessible relations. | |
| 170 | + | // | |
| 171 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 172 | + | // relation change must be communicated to assistive technologies. | |
| 173 | + | // | |
| 174 | + | // This function is meant to be used by language bindings. | |
| 175 | + | func (x *LayoutSlot) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 176 | + | ||
| 177 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 178 | + | ||
| 179 | + | } | |
| 180 | + | ||
| 181 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 182 | + | // documentation for the value types of accessible states. | |
| 183 | + | // | |
| 184 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 185 | + | // state change must be communicated to assistive technologies. | |
| 186 | + | // | |
| 187 | + | // Example: | |
| 188 | + | // ```c | |
| 189 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 190 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 191 | + | // | |
| 192 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 193 | + | // -1); | |
| 194 | + | // | |
| 195 | + | // ``` | |
| 196 | + | func (x *LayoutSlot) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 197 | + | ||
| 198 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 199 | + | ||
| 200 | + | } | |
| 201 | + | ||
| 202 | + | // Updates an array of accessible states. | |
| 203 | + | // | |
| 204 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 205 | + | // state change must be communicated to assistive technologies. | |
| 206 | + | // | |
| 207 | + | // This function is meant to be used by language bindings. | |
| 208 | + | func (x *LayoutSlot) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 209 | + | ||
| 210 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 211 | + | ||
| 212 | + | } | |
| 213 | + | ||
| 214 | + | // Gets the ID of the @buildable object. | |
| 215 | + | // | |
| 216 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 217 | + | // of the <object> tag used to construct the @buildable. | |
| 218 | + | func (x *LayoutSlot) GetBuildableId() string { | |
| 219 | + | ||
| 220 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 221 | + | return cret | |
| 222 | + | } | |
| 223 | + | ||
| 224 | + | func init() { | |
| 225 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 226 | + | if err != nil { | |
| 227 | + | panic(err) | |
| 228 | + | } | |
| 229 | + | ||
| 230 | + | core.PuregoSafeRegister(&xLayoutSlotGLibType, lib, "adw_layout_slot_get_type") | |
| 231 | + | ||
| 232 | + | core.PuregoSafeRegister(&xNewLayoutSlot, lib, "adw_layout_slot_new") | |
| 233 | + | ||
| 234 | + | core.PuregoSafeRegister(&xLayoutSlotGetSlotId, lib, "adw_layout_slot_get_slot_id") | |
| 235 | + | ||
| 236 | + | } | |
A v4/adw/adw-layout.go +125 -0
| @@ -0,0 +1,125 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 13 | + | ) | |
| 14 | + | ||
| 15 | + | type LayoutClass struct { | |
| 16 | + | _ structs.HostLayout | |
| 17 | + | ||
| 18 | + | ParentClass uintptr | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | func (x *LayoutClass) GoPointer() uintptr { | |
| 22 | + | return uintptr(unsafe.Pointer(x)) | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | // An individual layout in [class@MultiLayoutView]. | |
| 26 | + | type Layout struct { | |
| 27 | + | gobject.Object | |
| 28 | + | } | |
| 29 | + | ||
| 30 | + | var xLayoutGLibType func() types.GType | |
| 31 | + | ||
| 32 | + | func LayoutGLibType() types.GType { | |
| 33 | + | return xLayoutGLibType() | |
| 34 | + | } | |
| 35 | + | ||
| 36 | + | func LayoutNewFromInternalPtr(ptr uintptr) *Layout { | |
| 37 | + | cls := &Layout{} | |
| 38 | + | cls.Ptr = ptr | |
| 39 | + | return cls | |
| 40 | + | } | |
| 41 | + | ||
| 42 | + | var xNewLayout func(uintptr) uintptr | |
| 43 | + | ||
| 44 | + | // Creates a new `AdwLayout` that contains @content. | |
| 45 | + | func NewLayout(ContentVar *gtk.Widget) *Layout { | |
| 46 | + | var cls *Layout | |
| 47 | + | ||
| 48 | + | cret := xNewLayout(ContentVar.GoPointer()) | |
| 49 | + | ||
| 50 | + | if cret == 0 { | |
| 51 | + | return nil | |
| 52 | + | } | |
| 53 | + | cls = &Layout{} | |
| 54 | + | cls.Ptr = cret | |
| 55 | + | return cls | |
| 56 | + | } | |
| 57 | + | ||
| 58 | + | var xLayoutGetContent func(uintptr) uintptr | |
| 59 | + | ||
| 60 | + | // Gets the content widget. | |
| 61 | + | func (x *Layout) GetContent() *gtk.Widget { | |
| 62 | + | var cls *gtk.Widget | |
| 63 | + | ||
| 64 | + | cret := xLayoutGetContent(x.GoPointer()) | |
| 65 | + | ||
| 66 | + | if cret == 0 { | |
| 67 | + | return nil | |
| 68 | + | } | |
| 69 | + | gobject.IncreaseRef(cret) | |
| 70 | + | cls = >k.Widget{} | |
| 71 | + | cls.Ptr = cret | |
| 72 | + | return cls | |
| 73 | + | } | |
| 74 | + | ||
| 75 | + | var xLayoutGetName func(uintptr) string | |
| 76 | + | ||
| 77 | + | // Gets the name of the layout. | |
| 78 | + | func (x *Layout) GetName() string { | |
| 79 | + | ||
| 80 | + | cret := xLayoutGetName(x.GoPointer()) | |
| 81 | + | return cret | |
| 82 | + | } | |
| 83 | + | ||
| 84 | + | var xLayoutSetName func(uintptr, string) | |
| 85 | + | ||
| 86 | + | // Sets the name of the layout. | |
| 87 | + | func (x *Layout) SetName(NameVar string) { | |
| 88 | + | ||
| 89 | + | xLayoutSetName(x.GoPointer(), NameVar) | |
| 90 | + | ||
| 91 | + | } | |
| 92 | + | ||
| 93 | + | func (c *Layout) GoPointer() uintptr { | |
| 94 | + | return c.Ptr | |
| 95 | + | } | |
| 96 | + | ||
| 97 | + | func (c *Layout) SetGoPointer(ptr uintptr) { | |
| 98 | + | c.Ptr = ptr | |
| 99 | + | } | |
| 100 | + | ||
| 101 | + | // Gets the ID of the @buildable object. | |
| 102 | + | // | |
| 103 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 104 | + | // of the <object> tag used to construct the @buildable. | |
| 105 | + | func (x *Layout) GetBuildableId() string { | |
| 106 | + | ||
| 107 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 108 | + | return cret | |
| 109 | + | } | |
| 110 | + | ||
| 111 | + | func init() { | |
| 112 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 113 | + | if err != nil { | |
| 114 | + | panic(err) | |
| 115 | + | } | |
| 116 | + | ||
| 117 | + | core.PuregoSafeRegister(&xLayoutGLibType, lib, "adw_layout_get_type") | |
| 118 | + | ||
| 119 | + | core.PuregoSafeRegister(&xNewLayout, lib, "adw_layout_new") | |
| 120 | + | ||
| 121 | + | core.PuregoSafeRegister(&xLayoutGetContent, lib, "adw_layout_get_content") | |
| 122 | + | core.PuregoSafeRegister(&xLayoutGetName, lib, "adw_layout_get_name") | |
| 123 | + | core.PuregoSafeRegister(&xLayoutSetName, lib, "adw_layout_set_name") | |
| 124 | + | ||
| 125 | + | } | |
A v4/adw/adw-length-unit.go +67 -0
| @@ -0,0 +1,67 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "github.com/jwijenbergh/purego" | |
| 6 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 7 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 8 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 9 | + | ) | |
| 10 | + | ||
| 11 | + | // Describes length units. | |
| 12 | + | // | |
| 13 | + | // | Unit | Regular Text | Large Text | | |
| 14 | + | // | ---- | ------------ | ---------- | | |
| 15 | + | // | 1px | 1px | 1px | | |
| 16 | + | // | 1pt | 1.333333px | 1.666667px | | |
| 17 | + | // | 1sp | 1px | 1.25px | | |
| 18 | + | // | |
| 19 | + | // New values may be added to this enumeration over time. | |
| 20 | + | type LengthUnit int | |
| 21 | + | ||
| 22 | + | var xLengthUnitGLibType func() types.GType | |
| 23 | + | ||
| 24 | + | func LengthUnitGLibType() types.GType { | |
| 25 | + | return xLengthUnitGLibType() | |
| 26 | + | } | |
| 27 | + | ||
| 28 | + | const ( | |
| 29 | + | ||
| 30 | + | // pixels | |
| 31 | + | LengthUnitPxValue LengthUnit = 0 | |
| 32 | + | // points, changes with text scale factor | |
| 33 | + | LengthUnitPtValue LengthUnit = 1 | |
| 34 | + | // scale independent pixels, changes with text scale factor | |
| 35 | + | LengthUnitSpValue LengthUnit = 2 | |
| 36 | + | ) | |
| 37 | + | ||
| 38 | + | var xLengthUnitFromPx func(LengthUnit, float64, uintptr) float64 | |
| 39 | + | ||
| 40 | + | // Converts @value from pixels to @unit. | |
| 41 | + | func LengthUnitFromPx(UnitVar LengthUnit, ValueVar float64, SettingsVar *gtk.Settings) float64 { | |
| 42 | + | ||
| 43 | + | cret := xLengthUnitFromPx(UnitVar, ValueVar, SettingsVar.GoPointer()) | |
| 44 | + | return cret | |
| 45 | + | } | |
| 46 | + | ||
| 47 | + | var xLengthUnitToPx func(LengthUnit, float64, uintptr) float64 | |
| 48 | + | ||
| 49 | + | // Converts @value from @unit to pixels. | |
| 50 | + | func LengthUnitToPx(UnitVar LengthUnit, ValueVar float64, SettingsVar *gtk.Settings) float64 { | |
| 51 | + | ||
| 52 | + | cret := xLengthUnitToPx(UnitVar, ValueVar, SettingsVar.GoPointer()) | |
| 53 | + | return cret | |
| 54 | + | } | |
| 55 | + | ||
| 56 | + | func init() { | |
| 57 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 58 | + | if err != nil { | |
| 59 | + | panic(err) | |
| 60 | + | } | |
| 61 | + | ||
| 62 | + | core.PuregoSafeRegister(&xLengthUnitGLibType, lib, "adw_length_unit_get_type") | |
| 63 | + | ||
| 64 | + | core.PuregoSafeRegister(&xLengthUnitFromPx, lib, "adw_length_unit_from_px") | |
| 65 | + | core.PuregoSafeRegister(&xLengthUnitToPx, lib, "adw_length_unit_to_px") | |
| 66 | + | ||
| 67 | + | } | |
M v4/adw/adw-message-dialog.go +12 -32
| @@ -28,30 +28,6 @@ func (x *MessageDialogClass) GoPointer() uintptr { | |||
| 28 | 28 | return uintptr(unsafe.Pointer(x)) | |
| 29 | 29 | } | |
| 30 | 30 | ||
| 31 | - | // Describes the possible styles of [class@MessageDialog] response buttons. | |
| 32 | - | // | |
| 33 | - | // See [method@MessageDialog.set_response_appearance]. | |
| 34 | - | type ResponseAppearance int | |
| 35 | - | ||
| 36 | - | var xResponseAppearanceGLibType func() types.GType | |
| 37 | - | ||
| 38 | - | func ResponseAppearanceGLibType() types.GType { | |
| 39 | - | return xResponseAppearanceGLibType() | |
| 40 | - | } | |
| 41 | - | ||
| 42 | - | const ( | |
| 43 | - | ||
| 44 | - | // the default appearance. | |
| 45 | - | ResponseDefaultValue ResponseAppearance = 0 | |
| 46 | - | // used to denote important responses such as the | |
| 47 | - | // affirmative action. | |
| 48 | - | ResponseSuggestedValue ResponseAppearance = 1 | |
| 49 | - | // used to draw attention to the potentially damaging | |
| 50 | - | // consequences of using the response. This appearance acts as a warning to | |
| 51 | - | // the user. | |
| 52 | - | ResponseDestructiveValue ResponseAppearance = 2 | |
| 53 | - | ) | |
| 54 | - | ||
| 55 | 31 | // A dialog presenting a message or a question. | |
| 56 | 32 | // | |
| 57 | 33 | // <picture> | |
| @@ -111,8 +87,7 @@ const ( | |||
| 111 | 87 | // ## Async API | |
| 112 | 88 | // | |
| 113 | 89 | // `AdwMessageDialog` can also be used via the [method@MessageDialog.choose] | |
| 114 | - | // method. This API follows the GIO async pattern, and the result can be | |
| 115 | - | // obtained by calling [method@MessageDialog.choose_finish], for example: | |
| 90 | + | // method. This API follows the GIO async pattern, for example: | |
| 116 | 91 | // | |
| 117 | 92 | // ```c | |
| 118 | 93 | // static void | |
| @@ -158,7 +133,7 @@ const ( | |||
| 158 | 133 | // | |
| 159 | 134 | // `AdwMessageDialog` supports adding responses in UI definitions by via the | |
| 160 | 135 | // `<responses>` element that may contain multiple `<response>` elements, each | |
| 161 | - | // respresenting a response. | |
| 136 | + | // representing a response. | |
| 162 | 137 | // | |
| 163 | 138 | // Each of the `<response>` elements must have the `id` attribute specifying the | |
| 164 | 139 | // response ID. The contents of the element are used as the response label. | |
| @@ -292,9 +267,6 @@ func (x *MessageDialog) AddResponses(FirstIdVar string, varArgs ...interface{}) | |||
| 292 | 267 | var xMessageDialogChoose func(uintptr, uintptr, uintptr, uintptr) | |
| 293 | 268 | ||
| 294 | 269 | // This function shows @self to the user. | |
| 295 | - | // | |
| 296 | - | // The @callback will be called when the alert is dismissed. It should call | |
| 297 | - | // [method@MessageDialog.choose_finish] to obtain the result. | |
| 298 | 270 | func (x *MessageDialog) Choose(CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { | |
| 299 | 271 | ||
| 300 | 272 | xMessageDialogChoose(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) | |
| @@ -479,6 +451,15 @@ func (x *MessageDialog) HasResponse(ResponseVar string) bool { | |||
| 479 | 451 | return cret | |
| 480 | 452 | } | |
| 481 | 453 | ||
| 454 | + | var xMessageDialogRemoveResponse func(uintptr, string) | |
| 455 | + | ||
| 456 | + | // Removes a response from @self. | |
| 457 | + | func (x *MessageDialog) RemoveResponse(IdVar string) { | |
| 458 | + | ||
| 459 | + | xMessageDialogRemoveResponse(x.GoPointer(), IdVar) | |
| 460 | + | ||
| 461 | + | } | |
| 462 | + | ||
| 482 | 463 | var xMessageDialogResponse func(uintptr, string) | |
| 483 | 464 | ||
| 484 | 465 | // Emits the [signal@MessageDialog::response] signal with the given response ID. | |
| @@ -919,8 +900,6 @@ func init() { | |||
| 919 | 900 | panic(err) | |
| 920 | 901 | } | |
| 921 | 902 | ||
| 922 | - | core.PuregoSafeRegister(&xResponseAppearanceGLibType, lib, "adw_response_appearance_get_type") | |
| 923 | - | ||
| 924 | 903 | core.PuregoSafeRegister(&xMessageDialogGLibType, lib, "adw_message_dialog_get_type") | |
| 925 | 904 | ||
| 926 | 905 | core.PuregoSafeRegister(&xNewMessageDialog, lib, "adw_message_dialog_new") | |
| @@ -944,6 +923,7 @@ func init() { | |||
| 944 | 923 | core.PuregoSafeRegister(&xMessageDialogGetResponseEnabled, lib, "adw_message_dialog_get_response_enabled") | |
| 945 | 924 | core.PuregoSafeRegister(&xMessageDialogGetResponseLabel, lib, "adw_message_dialog_get_response_label") | |
| 946 | 925 | core.PuregoSafeRegister(&xMessageDialogHasResponse, lib, "adw_message_dialog_has_response") | |
| 926 | + | core.PuregoSafeRegister(&xMessageDialogRemoveResponse, lib, "adw_message_dialog_remove_response") | |
| 947 | 927 | core.PuregoSafeRegister(&xMessageDialogResponse, lib, "adw_message_dialog_response") | |
| 948 | 928 | core.PuregoSafeRegister(&xMessageDialogSetBody, lib, "adw_message_dialog_set_body") | |
| 949 | 929 | core.PuregoSafeRegister(&xMessageDialogSetBodyUseMarkup, lib, "adw_message_dialog_set_body_use_markup") | |
A v4/adw/adw-multi-layout-view.go +422 -0
| @@ -0,0 +1,422 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 13 | + | ) | |
| 14 | + | ||
| 15 | + | type MultiLayoutViewClass struct { | |
| 16 | + | _ structs.HostLayout | |
| 17 | + | ||
| 18 | + | ParentClass uintptr | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | func (x *MultiLayoutViewClass) GoPointer() uintptr { | |
| 22 | + | return uintptr(unsafe.Pointer(x)) | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | // A widget for switching between different layouts. | |
| 26 | + | // | |
| 27 | + | // `AdwMultiLayoutView` contains layouts and children. Each child has | |
| 28 | + | // an ID, each layout has slots inside it, each slot also has an ID. When | |
| 29 | + | // switching layouts, children are inserted into slots with matching IDs. The | |
| 30 | + | // [property@Gtk.Widget:visible] property of each slot is updated to match | |
| 31 | + | // that of the inserted child. | |
| 32 | + | // | |
| 33 | + | // This can be useful for rearranging children when it's difficult to do so | |
| 34 | + | // otherwise, for example to move a child from a sidebar to a bottom bar. | |
| 35 | + | // | |
| 36 | + | // The currently used layout can be switched using the | |
| 37 | + | // [property@MultiLayoutView:layout] or [property@MultiLayoutView:layout-name] | |
| 38 | + | // properties. For example, it can be done via a [class@Adw.Breakpoint] setter | |
| 39 | + | // to change layouts depending on the window size. | |
| 40 | + | // | |
| 41 | + | // ## AdwMultiLayoutView as GtkBuildable | |
| 42 | + | // | |
| 43 | + | // The `AdwMultiLayoutView` implementation of the [iface@Gtk.Buildable] | |
| 44 | + | // interface supports adding layouts via `<child>` element with the `type` | |
| 45 | + | // attribute omitted. | |
| 46 | + | // | |
| 47 | + | // It also supports setting children via `<child type="ID">`. | |
| 48 | + | // | |
| 49 | + | // Example of an `AdwMultiLayoutView` UI definition that can display a secondary | |
| 50 | + | // child as either a sidebar or a bottom sheet. | |
| 51 | + | // | |
| 52 | + | // ```xml | |
| 53 | + | // <object class="AdwMultiLayoutView"> | |
| 54 | + | // | |
| 55 | + | // <child> | |
| 56 | + | // <object class="AdwLayout"> | |
| 57 | + | // <property name="name">sidebar</property> | |
| 58 | + | // <property name="content"> | |
| 59 | + | // <object class="AdwOverlaySplitView"> | |
| 60 | + | // <property name="sidebar"> | |
| 61 | + | // <object class="AdwLayoutSlot"> | |
| 62 | + | // <property name="id">secondary</property> | |
| 63 | + | // </object> | |
| 64 | + | // </property> | |
| 65 | + | // <property name="content"> | |
| 66 | + | // <object class="AdwLayoutSlot"> | |
| 67 | + | // <property name="id">primary</property> | |
| 68 | + | // </object> | |
| 69 | + | // </property> | |
| 70 | + | // </object> | |
| 71 | + | // </property> | |
| 72 | + | // </object> | |
| 73 | + | // </child> | |
| 74 | + | // <child> | |
| 75 | + | // <object class="AdwLayout"> | |
| 76 | + | // <property name="name">bottom-sheet</property> | |
| 77 | + | // <property name="content"> | |
| 78 | + | // <object class="AdwBottomSheet"> | |
| 79 | + | // <property name="open">True</property> | |
| 80 | + | // <property name="content"> | |
| 81 | + | // <object class="AdwLayoutSlot"> | |
| 82 | + | // <property name="id">primary</property> | |
| 83 | + | // </object> | |
| 84 | + | // </property> | |
| 85 | + | // <property name="sheet"> | |
| 86 | + | // <object class="AdwLayoutSlot"> | |
| 87 | + | // <property name="id">secondary</property> | |
| 88 | + | // </object> | |
| 89 | + | // </property> | |
| 90 | + | // </object> | |
| 91 | + | // </property> | |
| 92 | + | // </object> | |
| 93 | + | // </child> | |
| 94 | + | // <child type="primary"> | |
| 95 | + | // <!-- ... --> | |
| 96 | + | // </child> | |
| 97 | + | // <child type="secondary"> | |
| 98 | + | // <!-- ... --> | |
| 99 | + | // </child> | |
| 100 | + | // | |
| 101 | + | // </object> | |
| 102 | + | // ``` | |
| 103 | + | // | |
| 104 | + | // ## CSS nodes | |
| 105 | + | // | |
| 106 | + | // `AdwMultiLayoutView` has a single CSS node with name `multi-layout-view`. | |
| 107 | + | type MultiLayoutView struct { | |
| 108 | + | gtk.Widget | |
| 109 | + | } | |
| 110 | + | ||
| 111 | + | var xMultiLayoutViewGLibType func() types.GType | |
| 112 | + | ||
| 113 | + | func MultiLayoutViewGLibType() types.GType { | |
| 114 | + | return xMultiLayoutViewGLibType() | |
| 115 | + | } | |
| 116 | + | ||
| 117 | + | func MultiLayoutViewNewFromInternalPtr(ptr uintptr) *MultiLayoutView { | |
| 118 | + | cls := &MultiLayoutView{} | |
| 119 | + | cls.Ptr = ptr | |
| 120 | + | return cls | |
| 121 | + | } | |
| 122 | + | ||
| 123 | + | var xNewMultiLayoutView func() uintptr | |
| 124 | + | ||
| 125 | + | // Creates a new `AdwMultiLayoutView`. | |
| 126 | + | func NewMultiLayoutView() *MultiLayoutView { | |
| 127 | + | var cls *MultiLayoutView | |
| 128 | + | ||
| 129 | + | cret := xNewMultiLayoutView() | |
| 130 | + | ||
| 131 | + | if cret == 0 { | |
| 132 | + | return nil | |
| 133 | + | } | |
| 134 | + | gobject.IncreaseRef(cret) | |
| 135 | + | cls = &MultiLayoutView{} | |
| 136 | + | cls.Ptr = cret | |
| 137 | + | return cls | |
| 138 | + | } | |
| 139 | + | ||
| 140 | + | var xMultiLayoutViewAddLayout func(uintptr, uintptr) | |
| 141 | + | ||
| 142 | + | // Adds @layout to @self. | |
| 143 | + | func (x *MultiLayoutView) AddLayout(LayoutVar *Layout) { | |
| 144 | + | ||
| 145 | + | xMultiLayoutViewAddLayout(x.GoPointer(), LayoutVar.GoPointer()) | |
| 146 | + | ||
| 147 | + | } | |
| 148 | + | ||
| 149 | + | var xMultiLayoutViewGetChild func(uintptr, string) uintptr | |
| 150 | + | ||
| 151 | + | // Gets the child for @id to @self. | |
| 152 | + | func (x *MultiLayoutView) GetChild(IdVar string) *gtk.Widget { | |
| 153 | + | var cls *gtk.Widget | |
| 154 | + | ||
| 155 | + | cret := xMultiLayoutViewGetChild(x.GoPointer(), IdVar) | |
| 156 | + | ||
| 157 | + | if cret == 0 { | |
| 158 | + | return nil | |
| 159 | + | } | |
| 160 | + | gobject.IncreaseRef(cret) | |
| 161 | + | cls = >k.Widget{} | |
| 162 | + | cls.Ptr = cret | |
| 163 | + | return cls | |
| 164 | + | } | |
| 165 | + | ||
| 166 | + | var xMultiLayoutViewGetLayout func(uintptr) uintptr | |
| 167 | + | ||
| 168 | + | // Gets the currently used layout of @self. | |
| 169 | + | func (x *MultiLayoutView) GetLayout() *Layout { | |
| 170 | + | var cls *Layout | |
| 171 | + | ||
| 172 | + | cret := xMultiLayoutViewGetLayout(x.GoPointer()) | |
| 173 | + | ||
| 174 | + | if cret == 0 { | |
| 175 | + | return nil | |
| 176 | + | } | |
| 177 | + | gobject.IncreaseRef(cret) | |
| 178 | + | cls = &Layout{} | |
| 179 | + | cls.Ptr = cret | |
| 180 | + | return cls | |
| 181 | + | } | |
| 182 | + | ||
| 183 | + | var xMultiLayoutViewGetLayoutByName func(uintptr, string) uintptr | |
| 184 | + | ||
| 185 | + | // Gets layout with the name @name from @self, or `NULL` if it doesn't exist. | |
| 186 | + | // | |
| 187 | + | // See [property@Layout:name]. | |
| 188 | + | func (x *MultiLayoutView) GetLayoutByName(NameVar string) *Layout { | |
| 189 | + | var cls *Layout | |
| 190 | + | ||
| 191 | + | cret := xMultiLayoutViewGetLayoutByName(x.GoPointer(), NameVar) | |
| 192 | + | ||
| 193 | + | if cret == 0 { | |
| 194 | + | return nil | |
| 195 | + | } | |
| 196 | + | gobject.IncreaseRef(cret) | |
| 197 | + | cls = &Layout{} | |
| 198 | + | cls.Ptr = cret | |
| 199 | + | return cls | |
| 200 | + | } | |
| 201 | + | ||
| 202 | + | var xMultiLayoutViewGetLayoutName func(uintptr) string | |
| 203 | + | ||
| 204 | + | // Returns the name of the currently used layout of @self. | |
| 205 | + | func (x *MultiLayoutView) GetLayoutName() string { | |
| 206 | + | ||
| 207 | + | cret := xMultiLayoutViewGetLayoutName(x.GoPointer()) | |
| 208 | + | return cret | |
| 209 | + | } | |
| 210 | + | ||
| 211 | + | var xMultiLayoutViewRemoveLayout func(uintptr, uintptr) | |
| 212 | + | ||
| 213 | + | // Removes @layout from @self. | |
| 214 | + | func (x *MultiLayoutView) RemoveLayout(LayoutVar *Layout) { | |
| 215 | + | ||
| 216 | + | xMultiLayoutViewRemoveLayout(x.GoPointer(), LayoutVar.GoPointer()) | |
| 217 | + | ||
| 218 | + | } | |
| 219 | + | ||
| 220 | + | var xMultiLayoutViewSetChild func(uintptr, string, uintptr) | |
| 221 | + | ||
| 222 | + | // Sets @child as the child for @id in @self. | |
| 223 | + | // | |
| 224 | + | // When changing layouts, it will be inserted into the slot with @id. | |
| 225 | + | func (x *MultiLayoutView) SetChild(IdVar string, ChildVar *gtk.Widget) { | |
| 226 | + | ||
| 227 | + | xMultiLayoutViewSetChild(x.GoPointer(), IdVar, ChildVar.GoPointer()) | |
| 228 | + | ||
| 229 | + | } | |
| 230 | + | ||
| 231 | + | var xMultiLayoutViewSetLayout func(uintptr, uintptr) | |
| 232 | + | ||
| 233 | + | // Makes @layout the current layout of @self. | |
| 234 | + | func (x *MultiLayoutView) SetLayout(LayoutVar *Layout) { | |
| 235 | + | ||
| 236 | + | xMultiLayoutViewSetLayout(x.GoPointer(), LayoutVar.GoPointer()) | |
| 237 | + | ||
| 238 | + | } | |
| 239 | + | ||
| 240 | + | var xMultiLayoutViewSetLayoutName func(uintptr, string) | |
| 241 | + | ||
| 242 | + | // Makes the layout with @name the current layout of @self. | |
| 243 | + | // | |
| 244 | + | // See [property@Layout:name]. | |
| 245 | + | func (x *MultiLayoutView) SetLayoutName(NameVar string) { | |
| 246 | + | ||
| 247 | + | xMultiLayoutViewSetLayoutName(x.GoPointer(), NameVar) | |
| 248 | + | ||
| 249 | + | } | |
| 250 | + | ||
| 251 | + | func (c *MultiLayoutView) GoPointer() uintptr { | |
| 252 | + | return c.Ptr | |
| 253 | + | } | |
| 254 | + | ||
| 255 | + | func (c *MultiLayoutView) SetGoPointer(ptr uintptr) { | |
| 256 | + | c.Ptr = ptr | |
| 257 | + | } | |
| 258 | + | ||
| 259 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 260 | + | func (x *MultiLayoutView) GetAccessibleRole() gtk.AccessibleRole { | |
| 261 | + | ||
| 262 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 263 | + | return cret | |
| 264 | + | } | |
| 265 | + | ||
| 266 | + | // Resets the accessible @property to its default value. | |
| 267 | + | func (x *MultiLayoutView) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 268 | + | ||
| 269 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 270 | + | ||
| 271 | + | } | |
| 272 | + | ||
| 273 | + | // Resets the accessible @relation to its default value. | |
| 274 | + | func (x *MultiLayoutView) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 275 | + | ||
| 276 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 277 | + | ||
| 278 | + | } | |
| 279 | + | ||
| 280 | + | // Resets the accessible @state to its default value. | |
| 281 | + | func (x *MultiLayoutView) ResetState(StateVar gtk.AccessibleState) { | |
| 282 | + | ||
| 283 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 284 | + | ||
| 285 | + | } | |
| 286 | + | ||
| 287 | + | // Updates a list of accessible properties. | |
| 288 | + | // | |
| 289 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 290 | + | // value types of accessible properties. | |
| 291 | + | // | |
| 292 | + | // This function should be called by `GtkWidget` types whenever | |
| 293 | + | // an accessible property change must be communicated to assistive | |
| 294 | + | // technologies. | |
| 295 | + | // | |
| 296 | + | // Example: | |
| 297 | + | // ```c | |
| 298 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 299 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 300 | + | // | |
| 301 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 302 | + | // -1); | |
| 303 | + | // | |
| 304 | + | // ``` | |
| 305 | + | func (x *MultiLayoutView) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 306 | + | ||
| 307 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 308 | + | ||
| 309 | + | } | |
| 310 | + | ||
| 311 | + | // Updates an array of accessible properties. | |
| 312 | + | // | |
| 313 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 314 | + | // property change must be communicated to assistive technologies. | |
| 315 | + | // | |
| 316 | + | // This function is meant to be used by language bindings. | |
| 317 | + | func (x *MultiLayoutView) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 318 | + | ||
| 319 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 320 | + | ||
| 321 | + | } | |
| 322 | + | ||
| 323 | + | // Updates a list of accessible relations. | |
| 324 | + | // | |
| 325 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 326 | + | // relation change must be communicated to assistive technologies. | |
| 327 | + | // | |
| 328 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 329 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 330 | + | // | |
| 331 | + | // ```c | |
| 332 | + | // gtk_accessible_update_relation (accessible, | |
| 333 | + | // | |
| 334 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 335 | + | // ref1, NULL, | |
| 336 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 337 | + | // ref1, ref2, ref3, NULL, | |
| 338 | + | // -1); | |
| 339 | + | // | |
| 340 | + | // ``` | |
| 341 | + | func (x *MultiLayoutView) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 342 | + | ||
| 343 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 344 | + | ||
| 345 | + | } | |
| 346 | + | ||
| 347 | + | // Updates an array of accessible relations. | |
| 348 | + | // | |
| 349 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 350 | + | // relation change must be communicated to assistive technologies. | |
| 351 | + | // | |
| 352 | + | // This function is meant to be used by language bindings. | |
| 353 | + | func (x *MultiLayoutView) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 354 | + | ||
| 355 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 356 | + | ||
| 357 | + | } | |
| 358 | + | ||
| 359 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 360 | + | // documentation for the value types of accessible states. | |
| 361 | + | // | |
| 362 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 363 | + | // state change must be communicated to assistive technologies. | |
| 364 | + | // | |
| 365 | + | // Example: | |
| 366 | + | // ```c | |
| 367 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 368 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 369 | + | // | |
| 370 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 371 | + | // -1); | |
| 372 | + | // | |
| 373 | + | // ``` | |
| 374 | + | func (x *MultiLayoutView) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 375 | + | ||
| 376 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 377 | + | ||
| 378 | + | } | |
| 379 | + | ||
| 380 | + | // Updates an array of accessible states. | |
| 381 | + | // | |
| 382 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 383 | + | // state change must be communicated to assistive technologies. | |
| 384 | + | // | |
| 385 | + | // This function is meant to be used by language bindings. | |
| 386 | + | func (x *MultiLayoutView) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 387 | + | ||
| 388 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 389 | + | ||
| 390 | + | } | |
| 391 | + | ||
| 392 | + | // Gets the ID of the @buildable object. | |
| 393 | + | // | |
| 394 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 395 | + | // of the <object> tag used to construct the @buildable. | |
| 396 | + | func (x *MultiLayoutView) GetBuildableId() string { | |
| 397 | + | ||
| 398 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 399 | + | return cret | |
| 400 | + | } | |
| 401 | + | ||
| 402 | + | func init() { | |
| 403 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 404 | + | if err != nil { | |
| 405 | + | panic(err) | |
| 406 | + | } | |
| 407 | + | ||
| 408 | + | core.PuregoSafeRegister(&xMultiLayoutViewGLibType, lib, "adw_multi_layout_view_get_type") | |
| 409 | + | ||
| 410 | + | core.PuregoSafeRegister(&xNewMultiLayoutView, lib, "adw_multi_layout_view_new") | |
| 411 | + | ||
| 412 | + | core.PuregoSafeRegister(&xMultiLayoutViewAddLayout, lib, "adw_multi_layout_view_add_layout") | |
| 413 | + | core.PuregoSafeRegister(&xMultiLayoutViewGetChild, lib, "adw_multi_layout_view_get_child") | |
| 414 | + | core.PuregoSafeRegister(&xMultiLayoutViewGetLayout, lib, "adw_multi_layout_view_get_layout") | |
| 415 | + | core.PuregoSafeRegister(&xMultiLayoutViewGetLayoutByName, lib, "adw_multi_layout_view_get_layout_by_name") | |
| 416 | + | core.PuregoSafeRegister(&xMultiLayoutViewGetLayoutName, lib, "adw_multi_layout_view_get_layout_name") | |
| 417 | + | core.PuregoSafeRegister(&xMultiLayoutViewRemoveLayout, lib, "adw_multi_layout_view_remove_layout") | |
| 418 | + | core.PuregoSafeRegister(&xMultiLayoutViewSetChild, lib, "adw_multi_layout_view_set_child") | |
| 419 | + | core.PuregoSafeRegister(&xMultiLayoutViewSetLayout, lib, "adw_multi_layout_view_set_layout") | |
| 420 | + | core.PuregoSafeRegister(&xMultiLayoutViewSetLayoutName, lib, "adw_multi_layout_view_set_layout_name") | |
| 421 | + | ||
| 422 | + | } | |
A v4/adw/adw-navigation-split-view.go +574 -0
| @@ -0,0 +1,574 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 13 | + | ) | |
| 14 | + | ||
| 15 | + | type NavigationSplitViewClass struct { | |
| 16 | + | _ structs.HostLayout | |
| 17 | + | ||
| 18 | + | ParentClass uintptr | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | func (x *NavigationSplitViewClass) GoPointer() uintptr { | |
| 22 | + | return uintptr(unsafe.Pointer(x)) | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | // A widget presenting sidebar and content side by side or as a navigation view. | |
| 26 | + | // | |
| 27 | + | // <picture> | |
| 28 | + | // | |
| 29 | + | // <source srcset="navigation-split-view-dark.png" media="(prefers-color-scheme: dark)"> | |
| 30 | + | // <img src="navigation-split-view.png" alt="navigation-split-view"> | |
| 31 | + | // | |
| 32 | + | // </picture> | |
| 33 | + | // <picture> | |
| 34 | + | // | |
| 35 | + | // <source srcset="navigation-split-view-collapsed-dark.png" media="(prefers-color-scheme: dark)"> | |
| 36 | + | // <img src="navigation-split-view-collapsed.png" alt="navigation-split-view-collapsed"> | |
| 37 | + | // | |
| 38 | + | // </picture> | |
| 39 | + | // | |
| 40 | + | // `AdwNavigationSplitView` has two [class@NavigationPage] children: sidebar and | |
| 41 | + | // content, and displays them side by side. | |
| 42 | + | // | |
| 43 | + | // When [property@NavigationSplitView:collapsed] is set to `TRUE`, it instead | |
| 44 | + | // puts both children inside an [class@NavigationView]. The | |
| 45 | + | // [property@NavigationSplitView:show-content] controls which child is visible | |
| 46 | + | // while collapsed. | |
| 47 | + | // | |
| 48 | + | // See also [class@OverlaySplitView]. | |
| 49 | + | // | |
| 50 | + | // `AdwNavigationSplitView` is typically used together with an [class@Breakpoint] | |
| 51 | + | // setting the `collapsed` property to `TRUE` on small widths, as follows: | |
| 52 | + | // | |
| 53 | + | // ```xml | |
| 54 | + | // <object class="AdwWindow"> | |
| 55 | + | // | |
| 56 | + | // <property name="width-request">280</property> | |
| 57 | + | // <property name="height-request">200</property> | |
| 58 | + | // <property name="default-width">800</property> | |
| 59 | + | // <property name="default-height">800</property> | |
| 60 | + | // <child> | |
| 61 | + | // <object class="AdwBreakpoint"> | |
| 62 | + | // <condition>max-width: 400sp</condition> | |
| 63 | + | // <setter object="split_view" property="collapsed">True</setter> | |
| 64 | + | // </object> | |
| 65 | + | // </child> | |
| 66 | + | // <property name="content"> | |
| 67 | + | // <object class="AdwNavigationSplitView" id="split_view"> | |
| 68 | + | // <property name="sidebar"> | |
| 69 | + | // <object class="AdwNavigationPage"> | |
| 70 | + | // <property name="title" translatable="yes">Sidebar</property> | |
| 71 | + | // <property name="child"> | |
| 72 | + | // <!-- ... --> | |
| 73 | + | // </property> | |
| 74 | + | // </object> | |
| 75 | + | // </property> | |
| 76 | + | // <property name="content"> | |
| 77 | + | // <object class="AdwNavigationPage"> | |
| 78 | + | // <property name="title" translatable="yes">Content</property> | |
| 79 | + | // <property name="child"> | |
| 80 | + | // <!-- ... --> | |
| 81 | + | // </property> | |
| 82 | + | // </object> | |
| 83 | + | // </property> | |
| 84 | + | // </object> | |
| 85 | + | // </property> | |
| 86 | + | // | |
| 87 | + | // </object> | |
| 88 | + | // ``` | |
| 89 | + | // | |
| 90 | + | // ## Sizing | |
| 91 | + | // | |
| 92 | + | // When not collapsed, `AdwNavigationSplitView` changes the sidebar width | |
| 93 | + | // depending on its own width. | |
| 94 | + | // | |
| 95 | + | // If possible, it tries to allocate a fraction of the total width, controlled | |
| 96 | + | // with the [property@NavigationSplitView:sidebar-width-fraction] property. | |
| 97 | + | // | |
| 98 | + | // The sidebar also has minimum and maximum sizes, controlled with the | |
| 99 | + | // [property@NavigationSplitView:min-sidebar-width] and | |
| 100 | + | // [property@NavigationSplitView:max-sidebar-width] properties. | |
| 101 | + | // | |
| 102 | + | // The minimum and maximum sizes are using the length unit specified with the | |
| 103 | + | // [property@NavigationSplitView:sidebar-width-unit]. | |
| 104 | + | // | |
| 105 | + | // By default, sidebar is using 25% of the total width, with 180sp as the | |
| 106 | + | // minimum size and 280sp as the maximum size. | |
| 107 | + | // | |
| 108 | + | // ## Header Bar Integration | |
| 109 | + | // | |
| 110 | + | // When used inside `AdwNavigationSplitView`, [class@HeaderBar] will | |
| 111 | + | // automatically hide the window buttons in the middle. | |
| 112 | + | // | |
| 113 | + | // When collapsed, it also displays a back button for the content widget, as | |
| 114 | + | // well as the page titles. See [class@NavigationView] documentation for details. | |
| 115 | + | // | |
| 116 | + | // ## Actions | |
| 117 | + | // | |
| 118 | + | // `AdwNavigationSplitView` defines the same actions as `AdwNavigationView`, but | |
| 119 | + | // they can be used even when the split view is not collapsed: | |
| 120 | + | // | |
| 121 | + | // - `navigation.push` takes a string parameter specifying the tag of the page | |
| 122 | + | // to push. If it matches the tag of the content widget, it sets | |
| 123 | + | // [property@NavigationSplitView:show-content] to `TRUE`. | |
| 124 | + | // | |
| 125 | + | // - `navigation.pop` doesn't take any parameters and sets | |
| 126 | + | // [property@NavigationSplitView:show-content] to `FALSE`. | |
| 127 | + | // | |
| 128 | + | // ## `AdwNavigationSplitView` as `GtkBuildable` | |
| 129 | + | // | |
| 130 | + | // The `AdwNavigationSplitView` implementation of the [iface@Gtk.Buildable] | |
| 131 | + | // interface supports setting the sidebar widget by specifying “sidebar” as the | |
| 132 | + | // “type” attribute of a `<child>` element, Specifying “content” child type or | |
| 133 | + | // omitting it results in setting the content widget. | |
| 134 | + | // | |
| 135 | + | // ## CSS nodes | |
| 136 | + | // | |
| 137 | + | // `AdwNavigationSplitView` has a single CSS node with the name | |
| 138 | + | // `navigation-split-view`. | |
| 139 | + | // | |
| 140 | + | // When collapsed, it contains a child node with the name `navigation-view` | |
| 141 | + | // containing both children. | |
| 142 | + | // | |
| 143 | + | // ``` | |
| 144 | + | // navigation-split-view | |
| 145 | + | // ╰── navigation-view | |
| 146 | + | // | |
| 147 | + | // ├── [sidebar child] | |
| 148 | + | // ╰── [content child] | |
| 149 | + | // | |
| 150 | + | // ``` | |
| 151 | + | // | |
| 152 | + | // When not collapsed, it contains two nodes with the name `widget`, one with | |
| 153 | + | // the `.sidebar-pane` style class, the other one with `.content-view` style | |
| 154 | + | // class, containing the sidebar and content children respectively. | |
| 155 | + | // | |
| 156 | + | // ``` | |
| 157 | + | // navigation-split-view | |
| 158 | + | // ├── widget.sidebar-pane | |
| 159 | + | // │ ╰── [sidebar child] | |
| 160 | + | // ╰── widget.content-pane | |
| 161 | + | // | |
| 162 | + | // ╰── [content child] | |
| 163 | + | // | |
| 164 | + | // ``` | |
| 165 | + | // | |
| 166 | + | // ## Accessibility | |
| 167 | + | // | |
| 168 | + | // `AdwNavigationSplitView` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role. | |
| 169 | + | type NavigationSplitView struct { | |
| 170 | + | gtk.Widget | |
| 171 | + | } | |
| 172 | + | ||
| 173 | + | var xNavigationSplitViewGLibType func() types.GType | |
| 174 | + | ||
| 175 | + | func NavigationSplitViewGLibType() types.GType { | |
| 176 | + | return xNavigationSplitViewGLibType() | |
| 177 | + | } | |
| 178 | + | ||
| 179 | + | func NavigationSplitViewNewFromInternalPtr(ptr uintptr) *NavigationSplitView { | |
| 180 | + | cls := &NavigationSplitView{} | |
| 181 | + | cls.Ptr = ptr | |
| 182 | + | return cls | |
| 183 | + | } | |
| 184 | + | ||
| 185 | + | var xNewNavigationSplitView func() uintptr | |
| 186 | + | ||
| 187 | + | // Creates a new `AdwNavigationSplitView`. | |
| 188 | + | func NewNavigationSplitView() *NavigationSplitView { | |
| 189 | + | var cls *NavigationSplitView | |
| 190 | + | ||
| 191 | + | cret := xNewNavigationSplitView() | |
| 192 | + | ||
| 193 | + | if cret == 0 { | |
| 194 | + | return nil | |
| 195 | + | } | |
| 196 | + | gobject.IncreaseRef(cret) | |
| 197 | + | cls = &NavigationSplitView{} | |
| 198 | + | cls.Ptr = cret | |
| 199 | + | return cls | |
| 200 | + | } | |
| 201 | + | ||
| 202 | + | var xNavigationSplitViewGetCollapsed func(uintptr) bool | |
| 203 | + | ||
| 204 | + | // Gets whether @self is collapsed. | |
| 205 | + | func (x *NavigationSplitView) GetCollapsed() bool { | |
| 206 | + | ||
| 207 | + | cret := xNavigationSplitViewGetCollapsed(x.GoPointer()) | |
| 208 | + | return cret | |
| 209 | + | } | |
| 210 | + | ||
| 211 | + | var xNavigationSplitViewGetContent func(uintptr) uintptr | |
| 212 | + | ||
| 213 | + | // Sets the content widget for @self. | |
| 214 | + | func (x *NavigationSplitView) GetContent() *NavigationPage { | |
| 215 | + | var cls *NavigationPage | |
| 216 | + | ||
| 217 | + | cret := xNavigationSplitViewGetContent(x.GoPointer()) | |
| 218 | + | ||
| 219 | + | if cret == 0 { | |
| 220 | + | return nil | |
| 221 | + | } | |
| 222 | + | gobject.IncreaseRef(cret) | |
| 223 | + | cls = &NavigationPage{} | |
| 224 | + | cls.Ptr = cret | |
| 225 | + | return cls | |
| 226 | + | } | |
| 227 | + | ||
| 228 | + | var xNavigationSplitViewGetMaxSidebarWidth func(uintptr) float64 | |
| 229 | + | ||
| 230 | + | // Gets the maximum sidebar width for @self. | |
| 231 | + | func (x *NavigationSplitView) GetMaxSidebarWidth() float64 { | |
| 232 | + | ||
| 233 | + | cret := xNavigationSplitViewGetMaxSidebarWidth(x.GoPointer()) | |
| 234 | + | return cret | |
| 235 | + | } | |
| 236 | + | ||
| 237 | + | var xNavigationSplitViewGetMinSidebarWidth func(uintptr) float64 | |
| 238 | + | ||
| 239 | + | // Gets the minimum sidebar width for @self. | |
| 240 | + | func (x *NavigationSplitView) GetMinSidebarWidth() float64 { | |
| 241 | + | ||
| 242 | + | cret := xNavigationSplitViewGetMinSidebarWidth(x.GoPointer()) | |
| 243 | + | return cret | |
| 244 | + | } | |
| 245 | + | ||
| 246 | + | var xNavigationSplitViewGetShowContent func(uintptr) bool | |
| 247 | + | ||
| 248 | + | // Gets which page is visible when @self is collapsed. | |
| 249 | + | func (x *NavigationSplitView) GetShowContent() bool { | |
| 250 | + | ||
| 251 | + | cret := xNavigationSplitViewGetShowContent(x.GoPointer()) | |
| 252 | + | return cret | |
| 253 | + | } | |
| 254 | + | ||
| 255 | + | var xNavigationSplitViewGetSidebar func(uintptr) uintptr | |
| 256 | + | ||
| 257 | + | // Gets the sidebar widget for @self. | |
| 258 | + | func (x *NavigationSplitView) GetSidebar() *NavigationPage { | |
| 259 | + | var cls *NavigationPage | |
| 260 | + | ||
| 261 | + | cret := xNavigationSplitViewGetSidebar(x.GoPointer()) | |
| 262 | + | ||
| 263 | + | if cret == 0 { | |
| 264 | + | return nil | |
| 265 | + | } | |
| 266 | + | gobject.IncreaseRef(cret) | |
| 267 | + | cls = &NavigationPage{} | |
| 268 | + | cls.Ptr = cret | |
| 269 | + | return cls | |
| 270 | + | } | |
| 271 | + | ||
| 272 | + | var xNavigationSplitViewGetSidebarWidthFraction func(uintptr) float64 | |
| 273 | + | ||
| 274 | + | // Gets the preferred sidebar width fraction for @self. | |
| 275 | + | func (x *NavigationSplitView) GetSidebarWidthFraction() float64 { | |
| 276 | + | ||
| 277 | + | cret := xNavigationSplitViewGetSidebarWidthFraction(x.GoPointer()) | |
| 278 | + | return cret | |
| 279 | + | } | |
| 280 | + | ||
| 281 | + | var xNavigationSplitViewGetSidebarWidthUnit func(uintptr) LengthUnit | |
| 282 | + | ||
| 283 | + | // Gets the length unit for minimum and maximum sidebar widths. | |
| 284 | + | func (x *NavigationSplitView) GetSidebarWidthUnit() LengthUnit { | |
| 285 | + | ||
| 286 | + | cret := xNavigationSplitViewGetSidebarWidthUnit(x.GoPointer()) | |
| 287 | + | return cret | |
| 288 | + | } | |
| 289 | + | ||
| 290 | + | var xNavigationSplitViewSetCollapsed func(uintptr, bool) | |
| 291 | + | ||
| 292 | + | // Sets whether @self is collapsed. | |
| 293 | + | // | |
| 294 | + | // When collapsed, the children are put inside an [class@NavigationView], | |
| 295 | + | // otherwise they are displayed side by side. | |
| 296 | + | // | |
| 297 | + | // The [property@NavigationSplitView:show-content] controls which child is | |
| 298 | + | // visible while collapsed. | |
| 299 | + | func (x *NavigationSplitView) SetCollapsed(CollapsedVar bool) { | |
| 300 | + | ||
| 301 | + | xNavigationSplitViewSetCollapsed(x.GoPointer(), CollapsedVar) | |
| 302 | + | ||
| 303 | + | } | |
| 304 | + | ||
| 305 | + | var xNavigationSplitViewSetContent func(uintptr, uintptr) | |
| 306 | + | ||
| 307 | + | // Sets the content widget for @self. | |
| 308 | + | func (x *NavigationSplitView) SetContent(ContentVar *NavigationPage) { | |
| 309 | + | ||
| 310 | + | xNavigationSplitViewSetContent(x.GoPointer(), ContentVar.GoPointer()) | |
| 311 | + | ||
| 312 | + | } | |
| 313 | + | ||
| 314 | + | var xNavigationSplitViewSetMaxSidebarWidth func(uintptr, float64) | |
| 315 | + | ||
| 316 | + | // Sets the maximum sidebar width for @self. | |
| 317 | + | // | |
| 318 | + | // Maximum width is affected by | |
| 319 | + | // [property@NavigationSplitView:sidebar-width-unit]. | |
| 320 | + | // | |
| 321 | + | // The sidebar widget can still be allocated with larger width if its own | |
| 322 | + | // minimum width exceeds it. | |
| 323 | + | func (x *NavigationSplitView) SetMaxSidebarWidth(WidthVar float64) { | |
| 324 | + | ||
| 325 | + | xNavigationSplitViewSetMaxSidebarWidth(x.GoPointer(), WidthVar) | |
| 326 | + | ||
| 327 | + | } | |
| 328 | + | ||
| 329 | + | var xNavigationSplitViewSetMinSidebarWidth func(uintptr, float64) | |
| 330 | + | ||
| 331 | + | // Sets the minimum sidebar width for @self. | |
| 332 | + | // | |
| 333 | + | // Minimum width is affected by | |
| 334 | + | // [property@NavigationSplitView:sidebar-width-unit]. | |
| 335 | + | // | |
| 336 | + | // The sidebar widget can still be allocated with larger width if its own | |
| 337 | + | // minimum width exceeds it. | |
| 338 | + | func (x *NavigationSplitView) SetMinSidebarWidth(WidthVar float64) { | |
| 339 | + | ||
| 340 | + | xNavigationSplitViewSetMinSidebarWidth(x.GoPointer(), WidthVar) | |
| 341 | + | ||
| 342 | + | } | |
| 343 | + | ||
| 344 | + | var xNavigationSplitViewSetShowContent func(uintptr, bool) | |
| 345 | + | ||
| 346 | + | // Sets which page is visible when @self is collapsed. | |
| 347 | + | // | |
| 348 | + | // If set to `TRUE`, the content widget will be the visible page when | |
| 349 | + | // [property@NavigationSplitView:collapsed] is `TRUE`; otherwise the sidebar | |
| 350 | + | // widget will be visible. | |
| 351 | + | // | |
| 352 | + | // If the split view is already collapsed, the visible page changes immediately. | |
| 353 | + | func (x *NavigationSplitView) SetShowContent(ShowContentVar bool) { | |
| 354 | + | ||
| 355 | + | xNavigationSplitViewSetShowContent(x.GoPointer(), ShowContentVar) | |
| 356 | + | ||
| 357 | + | } | |
| 358 | + | ||
| 359 | + | var xNavigationSplitViewSetSidebar func(uintptr, uintptr) | |
| 360 | + | ||
| 361 | + | // Sets the sidebar widget for @self. | |
| 362 | + | func (x *NavigationSplitView) SetSidebar(SidebarVar *NavigationPage) { | |
| 363 | + | ||
| 364 | + | xNavigationSplitViewSetSidebar(x.GoPointer(), SidebarVar.GoPointer()) | |
| 365 | + | ||
| 366 | + | } | |
| 367 | + | ||
| 368 | + | var xNavigationSplitViewSetSidebarWidthFraction func(uintptr, float64) | |
| 369 | + | ||
| 370 | + | // Sets the preferred sidebar width as a fraction of the total width of @self. | |
| 371 | + | // | |
| 372 | + | // The preferred width is additionally limited by | |
| 373 | + | // [property@NavigationSplitView:min-sidebar-width] and | |
| 374 | + | // [property@NavigationSplitView:max-sidebar-width]. | |
| 375 | + | // | |
| 376 | + | // The sidebar widget can be allocated with larger width if its own minimum | |
| 377 | + | // width exceeds the preferred width. | |
| 378 | + | func (x *NavigationSplitView) SetSidebarWidthFraction(FractionVar float64) { | |
| 379 | + | ||
| 380 | + | xNavigationSplitViewSetSidebarWidthFraction(x.GoPointer(), FractionVar) | |
| 381 | + | ||
| 382 | + | } | |
| 383 | + | ||
| 384 | + | var xNavigationSplitViewSetSidebarWidthUnit func(uintptr, LengthUnit) | |
| 385 | + | ||
| 386 | + | // Sets the length unit for minimum and maximum sidebar widths. | |
| 387 | + | // | |
| 388 | + | // See [property@NavigationSplitView:min-sidebar-width] and | |
| 389 | + | // [property@NavigationSplitView:max-sidebar-width]. | |
| 390 | + | func (x *NavigationSplitView) SetSidebarWidthUnit(UnitVar LengthUnit) { | |
| 391 | + | ||
| 392 | + | xNavigationSplitViewSetSidebarWidthUnit(x.GoPointer(), UnitVar) | |
| 393 | + | ||
| 394 | + | } | |
| 395 | + | ||
| 396 | + | func (c *NavigationSplitView) GoPointer() uintptr { | |
| 397 | + | return c.Ptr | |
| 398 | + | } | |
| 399 | + | ||
| 400 | + | func (c *NavigationSplitView) SetGoPointer(ptr uintptr) { | |
| 401 | + | c.Ptr = ptr | |
| 402 | + | } | |
| 403 | + | ||
| 404 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 405 | + | func (x *NavigationSplitView) GetAccessibleRole() gtk.AccessibleRole { | |
| 406 | + | ||
| 407 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 408 | + | return cret | |
| 409 | + | } | |
| 410 | + | ||
| 411 | + | // Resets the accessible @property to its default value. | |
| 412 | + | func (x *NavigationSplitView) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 413 | + | ||
| 414 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 415 | + | ||
| 416 | + | } | |
| 417 | + | ||
| 418 | + | // Resets the accessible @relation to its default value. | |
| 419 | + | func (x *NavigationSplitView) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 420 | + | ||
| 421 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 422 | + | ||
| 423 | + | } | |
| 424 | + | ||
| 425 | + | // Resets the accessible @state to its default value. | |
| 426 | + | func (x *NavigationSplitView) ResetState(StateVar gtk.AccessibleState) { | |
| 427 | + | ||
| 428 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 429 | + | ||
| 430 | + | } | |
| 431 | + | ||
| 432 | + | // Updates a list of accessible properties. | |
| 433 | + | // | |
| 434 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 435 | + | // value types of accessible properties. | |
| 436 | + | // | |
| 437 | + | // This function should be called by `GtkWidget` types whenever | |
| 438 | + | // an accessible property change must be communicated to assistive | |
| 439 | + | // technologies. | |
| 440 | + | // | |
| 441 | + | // Example: | |
| 442 | + | // ```c | |
| 443 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 444 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 445 | + | // | |
| 446 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 447 | + | // -1); | |
| 448 | + | // | |
| 449 | + | // ``` | |
| 450 | + | func (x *NavigationSplitView) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 451 | + | ||
| 452 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 453 | + | ||
| 454 | + | } | |
| 455 | + | ||
| 456 | + | // Updates an array of accessible properties. | |
| 457 | + | // | |
| 458 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 459 | + | // property change must be communicated to assistive technologies. | |
| 460 | + | // | |
| 461 | + | // This function is meant to be used by language bindings. | |
| 462 | + | func (x *NavigationSplitView) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 463 | + | ||
| 464 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 465 | + | ||
| 466 | + | } | |
| 467 | + | ||
| 468 | + | // Updates a list of accessible relations. | |
| 469 | + | // | |
| 470 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 471 | + | // relation change must be communicated to assistive technologies. | |
| 472 | + | // | |
| 473 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 474 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 475 | + | // | |
| 476 | + | // ```c | |
| 477 | + | // gtk_accessible_update_relation (accessible, | |
| 478 | + | // | |
| 479 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 480 | + | // ref1, NULL, | |
| 481 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 482 | + | // ref1, ref2, ref3, NULL, | |
| 483 | + | // -1); | |
| 484 | + | // | |
| 485 | + | // ``` | |
| 486 | + | func (x *NavigationSplitView) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 487 | + | ||
| 488 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 489 | + | ||
| 490 | + | } | |
| 491 | + | ||
| 492 | + | // Updates an array of accessible relations. | |
| 493 | + | // | |
| 494 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 495 | + | // relation change must be communicated to assistive technologies. | |
| 496 | + | // | |
| 497 | + | // This function is meant to be used by language bindings. | |
| 498 | + | func (x *NavigationSplitView) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 499 | + | ||
| 500 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 501 | + | ||
| 502 | + | } | |
| 503 | + | ||
| 504 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 505 | + | // documentation for the value types of accessible states. | |
| 506 | + | // | |
| 507 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 508 | + | // state change must be communicated to assistive technologies. | |
| 509 | + | // | |
| 510 | + | // Example: | |
| 511 | + | // ```c | |
| 512 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 513 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 514 | + | // | |
| 515 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 516 | + | // -1); | |
| 517 | + | // | |
| 518 | + | // ``` | |
| 519 | + | func (x *NavigationSplitView) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 520 | + | ||
| 521 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 522 | + | ||
| 523 | + | } | |
| 524 | + | ||
| 525 | + | // Updates an array of accessible states. | |
| 526 | + | // | |
| 527 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 528 | + | // state change must be communicated to assistive technologies. | |
| 529 | + | // | |
| 530 | + | // This function is meant to be used by language bindings. | |
| 531 | + | func (x *NavigationSplitView) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 532 | + | ||
| 533 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 534 | + | ||
| 535 | + | } | |
| 536 | + | ||
| 537 | + | // Gets the ID of the @buildable object. | |
| 538 | + | // | |
| 539 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 540 | + | // of the <object> tag used to construct the @buildable. | |
| 541 | + | func (x *NavigationSplitView) GetBuildableId() string { | |
| 542 | + | ||
| 543 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 544 | + | return cret | |
| 545 | + | } | |
| 546 | + | ||
| 547 | + | func init() { | |
| 548 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 549 | + | if err != nil { | |
| 550 | + | panic(err) | |
| 551 | + | } | |
| 552 | + | ||
| 553 | + | core.PuregoSafeRegister(&xNavigationSplitViewGLibType, lib, "adw_navigation_split_view_get_type") | |
| 554 | + | ||
| 555 | + | core.PuregoSafeRegister(&xNewNavigationSplitView, lib, "adw_navigation_split_view_new") | |
| 556 | + | ||
| 557 | + | core.PuregoSafeRegister(&xNavigationSplitViewGetCollapsed, lib, "adw_navigation_split_view_get_collapsed") | |
| 558 | + | core.PuregoSafeRegister(&xNavigationSplitViewGetContent, lib, "adw_navigation_split_view_get_content") | |
| 559 | + | core.PuregoSafeRegister(&xNavigationSplitViewGetMaxSidebarWidth, lib, "adw_navigation_split_view_get_max_sidebar_width") | |
| 560 | + | core.PuregoSafeRegister(&xNavigationSplitViewGetMinSidebarWidth, lib, "adw_navigation_split_view_get_min_sidebar_width") | |
| 561 | + | core.PuregoSafeRegister(&xNavigationSplitViewGetShowContent, lib, "adw_navigation_split_view_get_show_content") | |
| 562 | + | core.PuregoSafeRegister(&xNavigationSplitViewGetSidebar, lib, "adw_navigation_split_view_get_sidebar") | |
| 563 | + | core.PuregoSafeRegister(&xNavigationSplitViewGetSidebarWidthFraction, lib, "adw_navigation_split_view_get_sidebar_width_fraction") | |
| 564 | + | core.PuregoSafeRegister(&xNavigationSplitViewGetSidebarWidthUnit, lib, "adw_navigation_split_view_get_sidebar_width_unit") | |
| 565 | + | core.PuregoSafeRegister(&xNavigationSplitViewSetCollapsed, lib, "adw_navigation_split_view_set_collapsed") | |
| 566 | + | core.PuregoSafeRegister(&xNavigationSplitViewSetContent, lib, "adw_navigation_split_view_set_content") | |
| 567 | + | core.PuregoSafeRegister(&xNavigationSplitViewSetMaxSidebarWidth, lib, "adw_navigation_split_view_set_max_sidebar_width") | |
| 568 | + | core.PuregoSafeRegister(&xNavigationSplitViewSetMinSidebarWidth, lib, "adw_navigation_split_view_set_min_sidebar_width") | |
| 569 | + | core.PuregoSafeRegister(&xNavigationSplitViewSetShowContent, lib, "adw_navigation_split_view_set_show_content") | |
| 570 | + | core.PuregoSafeRegister(&xNavigationSplitViewSetSidebar, lib, "adw_navigation_split_view_set_sidebar") | |
| 571 | + | core.PuregoSafeRegister(&xNavigationSplitViewSetSidebarWidthFraction, lib, "adw_navigation_split_view_set_sidebar_width_fraction") | |
| 572 | + | core.PuregoSafeRegister(&xNavigationSplitViewSetSidebarWidthUnit, lib, "adw_navigation_split_view_set_sidebar_width_unit") | |
| 573 | + | ||
| 574 | + | } | |
A v4/adw/adw-navigation-view.go +1286 -0
| @@ -0,0 +1,1286 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gdk" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gio" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 13 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 14 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 15 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 16 | + | ) | |
| 17 | + | ||
| 18 | + | type NavigationPageClass struct { | |
| 19 | + | _ structs.HostLayout | |
| 20 | + | ||
| 21 | + | ParentClass uintptr | |
| 22 | + | ||
| 23 | + | Padding [8]uintptr | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | func (x *NavigationPageClass) GoPointer() uintptr { | |
| 27 | + | return uintptr(unsafe.Pointer(x)) | |
| 28 | + | } | |
| 29 | + | ||
| 30 | + | type NavigationViewClass struct { | |
| 31 | + | _ structs.HostLayout | |
| 32 | + | ||
| 33 | + | ParentClass uintptr | |
| 34 | + | } | |
| 35 | + | ||
| 36 | + | func (x *NavigationViewClass) GoPointer() uintptr { | |
| 37 | + | return uintptr(unsafe.Pointer(x)) | |
| 38 | + | } | |
| 39 | + | ||
| 40 | + | // A page within [class@NavigationView] or [class@NavigationSplitView]. | |
| 41 | + | // | |
| 42 | + | // Each page has a child widget, a title and optionally a tag. | |
| 43 | + | // | |
| 44 | + | // The [signal@NavigationPage::showing], [signal@NavigationPage::shown], | |
| 45 | + | // [signal@NavigationPage::hiding] and [signal@NavigationPage::hidden] signals | |
| 46 | + | // can be used to track the page's visibility within its `AdwNavigationView`. | |
| 47 | + | // | |
| 48 | + | // ## Header Bar Integration | |
| 49 | + | // | |
| 50 | + | // When placed inside `AdwNavigationPage`, [class@HeaderBar] will display the | |
| 51 | + | // page title instead of window title. | |
| 52 | + | // | |
| 53 | + | // When used together with [class@NavigationView], it will also display a back | |
| 54 | + | // button that can be used to go back to the previous page. Set | |
| 55 | + | // [property@HeaderBar:show-back-button] to `FALSE` to disable that behavior if | |
| 56 | + | // it's unwanted. | |
| 57 | + | // | |
| 58 | + | // ## CSS Nodes | |
| 59 | + | // | |
| 60 | + | // `AdwNavigationPage` has a single CSS node with name | |
| 61 | + | // `navigation-view-page`. | |
| 62 | + | // | |
| 63 | + | // ## Accessibility | |
| 64 | + | // | |
| 65 | + | // `AdwNavigationPage` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role. | |
| 66 | + | type NavigationPage struct { | |
| 67 | + | gtk.Widget | |
| 68 | + | } | |
| 69 | + | ||
| 70 | + | var xNavigationPageGLibType func() types.GType | |
| 71 | + | ||
| 72 | + | func NavigationPageGLibType() types.GType { | |
| 73 | + | return xNavigationPageGLibType() | |
| 74 | + | } | |
| 75 | + | ||
| 76 | + | func NavigationPageNewFromInternalPtr(ptr uintptr) *NavigationPage { | |
| 77 | + | cls := &NavigationPage{} | |
| 78 | + | cls.Ptr = ptr | |
| 79 | + | return cls | |
| 80 | + | } | |
| 81 | + | ||
| 82 | + | var xNewNavigationPage func(uintptr, string) uintptr | |
| 83 | + | ||
| 84 | + | // Creates a new `AdwNavigationPage`. | |
| 85 | + | func NewNavigationPage(ChildVar *gtk.Widget, TitleVar string) *NavigationPage { | |
| 86 | + | var cls *NavigationPage | |
| 87 | + | ||
| 88 | + | cret := xNewNavigationPage(ChildVar.GoPointer(), TitleVar) | |
| 89 | + | ||
| 90 | + | if cret == 0 { | |
| 91 | + | return nil | |
| 92 | + | } | |
| 93 | + | gobject.IncreaseRef(cret) | |
| 94 | + | cls = &NavigationPage{} | |
| 95 | + | cls.Ptr = cret | |
| 96 | + | return cls | |
| 97 | + | } | |
| 98 | + | ||
| 99 | + | var xNewNavigationPageWithTag func(uintptr, string, string) uintptr | |
| 100 | + | ||
| 101 | + | // Creates a new `AdwNavigationPage` with provided tag. | |
| 102 | + | func NewNavigationPageWithTag(ChildVar *gtk.Widget, TitleVar string, TagVar string) *NavigationPage { | |
| 103 | + | var cls *NavigationPage | |
| 104 | + | ||
| 105 | + | cret := xNewNavigationPageWithTag(ChildVar.GoPointer(), TitleVar, TagVar) | |
| 106 | + | ||
| 107 | + | if cret == 0 { | |
| 108 | + | return nil | |
| 109 | + | } | |
| 110 | + | gobject.IncreaseRef(cret) | |
| 111 | + | cls = &NavigationPage{} | |
| 112 | + | cls.Ptr = cret | |
| 113 | + | return cls | |
| 114 | + | } | |
| 115 | + | ||
| 116 | + | var xNavigationPageGetCanPop func(uintptr) bool | |
| 117 | + | ||
| 118 | + | // Gets whether @self can be popped from navigation stack. | |
| 119 | + | func (x *NavigationPage) GetCanPop() bool { | |
| 120 | + | ||
| 121 | + | cret := xNavigationPageGetCanPop(x.GoPointer()) | |
| 122 | + | return cret | |
| 123 | + | } | |
| 124 | + | ||
| 125 | + | var xNavigationPageGetChild func(uintptr) uintptr | |
| 126 | + | ||
| 127 | + | // Gets the child widget of @self. | |
| 128 | + | func (x *NavigationPage) GetChild() *gtk.Widget { | |
| 129 | + | var cls *gtk.Widget | |
| 130 | + | ||
| 131 | + | cret := xNavigationPageGetChild(x.GoPointer()) | |
| 132 | + | ||
| 133 | + | if cret == 0 { | |
| 134 | + | return nil | |
| 135 | + | } | |
| 136 | + | gobject.IncreaseRef(cret) | |
| 137 | + | cls = >k.Widget{} | |
| 138 | + | cls.Ptr = cret | |
| 139 | + | return cls | |
| 140 | + | } | |
| 141 | + | ||
| 142 | + | var xNavigationPageGetTag func(uintptr) string | |
| 143 | + | ||
| 144 | + | // Gets the tag of @self. | |
| 145 | + | func (x *NavigationPage) GetTag() string { | |
| 146 | + | ||
| 147 | + | cret := xNavigationPageGetTag(x.GoPointer()) | |
| 148 | + | return cret | |
| 149 | + | } | |
| 150 | + | ||
| 151 | + | var xNavigationPageGetTitle func(uintptr) string | |
| 152 | + | ||
| 153 | + | // Gets the title of @self. | |
| 154 | + | func (x *NavigationPage) GetTitle() string { | |
| 155 | + | ||
| 156 | + | cret := xNavigationPageGetTitle(x.GoPointer()) | |
| 157 | + | return cret | |
| 158 | + | } | |
| 159 | + | ||
| 160 | + | var xNavigationPageSetCanPop func(uintptr, bool) | |
| 161 | + | ||
| 162 | + | // Sets whether @self can be popped from navigation stack. | |
| 163 | + | // | |
| 164 | + | // Set it to `FALSE` to disable shortcuts and gestures, as well as remove the | |
| 165 | + | // back button from [class@HeaderBar]. | |
| 166 | + | // | |
| 167 | + | // Manually calling [method@NavigationView.pop] or using the `navigation.pop` | |
| 168 | + | // action will still work. | |
| 169 | + | // | |
| 170 | + | // See [property@HeaderBar:show-back-button] for removing only the back button, | |
| 171 | + | // but not shortcuts. | |
| 172 | + | func (x *NavigationPage) SetCanPop(CanPopVar bool) { | |
| 173 | + | ||
| 174 | + | xNavigationPageSetCanPop(x.GoPointer(), CanPopVar) | |
| 175 | + | ||
| 176 | + | } | |
| 177 | + | ||
| 178 | + | var xNavigationPageSetChild func(uintptr, uintptr) | |
| 179 | + | ||
| 180 | + | // Sets the child widget of @self. | |
| 181 | + | func (x *NavigationPage) SetChild(ChildVar *gtk.Widget) { | |
| 182 | + | ||
| 183 | + | xNavigationPageSetChild(x.GoPointer(), ChildVar.GoPointer()) | |
| 184 | + | ||
| 185 | + | } | |
| 186 | + | ||
| 187 | + | var xNavigationPageSetTag func(uintptr, string) | |
| 188 | + | ||
| 189 | + | // Sets the tag for @self. | |
| 190 | + | // | |
| 191 | + | // The tag can be used to retrieve the page with | |
| 192 | + | // [method@NavigationView.find_page], as well as with | |
| 193 | + | // [method@NavigationView.push_by_tag], [method@NavigationView.pop_to_tag] or | |
| 194 | + | // [method@NavigationView.replace_with_tags]. | |
| 195 | + | // | |
| 196 | + | // Tags must be unique within each [class@NavigationView]. | |
| 197 | + | // | |
| 198 | + | // The tag also must be set to use the `navigation.push` action. | |
| 199 | + | func (x *NavigationPage) SetTag(TagVar string) { | |
| 200 | + | ||
| 201 | + | xNavigationPageSetTag(x.GoPointer(), TagVar) | |
| 202 | + | ||
| 203 | + | } | |
| 204 | + | ||
| 205 | + | var xNavigationPageSetTitle func(uintptr, string) | |
| 206 | + | ||
| 207 | + | // Sets the title of @self. | |
| 208 | + | // | |
| 209 | + | // It's displayed in [class@HeaderBar] instead of the window title, and used as | |
| 210 | + | // the tooltip on the next page's back button, as well as by screen reader. | |
| 211 | + | func (x *NavigationPage) SetTitle(TitleVar string) { | |
| 212 | + | ||
| 213 | + | xNavigationPageSetTitle(x.GoPointer(), TitleVar) | |
| 214 | + | ||
| 215 | + | } | |
| 216 | + | ||
| 217 | + | func (c *NavigationPage) GoPointer() uintptr { | |
| 218 | + | return c.Ptr | |
| 219 | + | } | |
| 220 | + | ||
| 221 | + | func (c *NavigationPage) SetGoPointer(ptr uintptr) { | |
| 222 | + | c.Ptr = ptr | |
| 223 | + | } | |
| 224 | + | ||
| 225 | + | // Emitted when the navigation view transition has been completed and the page | |
| 226 | + | // is fully hidden. | |
| 227 | + | // | |
| 228 | + | // It will always be preceded by [signal@NavigationPage::hiding] or | |
| 229 | + | // [signal@NavigationPage::showing]. | |
| 230 | + | func (x *NavigationPage) ConnectHidden(cb *func(NavigationPage)) uint32 { | |
| 231 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 232 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 233 | + | return gobject.SignalConnect(x.GoPointer(), "hidden", cbRefPtr) | |
| 234 | + | } | |
| 235 | + | ||
| 236 | + | fcb := func(clsPtr uintptr) { | |
| 237 | + | fa := NavigationPage{} | |
| 238 | + | fa.Ptr = clsPtr | |
| 239 | + | cbFn := *cb | |
| 240 | + | ||
| 241 | + | cbFn(fa) | |
| 242 | + | ||
| 243 | + | } | |
| 244 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 245 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 246 | + | return gobject.SignalConnect(x.GoPointer(), "hidden", cbRefPtr) | |
| 247 | + | } | |
| 248 | + | ||
| 249 | + | // Emitted when the page starts hiding at the beginning of the navigation view | |
| 250 | + | // transition. | |
| 251 | + | // | |
| 252 | + | // It will always be followed by [signal@NavigationPage::hidden] or | |
| 253 | + | // [signal@NavigationPage::shown]. | |
| 254 | + | func (x *NavigationPage) ConnectHiding(cb *func(NavigationPage)) uint32 { | |
| 255 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 256 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 257 | + | return gobject.SignalConnect(x.GoPointer(), "hiding", cbRefPtr) | |
| 258 | + | } | |
| 259 | + | ||
| 260 | + | fcb := func(clsPtr uintptr) { | |
| 261 | + | fa := NavigationPage{} | |
| 262 | + | fa.Ptr = clsPtr | |
| 263 | + | cbFn := *cb | |
| 264 | + | ||
| 265 | + | cbFn(fa) | |
| 266 | + | ||
| 267 | + | } | |
| 268 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 269 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 270 | + | return gobject.SignalConnect(x.GoPointer(), "hiding", cbRefPtr) | |
| 271 | + | } | |
| 272 | + | ||
| 273 | + | // Emitted when the page shows at the beginning of the navigation view | |
| 274 | + | // transition. | |
| 275 | + | // | |
| 276 | + | // It will always be followed by [signal@NavigationPage::shown] or | |
| 277 | + | // [signal@NavigationPage::hidden]. | |
| 278 | + | func (x *NavigationPage) ConnectShowing(cb *func(NavigationPage)) uint32 { | |
| 279 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 280 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 281 | + | return gobject.SignalConnect(x.GoPointer(), "showing", cbRefPtr) | |
| 282 | + | } | |
| 283 | + | ||
| 284 | + | fcb := func(clsPtr uintptr) { | |
| 285 | + | fa := NavigationPage{} | |
| 286 | + | fa.Ptr = clsPtr | |
| 287 | + | cbFn := *cb | |
| 288 | + | ||
| 289 | + | cbFn(fa) | |
| 290 | + | ||
| 291 | + | } | |
| 292 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 293 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 294 | + | return gobject.SignalConnect(x.GoPointer(), "showing", cbRefPtr) | |
| 295 | + | } | |
| 296 | + | ||
| 297 | + | // Emitted when the navigation view transition has been completed and the page | |
| 298 | + | // is fully shown. | |
| 299 | + | // | |
| 300 | + | // It will always be preceded by [signal@NavigationPage::showing] or | |
| 301 | + | // [signal@NavigationPage::hiding]. | |
| 302 | + | func (x *NavigationPage) ConnectShown(cb *func(NavigationPage)) uint32 { | |
| 303 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 304 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 305 | + | return gobject.SignalConnect(x.GoPointer(), "shown", cbRefPtr) | |
| 306 | + | } | |
| 307 | + | ||
| 308 | + | fcb := func(clsPtr uintptr) { | |
| 309 | + | fa := NavigationPage{} | |
| 310 | + | fa.Ptr = clsPtr | |
| 311 | + | cbFn := *cb | |
| 312 | + | ||
| 313 | + | cbFn(fa) | |
| 314 | + | ||
| 315 | + | } | |
| 316 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 317 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 318 | + | return gobject.SignalConnect(x.GoPointer(), "shown", cbRefPtr) | |
| 319 | + | } | |
| 320 | + | ||
| 321 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 322 | + | func (x *NavigationPage) GetAccessibleRole() gtk.AccessibleRole { | |
| 323 | + | ||
| 324 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 325 | + | return cret | |
| 326 | + | } | |
| 327 | + | ||
| 328 | + | // Resets the accessible @property to its default value. | |
| 329 | + | func (x *NavigationPage) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 330 | + | ||
| 331 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 332 | + | ||
| 333 | + | } | |
| 334 | + | ||
| 335 | + | // Resets the accessible @relation to its default value. | |
| 336 | + | func (x *NavigationPage) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 337 | + | ||
| 338 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 339 | + | ||
| 340 | + | } | |
| 341 | + | ||
| 342 | + | // Resets the accessible @state to its default value. | |
| 343 | + | func (x *NavigationPage) ResetState(StateVar gtk.AccessibleState) { | |
| 344 | + | ||
| 345 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 346 | + | ||
| 347 | + | } | |
| 348 | + | ||
| 349 | + | // Updates a list of accessible properties. | |
| 350 | + | // | |
| 351 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 352 | + | // value types of accessible properties. | |
| 353 | + | // | |
| 354 | + | // This function should be called by `GtkWidget` types whenever | |
| 355 | + | // an accessible property change must be communicated to assistive | |
| 356 | + | // technologies. | |
| 357 | + | // | |
| 358 | + | // Example: | |
| 359 | + | // ```c | |
| 360 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 361 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 362 | + | // | |
| 363 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 364 | + | // -1); | |
| 365 | + | // | |
| 366 | + | // ``` | |
| 367 | + | func (x *NavigationPage) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 368 | + | ||
| 369 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 370 | + | ||
| 371 | + | } | |
| 372 | + | ||
| 373 | + | // Updates an array of accessible properties. | |
| 374 | + | // | |
| 375 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 376 | + | // property change must be communicated to assistive technologies. | |
| 377 | + | // | |
| 378 | + | // This function is meant to be used by language bindings. | |
| 379 | + | func (x *NavigationPage) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 380 | + | ||
| 381 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 382 | + | ||
| 383 | + | } | |
| 384 | + | ||
| 385 | + | // Updates a list of accessible relations. | |
| 386 | + | // | |
| 387 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 388 | + | // relation change must be communicated to assistive technologies. | |
| 389 | + | // | |
| 390 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 391 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 392 | + | // | |
| 393 | + | // ```c | |
| 394 | + | // gtk_accessible_update_relation (accessible, | |
| 395 | + | // | |
| 396 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 397 | + | // ref1, NULL, | |
| 398 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 399 | + | // ref1, ref2, ref3, NULL, | |
| 400 | + | // -1); | |
| 401 | + | // | |
| 402 | + | // ``` | |
| 403 | + | func (x *NavigationPage) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 404 | + | ||
| 405 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 406 | + | ||
| 407 | + | } | |
| 408 | + | ||
| 409 | + | // Updates an array of accessible relations. | |
| 410 | + | // | |
| 411 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 412 | + | // relation change must be communicated to assistive technologies. | |
| 413 | + | // | |
| 414 | + | // This function is meant to be used by language bindings. | |
| 415 | + | func (x *NavigationPage) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 416 | + | ||
| 417 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 418 | + | ||
| 419 | + | } | |
| 420 | + | ||
| 421 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 422 | + | // documentation for the value types of accessible states. | |
| 423 | + | // | |
| 424 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 425 | + | // state change must be communicated to assistive technologies. | |
| 426 | + | // | |
| 427 | + | // Example: | |
| 428 | + | // ```c | |
| 429 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 430 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 431 | + | // | |
| 432 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 433 | + | // -1); | |
| 434 | + | // | |
| 435 | + | // ``` | |
| 436 | + | func (x *NavigationPage) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 437 | + | ||
| 438 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 439 | + | ||
| 440 | + | } | |
| 441 | + | ||
| 442 | + | // Updates an array of accessible states. | |
| 443 | + | // | |
| 444 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 445 | + | // state change must be communicated to assistive technologies. | |
| 446 | + | // | |
| 447 | + | // This function is meant to be used by language bindings. | |
| 448 | + | func (x *NavigationPage) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 449 | + | ||
| 450 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 451 | + | ||
| 452 | + | } | |
| 453 | + | ||
| 454 | + | // Gets the ID of the @buildable object. | |
| 455 | + | // | |
| 456 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 457 | + | // of the <object> tag used to construct the @buildable. | |
| 458 | + | func (x *NavigationPage) GetBuildableId() string { | |
| 459 | + | ||
| 460 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 461 | + | return cret | |
| 462 | + | } | |
| 463 | + | ||
| 464 | + | // A page-based navigation container. | |
| 465 | + | // | |
| 466 | + | // <picture> | |
| 467 | + | // | |
| 468 | + | // <source srcset="navigation-view-dark.png" media="(prefers-color-scheme: dark)"> | |
| 469 | + | // <img src="navigation-view.png" alt="navigation-view"> | |
| 470 | + | // | |
| 471 | + | // </picture> | |
| 472 | + | // | |
| 473 | + | // `AdwNavigationView` presents one child at a time, similar to | |
| 474 | + | // [class@Gtk.Stack]. | |
| 475 | + | // | |
| 476 | + | // `AdwNavigationView` can only contain [class@NavigationPage] children. | |
| 477 | + | // | |
| 478 | + | // It maintains a navigation stack that can be controlled with | |
| 479 | + | // [method@NavigationView.push] and [method@NavigationView.pop]. The whole | |
| 480 | + | // navigation stack can also be replaced using [method@NavigationView.replace]. | |
| 481 | + | // | |
| 482 | + | // `AdwNavigationView` allows to manage pages statically or dynamically. | |
| 483 | + | // | |
| 484 | + | // Static pages can be added using the [method@NavigationView.add] method. The | |
| 485 | + | // `AdwNavigationView` will keep a reference to these pages, but they aren't | |
| 486 | + | // accessible to the user until [method@NavigationView.push] is called (except | |
| 487 | + | // for the first page, which is pushed automatically). Use the | |
| 488 | + | // [method@NavigationView.remove] method to remove them. This is useful for | |
| 489 | + | // applications that have a small number of unique pages and just need | |
| 490 | + | // navigation between them. | |
| 491 | + | // | |
| 492 | + | // Dynamic pages are automatically destroyed once they are popped off the | |
| 493 | + | // navigation stack. To add a page like this, push it using the | |
| 494 | + | // [method@NavigationView.push] method without calling | |
| 495 | + | // [method@NavigationView.add] first. | |
| 496 | + | // | |
| 497 | + | // ## Tags | |
| 498 | + | // | |
| 499 | + | // Static pages, as well as any pages in the navigation stack, can be accessed | |
| 500 | + | // by their [property@NavigationPage:tag]. For example, | |
| 501 | + | // [method@NavigationView.push_by_tag] can be used to push a static page that's | |
| 502 | + | // not in the navigation stack without having to keep a reference to it manually. | |
| 503 | + | // | |
| 504 | + | // ## Header Bar Integration | |
| 505 | + | // | |
| 506 | + | // When used inside `AdwNavigationView`, [class@HeaderBar] will automatically | |
| 507 | + | // display a back button that can be used to go back to the previous page when | |
| 508 | + | // possible. The button also has a context menu, allowing to pop multiple pages | |
| 509 | + | // at once, potentially across multiple navigation views. | |
| 510 | + | // | |
| 511 | + | // Set [property@HeaderBar:show-back-button] to `FALSE` to disable this behavior | |
| 512 | + | // in rare scenarios where it's unwanted. | |
| 513 | + | // | |
| 514 | + | // `AdwHeaderBar` will also display the title of the `AdwNavigationPage` it's | |
| 515 | + | // placed into, so most applications shouldn't need to customize it at all. | |
| 516 | + | // | |
| 517 | + | // ## Shortcuts and Gestures | |
| 518 | + | // | |
| 519 | + | // `AdwNavigationView` supports the following shortcuts for going to the | |
| 520 | + | // previous page: | |
| 521 | + | // | |
| 522 | + | // - <kbd>Escape</kbd> (unless [property@NavigationView:pop-on-escape] is set to | |
| 523 | + | // `FALSE`) | |
| 524 | + | // - <kbd>Alt</kbd>+<kbd>←</kbd> | |
| 525 | + | // - Back mouse button | |
| 526 | + | // | |
| 527 | + | // Additionally, it supports interactive gestures: | |
| 528 | + | // | |
| 529 | + | // - One-finger swipe towards the right on touchscreens | |
| 530 | + | // - Scrolling towards the right on touchpads (usually two-finger swipe) | |
| 531 | + | // | |
| 532 | + | // These gestures have transitions enabled regardless of the | |
| 533 | + | // [property@NavigationView:animate-transitions] value. | |
| 534 | + | // | |
| 535 | + | // Applications can also enable shortcuts for pushing another page onto the | |
| 536 | + | // navigation stack via connecting to the [signal@NavigationView::get-next-page] | |
| 537 | + | // signal, in that case the following shortcuts are supported: | |
| 538 | + | // | |
| 539 | + | // - <kbd>Alt</kbd>+<kbd>→</kbd> | |
| 540 | + | // - Forward mouse button | |
| 541 | + | // - Swipe/scrolling towards the left | |
| 542 | + | // | |
| 543 | + | // For right-to-left locales, the gestures and shortcuts are reversed. | |
| 544 | + | // | |
| 545 | + | // [property@NavigationPage:can-pop] can be used to disable them, along with the | |
| 546 | + | // header bar back buttons. | |
| 547 | + | // | |
| 548 | + | // ## Actions | |
| 549 | + | // | |
| 550 | + | // `AdwNavigationView` defines actions for controlling the navigation stack. | |
| 551 | + | // actions for controlling the navigation stack: | |
| 552 | + | // | |
| 553 | + | // - `navigation.push` takes a string parameter specifying the tag of the page to | |
| 554 | + | // push, and is equivalent to calling [method@NavigationView.push_by_tag]. | |
| 555 | + | // | |
| 556 | + | // - `navigation.pop` doesn't take any parameters and pops the current page from | |
| 557 | + | // the navigation stack, equivalent to calling [method@NavigationView.pop]. | |
| 558 | + | // | |
| 559 | + | // ## `AdwNavigationView` as `GtkBuildable` | |
| 560 | + | // | |
| 561 | + | // `AdwNavigationView` allows to add pages as children, equivalent to using the | |
| 562 | + | // [method@NavigationView.add] method. | |
| 563 | + | // | |
| 564 | + | // Example of an `AdwNavigationView` UI definition: | |
| 565 | + | // | |
| 566 | + | // ```xml | |
| 567 | + | // <object class="AdwNavigationView"> | |
| 568 | + | // | |
| 569 | + | // <child> | |
| 570 | + | // <object class="AdwNavigationPage"> | |
| 571 | + | // <property name="title" translatable="yes">Page 1</property> | |
| 572 | + | // <property name="child"> | |
| 573 | + | // <object class="AdwToolbarView"> | |
| 574 | + | // <child type="top"> | |
| 575 | + | // <object class="AdwHeaderBar"/> | |
| 576 | + | // </child> | |
| 577 | + | // <property name="content"> | |
| 578 | + | // <object class="GtkButton"> | |
| 579 | + | // <property name="label" translatable="yes">Open Page 2</property> | |
| 580 | + | // <property name="halign">center</property> | |
| 581 | + | // <property name="valign">center</property> | |
| 582 | + | // <property name="action-name">navigation.push</property> | |
| 583 | + | // <property name="action-target">'page-2'</property> | |
| 584 | + | // <style> | |
| 585 | + | // <class name="pill"/> | |
| 586 | + | // </style> | |
| 587 | + | // </object> | |
| 588 | + | // </property> | |
| 589 | + | // </object> | |
| 590 | + | // </property> | |
| 591 | + | // </object> | |
| 592 | + | // </child> | |
| 593 | + | // <child> | |
| 594 | + | // <object class="AdwNavigationPage"> | |
| 595 | + | // <property name="title" translatable="yes">Page 2</property> | |
| 596 | + | // <property name="tag">page-2</property> | |
| 597 | + | // <property name="child"> | |
| 598 | + | // <object class="AdwToolbarView"> | |
| 599 | + | // <child type="top"> | |
| 600 | + | // <object class="AdwHeaderBar"/> | |
| 601 | + | // </child> | |
| 602 | + | // <property name="content"> | |
| 603 | + | // <!-- ... --> | |
| 604 | + | // </property> | |
| 605 | + | // </object> | |
| 606 | + | // </property> | |
| 607 | + | // </object> | |
| 608 | + | // </child> | |
| 609 | + | // | |
| 610 | + | // </object> | |
| 611 | + | // ``` | |
| 612 | + | // | |
| 613 | + | // <picture> | |
| 614 | + | // | |
| 615 | + | // <source srcset="navigation-view-example-dark.png" media="(prefers-color-scheme: dark)"> | |
| 616 | + | // <img src="navigation-view-example.png" alt="navigation-view-example"> | |
| 617 | + | // | |
| 618 | + | // </picture> | |
| 619 | + | // | |
| 620 | + | // ## CSS nodes | |
| 621 | + | // | |
| 622 | + | // `AdwNavigationView` has a single CSS node with the name `navigation-view`. | |
| 623 | + | // | |
| 624 | + | // ## Accessibility | |
| 625 | + | // | |
| 626 | + | // `AdwNavigationView` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role. | |
| 627 | + | type NavigationView struct { | |
| 628 | + | gtk.Widget | |
| 629 | + | } | |
| 630 | + | ||
| 631 | + | var xNavigationViewGLibType func() types.GType | |
| 632 | + | ||
| 633 | + | func NavigationViewGLibType() types.GType { | |
| 634 | + | return xNavigationViewGLibType() | |
| 635 | + | } | |
| 636 | + | ||
| 637 | + | func NavigationViewNewFromInternalPtr(ptr uintptr) *NavigationView { | |
| 638 | + | cls := &NavigationView{} | |
| 639 | + | cls.Ptr = ptr | |
| 640 | + | return cls | |
| 641 | + | } | |
| 642 | + | ||
| 643 | + | var xNewNavigationView func() uintptr | |
| 644 | + | ||
| 645 | + | // Creates a new `AdwNavigationView`. | |
| 646 | + | func NewNavigationView() *NavigationView { | |
| 647 | + | var cls *NavigationView | |
| 648 | + | ||
| 649 | + | cret := xNewNavigationView() | |
| 650 | + | ||
| 651 | + | if cret == 0 { | |
| 652 | + | return nil | |
| 653 | + | } | |
| 654 | + | gobject.IncreaseRef(cret) | |
| 655 | + | cls = &NavigationView{} | |
| 656 | + | cls.Ptr = cret | |
| 657 | + | return cls | |
| 658 | + | } | |
| 659 | + | ||
| 660 | + | var xNavigationViewAdd func(uintptr, uintptr) | |
| 661 | + | ||
| 662 | + | // Permanently adds @page to @self. | |
| 663 | + | // | |
| 664 | + | // Any page that has been added will stay in @self even after being popped from | |
| 665 | + | // the navigation stack. | |
| 666 | + | // | |
| 667 | + | // Adding a page while no page is visible will automatically push it to the | |
| 668 | + | // navigation stack. | |
| 669 | + | // | |
| 670 | + | // See [method@NavigationView.remove]. | |
| 671 | + | func (x *NavigationView) Add(PageVar *NavigationPage) { | |
| 672 | + | ||
| 673 | + | xNavigationViewAdd(x.GoPointer(), PageVar.GoPointer()) | |
| 674 | + | ||
| 675 | + | } | |
| 676 | + | ||
| 677 | + | var xNavigationViewFindPage func(uintptr, string) uintptr | |
| 678 | + | ||
| 679 | + | // Finds a page in @self by its tag. | |
| 680 | + | // | |
| 681 | + | // See [property@NavigationPage:tag]. | |
| 682 | + | func (x *NavigationView) FindPage(TagVar string) *NavigationPage { | |
| 683 | + | var cls *NavigationPage | |
| 684 | + | ||
| 685 | + | cret := xNavigationViewFindPage(x.GoPointer(), TagVar) | |
| 686 | + | ||
| 687 | + | if cret == 0 { | |
| 688 | + | return nil | |
| 689 | + | } | |
| 690 | + | gobject.IncreaseRef(cret) | |
| 691 | + | cls = &NavigationPage{} | |
| 692 | + | cls.Ptr = cret | |
| 693 | + | return cls | |
| 694 | + | } | |
| 695 | + | ||
| 696 | + | var xNavigationViewGetAnimateTransitions func(uintptr) bool | |
| 697 | + | ||
| 698 | + | // Gets whether @self animates page transitions. | |
| 699 | + | func (x *NavigationView) GetAnimateTransitions() bool { | |
| 700 | + | ||
| 701 | + | cret := xNavigationViewGetAnimateTransitions(x.GoPointer()) | |
| 702 | + | return cret | |
| 703 | + | } | |
| 704 | + | ||
| 705 | + | var xNavigationViewGetNavigationStack func(uintptr) uintptr | |
| 706 | + | ||
| 707 | + | // Returns a [iface@Gio.ListModel] that contains the pages in navigation stack. | |
| 708 | + | // | |
| 709 | + | // The pages are sorted from root page to visible page. | |
| 710 | + | // | |
| 711 | + | // This can be used to keep an up-to-date view. | |
| 712 | + | func (x *NavigationView) GetNavigationStack() *gio.ListModelBase { | |
| 713 | + | var cls *gio.ListModelBase | |
| 714 | + | ||
| 715 | + | cret := xNavigationViewGetNavigationStack(x.GoPointer()) | |
| 716 | + | ||
| 717 | + | if cret == 0 { | |
| 718 | + | return nil | |
| 719 | + | } | |
| 720 | + | cls = &gio.ListModelBase{} | |
| 721 | + | cls.Ptr = cret | |
| 722 | + | return cls | |
| 723 | + | } | |
| 724 | + | ||
| 725 | + | var xNavigationViewGetPopOnEscape func(uintptr) bool | |
| 726 | + | ||
| 727 | + | // Gets whether pressing Escape pops the current page on @self. | |
| 728 | + | func (x *NavigationView) GetPopOnEscape() bool { | |
| 729 | + | ||
| 730 | + | cret := xNavigationViewGetPopOnEscape(x.GoPointer()) | |
| 731 | + | return cret | |
| 732 | + | } | |
| 733 | + | ||
| 734 | + | var xNavigationViewGetPreviousPage func(uintptr, uintptr) uintptr | |
| 735 | + | ||
| 736 | + | // Gets the previous page for @page. | |
| 737 | + | // | |
| 738 | + | // If @page is in the navigation stack, returns the page popping @page will | |
| 739 | + | // reveal. | |
| 740 | + | // | |
| 741 | + | // If @page is the root page or is not in the navigation stack, returns `NULL`. | |
| 742 | + | func (x *NavigationView) GetPreviousPage(PageVar *NavigationPage) *NavigationPage { | |
| 743 | + | var cls *NavigationPage | |
| 744 | + | ||
| 745 | + | cret := xNavigationViewGetPreviousPage(x.GoPointer(), PageVar.GoPointer()) | |
| 746 | + | ||
| 747 | + | if cret == 0 { | |
| 748 | + | return nil | |
| 749 | + | } | |
| 750 | + | gobject.IncreaseRef(cret) | |
| 751 | + | cls = &NavigationPage{} | |
| 752 | + | cls.Ptr = cret | |
| 753 | + | return cls | |
| 754 | + | } | |
| 755 | + | ||
| 756 | + | var xNavigationViewGetVisiblePage func(uintptr) uintptr | |
| 757 | + | ||
| 758 | + | // Gets the currently visible page in @self. | |
| 759 | + | func (x *NavigationView) GetVisiblePage() *NavigationPage { | |
| 760 | + | var cls *NavigationPage | |
| 761 | + | ||
| 762 | + | cret := xNavigationViewGetVisiblePage(x.GoPointer()) | |
| 763 | + | ||
| 764 | + | if cret == 0 { | |
| 765 | + | return nil | |
| 766 | + | } | |
| 767 | + | gobject.IncreaseRef(cret) | |
| 768 | + | cls = &NavigationPage{} | |
| 769 | + | cls.Ptr = cret | |
| 770 | + | return cls | |
| 771 | + | } | |
| 772 | + | ||
| 773 | + | var xNavigationViewPop func(uintptr) bool | |
| 774 | + | ||
| 775 | + | // Pops the visible page from the navigation stack. | |
| 776 | + | // | |
| 777 | + | // Does nothing if the navigation stack contains less than two pages. | |
| 778 | + | // | |
| 779 | + | // If [method@NavigationView.add] hasn't been called, the page is automatically | |
| 780 | + | // removed. | |
| 781 | + | // | |
| 782 | + | // [signal@NavigationView::popped] will be emitted for the current visible page. | |
| 783 | + | // | |
| 784 | + | // See [method@NavigationView.pop_to_page] and | |
| 785 | + | // [method@NavigationView.pop_to_tag]. | |
| 786 | + | func (x *NavigationView) Pop() bool { | |
| 787 | + | ||
| 788 | + | cret := xNavigationViewPop(x.GoPointer()) | |
| 789 | + | return cret | |
| 790 | + | } | |
| 791 | + | ||
| 792 | + | var xNavigationViewPopToPage func(uintptr, uintptr) bool | |
| 793 | + | ||
| 794 | + | // Pops pages from the navigation stack until @page is visible. | |
| 795 | + | // | |
| 796 | + | // @page must be in the navigation stack. | |
| 797 | + | // | |
| 798 | + | // If [method@NavigationView.add] hasn't been called for any of the popped pages, | |
| 799 | + | // they are automatically removed. | |
| 800 | + | // | |
| 801 | + | // [signal@NavigationView::popped] will be be emitted for each of the popped | |
| 802 | + | // pages. | |
| 803 | + | // | |
| 804 | + | // See [method@NavigationView.pop] and [method@NavigationView.pop_to_tag]. | |
| 805 | + | func (x *NavigationView) PopToPage(PageVar *NavigationPage) bool { | |
| 806 | + | ||
| 807 | + | cret := xNavigationViewPopToPage(x.GoPointer(), PageVar.GoPointer()) | |
| 808 | + | return cret | |
| 809 | + | } | |
| 810 | + | ||
| 811 | + | var xNavigationViewPopToTag func(uintptr, string) bool | |
| 812 | + | ||
| 813 | + | // Pops pages from the navigation stack until page with the tag @tag is visible. | |
| 814 | + | // | |
| 815 | + | // The page must be in the navigation stack. | |
| 816 | + | // | |
| 817 | + | // If [method@NavigationView.add] hasn't been called for any of the popped pages, | |
| 818 | + | // they are automatically removed. | |
| 819 | + | // | |
| 820 | + | // [signal@NavigationView::popped] will be emitted for each of the popped pages. | |
| 821 | + | // | |
| 822 | + | // See [method@NavigationView.pop_to_page] and [property@NavigationPage:tag]. | |
| 823 | + | func (x *NavigationView) PopToTag(TagVar string) bool { | |
| 824 | + | ||
| 825 | + | cret := xNavigationViewPopToTag(x.GoPointer(), TagVar) | |
| 826 | + | return cret | |
| 827 | + | } | |
| 828 | + | ||
| 829 | + | var xNavigationViewPush func(uintptr, uintptr) | |
| 830 | + | ||
| 831 | + | // Pushes @page onto the navigation stack. | |
| 832 | + | // | |
| 833 | + | // If [method@NavigationView.add] hasn't been called, the page is automatically | |
| 834 | + | // removed once it's popped. | |
| 835 | + | // | |
| 836 | + | // [signal@NavigationView::pushed] will be emitted for @page. | |
| 837 | + | // | |
| 838 | + | // See [method@NavigationView.push_by_tag]. | |
| 839 | + | func (x *NavigationView) Push(PageVar *NavigationPage) { | |
| 840 | + | ||
| 841 | + | xNavigationViewPush(x.GoPointer(), PageVar.GoPointer()) | |
| 842 | + | ||
| 843 | + | } | |
| 844 | + | ||
| 845 | + | var xNavigationViewPushByTag func(uintptr, string) | |
| 846 | + | ||
| 847 | + | // Pushes the page with the tag @tag onto the navigation stack. | |
| 848 | + | // | |
| 849 | + | // If [method@NavigationView.add] hasn't been called, the page is automatically | |
| 850 | + | // removed once it's popped. | |
| 851 | + | // | |
| 852 | + | // [signal@NavigationView::pushed] will be emitted for the page. | |
| 853 | + | // | |
| 854 | + | // See [method@NavigationView.push] and [property@NavigationPage:tag]. | |
| 855 | + | func (x *NavigationView) PushByTag(TagVar string) { | |
| 856 | + | ||
| 857 | + | xNavigationViewPushByTag(x.GoPointer(), TagVar) | |
| 858 | + | ||
| 859 | + | } | |
| 860 | + | ||
| 861 | + | var xNavigationViewRemove func(uintptr, uintptr) | |
| 862 | + | ||
| 863 | + | // Removes @page from @self. | |
| 864 | + | // | |
| 865 | + | // If @page is currently in the navigation stack, it will be removed once it's | |
| 866 | + | // popped. Otherwise, it's removed immediately. | |
| 867 | + | // | |
| 868 | + | // See [method@NavigationView.add]. | |
| 869 | + | func (x *NavigationView) Remove(PageVar *NavigationPage) { | |
| 870 | + | ||
| 871 | + | xNavigationViewRemove(x.GoPointer(), PageVar.GoPointer()) | |
| 872 | + | ||
| 873 | + | } | |
| 874 | + | ||
| 875 | + | var xNavigationViewReplace func(uintptr, uintptr, int) | |
| 876 | + | ||
| 877 | + | // Replaces the current navigation stack with @pages. | |
| 878 | + | // | |
| 879 | + | // The last page becomes the visible page. | |
| 880 | + | // | |
| 881 | + | // Replacing the navigation stack has no animation. | |
| 882 | + | // | |
| 883 | + | // If [method@NavigationView.add] hasn't been called for any pages that are no | |
| 884 | + | // longer in the navigation stack, they are automatically removed. | |
| 885 | + | // | |
| 886 | + | // @n_pages can be 0, in that case no page will be visible after calling this | |
| 887 | + | // method. This can be useful for removing all pages from @self. | |
| 888 | + | // | |
| 889 | + | // The [signal@NavigationView::replaced] signal will be emitted. | |
| 890 | + | // | |
| 891 | + | // See [method@NavigationView.replace_with_tags]. | |
| 892 | + | func (x *NavigationView) Replace(PagesVar uintptr, NPagesVar int) { | |
| 893 | + | ||
| 894 | + | xNavigationViewReplace(x.GoPointer(), PagesVar, NPagesVar) | |
| 895 | + | ||
| 896 | + | } | |
| 897 | + | ||
| 898 | + | var xNavigationViewReplaceWithTags func(uintptr, []string, int) | |
| 899 | + | ||
| 900 | + | // Replaces the current navigation stack with pages with the tags @tags. | |
| 901 | + | // | |
| 902 | + | // The last page becomes the visible page. | |
| 903 | + | // | |
| 904 | + | // Replacing the navigation stack has no animation. | |
| 905 | + | // | |
| 906 | + | // If [method@NavigationView.add] hasn't been called for any pages that are no | |
| 907 | + | // longer in the navigation stack, they are automatically removed. | |
| 908 | + | // | |
| 909 | + | // @n_tags can be 0, in that case no page will be visible after calling this | |
| 910 | + | // method. This can be useful for removing all pages from @self. | |
| 911 | + | // | |
| 912 | + | // The [signal@NavigationView::replaced] signal will be emitted. | |
| 913 | + | // | |
| 914 | + | // See [method@NavigationView.replace] and [property@NavigationPage:tag]. | |
| 915 | + | func (x *NavigationView) ReplaceWithTags(TagsVar []string, NTagsVar int) { | |
| 916 | + | ||
| 917 | + | xNavigationViewReplaceWithTags(x.GoPointer(), TagsVar, NTagsVar) | |
| 918 | + | ||
| 919 | + | } | |
| 920 | + | ||
| 921 | + | var xNavigationViewSetAnimateTransitions func(uintptr, bool) | |
| 922 | + | ||
| 923 | + | // Sets whether @self should animate page transitions. | |
| 924 | + | // | |
| 925 | + | // Gesture-based transitions are always animated. | |
| 926 | + | func (x *NavigationView) SetAnimateTransitions(AnimateTransitionsVar bool) { | |
| 927 | + | ||
| 928 | + | xNavigationViewSetAnimateTransitions(x.GoPointer(), AnimateTransitionsVar) | |
| 929 | + | ||
| 930 | + | } | |
| 931 | + | ||
| 932 | + | var xNavigationViewSetPopOnEscape func(uintptr, bool) | |
| 933 | + | ||
| 934 | + | // Sets whether pressing Escape pops the current page on @self. | |
| 935 | + | // | |
| 936 | + | // Applications using `AdwNavigationView` to implement a browser may want to | |
| 937 | + | // disable it. | |
| 938 | + | func (x *NavigationView) SetPopOnEscape(PopOnEscapeVar bool) { | |
| 939 | + | ||
| 940 | + | xNavigationViewSetPopOnEscape(x.GoPointer(), PopOnEscapeVar) | |
| 941 | + | ||
| 942 | + | } | |
| 943 | + | ||
| 944 | + | func (c *NavigationView) GoPointer() uintptr { | |
| 945 | + | return c.Ptr | |
| 946 | + | } | |
| 947 | + | ||
| 948 | + | func (c *NavigationView) SetGoPointer(ptr uintptr) { | |
| 949 | + | c.Ptr = ptr | |
| 950 | + | } | |
| 951 | + | ||
| 952 | + | // Emitted when a push shortcut or a gesture is triggered. | |
| 953 | + | // | |
| 954 | + | // To support the push shortcuts and gestures, the application is expected to | |
| 955 | + | // return the page to push in the handler. | |
| 956 | + | // | |
| 957 | + | // This signal can be emitted multiple times for the gestures, for example | |
| 958 | + | // when the gesture is cancelled by the user. As such, the application must | |
| 959 | + | // not make any irreversible changes in the handler, such as removing the page | |
| 960 | + | // from a forward stack. | |
| 961 | + | // | |
| 962 | + | // Instead, it should be done in the [signal@NavigationView::pushed] handler. | |
| 963 | + | func (x *NavigationView) ConnectGetNextPage(cb *func(NavigationView) NavigationPage) uint32 { | |
| 964 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 965 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 966 | + | return gobject.SignalConnect(x.GoPointer(), "get-next-page", cbRefPtr) | |
| 967 | + | } | |
| 968 | + | ||
| 969 | + | fcb := func(clsPtr uintptr) uintptr { | |
| 970 | + | fa := NavigationView{} | |
| 971 | + | fa.Ptr = clsPtr | |
| 972 | + | cbFn := *cb | |
| 973 | + | ||
| 974 | + | GetNextPageCls := cbFn(fa) | |
| 975 | + | return GetNextPageCls.Ptr | |
| 976 | + | ||
| 977 | + | } | |
| 978 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 979 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 980 | + | return gobject.SignalConnect(x.GoPointer(), "get-next-page", cbRefPtr) | |
| 981 | + | } | |
| 982 | + | ||
| 983 | + | // Emitted after @page has been popped from the navigation stack. | |
| 984 | + | // | |
| 985 | + | // See [method@NavigationView.pop]. | |
| 986 | + | // | |
| 987 | + | // When using [method@NavigationView.pop_to_page] or | |
| 988 | + | // [method@NavigationView.pop_to_tag], this signal is emitted for each of the | |
| 989 | + | // popped pages. | |
| 990 | + | func (x *NavigationView) ConnectPopped(cb *func(NavigationView, uintptr)) uint32 { | |
| 991 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 992 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 993 | + | return gobject.SignalConnect(x.GoPointer(), "popped", cbRefPtr) | |
| 994 | + | } | |
| 995 | + | ||
| 996 | + | fcb := func(clsPtr uintptr, PageVarp uintptr) { | |
| 997 | + | fa := NavigationView{} | |
| 998 | + | fa.Ptr = clsPtr | |
| 999 | + | cbFn := *cb | |
| 1000 | + | ||
| 1001 | + | cbFn(fa, PageVarp) | |
| 1002 | + | ||
| 1003 | + | } | |
| 1004 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 1005 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 1006 | + | return gobject.SignalConnect(x.GoPointer(), "popped", cbRefPtr) | |
| 1007 | + | } | |
| 1008 | + | ||
| 1009 | + | // Emitted after a page has been pushed to the navigation stack. | |
| 1010 | + | // | |
| 1011 | + | // See [method@NavigationView.push]. | |
| 1012 | + | func (x *NavigationView) ConnectPushed(cb *func(NavigationView)) uint32 { | |
| 1013 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 1014 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 1015 | + | return gobject.SignalConnect(x.GoPointer(), "pushed", cbRefPtr) | |
| 1016 | + | } | |
| 1017 | + | ||
| 1018 | + | fcb := func(clsPtr uintptr) { | |
| 1019 | + | fa := NavigationView{} | |
| 1020 | + | fa.Ptr = clsPtr | |
| 1021 | + | cbFn := *cb | |
| 1022 | + | ||
| 1023 | + | cbFn(fa) | |
| 1024 | + | ||
| 1025 | + | } | |
| 1026 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 1027 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 1028 | + | return gobject.SignalConnect(x.GoPointer(), "pushed", cbRefPtr) | |
| 1029 | + | } | |
| 1030 | + | ||
| 1031 | + | // Emitted after the navigation stack has been replaced. | |
| 1032 | + | // | |
| 1033 | + | // See [method@NavigationView.replace]. | |
| 1034 | + | func (x *NavigationView) ConnectReplaced(cb *func(NavigationView)) uint32 { | |
| 1035 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 1036 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 1037 | + | return gobject.SignalConnect(x.GoPointer(), "replaced", cbRefPtr) | |
| 1038 | + | } | |
| 1039 | + | ||
| 1040 | + | fcb := func(clsPtr uintptr) { | |
| 1041 | + | fa := NavigationView{} | |
| 1042 | + | fa.Ptr = clsPtr | |
| 1043 | + | cbFn := *cb | |
| 1044 | + | ||
| 1045 | + | cbFn(fa) | |
| 1046 | + | ||
| 1047 | + | } | |
| 1048 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 1049 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 1050 | + | return gobject.SignalConnect(x.GoPointer(), "replaced", cbRefPtr) | |
| 1051 | + | } | |
| 1052 | + | ||
| 1053 | + | // Gets the progress @self will snap back to after the gesture is canceled. | |
| 1054 | + | func (x *NavigationView) GetCancelProgress() float64 { | |
| 1055 | + | ||
| 1056 | + | cret := XAdwSwipeableGetCancelProgress(x.GoPointer()) | |
| 1057 | + | return cret | |
| 1058 | + | } | |
| 1059 | + | ||
| 1060 | + | // Gets the swipe distance of @self. | |
| 1061 | + | // | |
| 1062 | + | // This corresponds to how many pixels 1 unit represents. | |
| 1063 | + | func (x *NavigationView) GetDistance() float64 { | |
| 1064 | + | ||
| 1065 | + | cret := XAdwSwipeableGetDistance(x.GoPointer()) | |
| 1066 | + | return cret | |
| 1067 | + | } | |
| 1068 | + | ||
| 1069 | + | // Gets the current progress of @self. | |
| 1070 | + | func (x *NavigationView) GetProgress() float64 { | |
| 1071 | + | ||
| 1072 | + | cret := XAdwSwipeableGetProgress(x.GoPointer()) | |
| 1073 | + | return cret | |
| 1074 | + | } | |
| 1075 | + | ||
| 1076 | + | // Gets the snap points of @self. | |
| 1077 | + | // | |
| 1078 | + | // Each snap point represents a progress value that is considered acceptable to | |
| 1079 | + | // end the swipe on. | |
| 1080 | + | func (x *NavigationView) GetSnapPoints(NSnapPointsVar int) []float64 { | |
| 1081 | + | ||
| 1082 | + | cret := XAdwSwipeableGetSnapPoints(x.GoPointer(), NSnapPointsVar) | |
| 1083 | + | return cret | |
| 1084 | + | } | |
| 1085 | + | ||
| 1086 | + | // Gets the area @self can start a swipe from for the given direction and | |
| 1087 | + | // gesture type. | |
| 1088 | + | // | |
| 1089 | + | // This can be used to restrict swipes to only be possible from a certain area, | |
| 1090 | + | // for example, to only allow edge swipes, or to have a draggable element and | |
| 1091 | + | // ignore swipes elsewhere. | |
| 1092 | + | // | |
| 1093 | + | // If not implemented, the default implementation returns the allocation of | |
| 1094 | + | // @self, allowing swipes from anywhere. | |
| 1095 | + | func (x *NavigationView) GetSwipeArea(NavigationDirectionVar NavigationDirection, IsDragVar bool, RectVar *gdk.Rectangle) { | |
| 1096 | + | ||
| 1097 | + | XAdwSwipeableGetSwipeArea(x.GoPointer(), NavigationDirectionVar, IsDragVar, RectVar) | |
| 1098 | + | ||
| 1099 | + | } | |
| 1100 | + | ||
| 1101 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 1102 | + | func (x *NavigationView) GetAccessibleRole() gtk.AccessibleRole { | |
| 1103 | + | ||
| 1104 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 1105 | + | return cret | |
| 1106 | + | } | |
| 1107 | + | ||
| 1108 | + | // Resets the accessible @property to its default value. | |
| 1109 | + | func (x *NavigationView) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 1110 | + | ||
| 1111 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 1112 | + | ||
| 1113 | + | } | |
| 1114 | + | ||
| 1115 | + | // Resets the accessible @relation to its default value. | |
| 1116 | + | func (x *NavigationView) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 1117 | + | ||
| 1118 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 1119 | + | ||
| 1120 | + | } | |
| 1121 | + | ||
| 1122 | + | // Resets the accessible @state to its default value. | |
| 1123 | + | func (x *NavigationView) ResetState(StateVar gtk.AccessibleState) { | |
| 1124 | + | ||
| 1125 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 1126 | + | ||
| 1127 | + | } | |
| 1128 | + | ||
| 1129 | + | // Updates a list of accessible properties. | |
| 1130 | + | // | |
| 1131 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 1132 | + | // value types of accessible properties. | |
| 1133 | + | // | |
| 1134 | + | // This function should be called by `GtkWidget` types whenever | |
| 1135 | + | // an accessible property change must be communicated to assistive | |
| 1136 | + | // technologies. | |
| 1137 | + | // | |
| 1138 | + | // Example: | |
| 1139 | + | // ```c | |
| 1140 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 1141 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 1142 | + | // | |
| 1143 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 1144 | + | // -1); | |
| 1145 | + | // | |
| 1146 | + | // ``` | |
| 1147 | + | func (x *NavigationView) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 1148 | + | ||
| 1149 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 1150 | + | ||
| 1151 | + | } | |
| 1152 | + | ||
| 1153 | + | // Updates an array of accessible properties. | |
| 1154 | + | // | |
| 1155 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 1156 | + | // property change must be communicated to assistive technologies. | |
| 1157 | + | // | |
| 1158 | + | // This function is meant to be used by language bindings. | |
| 1159 | + | func (x *NavigationView) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 1160 | + | ||
| 1161 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 1162 | + | ||
| 1163 | + | } | |
| 1164 | + | ||
| 1165 | + | // Updates a list of accessible relations. | |
| 1166 | + | // | |
| 1167 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 1168 | + | // relation change must be communicated to assistive technologies. | |
| 1169 | + | // | |
| 1170 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 1171 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 1172 | + | // | |
| 1173 | + | // ```c | |
| 1174 | + | // gtk_accessible_update_relation (accessible, | |
| 1175 | + | // | |
| 1176 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 1177 | + | // ref1, NULL, | |
| 1178 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 1179 | + | // ref1, ref2, ref3, NULL, | |
| 1180 | + | // -1); | |
| 1181 | + | // | |
| 1182 | + | // ``` | |
| 1183 | + | func (x *NavigationView) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 1184 | + | ||
| 1185 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 1186 | + | ||
| 1187 | + | } | |
| 1188 | + | ||
| 1189 | + | // Updates an array of accessible relations. | |
| 1190 | + | // | |
| 1191 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 1192 | + | // relation change must be communicated to assistive technologies. | |
| 1193 | + | // | |
| 1194 | + | // This function is meant to be used by language bindings. | |
| 1195 | + | func (x *NavigationView) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 1196 | + | ||
| 1197 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 1198 | + | ||
| 1199 | + | } | |
| 1200 | + | ||
| 1201 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 1202 | + | // documentation for the value types of accessible states. | |
| 1203 | + | // | |
| 1204 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 1205 | + | // state change must be communicated to assistive technologies. | |
| 1206 | + | // | |
| 1207 | + | // Example: | |
| 1208 | + | // ```c | |
| 1209 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 1210 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 1211 | + | // | |
| 1212 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 1213 | + | // -1); | |
| 1214 | + | // | |
| 1215 | + | // ``` | |
| 1216 | + | func (x *NavigationView) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 1217 | + | ||
| 1218 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 1219 | + | ||
| 1220 | + | } | |
| 1221 | + | ||
| 1222 | + | // Updates an array of accessible states. | |
| 1223 | + | // | |
| 1224 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 1225 | + | // state change must be communicated to assistive technologies. | |
| 1226 | + | // | |
| 1227 | + | // This function is meant to be used by language bindings. | |
| 1228 | + | func (x *NavigationView) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 1229 | + | ||
| 1230 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 1231 | + | ||
| 1232 | + | } | |
| 1233 | + | ||
| 1234 | + | // Gets the ID of the @buildable object. | |
| 1235 | + | // | |
| 1236 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 1237 | + | // of the <object> tag used to construct the @buildable. | |
| 1238 | + | func (x *NavigationView) GetBuildableId() string { | |
| 1239 | + | ||
| 1240 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 1241 | + | return cret | |
| 1242 | + | } | |
| 1243 | + | ||
| 1244 | + | func init() { | |
| 1245 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 1246 | + | if err != nil { | |
| 1247 | + | panic(err) | |
| 1248 | + | } | |
| 1249 | + | ||
| 1250 | + | core.PuregoSafeRegister(&xNavigationPageGLibType, lib, "adw_navigation_page_get_type") | |
| 1251 | + | ||
| 1252 | + | core.PuregoSafeRegister(&xNewNavigationPage, lib, "adw_navigation_page_new") | |
| 1253 | + | core.PuregoSafeRegister(&xNewNavigationPageWithTag, lib, "adw_navigation_page_new_with_tag") | |
| 1254 | + | ||
| 1255 | + | core.PuregoSafeRegister(&xNavigationPageGetCanPop, lib, "adw_navigation_page_get_can_pop") | |
| 1256 | + | core.PuregoSafeRegister(&xNavigationPageGetChild, lib, "adw_navigation_page_get_child") | |
| 1257 | + | core.PuregoSafeRegister(&xNavigationPageGetTag, lib, "adw_navigation_page_get_tag") | |
| 1258 | + | core.PuregoSafeRegister(&xNavigationPageGetTitle, lib, "adw_navigation_page_get_title") | |
| 1259 | + | core.PuregoSafeRegister(&xNavigationPageSetCanPop, lib, "adw_navigation_page_set_can_pop") | |
| 1260 | + | core.PuregoSafeRegister(&xNavigationPageSetChild, lib, "adw_navigation_page_set_child") | |
| 1261 | + | core.PuregoSafeRegister(&xNavigationPageSetTag, lib, "adw_navigation_page_set_tag") | |
| 1262 | + | core.PuregoSafeRegister(&xNavigationPageSetTitle, lib, "adw_navigation_page_set_title") | |
| 1263 | + | ||
| 1264 | + | core.PuregoSafeRegister(&xNavigationViewGLibType, lib, "adw_navigation_view_get_type") | |
| 1265 | + | ||
| 1266 | + | core.PuregoSafeRegister(&xNewNavigationView, lib, "adw_navigation_view_new") | |
| 1267 | + | ||
| 1268 | + | core.PuregoSafeRegister(&xNavigationViewAdd, lib, "adw_navigation_view_add") | |
| 1269 | + | core.PuregoSafeRegister(&xNavigationViewFindPage, lib, "adw_navigation_view_find_page") | |
| 1270 | + | core.PuregoSafeRegister(&xNavigationViewGetAnimateTransitions, lib, "adw_navigation_view_get_animate_transitions") | |
| 1271 | + | core.PuregoSafeRegister(&xNavigationViewGetNavigationStack, lib, "adw_navigation_view_get_navigation_stack") | |
| 1272 | + | core.PuregoSafeRegister(&xNavigationViewGetPopOnEscape, lib, "adw_navigation_view_get_pop_on_escape") | |
| 1273 | + | core.PuregoSafeRegister(&xNavigationViewGetPreviousPage, lib, "adw_navigation_view_get_previous_page") | |
| 1274 | + | core.PuregoSafeRegister(&xNavigationViewGetVisiblePage, lib, "adw_navigation_view_get_visible_page") | |
| 1275 | + | core.PuregoSafeRegister(&xNavigationViewPop, lib, "adw_navigation_view_pop") | |
| 1276 | + | core.PuregoSafeRegister(&xNavigationViewPopToPage, lib, "adw_navigation_view_pop_to_page") | |
| 1277 | + | core.PuregoSafeRegister(&xNavigationViewPopToTag, lib, "adw_navigation_view_pop_to_tag") | |
| 1278 | + | core.PuregoSafeRegister(&xNavigationViewPush, lib, "adw_navigation_view_push") | |
| 1279 | + | core.PuregoSafeRegister(&xNavigationViewPushByTag, lib, "adw_navigation_view_push_by_tag") | |
| 1280 | + | core.PuregoSafeRegister(&xNavigationViewRemove, lib, "adw_navigation_view_remove") | |
| 1281 | + | core.PuregoSafeRegister(&xNavigationViewReplace, lib, "adw_navigation_view_replace") | |
| 1282 | + | core.PuregoSafeRegister(&xNavigationViewReplaceWithTags, lib, "adw_navigation_view_replace_with_tags") | |
| 1283 | + | core.PuregoSafeRegister(&xNavigationViewSetAnimateTransitions, lib, "adw_navigation_view_set_animate_transitions") | |
| 1284 | + | core.PuregoSafeRegister(&xNavigationViewSetPopOnEscape, lib, "adw_navigation_view_set_pop_on_escape") | |
| 1285 | + | ||
| 1286 | + | } | |
A v4/adw/adw-overlay-split-view.go +700 -0
| @@ -0,0 +1,700 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gdk" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 13 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 14 | + | ) | |
| 15 | + | ||
| 16 | + | type OverlaySplitViewClass struct { | |
| 17 | + | _ structs.HostLayout | |
| 18 | + | ||
| 19 | + | ParentClass uintptr | |
| 20 | + | } | |
| 21 | + | ||
| 22 | + | func (x *OverlaySplitViewClass) GoPointer() uintptr { | |
| 23 | + | return uintptr(unsafe.Pointer(x)) | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | // A widget presenting sidebar and content side by side or as an overlay. | |
| 27 | + | // | |
| 28 | + | // <picture> | |
| 29 | + | // | |
| 30 | + | // <source srcset="overlay-split-view-dark.png" media="(prefers-color-scheme: dark)"> | |
| 31 | + | // <img src="overlay-split-view.png" alt="overlay-split-view"> | |
| 32 | + | // | |
| 33 | + | // </picture> | |
| 34 | + | // <picture> | |
| 35 | + | // | |
| 36 | + | // <source srcset="overlay-split-view-collapsed-dark.png" media="(prefers-color-scheme: dark)"> | |
| 37 | + | // <img src="overlay-split-view-collapsed.png" alt="overlay-split-view-collapsed"> | |
| 38 | + | // | |
| 39 | + | // </picture> | |
| 40 | + | // | |
| 41 | + | // `AdwOverlaySplitView` has two children: sidebar and content, and displays | |
| 42 | + | // them side by side. | |
| 43 | + | // | |
| 44 | + | // When [property@OverlaySplitView:collapsed] is set to `TRUE`, the sidebar is | |
| 45 | + | // instead shown as an overlay above the content widget. | |
| 46 | + | // | |
| 47 | + | // The sidebar can be hidden or shown using the | |
| 48 | + | // [property@OverlaySplitView:show-sidebar] property. | |
| 49 | + | // | |
| 50 | + | // Sidebar can be displayed before or after the content, this can be controlled | |
| 51 | + | // with the [property@OverlaySplitView:sidebar-position] property. | |
| 52 | + | // | |
| 53 | + | // Collapsing the split view automatically hides the sidebar widget, and | |
| 54 | + | // uncollapsing it shows the sidebar. If this behavior is not desired, the | |
| 55 | + | // [property@OverlaySplitView:pin-sidebar] property can be used to override it. | |
| 56 | + | // | |
| 57 | + | // `AdwOverlaySplitView` supports an edge swipe gesture for showing the sidebar, | |
| 58 | + | // and a swipe from the sidebar for hiding it. Gestures are only supported on | |
| 59 | + | // touchscreen, but not touchpad. Gestures can be controlled with the | |
| 60 | + | // [property@OverlaySplitView:enable-show-gesture] and | |
| 61 | + | // [property@OverlaySplitView:enable-hide-gesture] properties. | |
| 62 | + | // | |
| 63 | + | // See also [class@NavigationSplitView]. | |
| 64 | + | // | |
| 65 | + | // `AdwOverlaySplitView` is typically used together with an [class@Breakpoint] | |
| 66 | + | // setting the `collapsed` property to `TRUE` on small widths, as follows: | |
| 67 | + | // | |
| 68 | + | // ```xml | |
| 69 | + | // <object class="AdwWindow"> | |
| 70 | + | // | |
| 71 | + | // <property name="default-width">800</property> | |
| 72 | + | // <property name="default-height">800</property> | |
| 73 | + | // <child> | |
| 74 | + | // <object class="AdwBreakpoint"> | |
| 75 | + | // <condition>max-width: 400sp</condition> | |
| 76 | + | // <setter object="split_view" property="collapsed">True</setter> | |
| 77 | + | // </object> | |
| 78 | + | // </child> | |
| 79 | + | // <property name="content"> | |
| 80 | + | // <object class="AdwOverlaySplitView" id="split_view"> | |
| 81 | + | // <property name="sidebar"> | |
| 82 | + | // <!-- ... --> | |
| 83 | + | // </property> | |
| 84 | + | // <property name="content"> | |
| 85 | + | // <!-- ... --> | |
| 86 | + | // </property> | |
| 87 | + | // </object> | |
| 88 | + | // </property> | |
| 89 | + | // | |
| 90 | + | // </object> | |
| 91 | + | // ``` | |
| 92 | + | // | |
| 93 | + | // `AdwOverlaySplitView` is often used for implementing the | |
| 94 | + | // [utility pane](https://developer.gnome.org/hig/patterns/containers/utility-panes.html) | |
| 95 | + | // pattern. | |
| 96 | + | // | |
| 97 | + | // ## Sizing | |
| 98 | + | // | |
| 99 | + | // When not collapsed, `AdwOverlaySplitView` changes the sidebar width | |
| 100 | + | // depending on its own width. | |
| 101 | + | // | |
| 102 | + | // If possible, it tries to allocate a fraction of the total width, controlled | |
| 103 | + | // with the [property@OverlaySplitView:sidebar-width-fraction] property. | |
| 104 | + | // | |
| 105 | + | // The sidebar also has minimum and maximum sizes, controlled with the | |
| 106 | + | // [property@OverlaySplitView:min-sidebar-width] and | |
| 107 | + | // [property@OverlaySplitView:max-sidebar-width] properties. | |
| 108 | + | // | |
| 109 | + | // The minimum and maximum sizes are using the length unit specified with the | |
| 110 | + | // [property@OverlaySplitView:sidebar-width-unit]. | |
| 111 | + | // | |
| 112 | + | // By default, sidebar is using 25% of the total width, with 180sp as the | |
| 113 | + | // minimum size and 280sp as the maximum size. | |
| 114 | + | // | |
| 115 | + | // When collapsed, the preferred width fraction is ignored and the sidebar uses | |
| 116 | + | // [property@OverlaySplitView:max-sidebar-width] when possible. | |
| 117 | + | // | |
| 118 | + | // ## Header Bar Integration | |
| 119 | + | // | |
| 120 | + | // When used inside `AdwOverlaySplitView`, [class@HeaderBar] will automatically | |
| 121 | + | // hide the window buttons in the middle. | |
| 122 | + | // | |
| 123 | + | // ## `AdwOverlaySplitView` as `GtkBuildable` | |
| 124 | + | // | |
| 125 | + | // The `AdwOverlaySplitView` implementation of the [iface@Gtk.Buildable] | |
| 126 | + | // interface supports setting the sidebar widget by specifying “sidebar” as the | |
| 127 | + | // “type” attribute of a `<child>` element, Specifying “content” child type or | |
| 128 | + | // omitting it results in setting the content widget. | |
| 129 | + | // | |
| 130 | + | // ## CSS nodes | |
| 131 | + | // | |
| 132 | + | // `AdwOverlaySplitView` has a single CSS node with the name | |
| 133 | + | // `overlay-split-view`. | |
| 134 | + | // | |
| 135 | + | // It contains two nodes with the name `widget`, containing the sidebar and | |
| 136 | + | // content children. | |
| 137 | + | // | |
| 138 | + | // When not collapsed, they have the `.sidebar-view` and `.content-view` style | |
| 139 | + | // classes respectively. | |
| 140 | + | // | |
| 141 | + | // ``` | |
| 142 | + | // overlay-split-view | |
| 143 | + | // ├── widget.sidebar-pane | |
| 144 | + | // │ ╰── [sidebar child] | |
| 145 | + | // ╰── widget.content-pane | |
| 146 | + | // | |
| 147 | + | // ╰── [content child] | |
| 148 | + | // | |
| 149 | + | // ``` | |
| 150 | + | // | |
| 151 | + | // When collapsed, the one containing the sidebar child has the `.background` | |
| 152 | + | // style class and the other one has no style classes. | |
| 153 | + | // | |
| 154 | + | // ``` | |
| 155 | + | // overlay-split-view | |
| 156 | + | // ├── widget.background | |
| 157 | + | // │ ╰── [sidebar child] | |
| 158 | + | // ╰── widget | |
| 159 | + | // | |
| 160 | + | // ╰── [content child] | |
| 161 | + | // | |
| 162 | + | // ``` | |
| 163 | + | // | |
| 164 | + | // ## Accessibility | |
| 165 | + | // | |
| 166 | + | // `AdwOverlaySplitView` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role. | |
| 167 | + | type OverlaySplitView struct { | |
| 168 | + | gtk.Widget | |
| 169 | + | } | |
| 170 | + | ||
| 171 | + | var xOverlaySplitViewGLibType func() types.GType | |
| 172 | + | ||
| 173 | + | func OverlaySplitViewGLibType() types.GType { | |
| 174 | + | return xOverlaySplitViewGLibType() | |
| 175 | + | } | |
| 176 | + | ||
| 177 | + | func OverlaySplitViewNewFromInternalPtr(ptr uintptr) *OverlaySplitView { | |
| 178 | + | cls := &OverlaySplitView{} | |
| 179 | + | cls.Ptr = ptr | |
| 180 | + | return cls | |
| 181 | + | } | |
| 182 | + | ||
| 183 | + | var xNewOverlaySplitView func() uintptr | |
| 184 | + | ||
| 185 | + | // Creates a new `AdwOverlaySplitView`. | |
| 186 | + | func NewOverlaySplitView() *OverlaySplitView { | |
| 187 | + | var cls *OverlaySplitView | |
| 188 | + | ||
| 189 | + | cret := xNewOverlaySplitView() | |
| 190 | + | ||
| 191 | + | if cret == 0 { | |
| 192 | + | return nil | |
| 193 | + | } | |
| 194 | + | gobject.IncreaseRef(cret) | |
| 195 | + | cls = &OverlaySplitView{} | |
| 196 | + | cls.Ptr = cret | |
| 197 | + | return cls | |
| 198 | + | } | |
| 199 | + | ||
| 200 | + | var xOverlaySplitViewGetCollapsed func(uintptr) bool | |
| 201 | + | ||
| 202 | + | // Gets whether @self is collapsed. | |
| 203 | + | func (x *OverlaySplitView) GetCollapsed() bool { | |
| 204 | + | ||
| 205 | + | cret := xOverlaySplitViewGetCollapsed(x.GoPointer()) | |
| 206 | + | return cret | |
| 207 | + | } | |
| 208 | + | ||
| 209 | + | var xOverlaySplitViewGetContent func(uintptr) uintptr | |
| 210 | + | ||
| 211 | + | // Gets the content widget for @self. | |
| 212 | + | func (x *OverlaySplitView) GetContent() *gtk.Widget { | |
| 213 | + | var cls *gtk.Widget | |
| 214 | + | ||
| 215 | + | cret := xOverlaySplitViewGetContent(x.GoPointer()) | |
| 216 | + | ||
| 217 | + | if cret == 0 { | |
| 218 | + | return nil | |
| 219 | + | } | |
| 220 | + | gobject.IncreaseRef(cret) | |
| 221 | + | cls = >k.Widget{} | |
| 222 | + | cls.Ptr = cret | |
| 223 | + | return cls | |
| 224 | + | } | |
| 225 | + | ||
| 226 | + | var xOverlaySplitViewGetEnableHideGesture func(uintptr) bool | |
| 227 | + | ||
| 228 | + | // Gets whether @self can be closed with a swipe gesture. | |
| 229 | + | func (x *OverlaySplitView) GetEnableHideGesture() bool { | |
| 230 | + | ||
| 231 | + | cret := xOverlaySplitViewGetEnableHideGesture(x.GoPointer()) | |
| 232 | + | return cret | |
| 233 | + | } | |
| 234 | + | ||
| 235 | + | var xOverlaySplitViewGetEnableShowGesture func(uintptr) bool | |
| 236 | + | ||
| 237 | + | // Gets whether @self can be opened with an edge swipe gesture. | |
| 238 | + | func (x *OverlaySplitView) GetEnableShowGesture() bool { | |
| 239 | + | ||
| 240 | + | cret := xOverlaySplitViewGetEnableShowGesture(x.GoPointer()) | |
| 241 | + | return cret | |
| 242 | + | } | |
| 243 | + | ||
| 244 | + | var xOverlaySplitViewGetMaxSidebarWidth func(uintptr) float64 | |
| 245 | + | ||
| 246 | + | // Gets the maximum sidebar width for @self. | |
| 247 | + | func (x *OverlaySplitView) GetMaxSidebarWidth() float64 { | |
| 248 | + | ||
| 249 | + | cret := xOverlaySplitViewGetMaxSidebarWidth(x.GoPointer()) | |
| 250 | + | return cret | |
| 251 | + | } | |
| 252 | + | ||
| 253 | + | var xOverlaySplitViewGetMinSidebarWidth func(uintptr) float64 | |
| 254 | + | ||
| 255 | + | // Gets the minimum sidebar width for @self. | |
| 256 | + | func (x *OverlaySplitView) GetMinSidebarWidth() float64 { | |
| 257 | + | ||
| 258 | + | cret := xOverlaySplitViewGetMinSidebarWidth(x.GoPointer()) | |
| 259 | + | return cret | |
| 260 | + | } | |
| 261 | + | ||
| 262 | + | var xOverlaySplitViewGetPinSidebar func(uintptr) bool | |
| 263 | + | ||
| 264 | + | // Gets whether the sidebar widget is pinned for @self. | |
| 265 | + | func (x *OverlaySplitView) GetPinSidebar() bool { | |
| 266 | + | ||
| 267 | + | cret := xOverlaySplitViewGetPinSidebar(x.GoPointer()) | |
| 268 | + | return cret | |
| 269 | + | } | |
| 270 | + | ||
| 271 | + | var xOverlaySplitViewGetShowSidebar func(uintptr) bool | |
| 272 | + | ||
| 273 | + | // Gets whether the sidebar widget is shown for @self. | |
| 274 | + | func (x *OverlaySplitView) GetShowSidebar() bool { | |
| 275 | + | ||
| 276 | + | cret := xOverlaySplitViewGetShowSidebar(x.GoPointer()) | |
| 277 | + | return cret | |
| 278 | + | } | |
| 279 | + | ||
| 280 | + | var xOverlaySplitViewGetSidebar func(uintptr) uintptr | |
| 281 | + | ||
| 282 | + | // Gets the sidebar widget for @self. | |
| 283 | + | func (x *OverlaySplitView) GetSidebar() *gtk.Widget { | |
| 284 | + | var cls *gtk.Widget | |
| 285 | + | ||
| 286 | + | cret := xOverlaySplitViewGetSidebar(x.GoPointer()) | |
| 287 | + | ||
| 288 | + | if cret == 0 { | |
| 289 | + | return nil | |
| 290 | + | } | |
| 291 | + | gobject.IncreaseRef(cret) | |
| 292 | + | cls = >k.Widget{} | |
| 293 | + | cls.Ptr = cret | |
| 294 | + | return cls | |
| 295 | + | } | |
| 296 | + | ||
| 297 | + | var xOverlaySplitViewGetSidebarPosition func(uintptr) gtk.PackType | |
| 298 | + | ||
| 299 | + | // Gets the sidebar position for @self. | |
| 300 | + | func (x *OverlaySplitView) GetSidebarPosition() gtk.PackType { | |
| 301 | + | ||
| 302 | + | cret := xOverlaySplitViewGetSidebarPosition(x.GoPointer()) | |
| 303 | + | return cret | |
| 304 | + | } | |
| 305 | + | ||
| 306 | + | var xOverlaySplitViewGetSidebarWidthFraction func(uintptr) float64 | |
| 307 | + | ||
| 308 | + | // Gets the preferred sidebar width fraction for @self. | |
| 309 | + | func (x *OverlaySplitView) GetSidebarWidthFraction() float64 { | |
| 310 | + | ||
| 311 | + | cret := xOverlaySplitViewGetSidebarWidthFraction(x.GoPointer()) | |
| 312 | + | return cret | |
| 313 | + | } | |
| 314 | + | ||
| 315 | + | var xOverlaySplitViewGetSidebarWidthUnit func(uintptr) LengthUnit | |
| 316 | + | ||
| 317 | + | // Gets the length unit for minimum and maximum sidebar widths. | |
| 318 | + | func (x *OverlaySplitView) GetSidebarWidthUnit() LengthUnit { | |
| 319 | + | ||
| 320 | + | cret := xOverlaySplitViewGetSidebarWidthUnit(x.GoPointer()) | |
| 321 | + | return cret | |
| 322 | + | } | |
| 323 | + | ||
| 324 | + | var xOverlaySplitViewSetCollapsed func(uintptr, bool) | |
| 325 | + | ||
| 326 | + | // Sets whether @self view is collapsed. | |
| 327 | + | // | |
| 328 | + | // When collapsed, the sidebar widget is presented as an overlay above the | |
| 329 | + | // content widget, otherwise they are displayed side by side. | |
| 330 | + | func (x *OverlaySplitView) SetCollapsed(CollapsedVar bool) { | |
| 331 | + | ||
| 332 | + | xOverlaySplitViewSetCollapsed(x.GoPointer(), CollapsedVar) | |
| 333 | + | ||
| 334 | + | } | |
| 335 | + | ||
| 336 | + | var xOverlaySplitViewSetContent func(uintptr, uintptr) | |
| 337 | + | ||
| 338 | + | // Sets the content widget for @self. | |
| 339 | + | func (x *OverlaySplitView) SetContent(ContentVar *gtk.Widget) { | |
| 340 | + | ||
| 341 | + | xOverlaySplitViewSetContent(x.GoPointer(), ContentVar.GoPointer()) | |
| 342 | + | ||
| 343 | + | } | |
| 344 | + | ||
| 345 | + | var xOverlaySplitViewSetEnableHideGesture func(uintptr, bool) | |
| 346 | + | ||
| 347 | + | // Sets whether @self can be closed with a swipe gesture. | |
| 348 | + | // | |
| 349 | + | // Only touchscreen swipes are supported. | |
| 350 | + | func (x *OverlaySplitView) SetEnableHideGesture(EnableHideGestureVar bool) { | |
| 351 | + | ||
| 352 | + | xOverlaySplitViewSetEnableHideGesture(x.GoPointer(), EnableHideGestureVar) | |
| 353 | + | ||
| 354 | + | } | |
| 355 | + | ||
| 356 | + | var xOverlaySplitViewSetEnableShowGesture func(uintptr, bool) | |
| 357 | + | ||
| 358 | + | // Sets whether @self can be opened with an edge swipe gesture. | |
| 359 | + | // | |
| 360 | + | // Only touchscreen swipes are supported. | |
| 361 | + | func (x *OverlaySplitView) SetEnableShowGesture(EnableShowGestureVar bool) { | |
| 362 | + | ||
| 363 | + | xOverlaySplitViewSetEnableShowGesture(x.GoPointer(), EnableShowGestureVar) | |
| 364 | + | ||
| 365 | + | } | |
| 366 | + | ||
| 367 | + | var xOverlaySplitViewSetMaxSidebarWidth func(uintptr, float64) | |
| 368 | + | ||
| 369 | + | // Sets the maximum sidebar width for @self. | |
| 370 | + | // | |
| 371 | + | // Maximum width is affected by [property@OverlaySplitView:sidebar-width-unit]. | |
| 372 | + | // | |
| 373 | + | // The sidebar widget can still be allocated with larger width if its own | |
| 374 | + | // minimum width exceeds it. | |
| 375 | + | func (x *OverlaySplitView) SetMaxSidebarWidth(WidthVar float64) { | |
| 376 | + | ||
| 377 | + | xOverlaySplitViewSetMaxSidebarWidth(x.GoPointer(), WidthVar) | |
| 378 | + | ||
| 379 | + | } | |
| 380 | + | ||
| 381 | + | var xOverlaySplitViewSetMinSidebarWidth func(uintptr, float64) | |
| 382 | + | ||
| 383 | + | // Sets the minimum sidebar width for @self. | |
| 384 | + | // | |
| 385 | + | // Minimum width is affected by [property@OverlaySplitView:sidebar-width-unit]. | |
| 386 | + | // | |
| 387 | + | // The sidebar widget can still be allocated with larger width if its own | |
| 388 | + | // minimum width exceeds it. | |
| 389 | + | func (x *OverlaySplitView) SetMinSidebarWidth(WidthVar float64) { | |
| 390 | + | ||
| 391 | + | xOverlaySplitViewSetMinSidebarWidth(x.GoPointer(), WidthVar) | |
| 392 | + | ||
| 393 | + | } | |
| 394 | + | ||
| 395 | + | var xOverlaySplitViewSetPinSidebar func(uintptr, bool) | |
| 396 | + | ||
| 397 | + | // Sets whether the sidebar widget is pinned for @self. | |
| 398 | + | // | |
| 399 | + | // By default, collapsing @self automatically hides the sidebar widget, and | |
| 400 | + | // uncollapsing it shows the sidebar. If set to `TRUE`, sidebar visibility never | |
| 401 | + | // changes on its own. | |
| 402 | + | func (x *OverlaySplitView) SetPinSidebar(PinSidebarVar bool) { | |
| 403 | + | ||
| 404 | + | xOverlaySplitViewSetPinSidebar(x.GoPointer(), PinSidebarVar) | |
| 405 | + | ||
| 406 | + | } | |
| 407 | + | ||
| 408 | + | var xOverlaySplitViewSetShowSidebar func(uintptr, bool) | |
| 409 | + | ||
| 410 | + | // Sets whether the sidebar widget is shown for @self. | |
| 411 | + | func (x *OverlaySplitView) SetShowSidebar(ShowSidebarVar bool) { | |
| 412 | + | ||
| 413 | + | xOverlaySplitViewSetShowSidebar(x.GoPointer(), ShowSidebarVar) | |
| 414 | + | ||
| 415 | + | } | |
| 416 | + | ||
| 417 | + | var xOverlaySplitViewSetSidebar func(uintptr, uintptr) | |
| 418 | + | ||
| 419 | + | // Sets the sidebar widget for @self. | |
| 420 | + | func (x *OverlaySplitView) SetSidebar(SidebarVar *gtk.Widget) { | |
| 421 | + | ||
| 422 | + | xOverlaySplitViewSetSidebar(x.GoPointer(), SidebarVar.GoPointer()) | |
| 423 | + | ||
| 424 | + | } | |
| 425 | + | ||
| 426 | + | var xOverlaySplitViewSetSidebarPosition func(uintptr, gtk.PackType) | |
| 427 | + | ||
| 428 | + | // Sets the sidebar position for @self. | |
| 429 | + | // | |
| 430 | + | // If it's set to `GTK_PACK_START`, the sidebar is displayed before the content, | |
| 431 | + | // if `GTK_PACK_END`, it's displayed after the content. | |
| 432 | + | func (x *OverlaySplitView) SetSidebarPosition(PositionVar gtk.PackType) { | |
| 433 | + | ||
| 434 | + | xOverlaySplitViewSetSidebarPosition(x.GoPointer(), PositionVar) | |
| 435 | + | ||
| 436 | + | } | |
| 437 | + | ||
| 438 | + | var xOverlaySplitViewSetSidebarWidthFraction func(uintptr, float64) | |
| 439 | + | ||
| 440 | + | // Sets the preferred sidebar width as a fraction of the total width of @self. | |
| 441 | + | // | |
| 442 | + | // The preferred width is additionally limited by | |
| 443 | + | // [property@OverlaySplitView:min-sidebar-width] and | |
| 444 | + | // [property@OverlaySplitView:max-sidebar-width]. | |
| 445 | + | // | |
| 446 | + | // The sidebar widget can be allocated with larger width if its own minimum | |
| 447 | + | // width exceeds the preferred width. | |
| 448 | + | func (x *OverlaySplitView) SetSidebarWidthFraction(FractionVar float64) { | |
| 449 | + | ||
| 450 | + | xOverlaySplitViewSetSidebarWidthFraction(x.GoPointer(), FractionVar) | |
| 451 | + | ||
| 452 | + | } | |
| 453 | + | ||
| 454 | + | var xOverlaySplitViewSetSidebarWidthUnit func(uintptr, LengthUnit) | |
| 455 | + | ||
| 456 | + | // Sets the length unit for minimum and maximum sidebar widths. | |
| 457 | + | // | |
| 458 | + | // See [property@OverlaySplitView:min-sidebar-width] and | |
| 459 | + | // [property@OverlaySplitView:max-sidebar-width]. | |
| 460 | + | func (x *OverlaySplitView) SetSidebarWidthUnit(UnitVar LengthUnit) { | |
| 461 | + | ||
| 462 | + | xOverlaySplitViewSetSidebarWidthUnit(x.GoPointer(), UnitVar) | |
| 463 | + | ||
| 464 | + | } | |
| 465 | + | ||
| 466 | + | func (c *OverlaySplitView) GoPointer() uintptr { | |
| 467 | + | return c.Ptr | |
| 468 | + | } | |
| 469 | + | ||
| 470 | + | func (c *OverlaySplitView) SetGoPointer(ptr uintptr) { | |
| 471 | + | c.Ptr = ptr | |
| 472 | + | } | |
| 473 | + | ||
| 474 | + | // Gets the progress @self will snap back to after the gesture is canceled. | |
| 475 | + | func (x *OverlaySplitView) GetCancelProgress() float64 { | |
| 476 | + | ||
| 477 | + | cret := XAdwSwipeableGetCancelProgress(x.GoPointer()) | |
| 478 | + | return cret | |
| 479 | + | } | |
| 480 | + | ||
| 481 | + | // Gets the swipe distance of @self. | |
| 482 | + | // | |
| 483 | + | // This corresponds to how many pixels 1 unit represents. | |
| 484 | + | func (x *OverlaySplitView) GetDistance() float64 { | |
| 485 | + | ||
| 486 | + | cret := XAdwSwipeableGetDistance(x.GoPointer()) | |
| 487 | + | return cret | |
| 488 | + | } | |
| 489 | + | ||
| 490 | + | // Gets the current progress of @self. | |
| 491 | + | func (x *OverlaySplitView) GetProgress() float64 { | |
| 492 | + | ||
| 493 | + | cret := XAdwSwipeableGetProgress(x.GoPointer()) | |
| 494 | + | return cret | |
| 495 | + | } | |
| 496 | + | ||
| 497 | + | // Gets the snap points of @self. | |
| 498 | + | // | |
| 499 | + | // Each snap point represents a progress value that is considered acceptable to | |
| 500 | + | // end the swipe on. | |
| 501 | + | func (x *OverlaySplitView) GetSnapPoints(NSnapPointsVar int) []float64 { | |
| 502 | + | ||
| 503 | + | cret := XAdwSwipeableGetSnapPoints(x.GoPointer(), NSnapPointsVar) | |
| 504 | + | return cret | |
| 505 | + | } | |
| 506 | + | ||
| 507 | + | // Gets the area @self can start a swipe from for the given direction and | |
| 508 | + | // gesture type. | |
| 509 | + | // | |
| 510 | + | // This can be used to restrict swipes to only be possible from a certain area, | |
| 511 | + | // for example, to only allow edge swipes, or to have a draggable element and | |
| 512 | + | // ignore swipes elsewhere. | |
| 513 | + | // | |
| 514 | + | // If not implemented, the default implementation returns the allocation of | |
| 515 | + | // @self, allowing swipes from anywhere. | |
| 516 | + | func (x *OverlaySplitView) GetSwipeArea(NavigationDirectionVar NavigationDirection, IsDragVar bool, RectVar *gdk.Rectangle) { | |
| 517 | + | ||
| 518 | + | XAdwSwipeableGetSwipeArea(x.GoPointer(), NavigationDirectionVar, IsDragVar, RectVar) | |
| 519 | + | ||
| 520 | + | } | |
| 521 | + | ||
| 522 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 523 | + | func (x *OverlaySplitView) GetAccessibleRole() gtk.AccessibleRole { | |
| 524 | + | ||
| 525 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 526 | + | return cret | |
| 527 | + | } | |
| 528 | + | ||
| 529 | + | // Resets the accessible @property to its default value. | |
| 530 | + | func (x *OverlaySplitView) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 531 | + | ||
| 532 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 533 | + | ||
| 534 | + | } | |
| 535 | + | ||
| 536 | + | // Resets the accessible @relation to its default value. | |
| 537 | + | func (x *OverlaySplitView) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 538 | + | ||
| 539 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 540 | + | ||
| 541 | + | } | |
| 542 | + | ||
| 543 | + | // Resets the accessible @state to its default value. | |
| 544 | + | func (x *OverlaySplitView) ResetState(StateVar gtk.AccessibleState) { | |
| 545 | + | ||
| 546 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 547 | + | ||
| 548 | + | } | |
| 549 | + | ||
| 550 | + | // Updates a list of accessible properties. | |
| 551 | + | // | |
| 552 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 553 | + | // value types of accessible properties. | |
| 554 | + | // | |
| 555 | + | // This function should be called by `GtkWidget` types whenever | |
| 556 | + | // an accessible property change must be communicated to assistive | |
| 557 | + | // technologies. | |
| 558 | + | // | |
| 559 | + | // Example: | |
| 560 | + | // ```c | |
| 561 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 562 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 563 | + | // | |
| 564 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 565 | + | // -1); | |
| 566 | + | // | |
| 567 | + | // ``` | |
| 568 | + | func (x *OverlaySplitView) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 569 | + | ||
| 570 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 571 | + | ||
| 572 | + | } | |
| 573 | + | ||
| 574 | + | // Updates an array of accessible properties. | |
| 575 | + | // | |
| 576 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 577 | + | // property change must be communicated to assistive technologies. | |
| 578 | + | // | |
| 579 | + | // This function is meant to be used by language bindings. | |
| 580 | + | func (x *OverlaySplitView) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 581 | + | ||
| 582 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 583 | + | ||
| 584 | + | } | |
| 585 | + | ||
| 586 | + | // Updates a list of accessible relations. | |
| 587 | + | // | |
| 588 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 589 | + | // relation change must be communicated to assistive technologies. | |
| 590 | + | // | |
| 591 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 592 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 593 | + | // | |
| 594 | + | // ```c | |
| 595 | + | // gtk_accessible_update_relation (accessible, | |
| 596 | + | // | |
| 597 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 598 | + | // ref1, NULL, | |
| 599 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 600 | + | // ref1, ref2, ref3, NULL, | |
| 601 | + | // -1); | |
| 602 | + | // | |
| 603 | + | // ``` | |
| 604 | + | func (x *OverlaySplitView) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 605 | + | ||
| 606 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 607 | + | ||
| 608 | + | } | |
| 609 | + | ||
| 610 | + | // Updates an array of accessible relations. | |
| 611 | + | // | |
| 612 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 613 | + | // relation change must be communicated to assistive technologies. | |
| 614 | + | // | |
| 615 | + | // This function is meant to be used by language bindings. | |
| 616 | + | func (x *OverlaySplitView) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 617 | + | ||
| 618 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 619 | + | ||
| 620 | + | } | |
| 621 | + | ||
| 622 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 623 | + | // documentation for the value types of accessible states. | |
| 624 | + | // | |
| 625 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 626 | + | // state change must be communicated to assistive technologies. | |
| 627 | + | // | |
| 628 | + | // Example: | |
| 629 | + | // ```c | |
| 630 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 631 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 632 | + | // | |
| 633 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 634 | + | // -1); | |
| 635 | + | // | |
| 636 | + | // ``` | |
| 637 | + | func (x *OverlaySplitView) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 638 | + | ||
| 639 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 640 | + | ||
| 641 | + | } | |
| 642 | + | ||
| 643 | + | // Updates an array of accessible states. | |
| 644 | + | // | |
| 645 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 646 | + | // state change must be communicated to assistive technologies. | |
| 647 | + | // | |
| 648 | + | // This function is meant to be used by language bindings. | |
| 649 | + | func (x *OverlaySplitView) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 650 | + | ||
| 651 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 652 | + | ||
| 653 | + | } | |
| 654 | + | ||
| 655 | + | // Gets the ID of the @buildable object. | |
| 656 | + | // | |
| 657 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 658 | + | // of the <object> tag used to construct the @buildable. | |
| 659 | + | func (x *OverlaySplitView) GetBuildableId() string { | |
| 660 | + | ||
| 661 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 662 | + | return cret | |
| 663 | + | } | |
| 664 | + | ||
| 665 | + | func init() { | |
| 666 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 667 | + | if err != nil { | |
| 668 | + | panic(err) | |
| 669 | + | } | |
| 670 | + | ||
| 671 | + | core.PuregoSafeRegister(&xOverlaySplitViewGLibType, lib, "adw_overlay_split_view_get_type") | |
| 672 | + | ||
| 673 | + | core.PuregoSafeRegister(&xNewOverlaySplitView, lib, "adw_overlay_split_view_new") | |
| 674 | + | ||
| 675 | + | core.PuregoSafeRegister(&xOverlaySplitViewGetCollapsed, lib, "adw_overlay_split_view_get_collapsed") | |
| 676 | + | core.PuregoSafeRegister(&xOverlaySplitViewGetContent, lib, "adw_overlay_split_view_get_content") | |
| 677 | + | core.PuregoSafeRegister(&xOverlaySplitViewGetEnableHideGesture, lib, "adw_overlay_split_view_get_enable_hide_gesture") | |
| 678 | + | core.PuregoSafeRegister(&xOverlaySplitViewGetEnableShowGesture, lib, "adw_overlay_split_view_get_enable_show_gesture") | |
| 679 | + | core.PuregoSafeRegister(&xOverlaySplitViewGetMaxSidebarWidth, lib, "adw_overlay_split_view_get_max_sidebar_width") | |
| 680 | + | core.PuregoSafeRegister(&xOverlaySplitViewGetMinSidebarWidth, lib, "adw_overlay_split_view_get_min_sidebar_width") | |
| 681 | + | core.PuregoSafeRegister(&xOverlaySplitViewGetPinSidebar, lib, "adw_overlay_split_view_get_pin_sidebar") | |
| 682 | + | core.PuregoSafeRegister(&xOverlaySplitViewGetShowSidebar, lib, "adw_overlay_split_view_get_show_sidebar") | |
| 683 | + | core.PuregoSafeRegister(&xOverlaySplitViewGetSidebar, lib, "adw_overlay_split_view_get_sidebar") | |
| 684 | + | core.PuregoSafeRegister(&xOverlaySplitViewGetSidebarPosition, lib, "adw_overlay_split_view_get_sidebar_position") | |
| 685 | + | core.PuregoSafeRegister(&xOverlaySplitViewGetSidebarWidthFraction, lib, "adw_overlay_split_view_get_sidebar_width_fraction") | |
| 686 | + | core.PuregoSafeRegister(&xOverlaySplitViewGetSidebarWidthUnit, lib, "adw_overlay_split_view_get_sidebar_width_unit") | |
| 687 | + | core.PuregoSafeRegister(&xOverlaySplitViewSetCollapsed, lib, "adw_overlay_split_view_set_collapsed") | |
| 688 | + | core.PuregoSafeRegister(&xOverlaySplitViewSetContent, lib, "adw_overlay_split_view_set_content") | |
| 689 | + | core.PuregoSafeRegister(&xOverlaySplitViewSetEnableHideGesture, lib, "adw_overlay_split_view_set_enable_hide_gesture") | |
| 690 | + | core.PuregoSafeRegister(&xOverlaySplitViewSetEnableShowGesture, lib, "adw_overlay_split_view_set_enable_show_gesture") | |
| 691 | + | core.PuregoSafeRegister(&xOverlaySplitViewSetMaxSidebarWidth, lib, "adw_overlay_split_view_set_max_sidebar_width") | |
| 692 | + | core.PuregoSafeRegister(&xOverlaySplitViewSetMinSidebarWidth, lib, "adw_overlay_split_view_set_min_sidebar_width") | |
| 693 | + | core.PuregoSafeRegister(&xOverlaySplitViewSetPinSidebar, lib, "adw_overlay_split_view_set_pin_sidebar") | |
| 694 | + | core.PuregoSafeRegister(&xOverlaySplitViewSetShowSidebar, lib, "adw_overlay_split_view_set_show_sidebar") | |
| 695 | + | core.PuregoSafeRegister(&xOverlaySplitViewSetSidebar, lib, "adw_overlay_split_view_set_sidebar") | |
| 696 | + | core.PuregoSafeRegister(&xOverlaySplitViewSetSidebarPosition, lib, "adw_overlay_split_view_set_sidebar_position") | |
| 697 | + | core.PuregoSafeRegister(&xOverlaySplitViewSetSidebarWidthFraction, lib, "adw_overlay_split_view_set_sidebar_width_fraction") | |
| 698 | + | core.PuregoSafeRegister(&xOverlaySplitViewSetSidebarWidthUnit, lib, "adw_overlay_split_view_set_sidebar_width_unit") | |
| 699 | + | ||
| 700 | + | } | |
A v4/adw/adw-preferences-dialog.go +368 -0
| @@ -0,0 +1,368 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 13 | + | ) | |
| 14 | + | ||
| 15 | + | type PreferencesDialogClass struct { | |
| 16 | + | _ structs.HostLayout | |
| 17 | + | ||
| 18 | + | ParentClass uintptr | |
| 19 | + | ||
| 20 | + | Padding [4]uintptr | |
| 21 | + | } | |
| 22 | + | ||
| 23 | + | func (x *PreferencesDialogClass) GoPointer() uintptr { | |
| 24 | + | return uintptr(unsafe.Pointer(x)) | |
| 25 | + | } | |
| 26 | + | ||
| 27 | + | // A dialog showing application's preferences. | |
| 28 | + | // | |
| 29 | + | // <picture> | |
| 30 | + | // | |
| 31 | + | // <source srcset="preferences-dialog-dark.png" media="(prefers-color-scheme: dark)"> | |
| 32 | + | // <img src="preferences-dialog.png" alt="preferences-dialog"> | |
| 33 | + | // | |
| 34 | + | // </picture> | |
| 35 | + | // | |
| 36 | + | // The `AdwPreferencesDialog` widget presents an application's preferences | |
| 37 | + | // gathered into pages and groups. The preferences are searchable by the user. | |
| 38 | + | // | |
| 39 | + | // ## Actions | |
| 40 | + | // | |
| 41 | + | // `AdwPrefencesDialog` defines the `navigation.pop` action, it doesn't take any | |
| 42 | + | // parameters and pops the current subpage from the navigation stack, equivalent | |
| 43 | + | // to calling [method@PreferencesDialog.pop_subpage]. | |
| 44 | + | // | |
| 45 | + | // ## CSS nodes | |
| 46 | + | // | |
| 47 | + | // `AdwPreferencesDialog` has a main CSS node with the name `dialog` and the | |
| 48 | + | // style class `.preferences`. | |
| 49 | + | type PreferencesDialog struct { | |
| 50 | + | Dialog | |
| 51 | + | } | |
| 52 | + | ||
| 53 | + | var xPreferencesDialogGLibType func() types.GType | |
| 54 | + | ||
| 55 | + | func PreferencesDialogGLibType() types.GType { | |
| 56 | + | return xPreferencesDialogGLibType() | |
| 57 | + | } | |
| 58 | + | ||
| 59 | + | func PreferencesDialogNewFromInternalPtr(ptr uintptr) *PreferencesDialog { | |
| 60 | + | cls := &PreferencesDialog{} | |
| 61 | + | cls.Ptr = ptr | |
| 62 | + | return cls | |
| 63 | + | } | |
| 64 | + | ||
| 65 | + | var xNewPreferencesDialog func() uintptr | |
| 66 | + | ||
| 67 | + | // Creates a new `AdwPreferencesDialog`. | |
| 68 | + | func NewPreferencesDialog() *PreferencesDialog { | |
| 69 | + | var cls *PreferencesDialog | |
| 70 | + | ||
| 71 | + | cret := xNewPreferencesDialog() | |
| 72 | + | ||
| 73 | + | if cret == 0 { | |
| 74 | + | return nil | |
| 75 | + | } | |
| 76 | + | gobject.IncreaseRef(cret) | |
| 77 | + | cls = &PreferencesDialog{} | |
| 78 | + | cls.Ptr = cret | |
| 79 | + | return cls | |
| 80 | + | } | |
| 81 | + | ||
| 82 | + | var xPreferencesDialogAdd func(uintptr, uintptr) | |
| 83 | + | ||
| 84 | + | // Adds a preferences page to @self. | |
| 85 | + | func (x *PreferencesDialog) Add(PageVar *PreferencesPage) { | |
| 86 | + | ||
| 87 | + | xPreferencesDialogAdd(x.GoPointer(), PageVar.GoPointer()) | |
| 88 | + | ||
| 89 | + | } | |
| 90 | + | ||
| 91 | + | var xPreferencesDialogAddToast func(uintptr, uintptr) | |
| 92 | + | ||
| 93 | + | // Displays @toast. | |
| 94 | + | // | |
| 95 | + | // See [method@ToastOverlay.add_toast]. | |
| 96 | + | func (x *PreferencesDialog) AddToast(ToastVar *Toast) { | |
| 97 | + | ||
| 98 | + | xPreferencesDialogAddToast(x.GoPointer(), ToastVar.GoPointer()) | |
| 99 | + | ||
| 100 | + | } | |
| 101 | + | ||
| 102 | + | var xPreferencesDialogGetSearchEnabled func(uintptr) bool | |
| 103 | + | ||
| 104 | + | // Gets whether search is enabled for @self. | |
| 105 | + | func (x *PreferencesDialog) GetSearchEnabled() bool { | |
| 106 | + | ||
| 107 | + | cret := xPreferencesDialogGetSearchEnabled(x.GoPointer()) | |
| 108 | + | return cret | |
| 109 | + | } | |
| 110 | + | ||
| 111 | + | var xPreferencesDialogGetVisiblePage func(uintptr) uintptr | |
| 112 | + | ||
| 113 | + | // Gets the currently visible page of @self. | |
| 114 | + | func (x *PreferencesDialog) GetVisiblePage() *PreferencesPage { | |
| 115 | + | var cls *PreferencesPage | |
| 116 | + | ||
| 117 | + | cret := xPreferencesDialogGetVisiblePage(x.GoPointer()) | |
| 118 | + | ||
| 119 | + | if cret == 0 { | |
| 120 | + | return nil | |
| 121 | + | } | |
| 122 | + | gobject.IncreaseRef(cret) | |
| 123 | + | cls = &PreferencesPage{} | |
| 124 | + | cls.Ptr = cret | |
| 125 | + | return cls | |
| 126 | + | } | |
| 127 | + | ||
| 128 | + | var xPreferencesDialogGetVisiblePageName func(uintptr) string | |
| 129 | + | ||
| 130 | + | // Gets the name of currently visible page of @self. | |
| 131 | + | func (x *PreferencesDialog) GetVisiblePageName() string { | |
| 132 | + | ||
| 133 | + | cret := xPreferencesDialogGetVisiblePageName(x.GoPointer()) | |
| 134 | + | return cret | |
| 135 | + | } | |
| 136 | + | ||
| 137 | + | var xPreferencesDialogPopSubpage func(uintptr) bool | |
| 138 | + | ||
| 139 | + | // Pop the visible page from the subpage stack of @self. | |
| 140 | + | func (x *PreferencesDialog) PopSubpage() bool { | |
| 141 | + | ||
| 142 | + | cret := xPreferencesDialogPopSubpage(x.GoPointer()) | |
| 143 | + | return cret | |
| 144 | + | } | |
| 145 | + | ||
| 146 | + | var xPreferencesDialogPushSubpage func(uintptr, uintptr) | |
| 147 | + | ||
| 148 | + | // Pushes @page onto the subpage stack of @self. | |
| 149 | + | // | |
| 150 | + | // The page will be automatically removed when popped. | |
| 151 | + | func (x *PreferencesDialog) PushSubpage(PageVar *NavigationPage) { | |
| 152 | + | ||
| 153 | + | xPreferencesDialogPushSubpage(x.GoPointer(), PageVar.GoPointer()) | |
| 154 | + | ||
| 155 | + | } | |
| 156 | + | ||
| 157 | + | var xPreferencesDialogRemove func(uintptr, uintptr) | |
| 158 | + | ||
| 159 | + | // Removes a page from @self. | |
| 160 | + | func (x *PreferencesDialog) Remove(PageVar *PreferencesPage) { | |
| 161 | + | ||
| 162 | + | xPreferencesDialogRemove(x.GoPointer(), PageVar.GoPointer()) | |
| 163 | + | ||
| 164 | + | } | |
| 165 | + | ||
| 166 | + | var xPreferencesDialogSetSearchEnabled func(uintptr, bool) | |
| 167 | + | ||
| 168 | + | // Sets whether search is enabled for @self. | |
| 169 | + | func (x *PreferencesDialog) SetSearchEnabled(SearchEnabledVar bool) { | |
| 170 | + | ||
| 171 | + | xPreferencesDialogSetSearchEnabled(x.GoPointer(), SearchEnabledVar) | |
| 172 | + | ||
| 173 | + | } | |
| 174 | + | ||
| 175 | + | var xPreferencesDialogSetVisiblePage func(uintptr, uintptr) | |
| 176 | + | ||
| 177 | + | // Makes @page the visible page of @self. | |
| 178 | + | func (x *PreferencesDialog) SetVisiblePage(PageVar *PreferencesPage) { | |
| 179 | + | ||
| 180 | + | xPreferencesDialogSetVisiblePage(x.GoPointer(), PageVar.GoPointer()) | |
| 181 | + | ||
| 182 | + | } | |
| 183 | + | ||
| 184 | + | var xPreferencesDialogSetVisiblePageName func(uintptr, string) | |
| 185 | + | ||
| 186 | + | // Makes the page with the given name visible. | |
| 187 | + | // | |
| 188 | + | // See [property@PreferencesDialog:visible-page]. | |
| 189 | + | func (x *PreferencesDialog) SetVisiblePageName(NameVar string) { | |
| 190 | + | ||
| 191 | + | xPreferencesDialogSetVisiblePageName(x.GoPointer(), NameVar) | |
| 192 | + | ||
| 193 | + | } | |
| 194 | + | ||
| 195 | + | func (c *PreferencesDialog) GoPointer() uintptr { | |
| 196 | + | return c.Ptr | |
| 197 | + | } | |
| 198 | + | ||
| 199 | + | func (c *PreferencesDialog) SetGoPointer(ptr uintptr) { | |
| 200 | + | c.Ptr = ptr | |
| 201 | + | } | |
| 202 | + | ||
| 203 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 204 | + | func (x *PreferencesDialog) GetAccessibleRole() gtk.AccessibleRole { | |
| 205 | + | ||
| 206 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 207 | + | return cret | |
| 208 | + | } | |
| 209 | + | ||
| 210 | + | // Resets the accessible @property to its default value. | |
| 211 | + | func (x *PreferencesDialog) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 212 | + | ||
| 213 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 214 | + | ||
| 215 | + | } | |
| 216 | + | ||
| 217 | + | // Resets the accessible @relation to its default value. | |
| 218 | + | func (x *PreferencesDialog) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 219 | + | ||
| 220 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 221 | + | ||
| 222 | + | } | |
| 223 | + | ||
| 224 | + | // Resets the accessible @state to its default value. | |
| 225 | + | func (x *PreferencesDialog) ResetState(StateVar gtk.AccessibleState) { | |
| 226 | + | ||
| 227 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 228 | + | ||
| 229 | + | } | |
| 230 | + | ||
| 231 | + | // Updates a list of accessible properties. | |
| 232 | + | // | |
| 233 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 234 | + | // value types of accessible properties. | |
| 235 | + | // | |
| 236 | + | // This function should be called by `GtkWidget` types whenever | |
| 237 | + | // an accessible property change must be communicated to assistive | |
| 238 | + | // technologies. | |
| 239 | + | // | |
| 240 | + | // Example: | |
| 241 | + | // ```c | |
| 242 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 243 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 244 | + | // | |
| 245 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 246 | + | // -1); | |
| 247 | + | // | |
| 248 | + | // ``` | |
| 249 | + | func (x *PreferencesDialog) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 250 | + | ||
| 251 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 252 | + | ||
| 253 | + | } | |
| 254 | + | ||
| 255 | + | // Updates an array of accessible properties. | |
| 256 | + | // | |
| 257 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 258 | + | // property change must be communicated to assistive technologies. | |
| 259 | + | // | |
| 260 | + | // This function is meant to be used by language bindings. | |
| 261 | + | func (x *PreferencesDialog) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 262 | + | ||
| 263 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 264 | + | ||
| 265 | + | } | |
| 266 | + | ||
| 267 | + | // Updates a list of accessible relations. | |
| 268 | + | // | |
| 269 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 270 | + | // relation change must be communicated to assistive technologies. | |
| 271 | + | // | |
| 272 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 273 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 274 | + | // | |
| 275 | + | // ```c | |
| 276 | + | // gtk_accessible_update_relation (accessible, | |
| 277 | + | // | |
| 278 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 279 | + | // ref1, NULL, | |
| 280 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 281 | + | // ref1, ref2, ref3, NULL, | |
| 282 | + | // -1); | |
| 283 | + | // | |
| 284 | + | // ``` | |
| 285 | + | func (x *PreferencesDialog) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 286 | + | ||
| 287 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 288 | + | ||
| 289 | + | } | |
| 290 | + | ||
| 291 | + | // Updates an array of accessible relations. | |
| 292 | + | // | |
| 293 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 294 | + | // relation change must be communicated to assistive technologies. | |
| 295 | + | // | |
| 296 | + | // This function is meant to be used by language bindings. | |
| 297 | + | func (x *PreferencesDialog) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 298 | + | ||
| 299 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 300 | + | ||
| 301 | + | } | |
| 302 | + | ||
| 303 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 304 | + | // documentation for the value types of accessible states. | |
| 305 | + | // | |
| 306 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 307 | + | // state change must be communicated to assistive technologies. | |
| 308 | + | // | |
| 309 | + | // Example: | |
| 310 | + | // ```c | |
| 311 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 312 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 313 | + | // | |
| 314 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 315 | + | // -1); | |
| 316 | + | // | |
| 317 | + | // ``` | |
| 318 | + | func (x *PreferencesDialog) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 319 | + | ||
| 320 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 321 | + | ||
| 322 | + | } | |
| 323 | + | ||
| 324 | + | // Updates an array of accessible states. | |
| 325 | + | // | |
| 326 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 327 | + | // state change must be communicated to assistive technologies. | |
| 328 | + | // | |
| 329 | + | // This function is meant to be used by language bindings. | |
| 330 | + | func (x *PreferencesDialog) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 331 | + | ||
| 332 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 333 | + | ||
| 334 | + | } | |
| 335 | + | ||
| 336 | + | // Gets the ID of the @buildable object. | |
| 337 | + | // | |
| 338 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 339 | + | // of the <object> tag used to construct the @buildable. | |
| 340 | + | func (x *PreferencesDialog) GetBuildableId() string { | |
| 341 | + | ||
| 342 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 343 | + | return cret | |
| 344 | + | } | |
| 345 | + | ||
| 346 | + | func init() { | |
| 347 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 348 | + | if err != nil { | |
| 349 | + | panic(err) | |
| 350 | + | } | |
| 351 | + | ||
| 352 | + | core.PuregoSafeRegister(&xPreferencesDialogGLibType, lib, "adw_preferences_dialog_get_type") | |
| 353 | + | ||
| 354 | + | core.PuregoSafeRegister(&xNewPreferencesDialog, lib, "adw_preferences_dialog_new") | |
| 355 | + | ||
| 356 | + | core.PuregoSafeRegister(&xPreferencesDialogAdd, lib, "adw_preferences_dialog_add") | |
| 357 | + | core.PuregoSafeRegister(&xPreferencesDialogAddToast, lib, "adw_preferences_dialog_add_toast") | |
| 358 | + | core.PuregoSafeRegister(&xPreferencesDialogGetSearchEnabled, lib, "adw_preferences_dialog_get_search_enabled") | |
| 359 | + | core.PuregoSafeRegister(&xPreferencesDialogGetVisiblePage, lib, "adw_preferences_dialog_get_visible_page") | |
| 360 | + | core.PuregoSafeRegister(&xPreferencesDialogGetVisiblePageName, lib, "adw_preferences_dialog_get_visible_page_name") | |
| 361 | + | core.PuregoSafeRegister(&xPreferencesDialogPopSubpage, lib, "adw_preferences_dialog_pop_subpage") | |
| 362 | + | core.PuregoSafeRegister(&xPreferencesDialogPushSubpage, lib, "adw_preferences_dialog_push_subpage") | |
| 363 | + | core.PuregoSafeRegister(&xPreferencesDialogRemove, lib, "adw_preferences_dialog_remove") | |
| 364 | + | core.PuregoSafeRegister(&xPreferencesDialogSetSearchEnabled, lib, "adw_preferences_dialog_set_search_enabled") | |
| 365 | + | core.PuregoSafeRegister(&xPreferencesDialogSetVisiblePage, lib, "adw_preferences_dialog_set_visible_page") | |
| 366 | + | core.PuregoSafeRegister(&xPreferencesDialogSetVisiblePageName, lib, "adw_preferences_dialog_set_visible_page_name") | |
| 367 | + | ||
| 368 | + | } | |
M v4/adw/adw-preferences-group.go +30 -1
| @@ -37,9 +37,14 @@ func (x *PreferencesGroupClass) GoPointer() uintptr { | |||
| 37 | 37 | // which in turn are represented by [class@PreferencesRow]. | |
| 38 | 38 | // | |
| 39 | 39 | // To summarize the role of the preferences it gathers, a group can have both a | |
| 40 | - | // title and a description. The title will be used by [class@PreferencesWindow] | |
| 40 | + | // title and a description. The title will be used by [class@PreferencesDialog] | |
| 41 | 41 | // to let the user look for a preference. | |
| 42 | 42 | // | |
| 43 | + | // The [property@PreferencesGroup:separate-rows] property can be used to | |
| 44 | + | // separate the rows within the group, same as when using the | |
| 45 | + | // [`.boxed-list-separate`](style-classes.html#boxed-lists-cards) style class | |
| 46 | + | // instead of `.boxed-list`. | |
| 47 | + | // | |
| 43 | 48 | // ## AdwPreferencesGroup as GtkBuildable | |
| 44 | 49 | // | |
| 45 | 50 | // The `AdwPreferencesGroup` implementation of the [iface@Gtk.Buildable] interface | |
| @@ -125,6 +130,15 @@ func (x *PreferencesGroup) GetHeaderSuffix() *gtk.Widget { | |||
| 125 | 130 | return cls | |
| 126 | 131 | } | |
| 127 | 132 | ||
| 133 | + | var xPreferencesGroupGetSeparateRows func(uintptr) bool | |
| 134 | + | ||
| 135 | + | // Gets whether @self's rows are separated. | |
| 136 | + | func (x *PreferencesGroup) GetSeparateRows() bool { | |
| 137 | + | ||
| 138 | + | cret := xPreferencesGroupGetSeparateRows(x.GoPointer()) | |
| 139 | + | return cret | |
| 140 | + | } | |
| 141 | + | ||
| 128 | 142 | var xPreferencesGroupGetTitle func(uintptr) string | |
| 129 | 143 | ||
| 130 | 144 | // Gets the title of @self. | |
| @@ -165,6 +179,19 @@ func (x *PreferencesGroup) SetHeaderSuffix(SuffixVar *gtk.Widget) { | |||
| 165 | 179 | ||
| 166 | 180 | } | |
| 167 | 181 | ||
| 182 | + | var xPreferencesGroupSetSeparateRows func(uintptr, bool) | |
| 183 | + | ||
| 184 | + | // Sets whether @self's rows are separated. | |
| 185 | + | // | |
| 186 | + | // Equivalent to using the | |
| 187 | + | // [`.boxed-list-separate`](style-classes.html#boxed-lists-cards) style class | |
| 188 | + | // on a [class@Gtk.ListBox] instead of `.boxed-list`. | |
| 189 | + | func (x *PreferencesGroup) SetSeparateRows(SeparateRowsVar bool) { | |
| 190 | + | ||
| 191 | + | xPreferencesGroupSetSeparateRows(x.GoPointer(), SeparateRowsVar) | |
| 192 | + | ||
| 193 | + | } | |
| 194 | + | ||
| 168 | 195 | var xPreferencesGroupSetTitle func(uintptr, string) | |
| 169 | 196 | ||
| 170 | 197 | // Sets the title for @self. | |
| @@ -338,10 +365,12 @@ func init() { | |||
| 338 | 365 | core.PuregoSafeRegister(&xPreferencesGroupAdd, lib, "adw_preferences_group_add") | |
| 339 | 366 | core.PuregoSafeRegister(&xPreferencesGroupGetDescription, lib, "adw_preferences_group_get_description") | |
| 340 | 367 | core.PuregoSafeRegister(&xPreferencesGroupGetHeaderSuffix, lib, "adw_preferences_group_get_header_suffix") | |
| 368 | + | core.PuregoSafeRegister(&xPreferencesGroupGetSeparateRows, lib, "adw_preferences_group_get_separate_rows") | |
| 341 | 369 | core.PuregoSafeRegister(&xPreferencesGroupGetTitle, lib, "adw_preferences_group_get_title") | |
| 342 | 370 | core.PuregoSafeRegister(&xPreferencesGroupRemove, lib, "adw_preferences_group_remove") | |
| 343 | 371 | core.PuregoSafeRegister(&xPreferencesGroupSetDescription, lib, "adw_preferences_group_set_description") | |
| 344 | 372 | core.PuregoSafeRegister(&xPreferencesGroupSetHeaderSuffix, lib, "adw_preferences_group_set_header_suffix") | |
| 373 | + | core.PuregoSafeRegister(&xPreferencesGroupSetSeparateRows, lib, "adw_preferences_group_set_separate_rows") | |
| 345 | 374 | core.PuregoSafeRegister(&xPreferencesGroupSetTitle, lib, "adw_preferences_group_set_title") | |
| 346 | 375 | ||
| 347 | 376 | } | |
M v4/adw/adw-preferences-page.go +43 -1
| @@ -24,7 +24,7 @@ func (x *PreferencesPageClass) GoPointer() uintptr { | |||
| 24 | 24 | return uintptr(unsafe.Pointer(x)) | |
| 25 | 25 | } | |
| 26 | 26 | ||
| 27 | - | // A page from [class@PreferencesWindow]. | |
| 27 | + | // A page from [class@PreferencesDialog]. | |
| 28 | 28 | // | |
| 29 | 29 | // <picture> | |
| 30 | 30 | // | |
| @@ -85,6 +85,24 @@ func (x *PreferencesPage) Add(GroupVar *PreferencesGroup) { | |||
| 85 | 85 | ||
| 86 | 86 | } | |
| 87 | 87 | ||
| 88 | + | var xPreferencesPageGetDescription func(uintptr) string | |
| 89 | + | ||
| 90 | + | // Gets the description of @self. | |
| 91 | + | func (x *PreferencesPage) GetDescription() string { | |
| 92 | + | ||
| 93 | + | cret := xPreferencesPageGetDescription(x.GoPointer()) | |
| 94 | + | return cret | |
| 95 | + | } | |
| 96 | + | ||
| 97 | + | var xPreferencesPageGetDescriptionCentered func(uintptr) bool | |
| 98 | + | ||
| 99 | + | // Gets whether the description is centered. | |
| 100 | + | func (x *PreferencesPage) GetDescriptionCentered() bool { | |
| 101 | + | ||
| 102 | + | cret := xPreferencesPageGetDescriptionCentered(x.GoPointer()) | |
| 103 | + | return cret | |
| 104 | + | } | |
| 105 | + | ||
| 88 | 106 | var xPreferencesPageGetIconName func(uintptr) string | |
| 89 | 107 | ||
| 90 | 108 | // Gets the icon name for @self. | |
| @@ -139,6 +157,26 @@ func (x *PreferencesPage) ScrollToTop() { | |||
| 139 | 157 | ||
| 140 | 158 | } | |
| 141 | 159 | ||
| 160 | + | var xPreferencesPageSetDescription func(uintptr, string) | |
| 161 | + | ||
| 162 | + | // Sets the description of @self. | |
| 163 | + | // | |
| 164 | + | // The description is displayed at the top of the page. | |
| 165 | + | func (x *PreferencesPage) SetDescription(DescriptionVar string) { | |
| 166 | + | ||
| 167 | + | xPreferencesPageSetDescription(x.GoPointer(), DescriptionVar) | |
| 168 | + | ||
| 169 | + | } | |
| 170 | + | ||
| 171 | + | var xPreferencesPageSetDescriptionCentered func(uintptr, bool) | |
| 172 | + | ||
| 173 | + | // Sets whether the description should be centered. | |
| 174 | + | func (x *PreferencesPage) SetDescriptionCentered(CenteredVar bool) { | |
| 175 | + | ||
| 176 | + | xPreferencesPageSetDescriptionCentered(x.GoPointer(), CenteredVar) | |
| 177 | + | ||
| 178 | + | } | |
| 179 | + | ||
| 142 | 180 | var xPreferencesPageSetIconName func(uintptr, string) | |
| 143 | 181 | ||
| 144 | 182 | // Sets the icon name for @self. | |
| @@ -337,12 +375,16 @@ func init() { | |||
| 337 | 375 | core.PuregoSafeRegister(&xNewPreferencesPage, lib, "adw_preferences_page_new") | |
| 338 | 376 | ||
| 339 | 377 | core.PuregoSafeRegister(&xPreferencesPageAdd, lib, "adw_preferences_page_add") | |
| 378 | + | core.PuregoSafeRegister(&xPreferencesPageGetDescription, lib, "adw_preferences_page_get_description") | |
| 379 | + | core.PuregoSafeRegister(&xPreferencesPageGetDescriptionCentered, lib, "adw_preferences_page_get_description_centered") | |
| 340 | 380 | core.PuregoSafeRegister(&xPreferencesPageGetIconName, lib, "adw_preferences_page_get_icon_name") | |
| 341 | 381 | core.PuregoSafeRegister(&xPreferencesPageGetName, lib, "adw_preferences_page_get_name") | |
| 342 | 382 | core.PuregoSafeRegister(&xPreferencesPageGetTitle, lib, "adw_preferences_page_get_title") | |
| 343 | 383 | core.PuregoSafeRegister(&xPreferencesPageGetUseUnderline, lib, "adw_preferences_page_get_use_underline") | |
| 344 | 384 | core.PuregoSafeRegister(&xPreferencesPageRemove, lib, "adw_preferences_page_remove") | |
| 345 | 385 | core.PuregoSafeRegister(&xPreferencesPageScrollToTop, lib, "adw_preferences_page_scroll_to_top") | |
| 386 | + | core.PuregoSafeRegister(&xPreferencesPageSetDescription, lib, "adw_preferences_page_set_description") | |
| 387 | + | core.PuregoSafeRegister(&xPreferencesPageSetDescriptionCentered, lib, "adw_preferences_page_set_description_centered") | |
| 346 | 388 | core.PuregoSafeRegister(&xPreferencesPageSetIconName, lib, "adw_preferences_page_set_icon_name") | |
| 347 | 389 | core.PuregoSafeRegister(&xPreferencesPageSetName, lib, "adw_preferences_page_set_name") | |
| 348 | 390 | core.PuregoSafeRegister(&xPreferencesPageSetTitle, lib, "adw_preferences_page_set_title") | |
M v4/adw/adw-preferences-row.go +1 -1
| @@ -27,7 +27,7 @@ func (x *PreferencesRowClass) GoPointer() uintptr { | |||
| 27 | 27 | ||
| 28 | 28 | // A [class@Gtk.ListBoxRow] used to present preferences. | |
| 29 | 29 | // | |
| 30 | - | // The `AdwPreferencesRow` widget has a title that [class@PreferencesWindow] | |
| 30 | + | // The `AdwPreferencesRow` widget has a title that [class@PreferencesDialog] | |
| 31 | 31 | // will use to let the user look for a preference. It doesn't present the title | |
| 32 | 32 | // in any way and lets you present the preference as you please. | |
| 33 | 33 | // | |
M v4/adw/adw-preferences-window.go +25 -1
| @@ -150,6 +150,15 @@ func (x *PreferencesWindow) GetVisiblePageName() string { | |||
| 150 | 150 | return cret | |
| 151 | 151 | } | |
| 152 | 152 | ||
| 153 | + | var xPreferencesWindowPopSubpage func(uintptr) bool | |
| 154 | + | ||
| 155 | + | // Pop the visible page from the subpage stack of @self. | |
| 156 | + | func (x *PreferencesWindow) PopSubpage() bool { | |
| 157 | + | ||
| 158 | + | cret := xPreferencesWindowPopSubpage(x.GoPointer()) | |
| 159 | + | return cret | |
| 160 | + | } | |
| 161 | + | ||
| 153 | 162 | var xPreferencesWindowPresentSubpage func(uintptr, uintptr) | |
| 154 | 163 | ||
| 155 | 164 | // Sets @subpage as the window's subpage and opens it. | |
| @@ -162,6 +171,17 @@ func (x *PreferencesWindow) PresentSubpage(SubpageVar *gtk.Widget) { | |||
| 162 | 171 | ||
| 163 | 172 | } | |
| 164 | 173 | ||
| 174 | + | var xPreferencesWindowPushSubpage func(uintptr, uintptr) | |
| 175 | + | ||
| 176 | + | // Pushes @page onto the subpage stack of @self. | |
| 177 | + | // | |
| 178 | + | // The page will be automatically removed when popped. | |
| 179 | + | func (x *PreferencesWindow) PushSubpage(PageVar *NavigationPage) { | |
| 180 | + | ||
| 181 | + | xPreferencesWindowPushSubpage(x.GoPointer(), PageVar.GoPointer()) | |
| 182 | + | ||
| 183 | + | } | |
| 184 | + | ||
| 165 | 185 | var xPreferencesWindowRemove func(uintptr, uintptr) | |
| 166 | 186 | ||
| 167 | 187 | // Removes a page from @self. | |
| @@ -185,6 +205,8 @@ var xPreferencesWindowSetCanNavigateBack func(uintptr, bool) | |||
| 185 | 205 | // <kbd>Alt</kbd>+<kbd>←</kbd> shortcut. | |
| 186 | 206 | // | |
| 187 | 207 | // For right-to-left locales, gestures and shortcuts are reversed. | |
| 208 | + | // | |
| 209 | + | // Has no effect for subpages added with [method@PreferencesWindow.push_subpage]. | |
| 188 | 210 | func (x *PreferencesWindow) SetCanNavigateBack(CanNavigateBackVar bool) { | |
| 189 | 211 | ||
| 190 | 212 | xPreferencesWindowSetCanNavigateBack(x.GoPointer(), CanNavigateBackVar) | |
| @@ -213,7 +235,7 @@ var xPreferencesWindowSetVisiblePageName func(uintptr, string) | |||
| 213 | 235 | ||
| 214 | 236 | // Makes the page with the given name visible. | |
| 215 | 237 | // | |
| 216 | - | // See [property@ViewStack:visible-child]. | |
| 238 | + | // See [property@PreferencesWindow:visible-page]. | |
| 217 | 239 | func (x *PreferencesWindow) SetVisiblePageName(NameVar string) { | |
| 218 | 240 | ||
| 219 | 241 | xPreferencesWindowSetVisiblePageName(x.GoPointer(), NameVar) | |
| @@ -495,7 +517,9 @@ func init() { | |||
| 495 | 517 | core.PuregoSafeRegister(&xPreferencesWindowGetSearchEnabled, lib, "adw_preferences_window_get_search_enabled") | |
| 496 | 518 | core.PuregoSafeRegister(&xPreferencesWindowGetVisiblePage, lib, "adw_preferences_window_get_visible_page") | |
| 497 | 519 | core.PuregoSafeRegister(&xPreferencesWindowGetVisiblePageName, lib, "adw_preferences_window_get_visible_page_name") | |
| 520 | + | core.PuregoSafeRegister(&xPreferencesWindowPopSubpage, lib, "adw_preferences_window_pop_subpage") | |
| 498 | 521 | core.PuregoSafeRegister(&xPreferencesWindowPresentSubpage, lib, "adw_preferences_window_present_subpage") | |
| 522 | + | core.PuregoSafeRegister(&xPreferencesWindowPushSubpage, lib, "adw_preferences_window_push_subpage") | |
| 499 | 523 | core.PuregoSafeRegister(&xPreferencesWindowRemove, lib, "adw_preferences_window_remove") | |
| 500 | 524 | core.PuregoSafeRegister(&xPreferencesWindowSetCanNavigateBack, lib, "adw_preferences_window_set_can_navigate_back") | |
| 501 | 525 | core.PuregoSafeRegister(&xPreferencesWindowSetSearchEnabled, lib, "adw_preferences_window_set_search_enabled") | |
A v4/adw/adw-spin-row.go +891 -0
| @@ -0,0 +1,891 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 13 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 14 | + | ) | |
| 15 | + | ||
| 16 | + | type SpinRowClass struct { | |
| 17 | + | _ structs.HostLayout | |
| 18 | + | ||
| 19 | + | ParentClass uintptr | |
| 20 | + | } | |
| 21 | + | ||
| 22 | + | func (x *SpinRowClass) GoPointer() uintptr { | |
| 23 | + | return uintptr(unsafe.Pointer(x)) | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | // An [class@ActionRow] with an embedded spin button. | |
| 27 | + | // | |
| 28 | + | // <picture> | |
| 29 | + | // | |
| 30 | + | // <source srcset="spin-row-dark.png" media="(prefers-color-scheme: dark)"> | |
| 31 | + | // <img src="spin-row.png" alt="spin-row"> | |
| 32 | + | // | |
| 33 | + | // </picture> | |
| 34 | + | // | |
| 35 | + | // Example of an `AdwSpinRow` UI definition: | |
| 36 | + | // | |
| 37 | + | // ```xml | |
| 38 | + | // <object class="AdwSpinRow"> | |
| 39 | + | // | |
| 40 | + | // <property name="title" translatable="yes">Spin Row</property> | |
| 41 | + | // <property name="adjustment"> | |
| 42 | + | // <object class="GtkAdjustment"> | |
| 43 | + | // <property name="lower">0</property> | |
| 44 | + | // <property name="upper">100</property> | |
| 45 | + | // <property name="value">50</property> | |
| 46 | + | // <property name="page-increment">10</property> | |
| 47 | + | // <property name="step-increment">1</property> | |
| 48 | + | // </object> | |
| 49 | + | // </property> | |
| 50 | + | // | |
| 51 | + | // </object> | |
| 52 | + | // ``` | |
| 53 | + | // | |
| 54 | + | // See [class@Gtk.SpinButton] for details. | |
| 55 | + | // | |
| 56 | + | // ## CSS nodes | |
| 57 | + | // | |
| 58 | + | // `AdwSpinRow` has the same structure as [class@ActionRow], as well as the | |
| 59 | + | // `.spin` style class on the main node. | |
| 60 | + | // | |
| 61 | + | // ## Accessibility | |
| 62 | + | // | |
| 63 | + | // `AdwSpinRow` uses an internal `GtkSpinButton` with the | |
| 64 | + | // `GTK_ACCESSIBLE_ROLE_SPIN_BUTTON` role. | |
| 65 | + | type SpinRow struct { | |
| 66 | + | ActionRow | |
| 67 | + | } | |
| 68 | + | ||
| 69 | + | var xSpinRowGLibType func() types.GType | |
| 70 | + | ||
| 71 | + | func SpinRowGLibType() types.GType { | |
| 72 | + | return xSpinRowGLibType() | |
| 73 | + | } | |
| 74 | + | ||
| 75 | + | func SpinRowNewFromInternalPtr(ptr uintptr) *SpinRow { | |
| 76 | + | cls := &SpinRow{} | |
| 77 | + | cls.Ptr = ptr | |
| 78 | + | return cls | |
| 79 | + | } | |
| 80 | + | ||
| 81 | + | var xNewSpinRow func(uintptr, float64, uint) uintptr | |
| 82 | + | ||
| 83 | + | // Creates a new `AdwSpinRow`. | |
| 84 | + | func NewSpinRow(AdjustmentVar *gtk.Adjustment, ClimbRateVar float64, DigitsVar uint) *SpinRow { | |
| 85 | + | var cls *SpinRow | |
| 86 | + | ||
| 87 | + | cret := xNewSpinRow(AdjustmentVar.GoPointer(), ClimbRateVar, DigitsVar) | |
| 88 | + | ||
| 89 | + | if cret == 0 { | |
| 90 | + | return nil | |
| 91 | + | } | |
| 92 | + | gobject.IncreaseRef(cret) | |
| 93 | + | cls = &SpinRow{} | |
| 94 | + | cls.Ptr = cret | |
| 95 | + | return cls | |
| 96 | + | } | |
| 97 | + | ||
| 98 | + | var xNewSpinRowWithRange func(float64, float64, float64) uintptr | |
| 99 | + | ||
| 100 | + | // Creates a new `AdwSpinRow` with the given properties. | |
| 101 | + | // | |
| 102 | + | // This is a convenience constructor that allows creation of a numeric | |
| 103 | + | // `AdwSpinRow` without manually creating an adjustment. The value is initially | |
| 104 | + | // set to the minimum value and a page increment of 10 * @step is the default. | |
| 105 | + | // The precision of the spin row is equivalent to the precisions of @step. | |
| 106 | + | // | |
| 107 | + | // ::: note | |
| 108 | + | // | |
| 109 | + | // The way in which the precision is derived works best if @step is a power | |
| 110 | + | // of ten. If the resulting precision is not suitable for your needs, use | |
| 111 | + | // [method@SpinRow.set_digits] to correct it. | |
| 112 | + | func NewSpinRowWithRange(MinVar float64, MaxVar float64, StepVar float64) *SpinRow { | |
| 113 | + | var cls *SpinRow | |
| 114 | + | ||
| 115 | + | cret := xNewSpinRowWithRange(MinVar, MaxVar, StepVar) | |
| 116 | + | ||
| 117 | + | if cret == 0 { | |
| 118 | + | return nil | |
| 119 | + | } | |
| 120 | + | gobject.IncreaseRef(cret) | |
| 121 | + | cls = &SpinRow{} | |
| 122 | + | cls.Ptr = cret | |
| 123 | + | return cls | |
| 124 | + | } | |
| 125 | + | ||
| 126 | + | var xSpinRowConfigure func(uintptr, uintptr, float64, uint) | |
| 127 | + | ||
| 128 | + | // Changes the properties of an existing spin row. | |
| 129 | + | // | |
| 130 | + | // The adjustment, climb rate, and number of decimal places are updated | |
| 131 | + | // accordingly. | |
| 132 | + | func (x *SpinRow) Configure(AdjustmentVar *gtk.Adjustment, ClimbRateVar float64, DigitsVar uint) { | |
| 133 | + | ||
| 134 | + | xSpinRowConfigure(x.GoPointer(), AdjustmentVar.GoPointer(), ClimbRateVar, DigitsVar) | |
| 135 | + | ||
| 136 | + | } | |
| 137 | + | ||
| 138 | + | var xSpinRowGetAdjustment func(uintptr) uintptr | |
| 139 | + | ||
| 140 | + | // Gets the adjustment that holds the value for the spin row. | |
| 141 | + | func (x *SpinRow) GetAdjustment() *gtk.Adjustment { | |
| 142 | + | var cls *gtk.Adjustment | |
| 143 | + | ||
| 144 | + | cret := xSpinRowGetAdjustment(x.GoPointer()) | |
| 145 | + | ||
| 146 | + | if cret == 0 { | |
| 147 | + | return nil | |
| 148 | + | } | |
| 149 | + | gobject.IncreaseRef(cret) | |
| 150 | + | cls = >k.Adjustment{} | |
| 151 | + | cls.Ptr = cret | |
| 152 | + | return cls | |
| 153 | + | } | |
| 154 | + | ||
| 155 | + | var xSpinRowGetClimbRate func(uintptr) float64 | |
| 156 | + | ||
| 157 | + | // Gets the acceleration rate when you hold down a button or key. | |
| 158 | + | func (x *SpinRow) GetClimbRate() float64 { | |
| 159 | + | ||
| 160 | + | cret := xSpinRowGetClimbRate(x.GoPointer()) | |
| 161 | + | return cret | |
| 162 | + | } | |
| 163 | + | ||
| 164 | + | var xSpinRowGetDigits func(uintptr) uint | |
| 165 | + | ||
| 166 | + | // Gets the number of decimal places to display. | |
| 167 | + | func (x *SpinRow) GetDigits() uint { | |
| 168 | + | ||
| 169 | + | cret := xSpinRowGetDigits(x.GoPointer()) | |
| 170 | + | return cret | |
| 171 | + | } | |
| 172 | + | ||
| 173 | + | var xSpinRowGetNumeric func(uintptr) bool | |
| 174 | + | ||
| 175 | + | // Gets whether non-numeric characters should be ignored. | |
| 176 | + | func (x *SpinRow) GetNumeric() bool { | |
| 177 | + | ||
| 178 | + | cret := xSpinRowGetNumeric(x.GoPointer()) | |
| 179 | + | return cret | |
| 180 | + | } | |
| 181 | + | ||
| 182 | + | var xSpinRowGetSnapToTicks func(uintptr) bool | |
| 183 | + | ||
| 184 | + | // Gets whether invalid values are snapped to nearest step increment. | |
| 185 | + | func (x *SpinRow) GetSnapToTicks() bool { | |
| 186 | + | ||
| 187 | + | cret := xSpinRowGetSnapToTicks(x.GoPointer()) | |
| 188 | + | return cret | |
| 189 | + | } | |
| 190 | + | ||
| 191 | + | var xSpinRowGetUpdatePolicy func(uintptr) gtk.SpinButtonUpdatePolicy | |
| 192 | + | ||
| 193 | + | // Gets the policy for updating the spin row. | |
| 194 | + | func (x *SpinRow) GetUpdatePolicy() gtk.SpinButtonUpdatePolicy { | |
| 195 | + | ||
| 196 | + | cret := xSpinRowGetUpdatePolicy(x.GoPointer()) | |
| 197 | + | return cret | |
| 198 | + | } | |
| 199 | + | ||
| 200 | + | var xSpinRowGetValue func(uintptr) float64 | |
| 201 | + | ||
| 202 | + | // Gets the current value. | |
| 203 | + | func (x *SpinRow) GetValue() float64 { | |
| 204 | + | ||
| 205 | + | cret := xSpinRowGetValue(x.GoPointer()) | |
| 206 | + | return cret | |
| 207 | + | } | |
| 208 | + | ||
| 209 | + | var xSpinRowGetWrap func(uintptr) bool | |
| 210 | + | ||
| 211 | + | // Gets whether the spin row should wrap upon reaching its limits. | |
| 212 | + | func (x *SpinRow) GetWrap() bool { | |
| 213 | + | ||
| 214 | + | cret := xSpinRowGetWrap(x.GoPointer()) | |
| 215 | + | return cret | |
| 216 | + | } | |
| 217 | + | ||
| 218 | + | var xSpinRowSetAdjustment func(uintptr, uintptr) | |
| 219 | + | ||
| 220 | + | // Sets the adjustment that holds the value for the spin row. | |
| 221 | + | func (x *SpinRow) SetAdjustment(AdjustmentVar *gtk.Adjustment) { | |
| 222 | + | ||
| 223 | + | xSpinRowSetAdjustment(x.GoPointer(), AdjustmentVar.GoPointer()) | |
| 224 | + | ||
| 225 | + | } | |
| 226 | + | ||
| 227 | + | var xSpinRowSetClimbRate func(uintptr, float64) | |
| 228 | + | ||
| 229 | + | // Sets the acceleration rate when you hold down a button or key. | |
| 230 | + | func (x *SpinRow) SetClimbRate(ClimbRateVar float64) { | |
| 231 | + | ||
| 232 | + | xSpinRowSetClimbRate(x.GoPointer(), ClimbRateVar) | |
| 233 | + | ||
| 234 | + | } | |
| 235 | + | ||
| 236 | + | var xSpinRowSetDigits func(uintptr, uint) | |
| 237 | + | ||
| 238 | + | // Sets the number of decimal places to display. | |
| 239 | + | func (x *SpinRow) SetDigits(DigitsVar uint) { | |
| 240 | + | ||
| 241 | + | xSpinRowSetDigits(x.GoPointer(), DigitsVar) | |
| 242 | + | ||
| 243 | + | } | |
| 244 | + | ||
| 245 | + | var xSpinRowSetNumeric func(uintptr, bool) | |
| 246 | + | ||
| 247 | + | // Sets whether non-numeric characters should be ignored. | |
| 248 | + | func (x *SpinRow) SetNumeric(NumericVar bool) { | |
| 249 | + | ||
| 250 | + | xSpinRowSetNumeric(x.GoPointer(), NumericVar) | |
| 251 | + | ||
| 252 | + | } | |
| 253 | + | ||
| 254 | + | var xSpinRowSetRange func(uintptr, float64, float64) | |
| 255 | + | ||
| 256 | + | // Sets the minimum and maximum allowable values for @self. | |
| 257 | + | // | |
| 258 | + | // If the current value is outside this range, it will be adjusted | |
| 259 | + | // to fit within the range, otherwise it will remain unchanged. | |
| 260 | + | func (x *SpinRow) SetRange(MinVar float64, MaxVar float64) { | |
| 261 | + | ||
| 262 | + | xSpinRowSetRange(x.GoPointer(), MinVar, MaxVar) | |
| 263 | + | ||
| 264 | + | } | |
| 265 | + | ||
| 266 | + | var xSpinRowSetSnapToTicks func(uintptr, bool) | |
| 267 | + | ||
| 268 | + | // Sets whether invalid values are snapped to the nearest step increment. | |
| 269 | + | func (x *SpinRow) SetSnapToTicks(SnapToTicksVar bool) { | |
| 270 | + | ||
| 271 | + | xSpinRowSetSnapToTicks(x.GoPointer(), SnapToTicksVar) | |
| 272 | + | ||
| 273 | + | } | |
| 274 | + | ||
| 275 | + | var xSpinRowSetUpdatePolicy func(uintptr, gtk.SpinButtonUpdatePolicy) | |
| 276 | + | ||
| 277 | + | // Sets the policy for updating the spin row. | |
| 278 | + | // | |
| 279 | + | // The options are always, or only when the value is invalid. | |
| 280 | + | func (x *SpinRow) SetUpdatePolicy(PolicyVar gtk.SpinButtonUpdatePolicy) { | |
| 281 | + | ||
| 282 | + | xSpinRowSetUpdatePolicy(x.GoPointer(), PolicyVar) | |
| 283 | + | ||
| 284 | + | } | |
| 285 | + | ||
| 286 | + | var xSpinRowSetValue func(uintptr, float64) | |
| 287 | + | ||
| 288 | + | // Sets the current value. | |
| 289 | + | func (x *SpinRow) SetValue(ValueVar float64) { | |
| 290 | + | ||
| 291 | + | xSpinRowSetValue(x.GoPointer(), ValueVar) | |
| 292 | + | ||
| 293 | + | } | |
| 294 | + | ||
| 295 | + | var xSpinRowSetWrap func(uintptr, bool) | |
| 296 | + | ||
| 297 | + | // Sets whether the spin row should wrap upon reaching its limits. | |
| 298 | + | func (x *SpinRow) SetWrap(WrapVar bool) { | |
| 299 | + | ||
| 300 | + | xSpinRowSetWrap(x.GoPointer(), WrapVar) | |
| 301 | + | ||
| 302 | + | } | |
| 303 | + | ||
| 304 | + | var xSpinRowUpdate func(uintptr) | |
| 305 | + | ||
| 306 | + | // Manually force an update of the spin row. | |
| 307 | + | func (x *SpinRow) Update() { | |
| 308 | + | ||
| 309 | + | xSpinRowUpdate(x.GoPointer()) | |
| 310 | + | ||
| 311 | + | } | |
| 312 | + | ||
| 313 | + | func (c *SpinRow) GoPointer() uintptr { | |
| 314 | + | return c.Ptr | |
| 315 | + | } | |
| 316 | + | ||
| 317 | + | func (c *SpinRow) SetGoPointer(ptr uintptr) { | |
| 318 | + | c.Ptr = ptr | |
| 319 | + | } | |
| 320 | + | ||
| 321 | + | // Emitted to convert the user's input into a double value. | |
| 322 | + | // | |
| 323 | + | // The signal handler is expected to use [method@Gtk.Editable.get_text] to | |
| 324 | + | // retrieve the text of the spinbutton and set new_value to the new value. | |
| 325 | + | // | |
| 326 | + | // The default conversion uses [func@GLib.strtod]. | |
| 327 | + | // | |
| 328 | + | // See [signal@Gtk.SpinButton::input]. | |
| 329 | + | func (x *SpinRow) ConnectInput(cb *func(SpinRow, float64) int) uint32 { | |
| 330 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 331 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 332 | + | return gobject.SignalConnect(x.GoPointer(), "input", cbRefPtr) | |
| 333 | + | } | |
| 334 | + | ||
| 335 | + | fcb := func(clsPtr uintptr, NewValueVarp float64) int { | |
| 336 | + | fa := SpinRow{} | |
| 337 | + | fa.Ptr = clsPtr | |
| 338 | + | cbFn := *cb | |
| 339 | + | ||
| 340 | + | return cbFn(fa, NewValueVarp) | |
| 341 | + | ||
| 342 | + | } | |
| 343 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 344 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 345 | + | return gobject.SignalConnect(x.GoPointer(), "input", cbRefPtr) | |
| 346 | + | } | |
| 347 | + | ||
| 348 | + | // Emitted to tweak the formatting of the value for display. | |
| 349 | + | // | |
| 350 | + | // See [signal@Gtk.SpinButton::output]. | |
| 351 | + | func (x *SpinRow) ConnectOutput(cb *func(SpinRow) bool) uint32 { | |
| 352 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 353 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 354 | + | return gobject.SignalConnect(x.GoPointer(), "output", cbRefPtr) | |
| 355 | + | } | |
| 356 | + | ||
| 357 | + | fcb := func(clsPtr uintptr) bool { | |
| 358 | + | fa := SpinRow{} | |
| 359 | + | fa.Ptr = clsPtr | |
| 360 | + | cbFn := *cb | |
| 361 | + | ||
| 362 | + | return cbFn(fa) | |
| 363 | + | ||
| 364 | + | } | |
| 365 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 366 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 367 | + | return gobject.SignalConnect(x.GoPointer(), "output", cbRefPtr) | |
| 368 | + | } | |
| 369 | + | ||
| 370 | + | // Emitted right after the spinbutton wraps. | |
| 371 | + | // | |
| 372 | + | // See [signal@Gtk.SpinButton::wrapped]. | |
| 373 | + | func (x *SpinRow) ConnectWrapped(cb *func(SpinRow)) uint32 { | |
| 374 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 375 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
| 376 | + | return gobject.SignalConnect(x.GoPointer(), "wrapped", cbRefPtr) | |
| 377 | + | } | |
| 378 | + | ||
| 379 | + | fcb := func(clsPtr uintptr) { | |
| 380 | + | fa := SpinRow{} | |
| 381 | + | fa.Ptr = clsPtr | |
| 382 | + | cbFn := *cb | |
| 383 | + | ||
| 384 | + | cbFn(fa) | |
| 385 | + | ||
| 386 | + | } | |
| 387 | + | cbRefPtr := purego.NewCallback(fcb) | |
| 388 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |
| 389 | + | return gobject.SignalConnect(x.GoPointer(), "wrapped", cbRefPtr) | |
| 390 | + | } | |
| 391 | + | ||
| 392 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 393 | + | func (x *SpinRow) GetAccessibleRole() gtk.AccessibleRole { | |
| 394 | + | ||
| 395 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 396 | + | return cret | |
| 397 | + | } | |
| 398 | + | ||
| 399 | + | // Resets the accessible @property to its default value. | |
| 400 | + | func (x *SpinRow) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 401 | + | ||
| 402 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 403 | + | ||
| 404 | + | } | |
| 405 | + | ||
| 406 | + | // Resets the accessible @relation to its default value. | |
| 407 | + | func (x *SpinRow) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 408 | + | ||
| 409 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 410 | + | ||
| 411 | + | } | |
| 412 | + | ||
| 413 | + | // Resets the accessible @state to its default value. | |
| 414 | + | func (x *SpinRow) ResetState(StateVar gtk.AccessibleState) { | |
| 415 | + | ||
| 416 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 417 | + | ||
| 418 | + | } | |
| 419 | + | ||
| 420 | + | // Updates a list of accessible properties. | |
| 421 | + | // | |
| 422 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 423 | + | // value types of accessible properties. | |
| 424 | + | // | |
| 425 | + | // This function should be called by `GtkWidget` types whenever | |
| 426 | + | // an accessible property change must be communicated to assistive | |
| 427 | + | // technologies. | |
| 428 | + | // | |
| 429 | + | // Example: | |
| 430 | + | // ```c | |
| 431 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 432 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 433 | + | // | |
| 434 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 435 | + | // -1); | |
| 436 | + | // | |
| 437 | + | // ``` | |
| 438 | + | func (x *SpinRow) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 439 | + | ||
| 440 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 441 | + | ||
| 442 | + | } | |
| 443 | + | ||
| 444 | + | // Updates an array of accessible properties. | |
| 445 | + | // | |
| 446 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 447 | + | // property change must be communicated to assistive technologies. | |
| 448 | + | // | |
| 449 | + | // This function is meant to be used by language bindings. | |
| 450 | + | func (x *SpinRow) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 451 | + | ||
| 452 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 453 | + | ||
| 454 | + | } | |
| 455 | + | ||
| 456 | + | // Updates a list of accessible relations. | |
| 457 | + | // | |
| 458 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 459 | + | // relation change must be communicated to assistive technologies. | |
| 460 | + | // | |
| 461 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 462 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 463 | + | // | |
| 464 | + | // ```c | |
| 465 | + | // gtk_accessible_update_relation (accessible, | |
| 466 | + | // | |
| 467 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 468 | + | // ref1, NULL, | |
| 469 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 470 | + | // ref1, ref2, ref3, NULL, | |
| 471 | + | // -1); | |
| 472 | + | // | |
| 473 | + | // ``` | |
| 474 | + | func (x *SpinRow) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 475 | + | ||
| 476 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 477 | + | ||
| 478 | + | } | |
| 479 | + | ||
| 480 | + | // Updates an array of accessible relations. | |
| 481 | + | // | |
| 482 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 483 | + | // relation change must be communicated to assistive technologies. | |
| 484 | + | // | |
| 485 | + | // This function is meant to be used by language bindings. | |
| 486 | + | func (x *SpinRow) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 487 | + | ||
| 488 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 489 | + | ||
| 490 | + | } | |
| 491 | + | ||
| 492 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 493 | + | // documentation for the value types of accessible states. | |
| 494 | + | // | |
| 495 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 496 | + | // state change must be communicated to assistive technologies. | |
| 497 | + | // | |
| 498 | + | // Example: | |
| 499 | + | // ```c | |
| 500 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 501 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 502 | + | // | |
| 503 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 504 | + | // -1); | |
| 505 | + | // | |
| 506 | + | // ``` | |
| 507 | + | func (x *SpinRow) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 508 | + | ||
| 509 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 510 | + | ||
| 511 | + | } | |
| 512 | + | ||
| 513 | + | // Updates an array of accessible states. | |
| 514 | + | // | |
| 515 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 516 | + | // state change must be communicated to assistive technologies. | |
| 517 | + | // | |
| 518 | + | // This function is meant to be used by language bindings. | |
| 519 | + | func (x *SpinRow) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 520 | + | ||
| 521 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 522 | + | ||
| 523 | + | } | |
| 524 | + | ||
| 525 | + | // Gets the action name for @actionable. | |
| 526 | + | func (x *SpinRow) GetActionName() string { | |
| 527 | + | ||
| 528 | + | cret := gtk.XGtkActionableGetActionName(x.GoPointer()) | |
| 529 | + | return cret | |
| 530 | + | } | |
| 531 | + | ||
| 532 | + | // Gets the current target value of @actionable. | |
| 533 | + | func (x *SpinRow) GetActionTargetValue() *glib.Variant { | |
| 534 | + | ||
| 535 | + | cret := gtk.XGtkActionableGetActionTargetValue(x.GoPointer()) | |
| 536 | + | return cret | |
| 537 | + | } | |
| 538 | + | ||
| 539 | + | // Specifies the name of the action with which this widget should be | |
| 540 | + | // associated. | |
| 541 | + | // | |
| 542 | + | // If @action_name is %NULL then the widget will be unassociated from | |
| 543 | + | // any previous action. | |
| 544 | + | // | |
| 545 | + | // Usually this function is used when the widget is located (or will be | |
| 546 | + | // located) within the hierarchy of a `GtkApplicationWindow`. | |
| 547 | + | // | |
| 548 | + | // Names are of the form “win.save” or “app.quit” for actions on the | |
| 549 | + | // containing [class@ApplicationWindow] or its associated [class@Application], | |
| 550 | + | // respectively. This is the same form used for actions in the [class@Gio.Menu] | |
| 551 | + | // associated with the window. | |
| 552 | + | func (x *SpinRow) SetActionName(ActionNameVar string) { | |
| 553 | + | ||
| 554 | + | gtk.XGtkActionableSetActionName(x.GoPointer(), ActionNameVar) | |
| 555 | + | ||
| 556 | + | } | |
| 557 | + | ||
| 558 | + | // Sets the target of an actionable widget. | |
| 559 | + | // | |
| 560 | + | // This is a convenience function that calls [ctor@GLib.Variant.new] for | |
| 561 | + | // @format_string and uses the result to call | |
| 562 | + | // [method@Gtk.Actionable.set_action_target_value]. | |
| 563 | + | // | |
| 564 | + | // If you are setting a string-valued target and want to set | |
| 565 | + | // the action name at the same time, you can use | |
| 566 | + | // [method@Gtk.Actionable.set_detailed_action_name]. | |
| 567 | + | func (x *SpinRow) SetActionTarget(FormatStringVar string, varArgs ...interface{}) { | |
| 568 | + | ||
| 569 | + | gtk.XGtkActionableSetActionTarget(x.GoPointer(), FormatStringVar, varArgs...) | |
| 570 | + | ||
| 571 | + | } | |
| 572 | + | ||
| 573 | + | // Sets the target value of an actionable widget. | |
| 574 | + | // | |
| 575 | + | // If @target_value is %NULL then the target value is unset. | |
| 576 | + | // | |
| 577 | + | // The target value has two purposes. First, it is used as the parameter | |
| 578 | + | // to activation of the action associated with the `GtkActionable` widget. | |
| 579 | + | // Second, it is used to determine if the widget should be rendered as | |
| 580 | + | // “active” — the widget is active if the state is equal to the given target. | |
| 581 | + | // | |
| 582 | + | // Consider the example of associating a set of buttons with a [iface@Gio.Action] | |
| 583 | + | // with string state in a typical “radio button” situation. Each button | |
| 584 | + | // will be associated with the same action, but with a different target | |
| 585 | + | // value for that action. Clicking on a particular button will activate | |
| 586 | + | // the action with the target of that button, which will typically cause | |
| 587 | + | // the action’s state to change to that value. Since the action’s state | |
| 588 | + | // is now equal to the target value of the button, the button will now | |
| 589 | + | // be rendered as active (and the other buttons, with different targets, | |
| 590 | + | // rendered inactive). | |
| 591 | + | func (x *SpinRow) SetActionTargetValue(TargetValueVar *glib.Variant) { | |
| 592 | + | ||
| 593 | + | gtk.XGtkActionableSetActionTargetValue(x.GoPointer(), TargetValueVar) | |
| 594 | + | ||
| 595 | + | } | |
| 596 | + | ||
| 597 | + | // Sets the action-name and associated string target value of an | |
| 598 | + | // actionable widget. | |
| 599 | + | // | |
| 600 | + | // @detailed_action_name is a string in the format accepted by | |
| 601 | + | // [func@Gio.Action.parse_detailed_name]. | |
| 602 | + | func (x *SpinRow) SetDetailedActionName(DetailedActionNameVar string) { | |
| 603 | + | ||
| 604 | + | gtk.XGtkActionableSetDetailedActionName(x.GoPointer(), DetailedActionNameVar) | |
| 605 | + | ||
| 606 | + | } | |
| 607 | + | ||
| 608 | + | // Gets the ID of the @buildable object. | |
| 609 | + | // | |
| 610 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 611 | + | // of the <object> tag used to construct the @buildable. | |
| 612 | + | func (x *SpinRow) GetBuildableId() string { | |
| 613 | + | ||
| 614 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 615 | + | return cret | |
| 616 | + | } | |
| 617 | + | ||
| 618 | + | // Deletes the currently selected text of the editable. | |
| 619 | + | // | |
| 620 | + | // This call doesn’t do anything if there is no selected text. | |
| 621 | + | func (x *SpinRow) DeleteSelection() { | |
| 622 | + | ||
| 623 | + | gtk.XGtkEditableDeleteSelection(x.GoPointer()) | |
| 624 | + | ||
| 625 | + | } | |
| 626 | + | ||
| 627 | + | // Deletes a sequence of characters. | |
| 628 | + | // | |
| 629 | + | // The characters that are deleted are those characters at positions | |
| 630 | + | // from @start_pos up to, but not including @end_pos. If @end_pos is | |
| 631 | + | // negative, then the characters deleted are those from @start_pos to | |
| 632 | + | // the end of the text. | |
| 633 | + | // | |
| 634 | + | // Note that the positions are specified in characters, not bytes. | |
| 635 | + | func (x *SpinRow) DeleteText(StartPosVar int, EndPosVar int) { | |
| 636 | + | ||
| 637 | + | gtk.XGtkEditableDeleteText(x.GoPointer(), StartPosVar, EndPosVar) | |
| 638 | + | ||
| 639 | + | } | |
| 640 | + | ||
| 641 | + | // Undoes the setup done by [method@Gtk.Editable.init_delegate]. | |
| 642 | + | // | |
| 643 | + | // This is a helper function that should be called from dispose, | |
| 644 | + | // before removing the delegate object. | |
| 645 | + | func (x *SpinRow) FinishDelegate() { | |
| 646 | + | ||
| 647 | + | gtk.XGtkEditableFinishDelegate(x.GoPointer()) | |
| 648 | + | ||
| 649 | + | } | |
| 650 | + | ||
| 651 | + | // Gets the alignment of the editable. | |
| 652 | + | func (x *SpinRow) GetAlignment() float32 { | |
| 653 | + | ||
| 654 | + | cret := gtk.XGtkEditableGetAlignment(x.GoPointer()) | |
| 655 | + | return cret | |
| 656 | + | } | |
| 657 | + | ||
| 658 | + | // Retrieves a sequence of characters. | |
| 659 | + | // | |
| 660 | + | // The characters that are retrieved are those characters at positions | |
| 661 | + | // from @start_pos up to, but not including @end_pos. If @end_pos is negative, | |
| 662 | + | // then the characters retrieved are those characters from @start_pos to | |
| 663 | + | // the end of the text. | |
| 664 | + | // | |
| 665 | + | // Note that positions are specified in characters, not bytes. | |
| 666 | + | func (x *SpinRow) GetChars(StartPosVar int, EndPosVar int) string { | |
| 667 | + | ||
| 668 | + | cret := gtk.XGtkEditableGetChars(x.GoPointer(), StartPosVar, EndPosVar) | |
| 669 | + | return cret | |
| 670 | + | } | |
| 671 | + | ||
| 672 | + | // Gets the `GtkEditable` that @editable is delegating its | |
| 673 | + | // implementation to. | |
| 674 | + | // | |
| 675 | + | // Typically, the delegate is a [class@Gtk.Text] widget. | |
| 676 | + | func (x *SpinRow) GetDelegate() *gtk.EditableBase { | |
| 677 | + | var cls *gtk.EditableBase | |
| 678 | + | ||
| 679 | + | cret := gtk.XGtkEditableGetDelegate(x.GoPointer()) | |
| 680 | + | ||
| 681 | + | if cret == 0 { | |
| 682 | + | return nil | |
| 683 | + | } | |
| 684 | + | gobject.IncreaseRef(cret) | |
| 685 | + | cls = >k.EditableBase{} | |
| 686 | + | cls.Ptr = cret | |
| 687 | + | return cls | |
| 688 | + | } | |
| 689 | + | ||
| 690 | + | // Retrieves whether @editable is editable. | |
| 691 | + | func (x *SpinRow) GetEditable() bool { | |
| 692 | + | ||
| 693 | + | cret := gtk.XGtkEditableGetEditable(x.GoPointer()) | |
| 694 | + | return cret | |
| 695 | + | } | |
| 696 | + | ||
| 697 | + | // Gets if undo/redo actions are enabled for @editable | |
| 698 | + | func (x *SpinRow) GetEnableUndo() bool { | |
| 699 | + | ||
| 700 | + | cret := gtk.XGtkEditableGetEnableUndo(x.GoPointer()) | |
| 701 | + | return cret | |
| 702 | + | } | |
| 703 | + | ||
| 704 | + | // Retrieves the desired maximum width of @editable, in characters. | |
| 705 | + | func (x *SpinRow) GetMaxWidthChars() int { | |
| 706 | + | ||
| 707 | + | cret := gtk.XGtkEditableGetMaxWidthChars(x.GoPointer()) | |
| 708 | + | return cret | |
| 709 | + | } | |
| 710 | + | ||
| 711 | + | // Retrieves the current position of the cursor relative | |
| 712 | + | // to the start of the content of the editable. | |
| 713 | + | // | |
| 714 | + | // Note that this position is in characters, not in bytes. | |
| 715 | + | func (x *SpinRow) GetPosition() int { | |
| 716 | + | ||
| 717 | + | cret := gtk.XGtkEditableGetPosition(x.GoPointer()) | |
| 718 | + | return cret | |
| 719 | + | } | |
| 720 | + | ||
| 721 | + | // Retrieves the selection bound of the editable. | |
| 722 | + | // | |
| 723 | + | // @start_pos will be filled with the start of the selection and | |
| 724 | + | // @end_pos with end. If no text was selected both will be identical | |
| 725 | + | // and %FALSE will be returned. | |
| 726 | + | // | |
| 727 | + | // Note that positions are specified in characters, not bytes. | |
| 728 | + | func (x *SpinRow) GetSelectionBounds(StartPosVar int, EndPosVar int) bool { | |
| 729 | + | ||
| 730 | + | cret := gtk.XGtkEditableGetSelectionBounds(x.GoPointer(), StartPosVar, EndPosVar) | |
| 731 | + | return cret | |
| 732 | + | } | |
| 733 | + | ||
| 734 | + | // Retrieves the contents of @editable. | |
| 735 | + | // | |
| 736 | + | // The returned string is owned by GTK and must not be modified or freed. | |
| 737 | + | func (x *SpinRow) GetText() string { | |
| 738 | + | ||
| 739 | + | cret := gtk.XGtkEditableGetText(x.GoPointer()) | |
| 740 | + | return cret | |
| 741 | + | } | |
| 742 | + | ||
| 743 | + | // Gets the number of characters of space reserved | |
| 744 | + | // for the contents of the editable. | |
| 745 | + | func (x *SpinRow) GetWidthChars() int { | |
| 746 | + | ||
| 747 | + | cret := gtk.XGtkEditableGetWidthChars(x.GoPointer()) | |
| 748 | + | return cret | |
| 749 | + | } | |
| 750 | + | ||
| 751 | + | // Sets up a delegate for `GtkEditable`. | |
| 752 | + | // | |
| 753 | + | // This is assuming that the get_delegate vfunc in the `GtkEditable` | |
| 754 | + | // interface has been set up for the @editable's type. | |
| 755 | + | // | |
| 756 | + | // This is a helper function that should be called in instance init, | |
| 757 | + | // after creating the delegate object. | |
| 758 | + | func (x *SpinRow) InitDelegate() { | |
| 759 | + | ||
| 760 | + | gtk.XGtkEditableInitDelegate(x.GoPointer()) | |
| 761 | + | ||
| 762 | + | } | |
| 763 | + | ||
| 764 | + | // Inserts @length bytes of @text into the contents of the | |
| 765 | + | // widget, at position @position. | |
| 766 | + | // | |
| 767 | + | // Note that the position is in characters, not in bytes. | |
| 768 | + | // The function updates @position to point after the newly | |
| 769 | + | // inserted text. | |
| 770 | + | func (x *SpinRow) InsertText(TextVar string, LengthVar int, PositionVar int) { | |
| 771 | + | ||
| 772 | + | gtk.XGtkEditableInsertText(x.GoPointer(), TextVar, LengthVar, PositionVar) | |
| 773 | + | ||
| 774 | + | } | |
| 775 | + | ||
| 776 | + | // Selects a region of text. | |
| 777 | + | // | |
| 778 | + | // The characters that are selected are those characters at positions | |
| 779 | + | // from @start_pos up to, but not including @end_pos. If @end_pos is | |
| 780 | + | // negative, then the characters selected are those characters from | |
| 781 | + | // @start_pos to the end of the text. | |
| 782 | + | // | |
| 783 | + | // Note that positions are specified in characters, not bytes. | |
| 784 | + | func (x *SpinRow) SelectRegion(StartPosVar int, EndPosVar int) { | |
| 785 | + | ||
| 786 | + | gtk.XGtkEditableSelectRegion(x.GoPointer(), StartPosVar, EndPosVar) | |
| 787 | + | ||
| 788 | + | } | |
| 789 | + | ||
| 790 | + | // Sets the alignment for the contents of the editable. | |
| 791 | + | // | |
| 792 | + | // This controls the horizontal positioning of the contents when | |
| 793 | + | // the displayed text is shorter than the width of the editable. | |
| 794 | + | func (x *SpinRow) SetAlignment(XalignVar float32) { | |
| 795 | + | ||
| 796 | + | gtk.XGtkEditableSetAlignment(x.GoPointer(), XalignVar) | |
| 797 | + | ||
| 798 | + | } | |
| 799 | + | ||
| 800 | + | // Determines if the user can edit the text in the editable widget. | |
| 801 | + | func (x *SpinRow) SetEditable(IsEditableVar bool) { | |
| 802 | + | ||
| 803 | + | gtk.XGtkEditableSetEditable(x.GoPointer(), IsEditableVar) | |
| 804 | + | ||
| 805 | + | } | |
| 806 | + | ||
| 807 | + | // If enabled, changes to @editable will be saved for undo/redo | |
| 808 | + | // actions. | |
| 809 | + | // | |
| 810 | + | // This results in an additional copy of text changes and are not | |
| 811 | + | // stored in secure memory. As such, undo is forcefully disabled | |
| 812 | + | // when [property@Gtk.Text:visibility] is set to %FALSE. | |
| 813 | + | func (x *SpinRow) SetEnableUndo(EnableUndoVar bool) { | |
| 814 | + | ||
| 815 | + | gtk.XGtkEditableSetEnableUndo(x.GoPointer(), EnableUndoVar) | |
| 816 | + | ||
| 817 | + | } | |
| 818 | + | ||
| 819 | + | // Sets the desired maximum width in characters of @editable. | |
| 820 | + | func (x *SpinRow) SetMaxWidthChars(NCharsVar int) { | |
| 821 | + | ||
| 822 | + | gtk.XGtkEditableSetMaxWidthChars(x.GoPointer(), NCharsVar) | |
| 823 | + | ||
| 824 | + | } | |
| 825 | + | ||
| 826 | + | // Sets the cursor position in the editable to the given value. | |
| 827 | + | // | |
| 828 | + | // The cursor is displayed before the character with the given (base 0) | |
| 829 | + | // index in the contents of the editable. The value must be less than | |
| 830 | + | // or equal to the number of characters in the editable. A value of -1 | |
| 831 | + | // indicates that the position should be set after the last character | |
| 832 | + | // of the editable. Note that @position is in characters, not in bytes. | |
| 833 | + | func (x *SpinRow) SetPosition(PositionVar int) { | |
| 834 | + | ||
| 835 | + | gtk.XGtkEditableSetPosition(x.GoPointer(), PositionVar) | |
| 836 | + | ||
| 837 | + | } | |
| 838 | + | ||
| 839 | + | // Sets the text in the editable to the given value. | |
| 840 | + | // | |
| 841 | + | // This is replacing the current contents. | |
| 842 | + | func (x *SpinRow) SetText(TextVar string) { | |
| 843 | + | ||
| 844 | + | gtk.XGtkEditableSetText(x.GoPointer(), TextVar) | |
| 845 | + | ||
| 846 | + | } | |
| 847 | + | ||
| 848 | + | // Changes the size request of the editable to be about the | |
| 849 | + | // right size for @n_chars characters. | |
| 850 | + | // | |
| 851 | + | // Note that it changes the size request, the size can still | |
| 852 | + | // be affected by how you pack the widget into containers. | |
| 853 | + | // If @n_chars is -1, the size reverts to the default size. | |
| 854 | + | func (x *SpinRow) SetWidthChars(NCharsVar int) { | |
| 855 | + | ||
| 856 | + | gtk.XGtkEditableSetWidthChars(x.GoPointer(), NCharsVar) | |
| 857 | + | ||
| 858 | + | } | |
| 859 | + | ||
| 860 | + | func init() { | |
| 861 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 862 | + | if err != nil { | |
| 863 | + | panic(err) | |
| 864 | + | } | |
| 865 | + | ||
| 866 | + | core.PuregoSafeRegister(&xSpinRowGLibType, lib, "adw_spin_row_get_type") | |
| 867 | + | ||
| 868 | + | core.PuregoSafeRegister(&xNewSpinRow, lib, "adw_spin_row_new") | |
| 869 | + | core.PuregoSafeRegister(&xNewSpinRowWithRange, lib, "adw_spin_row_new_with_range") | |
| 870 | + | ||
| 871 | + | core.PuregoSafeRegister(&xSpinRowConfigure, lib, "adw_spin_row_configure") | |
| 872 | + | core.PuregoSafeRegister(&xSpinRowGetAdjustment, lib, "adw_spin_row_get_adjustment") | |
| 873 | + | core.PuregoSafeRegister(&xSpinRowGetClimbRate, lib, "adw_spin_row_get_climb_rate") | |
| 874 | + | core.PuregoSafeRegister(&xSpinRowGetDigits, lib, "adw_spin_row_get_digits") | |
| 875 | + | core.PuregoSafeRegister(&xSpinRowGetNumeric, lib, "adw_spin_row_get_numeric") | |
| 876 | + | core.PuregoSafeRegister(&xSpinRowGetSnapToTicks, lib, "adw_spin_row_get_snap_to_ticks") | |
| 877 | + | core.PuregoSafeRegister(&xSpinRowGetUpdatePolicy, lib, "adw_spin_row_get_update_policy") | |
| 878 | + | core.PuregoSafeRegister(&xSpinRowGetValue, lib, "adw_spin_row_get_value") | |
| 879 | + | core.PuregoSafeRegister(&xSpinRowGetWrap, lib, "adw_spin_row_get_wrap") | |
| 880 | + | core.PuregoSafeRegister(&xSpinRowSetAdjustment, lib, "adw_spin_row_set_adjustment") | |
| 881 | + | core.PuregoSafeRegister(&xSpinRowSetClimbRate, lib, "adw_spin_row_set_climb_rate") | |
| 882 | + | core.PuregoSafeRegister(&xSpinRowSetDigits, lib, "adw_spin_row_set_digits") | |
| 883 | + | core.PuregoSafeRegister(&xSpinRowSetNumeric, lib, "adw_spin_row_set_numeric") | |
| 884 | + | core.PuregoSafeRegister(&xSpinRowSetRange, lib, "adw_spin_row_set_range") | |
| 885 | + | core.PuregoSafeRegister(&xSpinRowSetSnapToTicks, lib, "adw_spin_row_set_snap_to_ticks") | |
| 886 | + | core.PuregoSafeRegister(&xSpinRowSetUpdatePolicy, lib, "adw_spin_row_set_update_policy") | |
| 887 | + | core.PuregoSafeRegister(&xSpinRowSetValue, lib, "adw_spin_row_set_value") | |
| 888 | + | core.PuregoSafeRegister(&xSpinRowSetWrap, lib, "adw_spin_row_set_wrap") | |
| 889 | + | core.PuregoSafeRegister(&xSpinRowUpdate, lib, "adw_spin_row_update") | |
| 890 | + | ||
| 891 | + | } | |
A v4/adw/adw-spinner-paintable.go +292 -0
| @@ -0,0 +1,292 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gdk" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 13 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 14 | + | ) | |
| 15 | + | ||
| 16 | + | type SpinnerPaintableClass struct { | |
| 17 | + | _ structs.HostLayout | |
| 18 | + | ||
| 19 | + | ParentClass uintptr | |
| 20 | + | } | |
| 21 | + | ||
| 22 | + | func (x *SpinnerPaintableClass) GoPointer() uintptr { | |
| 23 | + | return uintptr(unsafe.Pointer(x)) | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | // A paintable showing a loading spinner. | |
| 27 | + | // | |
| 28 | + | // <picture> | |
| 29 | + | // | |
| 30 | + | // <source srcset="spinner-dark.png" media="(prefers-color-scheme: dark)"> | |
| 31 | + | // <img src="spinner.png" alt="spinner"> | |
| 32 | + | // | |
| 33 | + | // </picture> | |
| 34 | + | // | |
| 35 | + | // `AdwSpinnerPaintable` size varies depending on the available space, but is | |
| 36 | + | // capped at 64×64 pixels. | |
| 37 | + | // | |
| 38 | + | // To be able to animate, `AdwSpinnerPaintable` needs a widget. It will be | |
| 39 | + | // animated according to that widget's frame clock, and only if that widget is | |
| 40 | + | // mapped. Ideally it should be the same widget the paintable is displayed in, | |
| 41 | + | // but that's not a requirement. | |
| 42 | + | // | |
| 43 | + | // Most applications should be using [class@Spinner] instead. | |
| 44 | + | // `AdwSpinnerPaintable` is provided for the cases where using a widget is | |
| 45 | + | // impractical or impossible, such as [property@StatusPage:paintable]: | |
| 46 | + | // | |
| 47 | + | // ```xml | |
| 48 | + | // <object class="AdwStatusPage" id="status_page"> | |
| 49 | + | // | |
| 50 | + | // <property name="paintable"> | |
| 51 | + | // <object class="AdwSpinnerPaintable"> | |
| 52 | + | // <property name="widget">status_page</property> | |
| 53 | + | // </object> | |
| 54 | + | // </property> | |
| 55 | + | // <!-- ... --> | |
| 56 | + | // | |
| 57 | + | // </object> | |
| 58 | + | // ``` | |
| 59 | + | type SpinnerPaintable struct { | |
| 60 | + | gobject.Object | |
| 61 | + | } | |
| 62 | + | ||
| 63 | + | var xSpinnerPaintableGLibType func() types.GType | |
| 64 | + | ||
| 65 | + | func SpinnerPaintableGLibType() types.GType { | |
| 66 | + | return xSpinnerPaintableGLibType() | |
| 67 | + | } | |
| 68 | + | ||
| 69 | + | func SpinnerPaintableNewFromInternalPtr(ptr uintptr) *SpinnerPaintable { | |
| 70 | + | cls := &SpinnerPaintable{} | |
| 71 | + | cls.Ptr = ptr | |
| 72 | + | return cls | |
| 73 | + | } | |
| 74 | + | ||
| 75 | + | var xNewSpinnerPaintable func(uintptr) uintptr | |
| 76 | + | ||
| 77 | + | // Creates a new `AdwSpinnerPaintable` for @widget. | |
| 78 | + | func NewSpinnerPaintable(WidgetVar *gtk.Widget) *SpinnerPaintable { | |
| 79 | + | var cls *SpinnerPaintable | |
| 80 | + | ||
| 81 | + | cret := xNewSpinnerPaintable(WidgetVar.GoPointer()) | |
| 82 | + | ||
| 83 | + | if cret == 0 { | |
| 84 | + | return nil | |
| 85 | + | } | |
| 86 | + | cls = &SpinnerPaintable{} | |
| 87 | + | cls.Ptr = cret | |
| 88 | + | return cls | |
| 89 | + | } | |
| 90 | + | ||
| 91 | + | var xSpinnerPaintableGetWidget func(uintptr) uintptr | |
| 92 | + | ||
| 93 | + | // Gets the widget used for frame clock. | |
| 94 | + | func (x *SpinnerPaintable) GetWidget() *gtk.Widget { | |
| 95 | + | var cls *gtk.Widget | |
| 96 | + | ||
| 97 | + | cret := xSpinnerPaintableGetWidget(x.GoPointer()) | |
| 98 | + | ||
| 99 | + | if cret == 0 { | |
| 100 | + | return nil | |
| 101 | + | } | |
| 102 | + | gobject.IncreaseRef(cret) | |
| 103 | + | cls = >k.Widget{} | |
| 104 | + | cls.Ptr = cret | |
| 105 | + | return cls | |
| 106 | + | } | |
| 107 | + | ||
| 108 | + | var xSpinnerPaintableSetWidget func(uintptr, uintptr) | |
| 109 | + | ||
| 110 | + | // Sets the widget used for frame clock. | |
| 111 | + | func (x *SpinnerPaintable) SetWidget(WidgetVar *gtk.Widget) { | |
| 112 | + | ||
| 113 | + | xSpinnerPaintableSetWidget(x.GoPointer(), WidgetVar.GoPointer()) | |
| 114 | + | ||
| 115 | + | } | |
| 116 | + | ||
| 117 | + | func (c *SpinnerPaintable) GoPointer() uintptr { | |
| 118 | + | return c.Ptr | |
| 119 | + | } | |
| 120 | + | ||
| 121 | + | func (c *SpinnerPaintable) SetGoPointer(ptr uintptr) { | |
| 122 | + | c.Ptr = ptr | |
| 123 | + | } | |
| 124 | + | ||
| 125 | + | // Compute a concrete size for the `GdkPaintable`. | |
| 126 | + | // | |
| 127 | + | // Applies the sizing algorithm outlined in the | |
| 128 | + | // [CSS Image spec](https://drafts.csswg.org/css-images-3/#default-sizing) | |
| 129 | + | // to the given @paintable. See that link for more details. | |
| 130 | + | // | |
| 131 | + | // It is not necessary to call this function when both @specified_width | |
| 132 | + | // and @specified_height are known, but it is useful to call this | |
| 133 | + | // function in GtkWidget:measure implementations to compute the | |
| 134 | + | // other dimension when only one dimension is given. | |
| 135 | + | func (x *SpinnerPaintable) ComputeConcreteSize(SpecifiedWidthVar float64, SpecifiedHeightVar float64, DefaultWidthVar float64, DefaultHeightVar float64, ConcreteWidthVar float64, ConcreteHeightVar float64) { | |
| 136 | + | ||
| 137 | + | gdk.XGdkPaintableComputeConcreteSize(x.GoPointer(), SpecifiedWidthVar, SpecifiedHeightVar, DefaultWidthVar, DefaultHeightVar, ConcreteWidthVar, ConcreteHeightVar) | |
| 138 | + | ||
| 139 | + | } | |
| 140 | + | ||
| 141 | + | // Gets an immutable paintable for the current contents displayed by @paintable. | |
| 142 | + | // | |
| 143 | + | // This is useful when you want to retain the current state of an animation, | |
| 144 | + | // for example to take a screenshot of a running animation. | |
| 145 | + | // | |
| 146 | + | // If the @paintable is already immutable, it will return itself. | |
| 147 | + | func (x *SpinnerPaintable) GetCurrentImage() *gdk.PaintableBase { | |
| 148 | + | var cls *gdk.PaintableBase | |
| 149 | + | ||
| 150 | + | cret := gdk.XGdkPaintableGetCurrentImage(x.GoPointer()) | |
| 151 | + | ||
| 152 | + | if cret == 0 { | |
| 153 | + | return nil | |
| 154 | + | } | |
| 155 | + | cls = &gdk.PaintableBase{} | |
| 156 | + | cls.Ptr = cret | |
| 157 | + | return cls | |
| 158 | + | } | |
| 159 | + | ||
| 160 | + | // Get flags for the paintable. | |
| 161 | + | // | |
| 162 | + | // This is oftentimes useful for optimizations. | |
| 163 | + | // | |
| 164 | + | // See [flags@Gdk.PaintableFlags] for the flags and what they mean. | |
| 165 | + | func (x *SpinnerPaintable) GetFlags() gdk.PaintableFlags { | |
| 166 | + | ||
| 167 | + | cret := gdk.XGdkPaintableGetFlags(x.GoPointer()) | |
| 168 | + | return cret | |
| 169 | + | } | |
| 170 | + | ||
| 171 | + | // Gets the preferred aspect ratio the @paintable would like to be displayed at. | |
| 172 | + | // | |
| 173 | + | // The aspect ratio is the width divided by the height, so a value of 0.5 | |
| 174 | + | // means that the @paintable prefers to be displayed twice as high as it | |
| 175 | + | // is wide. Consumers of this interface can use this to preserve aspect | |
| 176 | + | // ratio when displaying the paintable. | |
| 177 | + | // | |
| 178 | + | // This is a purely informational value and does not in any way limit the | |
| 179 | + | // values that may be passed to [method@Gdk.Paintable.snapshot]. | |
| 180 | + | // | |
| 181 | + | // Usually when a @paintable returns nonzero values from | |
| 182 | + | // [method@Gdk.Paintable.get_intrinsic_width] and | |
| 183 | + | // [method@Gdk.Paintable.get_intrinsic_height] the aspect ratio | |
| 184 | + | // should conform to those values, though that is not required. | |
| 185 | + | // | |
| 186 | + | // If the @paintable does not have a preferred aspect ratio, | |
| 187 | + | // it returns 0. Negative values are never returned. | |
| 188 | + | func (x *SpinnerPaintable) GetIntrinsicAspectRatio() float64 { | |
| 189 | + | ||
| 190 | + | cret := gdk.XGdkPaintableGetIntrinsicAspectRatio(x.GoPointer()) | |
| 191 | + | return cret | |
| 192 | + | } | |
| 193 | + | ||
| 194 | + | // Gets the preferred height the @paintable would like to be displayed at. | |
| 195 | + | // | |
| 196 | + | // Consumers of this interface can use this to reserve enough space to draw | |
| 197 | + | // the paintable. | |
| 198 | + | // | |
| 199 | + | // This is a purely informational value and does not in any way limit the | |
| 200 | + | // values that may be passed to [method@Gdk.Paintable.snapshot]. | |
| 201 | + | // | |
| 202 | + | // If the @paintable does not have a preferred height, it returns 0. | |
| 203 | + | // Negative values are never returned. | |
| 204 | + | func (x *SpinnerPaintable) GetIntrinsicHeight() int { | |
| 205 | + | ||
| 206 | + | cret := gdk.XGdkPaintableGetIntrinsicHeight(x.GoPointer()) | |
| 207 | + | return cret | |
| 208 | + | } | |
| 209 | + | ||
| 210 | + | // Gets the preferred width the @paintable would like to be displayed at. | |
| 211 | + | // | |
| 212 | + | // Consumers of this interface can use this to reserve enough space to draw | |
| 213 | + | // the paintable. | |
| 214 | + | // | |
| 215 | + | // This is a purely informational value and does not in any way limit the | |
| 216 | + | // values that may be passed to [method@Gdk.Paintable.snapshot]. | |
| 217 | + | // | |
| 218 | + | // If the @paintable does not have a preferred width, it returns 0. | |
| 219 | + | // Negative values are never returned. | |
| 220 | + | func (x *SpinnerPaintable) GetIntrinsicWidth() int { | |
| 221 | + | ||
| 222 | + | cret := gdk.XGdkPaintableGetIntrinsicWidth(x.GoPointer()) | |
| 223 | + | return cret | |
| 224 | + | } | |
| 225 | + | ||
| 226 | + | // Called by implementations of `GdkPaintable` to invalidate their contents. | |
| 227 | + | // | |
| 228 | + | // Unless the contents are invalidated, implementations must guarantee that | |
| 229 | + | // multiple calls of [method@Gdk.Paintable.snapshot] produce the same output. | |
| 230 | + | // | |
| 231 | + | // This function will emit the [signal@Gdk.Paintable::invalidate-contents] | |
| 232 | + | // signal. | |
| 233 | + | // | |
| 234 | + | // If a @paintable reports the %GDK_PAINTABLE_STATIC_CONTENTS flag, | |
| 235 | + | // it must not call this function. | |
| 236 | + | func (x *SpinnerPaintable) InvalidateContents() { | |
| 237 | + | ||
| 238 | + | gdk.XGdkPaintableInvalidateContents(x.GoPointer()) | |
| 239 | + | ||
| 240 | + | } | |
| 241 | + | ||
| 242 | + | // Called by implementations of `GdkPaintable` to invalidate their size. | |
| 243 | + | // | |
| 244 | + | // As long as the size is not invalidated, @paintable must return the same | |
| 245 | + | // values for its intrinsic width, height and aspect ratio. | |
| 246 | + | // | |
| 247 | + | // This function will emit the [signal@Gdk.Paintable::invalidate-size] | |
| 248 | + | // signal. | |
| 249 | + | // | |
| 250 | + | // If a @paintable reports the %GDK_PAINTABLE_STATIC_SIZE flag, | |
| 251 | + | // it must not call this function. | |
| 252 | + | func (x *SpinnerPaintable) InvalidateSize() { | |
| 253 | + | ||
| 254 | + | gdk.XGdkPaintableInvalidateSize(x.GoPointer()) | |
| 255 | + | ||
| 256 | + | } | |
| 257 | + | ||
| 258 | + | // Snapshots the given paintable with the given @width and @height. | |
| 259 | + | // | |
| 260 | + | // The paintable is drawn at the current (0,0) offset of the @snapshot. | |
| 261 | + | // If @width and @height are not larger than zero, this function will | |
| 262 | + | // do nothing. | |
| 263 | + | func (x *SpinnerPaintable) Snapshot(SnapshotVar *gdk.Snapshot, WidthVar float64, HeightVar float64) { | |
| 264 | + | ||
| 265 | + | gdk.XGdkPaintableSnapshot(x.GoPointer(), SnapshotVar.GoPointer(), WidthVar, HeightVar) | |
| 266 | + | ||
| 267 | + | } | |
| 268 | + | ||
| 269 | + | // Snapshots the paintable with the given colors. | |
| 270 | + | // | |
| 271 | + | // If less than 4 colors are provided, GTK will pad the array with default | |
| 272 | + | // colors. | |
| 273 | + | func (x *SpinnerPaintable) SnapshotSymbolic(SnapshotVar *gdk.Snapshot, WidthVar float64, HeightVar float64, ColorsVar []gdk.RGBA, NColorsVar uint) { | |
| 274 | + | ||
| 275 | + | gtk.XGtkSymbolicPaintableSnapshotSymbolic(x.GoPointer(), SnapshotVar.GoPointer(), WidthVar, HeightVar, ColorsVar, NColorsVar) | |
| 276 | + | ||
| 277 | + | } | |
| 278 | + | ||
| 279 | + | func init() { | |
| 280 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 281 | + | if err != nil { | |
| 282 | + | panic(err) | |
| 283 | + | } | |
| 284 | + | ||
| 285 | + | core.PuregoSafeRegister(&xSpinnerPaintableGLibType, lib, "adw_spinner_paintable_get_type") | |
| 286 | + | ||
| 287 | + | core.PuregoSafeRegister(&xNewSpinnerPaintable, lib, "adw_spinner_paintable_new") | |
| 288 | + | ||
| 289 | + | core.PuregoSafeRegister(&xSpinnerPaintableGetWidget, lib, "adw_spinner_paintable_get_widget") | |
| 290 | + | core.PuregoSafeRegister(&xSpinnerPaintableSetWidget, lib, "adw_spinner_paintable_set_widget") | |
| 291 | + | ||
| 292 | + | } | |
A v4/adw/adw-spinner.go +255 -0
| @@ -0,0 +1,255 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 13 | + | ) | |
| 14 | + | ||
| 15 | + | type SpinnerClass struct { | |
| 16 | + | _ structs.HostLayout | |
| 17 | + | ||
| 18 | + | ParentClass uintptr | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | func (x *SpinnerClass) GoPointer() uintptr { | |
| 22 | + | return uintptr(unsafe.Pointer(x)) | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | // A widget showing a loading spinner. | |
| 26 | + | // | |
| 27 | + | // <picture> | |
| 28 | + | // | |
| 29 | + | // <source srcset="spinner-dark.png" media="(prefers-color-scheme: dark)"> | |
| 30 | + | // <img src="spinner.png" alt="spinner"> | |
| 31 | + | // | |
| 32 | + | // </picture> | |
| 33 | + | // | |
| 34 | + | // The size of the spinner depends on the available size, never smaller than | |
| 35 | + | // 16×16 pixels and never larger than 64×64 pixels. | |
| 36 | + | // | |
| 37 | + | // Use the [property@Gtk.Widget:halign] and [property@Gtk.Widget:valign] | |
| 38 | + | // properties in combination with [property@Gtk.Widget:width-request] and | |
| 39 | + | // [property@Gtk.Widget:height-request] for fine sizing control. | |
| 40 | + | // | |
| 41 | + | // For example, the following snippet shows the spinner at 48×48 pixels: | |
| 42 | + | // | |
| 43 | + | // ```xml | |
| 44 | + | // <object class="AdwSpinner"> | |
| 45 | + | // | |
| 46 | + | // <property name="halign">center</property> | |
| 47 | + | // <property name="valign">center</property> | |
| 48 | + | // <property name="width-request">48</property> | |
| 49 | + | // <property name="height-request">48</property> | |
| 50 | + | // | |
| 51 | + | // </object> | |
| 52 | + | // ``` | |
| 53 | + | // | |
| 54 | + | // See [class@SpinnerPaintable] for cases where using a widget is impractical or | |
| 55 | + | // impossible, such as [property@StatusPage:paintable]. | |
| 56 | + | // | |
| 57 | + | // ## CSS nodes | |
| 58 | + | // | |
| 59 | + | // `AdwSpinner` has a single node with the name `image` and the style class | |
| 60 | + | // `.spinner`. | |
| 61 | + | type Spinner struct { | |
| 62 | + | gtk.Widget | |
| 63 | + | } | |
| 64 | + | ||
| 65 | + | var xSpinnerGLibType func() types.GType | |
| 66 | + | ||
| 67 | + | func SpinnerGLibType() types.GType { | |
| 68 | + | return xSpinnerGLibType() | |
| 69 | + | } | |
| 70 | + | ||
| 71 | + | func SpinnerNewFromInternalPtr(ptr uintptr) *Spinner { | |
| 72 | + | cls := &Spinner{} | |
| 73 | + | cls.Ptr = ptr | |
| 74 | + | return cls | |
| 75 | + | } | |
| 76 | + | ||
| 77 | + | var xNewSpinner func() uintptr | |
| 78 | + | ||
| 79 | + | // Creates a new `AdwSpinner`. | |
| 80 | + | func NewSpinner() *Spinner { | |
| 81 | + | var cls *Spinner | |
| 82 | + | ||
| 83 | + | cret := xNewSpinner() | |
| 84 | + | ||
| 85 | + | if cret == 0 { | |
| 86 | + | return nil | |
| 87 | + | } | |
| 88 | + | gobject.IncreaseRef(cret) | |
| 89 | + | cls = &Spinner{} | |
| 90 | + | cls.Ptr = cret | |
| 91 | + | return cls | |
| 92 | + | } | |
| 93 | + | ||
| 94 | + | func (c *Spinner) GoPointer() uintptr { | |
| 95 | + | return c.Ptr | |
| 96 | + | } | |
| 97 | + | ||
| 98 | + | func (c *Spinner) SetGoPointer(ptr uintptr) { | |
| 99 | + | c.Ptr = ptr | |
| 100 | + | } | |
| 101 | + | ||
| 102 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 103 | + | func (x *Spinner) GetAccessibleRole() gtk.AccessibleRole { | |
| 104 | + | ||
| 105 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 106 | + | return cret | |
| 107 | + | } | |
| 108 | + | ||
| 109 | + | // Resets the accessible @property to its default value. | |
| 110 | + | func (x *Spinner) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 111 | + | ||
| 112 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 113 | + | ||
| 114 | + | } | |
| 115 | + | ||
| 116 | + | // Resets the accessible @relation to its default value. | |
| 117 | + | func (x *Spinner) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 118 | + | ||
| 119 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 120 | + | ||
| 121 | + | } | |
| 122 | + | ||
| 123 | + | // Resets the accessible @state to its default value. | |
| 124 | + | func (x *Spinner) ResetState(StateVar gtk.AccessibleState) { | |
| 125 | + | ||
| 126 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 127 | + | ||
| 128 | + | } | |
| 129 | + | ||
| 130 | + | // Updates a list of accessible properties. | |
| 131 | + | // | |
| 132 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 133 | + | // value types of accessible properties. | |
| 134 | + | // | |
| 135 | + | // This function should be called by `GtkWidget` types whenever | |
| 136 | + | // an accessible property change must be communicated to assistive | |
| 137 | + | // technologies. | |
| 138 | + | // | |
| 139 | + | // Example: | |
| 140 | + | // ```c | |
| 141 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 142 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 143 | + | // | |
| 144 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 145 | + | // -1); | |
| 146 | + | // | |
| 147 | + | // ``` | |
| 148 | + | func (x *Spinner) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 149 | + | ||
| 150 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 151 | + | ||
| 152 | + | } | |
| 153 | + | ||
| 154 | + | // Updates an array of accessible properties. | |
| 155 | + | // | |
| 156 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 157 | + | // property change must be communicated to assistive technologies. | |
| 158 | + | // | |
| 159 | + | // This function is meant to be used by language bindings. | |
| 160 | + | func (x *Spinner) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 161 | + | ||
| 162 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 163 | + | ||
| 164 | + | } | |
| 165 | + | ||
| 166 | + | // Updates a list of accessible relations. | |
| 167 | + | // | |
| 168 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 169 | + | // relation change must be communicated to assistive technologies. | |
| 170 | + | // | |
| 171 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 172 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 173 | + | // | |
| 174 | + | // ```c | |
| 175 | + | // gtk_accessible_update_relation (accessible, | |
| 176 | + | // | |
| 177 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 178 | + | // ref1, NULL, | |
| 179 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 180 | + | // ref1, ref2, ref3, NULL, | |
| 181 | + | // -1); | |
| 182 | + | // | |
| 183 | + | // ``` | |
| 184 | + | func (x *Spinner) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 185 | + | ||
| 186 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 187 | + | ||
| 188 | + | } | |
| 189 | + | ||
| 190 | + | // Updates an array of accessible relations. | |
| 191 | + | // | |
| 192 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 193 | + | // relation change must be communicated to assistive technologies. | |
| 194 | + | // | |
| 195 | + | // This function is meant to be used by language bindings. | |
| 196 | + | func (x *Spinner) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 197 | + | ||
| 198 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 199 | + | ||
| 200 | + | } | |
| 201 | + | ||
| 202 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 203 | + | // documentation for the value types of accessible states. | |
| 204 | + | // | |
| 205 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 206 | + | // state change must be communicated to assistive technologies. | |
| 207 | + | // | |
| 208 | + | // Example: | |
| 209 | + | // ```c | |
| 210 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 211 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 212 | + | // | |
| 213 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 214 | + | // -1); | |
| 215 | + | // | |
| 216 | + | // ``` | |
| 217 | + | func (x *Spinner) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 218 | + | ||
| 219 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 220 | + | ||
| 221 | + | } | |
| 222 | + | ||
| 223 | + | // Updates an array of accessible states. | |
| 224 | + | // | |
| 225 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 226 | + | // state change must be communicated to assistive technologies. | |
| 227 | + | // | |
| 228 | + | // This function is meant to be used by language bindings. | |
| 229 | + | func (x *Spinner) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 230 | + | ||
| 231 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 232 | + | ||
| 233 | + | } | |
| 234 | + | ||
| 235 | + | // Gets the ID of the @buildable object. | |
| 236 | + | // | |
| 237 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 238 | + | // of the <object> tag used to construct the @buildable. | |
| 239 | + | func (x *Spinner) GetBuildableId() string { | |
| 240 | + | ||
| 241 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 242 | + | return cret | |
| 243 | + | } | |
| 244 | + | ||
| 245 | + | func init() { | |
| 246 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 247 | + | if err != nil { | |
| 248 | + | panic(err) | |
| 249 | + | } | |
| 250 | + | ||
| 251 | + | core.PuregoSafeRegister(&xSpinnerGLibType, lib, "adw_spinner_get_type") | |
| 252 | + | ||
| 253 | + | core.PuregoSafeRegister(&xNewSpinner, lib, "adw_spinner_new") | |
| 254 | + | ||
| 255 | + | } | |
M v4/adw/adw-split-button.go +36 -0
| @@ -61,6 +61,17 @@ func (x *SplitButtonClass) GoPointer() uintptr { | |||
| 61 | 61 | // classes matching the button contents. The nested button nodes will never | |
| 62 | 62 | // contain them. | |
| 63 | 63 | // | |
| 64 | + | // ## Style classes | |
| 65 | + | // | |
| 66 | + | // `AdwSplitButton` can use some of the same style classes as [class@Gtk.Button]: | |
| 67 | + | // | |
| 68 | + | // - [`.suggested-action`](style-classes.html#suggested-action) | |
| 69 | + | // - [`.destructive-action`](style-classes.html#destructive-action) | |
| 70 | + | // - [`.flat`](style-classes.html#flat) | |
| 71 | + | // - [`.raised`](style-classes.html#raised) | |
| 72 | + | // | |
| 73 | + | // Other style classes, like `.pill`, cannot be used. | |
| 74 | + | // | |
| 64 | 75 | // ## Accessibility | |
| 65 | 76 | // | |
| 66 | 77 | // `AdwSplitButton` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role. | |
| @@ -97,6 +108,15 @@ func NewSplitButton() *SplitButton { | |||
| 97 | 108 | return cls | |
| 98 | 109 | } | |
| 99 | 110 | ||
| 111 | + | var xSplitButtonGetCanShrink func(uintptr) bool | |
| 112 | + | ||
| 113 | + | // gets whether the button can be smaller than the natural size of its contents. | |
| 114 | + | func (x *SplitButton) GetCanShrink() bool { | |
| 115 | + | ||
| 116 | + | cret := xSplitButtonGetCanShrink(x.GoPointer()) | |
| 117 | + | return cret | |
| 118 | + | } | |
| 119 | + | ||
| 100 | 120 | var xSplitButtonGetChild func(uintptr) uintptr | |
| 101 | 121 | ||
| 102 | 122 | // Gets the child widget. | |
| @@ -211,6 +231,20 @@ func (x *SplitButton) Popup() { | |||
| 211 | 231 | ||
| 212 | 232 | } | |
| 213 | 233 | ||
| 234 | + | var xSplitButtonSetCanShrink func(uintptr, bool) | |
| 235 | + | ||
| 236 | + | // Sets whether the button can be smaller than the natural size of its contents. | |
| 237 | + | // | |
| 238 | + | // If set to `TRUE`, the label will ellipsize. | |
| 239 | + | // | |
| 240 | + | // See [method@Gtk.Button.set_can_shrink] and | |
| 241 | + | // [method@Gtk.MenuButton.set_can_shrink]. | |
| 242 | + | func (x *SplitButton) SetCanShrink(CanShrinkVar bool) { | |
| 243 | + | ||
| 244 | + | xSplitButtonSetCanShrink(x.GoPointer(), CanShrinkVar) | |
| 245 | + | ||
| 246 | + | } | |
| 247 | + | ||
| 214 | 248 | var xSplitButtonSetChild func(uintptr, uintptr) | |
| 215 | 249 | ||
| 216 | 250 | // Sets the child widget. | |
| @@ -604,6 +638,7 @@ func init() { | |||
| 604 | 638 | ||
| 605 | 639 | core.PuregoSafeRegister(&xNewSplitButton, lib, "adw_split_button_new") | |
| 606 | 640 | ||
| 641 | + | core.PuregoSafeRegister(&xSplitButtonGetCanShrink, lib, "adw_split_button_get_can_shrink") | |
| 607 | 642 | core.PuregoSafeRegister(&xSplitButtonGetChild, lib, "adw_split_button_get_child") | |
| 608 | 643 | core.PuregoSafeRegister(&xSplitButtonGetDirection, lib, "adw_split_button_get_direction") | |
| 609 | 644 | core.PuregoSafeRegister(&xSplitButtonGetDropdownTooltip, lib, "adw_split_button_get_dropdown_tooltip") | |
| @@ -614,6 +649,7 @@ func init() { | |||
| 614 | 649 | core.PuregoSafeRegister(&xSplitButtonGetUseUnderline, lib, "adw_split_button_get_use_underline") | |
| 615 | 650 | core.PuregoSafeRegister(&xSplitButtonPopdown, lib, "adw_split_button_popdown") | |
| 616 | 651 | core.PuregoSafeRegister(&xSplitButtonPopup, lib, "adw_split_button_popup") | |
| 652 | + | core.PuregoSafeRegister(&xSplitButtonSetCanShrink, lib, "adw_split_button_set_can_shrink") | |
| 617 | 653 | core.PuregoSafeRegister(&xSplitButtonSetChild, lib, "adw_split_button_set_child") | |
| 618 | 654 | core.PuregoSafeRegister(&xSplitButtonSetDirection, lib, "adw_split_button_set_direction") | |
| 619 | 655 | core.PuregoSafeRegister(&xSplitButtonSetDropdownTooltip, lib, "adw_split_button_set_dropdown_tooltip") | |
M v4/adw/adw-status-page.go +19 -5
| @@ -39,9 +39,23 @@ func (x *StatusPageClass) GoPointer() uintptr { | |||
| 39 | 39 | // | |
| 40 | 40 | // `AdwStatusPage` has a main CSS node with name `statuspage`. | |
| 41 | 41 | // | |
| 42 | + | // When setting an [class@SpinnerPaintable] as [property@StatusPage:paintable], | |
| 43 | + | // the main nodes gains the `.spinner` style class for a more compact | |
| 44 | + | // appearance. | |
| 45 | + | // | |
| 46 | + | // ## Style classes | |
| 47 | + | // | |
| 42 | 48 | // `AdwStatusPage` can use the | |
| 43 | 49 | // [`.compact`](style-classes.html#compact-status-page) style class for when it | |
| 44 | - | // needs to fit into a small space such a sidebar or a popover. | |
| 50 | + | // needs to fit into a small space such a sidebar or a popover, similar to when | |
| 51 | + | // using a spinner as the paintable. | |
| 52 | + | // | |
| 53 | + | // <picture> | |
| 54 | + | // | |
| 55 | + | // <source srcset="status-page-compact-dark.png" media="(prefers-color-scheme: dark)"> | |
| 56 | + | // <img src="status-page-compact.png" alt="status-page-compact"> | |
| 57 | + | // | |
| 58 | + | // </picture> | |
| 45 | 59 | type StatusPage struct { | |
| 46 | 60 | gtk.Widget | |
| 47 | 61 | } | |
| @@ -94,7 +108,7 @@ func (x *StatusPage) GetChild() *gtk.Widget { | |||
| 94 | 108 | ||
| 95 | 109 | var xStatusPageGetDescription func(uintptr) string | |
| 96 | 110 | ||
| 97 | - | // Gets the description for @self. | |
| 111 | + | // Gets the description markup for @self. | |
| 98 | 112 | func (x *StatusPage) GetDescription() string { | |
| 99 | 113 | ||
| 100 | 114 | cret := xStatusPageGetDescription(x.GoPointer()) | |
| @@ -147,9 +161,9 @@ func (x *StatusPage) SetChild(ChildVar *gtk.Widget) { | |||
| 147 | 161 | ||
| 148 | 162 | var xStatusPageSetDescription func(uintptr, string) | |
| 149 | 163 | ||
| 150 | - | // Sets the description for @self. | |
| 164 | + | // Sets the description markup for @self. | |
| 151 | 165 | // | |
| 152 | - | // The description is displayed below the title. | |
| 166 | + | // The description is displayed below the title. It is parsed as Pango markup. | |
| 153 | 167 | func (x *StatusPage) SetDescription(DescriptionVar string) { | |
| 154 | 168 | ||
| 155 | 169 | xStatusPageSetDescription(x.GoPointer(), DescriptionVar) | |
| @@ -182,7 +196,7 @@ var xStatusPageSetTitle func(uintptr, string) | |||
| 182 | 196 | ||
| 183 | 197 | // Sets the title for @self. | |
| 184 | 198 | // | |
| 185 | - | // The title is displayed below the icon. | |
| 199 | + | // The title is displayed below the icon. It is not parsed as Pango markup. | |
| 186 | 200 | func (x *StatusPage) SetTitle(TitleVar string) { | |
| 187 | 201 | ||
| 188 | 202 | xStatusPageSetTitle(x.GoPointer(), TitleVar) | |
M v4/adw/adw-style-manager.go +47 -2
| @@ -52,11 +52,13 @@ const ( | |||
| 52 | 52 | // A class for managing application-wide styling. | |
| 53 | 53 | // | |
| 54 | 54 | // `AdwStyleManager` provides a way to query and influence the application | |
| 55 | - | // styles, such as whether to use dark or high contrast appearance. | |
| 55 | + | // styles, such as whether to use dark style, the system accent color or high | |
| 56 | + | // contrast appearance. | |
| 56 | 57 | // | |
| 57 | 58 | // It allows to set the color scheme via the | |
| 58 | 59 | // [property@StyleManager:color-scheme] property, and to query the current | |
| 59 | - | // appearance, as well as whether a system-wide color scheme preference exists. | |
| 60 | + | // appearance, as well as whether a system-wide color scheme and accent color | |
| 61 | + | // preferences exists. | |
| 60 | 62 | type StyleManager struct { | |
| 61 | 63 | gobject.Object | |
| 62 | 64 | } | |
| @@ -73,6 +75,31 @@ func StyleManagerNewFromInternalPtr(ptr uintptr) *StyleManager { | |||
| 73 | 75 | return cls | |
| 74 | 76 | } | |
| 75 | 77 | ||
| 78 | + | var xStyleManagerGetAccentColor func(uintptr) AccentColor | |
| 79 | + | ||
| 80 | + | // Gets the current system accent color. | |
| 81 | + | // | |
| 82 | + | // See also [property@StyleManager:accent-color-rgba]. | |
| 83 | + | func (x *StyleManager) GetAccentColor() AccentColor { | |
| 84 | + | ||
| 85 | + | cret := xStyleManagerGetAccentColor(x.GoPointer()) | |
| 86 | + | return cret | |
| 87 | + | } | |
| 88 | + | ||
| 89 | + | var xStyleManagerGetAccentColorRgba func(uintptr) *gdk.RGBA | |
| 90 | + | ||
| 91 | + | // Gets the current system accent color as a `GdkRGBA`. | |
| 92 | + | // | |
| 93 | + | // Equivalent to calling [func@AccentColor.to_rgba] on the value of | |
| 94 | + | // [property@StyleManager:accent-color]. | |
| 95 | + | // | |
| 96 | + | // This is a background color. The matching foreground color is white. | |
| 97 | + | func (x *StyleManager) GetAccentColorRgba() *gdk.RGBA { | |
| 98 | + | ||
| 99 | + | cret := xStyleManagerGetAccentColorRgba(x.GoPointer()) | |
| 100 | + | return cret | |
| 101 | + | } | |
| 102 | + | ||
| 76 | 103 | var xStyleManagerGetColorScheme func(uintptr) ColorScheme | |
| 77 | 104 | ||
| 78 | 105 | // Gets the requested application color scheme. | |
| @@ -125,6 +152,21 @@ func (x *StyleManager) GetHighContrast() bool { | |||
| 125 | 152 | return cret | |
| 126 | 153 | } | |
| 127 | 154 | ||
| 155 | + | var xStyleManagerGetSystemSupportsAccentColors func(uintptr) bool | |
| 156 | + | ||
| 157 | + | // Gets whether the system supports accent colors. | |
| 158 | + | // | |
| 159 | + | // This can be used to check if the current environment provides an accent color | |
| 160 | + | // preference. For example, applications might want to show a preference for | |
| 161 | + | // choosing accent color if it's set to `FALSE`. | |
| 162 | + | // | |
| 163 | + | // See [property@StyleManager:accent-color]. | |
| 164 | + | func (x *StyleManager) GetSystemSupportsAccentColors() bool { | |
| 165 | + | ||
| 166 | + | cret := xStyleManagerGetSystemSupportsAccentColors(x.GoPointer()) | |
| 167 | + | return cret | |
| 168 | + | } | |
| 169 | + | ||
| 128 | 170 | var xStyleManagerGetSystemSupportsColorSchemes func(uintptr) bool | |
| 129 | 171 | ||
| 130 | 172 | // Gets whether the system supports color schemes. | |
| @@ -239,10 +281,13 @@ func init() { | |||
| 239 | 281 | ||
| 240 | 282 | core.PuregoSafeRegister(&xStyleManagerGLibType, lib, "adw_style_manager_get_type") | |
| 241 | 283 | ||
| 284 | + | core.PuregoSafeRegister(&xStyleManagerGetAccentColor, lib, "adw_style_manager_get_accent_color") | |
| 285 | + | core.PuregoSafeRegister(&xStyleManagerGetAccentColorRgba, lib, "adw_style_manager_get_accent_color_rgba") | |
| 242 | 286 | core.PuregoSafeRegister(&xStyleManagerGetColorScheme, lib, "adw_style_manager_get_color_scheme") | |
| 243 | 287 | core.PuregoSafeRegister(&xStyleManagerGetDark, lib, "adw_style_manager_get_dark") | |
| 244 | 288 | core.PuregoSafeRegister(&xStyleManagerGetDisplay, lib, "adw_style_manager_get_display") | |
| 245 | 289 | core.PuregoSafeRegister(&xStyleManagerGetHighContrast, lib, "adw_style_manager_get_high_contrast") | |
| 290 | + | core.PuregoSafeRegister(&xStyleManagerGetSystemSupportsAccentColors, lib, "adw_style_manager_get_system_supports_accent_colors") | |
| 246 | 291 | core.PuregoSafeRegister(&xStyleManagerGetSystemSupportsColorSchemes, lib, "adw_style_manager_get_system_supports_color_schemes") | |
| 247 | 292 | core.PuregoSafeRegister(&xStyleManagerSetColorScheme, lib, "adw_style_manager_set_color_scheme") | |
| 248 | 293 | ||
M v4/adw/adw-swipe-tracker.go +64 -1
| @@ -23,7 +23,8 @@ func (x *SwipeTrackerClass) GoPointer() uintptr { | |||
| 23 | 23 | return uintptr(unsafe.Pointer(x)) | |
| 24 | 24 | } | |
| 25 | 25 | ||
| 26 | - | // A swipe tracker used in [class@Carousel], [class@Flap] and [class@Leaflet]. | |
| 26 | + | // A swipe tracker used in [class@Carousel], [class@NavigationView] and | |
| 27 | + | // [class@OverlaySplitView]. | |
| 27 | 28 | // | |
| 28 | 29 | // The `AdwSwipeTracker` object can be used for implementing widgets with swipe | |
| 29 | 30 | // gestures. It supports touch-based swipes, pointer dragging, and touchpad | |
| @@ -83,6 +84,15 @@ func (x *SwipeTracker) GetAllowMouseDrag() bool { | |||
| 83 | 84 | return cret | |
| 84 | 85 | } | |
| 85 | 86 | ||
| 87 | + | var xSwipeTrackerGetAllowWindowHandle func(uintptr) bool | |
| 88 | + | ||
| 89 | + | // Gets whether to allow touchscreen swiping from `GtkWindowHandle`. | |
| 90 | + | func (x *SwipeTracker) GetAllowWindowHandle() bool { | |
| 91 | + | ||
| 92 | + | cret := xSwipeTrackerGetAllowWindowHandle(x.GoPointer()) | |
| 93 | + | return cret | |
| 94 | + | } | |
| 95 | + | ||
| 86 | 96 | var xSwipeTrackerGetEnabled func(uintptr) bool | |
| 87 | 97 | ||
| 88 | 98 | // Gets whether @self is enabled. | |
| @@ -92,6 +102,15 @@ func (x *SwipeTracker) GetEnabled() bool { | |||
| 92 | 102 | return cret | |
| 93 | 103 | } | |
| 94 | 104 | ||
| 105 | + | var xSwipeTrackerGetLowerOvershoot func(uintptr) bool | |
| 106 | + | ||
| 107 | + | // Gets whether to allow swiping past the first available snap point. | |
| 108 | + | func (x *SwipeTracker) GetLowerOvershoot() bool { | |
| 109 | + | ||
| 110 | + | cret := xSwipeTrackerGetLowerOvershoot(x.GoPointer()) | |
| 111 | + | return cret | |
| 112 | + | } | |
| 113 | + | ||
| 95 | 114 | var xSwipeTrackerGetReversed func(uintptr) bool | |
| 96 | 115 | ||
| 97 | 116 | // Gets whether @self is reversing the swipe direction. | |
| @@ -118,6 +137,15 @@ func (x *SwipeTracker) GetSwipeable() *SwipeableBase { | |||
| 118 | 137 | return cls | |
| 119 | 138 | } | |
| 120 | 139 | ||
| 140 | + | var xSwipeTrackerGetUpperOvershoot func(uintptr) bool | |
| 141 | + | ||
| 142 | + | // Gets whether to allow swiping past the last available snap point. | |
| 143 | + | func (x *SwipeTracker) GetUpperOvershoot() bool { | |
| 144 | + | ||
| 145 | + | cret := xSwipeTrackerGetUpperOvershoot(x.GoPointer()) | |
| 146 | + | return cret | |
| 147 | + | } | |
| 148 | + | ||
| 121 | 149 | var xSwipeTrackerSetAllowLongSwipes func(uintptr, bool) | |
| 122 | 150 | ||
| 123 | 151 | // Sets whether to allow swiping for more than one snap point at a time. | |
| @@ -139,6 +167,17 @@ func (x *SwipeTracker) SetAllowMouseDrag(AllowMouseDragVar bool) { | |||
| 139 | 167 | ||
| 140 | 168 | } | |
| 141 | 169 | ||
| 170 | + | var xSwipeTrackerSetAllowWindowHandle func(uintptr, bool) | |
| 171 | + | ||
| 172 | + | // Sets whether to allow touchscreen swiping from `GtkWindowHandle`. | |
| 173 | + | // | |
| 174 | + | // Setting it to `TRUE` will make dragging the window impossible. | |
| 175 | + | func (x *SwipeTracker) SetAllowWindowHandle(AllowWindowHandleVar bool) { | |
| 176 | + | ||
| 177 | + | xSwipeTrackerSetAllowWindowHandle(x.GoPointer(), AllowWindowHandleVar) | |
| 178 | + | ||
| 179 | + | } | |
| 180 | + | ||
| 142 | 181 | var xSwipeTrackerSetEnabled func(uintptr, bool) | |
| 143 | 182 | ||
| 144 | 183 | // Sets whether @self is enabled. | |
| @@ -151,6 +190,15 @@ func (x *SwipeTracker) SetEnabled(EnabledVar bool) { | |||
| 151 | 190 | ||
| 152 | 191 | } | |
| 153 | 192 | ||
| 193 | + | var xSwipeTrackerSetLowerOvershoot func(uintptr, bool) | |
| 194 | + | ||
| 195 | + | // Sets whether to allow swiping past the first available snap point. | |
| 196 | + | func (x *SwipeTracker) SetLowerOvershoot(OvershootVar bool) { | |
| 197 | + | ||
| 198 | + | xSwipeTrackerSetLowerOvershoot(x.GoPointer(), OvershootVar) | |
| 199 | + | ||
| 200 | + | } | |
| 201 | + | ||
| 154 | 202 | var xSwipeTrackerSetReversed func(uintptr, bool) | |
| 155 | 203 | ||
| 156 | 204 | // Sets whether to reverse the swipe direction. | |
| @@ -163,6 +211,15 @@ func (x *SwipeTracker) SetReversed(ReversedVar bool) { | |||
| 163 | 211 | ||
| 164 | 212 | } | |
| 165 | 213 | ||
| 214 | + | var xSwipeTrackerSetUpperOvershoot func(uintptr, bool) | |
| 215 | + | ||
| 216 | + | // Sets whether to allow swiping past the last available snap point. | |
| 217 | + | func (x *SwipeTracker) SetUpperOvershoot(OvershootVar bool) { | |
| 218 | + | ||
| 219 | + | xSwipeTrackerSetUpperOvershoot(x.GoPointer(), OvershootVar) | |
| 220 | + | ||
| 221 | + | } | |
| 222 | + | ||
| 166 | 223 | var xSwipeTrackerShiftPosition func(uintptr, float64) | |
| 167 | 224 | ||
| 168 | 225 | // Moves the current progress value by @delta. | |
| @@ -298,13 +355,19 @@ func init() { | |||
| 298 | 355 | ||
| 299 | 356 | core.PuregoSafeRegister(&xSwipeTrackerGetAllowLongSwipes, lib, "adw_swipe_tracker_get_allow_long_swipes") | |
| 300 | 357 | core.PuregoSafeRegister(&xSwipeTrackerGetAllowMouseDrag, lib, "adw_swipe_tracker_get_allow_mouse_drag") | |
| 358 | + | core.PuregoSafeRegister(&xSwipeTrackerGetAllowWindowHandle, lib, "adw_swipe_tracker_get_allow_window_handle") | |
| 301 | 359 | core.PuregoSafeRegister(&xSwipeTrackerGetEnabled, lib, "adw_swipe_tracker_get_enabled") | |
| 360 | + | core.PuregoSafeRegister(&xSwipeTrackerGetLowerOvershoot, lib, "adw_swipe_tracker_get_lower_overshoot") | |
| 302 | 361 | core.PuregoSafeRegister(&xSwipeTrackerGetReversed, lib, "adw_swipe_tracker_get_reversed") | |
| 303 | 362 | core.PuregoSafeRegister(&xSwipeTrackerGetSwipeable, lib, "adw_swipe_tracker_get_swipeable") | |
| 363 | + | core.PuregoSafeRegister(&xSwipeTrackerGetUpperOvershoot, lib, "adw_swipe_tracker_get_upper_overshoot") | |
| 304 | 364 | core.PuregoSafeRegister(&xSwipeTrackerSetAllowLongSwipes, lib, "adw_swipe_tracker_set_allow_long_swipes") | |
| 305 | 365 | core.PuregoSafeRegister(&xSwipeTrackerSetAllowMouseDrag, lib, "adw_swipe_tracker_set_allow_mouse_drag") | |
| 366 | + | core.PuregoSafeRegister(&xSwipeTrackerSetAllowWindowHandle, lib, "adw_swipe_tracker_set_allow_window_handle") | |
| 306 | 367 | core.PuregoSafeRegister(&xSwipeTrackerSetEnabled, lib, "adw_swipe_tracker_set_enabled") | |
| 368 | + | core.PuregoSafeRegister(&xSwipeTrackerSetLowerOvershoot, lib, "adw_swipe_tracker_set_lower_overshoot") | |
| 307 | 369 | core.PuregoSafeRegister(&xSwipeTrackerSetReversed, lib, "adw_swipe_tracker_set_reversed") | |
| 370 | + | core.PuregoSafeRegister(&xSwipeTrackerSetUpperOvershoot, lib, "adw_swipe_tracker_set_upper_overshoot") | |
| 308 | 371 | core.PuregoSafeRegister(&xSwipeTrackerShiftPosition, lib, "adw_swipe_tracker_shift_position") | |
| 309 | 372 | ||
| 310 | 373 | } | |
A v4/adw/adw-switch-row.go +358 -0
| @@ -0,0 +1,358 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 13 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 14 | + | ) | |
| 15 | + | ||
| 16 | + | type SwitchRowClass struct { | |
| 17 | + | _ structs.HostLayout | |
| 18 | + | ||
| 19 | + | ParentClass uintptr | |
| 20 | + | } | |
| 21 | + | ||
| 22 | + | func (x *SwitchRowClass) GoPointer() uintptr { | |
| 23 | + | return uintptr(unsafe.Pointer(x)) | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | // A [class@Gtk.ListBoxRow] used to represent two states. | |
| 27 | + | // | |
| 28 | + | // <picture> | |
| 29 | + | // | |
| 30 | + | // <source srcset="switch-row-dark.png" media="(prefers-color-scheme: dark)"> | |
| 31 | + | // <img src="switch-row.png" alt="switch-row"> | |
| 32 | + | // | |
| 33 | + | // </picture> | |
| 34 | + | // | |
| 35 | + | // The `AdwSwitchRow` widget contains a [class@Gtk.Switch] that allows the user | |
| 36 | + | // to select between two states: "on" or "off". When activated, the row will | |
| 37 | + | // invert its active state. | |
| 38 | + | // | |
| 39 | + | // The user can control the switch by activating the row or by dragging on the | |
| 40 | + | // switch handle. | |
| 41 | + | // | |
| 42 | + | // See [class@Gtk.Switch] for details. | |
| 43 | + | // | |
| 44 | + | // Example of an `AdwSwitchRow` UI definition: | |
| 45 | + | // ```xml | |
| 46 | + | // <object class="AdwSwitchRow"> | |
| 47 | + | // | |
| 48 | + | // <property name="title" translatable="yes">Switch Row</property> | |
| 49 | + | // <signal name="notify::active" handler="switch_row_notify_active_cb"/> | |
| 50 | + | // | |
| 51 | + | // </object> | |
| 52 | + | // ``` | |
| 53 | + | // | |
| 54 | + | // The [property@SwitchRow:active] property should be connected to in order to | |
| 55 | + | // monitor changes to the active state. | |
| 56 | + | // | |
| 57 | + | // ## Accessibility | |
| 58 | + | // | |
| 59 | + | // `AdwSwitchRow` uses the `GTK_ACCESSIBLE_ROLE_SWITCH` role. | |
| 60 | + | type SwitchRow struct { | |
| 61 | + | ActionRow | |
| 62 | + | } | |
| 63 | + | ||
| 64 | + | var xSwitchRowGLibType func() types.GType | |
| 65 | + | ||
| 66 | + | func SwitchRowGLibType() types.GType { | |
| 67 | + | return xSwitchRowGLibType() | |
| 68 | + | } | |
| 69 | + | ||
| 70 | + | func SwitchRowNewFromInternalPtr(ptr uintptr) *SwitchRow { | |
| 71 | + | cls := &SwitchRow{} | |
| 72 | + | cls.Ptr = ptr | |
| 73 | + | return cls | |
| 74 | + | } | |
| 75 | + | ||
| 76 | + | var xNewSwitchRow func() uintptr | |
| 77 | + | ||
| 78 | + | // Creates a new `AdwSwitchRow`. | |
| 79 | + | func NewSwitchRow() *SwitchRow { | |
| 80 | + | var cls *SwitchRow | |
| 81 | + | ||
| 82 | + | cret := xNewSwitchRow() | |
| 83 | + | ||
| 84 | + | if cret == 0 { | |
| 85 | + | return nil | |
| 86 | + | } | |
| 87 | + | gobject.IncreaseRef(cret) | |
| 88 | + | cls = &SwitchRow{} | |
| 89 | + | cls.Ptr = cret | |
| 90 | + | return cls | |
| 91 | + | } | |
| 92 | + | ||
| 93 | + | var xSwitchRowGetActive func(uintptr) bool | |
| 94 | + | ||
| 95 | + | // Gets whether @self is in its "on" or "off" position. | |
| 96 | + | func (x *SwitchRow) GetActive() bool { | |
| 97 | + | ||
| 98 | + | cret := xSwitchRowGetActive(x.GoPointer()) | |
| 99 | + | return cret | |
| 100 | + | } | |
| 101 | + | ||
| 102 | + | var xSwitchRowSetActive func(uintptr, bool) | |
| 103 | + | ||
| 104 | + | // Sets whether @self is in its "on" or "off" position | |
| 105 | + | func (x *SwitchRow) SetActive(IsActiveVar bool) { | |
| 106 | + | ||
| 107 | + | xSwitchRowSetActive(x.GoPointer(), IsActiveVar) | |
| 108 | + | ||
| 109 | + | } | |
| 110 | + | ||
| 111 | + | func (c *SwitchRow) GoPointer() uintptr { | |
| 112 | + | return c.Ptr | |
| 113 | + | } | |
| 114 | + | ||
| 115 | + | func (c *SwitchRow) SetGoPointer(ptr uintptr) { | |
| 116 | + | c.Ptr = ptr | |
| 117 | + | } | |
| 118 | + | ||
| 119 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 120 | + | func (x *SwitchRow) GetAccessibleRole() gtk.AccessibleRole { | |
| 121 | + | ||
| 122 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 123 | + | return cret | |
| 124 | + | } | |
| 125 | + | ||
| 126 | + | // Resets the accessible @property to its default value. | |
| 127 | + | func (x *SwitchRow) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 128 | + | ||
| 129 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 130 | + | ||
| 131 | + | } | |
| 132 | + | ||
| 133 | + | // Resets the accessible @relation to its default value. | |
| 134 | + | func (x *SwitchRow) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 135 | + | ||
| 136 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 137 | + | ||
| 138 | + | } | |
| 139 | + | ||
| 140 | + | // Resets the accessible @state to its default value. | |
| 141 | + | func (x *SwitchRow) ResetState(StateVar gtk.AccessibleState) { | |
| 142 | + | ||
| 143 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 144 | + | ||
| 145 | + | } | |
| 146 | + | ||
| 147 | + | // Updates a list of accessible properties. | |
| 148 | + | // | |
| 149 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 150 | + | // value types of accessible properties. | |
| 151 | + | // | |
| 152 | + | // This function should be called by `GtkWidget` types whenever | |
| 153 | + | // an accessible property change must be communicated to assistive | |
| 154 | + | // technologies. | |
| 155 | + | // | |
| 156 | + | // Example: | |
| 157 | + | // ```c | |
| 158 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 159 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 160 | + | // | |
| 161 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 162 | + | // -1); | |
| 163 | + | // | |
| 164 | + | // ``` | |
| 165 | + | func (x *SwitchRow) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 166 | + | ||
| 167 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 168 | + | ||
| 169 | + | } | |
| 170 | + | ||
| 171 | + | // Updates an array of accessible properties. | |
| 172 | + | // | |
| 173 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 174 | + | // property change must be communicated to assistive technologies. | |
| 175 | + | // | |
| 176 | + | // This function is meant to be used by language bindings. | |
| 177 | + | func (x *SwitchRow) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 178 | + | ||
| 179 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 180 | + | ||
| 181 | + | } | |
| 182 | + | ||
| 183 | + | // Updates a list of accessible relations. | |
| 184 | + | // | |
| 185 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 186 | + | // relation change must be communicated to assistive technologies. | |
| 187 | + | // | |
| 188 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 189 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 190 | + | // | |
| 191 | + | // ```c | |
| 192 | + | // gtk_accessible_update_relation (accessible, | |
| 193 | + | // | |
| 194 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 195 | + | // ref1, NULL, | |
| 196 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 197 | + | // ref1, ref2, ref3, NULL, | |
| 198 | + | // -1); | |
| 199 | + | // | |
| 200 | + | // ``` | |
| 201 | + | func (x *SwitchRow) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 202 | + | ||
| 203 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 204 | + | ||
| 205 | + | } | |
| 206 | + | ||
| 207 | + | // Updates an array of accessible relations. | |
| 208 | + | // | |
| 209 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 210 | + | // relation change must be communicated to assistive technologies. | |
| 211 | + | // | |
| 212 | + | // This function is meant to be used by language bindings. | |
| 213 | + | func (x *SwitchRow) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 214 | + | ||
| 215 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 216 | + | ||
| 217 | + | } | |
| 218 | + | ||
| 219 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 220 | + | // documentation for the value types of accessible states. | |
| 221 | + | // | |
| 222 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 223 | + | // state change must be communicated to assistive technologies. | |
| 224 | + | // | |
| 225 | + | // Example: | |
| 226 | + | // ```c | |
| 227 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 228 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 229 | + | // | |
| 230 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 231 | + | // -1); | |
| 232 | + | // | |
| 233 | + | // ``` | |
| 234 | + | func (x *SwitchRow) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 235 | + | ||
| 236 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 237 | + | ||
| 238 | + | } | |
| 239 | + | ||
| 240 | + | // Updates an array of accessible states. | |
| 241 | + | // | |
| 242 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 243 | + | // state change must be communicated to assistive technologies. | |
| 244 | + | // | |
| 245 | + | // This function is meant to be used by language bindings. | |
| 246 | + | func (x *SwitchRow) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 247 | + | ||
| 248 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 249 | + | ||
| 250 | + | } | |
| 251 | + | ||
| 252 | + | // Gets the action name for @actionable. | |
| 253 | + | func (x *SwitchRow) GetActionName() string { | |
| 254 | + | ||
| 255 | + | cret := gtk.XGtkActionableGetActionName(x.GoPointer()) | |
| 256 | + | return cret | |
| 257 | + | } | |
| 258 | + | ||
| 259 | + | // Gets the current target value of @actionable. | |
| 260 | + | func (x *SwitchRow) GetActionTargetValue() *glib.Variant { | |
| 261 | + | ||
| 262 | + | cret := gtk.XGtkActionableGetActionTargetValue(x.GoPointer()) | |
| 263 | + | return cret | |
| 264 | + | } | |
| 265 | + | ||
| 266 | + | // Specifies the name of the action with which this widget should be | |
| 267 | + | // associated. | |
| 268 | + | // | |
| 269 | + | // If @action_name is %NULL then the widget will be unassociated from | |
| 270 | + | // any previous action. | |
| 271 | + | // | |
| 272 | + | // Usually this function is used when the widget is located (or will be | |
| 273 | + | // located) within the hierarchy of a `GtkApplicationWindow`. | |
| 274 | + | // | |
| 275 | + | // Names are of the form “win.save” or “app.quit” for actions on the | |
| 276 | + | // containing [class@ApplicationWindow] or its associated [class@Application], | |
| 277 | + | // respectively. This is the same form used for actions in the [class@Gio.Menu] | |
| 278 | + | // associated with the window. | |
| 279 | + | func (x *SwitchRow) SetActionName(ActionNameVar string) { | |
| 280 | + | ||
| 281 | + | gtk.XGtkActionableSetActionName(x.GoPointer(), ActionNameVar) | |
| 282 | + | ||
| 283 | + | } | |
| 284 | + | ||
| 285 | + | // Sets the target of an actionable widget. | |
| 286 | + | // | |
| 287 | + | // This is a convenience function that calls [ctor@GLib.Variant.new] for | |
| 288 | + | // @format_string and uses the result to call | |
| 289 | + | // [method@Gtk.Actionable.set_action_target_value]. | |
| 290 | + | // | |
| 291 | + | // If you are setting a string-valued target and want to set | |
| 292 | + | // the action name at the same time, you can use | |
| 293 | + | // [method@Gtk.Actionable.set_detailed_action_name]. | |
| 294 | + | func (x *SwitchRow) SetActionTarget(FormatStringVar string, varArgs ...interface{}) { | |
| 295 | + | ||
| 296 | + | gtk.XGtkActionableSetActionTarget(x.GoPointer(), FormatStringVar, varArgs...) | |
| 297 | + | ||
| 298 | + | } | |
| 299 | + | ||
| 300 | + | // Sets the target value of an actionable widget. | |
| 301 | + | // | |
| 302 | + | // If @target_value is %NULL then the target value is unset. | |
| 303 | + | // | |
| 304 | + | // The target value has two purposes. First, it is used as the parameter | |
| 305 | + | // to activation of the action associated with the `GtkActionable` widget. | |
| 306 | + | // Second, it is used to determine if the widget should be rendered as | |
| 307 | + | // “active” — the widget is active if the state is equal to the given target. | |
| 308 | + | // | |
| 309 | + | // Consider the example of associating a set of buttons with a [iface@Gio.Action] | |
| 310 | + | // with string state in a typical “radio button” situation. Each button | |
| 311 | + | // will be associated with the same action, but with a different target | |
| 312 | + | // value for that action. Clicking on a particular button will activate | |
| 313 | + | // the action with the target of that button, which will typically cause | |
| 314 | + | // the action’s state to change to that value. Since the action’s state | |
| 315 | + | // is now equal to the target value of the button, the button will now | |
| 316 | + | // be rendered as active (and the other buttons, with different targets, | |
| 317 | + | // rendered inactive). | |
| 318 | + | func (x *SwitchRow) SetActionTargetValue(TargetValueVar *glib.Variant) { | |
| 319 | + | ||
| 320 | + | gtk.XGtkActionableSetActionTargetValue(x.GoPointer(), TargetValueVar) | |
| 321 | + | ||
| 322 | + | } | |
| 323 | + | ||
| 324 | + | // Sets the action-name and associated string target value of an | |
| 325 | + | // actionable widget. | |
| 326 | + | // | |
| 327 | + | // @detailed_action_name is a string in the format accepted by | |
| 328 | + | // [func@Gio.Action.parse_detailed_name]. | |
| 329 | + | func (x *SwitchRow) SetDetailedActionName(DetailedActionNameVar string) { | |
| 330 | + | ||
| 331 | + | gtk.XGtkActionableSetDetailedActionName(x.GoPointer(), DetailedActionNameVar) | |
| 332 | + | ||
| 333 | + | } | |
| 334 | + | ||
| 335 | + | // Gets the ID of the @buildable object. | |
| 336 | + | // | |
| 337 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 338 | + | // of the <object> tag used to construct the @buildable. | |
| 339 | + | func (x *SwitchRow) GetBuildableId() string { | |
| 340 | + | ||
| 341 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 342 | + | return cret | |
| 343 | + | } | |
| 344 | + | ||
| 345 | + | func init() { | |
| 346 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 347 | + | if err != nil { | |
| 348 | + | panic(err) | |
| 349 | + | } | |
| 350 | + | ||
| 351 | + | core.PuregoSafeRegister(&xSwitchRowGLibType, lib, "adw_switch_row_get_type") | |
| 352 | + | ||
| 353 | + | core.PuregoSafeRegister(&xNewSwitchRow, lib, "adw_switch_row_new") | |
| 354 | + | ||
| 355 | + | core.PuregoSafeRegister(&xSwitchRowGetActive, lib, "adw_switch_row_get_active") | |
| 356 | + | core.PuregoSafeRegister(&xSwitchRowSetActive, lib, "adw_switch_row_set_active") | |
| 357 | + | ||
| 358 | + | } | |
M v4/adw/adw-tab-bar.go +25 -1
| @@ -34,7 +34,7 @@ func (x *TabBarClass) GoPointer() uintptr { | |||
| 34 | 34 | // </picture> | |
| 35 | 35 | // | |
| 36 | 36 | // The `AdwTabBar` widget is a tab bar that can be used with conjunction with | |
| 37 | - | // `AdwTabView`. | |
| 37 | + | // `AdwTabView`. It is typically used as a top bar within [class@ToolbarView]. | |
| 38 | 38 | // | |
| 39 | 39 | // `AdwTabBar` can autohide and can optionally contain action widgets on both | |
| 40 | 40 | // sides of the tabs. | |
| @@ -46,6 +46,20 @@ func (x *TabBarClass) GoPointer() uintptr { | |||
| 46 | 46 | // ## CSS nodes | |
| 47 | 47 | // | |
| 48 | 48 | // `AdwTabBar` has a single CSS node with name `tabbar`. | |
| 49 | + | // | |
| 50 | + | // ## Style classes | |
| 51 | + | // | |
| 52 | + | // By default `AdwTabBar` look like a part of an `AdwHeaderBar` and is intended | |
| 53 | + | // to be used directly attached to one or used as a [class@ToolbarView] toolbar. | |
| 54 | + | // The [`.inline`](style-classes.html#inline) style class removes its background, | |
| 55 | + | // so that it can be used in different contexts instead. | |
| 56 | + | // | |
| 57 | + | // <picture> | |
| 58 | + | // | |
| 59 | + | // <source srcset="tab-bar-inline-dark.png" media="(prefers-color-scheme: dark)"> | |
| 60 | + | // <img src="tab-bar-inline.png" alt="tab-bar-inline"> | |
| 61 | + | // | |
| 62 | + | // </picture> | |
| 49 | 63 | type TabBar struct { | |
| 50 | 64 | gtk.Widget | |
| 51 | 65 | } | |
| @@ -114,6 +128,15 @@ func (x *TabBar) GetExpandTabs() bool { | |||
| 114 | 128 | return cret | |
| 115 | 129 | } | |
| 116 | 130 | ||
| 131 | + | var xTabBarGetExtraDragPreferredAction func(uintptr) gdk.DragAction | |
| 132 | + | ||
| 133 | + | // Gets the current action during a drop on the extra_drop_target. | |
| 134 | + | func (x *TabBar) GetExtraDragPreferredAction() gdk.DragAction { | |
| 135 | + | ||
| 136 | + | cret := xTabBarGetExtraDragPreferredAction(x.GoPointer()) | |
| 137 | + | return cret | |
| 138 | + | } | |
| 139 | + | ||
| 117 | 140 | var xTabBarGetExtraDragPreload func(uintptr) bool | |
| 118 | 141 | ||
| 119 | 142 | // Gets whether drop data should be preloaded on hover. | |
| @@ -500,6 +523,7 @@ func init() { | |||
| 500 | 523 | core.PuregoSafeRegister(&xTabBarGetAutohide, lib, "adw_tab_bar_get_autohide") | |
| 501 | 524 | core.PuregoSafeRegister(&xTabBarGetEndActionWidget, lib, "adw_tab_bar_get_end_action_widget") | |
| 502 | 525 | core.PuregoSafeRegister(&xTabBarGetExpandTabs, lib, "adw_tab_bar_get_expand_tabs") | |
| 526 | + | core.PuregoSafeRegister(&xTabBarGetExtraDragPreferredAction, lib, "adw_tab_bar_get_extra_drag_preferred_action") | |
| 503 | 527 | core.PuregoSafeRegister(&xTabBarGetExtraDragPreload, lib, "adw_tab_bar_get_extra_drag_preload") | |
| 504 | 528 | core.PuregoSafeRegister(&xTabBarGetInverted, lib, "adw_tab_bar_get_inverted") | |
| 505 | 529 | core.PuregoSafeRegister(&xTabBarGetIsOverflowing, lib, "adw_tab_bar_get_is_overflowing") | |
M v4/adw/adw-tab-overview.go +11 -1
| @@ -151,6 +151,15 @@ func (x *TabOverview) GetEnableSearch() bool { | |||
| 151 | 151 | return cret | |
| 152 | 152 | } | |
| 153 | 153 | ||
| 154 | + | var xTabOverviewGetExtraDragPreferredAction func(uintptr) gdk.DragAction | |
| 155 | + | ||
| 156 | + | // Gets the current action during a drop on the extra_drop_target. | |
| 157 | + | func (x *TabOverview) GetExtraDragPreferredAction() gdk.DragAction { | |
| 158 | + | ||
| 159 | + | cret := xTabOverviewGetExtraDragPreferredAction(x.GoPointer()) | |
| 160 | + | return cret | |
| 161 | + | } | |
| 162 | + | ||
| 154 | 163 | var xTabOverviewGetExtraDragPreload func(uintptr) bool | |
| 155 | 164 | ||
| 156 | 165 | // Gets whether drop data should be preloaded on hover. | |
| @@ -383,7 +392,7 @@ func (c *TabOverview) SetGoPointer(ptr uintptr) { | |||
| 383 | 392 | c.Ptr = ptr | |
| 384 | 393 | } | |
| 385 | 394 | ||
| 386 | - | // Emitted when a tab needs to be created; | |
| 395 | + | // Emitted when a tab needs to be created. | |
| 387 | 396 | // | |
| 388 | 397 | // This can happen after the new tab button has been pressed, see | |
| 389 | 398 | // [property@TabOverview:enable-new-tab]. | |
| @@ -619,6 +628,7 @@ func init() { | |||
| 619 | 628 | core.PuregoSafeRegister(&xTabOverviewGetChild, lib, "adw_tab_overview_get_child") | |
| 620 | 629 | core.PuregoSafeRegister(&xTabOverviewGetEnableNewTab, lib, "adw_tab_overview_get_enable_new_tab") | |
| 621 | 630 | core.PuregoSafeRegister(&xTabOverviewGetEnableSearch, lib, "adw_tab_overview_get_enable_search") | |
| 631 | + | core.PuregoSafeRegister(&xTabOverviewGetExtraDragPreferredAction, lib, "adw_tab_overview_get_extra_drag_preferred_action") | |
| 622 | 632 | core.PuregoSafeRegister(&xTabOverviewGetExtraDragPreload, lib, "adw_tab_overview_get_extra_drag_preload") | |
| 623 | 633 | core.PuregoSafeRegister(&xTabOverviewGetInverted, lib, "adw_tab_overview_get_inverted") | |
| 624 | 634 | core.PuregoSafeRegister(&xTabOverviewGetOpen, lib, "adw_tab_overview_get_open") | |
M v4/adw/adw-tab-view.go +5 -2
| @@ -53,10 +53,10 @@ const ( | |||
| 53 | 53 | ||
| 54 | 54 | // No shortcuts | |
| 55 | 55 | TabViewShortcutNoneValue TabViewShortcuts = 0 | |
| 56 | - | // <kbd>Ctrl</kbd>+<kbd>Tab</kbd> - switch to the next page, with looping | |
| 56 | + | // <kbd>Ctrl</kbd>+<kbd>Tab</kbd> - switch to the next page | |
| 57 | 57 | TabViewShortcutControlTabValue TabViewShortcuts = 1 | |
| 58 | 58 | // <kbd>Shift</kbd>+<kbd>Ctrl</kbd>+<kbd>Tab</kbd> - switch to the previous | |
| 59 | - | // page, with looping | |
| 59 | + | // page | |
| 60 | 60 | TabViewShortcutControlShiftTabValue TabViewShortcuts = 2 | |
| 61 | 61 | // <kbd>Ctrl</kbd>+<kbd>Page Up</kbd> - switch to the previous page | |
| 62 | 62 | TabViewShortcutControlPageUpValue TabViewShortcuts = 4 | |
| @@ -1325,6 +1325,9 @@ func (c *TabView) SetGoPointer(ptr uintptr) { | |||
| 1325 | 1325 | // | |
| 1326 | 1326 | // A typical reason to connect to this signal is to show a confirmation dialog | |
| 1327 | 1327 | // for closing a tab. | |
| 1328 | + | // | |
| 1329 | + | // The signal handler should return `GDK_EVENT_STOP` to stop propagation or | |
| 1330 | + | // `GDK_EVENT_CONTINUE` to invoke the default handler. | |
| 1328 | 1331 | func (x *TabView) ConnectClosePage(cb *func(TabView, uintptr) bool) uint32 { | |
| 1329 | 1332 | cbPtr := uintptr(unsafe.Pointer(cb)) | |
| 1330 | 1333 | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |
M v4/adw/adw-toast.go +25 -0
| @@ -65,6 +65,9 @@ const ( | |||
| 65 | 65 | // [property@Toast:priority] determines how it behaves if another toast is | |
| 66 | 66 | // already being displayed. | |
| 67 | 67 | // | |
| 68 | + | // Toast titles use Pango markup by default, set [property@Toast:use-markup] to | |
| 69 | + | // `FALSE` if this is unwanted. | |
| 70 | + | // | |
| 68 | 71 | // [property@Toast:custom-title] can be used to replace the title label with a | |
| 69 | 72 | // custom widget. | |
| 70 | 73 | // | |
| @@ -315,6 +318,15 @@ func (x *Toast) GetTitle() string { | |||
| 315 | 318 | return cret | |
| 316 | 319 | } | |
| 317 | 320 | ||
| 321 | + | var xToastGetUseMarkup func(uintptr) bool | |
| 322 | + | ||
| 323 | + | // Gets whether to use Pango markup for the toast title. | |
| 324 | + | func (x *Toast) GetUseMarkup() bool { | |
| 325 | + | ||
| 326 | + | cret := xToastGetUseMarkup(x.GoPointer()) | |
| 327 | + | return cret | |
| 328 | + | } | |
| 329 | + | ||
| 318 | 330 | var xToastSetActionName func(uintptr, string) | |
| 319 | 331 | ||
| 320 | 332 | // Sets the name of the associated action. | |
| @@ -445,6 +457,17 @@ func (x *Toast) SetTitle(TitleVar string) { | |||
| 445 | 457 | ||
| 446 | 458 | } | |
| 447 | 459 | ||
| 460 | + | var xToastSetUseMarkup func(uintptr, bool) | |
| 461 | + | ||
| 462 | + | // Whether to use Pango markup for the toast title. | |
| 463 | + | // | |
| 464 | + | // See also [func@Pango.parse_markup]. | |
| 465 | + | func (x *Toast) SetUseMarkup(UseMarkupVar bool) { | |
| 466 | + | ||
| 467 | + | xToastSetUseMarkup(x.GoPointer(), UseMarkupVar) | |
| 468 | + | ||
| 469 | + | } | |
| 470 | + | ||
| 448 | 471 | func (c *Toast) GoPointer() uintptr { | |
| 449 | 472 | return c.Ptr | |
| 450 | 473 | } | |
| @@ -516,6 +539,7 @@ func init() { | |||
| 516 | 539 | core.PuregoSafeRegister(&xToastGetPriority, lib, "adw_toast_get_priority") | |
| 517 | 540 | core.PuregoSafeRegister(&xToastGetTimeout, lib, "adw_toast_get_timeout") | |
| 518 | 541 | core.PuregoSafeRegister(&xToastGetTitle, lib, "adw_toast_get_title") | |
| 542 | + | core.PuregoSafeRegister(&xToastGetUseMarkup, lib, "adw_toast_get_use_markup") | |
| 519 | 543 | core.PuregoSafeRegister(&xToastSetActionName, lib, "adw_toast_set_action_name") | |
| 520 | 544 | core.PuregoSafeRegister(&xToastSetActionTarget, lib, "adw_toast_set_action_target") | |
| 521 | 545 | core.PuregoSafeRegister(&xToastSetActionTargetValue, lib, "adw_toast_set_action_target_value") | |
| @@ -525,5 +549,6 @@ func init() { | |||
| 525 | 549 | core.PuregoSafeRegister(&xToastSetPriority, lib, "adw_toast_set_priority") | |
| 526 | 550 | core.PuregoSafeRegister(&xToastSetTimeout, lib, "adw_toast_set_timeout") | |
| 527 | 551 | core.PuregoSafeRegister(&xToastSetTitle, lib, "adw_toast_set_title") | |
| 552 | + | core.PuregoSafeRegister(&xToastSetUseMarkup, lib, "adw_toast_set_use_markup") | |
| 528 | 553 | ||
| 529 | 554 | } | |
A v4/adw/adw-toolbar-view.go +680 -0
| @@ -0,0 +1,680 @@ | |||
| 1 | + | // Package adw was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT | |
| 2 | + | package adw | |
| 3 | + | ||
| 4 | + | import ( | |
| 5 | + | "structs" | |
| 6 | + | "unsafe" | |
| 7 | + | ||
| 8 | + | "github.com/jwijenbergh/purego" | |
| 9 | + | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 12 | + | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| 13 | + | ) | |
| 14 | + | ||
| 15 | + | type ToolbarViewClass struct { | |
| 16 | + | _ structs.HostLayout | |
| 17 | + | ||
| 18 | + | ParentClass uintptr | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | func (x *ToolbarViewClass) GoPointer() uintptr { | |
| 22 | + | return uintptr(unsafe.Pointer(x)) | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | // Describes the possible top or bottom bar styles in an [class@ToolbarView] | |
| 26 | + | // widget. | |
| 27 | + | // | |
| 28 | + | // `ADW_TOOLBAR_FLAT` is suitable for simple content, such as | |
| 29 | + | // [class@StatusPage] or [class@PreferencesPage], where the background at the | |
| 30 | + | // top and bottom parts of the page is uniform. Additionally, windows with | |
| 31 | + | // sidebars should always use this style. | |
| 32 | + | // | |
| 33 | + | // <picture style="min-width: 33%; display: inline-block;"> | |
| 34 | + | // | |
| 35 | + | // <source srcset="toolbar-view-flat-1-dark.png" media="(prefers-color-scheme: dark)"> | |
| 36 | + | // <img src="toolbar-view-flat-1.png" alt="toolbar-view-flat-1"> | |
| 37 | + | // | |
| 38 | + | // </picture> | |
| 39 | + | // <picture style="min-width: 33%; display: inline-block;"> | |
| 40 | + | // | |
| 41 | + | // <source srcset="toolbar-view-flat-2-dark.png" media="(prefers-color-scheme: dark)"> | |
| 42 | + | // <img src="toolbar-view-flat-2.png" alt="toolbar-view-flat-2"> | |
| 43 | + | // | |
| 44 | + | // </picture> | |
| 45 | + | // | |
| 46 | + | // `ADW_TOOLBAR_RAISED` style is suitable for content such as | |
| 47 | + | // [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html), | |
| 48 | + | // where some elements are directly adjacent to the top/bottom bars, or | |
| 49 | + | // [class@TabView], where each page can have a different background. | |
| 50 | + | // | |
| 51 | + | // `ADW_TOOLBAR_RAISED_BORDER` style is similar to `ADW_TOOLBAR_RAISED`, but | |
| 52 | + | // with the shadow replaced with a more subtle border. It's intended to be used | |
| 53 | + | // in applications like image viewers, where a shadow over the content might be | |
| 54 | + | // undesired. | |
| 55 | + | // | |
| 56 | + | // <picture style="min-width: 33%; display: inline-block;"> | |
| 57 | + | // | |
| 58 | + | // <source srcset="toolbar-view-raised-dark.png" media="(prefers-color-scheme: dark)"> | |
| 59 | + | // <img src="toolbar-view-raised.png" alt="toolbar-view-raised"> | |
| 60 | + | // | |
| 61 | + | // </picture> | |
| 62 | + | // <picture style="min-width: 33%; display: inline-block;"> | |
| 63 | + | // | |
| 64 | + | // <source srcset="toolbar-view-raised-border-dark.png" media="(prefers-color-scheme: dark)"> | |
| 65 | + | // <img src="toolbar-view-raised-border.png" alt="toolbar-view-raised-border"> | |
| 66 | + | // | |
| 67 | + | // </picture> | |
| 68 | + | // | |
| 69 | + | // See [property@ToolbarView:top-bar-style] and | |
| 70 | + | // [property@ToolbarView:bottom-bar-style]. | |
| 71 | + | // | |
| 72 | + | // New values may be added to this enumeration over time. | |
| 73 | + | type ToolbarStyle int | |
| 74 | + | ||
| 75 | + | var xToolbarStyleGLibType func() types.GType | |
| 76 | + | ||
| 77 | + | func ToolbarStyleGLibType() types.GType { | |
| 78 | + | return xToolbarStyleGLibType() | |
| 79 | + | } | |
| 80 | + | ||
| 81 | + | const ( | |
| 82 | + | ||
| 83 | + | // No background, shadow only for scrolled content | |
| 84 | + | ToolbarFlatValue ToolbarStyle = 0 | |
| 85 | + | // Opaque background with a persistent shadow | |
| 86 | + | ToolbarRaisedValue ToolbarStyle = 1 | |
| 87 | + | // Opaque background with a persistent border | |
| 88 | + | ToolbarRaisedBorderValue ToolbarStyle = 2 | |
| 89 | + | ) | |
| 90 | + | ||
| 91 | + | // A widget containing a page, as well as top and/or bottom bars. | |
| 92 | + | // | |
| 93 | + | // <picture> | |
| 94 | + | // | |
| 95 | + | // <source srcset="toolbar-view-dark.png" media="(prefers-color-scheme: dark)"> | |
| 96 | + | // <img src="toolbar-view.png" alt="toolbar-view"> | |
| 97 | + | // | |
| 98 | + | // </picture> | |
| 99 | + | // | |
| 100 | + | // `AdwToolbarView` has a single content widget and one or multiple top and | |
| 101 | + | // bottom bars, shown at the top and bottom sides respectively. | |
| 102 | + | // | |
| 103 | + | // Example of an `AdwToolbarView` UI definition: | |
| 104 | + | // ```xml | |
| 105 | + | // <object class="AdwToolbarView"> | |
| 106 | + | // | |
| 107 | + | // <child type="top"> | |
| 108 | + | // <object class="AdwHeaderBar"/> | |
| 109 | + | // </child> | |
| 110 | + | // <property name="content"> | |
| 111 | + | // <object class="AdwPreferencesPage"> | |
| 112 | + | // <!-- ... --> | |
| 113 | + | // </object> | |
| 114 | + | // </property> | |
| 115 | + | // | |
| 116 | + | // </object> | |
| 117 | + | // ``` | |
| 118 | + | // | |
| 119 | + | // The following kinds of top and bottom bars are supported: | |
| 120 | + | // | |
| 121 | + | // - [class@HeaderBar] | |
| 122 | + | // - [class@TabBar] | |
| 123 | + | // - [class@ViewSwitcherBar] | |
| 124 | + | // - [class@Gtk.ActionBar] | |
| 125 | + | // - [class@Gtk.HeaderBar] | |
| 126 | + | // - [class@Gtk.PopoverMenuBar] | |
| 127 | + | // - [class@Gtk.SearchBar] | |
| 128 | + | // - Any [class@Gtk.Box] or a similar widget with the | |
| 129 | + | // [`.toolbar`](style-classes.html#toolbars) style class | |
| 130 | + | // | |
| 131 | + | // By default, top and bottom bars are flat and scrolling content has a subtle | |
| 132 | + | // undershoot shadow, same as when using the | |
| 133 | + | // [`.undershoot-top`](style-classes.html#undershoot-indicators) and | |
| 134 | + | // [`.undershoot-bottom`](style-classes.html#undershoot-indicators) style | |
| 135 | + | // classes. This works well in most cases, e.g. with [class@StatusPage] or | |
| 136 | + | // [class@PreferencesPage], where the background at the top and bottom parts of | |
| 137 | + | // the page is uniform. Additionally, windows with sidebars should always use | |
| 138 | + | // this style. | |
| 139 | + | // | |
| 140 | + | // [property@ToolbarView:top-bar-style] and | |
| 141 | + | // [property@ToolbarView:bottom-bar-style] properties can be used add an opaque | |
| 142 | + | // background and a persistent shadow to top and bottom bars, this can be useful | |
| 143 | + | // for content such as [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html), | |
| 144 | + | // where some elements are adjacent to the top/bottom bars, or [class@TabView], | |
| 145 | + | // where each page can have a different background. | |
| 146 | + | // | |
| 147 | + | // <picture style="min-width: 33%; display: inline-block;"> | |
| 148 | + | // | |
| 149 | + | // <source srcset="toolbar-view-flat-1-dark.png" media="(prefers-color-scheme: dark)"> | |
| 150 | + | // <img src="toolbar-view-flat-1.png" alt="toolbar-view-flat-1"> | |
| 151 | + | // | |
| 152 | + | // </picture> | |
| 153 | + | // <picture style="min-width: 33%; display: inline-block;"> | |
| 154 | + | // | |
| 155 | + | // <source srcset="toolbar-view-flat-2-dark.png" media="(prefers-color-scheme: dark)"> | |
| 156 | + | // <img src="toolbar-view-flat-2.png" alt="toolbar-view-flat-2"> | |
| 157 | + | // | |
| 158 | + | // </picture> | |
| 159 | + | // <picture style="min-width: 33%; display: inline-block;"> | |
| 160 | + | // | |
| 161 | + | // <source srcset="toolbar-view-raised-dark.png" media="(prefers-color-scheme: dark)"> | |
| 162 | + | // <img src="toolbar-view-raised.png" alt="toolbar-view-raised"> | |
| 163 | + | // | |
| 164 | + | // </picture> | |
| 165 | + | // | |
| 166 | + | // `AdwToolbarView` ensures the top and bottom bars have consistent backdrop | |
| 167 | + | // styles and vertical spacing. For comparison: | |
| 168 | + | // | |
| 169 | + | // <picture style="min-width: 40%; display: inline-block;"> | |
| 170 | + | // | |
| 171 | + | // <source srcset="toolbar-view-spacing-dark.png" media="(prefers-color-scheme: dark)"> | |
| 172 | + | // <img src="toolbar-view-spacing.png" alt="toolbar-view-spacing"> | |
| 173 | + | // | |
| 174 | + | // </picture> | |
| 175 | + | // <picture style="min-width: 40%; display: inline-block;"> | |
| 176 | + | // | |
| 177 | + | // <source srcset="toolbar-view-spacing-box-dark.png" media="(prefers-color-scheme: dark)"> | |
| 178 | + | // <img src="toolbar-view-spacing-box.png" alt="toolbar-view-spacing-box"> | |
| 179 | + | // | |
| 180 | + | // </picture> | |
| 181 | + | // | |
| 182 | + | // Any top and bottom bars can also be dragged to move the window, equivalent | |
| 183 | + | // to putting them into a [class@Gtk.WindowHandle]. | |
| 184 | + | // | |
| 185 | + | // Content is typically place between top and bottom bars, but can also extend | |
| 186 | + | // behind them. This is controlled with the | |
| 187 | + | // [property@ToolbarView:extend-content-to-top-edge] and | |
| 188 | + | // [property@ToolbarView:extend-content-to-bottom-edge] properties. | |
| 189 | + | // | |
| 190 | + | // Top and bottom bars can be hidden and revealed with an animation using the | |
| 191 | + | // [property@ToolbarView:reveal-top-bars] and | |
| 192 | + | // [property@ToolbarView:reveal-bottom-bars] properties. | |
| 193 | + | // | |
| 194 | + | // ## `AdwToolbarView` as `GtkBuildable` | |
| 195 | + | // | |
| 196 | + | // The `AdwToolbarView` implementation of the [iface@Gtk.Buildable] interface | |
| 197 | + | // supports adding a top bar by specifying “top” as the “type” attribute of a | |
| 198 | + | // `<child>` element, or adding a bottom bar by specifying “bottom”. | |
| 199 | + | // | |
| 200 | + | // ## Accessibility | |
| 201 | + | // | |
| 202 | + | // `AdwToolbarView` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role. | |
| 203 | + | type ToolbarView struct { | |
| 204 | + | gtk.Widget | |
| 205 | + | } | |
| 206 | + | ||
| 207 | + | var xToolbarViewGLibType func() types.GType | |
| 208 | + | ||
| 209 | + | func ToolbarViewGLibType() types.GType { | |
| 210 | + | return xToolbarViewGLibType() | |
| 211 | + | } | |
| 212 | + | ||
| 213 | + | func ToolbarViewNewFromInternalPtr(ptr uintptr) *ToolbarView { | |
| 214 | + | cls := &ToolbarView{} | |
| 215 | + | cls.Ptr = ptr | |
| 216 | + | return cls | |
| 217 | + | } | |
| 218 | + | ||
| 219 | + | var xNewToolbarView func() uintptr | |
| 220 | + | ||
| 221 | + | // Creates a new `AdwToolbarView`. | |
| 222 | + | func NewToolbarView() *ToolbarView { | |
| 223 | + | var cls *ToolbarView | |
| 224 | + | ||
| 225 | + | cret := xNewToolbarView() | |
| 226 | + | ||
| 227 | + | if cret == 0 { | |
| 228 | + | return nil | |
| 229 | + | } | |
| 230 | + | gobject.IncreaseRef(cret) | |
| 231 | + | cls = &ToolbarView{} | |
| 232 | + | cls.Ptr = cret | |
| 233 | + | return cls | |
| 234 | + | } | |
| 235 | + | ||
| 236 | + | var xToolbarViewAddBottomBar func(uintptr, uintptr) | |
| 237 | + | ||
| 238 | + | // Adds a bottom bar to @self. | |
| 239 | + | func (x *ToolbarView) AddBottomBar(WidgetVar *gtk.Widget) { | |
| 240 | + | ||
| 241 | + | xToolbarViewAddBottomBar(x.GoPointer(), WidgetVar.GoPointer()) | |
| 242 | + | ||
| 243 | + | } | |
| 244 | + | ||
| 245 | + | var xToolbarViewAddTopBar func(uintptr, uintptr) | |
| 246 | + | ||
| 247 | + | // Adds a top bar to @self. | |
| 248 | + | func (x *ToolbarView) AddTopBar(WidgetVar *gtk.Widget) { | |
| 249 | + | ||
| 250 | + | xToolbarViewAddTopBar(x.GoPointer(), WidgetVar.GoPointer()) | |
| 251 | + | ||
| 252 | + | } | |
| 253 | + | ||
| 254 | + | var xToolbarViewGetBottomBarHeight func(uintptr) int | |
| 255 | + | ||
| 256 | + | // Gets the current bottom bar height for @self. | |
| 257 | + | // | |
| 258 | + | // Bottom bar height does change depending on | |
| 259 | + | // [property@ToolbarView:reveal-bottom-bars], including during the transition. | |
| 260 | + | // | |
| 261 | + | // See [method@ToolbarView.get_top_bar_height]. | |
| 262 | + | func (x *ToolbarView) GetBottomBarHeight() int { | |
| 263 | + | ||
| 264 | + | cret := xToolbarViewGetBottomBarHeight(x.GoPointer()) | |
| 265 | + | return cret | |
| 266 | + | } | |
| 267 | + | ||
| 268 | + | var xToolbarViewGetBottomBarStyle func(uintptr) ToolbarStyle | |
| 269 | + | ||
| 270 | + | // Gets appearance of the bottom bars for @self. | |
| 271 | + | func (x *ToolbarView) GetBottomBarStyle() ToolbarStyle { | |
| 272 | + | ||
| 273 | + | cret := xToolbarViewGetBottomBarStyle(x.GoPointer()) | |
| 274 | + | return cret | |
| 275 | + | } | |
| 276 | + | ||
| 277 | + | var xToolbarViewGetContent func(uintptr) uintptr | |
| 278 | + | ||
| 279 | + | // Gets the content widget for @self. | |
| 280 | + | func (x *ToolbarView) GetContent() *gtk.Widget { | |
| 281 | + | var cls *gtk.Widget | |
| 282 | + | ||
| 283 | + | cret := xToolbarViewGetContent(x.GoPointer()) | |
| 284 | + | ||
| 285 | + | if cret == 0 { | |
| 286 | + | return nil | |
| 287 | + | } | |
| 288 | + | gobject.IncreaseRef(cret) | |
| 289 | + | cls = >k.Widget{} | |
| 290 | + | cls.Ptr = cret | |
| 291 | + | return cls | |
| 292 | + | } | |
| 293 | + | ||
| 294 | + | var xToolbarViewGetExtendContentToBottomEdge func(uintptr) bool | |
| 295 | + | ||
| 296 | + | // Gets whether the content widget can extend behind bottom bars. | |
| 297 | + | func (x *ToolbarView) GetExtendContentToBottomEdge() bool { | |
| 298 | + | ||
| 299 | + | cret := xToolbarViewGetExtendContentToBottomEdge(x.GoPointer()) | |
| 300 | + | return cret | |
| 301 | + | } | |
| 302 | + | ||
| 303 | + | var xToolbarViewGetExtendContentToTopEdge func(uintptr) bool | |
| 304 | + | ||
| 305 | + | // Gets whether the content widget can extend behind top bars. | |
| 306 | + | func (x *ToolbarView) GetExtendContentToTopEdge() bool { | |
| 307 | + | ||
| 308 | + | cret := xToolbarViewGetExtendContentToTopEdge(x.GoPointer()) | |
| 309 | + | return cret | |
| 310 | + | } | |
| 311 | + | ||
| 312 | + | var xToolbarViewGetRevealBottomBars func(uintptr) bool | |
| 313 | + | ||
| 314 | + | // Gets whether bottom bars are revealed for @self. | |
| 315 | + | func (x *ToolbarView) GetRevealBottomBars() bool { | |
| 316 | + | ||
| 317 | + | cret := xToolbarViewGetRevealBottomBars(x.GoPointer()) | |
| 318 | + | return cret | |
| 319 | + | } | |
| 320 | + | ||
| 321 | + | var xToolbarViewGetRevealTopBars func(uintptr) bool | |
| 322 | + | ||
| 323 | + | // Gets whether top bars are revealed for @self. | |
| 324 | + | func (x *ToolbarView) GetRevealTopBars() bool { | |
| 325 | + | ||
| 326 | + | cret := xToolbarViewGetRevealTopBars(x.GoPointer()) | |
| 327 | + | return cret | |
| 328 | + | } | |
| 329 | + | ||
| 330 | + | var xToolbarViewGetTopBarHeight func(uintptr) int | |
| 331 | + | ||
| 332 | + | // Gets the current top bar height for @self. | |
| 333 | + | // | |
| 334 | + | // Top bar height does change depending on | |
| 335 | + | // [property@ToolbarView:reveal-top-bars], including during the transition. | |
| 336 | + | // | |
| 337 | + | // See [method@ToolbarView.get_bottom_bar_height]. | |
| 338 | + | func (x *ToolbarView) GetTopBarHeight() int { | |
| 339 | + | ||
| 340 | + | cret := xToolbarViewGetTopBarHeight(x.GoPointer()) | |
| 341 | + | return cret | |
| 342 | + | } | |
| 343 | + | ||
| 344 | + | var xToolbarViewGetTopBarStyle func(uintptr) ToolbarStyle | |
| 345 | + | ||
| 346 | + | // Gets appearance of the top bars for @self. | |
| 347 | + | func (x *ToolbarView) GetTopBarStyle() ToolbarStyle { | |
| 348 | + | ||
| 349 | + | cret := xToolbarViewGetTopBarStyle(x.GoPointer()) | |
| 350 | + | return cret | |
| 351 | + | } | |
| 352 | + | ||
| 353 | + | var xToolbarViewRemove func(uintptr, uintptr) | |
| 354 | + | ||
| 355 | + | // Removes a child from @self. | |
| 356 | + | func (x *ToolbarView) Remove(WidgetVar *gtk.Widget) { | |
| 357 | + | ||
| 358 | + | xToolbarViewRemove(x.GoPointer(), WidgetVar.GoPointer()) | |
| 359 | + | ||
| 360 | + | } | |
| 361 | + | ||
| 362 | + | var xToolbarViewSetBottomBarStyle func(uintptr, ToolbarStyle) | |
| 363 | + | ||
| 364 | + | // Sets appearance of the bottom bars for @self. | |
| 365 | + | // | |
| 366 | + | // If set to `ADW_TOOLBAR_FLAT`, bottom bars are flat and scrolling content has | |
| 367 | + | // a subtle undershoot shadow when touching them, same as the | |
| 368 | + | // [`.undershoot-bottom`](style-classes.html#undershoot-indicators) | |
| 369 | + | // style class. This works well for simple content, e.g. [class@StatusPage] or | |
| 370 | + | // [class@PreferencesPage], where the background at the bottom of the page is | |
| 371 | + | // uniform. Additionally, windows with sidebars should always use this style. | |
| 372 | + | // | |
| 373 | + | // Undershoot shadow is only present if a bottom bar is actually present and | |
| 374 | + | // visible. It is also never present if | |
| 375 | + | // [property@ToolbarView:extend-content-to-bottom-edge] is set to `TRUE`. | |
| 376 | + | // | |
| 377 | + | // If set to `ADW_TOOLBAR_RAISED`, bottom bars have an opaque background and a | |
| 378 | + | // persistent shadow, this is suitable for content such as | |
| 379 | + | // [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html), | |
| 380 | + | // where some elements are directly adjacent to the bottom bars, or | |
| 381 | + | // [class@TabView], where each page can have a different background. | |
| 382 | + | // | |
| 383 | + | // `ADW_TOOLBAR_RAISED_BORDER` is similar to `ADW_TOOLBAR_RAISED`, but the | |
| 384 | + | // shadow is replaced with a more subtle border. This can be useful for | |
| 385 | + | // applications like image viewers. | |
| 386 | + | // | |
| 387 | + | // See also [method@ToolbarView.set_top_bar_style]. | |
| 388 | + | func (x *ToolbarView) SetBottomBarStyle(StyleVar ToolbarStyle) { | |
| 389 | + | ||
| 390 | + | xToolbarViewSetBottomBarStyle(x.GoPointer(), StyleVar) | |
| 391 | + | ||
| 392 | + | } | |
| 393 | + | ||
| 394 | + | var xToolbarViewSetContent func(uintptr, uintptr) | |
| 395 | + | ||
| 396 | + | // Sets the content widget for @self. | |
| 397 | + | func (x *ToolbarView) SetContent(ContentVar *gtk.Widget) { | |
| 398 | + | ||
| 399 | + | xToolbarViewSetContent(x.GoPointer(), ContentVar.GoPointer()) | |
| 400 | + | ||
| 401 | + | } | |
| 402 | + | ||
| 403 | + | var xToolbarViewSetExtendContentToBottomEdge func(uintptr, bool) | |
| 404 | + | ||
| 405 | + | // Sets whether the content widget can extend behind bottom bars. | |
| 406 | + | // | |
| 407 | + | // This can be used in combination with [property@ToolbarView:reveal-bottom-bars] | |
| 408 | + | // to show and hide toolbars in fullscreen. | |
| 409 | + | // | |
| 410 | + | // See [method@ToolbarView.set_extend_content_to_top_edge]. | |
| 411 | + | func (x *ToolbarView) SetExtendContentToBottomEdge(ExtendVar bool) { | |
| 412 | + | ||
| 413 | + | xToolbarViewSetExtendContentToBottomEdge(x.GoPointer(), ExtendVar) | |
| 414 | + | ||
| 415 | + | } | |
| 416 | + | ||
| 417 | + | var xToolbarViewSetExtendContentToTopEdge func(uintptr, bool) | |
| 418 | + | ||
| 419 | + | // Sets whether the content widget can extend behind top bars. | |
| 420 | + | // | |
| 421 | + | // This can be used in combination with [property@ToolbarView:reveal-top-bars] | |
| 422 | + | // to show and hide toolbars in fullscreen. | |
| 423 | + | // | |
| 424 | + | // See [method@ToolbarView.set_extend_content_to_bottom_edge]. | |
| 425 | + | func (x *ToolbarView) SetExtendContentToTopEdge(ExtendVar bool) { | |
| 426 | + | ||
| 427 | + | xToolbarViewSetExtendContentToTopEdge(x.GoPointer(), ExtendVar) | |
| 428 | + | ||
| 429 | + | } | |
| 430 | + | ||
| 431 | + | var xToolbarViewSetRevealBottomBars func(uintptr, bool) | |
| 432 | + | ||
| 433 | + | // Sets whether bottom bars are revealed for @self. | |
| 434 | + | // | |
| 435 | + | // The transition will be animated. | |
| 436 | + | // | |
| 437 | + | // This can be used in combination with | |
| 438 | + | // [property@ToolbarView:extend-content-to-bottom-edge] to show and hide | |
| 439 | + | // toolbars in fullscreen. | |
| 440 | + | // | |
| 441 | + | // See [method@ToolbarView.set_reveal_top_bars]. | |
| 442 | + | func (x *ToolbarView) SetRevealBottomBars(RevealVar bool) { | |
| 443 | + | ||
| 444 | + | xToolbarViewSetRevealBottomBars(x.GoPointer(), RevealVar) | |
| 445 | + | ||
| 446 | + | } | |
| 447 | + | ||
| 448 | + | var xToolbarViewSetRevealTopBars func(uintptr, bool) | |
| 449 | + | ||
| 450 | + | // Sets whether top bars are revealed for @self. | |
| 451 | + | // | |
| 452 | + | // The transition will be animated. | |
| 453 | + | // | |
| 454 | + | // This can be used in combination with | |
| 455 | + | // [property@ToolbarView:extend-content-to-top-edge] to show and hide toolbars | |
| 456 | + | // in fullscreen. | |
| 457 | + | // | |
| 458 | + | // See [method@ToolbarView.set_reveal_bottom_bars]. | |
| 459 | + | func (x *ToolbarView) SetRevealTopBars(RevealVar bool) { | |
| 460 | + | ||
| 461 | + | xToolbarViewSetRevealTopBars(x.GoPointer(), RevealVar) | |
| 462 | + | ||
| 463 | + | } | |
| 464 | + | ||
| 465 | + | var xToolbarViewSetTopBarStyle func(uintptr, ToolbarStyle) | |
| 466 | + | ||
| 467 | + | // Sets appearance of the top bars for @self. | |
| 468 | + | // | |
| 469 | + | // If set to `ADW_TOOLBAR_FLAT`, top bars are flat and scrolling content has a | |
| 470 | + | // subtle undershoot shadow when touching them, same as the | |
| 471 | + | // [`.undershoot-top`](style-classes.html#undershoot-indicators) | |
| 472 | + | // style class. This works well for simple content, e.g. [class@StatusPage] or | |
| 473 | + | // [class@PreferencesPage], where the background at the top of the page is | |
| 474 | + | // uniform. Additionally, windows with sidebars should always use this style. | |
| 475 | + | // | |
| 476 | + | // Undershoot shadow is only present if a top bar is actually present and | |
| 477 | + | // visible. It is also never present if | |
| 478 | + | // [property@ToolbarView:extend-content-to-top-edge] is set to `TRUE`. | |
| 479 | + | // | |
| 480 | + | // If set to `ADW_TOOLBAR_RAISED`, top bars have an opaque background and a | |
| 481 | + | // persistent shadow, this is suitable for content such as | |
| 482 | + | // [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html), | |
| 483 | + | // where some elements are directly adjacent to the top bars, or | |
| 484 | + | // [class@TabView], where each page can have a different background. | |
| 485 | + | // | |
| 486 | + | // `ADW_TOOLBAR_RAISED_BORDER` is similar to `ADW_TOOLBAR_RAISED`, but the | |
| 487 | + | // shadow is replaced with a more subtle border. This can be useful for | |
| 488 | + | // applications like image viewers. | |
| 489 | + | // | |
| 490 | + | // See also [method@ToolbarView.set_bottom_bar_style]. | |
| 491 | + | func (x *ToolbarView) SetTopBarStyle(StyleVar ToolbarStyle) { | |
| 492 | + | ||
| 493 | + | xToolbarViewSetTopBarStyle(x.GoPointer(), StyleVar) | |
| 494 | + | ||
| 495 | + | } | |
| 496 | + | ||
| 497 | + | func (c *ToolbarView) GoPointer() uintptr { | |
| 498 | + | return c.Ptr | |
| 499 | + | } | |
| 500 | + | ||
| 501 | + | func (c *ToolbarView) SetGoPointer(ptr uintptr) { | |
| 502 | + | c.Ptr = ptr | |
| 503 | + | } | |
| 504 | + | ||
| 505 | + | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | |
| 506 | + | func (x *ToolbarView) GetAccessibleRole() gtk.AccessibleRole { | |
| 507 | + | ||
| 508 | + | cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) | |
| 509 | + | return cret | |
| 510 | + | } | |
| 511 | + | ||
| 512 | + | // Resets the accessible @property to its default value. | |
| 513 | + | func (x *ToolbarView) ResetProperty(PropertyVar gtk.AccessibleProperty) { | |
| 514 | + | ||
| 515 | + | gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) | |
| 516 | + | ||
| 517 | + | } | |
| 518 | + | ||
| 519 | + | // Resets the accessible @relation to its default value. | |
| 520 | + | func (x *ToolbarView) ResetRelation(RelationVar gtk.AccessibleRelation) { | |
| 521 | + | ||
| 522 | + | gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) | |
| 523 | + | ||
| 524 | + | } | |
| 525 | + | ||
| 526 | + | // Resets the accessible @state to its default value. | |
| 527 | + | func (x *ToolbarView) ResetState(StateVar gtk.AccessibleState) { | |
| 528 | + | ||
| 529 | + | gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar) | |
| 530 | + | ||
| 531 | + | } | |
| 532 | + | ||
| 533 | + | // Updates a list of accessible properties. | |
| 534 | + | // | |
| 535 | + | // See the [enum@Gtk.AccessibleProperty] documentation for the | |
| 536 | + | // value types of accessible properties. | |
| 537 | + | // | |
| 538 | + | // This function should be called by `GtkWidget` types whenever | |
| 539 | + | // an accessible property change must be communicated to assistive | |
| 540 | + | // technologies. | |
| 541 | + | // | |
| 542 | + | // Example: | |
| 543 | + | // ```c | |
| 544 | + | // value = gtk_adjustment_get_value (adjustment); | |
| 545 | + | // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), | |
| 546 | + | // | |
| 547 | + | // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, | |
| 548 | + | // -1); | |
| 549 | + | // | |
| 550 | + | // ``` | |
| 551 | + | func (x *ToolbarView) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { | |
| 552 | + | ||
| 553 | + | gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) | |
| 554 | + | ||
| 555 | + | } | |
| 556 | + | ||
| 557 | + | // Updates an array of accessible properties. | |
| 558 | + | // | |
| 559 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 560 | + | // property change must be communicated to assistive technologies. | |
| 561 | + | // | |
| 562 | + | // This function is meant to be used by language bindings. | |
| 563 | + | func (x *ToolbarView) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { | |
| 564 | + | ||
| 565 | + | gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) | |
| 566 | + | ||
| 567 | + | } | |
| 568 | + | ||
| 569 | + | // Updates a list of accessible relations. | |
| 570 | + | // | |
| 571 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 572 | + | // relation change must be communicated to assistive technologies. | |
| 573 | + | // | |
| 574 | + | // If the [enum@Gtk.AccessibleRelation] requires a list of references, | |
| 575 | + | // you should pass each reference individually, followed by %NULL, e.g. | |
| 576 | + | // | |
| 577 | + | // ```c | |
| 578 | + | // gtk_accessible_update_relation (accessible, | |
| 579 | + | // | |
| 580 | + | // GTK_ACCESSIBLE_RELATION_CONTROLS, | |
| 581 | + | // ref1, NULL, | |
| 582 | + | // GTK_ACCESSIBLE_RELATION_LABELLED_BY, | |
| 583 | + | // ref1, ref2, ref3, NULL, | |
| 584 | + | // -1); | |
| 585 | + | // | |
| 586 | + | // ``` | |
| 587 | + | func (x *ToolbarView) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { | |
| 588 | + | ||
| 589 | + | gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) | |
| 590 | + | ||
| 591 | + | } | |
| 592 | + | ||
| 593 | + | // Updates an array of accessible relations. | |
| 594 | + | // | |
| 595 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 596 | + | // relation change must be communicated to assistive technologies. | |
| 597 | + | // | |
| 598 | + | // This function is meant to be used by language bindings. | |
| 599 | + | func (x *ToolbarView) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { | |
| 600 | + | ||
| 601 | + | gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) | |
| 602 | + | ||
| 603 | + | } | |
| 604 | + | ||
| 605 | + | // Updates a list of accessible states. See the [enum@Gtk.AccessibleState] | |
| 606 | + | // documentation for the value types of accessible states. | |
| 607 | + | // | |
| 608 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 609 | + | // state change must be communicated to assistive technologies. | |
| 610 | + | // | |
| 611 | + | // Example: | |
| 612 | + | // ```c | |
| 613 | + | // value = GTK_ACCESSIBLE_TRISTATE_MIXED; | |
| 614 | + | // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), | |
| 615 | + | // | |
| 616 | + | // GTK_ACCESSIBLE_STATE_CHECKED, value, | |
| 617 | + | // -1); | |
| 618 | + | // | |
| 619 | + | // ``` | |
| 620 | + | func (x *ToolbarView) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { | |
| 621 | + | ||
| 622 | + | gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) | |
| 623 | + | ||
| 624 | + | } | |
| 625 | + | ||
| 626 | + | // Updates an array of accessible states. | |
| 627 | + | // | |
| 628 | + | // This function should be called by `GtkWidget` types whenever an accessible | |
| 629 | + | // state change must be communicated to assistive technologies. | |
| 630 | + | // | |
| 631 | + | // This function is meant to be used by language bindings. | |
| 632 | + | func (x *ToolbarView) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { | |
| 633 | + | ||
| 634 | + | gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) | |
| 635 | + | ||
| 636 | + | } | |
| 637 | + | ||
| 638 | + | // Gets the ID of the @buildable object. | |
| 639 | + | // | |
| 640 | + | // `GtkBuilder` sets the name based on the ID attribute | |
| 641 | + | // of the <object> tag used to construct the @buildable. | |
| 642 | + | func (x *ToolbarView) GetBuildableId() string { | |
| 643 | + | ||
| 644 | + | cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) | |
| 645 | + | return cret | |
| 646 | + | } | |
| 647 | + | ||
| 648 | + | func init() { | |
| 649 | + | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 650 | + | if err != nil { | |
| 651 | + | panic(err) | |
| 652 | + | } | |
| 653 | + | ||
| 654 | + | core.PuregoSafeRegister(&xToolbarStyleGLibType, lib, "adw_toolbar_style_get_type") | |
| 655 | + | ||
| 656 | + | core.PuregoSafeRegister(&xToolbarViewGLibType, lib, "adw_toolbar_view_get_type") | |
| 657 | + | ||
| 658 | + | core.PuregoSafeRegister(&xNewToolbarView, lib, "adw_toolbar_view_new") | |
| 659 | + | ||
| 660 | + | core.PuregoSafeRegister(&xToolbarViewAddBottomBar, lib, "adw_toolbar_view_add_bottom_bar") | |
| 661 | + | core.PuregoSafeRegister(&xToolbarViewAddTopBar, lib, "adw_toolbar_view_add_top_bar") | |
| 662 | + | core.PuregoSafeRegister(&xToolbarViewGetBottomBarHeight, lib, "adw_toolbar_view_get_bottom_bar_height") | |
| 663 | + | core.PuregoSafeRegister(&xToolbarViewGetBottomBarStyle, lib, "adw_toolbar_view_get_bottom_bar_style") | |
| 664 | + | core.PuregoSafeRegister(&xToolbarViewGetContent, lib, "adw_toolbar_view_get_content") | |
| 665 | + | core.PuregoSafeRegister(&xToolbarViewGetExtendContentToBottomEdge, lib, "adw_toolbar_view_get_extend_content_to_bottom_edge") | |
| 666 | + | core.PuregoSafeRegister(&xToolbarViewGetExtendContentToTopEdge, lib, "adw_toolbar_view_get_extend_content_to_top_edge") | |
| 667 | + | core.PuregoSafeRegister(&xToolbarViewGetRevealBottomBars, lib, "adw_toolbar_view_get_reveal_bottom_bars") | |
| 668 | + | core.PuregoSafeRegister(&xToolbarViewGetRevealTopBars, lib, "adw_toolbar_view_get_reveal_top_bars") | |
| 669 | + | core.PuregoSafeRegister(&xToolbarViewGetTopBarHeight, lib, "adw_toolbar_view_get_top_bar_height") | |
| 670 | + | core.PuregoSafeRegister(&xToolbarViewGetTopBarStyle, lib, "adw_toolbar_view_get_top_bar_style") | |
| 671 | + | core.PuregoSafeRegister(&xToolbarViewRemove, lib, "adw_toolbar_view_remove") | |
| 672 | + | core.PuregoSafeRegister(&xToolbarViewSetBottomBarStyle, lib, "adw_toolbar_view_set_bottom_bar_style") | |
| 673 | + | core.PuregoSafeRegister(&xToolbarViewSetContent, lib, "adw_toolbar_view_set_content") | |
| 674 | + | core.PuregoSafeRegister(&xToolbarViewSetExtendContentToBottomEdge, lib, "adw_toolbar_view_set_extend_content_to_bottom_edge") | |
| 675 | + | core.PuregoSafeRegister(&xToolbarViewSetExtendContentToTopEdge, lib, "adw_toolbar_view_set_extend_content_to_top_edge") | |
| 676 | + | core.PuregoSafeRegister(&xToolbarViewSetRevealBottomBars, lib, "adw_toolbar_view_set_reveal_bottom_bars") | |
| 677 | + | core.PuregoSafeRegister(&xToolbarViewSetRevealTopBars, lib, "adw_toolbar_view_set_reveal_top_bars") | |
| 678 | + | core.PuregoSafeRegister(&xToolbarViewSetTopBarStyle, lib, "adw_toolbar_view_set_top_bar_style") | |
| 679 | + | ||
| 680 | + | } | |
M v4/adw/adw-version.go +3 -3
| @@ -10,12 +10,12 @@ const ( | |||
| 10 | 10 | // Adwaita major version component (e.g. 1 if the version is 1.2.3). | |
| 11 | 11 | MAJOR_VERSION int = 1 | |
| 12 | 12 | // Adwaita micro version component (e.g. 3 if the version is 1.2.3). | |
| 13 | - | MICRO_VERSION int = 3 | |
| 13 | + | MICRO_VERSION int = 4 | |
| 14 | 14 | // Adwaita minor version component (e.g. 2 if the version is 1.2.3). | |
| 15 | - | MINOR_VERSION int = 3 | |
| 15 | + | MINOR_VERSION int = 6 | |
| 16 | 16 | // Adwaita version, encoded as a string, useful for printing and | |
| 17 | 17 | // concatenation. | |
| 18 | - | VERSION_S string = "1.3.3" | |
| 18 | + | VERSION_S string = "1.6.4" | |
| 19 | 19 | ) | |
| 20 | 20 | ||
| 21 | 21 | var xGetMajorVersion func() uint | |
M v4/adw/adw-view-stack.go +292 -1
| @@ -7,6 +7,7 @@ import ( | |||
| 7 | 7 | ||
| 8 | 8 | "github.com/jwijenbergh/purego" | |
| 9 | 9 | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | + | "github.com/jwijenbergh/puregotk/v4/gio" | |
| 10 | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 11 | 12 | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 12 | 13 | "github.com/jwijenbergh/puregotk/v4/gtk" | |
| @@ -32,6 +33,16 @@ func (x *ViewStackPageClass) GoPointer() uintptr { | |||
| 32 | 33 | return uintptr(unsafe.Pointer(x)) | |
| 33 | 34 | } | |
| 34 | 35 | ||
| 36 | + | type ViewStackPagesClass struct { | |
| 37 | + | _ structs.HostLayout | |
| 38 | + | ||
| 39 | + | ParentClass uintptr | |
| 40 | + | } | |
| 41 | + | ||
| 42 | + | func (x *ViewStackPagesClass) GoPointer() uintptr { | |
| 43 | + | return uintptr(unsafe.Pointer(x)) | |
| 44 | + | } | |
| 45 | + | ||
| 35 | 46 | // A view container for [class@ViewSwitcher]. | |
| 36 | 47 | // | |
| 37 | 48 | // `AdwViewStack` is a container which only shows one page at a time. | |
| @@ -271,7 +282,7 @@ func (x *ViewStack) GetVhomogeneous() bool { | |||
| 271 | 282 | ||
| 272 | 283 | var xViewStackGetVisibleChild func(uintptr) uintptr | |
| 273 | 284 | ||
| 274 | - | // Gets the currently visible child of @self, . | |
| 285 | + | // Gets the currently visible child of @self. | |
| 275 | 286 | func (x *ViewStack) GetVisibleChild() *gtk.Widget { | |
| 276 | 287 | var cls *gtk.Widget | |
| 277 | 288 | ||
| @@ -819,6 +830,281 @@ func (x *ViewStackPage) UpdateStateValue(NStatesVar int, StatesVar []gtk.Accessi | |||
| 819 | 830 | ||
| 820 | 831 | } | |
| 821 | 832 | ||
| 833 | + | // An auxiliary class used by [class@ViewStack]. | |
| 834 | + | // | |
| 835 | + | // See [property@ViewStack:pages]. | |
| 836 | + | type ViewStackPages struct { | |
| 837 | + | gobject.Object | |
| 838 | + | } | |
| 839 | + | ||
| 840 | + | var xViewStackPagesGLibType func() types.GType | |
| 841 | + | ||
| 842 | + | func ViewStackPagesGLibType() types.GType { | |
| 843 | + | return xViewStackPagesGLibType() | |
| 844 | + | } | |
| 845 | + | ||
| 846 | + | func ViewStackPagesNewFromInternalPtr(ptr uintptr) *ViewStackPages { | |
| 847 | + | cls := &ViewStackPages{} | |
| 848 | + | cls.Ptr = ptr | |
| 849 | + | return cls | |
| 850 | + | } | |
| 851 | + | ||
| 852 | + | var xViewStackPagesGetSelectedPage func(uintptr) uintptr | |
| 853 | + | ||
| 854 | + | // Gets the [class@ViewStackPage] for the visible child of a view stack | |
| 855 | + | // | |
| 856 | + | // Gets the [class@ViewStackPage] for the visible child of the associated stack. | |
| 857 | + | // | |
| 858 | + | // Returns `NULL` if there's no selected page. | |
| 859 | + | func (x *ViewStackPages) GetSelectedPage() *ViewStackPage { | |
| 860 | + | var cls *ViewStackPage | |
| 861 | + | ||
| 862 | + | cret := xViewStackPagesGetSelectedPage(x.GoPointer()) | |
| 863 | + | ||
| 864 | + | if cret == 0 { | |
| 865 | + | return nil | |
| 866 | + | } | |
| 867 | + | gobject.IncreaseRef(cret) | |
| 868 | + | cls = &ViewStackPage{} | |
| 869 | + | cls.Ptr = cret | |
| 870 | + | return cls | |
| 871 | + | } | |
| 872 | + | ||
| 873 | + | var xViewStackPagesSetSelectedPage func(uintptr, uintptr) | |
| 874 | + | ||
| 875 | + | // Sets the visible child in the associated [class@ViewStack]. | |
| 876 | + | // | |
| 877 | + | // See [property@ViewStack:visible-child]. | |
| 878 | + | func (x *ViewStackPages) SetSelectedPage(PageVar *ViewStackPage) { | |
| 879 | + | ||
| 880 | + | xViewStackPagesSetSelectedPage(x.GoPointer(), PageVar.GoPointer()) | |
| 881 | + | ||
| 882 | + | } | |
| 883 | + | ||
| 884 | + | func (c *ViewStackPages) GoPointer() uintptr { | |
| 885 | + | return c.Ptr | |
| 886 | + | } | |
| 887 | + | ||
| 888 | + | func (c *ViewStackPages) SetGoPointer(ptr uintptr) { | |
| 889 | + | c.Ptr = ptr | |
| 890 | + | } | |
| 891 | + | ||
| 892 | + | // Get the item at @position. | |
| 893 | + | // | |
| 894 | + | // If @position is greater than the number of items in @list, %NULL is | |
| 895 | + | // returned. | |
| 896 | + | // | |
| 897 | + | // %NULL is never returned for an index that is smaller than the length | |
| 898 | + | // of the list. | |
| 899 | + | // | |
| 900 | + | // See also: g_list_model_get_n_items() | |
| 901 | + | func (x *ViewStackPages) GetItem(PositionVar uint) uintptr { | |
| 902 | + | ||
| 903 | + | cret := gio.XGListModelGetItem(x.GoPointer(), PositionVar) | |
| 904 | + | return cret | |
| 905 | + | } | |
| 906 | + | ||
| 907 | + | // Gets the type of the items in @list. | |
| 908 | + | // | |
| 909 | + | // All items returned from g_list_model_get_item() are of the type | |
| 910 | + | // returned by this function, or a subtype, or if the type is an | |
| 911 | + | // interface, they are an implementation of that interface. | |
| 912 | + | // | |
| 913 | + | // The item type of a #GListModel can not change during the life of the | |
| 914 | + | // model. | |
| 915 | + | func (x *ViewStackPages) GetItemType() types.GType { | |
| 916 | + | ||
| 917 | + | cret := gio.XGListModelGetItemType(x.GoPointer()) | |
| 918 | + | return cret | |
| 919 | + | } | |
| 920 | + | ||
| 921 | + | // Gets the number of items in @list. | |
| 922 | + | // | |
| 923 | + | // Depending on the model implementation, calling this function may be | |
| 924 | + | // less efficient than iterating the list with increasing values for | |
| 925 | + | // @position until g_list_model_get_item() returns %NULL. | |
| 926 | + | func (x *ViewStackPages) GetNItems() uint { | |
| 927 | + | ||
| 928 | + | cret := gio.XGListModelGetNItems(x.GoPointer()) | |
| 929 | + | return cret | |
| 930 | + | } | |
| 931 | + | ||
| 932 | + | // Get the item at @position. | |
| 933 | + | // | |
| 934 | + | // If @position is greater than the number of items in @list, %NULL is | |
| 935 | + | // returned. | |
| 936 | + | // | |
| 937 | + | // %NULL is never returned for an index that is smaller than the length | |
| 938 | + | // of the list. | |
| 939 | + | // | |
| 940 | + | // This function is meant to be used by language bindings in place | |
| 941 | + | // of g_list_model_get_item(). | |
| 942 | + | // | |
| 943 | + | // See also: g_list_model_get_n_items() | |
| 944 | + | func (x *ViewStackPages) GetObject(PositionVar uint) *gobject.Object { | |
| 945 | + | var cls *gobject.Object | |
| 946 | + | ||
| 947 | + | cret := gio.XGListModelGetObject(x.GoPointer(), PositionVar) | |
| 948 | + | ||
| 949 | + | if cret == 0 { | |
| 950 | + | return nil | |
| 951 | + | } | |
| 952 | + | cls = &gobject.Object{} | |
| 953 | + | cls.Ptr = cret | |
| 954 | + | return cls | |
| 955 | + | } | |
| 956 | + | ||
| 957 | + | // Emits the #GListModel::items-changed signal on @list. | |
| 958 | + | // | |
| 959 | + | // This function should only be called by classes implementing | |
| 960 | + | // #GListModel. It has to be called after the internal representation | |
| 961 | + | // of @list has been updated, because handlers connected to this signal | |
| 962 | + | // might query the new state of the list. | |
| 963 | + | // | |
| 964 | + | // Implementations must only make changes to the model (as visible to | |
| 965 | + | // its consumer) in places that will not cause problems for that | |
| 966 | + | // consumer. For models that are driven directly by a write API (such | |
| 967 | + | // as #GListStore), changes can be reported in response to uses of that | |
| 968 | + | // API. For models that represent remote data, changes should only be | |
| 969 | + | // made from a fresh mainloop dispatch. It is particularly not | |
| 970 | + | // permitted to make changes in response to a call to the #GListModel | |
| 971 | + | // consumer API. | |
| 972 | + | // | |
| 973 | + | // Stated another way: in general, it is assumed that code making a | |
| 974 | + | // series of accesses to the model via the API, without returning to the | |
| 975 | + | // mainloop, and without calling other code, will continue to view the | |
| 976 | + | // same contents of the model. | |
| 977 | + | func (x *ViewStackPages) ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint) { | |
| 978 | + | ||
| 979 | + | gio.XGListModelItemsChanged(x.GoPointer(), PositionVar, RemovedVar, AddedVar) | |
| 980 | + | ||
| 981 | + | } | |
| 982 | + | ||
| 983 | + | // Gets the set containing all currently selected items in the model. | |
| 984 | + | // | |
| 985 | + | // This function may be slow, so if you are only interested in single item, | |
| 986 | + | // consider using [method@Gtk.SelectionModel.is_selected] or if you are only | |
| 987 | + | // interested in a few, consider [method@Gtk.SelectionModel.get_selection_in_range]. | |
| 988 | + | func (x *ViewStackPages) GetSelection() *gtk.Bitset { | |
| 989 | + | ||
| 990 | + | cret := gtk.XGtkSelectionModelGetSelection(x.GoPointer()) | |
| 991 | + | return cret | |
| 992 | + | } | |
| 993 | + | ||
| 994 | + | // Gets the set of selected items in a range. | |
| 995 | + | // | |
| 996 | + | // This function is an optimization for | |
| 997 | + | // [method@Gtk.SelectionModel.get_selection] when you are only | |
| 998 | + | // interested in part of the model's selected state. A common use | |
| 999 | + | // case is in response to the [signal@Gtk.SelectionModel::selection-changed] | |
| 1000 | + | // signal. | |
| 1001 | + | func (x *ViewStackPages) GetSelectionInRange(PositionVar uint, NItemsVar uint) *gtk.Bitset { | |
| 1002 | + | ||
| 1003 | + | cret := gtk.XGtkSelectionModelGetSelectionInRange(x.GoPointer(), PositionVar, NItemsVar) | |
| 1004 | + | return cret | |
| 1005 | + | } | |
| 1006 | + | ||
| 1007 | + | // Checks if the given item is selected. | |
| 1008 | + | func (x *ViewStackPages) IsSelected(PositionVar uint) bool { | |
| 1009 | + | ||
| 1010 | + | cret := gtk.XGtkSelectionModelIsSelected(x.GoPointer(), PositionVar) | |
| 1011 | + | return cret | |
| 1012 | + | } | |
| 1013 | + | ||
| 1014 | + | // Requests to select all items in the model. | |
| 1015 | + | func (x *ViewStackPages) SelectAll() bool { | |
| 1016 | + | ||
| 1017 | + | cret := gtk.XGtkSelectionModelSelectAll(x.GoPointer()) | |
| 1018 | + | return cret | |
| 1019 | + | } | |
| 1020 | + | ||
| 1021 | + | // Requests to select an item in the model. | |
| 1022 | + | func (x *ViewStackPages) SelectItem(PositionVar uint, UnselectRestVar bool) bool { | |
| 1023 | + | ||
| 1024 | + | cret := gtk.XGtkSelectionModelSelectItem(x.GoPointer(), PositionVar, UnselectRestVar) | |
| 1025 | + | return cret | |
| 1026 | + | } | |
| 1027 | + | ||
| 1028 | + | // Requests to select a range of items in the model. | |
| 1029 | + | func (x *ViewStackPages) SelectRange(PositionVar uint, NItemsVar uint, UnselectRestVar bool) bool { | |
| 1030 | + | ||
| 1031 | + | cret := gtk.XGtkSelectionModelSelectRange(x.GoPointer(), PositionVar, NItemsVar, UnselectRestVar) | |
| 1032 | + | return cret | |
| 1033 | + | } | |
| 1034 | + | ||
| 1035 | + | // Helper function for implementations of `GtkSelectionModel`. | |
| 1036 | + | // | |
| 1037 | + | // Call this when a the selection changes to emit the | |
| 1038 | + | // [signal@Gtk.SelectionModel::selection-changed] signal. | |
| 1039 | + | func (x *ViewStackPages) SelectionChanged(PositionVar uint, NItemsVar uint) { | |
| 1040 | + | ||
| 1041 | + | gtk.XGtkSelectionModelSelectionChanged(x.GoPointer(), PositionVar, NItemsVar) | |
| 1042 | + | ||
| 1043 | + | } | |
| 1044 | + | ||
| 1045 | + | // Make selection changes. | |
| 1046 | + | // | |
| 1047 | + | // This is the most advanced selection updating method that allows | |
| 1048 | + | // the most fine-grained control over selection changes. If you can, | |
| 1049 | + | // you should try the simpler versions, as implementations are more | |
| 1050 | + | // likely to implement support for those. | |
| 1051 | + | // | |
| 1052 | + | // Requests that the selection state of all positions set in @mask | |
| 1053 | + | // be updated to the respective value in the @selected bitmask. | |
| 1054 | + | // | |
| 1055 | + | // In pseudocode, it would look something like this: | |
| 1056 | + | // | |
| 1057 | + | // ```c | |
| 1058 | + | // for (i = 0; i < n_items; i++) | |
| 1059 | + | // | |
| 1060 | + | // { | |
| 1061 | + | // // don't change values not in the mask | |
| 1062 | + | // if (!gtk_bitset_contains (mask, i)) | |
| 1063 | + | // continue; | |
| 1064 | + | // | |
| 1065 | + | // if (gtk_bitset_contains (selected, i)) | |
| 1066 | + | // select_item (i); | |
| 1067 | + | // else | |
| 1068 | + | // unselect_item (i); | |
| 1069 | + | // } | |
| 1070 | + | // | |
| 1071 | + | // gtk_selection_model_selection_changed (model, | |
| 1072 | + | // | |
| 1073 | + | // first_changed_item, | |
| 1074 | + | // n_changed_items); | |
| 1075 | + | // | |
| 1076 | + | // ``` | |
| 1077 | + | // | |
| 1078 | + | // @mask and @selected must not be modified. They may refer to the | |
| 1079 | + | // same bitset, which would mean that every item in the set should | |
| 1080 | + | // be selected. | |
| 1081 | + | func (x *ViewStackPages) SetSelection(SelectedVar *gtk.Bitset, MaskVar *gtk.Bitset) bool { | |
| 1082 | + | ||
| 1083 | + | cret := gtk.XGtkSelectionModelSetSelection(x.GoPointer(), SelectedVar, MaskVar) | |
| 1084 | + | return cret | |
| 1085 | + | } | |
| 1086 | + | ||
| 1087 | + | // Requests to unselect all items in the model. | |
| 1088 | + | func (x *ViewStackPages) UnselectAll() bool { | |
| 1089 | + | ||
| 1090 | + | cret := gtk.XGtkSelectionModelUnselectAll(x.GoPointer()) | |
| 1091 | + | return cret | |
| 1092 | + | } | |
| 1093 | + | ||
| 1094 | + | // Requests to unselect an item in the model. | |
| 1095 | + | func (x *ViewStackPages) UnselectItem(PositionVar uint) bool { | |
| 1096 | + | ||
| 1097 | + | cret := gtk.XGtkSelectionModelUnselectItem(x.GoPointer(), PositionVar) | |
| 1098 | + | return cret | |
| 1099 | + | } | |
| 1100 | + | ||
| 1101 | + | // Requests to unselect a range of items in the model. | |
| 1102 | + | func (x *ViewStackPages) UnselectRange(PositionVar uint, NItemsVar uint) bool { | |
| 1103 | + | ||
| 1104 | + | cret := gtk.XGtkSelectionModelUnselectRange(x.GoPointer(), PositionVar, NItemsVar) | |
| 1105 | + | return cret | |
| 1106 | + | } | |
| 1107 | + | ||
| 822 | 1108 | func init() { | |
| 823 | 1109 | lib, err := purego.Dlopen(core.GetPath("ADW"), purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 824 | 1110 | if err != nil { | |
| @@ -864,4 +1150,9 @@ func init() { | |||
| 864 | 1150 | core.PuregoSafeRegister(&xViewStackPageSetUseUnderline, lib, "adw_view_stack_page_set_use_underline") | |
| 865 | 1151 | core.PuregoSafeRegister(&xViewStackPageSetVisible, lib, "adw_view_stack_page_set_visible") | |
| 866 | 1152 | ||
| 1153 | + | core.PuregoSafeRegister(&xViewStackPagesGLibType, lib, "adw_view_stack_pages_get_type") | |
| 1154 | + | ||
| 1155 | + | core.PuregoSafeRegister(&xViewStackPagesGetSelectedPage, lib, "adw_view_stack_pages_get_selected_page") | |
| 1156 | + | core.PuregoSafeRegister(&xViewStackPagesSetSelectedPage, lib, "adw_view_stack_pages_set_selected_page") | |
| 1157 | + | ||
| 867 | 1158 | } | |
M v4/adw/adw-view-switcher-bar.go +31 -26
| @@ -37,38 +37,38 @@ func (x *ViewSwitcherBarClass) GoPointer() uintptr { | |||
| 37 | 37 | // on mobile phones. It can't be revealed if there are less than two pages. | |
| 38 | 38 | // | |
| 39 | 39 | // `AdwViewSwitcherBar` is intended to be used together with | |
| 40 | - | // [class@ViewSwitcherTitle]. | |
| 41 | - | // | |
| 42 | - | // A common use case is to bind the [property@ViewSwitcherBar:reveal] property | |
| 43 | - | // to [property@ViewSwitcherTitle:title-visible] to automatically reveal the | |
| 44 | - | // view switcher bar when the title label is displayed in place of the view | |
| 45 | - | // switcher, as follows: | |
| 40 | + | // `AdwViewSwitcher` in a header bar, and a [class@Breakpoint] showing the view | |
| 41 | + | // switcher bar on narrow sizes, while removing the view switcher from the | |
| 42 | + | // header bar, as follows: | |
| 46 | 43 | // | |
| 47 | 44 | // ```xml | |
| 48 | - | // <object class="GtkWindow"> | |
| 45 | + | // <object class="AdwWindow"> | |
| 49 | 46 | // | |
| 50 | - | // <property name="titlebar"> | |
| 51 | - | // <object class="AdwHeaderBar"> | |
| 52 | - | // <property name="centering-policy">strict</property> | |
| 53 | - | // <property name="title-widget"> | |
| 54 | - | // <object class="AdwViewSwitcherTitle" id="title"> | |
| 55 | - | // <property name="stack">stack</property> | |
| 56 | - | // </object> | |
| 57 | - | // </property> | |
| 47 | + | // <child> | |
| 48 | + | // <object class="AdwBreakpoint"> | |
| 49 | + | // <condition>max-width: 550sp</condition> | |
| 50 | + | // <setter object="switcher_bar" property="reveal">True</setter> | |
| 51 | + | // <setter object="header_bar" property="title-widget"/> | |
| 58 | 52 | // </object> | |
| 59 | - | // </property> | |
| 60 | - | // <property name="child"> | |
| 61 | - | // <object class="GtkBox"> | |
| 62 | - | // <property name="orientation">vertical</property> | |
| 63 | - | // <child> | |
| 64 | - | // <object class="AdwViewStack" id="stack"/> | |
| 53 | + | // </child> | |
| 54 | + | // <property name="content"> | |
| 55 | + | // <object class="AdwToolbarView"> | |
| 56 | + | // <child type="top"> | |
| 57 | + | // <object class="AdwHeaderBar" id="header_bar"> | |
| 58 | + | // <property name="title-widget"> | |
| 59 | + | // <object class="AdwViewSwitcher"> | |
| 60 | + | // <property name="stack">stack</property> | |
| 61 | + | // <property name="policy">wide</property> | |
| 62 | + | // </object> | |
| 63 | + | // </property> | |
| 64 | + | // </object> | |
| 65 | 65 | // </child> | |
| 66 | - | // <child> | |
| 67 | - | // <object class="AdwViewSwitcherBar"> | |
| 66 | + | // <property name="content"> | |
| 67 | + | // <object class="AdwViewStack" id="stack"/> | |
| 68 | + | // </property> | |
| 69 | + | // <child type="bottom"> | |
| 70 | + | // <object class="AdwViewSwitcherBar" id="switcher_bar"> | |
| 68 | 71 | // <property name="stack">stack</property> | |
| 69 | - | // <binding name="reveal"> | |
| 70 | - | // <lookup name="title-visible">title</lookup> | |
| 71 | - | // </binding> | |
| 72 | 72 | // </object> | |
| 73 | 73 | // </child> | |
| 74 | 74 | // </object> | |
| @@ -77,6 +77,11 @@ func (x *ViewSwitcherBarClass) GoPointer() uintptr { | |||
| 77 | 77 | // </object> | |
| 78 | 78 | // ``` | |
| 79 | 79 | // | |
| 80 | + | // It's recommended to set [property@ViewSwitcher:policy] to | |
| 81 | + | // `ADW_VIEW_SWITCHER_POLICY_WIDE` in this case. | |
| 82 | + | // | |
| 83 | + | // You may have to adjust the breakpoint condition for your specific pages. | |
| 84 | + | // | |
| 80 | 85 | // ## CSS nodes | |
| 81 | 86 | // | |
| 82 | 87 | // `AdwViewSwitcherBar` has a single CSS node with name` viewswitcherbar`. | |
M v4/adw/adw-view-switcher-title.go +16 -17
| @@ -51,25 +51,24 @@ func (x *ViewSwitcherTitleClass) GoPointer() uintptr { | |||
| 51 | 51 | // switcher, as follows: | |
| 52 | 52 | // | |
| 53 | 53 | // ```xml | |
| 54 | - | // <object class="GtkWindow"> | |
| 55 | - | // | |
| 56 | - | // <property name="titlebar"> | |
| 57 | - | // <object class="AdwHeaderBar"> | |
| 58 | - | // <property name="centering-policy">strict</property> | |
| 59 | - | // <property name="title-widget"> | |
| 60 | - | // <object class="AdwViewSwitcherTitle" id="title"> | |
| 61 | - | // <property name="stack">stack</property> | |
| 54 | + | // <object class="AdwWindow"> | |
| 55 | + | // | |
| 56 | + | // <property name="content"> | |
| 57 | + | // <object class="AdwToolbarView"> | |
| 58 | + | // <child type="top"> | |
| 59 | + | // <object class="AdwHeaderBar"> | |
| 60 | + | // <property name="centering-policy">strict</property> | |
| 61 | + | // <property name="title-widget"> | |
| 62 | + | // <object class="AdwViewSwitcherTitle" id="title"> | |
| 63 | + | // <property name="stack">stack</property> | |
| 64 | + | // </object> | |
| 65 | + | // </property> | |
| 62 | 66 | // </object> | |
| 63 | - | // </property> | |
| 64 | - | // </object> | |
| 65 | - | // </property> | |
| 66 | - | // <property name="child"> | |
| 67 | - | // <object class="GtkBox"> | |
| 68 | - | // <property name="orientation">vertical</property> | |
| 69 | - | // <child> | |
| 70 | - | // <object class="AdwViewStack" id="stack"/> | |
| 71 | 67 | // </child> | |
| 72 | - | // <child> | |
| 68 | + | // <property name="content"> | |
| 69 | + | // <object class="AdwViewStack" id="stack"/> | |
| 70 | + | // </property> | |
| 71 | + | // <child type="bottom"> | |
| 73 | 72 | // <object class="AdwViewSwitcherBar"> | |
| 74 | 73 | // <property name="stack">stack</property> | |
| 75 | 74 | // <binding name="reveal"> | |
M v4/adw/adw-view-switcher.go +45 -2
| @@ -56,8 +56,51 @@ const ( | |||
| 56 | 56 | // displayed side by side, or icon on top of the label. This can be controlled | |
| 57 | 57 | // via the [property@ViewSwitcher:policy] property. | |
| 58 | 58 | // | |
| 59 | - | // Most applications should be using [class@ViewSwitcherBar] and | |
| 60 | - | // [class@ViewSwitcherTitle]. | |
| 59 | + | // `AdwViewSwitcher` is intended to be used in a header bar together with | |
| 60 | + | // [class@ViewSwitcherBar] at the bottom of the window, and a [class@Breakpoint] | |
| 61 | + | // showing the view switcher bar on narrow sizes, while removing the view | |
| 62 | + | // switcher from the header bar, as follows: | |
| 63 | + | // | |
| 64 | + | // ```xml | |
| 65 | + | // <object class="AdwWindow"> | |
| 66 | + | // | |
| 67 | + | // <child> | |
| 68 | + | // <object class="AdwBreakpoint"> | |
| 69 | + | // <condition>max-width: 550sp</condition> | |
| 70 | + | // <setter object="switcher_bar" property="reveal">True</setter> | |
| 71 | + | // <setter object="header_bar" property="title-widget"/> | |
| 72 | + | // </object> | |
| 73 | + | // </child> | |
| 74 | + | // <property name="content"> | |
| 75 | + | // <object class="AdwToolbarView"> | |
| 76 | + | // <child type="top"> | |
| 77 | + | // <object class="AdwHeaderBar" id="header_bar"> | |
| 78 | + | // <property name="title-widget"> | |
| 79 | + | // <object class="AdwViewSwitcher"> | |
| 80 | + | // <property name="stack">stack</property> | |
| 81 | + | // <property name="policy">wide</property> | |
| 82 | + | // </object> | |
| 83 | + | // </property> | |
| 84 | + | // </object> | |
| 85 | + | // </child> | |
| 86 | + | // <property name="content"> | |
| 87 | + | // <object class="AdwViewStack" id="stack"/> | |
| 88 | + | // </property> | |
| 89 | + | // <child type="bottom"> | |
| 90 | + | // <object class="AdwViewSwitcherBar" id="switcher_bar"> | |
| 91 | + | // <property name="stack">stack</property> | |
| 92 | + | // </object> | |
| 93 | + | // </child> | |
| 94 | + | // </object> | |
| 95 | + | // </property> | |
| 96 | + | // | |
| 97 | + | // </object> | |
| 98 | + | // ``` | |
| 99 | + | // | |
| 100 | + | // It's recommended to set [property@ViewSwitcher:policy] to | |
| 101 | + | // `ADW_VIEW_SWITCHER_POLICY_WIDE` in this case. | |
| 102 | + | // | |
| 103 | + | // You may have to adjust the breakpoint condition for your specific pages. | |
| 61 | 104 | // | |
| 62 | 105 | // ## CSS nodes | |
| 63 | 106 | // | |
M v4/adw/adw-window.go +119 -7
| @@ -8,6 +8,7 @@ import ( | |||
| 8 | 8 | "github.com/jwijenbergh/purego" | |
| 9 | 9 | "github.com/jwijenbergh/puregotk/internal/core" | |
| 10 | 10 | "github.com/jwijenbergh/puregotk/v4/gdk" | |
| 11 | + | "github.com/jwijenbergh/puregotk/v4/gio" | |
| 11 | 12 | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 12 | 13 | "github.com/jwijenbergh/puregotk/v4/gobject/types" | |
| 13 | 14 | "github.com/jwijenbergh/puregotk/v4/gsk" | |
| @@ -36,20 +37,20 @@ func (x *WindowClass) GoPointer() uintptr { | |||
| 36 | 37 | // </picture> | |
| 37 | 38 | // | |
| 38 | 39 | // The `AdwWindow` widget is a subclass of [class@Gtk.Window] which has no | |
| 39 | - | // titlebar area. It means [class@Gtk.HeaderBar] can be used as follows: | |
| 40 | + | // titlebar area. Instead, [class@ToolbarView] can be used together with | |
| 41 | + | // [class@HeaderBar] or [class@Gtk.HeaderBar] as follows: | |
| 40 | 42 | // | |
| 41 | 43 | // ```xml | |
| 42 | 44 | // <object class="AdwWindow"> | |
| 43 | 45 | // | |
| 44 | 46 | // <property name="content"> | |
| 45 | - | // <object class="GtkBox"> | |
| 46 | - | // <property name="orientation">vertical</property> | |
| 47 | - | // <child> | |
| 48 | - | // <object class="GtkHeaderBar"/> | |
| 47 | + | // <object class="AdwToolbarView"> | |
| 48 | + | // <child type="top"> | |
| 49 | + | // <object class="AdwHeaderBar"/> | |
| 49 | 50 | // </child> | |
| 50 | - | // <child> | |
| 51 | + | // <property name="content"> | |
| 51 | 52 | // <!-- ... --> | |
| 52 | - | // </child> | |
| 53 | + | // </property> | |
| 53 | 54 | // </object> | |
| 54 | 55 | // </property> | |
| 55 | 56 | // | |
| @@ -59,6 +60,52 @@ func (x *WindowClass) GoPointer() uintptr { | |||
| 59 | 60 | // Using [property@Gtk.Window:titlebar] or [property@Gtk.Window:child] | |
| 60 | 61 | // is not supported and will result in a crash. Use [property@Window:content] | |
| 61 | 62 | // instead. | |
| 63 | + | // | |
| 64 | + | // ## Dialogs | |
| 65 | + | // | |
| 66 | + | // `AdwWindow` can contain [class@Dialog]. Use [method@Dialog.present] with the | |
| 67 | + | // window or a widget within a window to show a dialog. | |
| 68 | + | // | |
| 69 | + | // ## Breakpoints | |
| 70 | + | // | |
| 71 | + | // `AdwWindow` can be used with [class@Breakpoint] the same way as | |
| 72 | + | // [class@BreakpointBin]. Refer to that widget's documentation for details. | |
| 73 | + | // | |
| 74 | + | // Example: | |
| 75 | + | // | |
| 76 | + | // ```xml | |
| 77 | + | // <object class="AdwWindow"> | |
| 78 | + | // | |
| 79 | + | // <property name="content"> | |
| 80 | + | // <object class="AdwToolbarView"> | |
| 81 | + | // <child type="top"> | |
| 82 | + | // <object class="AdwHeaderBar"/> | |
| 83 | + | // </child> | |
| 84 | + | // <property name="content"> | |
| 85 | + | // <!-- ... --> | |
| 86 | + | // </property> | |
| 87 | + | // <child type="bottom"> | |
| 88 | + | // <object class="GtkActionBar" id="bottom_bar"> | |
| 89 | + | // <property name="revealed">True</property> | |
| 90 | + | // <property name="visible">False</property> | |
| 91 | + | // </object> | |
| 92 | + | // </child> | |
| 93 | + | // </object> | |
| 94 | + | // </property> | |
| 95 | + | // <child> | |
| 96 | + | // <object class="AdwBreakpoint"> | |
| 97 | + | // <condition>max-width: 500px</condition> | |
| 98 | + | // <setter object="bottom_bar" property="visible">True</setter> | |
| 99 | + | // </object> | |
| 100 | + | // </child> | |
| 101 | + | // | |
| 102 | + | // </object> | |
| 103 | + | // ``` | |
| 104 | + | // | |
| 105 | + | // When breakpoints are used, the minimum size must be larger than the smallest | |
| 106 | + | // UI state. `AdwWindow` defaults to the minimum size of 360×200 px. If that's | |
| 107 | + | // too small, set the [property@Gtk.Widget:width-request] and | |
| 108 | + | // [property@Gtk.Widget:height-request] properties manually. | |
| 62 | 109 | type Window struct { | |
| 63 | 110 | gtk.Window | |
| 64 | 111 | } | |
| @@ -92,6 +139,15 @@ func NewWindow() *Window { | |||
| 92 | 139 | return cls | |
| 93 | 140 | } | |
| 94 | 141 | ||
| 142 | + | var xWindowAddBreakpoint func(uintptr, uintptr) | |
| 143 | + | ||
| 144 | + | // Adds @breakpoint to @self. | |
| 145 | + | func (x *Window) AddBreakpoint(BreakpointVar *Breakpoint) { | |
| 146 | + | ||
| 147 | + | xWindowAddBreakpoint(x.GoPointer(), BreakpointVar.GoPointer()) | |
| 148 | + | ||
| 149 | + | } | |
| 150 | + | ||
| 95 | 151 | var xWindowGetContent func(uintptr) uintptr | |
| 96 | 152 | ||
| 97 | 153 | // Gets the content widget of @self. | |
| @@ -111,6 +167,58 @@ func (x *Window) GetContent() *gtk.Widget { | |||
| 111 | 167 | return cls | |
| 112 | 168 | } | |
| 113 | 169 | ||
| 170 | + | var xWindowGetCurrentBreakpoint func(uintptr) uintptr | |
| 171 | + | ||
| 172 | + | // Gets the current breakpoint. | |
| 173 | + | func (x *Window) GetCurrentBreakpoint() *Breakpoint { | |
| 174 | + | var cls *Breakpoint | |
| 175 | + | ||
| 176 | + | cret := xWindowGetCurrentBreakpoint(x.GoPointer()) | |
| 177 | + | ||
| 178 | + | if cret == 0 { | |
| 179 | + | return nil | |
| 180 | + | } | |
| 181 | + | gobject.IncreaseRef(cret) | |
| 182 | + | cls = &Breakpoint{} | |
| 183 | + | cls.Ptr = cret | |
| 184 | + | return cls | |
| 185 | + | } | |
| 186 | + | ||
| 187 | + | var xWindowGetDialogs func(uintptr) uintptr | |
| 188 | + | ||
| 189 | + | // Returns a [iface@Gio.ListModel] that contains the open dialogs of @self. | |
| 190 | + | // | |
| 191 | + | // This can be used to keep an up-to-date view. | |
| 192 | + | func (x *Window) GetDialogs() *gio.ListModelBase { | |
| 193 | + | var cls *gio.ListModelBase | |
| 194 | + | ||
| 195 | + | cret := xWindowGetDialogs(x.GoPointer()) | |
| 196 | + | ||
| 197 | + | if cret == 0 { | |
| 198 | + | return nil | |
| 199 | + | } | |
| 200 | + | cls = &gio.ListModelBase{} | |
| 201 | + | cls.Ptr = cret | |
| 202 | + | return cls | |
| 203 | + | } | |
| 204 | + | ||
| 205 | + | var xWindowGetVisibleDialog func(uintptr) uintptr | |
| 206 | + | ||
| 207 | + | // Returns the currently visible dialog in @self, if there's one. | |
| 208 | + | func (x *Window) GetVisibleDialog() *Dialog { | |
| 209 | + | var cls *Dialog | |
| 210 | + | ||
| 211 | + | cret := xWindowGetVisibleDialog(x.GoPointer()) | |
| 212 | + | ||
| 213 | + | if cret == 0 { | |
| 214 | + | return nil | |
| 215 | + | } | |
| 216 | + | gobject.IncreaseRef(cret) | |
| 217 | + | cls = &Dialog{} | |
| 218 | + | cls.Ptr = cret | |
| 219 | + | return cls | |
| 220 | + | } | |
| 221 | + | ||
| 114 | 222 | var xWindowSetContent func(uintptr, uintptr) | |
| 115 | 223 | ||
| 116 | 224 | // Sets the content widget of @self. | |
| @@ -390,7 +498,11 @@ func init() { | |||
| 390 | 498 | ||
| 391 | 499 | core.PuregoSafeRegister(&xNewWindow, lib, "adw_window_new") | |
| 392 | 500 | ||
| 501 | + | core.PuregoSafeRegister(&xWindowAddBreakpoint, lib, "adw_window_add_breakpoint") | |
| 393 | 502 | core.PuregoSafeRegister(&xWindowGetContent, lib, "adw_window_get_content") | |
| 503 | + | core.PuregoSafeRegister(&xWindowGetCurrentBreakpoint, lib, "adw_window_get_current_breakpoint") | |
| 504 | + | core.PuregoSafeRegister(&xWindowGetDialogs, lib, "adw_window_get_dialogs") | |
| 505 | + | core.PuregoSafeRegister(&xWindowGetVisibleDialog, lib, "adw_window_get_visible_dialog") | |
| 394 | 506 | core.PuregoSafeRegister(&xWindowSetContent, lib, "adw_window_set_content") | |
| 395 | 507 | ||
| 396 | 508 | } | |