Libadwaita Widgets
Some widgets are only available when linking against later libadwaita versions.
Set the target libadwaita version by passing -d:adwminor=<Minor Version>.
AdwWindow
renderable AdwWindow of BaseWindow
A Window that does not have a title bar.
Fields
- All fields from BaseWindow
 content: Widget
Adders
- All adders from BaseWindow
 addAdds a child to the window surface. Each window surface may only have one child.
Example
AdwWindow:
  Box:
    orient = OrientX
    Box {.expand: false.}:
      sizeRequest = (250, -1)
      orient = OrientY
      HeaderBar {.expand: false.}:
        showTitleButtons = false
      Label(text = "Sidebar")
    Separator() {.expand: false.}
    Box:
      orient = OrientY
      HeaderBar() {.expand: false.}
      Label(text = "Main Content")
WindowTitle
renderable WindowTitle of BaseWidget
Fields
- All fields from BaseWidget
 title: stringsubtitle: string
Example
Window:
  HeaderBar {.addTitlebar.}:
    WindowTitle {.addTitle.}:
      title = "Title"
      subtitle = "Subtitle"
Avatar
renderable Avatar of BaseWidget
Fields
- All fields from BaseWidget
 text: stringsize: intshowInitials: booliconName: string = "avatar-default-symbolic"
Example
Avatar:
  text = "Erika Mustermann"
  size = 100
  showInitials = true
ButtonContent
renderable ButtonContent of BaseWidget
Fields
- All fields from BaseWidget
 label: stringiconName: stringuseUnderline: boolDefines whether you can use_on part of the label to make the button accessible via hotkey. If you prefix a character of the label text with_it will hide the_and activate the button if you press ALT + the key of the character. E.g._Button Textwill trigger the button when pressingALT + B.canShrink: boolDefines whether the ButtonContent can be smaller than the size of its contents. Since:AdwVersion >= (1, 4)
Clamp
renderable Clamp of BaseWidget
Fields
- All fields from BaseWidget
 maximumSize: intMaximum width of the contentchild: Widget
Adders
- All adders from BaseWidget
 add
Example
Clamp:
  maximumSize = 600
  margin = 12
  PreferencesGroup:
    title = "Settings"
PreferencesGroup
renderable PreferencesGroup of BaseWidget
Fields
- All fields from BaseWidget
 title: stringdescription: stringchildren: seq[Widget]suffix: Widget
Adders
- All adders from BaseWidget
 addaddSuffix
Example
PreferencesGroup:
  title = "Settings"
  description = "Application Settings"
  ActionRow:
    title = "My Setting"
    subtitle = "Subtitle"
    Switch() {.addSuffix.}
PreferencesPage
renderable PreferencesPage of BaseWidget
Fields
- All fields from BaseWidget
 preferences: seq[Widget]iconName: stringname: stringtitle: stringuseUnderline: booldescription: stringSince:AdwVersion >= (1, 4)
Adders
- All adders from BaseWidget
 add
PreferencesRow
renderable PreferencesRow of ListBoxRow
Fields
- All fields from ListBoxRow
 title: string
ActionRow
renderable ActionRow of PreferencesRow
Fields
- All fields from PreferencesRow
 subtitle: stringsuffixes: seq[AlignedChild[Widget]]
Adders
- All adders from PreferencesRow
 addSuffixhAlign = AlignFillvAlign = AlignCenter
Example
ActionRow:
  title = "Color"
  subtitle = "Color of the object"
  ColorButton {.addSuffix.}:(discard )
ExpanderRow
renderable ExpanderRow of PreferencesRow
Fields
- All fields from PreferencesRow
 subtitle: stringactions: seq[AlignedChild[Widget]]rows: seq[AlignedChild[Widget]]expanded: bool = falseenableExpansion: bool = trueshowEnableSwitch: bool = falsetitleLines: intDetermines how many lines of text from the title are shown before it ellipsizes the text. Defaults to 0 which means it never elipsizes and instead adds new lines to show the full text. Since:AdwVersion >= (1, 3)subtitleLines: intDetermines how many lines of text from the subtitle are shown before it ellipsizes the text. Defaults to 0 which means it never elipsizes and instead adds new lines to show the full text. Since:AdwVersion >= (1, 3)
Events
- expand: 
proc (newExpandState: bool)Triggered when row gets expanded 
Adders
- All adders from PreferencesRow
 addActionhAlign = AlignFillvAlign = AlignCenter
addRowhAlign = AlignFillvAlign = AlignFill
Example
ExpanderRow:
  title = "Expander Row"
  for it in 0 ..< 3:
    ActionRow {.addRow.}:
      title = "Nested Row " & $it
ComboRow
renderable ComboRow of ActionRow
Fields
- All fields from ActionRow
 items: seq[string]selected: int
Events
- select: 
proc (item: int) 
Example
ComboRow:
  title = "Combo Row"
  items = @["Option 1", "Option 2", "Option 3"]
  selected = app.selected
  proc select(item: int) =
    app.selected = item
EntryRow
renderable EntryRow of PreferencesRow
Since: AdwVersion >= (1, 2)
Fields
- All fields from PreferencesRow
 suffixes: seq[AlignedChild[Widget]]text: string
Events
- changed: 
proc (text: string) 
Adders
- All adders from PreferencesRow
 addSuffixhAlign = AlignFillvAlign = AlignCenter
Example
EntryRow:
  title = "Name"
  text = app.name
  proc changed(name: string) =
    app.name = name
PasswordEntryRow
renderable PasswordEntryRow of EntryRow
An EntryRow that hides the user input
Since: AdwVersion >= (1, 2)
Fields
- All fields from EntryRow
 
Example
PasswordEntryRow:
  title = "Password"
  text = app.password
  proc changed(password: string) =
    app.password = password
Flap
renderable Flap
Fields
content: Widgetseparator: Widgetflap: FlapChild[Widget]revealed: bool = falsefoldPolicy: FlapFoldPolicy = FlapFoldAutofoldThresholdPolicy: FoldThresholdPolicy = FoldThresholdNaturaltransitionType: FlapTransitionType = FlapTransitionOvermodal: bool = truelocked: bool = falseswipeToClose: bool = trueswipeToOpen: bool = true
Setters
swipe: bool
Events
- changed: 
proc (revealed: bool) - fold: 
proc (folded: bool) 
Adders
addaddSeparatoraddFlapwidth = -1
Example
Flap:
  revealed = app.showFlap
  transitionType = FlapTransitionOver
  proc changed(revealed: bool) =
    app.showFlap = revealed
  Label(text = "Flap") {.addFlap, width: 200.}
  Separator() {.addSeparator.}
  Box:
    Label:
      text = "Content ".repeat(10)
      wrap = true
OverlaySplitView
renderable OverlaySplitView of BaseWidget
Since: AdwVersion >= (1, 4)
Fields
- All fields from BaseWidget
 content: Widgetsidebar: Widgetcollapsed: bool = falseenableHideGesture: bool = trueenableShowGesture: bool = truemaxSidebarWidth: float = 280.0minSidebarWidth: float = 180.0pinSidebar: bool = falseshowSidebar: bool = truesidebarPosition: PackType = PackStartwidthFraction: float = 0.25widthUnit: LengthUnit = LengthScaleIndependent
Events
- toggle: 
proc (shown: bool) 
Adders
- All adders from BaseWidget
 addaddSidebar
AdwHeaderBar
renderable AdwHeaderBar of BaseWidget
Adwaita Headerbar that combines GTK Headerbar and WindowControls.
Fields
- All fields from BaseWidget
 packLeft: seq[Widget]packRight: seq[Widget]centeringPolicy: CenteringPolicy = CenteringPolicyLoosedecorationLayout: Option[string] = none(string)showRightButtons: bool = trueDetermines whether the buttons inrightButtonsare shown. Does not affect Widgets inpackRight.showLeftButtons: bool = trueDetermines whether the buttons inleftButtonsare shown. Does not affect Widgets inpackLeft.titleWidget: WidgetA widget for the title. Replaces the title string, if there is one.showBackButton: bool = trueSince:AdwVersion >= (1, 4)showTitle: bool = trueDetermines whether to show or hide the title Since:AdwVersion >= (1, 4)
Setters
windowControls: DecorationLayoutwindowControls: Option[DecorationLayout]
Adders
- 
All adders from BaseWidget
 - 
addLeftAdds a widget to the left side of the HeaderBar. - 
addRightAdds a widget to the right side of the HeaderBar. - 
addTitle 
SplitButton
renderable SplitButton of BaseWidget
Fields
- All fields from BaseWidget
 child: Widgetpopover: Widget
Setters
text: stringicon: stringSets the icon of the SplitButton. See recommended_tools.md for a list of icons.
Events
- clicked: 
proc () 
Adders
- All adders from BaseWidget
 addChildadd
StatusPage
renderable StatusPage of BaseWidget
Fields
- All fields from BaseWidget
 iconName: stringThe icon to render in the center of the StatusPage. Setting this overrides paintable. See the tooling section for how to figure out what icon names are available.paintable: WidgetThe widget that implements GdkPaintable to render (e.g. IconPaintable, WidgetPaintable) in the center of the StatusPage. Setting this overrides iconName.title: stringdescription: stringchild: Widget
Adders
- All adders from BaseWidget
 addaddPaintable
ToolbarView
renderable ToolbarView of BaseWidget
Since: AdwVersion >= (1, 4)
Fields
- All fields from BaseWidget
 content: WidgetbottomBars: seq[Widget]topBars: seq[Widget]bottomBarStyle: ToolbarStyle = ToolbarFlatextendContentToBottomEdge: bool = falseextendContentToTopEdge: bool = falserevealBottomBars: bool = truerevealTopBars: bool = truetopBarStyle: ToolbarStyle = ToolbarFlat
Adders
- All adders from BaseWidget
 addaddBottomaddTop
AboutWindow
renderable AboutWindow
Since: AdwVersion >= (1, 2)
Fields
applicationName: stringdeveloperName: stringversion: stringsupportUrl: stringissueUrl: stringwebsite: stringcopyright: stringlicense: stringA custom license text. If this field is used instead oflicenseType,licenseTypehas to be empty orLicenseCustom.licenseType: LicenseTypeA license from theLicenseTypeenum.legalSections: seq[LegalSection]Adds extra sections to the "Legal" page. You can use these sections for dependency package attributions etc.applicationIcon: stringreleaseNotes: stringcomments: stringdebugInfo: stringAdds a "Troubleshooting" section. Use this field to provide instructions on how to acquire logs or other info you want users of your app to know about when reporting bugs or debugging.developers: seq[string]designers: seq[string]artists: seq[string]documenters: seq[string]credits: seq[tuple[title: string, people: seq[string]]]Additional credit sections with customizable titlesacknowledgements: seq[tuple[title: string, people: seq[string]]]Acknowledgment sections with customizable titleslinks: seq[tuple[title: string, url: string]]Additional links placed in the details section
Example
AboutWindow:
  applicationName = "My Application"
  developerName = "Erika Mustermann"
  version = "1.0.0"
  applicationIcon = "application-x-executable"
  supportUrl = "https://github.com/can-lehmann/owlkettle/discussions"
  issueUrl = "https://github.com/can-lehmann/owlkettle/issues"
  website = "https://can-lehmann.github.io/owlkettle/README"
  links = @{"Tutorial": "https://can-lehmann.github.io/owlkettle/docs/tutorial.html", "Installation": "https://can-lehmann.github.io/owlkettle/docs/installation.html"}
  comments = """My Application demonstrates the use of the Adwaita AboutWindow. Comments will be shown on the Details page, above links. <i>Unlike</i> GtkAboutDialog comments, this string can be long and detailed. It can also contain <a href='https://docs.gtk.org/Pango/pango_markup.html'>links</a> and <b>Pango markup</b>."""
  copyright = "Erika Mustermann"
  licenseType = LicenseMIT_X11
ToastOverlay
renderable ToastOverlay of BaseWidget
Displays messages (toasts) to the user.
Use newToast to create a Toast.
Toast has the following properties that can be assigned to:
- title: The text to display in the toast. Hidden if customTitle is set.
 - customTitle: A Widget to display in the toast. Causes title to be hidden if it is set. Only available when compiling for Adwaita version 1.2 or higher.
 - buttonLabel: If set, the Toast will contain a button with this string as its text. If not set, the Toast will not contain a button.
 - priority: Defines the behaviour of the toast. 
ToastPriorityNormalwill put the toast at the end of the queue of toasts to display.ToastPriorityHighwill display the toast immediately, ignoring any others. - timeout: The time in seconds after which the toast is dismissed automatically. Disables automatic dismissal if set to 0. Defaults to 5.
 - dismissalHandler: An event handler which is called when the toast is dismissed
 - clickedHandler: An event handler which is called when the user clicks on the button that appears if 
buttonLabelis defined. Only available when compiling for Adwaita version 1.2 or higher. - useMarkup: Whether to interpret the title as Pango Markup. Only available when compiling for Adwaita version 1.4 or higher.
 
Fields
- All fields from BaseWidget
 child: WidgettoastQueue: ToastQueueThe Toasts to display. Toasts of priorityToastPriorityNormalare displayed in First-In-First-Out order, after toasts of priorityToastPriorityHighwhich are displayed in Last-In-First-Out order.
Adders
- All adders from BaseWidget
 add
SwitchRow
renderable SwitchRow of ActionRow
Since: AdwVersion >= (1, 4)
Fields
- All fields from ActionRow
 active: bool
Events
- activated: 
proc (active: bool) 
Banner
renderable Banner of BaseWidget
A rectangular Box taking up the entire vailable width with an optional button.
Since: AdwVersion >= (1, 3)
Fields
- All fields from BaseWidget
 buttonLabel: stringLabel of the optional banner button. Button will only be added to the banner if this Label has a value.title: stringuseMarkup: bool = trueDetermines whether using Markup in title is allowed or not.revealed: bool = trueDetermines whether the banner is shown.
Events
- clicked: 
proc ()Triggered by clicking the banner button