Skip to content

Latest commit

 

History

History
126 lines (98 loc) · 4.41 KB

GtkBindings.md

File metadata and controls

126 lines (98 loc) · 4.41 KB

Container

add methods: add_with_properties

Due to a limitation in Gtkaml 0.2.x, the Container is using add_with_properties instead of add.

This is the only method for adding widgets to a Container so it's implicitly chosen. All classes that extend Container have the ability to use its add method by default.

<Container>
  <Button />
</Button>

ScrolledWindow

add methods: add_with_properties, add_with_viewport.

The order above means that implicitly add_with_properties will be used. To use add_with_viewport write:

<ScrolledWindow>
   <Button add-with-viewport="true" />
</ScrolledWindow>

Also, add_with_properites is only mentioned for ScrolledWindow so that it takes precedence over the more-specific add_with_viewport.

Box

add methods: pack_start, pack_end

You can specify any of expand, fill, and padding on the child widget. The default values are: expand="true", fill="true", padding="0".

Of course these add methods apply for HBox and VBox which implement from Box.

<HBox>
  <Button fill="false" /> <!-- pack_start () used by default -->
  <Button pack-end="true" expand="false" />
</HBox>

Fixed

add methods: put

You need to specify x and y for this method.

<Fixed>
  <Button x="10" y="10" />
</Fixed>

Paned

add methods: add1, add2, pack1, pack2,

For pack1 and pack2 you need to specify resize and shrink boolean parameters.

<HPaned>
  <Button />             <!-- by default uses add1() -->
  <Button add2="true" /> <!-- note: you need to specify add2() explicitly -->
</HPaned>

Layout

add methods: put

You need to specify x and y for put, which is the default method.

<Layout>
  <Button x="10" y="10" />
</Layout>

Window

Window just inherits whatever Bin and Container have as add methods.

MenuShell

add methods: append prepend insert

Default is append which requires no parameters. insert requires position on child widget.

The same appliy for MenuBar and Menu which extend MenuShell.

<MenuBar>
  <MenuItem />
  <MenuItem prepend="true" />
  <MenuItem position="0" />    <!-- uses insert() -->
</MenuBar>

Notebook

add methods: append_page append_page_menu prepend_page prepend_page_menu insert_page insert_page_menu

The default is append_page. All methods require an attribute tab_label of type Widget present on the child. The methods ending with _menu require a second one, menu_label.

To specify tab-label you either use {code} to write an expression (like the name of a private property or an existing widget) or you use a Complex attribute, that is, a sub-tag that plays the role of an attribute.

TODO```