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/Notebook/index.html

Module Wrappers.Notebook

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

Create a new Notebook

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

Sets whether the notebook tab can be reordered via drag and drop or not.

val set_tab_pos : t -> Gtk_enums.positiontype -> unit

Sets the edge at which the tabs are drawn.

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

Creates a new label and sets it as the tab label for the page containing @child.

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

Changes the tab label for @child.

If %NULL is specified for @tab_label, then the page will have the label “page N”.

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

Sets whether the tab can be detached from @notebook to another notebook or widget.

Note that two notebooks must share a common group identifier (see method@Gtk.Notebook.set_group_name) to allow automatic tabs interchange between them.

If you want a widget to interact with a notebook through DnD (i.e.: accept dragged tabs from it) it must be set as a drop destination by adding to it a class@Gtk.DropTarget controller that accepts the GType `GTK_TYPE_NOTEBOOK_PAGE`. The `:value` of said drop target will be preloaded with a class@Gtk.NotebookPage object that corresponds to the dropped tab, so you can process the value via `::accept` or `::drop` signals.

Note that you should use method@Gtk.Notebook.detach_tab instead of method@Gtk.Notebook.remove_page if you want to remove the tab from the source notebook as part of accepting a drop. Otherwise, the source notebook will think that the dragged tab was removed from underneath the ongoing drag operation, and will initiate a drag cancel animation.

```c static void on_drag_data_received (GtkWidget *widget, GdkDrop *drop, GtkSelectionData *data, guint time, gpointer user_data) GtkDrag *drag; GtkWidget *notebook; GtkWidget **child; drag = gtk_drop_get_drag (drop); notebook = g_object_get_data (drag, "gtk-notebook-drag-origin"); child = (void*\) gtk_selection_data_get_data (data); // process_widget (\*child); gtk_notebook_detach_tab (GTK_NOTEBOOK (notebook), *child); ```

If you want a notebook to accept drags from other widgets, you will have to set your own DnD code to do it.

val set_show_tabs : t -> bool -> unit

Sets whether to show the tabs for the notebook or not.

val set_show_border : t -> bool -> unit

Sets whether a bevel will be drawn around the notebook pages.

This only has a visual effect when the tabs are not shown.

val set_scrollable : t -> bool -> unit

Sets whether the tab label area will have arrows for scrolling if there are too many tabs to fit in the area.

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

Creates a new label and sets it as the menu label of @child.

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

Changes the menu label for the page containing @child.

val set_group_name : t -> string option -> unit

Sets a group name for @notebook.

Notebooks with the same name will be able to exchange tabs via drag and drop. A notebook with a %NULL group name will not be able to exchange tabs with any other notebook.

val set_current_page : t -> int -> unit

Switches to the page number @page_num.

Note that due to historical reasons, GtkNotebook refuses to switch to a page unless the child widget is visible. Therefore, it is recommended to show child widgets before adding them to a notebook.

val set_action_widget : t -> [ `widget | `initially_unowned | `object_ ] Gobject.obj -> Gtk_enums.packtype -> unit

Sets @widget as one of the action widgets.

Depending on the pack type the widget will be placed before or after the tabs. You can use a `GtkBox` if you need to pack more than one widget on the same side.

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

Reorders the page containing @child, so that it appears in position @position.

If @position is greater than or equal to the number of children in the list or negative, @child will be moved to the end of the list.

val remove_page : t -> int -> unit

Removes a page from the notebook given its index in the notebook.

val prev_page : t -> unit

Switches to the previous page.

Nothing happens if the current page is the first page.

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

Prepends a page to @notebook, specifying the widget to use as the label in the popup menu.

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

Prepends a page to @notebook.

val popup_enable : t -> unit

Enables the popup menu.

If the user clicks with the right mouse button on the tab labels, a menu with all the pages will be popped up.

val popup_disable : t -> unit

Disables the popup menu.

val page_num : t -> [ `widget | `initially_unowned | `object_ ] Gobject.obj -> int

Finds the index of the page which contains the given child widget.

val next_page : t -> unit

Switches to the next page.

Nothing happens if the current page is the last page.

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

Insert a page into @notebook at the given position, specifying the widget to use as the label in the popup menu.

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

Insert a page into @notebook at the given position.

val get_tab_reorderable : t -> [ `widget | `initially_unowned | `object_ ] Gobject.obj -> bool

Gets whether the tab can be reordered via drag and drop or not.

val get_tab_pos : t -> Gtk_enums.positiontype

Gets the edge at which the tabs are drawn.

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

Retrieves the text of the tab label for the page containing @child.

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

Returns the tab label widget for the page @child.

%NULL is returned if @child is not in @notebook or if no tab label has specifically been set for @child.

val get_tab_detachable : t -> [ `widget | `initially_unowned | `object_ ] Gobject.obj -> bool

Returns whether the tab contents can be detached from @notebook.

val get_show_tabs : t -> bool

Returns whether the tabs of the notebook are shown.

val get_show_border : t -> bool

Returns whether a bevel will be drawn around the notebook pages.

val get_scrollable : t -> bool

Returns whether the tab label area has arrows for scrolling.

Returns a `GListModel` that contains the pages of the notebook.

This can be used to keep an up-to-date view. The model also implements iface@Gtk.SelectionModel and can be used to track and modify the visible page.

val get_page : t -> [ `widget | `initially_unowned | `object_ ] Gobject.obj -> [ `notebook_page | `object_ ] Gobject.obj

Returns the `GtkNotebookPage` for @child.

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

Returns the child widget contained in page number @page_num.

val get_n_pages : t -> int

Gets the number of pages in a notebook.

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

Retrieves the text of the menu label for the page containing @child.

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

Retrieves the menu label widget of the page containing @child.

val get_group_name : t -> string option

Gets the current group name for @notebook.

val get_current_page : t -> int

Returns the page number of the current page.

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

Gets one of the action widgets.

See method@Gtk.Notebook.set_action_widget.

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

Removes the child from the notebook.

This function is very similar to method@Gtk.Notebook.remove_page, but additionally informs the notebook that the removal is happening as part of a tab DND operation, which should not be cancelled.

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

Appends a page to @notebook, specifying the widget to use as the label in the popup menu.

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

Appends a page to @notebook.

val get_enable_popup : t -> bool

Get property: enable-popup

val set_enable_popup : t -> bool -> unit

Set property: enable-popup

val on_change_current_page : ?after:bool -> t -> callback:(object_:int -> bool) -> Gobject.Signal.handler_id
val on_create_window : ?after:bool -> t -> callback: (page:[ `widget | `initially_unowned | `object_ ] Gobject.obj -> t option) -> Gobject.Signal.handler_id
val on_focus_tab : ?after:bool -> t -> callback:(object_:Gtk_enums.notebooktab -> bool) -> Gobject.Signal.handler_id
val on_move_focus_out : ?after:bool -> t -> callback:(object_:Gtk_enums.directiontype -> unit) -> Gobject.Signal.handler_id
val on_page_added : ?after:bool -> t -> callback: (child:[ `widget | `initially_unowned | `object_ ] Gobject.obj -> page_num:int -> unit) -> Gobject.Signal.handler_id
val on_page_removed : ?after:bool -> t -> callback: (child:[ `widget | `initially_unowned | `object_ ] Gobject.obj -> page_num:int -> unit) -> Gobject.Signal.handler_id
val on_page_reordered : ?after:bool -> t -> callback: (child:[ `widget | `initially_unowned | `object_ ] Gobject.obj -> page_num:int -> unit) -> Gobject.Signal.handler_id
val on_reorder_tab : ?after:bool -> t -> callback:(object_:Gtk_enums.directiontype -> p0:bool -> bool) -> Gobject.Signal.handler_id
val on_select_page : ?after:bool -> t -> callback:(object_:bool -> bool) -> Gobject.Signal.handler_id
val on_switch_page : ?after:bool -> t -> callback: (page:[ `widget | `initially_unowned | `object_ ] Gobject.obj -> page_num:int -> unit) -> Gobject.Signal.handler_id