package ocgtk
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054
doc/ocgtk.gtk/Ocgtk_gtk/Gtk/Wrappers/Notebook/index.html
Module Wrappers.Notebook
type t = [ `notebook | `widget | `initially_unowned | `object_ ] Gobject.objval new_ : unit -> tCreate a new Notebook
val set_tab_reorderable :
t ->
[ `widget | `initially_unowned | `object_ ] Gobject.obj ->
bool ->
unitSets whether the notebook tab can be reordered via drag and drop or not.
val set_tab_pos : t -> Gtk_enums.positiontype -> unitSets the edge at which the tabs are drawn.
val set_tab_label_text :
t ->
[ `widget | `initially_unowned | `object_ ] Gobject.obj ->
string ->
unitCreates 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 ->
unitChanges 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 ->
unitSets 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 -> unitSets whether to show the tabs for the notebook or not.
val set_show_border : t -> bool -> unitSets 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 -> unitSets whether the tab label area will have arrows for scrolling if there are too many tabs to fit in the area.
Creates a new label and sets it as the menu label of @child.
Changes the menu label for the page containing @child.
val set_group_name : t -> string option -> unitSets 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 -> unitSwitches 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 ->
unitSets @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 ->
unitReorders 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 -> unitRemoves a page from the notebook given its index in the notebook.
val prev_page : t -> unitSwitches to the previous page.
Nothing happens if the current page is the first page.
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 ->
intPrepends a page to @notebook.
val popup_enable : t -> unitEnables 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 -> unitDisables the popup menu.
val page_num :
t ->
[ `widget | `initially_unowned | `object_ ] Gobject.obj ->
intFinds the index of the page which contains the given child widget.
val next_page : t -> unitSwitches to the next page.
Nothing happens if the current page is the last page.
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 ->
intInsert a page into @notebook at the given position.
val get_tab_reorderable :
t ->
[ `widget | `initially_unowned | `object_ ] Gobject.obj ->
boolGets whether the tab can be reordered via drag and drop or not.
val get_tab_pos : t -> Gtk_enums.positiontypeGets the edge at which the tabs are drawn.
val get_tab_label_text :
t ->
[ `widget | `initially_unowned | `object_ ] Gobject.obj ->
string optionRetrieves 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 optionReturns 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 ->
boolReturns whether the tab contents can be detached from @notebook.
val get_show_tabs : t -> boolReturns whether the tabs of the notebook are shown.
val get_show_border : t -> boolReturns whether a bevel will be drawn around the notebook pages.
val get_scrollable : t -> boolReturns whether the tab label area has arrows for scrolling.
val get_pages : t -> Ocgtk_gio.Gio.Wrappers.List_model.tReturns 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.objReturns the `GtkNotebookPage` for @child.
val get_nth_page :
t ->
int ->
[ `widget | `initially_unowned | `object_ ] Gobject.obj optionReturns the child widget contained in page number @page_num.
val get_n_pages : t -> intGets the number of pages in a notebook.
Retrieves the text of the menu label for the page containing @child.
Retrieves the menu label widget of the page containing @child.
val get_group_name : t -> string optionGets the current group name for @notebook.
val get_current_page : t -> intReturns the page number of the current page.
val get_action_widget :
t ->
Gtk_enums.packtype ->
[ `widget | `initially_unowned | `object_ ] Gobject.obj optionGets one of the action widgets.
See method@Gtk.Notebook.set_action_widget.
val detach_tab :
t ->
[ `widget | `initially_unowned | `object_ ] Gobject.obj ->
unitRemoves 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.
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 ->
intAppends a page to @notebook.
val get_enable_popup : t -> boolGet property: enable-popup
val set_enable_popup : t -> bool -> unitSet property: enable-popup
val on_change_current_page :
?after:bool ->
t ->
callback:(object_:int -> bool) ->
Gobject.Signal.handler_idval on_create_window :
?after:bool ->
t ->
callback:
(page:[ `widget | `initially_unowned | `object_ ] Gobject.obj -> t option) ->
Gobject.Signal.handler_idval on_focus_tab :
?after:bool ->
t ->
callback:(object_:Gtk_enums.notebooktab -> bool) ->
Gobject.Signal.handler_idval on_move_focus_out :
?after:bool ->
t ->
callback:(object_:Gtk_enums.directiontype -> unit) ->
Gobject.Signal.handler_idval on_page_added :
?after:bool ->
t ->
callback:
(child:[ `widget | `initially_unowned | `object_ ] Gobject.obj ->
page_num:int ->
unit) ->
Gobject.Signal.handler_idval on_page_removed :
?after:bool ->
t ->
callback:
(child:[ `widget | `initially_unowned | `object_ ] Gobject.obj ->
page_num:int ->
unit) ->
Gobject.Signal.handler_idval on_page_reordered :
?after:bool ->
t ->
callback:
(child:[ `widget | `initially_unowned | `object_ ] Gobject.obj ->
page_num:int ->
unit) ->
Gobject.Signal.handler_idval on_reorder_tab :
?after:bool ->
t ->
callback:(object_:Gtk_enums.directiontype -> p0:bool -> bool) ->
Gobject.Signal.handler_idval on_select_page :
?after:bool ->
t ->
callback:(object_:bool -> bool) ->
Gobject.Signal.handler_idval on_switch_page :
?after:bool ->
t ->
callback:
(page:[ `widget | `initially_unowned | `object_ ] Gobject.obj ->
page_num:int ->
unit) ->
Gobject.Signal.handler_id