package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.gtk/Ocgtk_gtk/Gtk/Wrappers/Button/index.html

Module Wrappers.Button

type t = [ `button | `widget | `initially_unowned | `object_ ] Gobject.obj
val new_ : unit -> t

Create a new Button

val new_from_icon_name : string -> t

Create a new Button

val new_with_label : string -> t

Create a new Button

val new_with_mnemonic : string -> t

Create a new Button

val set_use_underline : t -> bool -> unit

Sets whether to use underlines as mnemonics.

If true, an underline in the text of the button label indicates the next character should be used for the mnemonic accelerator key.

val set_label : t -> string -> unit

Sets the text of the label of the button to @label.

This will also clear any previously set labels.

val set_icon_name : t -> string -> unit

Adds a `GtkImage` with the given icon name as a child.

If @button already contains a child widget, that child widget will be removed and replaced with the image.

val set_has_frame : t -> bool -> unit

Sets the style of the button.

Buttons can have a flat appearance or have a frame drawn around them.

val set_child : t -> [ `widget | `initially_unowned | `object_ ] Gobject.obj option -> unit

Sets the child widget of @button.

Note that by using this API, you take full responsibility for setting up the proper accessibility label and description information for @button. Most likely, you'll either set the accessibility label or description for @button explicitly, or you'll set a labelled-by or described-by relations from @child to @button.

val set_can_shrink : t -> bool -> unit

Sets whether the button size can be smaller than the natural size of its contents.

For text buttons, setting @can_shrink to true will ellipsize the label.

For icons and custom children, this function has no effect.

val get_use_underline : t -> bool

gets whether underlines are interpreted as mnemonics.

See method@Gtk.Button.set_use_underline.

val get_label : t -> string option

Fetches the text from the label of the button.

If the label text has not been set with method@Gtk.Button.set_label the return value will be %NULL. This will be the case if you create an empty button with ctor@Gtk.Button.new to use as a container.

val get_icon_name : t -> string option

Returns the icon name of the button.

If the icon name has not been set with method@Gtk.Button.set_icon_name the return value will be %NULL. This will be the case if you create an empty button with ctor@Gtk.Button.new to use as a container.

val get_has_frame : t -> bool

Returns whether the button has a frame.

val get_child : t -> [ `widget | `initially_unowned | `object_ ] Gobject.obj option

Gets the child widget of @button.

val get_can_shrink : t -> bool

Retrieves whether the button can be smaller than the natural size of its contents.

val on_activate : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id
val on_clicked : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id