-
Notifications
You must be signed in to change notification settings - Fork 46
Highlevel api
module gtk_hl_containerThe high-level interface provides convenience interfaces for:
- Window, the gtk top-level window.
- Box, Horizontal and vertical boxes to pack widgets. This was added because the gtk_box_pack_start_defaults procedure is removed from GTK3.x
- Table, a grid layout of widgets Note that the weird convention where rows comes before columns in sizing tables, but X before Y in adding widgets follows the convention of GTK proper.
- Notebook, a tabbed container to pack widgets
- ScrolledWindow, a scrolled window into which to place another widget.
function hl_gtk_application_new(app_id, activate, flags, data) result(app)
use, intrinsic :: iso_c_binding, only: c_ptr, c_funloc, c_null_char, c_null_ptr
use gtk, only: gtk_application_new, G_APPLICATION_FLAGS_NONE
use g, only: g_application_run, g_object_unref
type(c_ptr) :: app
character(kind=c_char), dimension(*), intent(in) :: app_id
type(c_funptr), intent(in) :: activate
integer(c_int), optional, intent(in) :: flags
type(c_ptr), optional, intent(in) :: data
integer(c_int) :: the_flagsHigher-level interface to make a GtkApplication
| Argument | Type | Required? | Description |
|---|---|---|---|
| APP_ID | C string | compulsory | name of the GtkApplication. must contain at least one point |
| ACTIVATE | c_funptr | compulsory | Callback for the "activate" signal (defines the GUI) |
| FLAGS | integer | optional | flags |
| DATA | c_ptr | optional | Data to be passed to the "activate" callback function |
function hl_gtk_window_new(title, destroy, delete_event, data_destroy, &
& data_delete_event, border, wsize, sensitive, resizable, decorated, &
& deletable, above, below, parent, icon, icon_file,&
& icon_name, modal) result(win)
type(c_ptr) :: win
character(kind=c_char), dimension(*), intent(in), optional :: title
type(c_funptr), optional :: destroy, delete_event
type(c_ptr), optional :: data_destroy, data_delete_event
integer(c_int), optional, intent(in) :: border
integer(c_int), optional, intent(in), dimension(2) :: wsize
integer(c_int), intent(in), optional :: sensitive, resizable, decorated
integer(c_int), intent(in), optional :: deletable, above, below
type(c_ptr), intent(in), optional :: parent
type(c_ptr), intent(in), optional :: icon
character(kind=c_char), dimension(*), intent(in), optional :: icon_name, &
& icon_file
integer(c_int), intent(in), optional :: modalHigher-level interface to make a gtk_window
| Argument | Type | Required? | Description |
|---|---|---|---|
| TITLE | String | optional | Title for the window |
| DESTROY | c_funptr | optional | Callback for the "destroy" signal |
| DELETE_EVENT | c_funptr | optional | Callback for the "delete-event" signal. Removed from GTK 4. |
| DATA_DESTROY | c_ptr | optional | Data to be passed to the destroy signal handler |
| DATA_DELETE_EVENT | c_ptr | optional | Data to be passed to the delete_event signal handler |
| BORDER | integer | optional | Size of the window border |
| WSIZE | integer(2) | optional | Size of the window |
| SENSITIVE | boolean | optional | Whether the widget should initially be sensitive or not. |
| RESIZABLE | boolean | optional | Is the window resizable. |
| DECORATED | boolean | optional | Set FALSE to disable window decorations. |
| DELETABLE | boolean | optional | Set to FALSE to remove the "delete" button. |
| ABOVE | boolean | optional | Set to TRUE to make the window stay on top of others. Removed from GTK 4. |
| BELOW | boolean | optional | Set to TRUE to make the window stay below others. Removed from GTK 4. |
| PARENT | c_ptr | optional | An optional parent window for the new window. |
| ICON | c_ptr | optional | A GdkPixbuf containing the icon for the window. Removed from GTK 4. |
| ICON_FILE | String | optional | A file from which to read the icon for the window. Removed from GTK 4. |
| ICON_NAME | String | optional | The name of a standard icon to use for the window. |
| MODAL | boolean | optional | Set to true to make the window modal (only meaningful if PARENT is also set). |
function hl_gtk_box_new(horizontal, homogeneous, spacing) result(box)
type(c_ptr) :: box
integer(c_int), intent(in), optional :: horizontal, homogeneous
integer(c_int), intent(in), optional :: spacingGeneric packing box
| Argument | Type | Required? | Description |
|---|---|---|---|
| HORIZONTAL | boolean | optional | Set to TRUE to make a row box. FALSE or absent implies a column box. |
| HOMOGENEOUS | boolean | optional | If set to TRUE then all children are the same size, FALSE or absent allows each widget to take its natural size. |
| SPACING | c_int | optional | Set the space between children. |
subroutine hl_gtk_box_pack(box, child, expand, fill, padding, atend)
type(c_ptr), intent(in) :: box, child
integer(c_int), intent(in), optional :: expand, fill
integer(c_int), intent(in), optional :: padding
integer(c_int), intent(in), optional :: atendPut a widget into a box
| Argument | Type | Required? | Description |
|---|---|---|---|
| BOX | c_ptr | required | The box into which to put the child |
| CHILD | c_ptr | required | The child to pack |
| EXPAND | boolean | optional | If TRUE then expand this child when filling the box, if FALSE don't, (Default TRUE) |
| FILL | boolean | optional | If TRUE, then expand the widget when expanding, if FALSE, then put space round it. (Default TRUE, ignored if EXPAND==FALSE. |
| PADDING | c_int | optional | Extra space to put around the child in the fill direction. |
| ATEND | boolean | optional | If present and TRUE, then put the child at the end of the box rather than the start. |
function hl_gtk_table_new(nrows, ncols, homogeneous, row_spacing, &
& col_spacing, row_homogeneous, col_homogeneous) result(table)
type(c_ptr) :: table
integer(c_int), intent(in), optional :: nrows, ncols
integer(c_int), intent(in), optional :: homogeneous
integer(c_int), intent(in), optional :: row_spacing, col_spacing
integer(c_int), intent(in), optional :: row_homogeneous,&
& col_homogeneousUtility interface to create a table container
| Argument | Type | Required? | Description |
|---|---|---|---|
| NROWS | c_int | optional | The initial number of rows. |
| NCOLS | c_int | optional | The initial number of columns. |
| HOMOGENEOUS | boolean | optional | Whether the cells all have the same size. |
| ROW_HOMOGENEOUS | boolean | optional | Whether the rows all have the same size. |
| COL_HOMOGENEOUS | boolean | optional | Whether the columns all have the same size. |
| ROW_SPACING | c_int | optional | Spacing between rows. |
| COL_SPACING | c_int | optional | Spacing between columns. |
Note This is implemented as a GtkTable for Gtk+2.x and as a GtkGrid for 3.x For 2.x, the ROW and COL_HOMOGENEOUS settings are treated as HOMOGENOUS except that if both are given and their values differ then homogenous is not set. For 3.x the ROW and COL settings take precedence over the common setting. The NROWS and NCOLS arguments are ignored for GTK 3.x
subroutine hl_gtk_table_attach(table, widget, ix, iy, xspan, yspan, &
& xpad, ypad, xopts, yopts)
type(c_ptr), intent(in) :: table, widget
integer(c_int), intent(in) :: ix, iy
integer(c_int), intent(in), optional :: xspan, yspan
integer(c_int), intent(in), optional :: xpad, ypad
integer(c_int), intent(in), optional :: xopts, yoptsAttach a widget to a table
| Argument | Type | Required? | Description |
|---|---|---|---|
| TABLE | c_ptr | required | The table to which to attach |
| WIDGET | c_ptr | required | The widget to attach to the table |
| IX | c_int | required | The cell number of the left edge of the widget |
| IY | c_int | required | The cell number of the top edge of the widget. |
| XSPAN | c_int | optional | How many cells to span in the X direction (1) |
| YSPAN | c_int | optional | How many cells to span in the Y direction (1) |
| XPAD | c_int | optional | Padding around the cell in the X direction |
| YPAD | c_int | optional | Padding in the Y direction |
| XOPTS | c_int | optional | X fill/expand options (from the GtkAttachOptions enumerator, or 0 for none). Removed from GTK 4. |
| YOPTS | c_int | optional | Y fill/expand options. Removed from GTK 4. |
N.B. GTK_SHRINK in the options is ignored in GTK 3.x
subroutine hl_gtk_table_expand(table, ny, nx)
type(c_ptr), intent(in) :: table
integer(c_int), intent(in), optional :: ny, nxAdd rows and/or columns to a table
| Argument | Type | Required? | Description |
|---|---|---|---|
| TABLE | c_ptr | required | The table to enlarge |
| NY | c_int | optional | How many rows to add |
| NX | c_int | optional | How many columns to add |
To set an absolute size, use gtk_table_resize directly. Negative NX and/or NY will reduce the table. For GTK3.x this is a do-nothing routine.
function hl_gtk_notebook_new(show_tabs, tab_position, popup, &
& scrollable, group, switch_page, data) result(nbook)
type(c_ptr) :: nbook
integer(c_int), intent(in), optional :: show_tabs
integer(c_int), intent(in), optional :: tab_position
integer(c_int), intent(in), optional :: popup, scrollable
character(kind=c_char), intent(in), optional, dimension(*), target :: group
type(c_funptr), optional :: switch_page
type(c_ptr), intent(in), optional :: dataConvenience function to create a notebook (tabbed) container
| Argument | Type | Required? | Description |
|---|---|---|---|
| SHOW_TABS | boolean | optional | Whether the tabs are visible |
| TAB_POSITION | c_int | optional | Where the tabs are placed (from the GtkPositionType enumerator). |
| POPUP | boolean | optional | Whether to have a popup tab selector. |
| SCROLLABLE | boolean | optional | Whether the tabs are scrollable if there are too many to fit. |
| GROUP | string | optional | A group name for the notebook (needed if you want to drag tabs from one book to another). N.B. For GTK+2, this probably has to be a variable to work. |
| SWITCH_PAGE | c_funptr | optional | A callback to be called when the page selection is changed (signal switch-page). Note that this callback has 4 arguments; the notebook, the selected page, the index of that page and the user data. |
| DATA | c_ptr | optional | Data to pass the the switch-page callback. |
function hl_gtk_notebook_add_page(nbook, page, position, at_start, &
& reorderable, detachable, label) result(location)
integer(c_int) :: location
type(c_ptr), intent(in) :: nbook, page
integer(c_int), intent(in), optional :: position
integer(c_int), intent(in), optional :: at_start, reorderable, &
& detachable
character(kind=c_char), dimension(*), intent(in), optional :: labelConvenience function to add a page to a notebook.
| Argument | Type | Required? | Description |
|---|---|---|---|
| NBOOK | c_ptr | required | The book to which to add the page |
| PAGE | c_ptr | required | The page to at to the book. |
| POSITION | c_int | optional | The position at which to add the page. |
| AT_START | boolean | optional | Set to TRUE to add at the start. (If neither AT_START nor POSITION is given the page is added at the end). |
| REORDERABLE | boolean | optional | Whether the tab can be reordered by drag and drop |
| DETACHABLE | boolean | optional | Whether the tab can be dragged to a different notebook (requires a group name for the notebooks). |
| LABEL | string | optional | A label to show on the tab. |
Returns the location at which the tab was added or -1 for failure.
function hl_gtk_scrolled_window_new(hpolicy, vpolicy, &
& hsize, vsize, hadjustment, vadjustment) result(win)
type(c_ptr) :: win
integer(c_int), intent(in), optional :: hpolicy, vpolicy
integer(c_int), intent(in), optional :: hsize, vsize
type(c_ptr), intent(in), optional :: hadjustment, vadjustmentCreate a scrolled window, with convenient settings.
| Argument | Type | Required? | Description |
|---|---|---|---|
| HPOLICY | c_int | optional | Whether to show the horizontal scrollbar default- GTK_POLICY_AUTOMATIC, allowed- any GTK_POLICY_TYPE |
| VPOLICY | c_int | optional | Whether to show the vertical scrollbar default- GTK_POLICY_AUTOMATIC, allowed- any GTK_POLICY_TYPE |
| HSIZE | c_int | optional | The size of the window in the horizontal direction. |
| VSIZE | c_int | optional | The size of the window in the vertical direction. |
| HADJUSTMENT | c_ptr | optional | An adjustment widget to use in place of the automatically generated scrollbar in the horizontal direction. Removed from GTK 4. |
| VADJUSTMENT | c_ptr | optional | An adjustment widget to use in place of the automatically generated scrollbar in the vertical direction. Removed from GTK 4. |
subroutine hl_gtk_scrolled_window_add(win, child, viewport)
type(c_ptr), intent(in) :: win, child
integer(c_int), intent(in), optional :: viewportAdd a widget to a scrolled window.
| Argument | Type | Required? | Description |
|---|---|---|---|
| WIN | c_ptr | required | The scrolled window. |
| CHILD | c_ptr | required | The widget to insert. |
| VIEWPORT | c_int | optional | Set this to true if the child widget requires a viewport between it and the scrolled window. Unfortunately I can't see a way to determine automatically whether this is needed. |
module gtk_hl_buttonConvenience interfaces for regular buttons, checkboxes.
function hl_gtk_button_new(label, clicked, data, tooltip, sensitive, &
& is_markup) result(but)
type(c_ptr) :: but
character(kind=c_char), dimension(*), intent(in) :: label
type(c_funptr), optional :: clicked
type(c_ptr), optional :: data
character(kind=c_char), dimension(*), intent(in), optional :: tooltip
integer(c_int), intent(in), optional :: sensitive
integer(c_int), optional, intent(in) :: is_markupHigher-level button
| Argument | Type | Required? | Description |
|---|---|---|---|
| LABEL | string | required | The label on the button |
| CLICKED | c_funptr | optional | callback routine for the "clicked" signal |
| DATA | c_ptr | optional | Data to be passed to the clicked callback |
| TOOLTIP | string | optional | tooltip to be displayed when the pointer is held over the button. |
| SENSITIVE | boolean | optional | Whether the widget should initially be sensitive or not. |
| IS_MARKUP | boolean | optional | Set this to TRUE if the label contains Pango markup. |
subroutine hl_gtk_button_set_label(button, label, is_markup)
type(c_ptr), intent(in) :: button
character(kind=c_char), dimension(*), intent(in) :: label
integer(c_int), intent(in), optional :: is_markupSet the label of a button, including using markup.
| Argument | Type | Required? | Description |
|---|---|---|---|
| BUTTON | c_ptr | required | The button to modify. |
| LABEL | string | required | The new label for the button. |
| IS_MARKUP | boolean | optional | Set this to TRUE if the label contains pango markup. |
function hl_gtk_check_button_new(label, toggled, data, tooltip, &
& initial_state, sensitive, is_markup, toggle) result(but)
type(c_ptr) :: but
character(kind=c_char), dimension(*), intent(in) :: label
type(c_funptr), optional :: toggled
type(c_ptr), optional :: data
character(kind=c_char), dimension(*), intent(in), optional :: tooltip
integer(c_int), intent(in), optional :: initial_state
integer(c_int), intent(in), optional :: sensitive, is_markup, toggleHigher level check box.
| Argument | Type | Required? | Description |
|---|---|---|---|
| LABEL | string | required | The label on the button. |
| TOGGLED | c_funptr | optional | Callback function for the "toggled" signal. |
| DATA | c_ptr | optional | Data to pass to/from the toggled callback. |
| TOOLTIP | string | optional | A tooltip for the check_button. |
| INITIAL_STATE | integer | optional | set the initial state of the check_button. |
| SENSITIVE | boolean | optional | Whether the widget should initially be sensitive or not. |
| IS_MARKUP | boolean | optional | Set this to TRUE if the label contains Pango markup. |
| TOGGLE | boolean | optional | Set this to TRUE to make a toggle button rather than a check button. |
subroutine hl_gtk_button_set_label_markup(but, label)
type(c_ptr) :: but
character(kind=c_char), dimension(*), intent(in) :: labelSet a markup label on a button
| Argument | Type | Required? | Description |
|---|---|---|---|
| BUT | c_ptr | required | The button to relabel |
| LABEL | string | required | The string (with Pango markup) to apply. |
Normally if the label does not need Pango markup, then gtk_button_set_label can be used.
module gtk_hl_comboboxThis interface implements the GtkComboBoxText widget for making a chooser. While this has more limited capabilities than the full GtkComboBox, it is adequate for the vast majority of uses.
function hl_gtk_combo_box_new(has_entry, changed, data, initial_choices, &
& sensitive, tooltip, active) result(cbox)
type(c_ptr) :: cbox
integer(c_int), intent(in), optional :: has_entry
type(c_funptr), optional :: changed
type(c_ptr), intent(in), optional :: data
character(len=*), dimension(:), intent(in), optional :: initial_choices
integer(c_int), intent(in), optional :: sensitive
character(kind=c_char), dimension(*), optional, intent(in) :: tooltip
integer(c_int), optional, intent(in) :: activeCreator for the combobox.
| Argument | Type | Required? | Description |
|---|---|---|---|
| HAS_ENTRY | boolean | optional | Set to TRUE to add an entry field. |
| CHANGED | c_funptr | optional | Callback routine for the "changed" signal. |
| DATA | c_ptr | optional | User data for the changed callback. |
| INITIAL_CHOICES | string() | optional | Initial list of choices. |
| SENSITIVE | boolean | optional | Set to FALSE to make the widget start in an insensitive state. |
| TOOLTIP | string | optional | A tooltip to display when the pointer is held over the widget. |
| ACTIVE | c_int | optional | The initial active selection. |
subroutine hl_gtk_combo_box_add_text(cbox, text, index, at_start)
type(c_ptr), intent(in) :: cbox
character(kind=c_char), dimension(*), optional :: text
integer(c_int), intent(in), optional :: index
integer(c_int), intent(in), optional :: at_startAdd a new choice to a combo box.
| Argument | Type | Required? | Description |
|---|---|---|---|
| CBOX | c_ptr | required | The combo box to modify. |
| TEXT | string | required | The text to add. |
| INDEX | c_int | optional | The location at which to add the text. |
| AT_START | boolean | optional | If set to TRUE and INDEX is not given then add the text at the start of the list. |
If neither INDEX nor AT_START is present the text is appended.
subroutine hl_gtk_combo_box_delete_single(cbox, index)
type(c_ptr), intent(in) :: cbox
integer(c_int), intent(in) :: indexDelete a line from a combo box
| Argument | Type | Required? | Description |
|---|---|---|---|
| CBOX | c_ptr | required | The combo box to update |
| INDEX | c_int | required | The index of the choce to remove |
Usually called via the generic hl_gtk_combo_box_delete interface.
subroutine hl_gtk_combo_box_delete_multi(cbox, index)
type(c_ptr), intent(in) :: cbox
integer(c_int), dimension(:), intent(in) :: indexDelete lines from a combo box
| Argument | Type | Required? | Description |
|---|---|---|---|
| CBOX | c_ptr | required | The combo box to update |
| INDEX | c_int() | required | The index of the choce to remove |
Usually called via the generic hl_gtk_combo_box_delete interface.
subroutine hl_gtk_combo_box_delete_all(cbox)
type(c_ptr), intent(in) :: cboxDelete all lines from a combo box
| Argument | Type | Required? | Description |
|---|---|---|---|
| CBOX | c_ptr | required | The combo box to update |
Usually called via the generic hl_gtk_combo_box_delete interface.
function hl_gtk_combo_box_get_active(cbox, text, ftext) result(index)
integer(c_int) :: index
type(c_ptr), intent(in) :: cbox
type(c_ptr), intent(out), optional :: text
character(len=*), intent(out), optional :: ftextGet the selection from a combo box
| Argument | Type | Required? | Description |
|---|---|---|---|
| CBOX | c_ptr | required | The combo box to query. |
| TEXT | c_ptr | optional | C pointer to the text. |
| FTEXT | fstring | optional | The string as a Fortran string. |
function hl_gtk_combo_box_n_entries(cbox) result(count)
integer(c_int) :: count
type(c_ptr), intent(in) :: cboxFind the number of entries in a combo box.
| Argument | Type | Required? | Description |
|---|---|---|---|
| CBOX | c_ptr | required | The combo box to query. |
module gtk_hl_entryConvenience functions for both single and multiple line text boxes.
The single line is just wrappers for the GtkEntry widget.
The multi line editor is based around the GtkTextView widget family. The HL interface hides the text buffer from the user, except in some callbacks where the signal is attached to the buffer not the view.
If you do need to access the text buffer directly it can be obtained with the gtk_text_view_get_buffer function, or it can be returned via the optional BUFFER argument to the constructor.
function hl_gtk_entry_new(len, editable, activate, data, tooltip, value, &
& sensitive, changed, data_changed, delete_text, data_delete_text, &
& insert_text, data_insert_text, focus_in_event, focus_out_event, &
& data_focus_in, data_focus_out, size) result(entry)
type(c_ptr) :: entry
integer(c_int), intent(in), optional :: len
integer(c_int), intent(in), optional :: editable
type(c_funptr), optional :: activate, focus_in_event, focus_out_event
type(c_ptr), optional :: data
character(kind=c_char), dimension(*), intent(in), optional :: tooltip, value
integer(c_int), intent(in), optional :: sensitive
type(c_funptr), optional :: changed, delete_text, insert_text
type(c_ptr), optional :: data_changed, data_delete_text, data_insert_text
type(c_ptr), optional :: data_focus_in, data_focus_out
integer(c_int), intent(in), optional :: size
type(c_ptr) :: bufferHigher level text entry box
| Argument | Type | Required? | Description |
|---|---|---|---|
| LEN | integer | optional | The maximum length of the entry field. |
| EDITABLE | boolean | optional | whether the entry box can be edited by the user |
| ACTIVATE | c_funptr | optional | Callback function for the "activate" signal |
| DATA | c_ptr | optional | Data to be passed to the activate callback (this is a plain DATA because the changed and other signals were added later. |
| TOOLTIP | string | optional | tooltip to be displayed when the pointer is held over the button. |
| VALUE | string | optional | An initial value for the entry box. |
| SENSITIVE | boolean | optional | Whether the widget should initially be sensitive or not. |
| CHANGED | c_funptr | optional | Callback for the "changed" signal. |
| DATA_CHANGED | c_ptr | optional | Data to be passed to the changed callback. |
| DELETE_TEXT | c_funptr | optional | Callback for the "delete-text" signal. |
| DATA_DELETE_TEXT | c_ptr | optional | Data to be passed to the delete_text callback |
| INSERT_TEXT | c_funptr | optional | Callback for the "insert-text" signal. |
| DATA_INSERT_TEXT | c_ptr | optional | Data to be passed to the insert_text callback |
| FOCUS_OUT_EVENT | c_funptr | optional | Callback for the "focus-out-event" signal, this is a GDK event rather than a GTK signal, so the call back is a function of 3 arguments returning gboolean. |
| DATA_FOCUS_OUT | c_ptr | optional | Data to pass to the focus_out_event callback |
| FOCUS_IN_EVENT | c_funptr | optional | Callback for the "focus-in-event" signal, this is a GDK event rather than a GTK signal, so the call back is a function of 3 arguments returning gboolean. |
| DATA_FOCUS_IN | c_ptr | optional | Data to pass to the focus_in_event callback |
| SIZE | integer | optional | The X-size request for the widget. Y is set to default (-1). Note that Gtk may make the widget bigger than this if expand/fill options in the packing require it. |
subroutine hl_gtk_entry_get_text(entry, text, status)
type(c_ptr), intent(in) :: entry
character(len=*), intent(out) :: text
integer(c_int), optional, intent(out) :: statusReturn the text in an entry box as a fortran string.
| Argument | Type | Required? | Description |
|---|---|---|---|
| ENTRY | c_ptr | required | The text entry to read |
| TEXT | f_string | required | The text read. |
| STATUS | c_int | optional | Returns -1 if the string is truncated. |
To return the text as a c-pointer use gtk_entry_get_text
function hl_gtk_text_view_new(scroll, editable, changed, data_changed, &
& insert_text, data_insert_text, delete_range, data_delete_range, &
& initial_text, sensitive, tooltip, ssize, buffer, focus_in_event, &
& focus_out_event, data_focus_in, data_focus_out, hscroll_policy, &
& vscroll_policy) result(view)
type(c_ptr) :: view
type(c_ptr), intent(out), optional :: scroll
integer(c_int), intent(in), optional :: editable
type(c_funptr), optional :: changed, insert_text, delete_range
type(c_ptr), optional :: data_changed, data_insert_text, data_delete_range
character(kind=c_char, len=*), dimension(:), intent(in), &
& optional :: initial_text
integer(c_int), intent(in), optional :: sensitive
character(kind=c_char), dimension(*), optional :: tooltip
integer(c_int), dimension(:), optional :: ssize
type(c_ptr), intent(out), optional :: buffer
type(c_funptr), optional :: focus_in_event, focus_out_event
type(c_ptr), optional :: data_focus_in, data_focus_out
integer(c_int), intent(in), optional :: hscroll_policy, vscroll_policyA multiline text edit widget
| Argument | Type | Required? | Description |
|---|---|---|---|
| SCROLL | c_ptr | optional | A scrolled window in which the text editor is placed. If it is present, then it must be used used for packing the widget into your application. If it is not used, then scroll bars will not be added if the text goes beyond the edge of the box. |
| EDITABLE | boolean | optional | Set to FALSE to make a non-editable text box. |
| CHANGED | c_funptr | optional | Callback for the "activate" signal. |
| DATA_CHANGED | c_ptr | optional | User data to pass to/from the activate callback |
| INSERT_TEXT | c_funptr | optional | Callback for the "insert-text" signal. This handler is attached to the text buffer not the text view. |
| DATA_INSERT_TEXT | c_ptr | optional | User data for the insert-text callback. |
| DELETE_RANGE | c_funptr | optional | Callback for the "delete-range" signal. This handler is attached to the text buffer not the text view. |
| DATA_DELETE_RANGE | c_ptr | optional | User data for the delete-range callback. |
| INITIAL_TEXT | string() | optional | Initial text to put in the text window. |
| SENSITIVE | boolean | optional | Set to FALSE to make the widget start in an insensitive state. |
| TOOLTIP | string | optional | A tooltip to display when the pointer is held over the widget. |
| SSIZE | c_int(2) | optional | Size of the scroll widget. |
| BUFFER | c_ptr | optional | Variable to return the buffer pointer |
| FOCUS_OUT_EVENT | c_funptr | optional | Callback for the "focus-out-event" signal, this is a GDK event rather than a GTK signal, so the call back is a function of 3 arguments returning gboolean. |
| DATA_FOCUS_OUT | c_ptr | optional | Data to pass to the focus_out_event callback |
| FOCUS_IN_EVENT | c_funptr | optional | Callback for the "focus-in-event" signal, this is a GDK event rather than a GTK signal, so the call back is a function of 3 arguments returning gboolean. |
| DATA_FOCUS_IN | c_ptr | optional | Data to pass to the focus_in_event callback |
| HSCROLL_POLICY | int | optional | Horizontal scrolling policy for the containing scroll window (default AUTOMATIC). |
| VSCROLL_POLICY | int | optional | Vertical scrolling policy for the containing scroll window (default AUTOMATIC). |
NOTE -- The insert-text and delete-range callbacks take extra arguments. They are called before the buffer is actually modified. The changed callback is called after the change.
subroutine hl_gtk_text_view_insert(view, text, line, column, replace, &
& at_cursor, buffer)
type(c_ptr), intent(in) :: view
character(len=*), dimension(:), intent(in) :: text
integer(c_int), optional, intent(in) :: line, column
integer(c_int), optional, intent(in) :: replace, at_cursor
type(c_ptr), intent(in), optional :: bufferInsert text to an text view
| Argument | Type | Required? | Description |
|---|---|---|---|
| VIEW | c_ptr | required | The text view into which to insert. |
| TEXT | string() | required | The text to insert. |
| LINE | c_int | optional | The line at which to insert (if omitted, then the text is appended). |
| COLUMN | c_int | optional | The column as which to insert the text (If omitted, then insert at the start of the line). |
| REPLACE | boolean | optional | If set to TRUE and LINE and COLUMN are omitted then replace the text in the buffer. |
| AT_CURSOR | boolean | optional | Set to TRUE to insert the text at the cursor. |
| BUFFER | c_ptr | optional | The text buffer in which to insert the text If this is given, then VIEW is ignored -- used in signal handlers attached to the buffer. |
subroutine hl_gtk_text_view_delete(view, line, column, n_chars, n_lines, &
& buffer)
type(c_ptr), intent(in) :: view
integer(c_int), intent(in), optional :: line, column, n_chars, n_lines
type(c_ptr), intent(in), optional :: bufferDelete from a text view
| Argument | Type | Required? | Description |
|---|---|---|---|
| VIEW | c_ptr | required | The text view from which to delete. |
| LINE | c_int | optional | The line at which to start the deletion |
| COLUMN | c_int | optional | The column at which to start the deletion. required if N_CHARS is given. Ignored if N_LINES is given. |
| N_CHARS | c_int | optional | How many characters to delete. |
| N_LINES | c_int | optional | How many lines to delete. |
| BUFFER | c_ptr | optional | The text buffer from which to delete. If this is given, then VIEW is ignored, used in signal handlers attached to the buffer. |
If no location specifiers are given then the buffer is cleared
subroutine hl_gtk_text_view_get_text(view, text, start_line, start_column, &
& end_line, end_column, hidden, buffer)
type(c_ptr), intent(in) :: view
character(len=*), dimension(:), allocatable, intent(out) :: text
integer(c_int), intent(in), optional :: start_column, start_line, &
& end_line, end_column
integer(c_int), intent(in), optional :: hidden
type(c_ptr), intent(in), optional :: bufferGet text from s text view.
| Argument | Type | Required? | Description |
|---|---|---|---|
| VIEW | c_ptr | required | The text view to read. |
| TEXT | string() | required | A variable to contain the output text. |
| START_LINE | c_int | optional | The first line to read. |
| START_COLUMN | c_int | optional | The column at which to start reading. |
| END_LINE | c_int | optional | The last line to read. |
| END_COLUMN | c_int | optional | The column at which to stop reading. |
| HIDDEN | boolean | optional | If set to FALSE, then do not get hidden characters |
| BUFFER | c_ptr | optional | The text buffer from which to read. If this is given, then VIEW is ignored, useful for signal handlers attached to the buffer. |
Note the rules for selection.
- If no selection arguments are present, the whole text is returned.
- If either start_column or end_column is absent, but the matching line is present, then selection is by line.
- If end_line is absent, but both columns are present, then the selection is within start_line
- If neither start_line nor start_column is present, then the selection is from the start of the buffer
- If neither end_line nor end_column is present, then the selection is to the end of the buffer.
function hl_gtk_text_view_get_cursor(view, buffer) result(ipos)
integer(c_int), dimension(3) :: ipos
type(c_ptr), intent(in) :: view
type(c_ptr), intent(in), optional :: bufferGet the current cursor location
| Argument | Type | Required? | Description |
|---|---|---|---|
| VIEW | c_ptr | required | The text view to query |
| BUFFER | c_ptr | optional | The buffer to query (if given, then VIEW is ignored). |
Returns a 3-element array with the line, column and offset of the cursor
function hl_gtk_text_view_get_selection(view, s_start, s_end, buffer) &
& result(issel)
integer(c_int) :: issel
type(c_ptr), intent(in) :: view
integer(c_int), dimension(3), intent(out) :: s_start, s_end
type(c_ptr), intent(in), optional :: bufferGet the selection range
| Argument | Type | Required? | Description |
|---|---|---|---|
| VIEW | c_ptr | required | The text view to query. |
| S_START | c_int() | required | The start of the selection. (line, column, offset) |
| S_END | c_int() | required | The end of the selection. (line, column, offset) |
| BUFFER | c_ptr | optional | The text buffer to query. If present, then the view argument is ignored. |
Returns TRUE if there is a selection, FALSE if there isn't
function hl_gtk_text_view_get_modified(view) result(ismod)
integer(c_int) :: ismod
type(c_ptr), intent(in) :: viewCheck if the buffer of a text view is modified
| Argument | Type | Required? | Description |
|---|---|---|---|
| VIEW | c_ptr | required | The text view to check. |
N.B. No BUFFER argument is provided as gtk_text_buffer_get_modified is just a single call
subroutine hl_gtk_text_view_set_modified(view, state)
type(c_ptr), intent(in) :: view
integer(c_int), intent(in) :: stateSet/clear the modified flag on the text buffer of a text view
| Argument | Type | Required? | Description |
|---|---|---|---|
| VIEW | c_ptr | required | The text view to set |
| STATE | boolean | required | The state to set the flag to. |
subroutine hl_gtk_text_view_get_info(view, nlines, nchars, ncline, buffer)
type(c_ptr), intent(in) :: view
integer(c_int), intent(out), optional :: nlines, nchars
integer(c_int), intent(out), optional, allocatable, dimension(:) :: ncline
type(c_ptr), intent(in), optional :: bufferGet various useful information about a text view
| Argument | Type | Required? | Description |
|---|---|---|---|
| VIEW | c_ptr | required | The view to query |
| NLINES | c_int | optional | Return the number of lines in the view |
| NCHARS | c_int | optional | Return the number of characters in the view |
| NCLINE | c_int() | optional | Return the nuber of characters in each line. Must be an allocatable array. |
| BUFFER | c_ptr | optional | If present use this buffer and ignore the VIEW argument |
module gtk_hl_spin_sliderGTK sliders and spin buttons use floating point values, the HL interface implements an automatic interface selection between a floating point or an integer slider.
Although they belong to completely different widget families in GTK, the interfaces are very similar, which is why they are grouped together here.
function hl_gtk_slider_flt_new(vmin, vmax, step, vertical, initial_value, &
& value_changed, data, digits, sensitive, tooltip, draw, length) &
& result(slider)
type(c_ptr) :: slider
real(c_double), intent(in) :: vmin, vmax, step
integer(c_int), intent(in), optional :: vertical
real(c_double), intent(in), optional :: initial_value
type(c_funptr), optional :: value_changed
type(c_ptr), optional :: data
integer(c_int), optional, intent(in) :: digits
integer(c_int), optional, intent(in) :: sensitive
character(len=*), intent(in), optional:: tooltip
integer(c_int), intent(in), optional :: draw
integer(c_int), intent(in), optional :: lengthFloating point version of a slider
| Argument | Type | Required? | Description |
|---|---|---|---|
| VMIN | c_double | required | The minimum value for the slider |
| VMAX | c_double | required | The maximum value for the slider |
| STEP | c_double | required | The step for the slider. |
| VERTICAL | boolean | optional | if TRUE then a vertical slider is created if FALSE or absent, then a horizontal silder is created. |
| INITIAL_VALUE | c_double | optional | Set the intial value of the slider |
| VALUE_CHANGED | c_funptr | optional | Callback function for the "value-changed" signal. |
| DATA | c_ptr | optional | User data to pass the the value_changed callback. |
| DIGITS | c_int | optional | Number of decimal places to show. |
| SENSITIVE | boolean | optional | Whether the widget is created in the sensitive state. |
| TOOLTIP | string | optional | A tooltip to display. |
| DRAW | boolean | optional | Set to FALSE to suppress writing the value. |
| LENGTH | c_int | optional | Set the length of the slider in pixels |
This routine is usually called via its generic interface hl_gtk_slider_new
function hl_gtk_slider_int_new(imin, imax, vertical, initial_value, &
& value_changed, data, sensitive, tooltip, draw, length) result(slider)
type(c_ptr) :: slider
integer(c_int), intent(in) :: imin, imax
integer(c_int), intent(in), optional :: vertical
integer(c_int), intent(in), optional :: initial_value
type(c_funptr), optional :: value_changed
type(c_ptr), optional :: data
integer(c_int), optional, intent(in) :: sensitive
character(len=*), intent(in), optional:: tooltipNB the C-type confuses generic interfaces. integer(c_int), intent(in), optional :: draw integer(c_int), intent(in), optional :: length
Integer version of a slider
| Argument | Type | Required? | Description |
|---|---|---|---|
| IMIN | c_int | required | The minimum value for the slider |
| IMAX | c_int | required | The maximum value for the slider |
| VERTICAL | boolean | optional | if TRUE then a vertical slider is created if FALSE or absent, then a horizontal silder is created. |
| INITIAL_VALUE | c_int | optional | Set the intial value of the slider |
| VALUE_CHANGED | c_funptr | optional | Callback function for the "value-changed" signal. |
| DATA | c_ptr | optional | User data to pass the the value_changed callback. |
| SENSITIVE | boolean | optional | Whether the widget is created in the sensitive state. |
| TOOLTIP | string | optional | A tooltip to display. |
| DRAW | boolean | optional | Set to FALSE to suppress writing the value. |
| LENGTH | c_int | optional | Set the length of the slider in pixels |
This routine is usually called via its generic interface hl_gtk_slider_new
function hl_gtk_slider_get_value(slider) result(val)
real(c_double) :: val
type(c_ptr) :: sliderGet the value of a slider
| Argument | Type | Required? | Description |
|---|---|---|---|
| SLIDER | c_ptr | required | The slider to read. |
Note even for an integer slider we get a float value but there's no problem letting Fortran do the truncation
subroutine hl_gtk_slider_set_flt(slider, val)
type(c_ptr), intent(in) :: slider
real(c_double), intent(in) :: valSet a floating point value for a slider
| Argument | Type | Required? | Description |
|---|---|---|---|
| SLIDER | c_ptr | required | The slider to set. |
| VAL | c_double | required | The value to set. |
This is usually accessed via the generic interface hl_gtk_slider_set_value. Note that since GTK implements all sliders a doubles, either type of value may be used to set any slider.
subroutine hl_gtk_slider_set_int(slider, val)
type(c_ptr), intent(in) :: slider
integer(c_int), intent(in) :: valSet an integer value for a slider
| Argument | Type | Required? | Description |
|---|---|---|---|
| SLIDER | c_ptr | required | The slider to set. |
| VAL | c_int | required | The value to set. |
This is usually accessed via the generic interface hl_gtk_slider_set_value. Note that since GTK implements all sliders a doubles, either type of value may be used to set any slider.
subroutine hl_gtk_slider_set_range(slider, lower, upper, step, digits)
type(c_ptr), intent(in) :: slider
real(c_double), intent(in), optional :: lower, upper, step
integer(c_int), intent(in), optional :: digitsAdjust the bounds of a slider
| Argument | Type | Required? | Description |
|---|---|---|---|
| SLIDER | c_ptr | required | The slider to modify |
| LOWER | c_double | optional | The new lower bound |
| UPPER | c_double | optional | The new uppper bound |
| STEP | c_double | optional | The new step size. |
| DIGITS | c_int | optional | The new number of decimals. |
Note This routine is not a generic interface as overloading requires that the interface be distinguishable by its required arguments, and it seems less annoying to have to convert to doubles or use a separate call than to specify an unchanged bound.
subroutine hl_gtk_slider_set_range_int(slider, lower, upper)
type(c_ptr), intent(in) :: slider
integer(c_int), intent(in), optional :: lower, upperAdjust the bounds of a slider, integer values
| Argument | Type | Required? | Description |
|---|---|---|---|
| SLIDER | c_ptr | required | The slider to modify |
| LOWER | c_int | optional | The new lower bound |
| UPPER | c_int | optional | The new uppper bound |
Note This routine is not a generic interface as overloading requires that the interface be distinguishable by its required arguments, and it seems less annoying to use a separate call than to specify an unchanged bound.
function hl_gtk_spin_button_flt_new(vmin, vmax, step, initial_value, &
& value_changed, data, digits, sensitive, tooltip, wrap, &
& focus_in_event, focus_out_event, data_focus_in, data_focus_out) &
& result(spin_button)
type(c_ptr) :: spin_button
real(c_double), intent(in) :: vmin, vmax, step
real(c_double), intent(in), optional :: initial_value
type(c_funptr), optional :: value_changed
type(c_ptr), optional :: data
integer(c_int), optional, intent(in) :: digits
integer(c_int), optional, intent(in) :: sensitive
character(len=*), intent(in), optional:: tooltipNB the C-type confuses generic interfaces. integer(c_int), intent(in), optional :: wrap type(c_funptr), optional :: focus_in_event, focus_out_event type(c_ptr), optional :: data_focus_in, data_focus_out
Floating point version of a spin_button
| Argument | Type | Required? | Description |
|---|---|---|---|
| VMIN | c_double | required | The minimum value for the spin_button |
| VMAX | c_double | required | The maximum value for the spin_button |
| STEP | c_double | required | The step for the spin_button. |
| INITIAL_VALUE | c_double | optional | Set the intial value of the spin_button |
| VALUE_CHANGED | c_funptr | optional | Callback function for the "value-changed" signal. |
| DATA | c_ptr | optional | User data to pass the the value_changed callback. |
| DIGITS | c_int | optional | Number of decimal places to show. |
| SENSITIVE | boolean | optional | Whether the widget is created in the sensitive state. |
| TOOLTIP | string | optional | A tooltip to display. |
| WRAP | boolean | optional | If set to TRUE then wrap around if limit is exceeded |
| FOCUS_OUT_EVENT | c_funptr | optional | Callback for the "focus-out-event" signal, this is a GDK event rather than a GTK signal, so the call back is a function of 3 arguments returning gboolean. |
| DATA_FOCUS_OUT | c_ptr | optional | Data to pass to the focus_out_event callback |
| FOCUS_IN_EVENT | c_funptr | optional | Callback for the "focus-in-event" signal, this is a GDK event rather than a GTK signal, so the call back is a function of 3 arguments returning gboolean. |
| DATA_FOCUS_IN | c_ptr | optional | Data to pass to the focus_in_event callback |
This routine is usually called via its generic interface hl_gtk_spin_button_new
function hl_gtk_spin_button_int_new(imin, imax, initial_value, &
& value_changed, data, sensitive, tooltip, wrap, &
& focus_in_event, focus_out_event, data_focus_in, data_focus_out) &
& result(spin_button)
type(c_ptr) :: spin_button
integer(c_int), intent(in) :: imin, imax
integer(c_int), intent(in), optional :: initial_value
type(c_funptr), optional :: value_changed
type(c_ptr), optional :: data
integer(c_int), optional, intent(in) :: sensitive
character(len=*), intent(in), optional:: tooltipNB the C-type confuses generic interfaces. integer(c_int), intent(in), optional :: wrap type(c_funptr), optional :: focus_in_event, focus_out_event type(c_ptr), optional :: data_focus_in, data_focus_out
Integer version of a spin_button
| Argument | Type | Required? | Description |
|---|---|---|---|
| IMIN | c_int | required | The minimum value for the spin_button |
| IMAX | c_int | required | The maximum value for the spin_button |
| INITIAL_VALUE | c_int | optional | Set the intial value of the spin_button |
| VALUE_CHANGED | c_funptr | optional | Callback function for the "value-changed" signal. |
| DATA | c_ptr | optional | User data to pass the the value_changed callback. |
| SENSITIVE | boolean | optional | Whether the widget is created in the sensitive state. |
| TOOLTIP | string | optional | A tooltip to display. |
| WRAP | boolean | optional | If set to TRUE then wrap around if limit is exceeded |
| FOCUS_OUT_EVENT | c_funptr | optional | Callback for the "focus-out-event" signal, this is a GDK event rather than a GTK signal, so the call back is a function of 3 arguments returning gboolean. |
| DATA_FOCUS_OUT | c_ptr | optional | Data to pass to the focus_out_event callback |
| FOCUS_IN_EVENT | c_funptr | optional | Callback for the "focus-in-event" signal, this is a GDK event rather than a GTK signal, so the call back is a function of 3 arguments returning gboolean. |
| DATA_FOCUS_IN | c_ptr | optional | Data to pass to the focus_in_event callback |
This routine is usually called via its generic interface hl_gtk_spin_button_new
function hl_gtk_spin_button_get_value(spin_button) result(val)
real(c_double) :: val
type(c_ptr) :: spin_buttonGet the value of a spin_button
| Argument | Type | Required? | Description |
|---|---|---|---|
| SPIN_BUTTON | c_ptr | required | The spin_button to read. |
Note even for an integer spin_button we get a float value but there's no problem letting Fortran do the truncation
subroutine hl_gtk_spin_button_set_flt(spin_button, val)
type(c_ptr), intent(in) :: spin_button
real(c_double), intent(in) :: valSet a floating point value for a spin_button
| Argument | Type | Required? | Description |
|---|---|---|---|
| SPIN_BUTTON | c_ptr | required | The spin_button to set. |
| VAL | c_double | required | The value to set. |
This is usually accessed via the generic interface hl_gtk_spin_button_set_value. Note that since GTK implements all spin buttons as double either type may be used for any button.
subroutine hl_gtk_spin_button_set_int(spin_button, val)
type(c_ptr), intent(in) :: spin_button
integer(c_int), intent(in) :: valSet an integer value for a spin_button
| Argument | Type | Required? | Description |
|---|---|---|---|
| SPIN_BUTTON | c_ptr | required | The spin_button to set. |
| VAL | c_int | required | The value to set. |
This is usually accessed via the generic interface hl_gtk_spin_button_set_value. Note that since GTK implements all spin buttons as double either type may be used for any button.
subroutine hl_gtk_spin_button_set_range(spin_button, lower, upper, &
& step, digits)
type(c_ptr), intent(in) :: spin_button
real(c_double), intent(in), optional :: lower, upper, step
integer(c_int), intent(in), optional :: digitsAdjust the bounds of a spin box
| Argument | Type | Required? | Description |
|---|---|---|---|
| SLIDER | c_ptr | required | The slider to modify |
| LOWER | c_double | optional | The new lower bound |
| UPPER | c_double | optional | The new uppper bound |
| STEP | c_double | optional | The new step size. |
| DIGITS | c_int | optional | The new number of decimals. |
Note This routine is not a generic interface as overloading requires that the interface be distinguishable by its required arguments, and it seems less annoying to have to convert to doubles or use a separate call than to specify an unchanged bound.
subroutine hl_gtk_spin_button_set_range_int(spin_button, lower, upper)
type(c_ptr), intent(in) :: spin_button
integer(c_int), intent(in), optional :: lower, upperAdjust the bounds of a spin box, integer values
| Argument | Type | Required? | Description |
|---|---|---|---|
| SLIDER | c_ptr | required | The slider to modify |
| LOWER | c_int | optional | The new lower bound |
| UPPER | c_int | optional | The new uppper bound |
Note This routine is not a generic interface as overloading requires that the interface be distinguishable by its required arguments, and it seems less annoying to use a separate call than to specify an unchanged bound.
module gtk_hl_infobarConvenience interface for the GtkInfoBar widget. This is created because the routine for adding multiple buttons is variadic, and setting the message involves several levels of indirection.
function hl_gtk_info_bar_new(buttons, ids, response, data_response, close, &
& data_close, auto_show, type, default, horizontal, buttons_below) &
& result(infobar)
type(c_ptr) :: infobar
character(len=*,kind=c_char), dimension(:), intent(in), optional :: buttons
integer(c_int), dimension(:), intent(in), optional :: ids
type(c_funptr), optional :: response, close
type(c_ptr), intent(in), optional :: data_response, data_close
integer(c_int), intent(in), optional :: auto_show, type, default
integer(c_int), intent(in), optional :: horizontal, buttons_belowCreate a new info bar.
| Argument | Type | Required? | Description |
|---|---|---|---|
| BUTTONS | f_string() | optional | The buttons to add to the |
| IDS | c_int() | optional | The response IDs for the buttons. If buttons are specified and no IDS are given, then the button index is used. |
| RESPONSE | c_funptr | optional | The handler for a button pressed (has an extra argument which is the button ID. |
| DATA_RESPONSE | c_ptr | optional | User data to pass to the response handler. |
| CLOSE | c_funptr | optional | The handler for closing the bar by a key action. |
| DATA_CLOSE | c_ptr | optional | User data to pass to the close handler. |
| AUTO_SHOW | boolean | optional | Whether the info bar should be displayed when its parent is shown. Default=FALSE. |
| TYPE | c_int | optional | The initial message type. |
| DEFAULT | c_int | optional | Set the initial default response ID. |
| HORIZONTAL | boolean | optional | Set to TRUE to lay the buttons in a row rather than a column. Removed from GTK 4. |
| BUTTONS_BELOW | boolean | optional | Set to TRUE to place the buttons below the message rather than to the right. |
subroutine hl_gtk_info_bar_message(infobar, message, type, default, &
& ids, state)
type(c_ptr), intent(in) :: infobar
character(kind=c_char), dimension(*), intent(in) :: message
integer(c_int), intent(in), optional :: type, default
integer(c_int), intent(in), optional, dimension(:) :: ids, stateShow a message in an infobar
| Argument | Type | Required? | Description |
|---|---|---|---|
| INFOBAR | c_ptr | required | The infobar to update. |
| MESSAGE | c_str | required | The message to display. |
| TYPE | c_int | optional | The severity level of the message. |
| DEFAULT | c_int | optional | Set the default response ID. |
| IDS | c_int() | optional | Response IDs whose sensitivity will be set. |
| STATE | boolean() | optional | Sensitivity states of the IDS. |
To set buttons to be sensitive or not, you must give BOTH ids and state, and they must be the same length.
module gtk_hl_dialogThe message dialogue provided is here because, the built-in message dialogue GtkMessageDialog cannot be created without calling variadic functions which are not compatible with Fortran, therefore this is based around the plain GtkDialog family.
There are two functions provided, one; hl_gtk_message_dialog_new, just creates a dialogue and the other; hl_gtk_message_dialog_show, creates the dialogue and also displays it and returns the response. Unless you need to add other non-standard buttons to the dialogue it is easier to use hl_gtk_message_dialog_show.
function hl_gtk_message_dialog_new(message, button_set, title, type, &
& parent) result(dialog)
type(c_ptr) :: dialog
character(len=*), dimension(:), intent(in) :: message
integer(c_int), intent(in) :: button_set
character(kind=c_char), dimension(*), intent(in), optional :: title
integer(c_int), intent(in), optional :: type
type(c_ptr), intent(in), optional :: parentA DIY version of the message dialogue, needed because both creators for the built in one are variadic and so not callable from Fortran.
| Argument | Type | Required? | Description |
|---|---|---|---|
| MESSAGE | string(n) | required | The message to display. Since this is a string array, the C_NULL_CHAR terminations are provided internally |
| BUTTON_SET | integer | required | The set of buttons to display |
| TITLE | string | optional | Title for the window. |
| TYPE | c_int | optional | Message type (a GTK_MESSAGE_ value) |
| PARENT | c_ptr | optional | An optional parent for the dialogue. |
function hl_gtk_message_dialog_show(message, button_set, title, type, &
& parent) result(resp)
integer(c_int) :: resp
character(len=*), dimension(:), intent(in) :: message
integer(c_int), intent(in) :: button_set
character(kind=c_char), dimension(*), intent(in), optional :: title
integer(c_int), intent(in), optional :: type
type(c_ptr), intent(in), optional :: parentA DIY version of the message dialogue, needed because both creators for the built in one are variadic and so not callable from Fortran. This version runs the dialog as well as creating it.
| Argument | Type | Required? | Description |
|---|---|---|---|
| MESSAGE | string(n) | required | The message to display. Since this is a string array, the C_NULL_CHAR terminations are provided internally |
| BUTTON_SET | integer | required | The set of buttons to display |
| TITLE | string | optional | Title for the window. |
| TYPE | c_int | optional | Message type (a GTK_MESSAGE_ value) |
| PARENT | c_ptr | optional | An optional parent for the dialogue. |
This version returns a response code, not a widget pointer.
function hl_gtk_about_dialog_new(name, license, license_type, &
& comments, authors, website, website_label, copyright, version, &
& documenters, translators, artists, logo, parent) result(about)
type(c_ptr) :: about
character(kind=c_char, len=*), intent(in), optional :: name
character(kind=c_char, len=*), intent(in), optional :: license
integer(c_int), intent(in), optional :: license_type
character(kind=c_char, len=*), intent(in), optional :: comments
character(len=*, kind=c_char), dimension(:), optional, target :: authors, &
& documenters, artists
character(kind=c_char, len=*), intent(in), optional :: website, &
& website_label, translators, copyright, version
type(c_ptr), intent(in), optional :: logo, parentA convenience interface for about dialogues.
| Argument | Type | Required? | Description |
|---|---|---|---|
| NAME | string | optional | The name of the program etc. |
| LICENCE | string | optional | The license for the program. |
| LICENCE_TYPE | c_int | optional | Specify a license from the GtkLicence enumerator. (Only valid in GTK 3.0 and later) |
| COMMENTS | string | optional | A description of the program/library... |
| AUTHORS | string() | optional | A list of the authors. |
| WEBSITE | string | optional | The website. |
| WEBSITE_LABEL | string | optional | A label to describe the website. |
| COPYRIGHT | string | optional | The copyright message. |
| VERSION | string | optional | The version of the program. |
| DOCUMENTERS | string() | optional | The documentation authors. |
| TRANSLATORS | string | optional | The translators (N.B. unlike the other credits, this is a single string). |
| ARTISTS | string() | optional | The artists involved. |
| LOGO | c_ptr | optional | A gdk_pixbuf with the project's logo. |
| PARENT | c_ptr | optional | The parent widget of the window. |
subroutine hl_gtk_about_dialog_gtk_fortran(parent)
type(c_ptr), intent(in), optional :: parentA standard "About" dialogue for gtk-fortran
| Argument | Type | Required? | Description |
|---|---|---|---|
| PARENT | c_ptr | optional | A parent widget for the dialogue. |
module gtk_hl_progressImplements the GtkProgressBar widget. Includes the facility to make a bar display "n of m" as well as the usual fraction.
function hl_gtk_progress_bar_new(vertical, reversed, step) result(bar)
type(c_ptr) :: bar
integer(c_int), optional :: vertical, reversed
real(c_double), optional :: stepIntializer for a progress bar
| Argument | Type | Required? | Description |
|---|---|---|---|
| VERTICAL | boolean | optional | The orientation of the bar. |
| REVERSED | boolean | optional | Whether the direction of the bar should be reversed. |
| STEP | double | optional | The fractional step to advance when pulsing the bar |
subroutine hl_gtk_progress_bar_set_f(bar, val, string, text)
type(c_ptr) :: bar
real(c_double), optional :: val
integer(c_int), optional :: string
character(len=*), intent(in), optional:: textSet the value of a progress bar (fraction or pulse)
| Argument | Type | Required? | Description |
|---|---|---|---|
| BAR | c_ptr | required | The bar to set |
| VAL | double | optional | The value to set. If absent, the bar is pulsed |
| STRING | boolean | optional | Whether to put a string on the bar. |
| TEXT | string | optional | Text to put in the bar, (overrides STRING) |
This routine is normally accessed via the generic interface hl_gtk_progress_bar_set
subroutine hl_gtk_progress_bar_set_ii(bar, val, maxv, string, text)
type(c_ptr) :: bar
integer(c_int) :: val, maxv
integer(c_int), optional :: string
character(len=*), intent(in), optional:: textSet the value of a progress bar (n of m)
| Argument | Type | Required? | Description |
|---|---|---|---|
| BAR | c_ptr | required | The bar to set |
| VAL | int | required | The value to set. |
| MAXV | int | required | The maximum value for the bar |
| STRING | boolean | optional | Whether to put a string on the bar. |
| TEXT | string | optional | Text to put in the bar, (overrides STRING) |
This routine is normally accessed via the generic interface hl_gtk_progress_bar_set
module gtk_hl_assistantHigh-level interface to the GtkAssistant widget
function hl_gtk_assistant_new(title, destroy, delete_event, data_destroy, &
& data_delete_event, close, data_close, cancel, data_cancel, &
& border, wsize, parent, icon, icon_file, &
& icon_name, forward, data_forward) result(asstnt)
type(c_ptr) :: asstnt
character(kind=c_char), dimension(*), intent(in), optional :: title
type(c_funptr), optional :: destroy, delete_event, close, cancel
type(c_ptr), optional :: data_destroy, data_delete_event, data_close, &
& data_cancel
integer(c_int), optional, intent(in) :: border
integer(c_int), optional, intent(in), dimension(2) :: wsize
type(c_ptr), optional :: parent
type(c_ptr), intent(in), optional :: icon
character(kind=c_char), dimension(*), intent(in), optional :: icon_name, &
& icon_file
type(c_funptr), optional :: forward
type(c_ptr), optional, intent(in) :: data_forwardHigher level interface to make a GtkAssistant
| Argument | Type | Required? | Description |
|---|---|---|---|
| TITLE | String | optional | Title for the window |
| DESTROY | c_funptr | optional | Callback for the "destroy" signal |
| DELETE_EVENT | c_funptr | optional | Callback for the "delete-event" signal |
| CLOSE | c_funptr | optional | Callback for when the assistant is completed |
| CANCEL | c_funptr | optional | Callback for the Cancel operation. |
| DATA_DESTROY | c_ptr | optional | Data to be passed to the destroy signal handler |
| DATA_DELETE_EVENT | c_ptr | optional | Data to be passed to the delete_event signal handler |
| DATA_CLOSE | c_ptr | optional | Data to be passed to the close signal |
| DATA_CANCEL | c_ptr | optional | Data to be passed to the cancel signal. |
| BORDER | integer | optional | Size of the window border |
| WSIZE | integer(2) | optional | Size of the window |
| PARENT | c_ptr | optional | An optional parent window for the new window. |
| ICON | c_ptr | optional | A GdkPixbuf containing the icon for the window. |
| ICON_FILE | String | optional | A file from which to read the icon for the window. |
| ICON_NAME | String | optional | The name of a standard icon to use for the window. |
| FORWARD | c_funptr | optional | A function to handle paging. |
| DATA_FORWARD | c_ptr | optional | Data for the paging function. |
At most one way of setting the icon should be given, if more than one is specified the priority is ICON, ICON_FILE, ICON_NAME.
If the CLOSE and/or CANCEL keys are not given then the DESTROY handler is used if available, otherwise a default that just destroys the widget.
subroutine hl_gtk_assistant_add_page(asstnt, page, type, page_title, &
& complete, position)
type(c_ptr), intent(in) :: asstnt, page
integer(c_int), intent(in) :: type
character(kind=c_char), dimension(*), intent(in), optional :: page_title
integer(c_int), intent(in), optional :: complete
integer(c_int), intent(in), optional :: positionAdd a page to a GtkAssistant
| Argument | Type | Required? | Description |
|---|---|---|---|
| ASSTNT | c_ptr | required | The Assistant to which to add the page. |
| PAGE | c_ptr | required | The widget to add to the assistant. |
| TYPE | c_int | required | The type of page (from the GtkAssistantPageType enumeration). |
| PAGE_TITLE | string | optional | A title for the page. |
| COMPLETE | boolean | optional | Can the use advance? (Default FALSE, unless type is GTK_ASSISTANT_PAGE_INTRO, GTK_ASSISTANT_PAGE_CONFIRM, or GTK_ASSISTANT_PAGE_SUMMARY). |
| POSITION | c_int | optional | The position of the page in the sequence (Append the page if omitted). |
N.B. Supplying handlers for actions within the page is the responsibility of the code creating the page. In particular, a page that is initially flagged as incomplete must have an action that sets the complete flag.
function hl_gtk_assistant_get_current_page(asstnt, pageno) result(page)
type(c_ptr) :: page
type(c_ptr), intent(in) :: asstnt
integer(c_int), intent(out), optional :: pagenoReturn the current page of an assistant.
| Argument | Type | Required? | Description |
|---|---|---|---|
| ASSTNT | c_ptr | required | The assistant to query |
The returns the widget of the current page. To get the page number only just use gtk_assistant_get_current_page,
subroutine hl_gtk_assistant_set_page_complete(asstnt, state, &
& page, pageno)
type(c_ptr), intent(in) :: asstnt
integer(c_int), intent(in) :: state
type(c_ptr), intent(in), optional :: page
integer(c_int), intent(in), optional :: pagenoSet the completion state of a page of an assistant
| Argument | Type | Required? | Description |
|---|---|---|---|
| ASSTNT | c_ptr | required | The assistant with the page. |
| STATE | boolean | required | The completion state. |
| PAGE | c_ptr | optional | The page whose state is to be set. |
| PAGENO | c_int | optional | The page number to set. |
If neither PAGE nor PAGENO is given then the current page is used.
module gtk_hl_chooserhl_gtk_file_chooser_new and _show implement a general chooser dialogue via the file_chooser_widget (file_choose_dialog only has variadic constructors).
Filters may be either patterns (e.g. '.f90' or '2011.lis') or mime types (e.g. 'image/png' or 'text/'). The constructors recognise the difference by the presence or absence of a '/' character. Each filter is a comma-separated list, which may contain any mixture of patterns and mime types (e.g. '.png,image/tiff,*.jpg'). If a name is not provided, then the filter specification is used as the name.
type
type, bind(c) :: hl_gtk_chooser_info
type(c_ptr) :: chooser=C_NULL_PTR, chooser_sel_list=C_NULL_PTR
type(c_ptr) :: chooser_curdir=C_NULL_PTR, fentry=C_NULL_PTR
integer(c_int) :: iselect=0
end type hl_gtk_chooser_infoThese items must be shared between the file chooser widget and its event handler or the filter editor. They are passed to the signal handlers via the user data argument. Even though it's never used in the C code, it still has to be bind(c) otherwise c_loc() will croak on it.
function hl_gtk_file_chooser_new(chooser_info, cdir, directory, create, &
& multiple, allow_uri, show_hidden, confirm_overwrite, title, &
& initial_dir, current, initial_file, filter, filter_name, parent, &
& all, wsize, edit_filters) result(dialog)
type(c_ptr) :: dialog
type(hl_gtk_chooser_info), intent(out), target :: chooser_info
character(len=*), intent(out), optional :: cdir
integer(c_int), intent(in), optional :: directory, create, multiple
integer(c_int), intent(in), optional :: allow_uri, show_hidden
integer(c_int), intent(in), optional :: confirm_overwrite
character(kind=c_char), dimension(*), intent(in), optional :: title, initial_dir, initial_file
integer(c_int), intent(in), optional :: current
character(len=*), dimension(:), intent(in), optional :: filter
character(len=*), dimension(:), intent(in), optional :: filter_name
type(c_ptr), intent(in), optional :: parent
integer(c_int), intent(in), optional :: all
integer(c_int), intent(in), dimension(2), optional :: wsize
integer(c_int), intent(in), optional :: edit_filtersCreate a file chooser widget.
| Argument | Type | Required? | Description |
|---|---|---|---|
| CHOOSER_INFO | hl_gtk_chooser_info | required | IDs and flags of various subwidgets needed to process the dialog actions. |
| CDIR | string | optional | The directory from which they were chosen. |
| DIRECTORY | boolean | optional | Set to TRUE to select directories instead of files. |
| CREATE | boolean | optional | Set to FALSE to prohibit creating new files. |
| MULTIPLE | boolean | optional | Set to TRUE to allow the selection of multiple files. |
| ALLOW_URI | boolean | optional | Set to TRUE to allow nonlocal selections. Removed from GTK 4. |
| SHOW_HIDDEN | boolean | optional | Set to TRUE to show hidden files. Removed from GTK 4. |
| CONFIRM_OVERWRITE | boolean | optional | Set to TRUE to request confirmation of an overwrite (only used if CREATE is TRUE). Removed from GTK 4. |
| TITLE | string | optional | Title for the window. |
| INITIAL_DIR | string | optional | Set the initial directory here instead of the current directory. |
| CURRENT | boolean | optional | Use to force start in current directory. |
| INITIAL_FILE | string | optional | Set the initial file selection. |
| FILTER | string() | optional | The file selection filter. Elements may either be patterns or mime types. Each filter is a comma-separated list of patterns |
| FILTER_NAME | string() | optional | Names for the filters |
| PARENT | c_ptr | optional | Parent window for the dialogue. |
| ALL | boolean | optional | Set to TRUE to add an all-files filter pattern |
| WSIZE | c_int(2) | optional | Set the size for the dialog. |
| EDIT_FILTERS | boolean | optional | Set to TRUE to proves an entry window to add extra filters. Removed from GTK 4. |
function hl_gtk_file_chooser_show(files, cdir, directory, create, &
& multiple, allow_uri, show_hidden, confirm_overwrite, title, &
& initial_dir, current, initial_file, filter, filter_name, parent, &
& all, wsize, edit_filters) result(isel)
integer(c_int) :: isel
character(len=*), dimension(:), intent(out), allocatable :: files
character(len=*), intent(out), optional :: cdir
integer(c_int), intent(in), optional :: directory, create, multiple
integer(c_int), intent(in), optional :: allow_uri, show_hidden
integer(c_int), intent(in), optional :: confirm_overwrite
character(kind=c_char), dimension(*), intent(in), optional :: title, initial_dir, initial_file
integer(c_int), intent(in), optional :: current
character(len=*), dimension(:), intent(in), optional :: filter
character(len=*), dimension(:), intent(in), optional :: filter_name
type(c_ptr), intent(in), optional :: parent
integer(c_int), intent(in), optional :: all
integer(c_int), intent(in), dimension(2), optional :: wsize
integer(c_int), intent(in), optional :: edit_filtersCreate and show a file chooser widget.
| Argument | Type | Required? | Description |
|---|---|---|---|
| FILES | string() | required | The file or files selected. |
| CDIR | string | optional | The directory from which they were chosen. |
| DIRECTORY | boolean | optional | Set to TRUE to select directories instead of files. |
| CREATE | boolean | optional | Set to FALSE to prohibit creating new files. |
| MULTIPLE | boolean | optional | Set to TRUE to allow the selection of multiple files. |
| ALLOW_URI | boolean | optional | Set to TRUE to allow nonlocal selections. |
| SHOW_HIDDEN | boolean | optional | Set to TRUE to show hidden files. Removed from GTK 4. |
| CONFIRM_OVERWRITE | boolean | optional | Set to TRUE to request confirmation of an overwrite (only used if CREATE is TRUE). Removed from GTK 4. |
| TITLE | string | optional | Title for the window. |
| INITIAL_DIR | string | optional | Set the initial directory here instead of the current directory. |
| CURRENT | boolean | optional | Use to force start in current directory. |
| INITIAL_FILE | string | optional | Set the initial file selection. |
| FILTER | string() | optional | The file selection filter. Elements may either be patterns or mime types. Each filter is a comma-separated list of patterns |
| FILTER_NAME | string() | optional | Names for the filters |
| PARENT | c_ptr | optional | Parent window for the dialogue. |
| ALL | boolean | optional | Set to TRUE to add an all-files filter pattern |
| WSIZE | c_int(2) | optional | Set the size for the dialog. |
| EDIT_FILTERS | boolean | optional | Set to TRUE to proves an entry window to add extra filters. Removed from GTK 4. |
Returns TRUE if one or more files was selected, FALSE otherwise.
subroutine hl_gtk_chooser_resp_cb(dialog, response, gdata) bind(c)
type(c_ptr), value :: dialog
integer(c_int), value :: response
type(c_ptr), value :: gdataCallback for the "response" signal of the chooser
| Argument | Type | Required? | Description |
|---|---|---|---|
| DIALOG | c_ptr | required | The dialog sending the response |
| RESPONSE | c_int | required | The response code. |
| GDATA | c_ptr | required | User data used to return a select/cancel value |
The application developer should never need to use this routine directly.
subroutine hl_gtk_chooser_filt_cb(widget, gdata) bind(c)
type(c_ptr), value :: widget
type(c_ptr), value :: gdataCallback for the new filter entry.
| Argument | Type | Required? | Description |
|---|---|---|---|
| WIDGET | c_ptr | required | The widget sending the signal |
| GDATA | c_ptr | required | User data used to return a select/cancel value |
The application developer should never need to use this routine directly.
module gtk_hl_treeThese functions attempt to hide some of the complexity of the GtkTreeView system of widgets and object, while still allowing the main functionality to be accessed. Most possible renderers are supported (spinner is not).
There are three types of list and tree supported.
- listn; A multi-column flat list.
- list1; A single-column flat list, that allows only string values. (This is now implemented by calls to the corresponding listn routines). Editability is not available for list1.
- tree; A tree view (similar to listn but with child rows).
function hl_gtk_listn_new(scroll, ncols, types, changed, data, multiple,&
& width, titles, height, swidth, align, ixpad, iypad, renderers, &
& sensitive, tooltip, sortable, editable, colnos, edited, &
& data_edited, edited_text, data_edited_text, toggled,&
& data_toggled, edited_spin, data_edited_spin, &
& edited_combo, data_edited_combo, changed_combo, data_changed_combo,&
& toggled_radio, data_toggled_radio, &
& hscroll_policy, vscroll_policy) result(list)
type(c_ptr) :: list
type(c_ptr), intent(out), optional :: scroll
integer(c_int), intent(in), optional :: ncols
integer(type_kind), dimension(:), intent(in), optional :: types
type(c_funptr), optional :: changed
type(c_ptr), intent(in), optional :: data
integer(c_int), intent(in), optional :: multiple
integer(c_int), intent(in), optional, dimension(:) :: width
character(len=*), dimension(:), intent(in), optional :: titles, renderers
integer(c_int), intent(in), optional :: height, swidth
real(c_float), intent(in), optional, dimension(:) :: align
integer(c_int), intent(in), optional, dimension(:) :: ixpad, iypad
integer(c_int), intent(in), optional :: sensitive
character(kind=c_char), dimension(*), intent(in), optional :: tooltip
integer(c_int), intent(in), optional, dimension(:) :: sortable, editable
type(c_funptr), optional :: edited, edited_text, toggled, edited_spin, &
& edited_combo, changed_combo, toggled_radio
type(c_ptr), optional, intent(in) :: data_edited, data_edited_text, &
& data_toggled, data_edited_spin, data_edited_combo, &
& data_changed_combo, data_toggled_radio
integer(c_int), dimension(:), allocatable, intent(out), optional, target :: colnos
integer(c_int), intent(in), optional :: hscroll_policy, vscroll_policyMake a multi column list
| Argument | Type | Required? | Description |
|---|---|---|---|
| SCROLL | c_ptr | optional | A scrollable widget containing the list. (If present, then this is used to pack the list) |
| NCOLS | c_int | optional | The number of columns. |
| TYPES | GType() | optional | The types for each column. |
| CHANGED | c_funptr | optional | Callback function for the "changed" signal to the associated selection object. |
| DATA | c_ptr | optional | Data to be passed to/from the callback. |
| MULTIPLE | boolean | optional | Whether multiple selections are allowed. |
| WIDTH | integer() | optional | The width of the displayed columns. |
| TITLES | string() | optional | Titles for the visible columns. |
| HEIGHT | c_int | optional | The height of the display (this is actually the height of the scroll box). |
| SWIDTH | c_int | Optional | The width for the scroll box |
| ALIGN | c_float() | optional | The alignment of the columns |
| IXPAD | c_int() | optional | The X-padding around the cells. |
| IYPAD | c_int() | optional | The Y-Padding around the cells. |
| RENDERERS | f_string() | optional | List of renderer types. |
| SENSITIVE | boolean | optional | Whether the widget is intially sensitive. |
| TOOLTIP | string | optional | Tooltip for the widget |
| SORTABLE | boolean() | optional | Set whether the list can be sorted on that column. |
| EDITABLE | boolean() | optional | Set whether the column can be edited. |
| EDITED | c_funptr | optional | An alternative callback for the "edited" signal on edited cells. N.B. Only a single callback can be set if different actions are needed for different columns, you must use the column number inside the callback. See hl_gtk_listn_edit_cb for how to access the column numbers. Used for all "text" dereived renderers unless overridden by specific callbacks. |
| DATA_EDITED | c_ptr | optional | Data to pass to the edited callback. |
| EDITED_TEXT | c_funptr | optional | An alternative callback for text renderers (not applied to derived renderers). |
| DATA_EDITED_TEXT | c_ptr | optional | Data to pass to the edited_text callback. |
| EDITED_SPIN | c_funptr | optional | An alternative callback for spin button. |
| DATA_EDITED_SPIN | c_ptr | optional | Data to pass to the edited_spin callback. |
| EDITED_COMBO | c_funptr | optional | An alternative callback for the "edited" signal from a combo cell |
| DATA_EDITED_COMBO | c_ptr | optional | Data to pass to the edited_combo callback. |
| TOGGLED | c_funptr | optional | An alternative callback for the "toggled" signal from toggle renderers. |
| DATA_TOGGLED | c_ptr | optional | Data to pass to the toggled callback. |
| TOGGLED_RADIO | c_funptr | optional | An alternative callback for the "toggled" signal from radio toggle renderers. |
| DATA_TOGGLED_RADIO | c_ptr | optional | Data to pass to the toggled callback for radio toggle renderers |
| CHANGED_COMBO | c_funptr | optional | Callback for the "changed" signal from a combo cell. This is not actually all that useful as the edited signal will be emitted as soon as focus leaves the combo. |
| DATA_CHANGED_COMBO | c_ptr | optional | Data to pass to the changed callback. |
| HSCROLL_POLICY | int | optional | Horizontal scrolling policy for the containing scroll window (default AUTOMATIC). |
| VSCROLL_POLICY | int | optional | Vertical scrolling policy for the containing scroll window (default AUTOMATIC). |
At least one of the array arguments or NCOLS must be given. If TYPES is not given, then strings are assumed.
The following types of renderer are implemented.
- "text" (hl_gtk_cell_text) A standard text box (can also have numeric types.)
- "toggle" (hl_gtk_cell_toggle) A toggle button (always G_TYPE_BOOLEAN).
- "radio" (hl_gtk_cell_radio) A toggle button with radio button renderering. As far as I can see it is the programmer's responsibility to deal with the exclusivity--there does not appear to be an equivalent of the group for normal radio buttons.
- "combo" (hl_gtk_cell_combo) A combo box--the default model supports strings only but user-defined models are possible.
- "spin" (hl_gtk_cell_spin) A spin button. Always of type G_TYPE_DOUBLE.
- "pixbuf" (hl_gtk_cell_pixbuf) A gdk_pixbuf. Always of type gdk_pixbuf_get_type()
- "progress" (hl_gtk_cell_progress) A progress bar. Always of type G_TYPE_INT, not editable.
- The spinner type is not (yet) implemented.
subroutine hl_gtk_listn_ins(list, row, count)
type(c_ptr), intent(in) :: list
integer(c_int), intent(in), optional :: row, countInsert a row into a tabular list.
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list into which to insert the row. |
| ROW | c_int | optional | The row BEFORE which to insert the row (append if absent) |
| COUNT | c_int | optional | How many rows to add (default 1) |
subroutine hl_gtk_listn_rem(list, row)
type(c_ptr), intent(in) :: list
integer(c_int), optional, intent(in) :: rowRemove a row or clear a list
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list to modify |
| ROW | integer | optional | The row to remove, if absent clear the list |
function hl_gtk_listn_get_selections(list, indices, selection) result(count)
integer(c_int) :: count
type(c_ptr), intent(in) :: list
integer(c_int), dimension(:), allocatable, target, &
& intent(out), optional :: indices
type(c_ptr), optional :: selectionGet the indices of the selected rows
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list whose selections are to be found. |
| INDICES | integer | optional | An allocatable array to return the list of selections. (If count = 0 it will not be allocated). If this argument is not given, then the number of selected rows is returned. |
| SELECTION | c_ptr | optional | A selection. If this is given then LIST is ignored. This is most often used in the callback routine for the changed signal when that needs to find which element(s) are selected. |
Returns the number of selections.
subroutine hl_gtk_listn_set_selection(list, row)
type(c_ptr), intent(in) :: list
integer(c_int), intent(in), optional :: rowSet the selected row in a list (single row only).
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list to work on. |
| ROW | c_int | optional | The row to select (absent or less than 0 is clear selection) |
subroutine hl_gtk_listn_set_cell(list, row, col, &
& svalue, fvalue, dvalue, ivalue, lvalue, l64value, logvalue, &
& i8value, pbvalue)
type(c_ptr), intent(in) :: list
integer(c_int), intent(in) :: row, col
character(len=*), intent(in), optional :: svalue
real(c_float), intent(in), optional :: fvalue
real(c_double), intent(in), optional :: dvalue
integer(c_int), intent(in), optional :: ivalue
integer(c_long), intent(in), optional :: lvalue
integer(c_int64_t), intent(in), optional :: l64value
logical, intent(in), optional :: logvalue
integer(c_int8_t), intent(in), optional :: i8value
type(c_ptr), intent(in), optional :: pbvalueSet the value of a cell.
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list containing the cell. |
| ROW | c_int | required | The row of the cell |
| COL | c_int | required | The column of the cell. |
| SVALUE | string | optional | A string value for the cell. |
| FVALUE | float | optional | A single precision FP value for the cell. |
| DVALUE | double | optional | A double precision FP value for the cell. |
| IVALUE | c_int | optional | A normal integer value for the cell. |
| LVALUE | c_long | optional | A long integer value for the cell. |
| L64VALUE | c_int64_t | optional | A 64-bit integer value for the cell. |
| LOGVALUE | logical | optional | A logical value for the cell. |
| I8VALUE | int8_t | optional | An 8-bit integer value for the cell. |
| PBVALUE | c_ptr | optional | A pixbuf pointer value for the cell. |
Note that reasonable conversions are made between types.
subroutine hl_gtk_listn_get_cell(list, row, col, &
& svalue, fvalue, dvalue, ivalue, lvalue, l64value, logvalue, &
& i8value, pbvalue)
type(c_ptr), intent(in) :: list
integer(c_int), intent(in) :: row, col
character(len=*), intent(out), optional :: svalue
real(c_float), intent(out), optional :: fvalue
real(c_double), intent(out), optional :: dvalue
integer(c_int), intent(out), optional :: ivalue
integer(c_long), intent(out), optional :: lvalue
integer(c_int64_t), intent(out), optional :: l64value
logical, intent(out), optional :: logvalue
integer(c_int8_t), intent(out), optional :: i8value
type(c_ptr), intent(out), optional :: pbvalueRetrieve the value of a cell.
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list containing the cell. |
| ROW | c_int | required | The row of the cell |
| COL | c_int | required | The column of the cell. |
| SVALUE | string | optional | A string value from the cell. |
| FVALUE | float | optional | A single precision FP value from the cell. |
| DVALUE | double | optional | A double precision FP value from the cell. |
| IVALUE | c_int | optional | A normal integer value from the cell. |
| LVALUE | c_long | optional | A long integer value from the cell. |
| L64VALUE | c_int64_t | optional | A 64-bit integer value from the cell. |
| LOGVALUE | logical | optional | A logical value from the cell. |
| I8VALUE | int8_t | optional | An 8-bit integer value from the cell. |
| PBVALUE | c_ptr | optional | A pixbuf pointer from the cell. |
Note that a similar conversion system to the set_cell routine except that strings can only be returned to SVALUE.
subroutine hl_gtk_listn_move_row(list, row1, row2, after)
type(c_ptr), intent(in) :: list
integer(c_int), intent(in) :: row1
integer(c_int), intent(in), optional :: row2
integer(c_int), intent(in), optional :: afterMove a row in a list to a new location
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list to work on. |
| ROW1 | c_int | required | The index of the row to move. |
| ROW2 | c_int | optional | The location before which to place the row. (If omitted, then move to start (or end if AFTER is TRUE)). |
| AFTER | boolean | optional | Set this to TRUE to put the row after the location instead of before. |
subroutine hl_gtk_listn_swap_rows(list, row1, row2)
type(c_ptr), intent(in) :: list
integer(c_int), intent(in) :: row1, row2Move a row in a list to a new location
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list to work on. |
| ROW1 | c_int | required | The index of the first row to move. |
| ROW2 | c_int | required | The index of the second row to move |
subroutine hl_gtk_listn_reorder(list, indices)
type(c_ptr), intent(in) :: list
integer(c_int), intent(in), dimension(:) :: indicesMove a row in a list to a new location
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list to work on. |
| INDICES | c_int() | required | The sorting array. The ith element contains the old location of the new (i-1)th row. |
function hl_gtk_listn_get_n_rows(list) result(nrows)
integer(c_int) :: nrows
type(c_ptr), intent(in) :: listReturn the number of rows in a list.
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | the list to query |
function hl_gtk_list1_new(scroll, width, changed, data, multiple, &
& sensitive, tooltip, title, height) result(list)
type(c_ptr) :: list
type(c_ptr), intent(out), optional :: scroll
integer(c_int), intent(in), optional :: width
type(c_funptr), intent(in), optional :: changed
type(c_ptr), intent(in), optional :: data
integer(c_int), intent(in), optional :: multiple, sensitive
character(kind=c_char), dimension(*), intent(in), optional :: tooltip
character(len=*), intent(in), optional :: title
integer(c_int), intent(in), optional :: heightA single column selectable list based on the GTK Tree View
| Argument | Type | Required? | Description |
|---|---|---|---|
| SCROLL | c_ptr | optional | A scroll box that will contain the list (used for packing etc.) |
| WIDTH | integer | optional | The width of the displayed column. |
| CHANGED | c_funptr | optional | Callback function for the "changed" signal to the associated selection object. |
| DATA | c_ptr | optional | Data to be passed to/from the callback. |
| MULTIPLE | boolean | optional | Whether multiple selections are allowed. |
| SENSITIVE | boolean | optional | Whether the widget is intially sensitive. |
| TOOLTIP | string | optional | Tooltip for the widget |
| TITLE | string | optional | Title for the visible column. |
| HEIGHT | integer | optional | The height of the display (this is actually the height of the scroll box). |
If other options (e.g. sortable columns or editable cells are needed, the use hl_gtk_listn_new with 1 column).
subroutine hl_gtk_list1_ins(list, text, row)
type(c_ptr), intent(in) :: list
character(kind=c_char, len=*), intent(in), optional :: text
integer(c_int), intent(in), optional :: rowInsert a row into a list
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list to insert to. |
| TEXT | string | optional | The text to insert. |
| ROW | integer | optional | The row at which to insert the text (omit to append) |
subroutine hl_gtk_list1_rem(list, row)
type(c_ptr), intent(in) :: list
integer(c_int), optional, intent(in) :: rowRemove a row or clear a list
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list to modify |
| ROW | integer | optional | The row to remove, if absent clear the list |
function hl_gtk_list1_get_selections(list, indices, selection) result(count)
integer(c_int) :: count
type(c_ptr), intent(in) :: list
integer(c_int), dimension(:), allocatable, target, &
& intent(out), optional :: indices
type(c_ptr), optional :: selectionGet the indices of the selected rows
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list whose selections are to be found. |
| INDICES | integer | optional | An allocatable array to return the list of selections. (If count = 0 it will not be allocated). If this argument is not given, then the number of selected rows is returned. |
| SELECTION | c_ptr | optional | A selection. If this is given then LIST is ignored. This is most often used in the callback routine for the changed signal when that needs to find which element(s) are selected. |
Returns the number of selections.
subroutine hl_gtk_list1_set_selection(list, row)
type(c_ptr), intent(in) :: list
integer(c_int), intent(in), optional :: rowSet the selected row in a list (single row only)
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list to work on. |
| ROW | c_int | optional | The row to select (absent or < 0 is clear selection) |
subroutine hl_gtk_list1_set_cell(list, row, svalue)
type(c_ptr), intent(in) :: list
integer(c_int), intent(in) :: row
character(len=*), intent(in) :: svalueSet a cell in a single column list
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list containing the cell. |
| ROW | c_int | required | The row of the cell |
| SVALUE | string | required | A string value for the cell. |
subroutine hl_gtk_list1_get_cell(list, row, svalue)
type(c_ptr), intent(in) :: list
integer(c_int), intent(in) :: row
character(len=*), intent(out) :: svalueSet a cell in a single column list
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list containing the cell. |
| ROW | c_int | required | The row of the cell |
| SVALUE | string | required | A string value from the cell. |
subroutine hl_gtk_list1_move_row(list, row1, row2, after)
type(c_ptr), intent(in) :: list
integer(c_int), intent(in) :: row1
integer(c_int), intent(in), optional :: row2
integer(c_int), intent(in), optional :: afterMove a row in a list to a new location
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list to work on. |
| ROW1 | c_int | required | The index of the row to move. |
| ROW2 | c_int | optional | The location before which to place the row. |
| AFTER | boolean | optional | Set this to TRUE to put the row after the location instead of before. |
subroutine hl_gtk_list1_swap_rows(list, row1, row2)
type(c_ptr), intent(in) :: list
integer(c_int), intent(in) :: row1, row2Move a row in a list to a new location
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list to work on. |
| ROW1 | c_int | required | The index of the first row to move. |
| ROW2 | c_int | required | The index of the second row to move |
subroutine hl_gtk_list1_reorder(list, indices)
type(c_ptr), intent(in) :: list
integer(c_int), intent(in), dimension(:), target :: indicesMove a row in a list to a new location
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list to work on. |
| INDICES | c_int() | required | The sorting array. The ith element contains the old location of the new (i-1)th row. |
function hl_gtk_list1_get_n_rows(list) result(nrows)
integer(c_int) :: nrows
type(c_ptr), intent(in) :: listReturn the number of rows in a list.
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | the list to query |
subroutine hl_gtk_list1_set_cell_data_func(list, func, &
& data, destroy_notify)
type(c_ptr), intent(in) :: list
type(c_funptr), optional :: func
type(c_ptr), optional :: data
type(c_funptr), optional :: destroy_notifyAdd a custom rendering function to a column of a list
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list to which to apply the rendering function |
| FUNC | c_funptr | optional | The function (actually subroutine) to do the rendering (see GtkTreeCellDataFunc, for details). Omit or set to C_NULL_FUNPTR to remove a function. |
| DATA | c_ptr | optional | User data to pass to the function. |
| DESTROY_NOTIFY | c_funptr | optional | A destroy notify subroutine. |
function hl_gtk_tree_new(scroll, ncols, types, changed, data, multiple,&
& width, titles, height, swidth, align, ixpad, iypad, renderers, &
& sensitive, tooltip, sortable, editable, colnos, edited, data_edited, &
& edited_text, data_edited_text, toggled, data_toggled, &
& edited_spin, data_edited_spin, &
& edited_combo, data_edited_combo, changed_combo, data_changed_combo, &
& toggled_radio, data_toggled_radio, &
& hscroll_policy, vscroll_policy) result(tree)
type(c_ptr) :: tree
type(c_ptr), intent(out), optional :: scroll
integer(c_int), intent(in), optional :: ncols
integer(type_kind), dimension(:), intent(in), optional :: types
type(c_funptr), optional :: changed
type(c_ptr), intent(in), optional :: data
integer(c_int), intent(in), optional :: multiple
integer(c_int), intent(in), optional, dimension(:) :: width
character(len=*), dimension(:), intent(in), optional :: titles, renderers
integer(c_int), intent(in), optional :: height, swidth
real(c_float), intent(in), optional, dimension(:) :: align
integer(c_int), intent(in), optional, dimension(:) :: ixpad, iypad
integer(c_int), intent(in), optional :: sensitive
character(kind=c_char), dimension(*), intent(in), optional :: tooltip
integer(c_int), intent(in), optional, dimension(:) :: sortable, editable
integer(c_int), dimension(:), allocatable, intent(out), optional, target :: colnos
type(c_funptr), optional :: edited, edited_text, toggled, edited_spin, &
& edited_combo, changed_combo, toggled_radio
type(c_ptr), optional, intent(in) :: data_edited, data_edited_text,&
& data_toggled, data_edited_spin, data_edited_combo, &
& data_changed_combo, data_toggled_radio
integer(c_int), intent(in), optional :: hscroll_policy, vscroll_policyMake a tree view
| Argument | Type | Required? | Description |
|---|---|---|---|
| SCROLL | c_ptr | optional | A scrollable widget to contain the tree. (This is used to pack the tree) |
| NCOLS | c_int | optional | The number of columns. |
| TYPES | GType() | optional | The types for each column. |
| CHANGED | c_funptr | optional | Callback function for the "changed" signal to the associated selection object. |
| DATA | c_ptr | optional | Data to be passed to/from the callback. |
| MULTIPLE | boolean | optional | Whether multiple selections are allowed. |
| WIDTH | integer() | optional | The width of the displayed columns. |
| TITLES | string() | optional | Titles for the visible columns. |
| HEIGHT | c_int | optional | The height of the display (this is actually the height of the scroll box). |
| SWIDTH | c_int | Optional | The width for the scroll box |
| ALIGN | c_float() | optional | The alignment of the columns |
| IXPAD | c_int() | optional | The X-padding around the cells. |
| IYPAD | c_int() | optional | The Y-Padding around the cells. |
| RENDERERS | f_string() | List of renderer types. | |
| SENSITIVE | boolean | optional | Whether the widget is intially sensitive. |
| TOOLTIP | string | optional | Tooltip for the widget |
| SORTABLE | boolean() | optional | Set whether the tree can be sorted on that column. |
| EDITABLE | boolean() | optional | Set whether the column can be edited. |
| EDITED | f_funptr | optional | An alternative callback for the "edited" signal on edited cells. N.B. Only a single callback can be set if different actions are needed for different columns, you must use the column number inside the callback. |
| DATA_EDITED | c_ptr | optional | Data to pass to the edited callback. |
| EDITED_TEXT | c_funptr | optional | An alternative callback for text renderers (not applied to derived renderers). |
| DATA_EDITED_TEXT | c_ptr | optional | Data to pass to the edited_text callback. |
| EDITED_SPIN | c_funptr | optional | An alternative callback for spin button. |
| DATA_EDITED_SPIN | c_ptr | optional | Data to pass to the edited_spin callback. |
| EDITED_COMBO | c_funptr | optional | An alternative callback for the "edited" signal from a combo cell |
| DATA_EDITED_COMBO | c_ptr | optional | Data to pass to the edited_combo callback. |
| TOGGLED | c_funptr | optional | An alternative callback for the "toggled" signal from toggle renderers. |
| DATA_TOGGLED | c_ptr | optional | Data to pass to the toggled callback. |
| TOGGLED_RADIO | c_funptr | optional | An alternative callback for the "toggled" signal from radio toggle renderers. |
| DATA_TOGGLED_RADIO | c_ptr | optional | Data to pass to the toggled callback for radio toggle renderers |
| CHANGED_COMBO | c_funptr | optional | Callback for the "changed" signal from a combo cell. This is not actually all that useful as the edited signal will be emitted as soon as focus leaves the combo. |
| DATA_CHANGED_COMBO | c_ptr | optional | Data to pass to the changed callback. |
| HSCROLL_POLICY | int | optional | Horizontal scrolling policy for the containing scroll window (default AUTOMATIC). |
| VSCROLL_POLICY | int | optional | Vertical scrolling policy for the containing scroll window (default AUTOMATIC). |
At least one of the array arguments or NCOLS must be given. If TYPES is not given, then strings are assumed.
For renderer types see HL_GTK_LISTN_NEW.
subroutine hl_gtk_tree_ins(tree, row, absrow, count)
type(c_ptr), intent(in) :: tree
integer(c_int), intent(in), optional, dimension(:) :: row
integer(c_int), intent(in), optional :: absrow, countInsert a row into a tabular tree.
| Argument | Type | Required? | Description |
|---|---|---|---|
| TREE | c_ptr | required | The tree into which to insert the row. |
| ROW | c_int() | optional | The row BEFORE which to insert the row (append if an element is -1) For example; to put a new row after all other children of the second child of the fifth top-level row use [ 4, 1, -1 ]. |
| ABSROW | c_int | optional | The row BEFORE which to insert the new row treating the tree as a flat list. |
| COUNT | c_int | optional | How many rows to add (default 1) |
function hl_gtk_tree_abs_iter(tree, iter, index, model) result(valid)
integer(c_int) :: valid
type(c_ptr), intent(in) :: tree
type(gtktreeiter), intent(out), target :: iter
integer(c_int), intent(in) :: index
type(c_ptr), intent(in), optional :: modelGet the indexth iterator of a tree (treating it as a flat list)
| Argument | Type | Required? | Description |
|---|---|---|---|
| TREE | c_ptr | required | The tree to traverse |
| ITER | gtktreeiter | required | The iterator found |
| INDEX | c_int | required | The location to be identified |
| MODEL | c_ptr | optional | The tree model (if this is given then TREE is ignored) |
Returns TRUE if the search was successful, FALSE otherwise (not usually called directly by applications).
function hl_gtk_tree_row_iter(tree, iter, row, model) result(valid)
type(gtktreeiter), target :: iter
type(c_ptr), intent(in) :: tree
integer(c_int), intent(in), dimension(:) :: row
type(c_ptr), intent(in), optional :: modelGet the iterator for a given row of the tree
| Argument | Type | Required? | Description |
|---|---|---|---|
| TREE | c_ptr | required | The tree to traverse |
| ITER | gtktreeiter | required | The iterator found |
| ROW | c_int() | required | The row specifier |
| MODEL | c_ptr | optional | The tree model (if this is given then TREE is ignored) |
subroutine hl_gtk_tree_rem(tree, row, absrow)
type(c_ptr), intent(in) :: tree
integer(c_int), optional, intent(in), dimension(:) :: row
integer(c_int), intent(in), optional :: absrowRemove a row or clear a tree
| Argument | Type | Required? | Description |
|---|---|---|---|
| TREE | c_ptr | required | The tree to modify |
| ROW | integer() | optional | The row to remove, if absent clear the tree |
| ABSROW | c_int | optional | The row to remove, treating the tree as a flat list. |
function hl_gtk_tree_get_selections(tree, indices, depths, &
& selection) result(count)
integer(c_int) :: count
type(c_ptr), intent(in) :: tree
integer(c_int), dimension(:,:), allocatable, target, &
& intent(out), optional :: indices
integer(c_int), dimension(:), allocatable, target, &
& intent(out), optional :: depths
type(c_ptr), intent(in), optional :: selectionGet the indices of the selected rows
| Argument | Type | Required? | Description |
|---|---|---|---|
| TREE | c_ptr | required | The tree whose selections are to be found. |
| INDICES | c_int(,) | optional | An allocatable array to return the tree of selections. (If count = 0 it will not be allocated). If this argument is not given, then the number of selected rows is returned. |
| DEPTHS | c_int() | optional | An allocatable array to return the depth of each selection. (Strictly the last meaningful element of each row of INDICES). |
| SELECTION | c_ptr | optional | A selection. If this is given then TREE is ignored. This is most often used in the callback routine for the changed signal when that needs to find which element(s) are selected. |
Returns the number of selections.
subroutine hl_gtk_tree_set_cell(tree, row, col, absrow, &
& svalue, fvalue, dvalue, ivalue, lvalue, l64value, &
& logvalue, i8value, pbvalue)
type(c_ptr), intent(in) :: tree
integer(c_int), intent(in), optional :: absrow, col
integer(c_int), intent(in), optional, dimension(:) :: row
character(len=*), intent(in), optional :: svalue
real(c_float), intent(in), optional :: fvalue
real(c_double), intent(in), optional :: dvalue
integer(c_int), intent(in), optional :: ivalue
integer(c_long), intent(in), optional :: lvalue
integer(c_int64_t), intent(in), optional :: l64value
logical, intent(in), optional :: logvalue
integer(c_int8_t), intent(in), optional :: i8value
type(c_ptr), intent(in), optional :: pbvalueSet the value of a cell.
| Argument | Type | Required? | Description |
|---|---|---|---|
| TREE | c_ptr | required | The tree containing the cell. |
| ROW | c_int() | optional | The row of the cell |
| COL | c_int | optional | The column of the cell, (Only optional to allow format similar to the LISTs). |
| ABSROW | c_int | optional | The row, treating the tree as a flat list. |
| SVALUE | string | optional | A string value for the cell. |
| FVALUE | float | optional | A single precision FP value for the cell. |
| DVALUE | double | optional | A double precision FP value for the cell. |
| IVALUE | c_int | optional | A normal integer value for the cell. |
| LVALUE | c_long | optional | A long integer value for the cell. |
| L64VALUE | c_int64_t | optional | A 64-bit integer value for the cell. |
| LOGVALUE | logical | optional | A logical value for the cell. |
| I8VALUE | int8_t | optional | An 8-bit integer value for the cell. |
| PBVALUE | c_ptr | optional | A pixbuf pointer value for the cell. |
Note that reasonable conversions are made between types.
subroutine hl_gtk_tree_get_cell(tree, row, col, absrow, &
& svalue, fvalue, dvalue, ivalue, lvalue, l64value, logvalue, &
& i8value, pbvalue)
type(c_ptr), intent(in) :: tree
integer(c_int), intent(in), optional :: absrow, col
integer(c_int), intent(in), optional, dimension(:) :: row
character(len=*), intent(out), optional :: svalue
real(c_float), intent(out), optional :: fvalue
real(c_double), intent(out), optional :: dvalue
integer(c_int), intent(out), optional :: ivalue
integer(c_long), intent(out), optional :: lvalue
integer(c_int64_t), intent(out), optional :: l64value
logical, intent(out), optional :: logvalue
integer(c_int8_t), intent(out), optional :: i8value
type(c_ptr), intent(out), optional :: pbvalueRetrieve the value of a cell.
| Argument | Type | Required? | Description |
|---|---|---|---|
| TREE | c_ptr | required | The tree containing the cell. |
| ROW | c_int() | optional | The row of the cell |
| COL | c_int | optional | The column of the cell. (Only optional to allow format similar to the LISTs i.e. tree, row, column). |
| ABSROW | c_int | optional | The row of the cell, treating the tree as a flat list. |
| SVALUE | string | optional | A string value from the cell. |
| FVALUE | float | optional | A single precision FP value from the cell. |
| DVALUE | double | optional | A double precision FP value from the cell. |
| IVALUE | c_int | optional | A normal integer value from the cell. |
| LVALUE | c_long | optional | A long integer value from the cell. |
| L64VALUE | c_int64_t | optional | A 64-bit integer value from the cell. |
| LOGVALUE | logical | optional | A logical value from the cell. |
| I8VALUE | int8_t | optional | An 8-bit integer value from the cell. |
| PBVALUE | c_ptr | optional | A pixbuf pointer from the cell. |
Note that a similar conversion system to the set_cell routine except that strings can only be returned to SVALUE.
subroutine hl_gtk_listn_combo_set_select(view, row, colno, selection)
type(c_ptr), intent(in) :: view
integer(c_int), intent(in) :: row, colno, selectionSet the selected item in a combo cell renderer.
| Argument | Type | Required? | Description |
|---|---|---|---|
| VIEW | c_ptr | required | The list view containing the cell. |
| ROW | int | required | The row number of the cell |
| COLNO | int | required | The column number with the cell |
| SELECTION | int | required | The element of the combo to set. |
subroutine hl_gtk_tree_combo_set_select(view, row, colno, absrow, selection)
type(c_ptr), intent(in) :: view
integer(c_int), dimension(:), intent(in), optional :: row
integer(c_int), intent(in), optional :: colno, absrow, selectionSet the selected item in a combo cell renderer.
| Argument | Type | Required? | Description |
|---|---|---|---|
| VIEW | c_ptr | required | The list view containing the cell. |
| ROW | int() | optional | The row number of the cell |
| COLNO | int | optional | The column number with the cell (Only optional to allow format similar to the LISTs). |
| ABSROW | c_int | optional | The row, treating the tree as a flat list. |
| SELECTION | int | required | The element of the combo to set. |
subroutine hl_gtk_listn_edit_cb(renderer, path, text, gdata) bind(c)
type(c_ptr), value :: renderer, path, text, gdataDefault callback for list cell edited.
| Argument | Type | Required? | Description |
|---|---|---|---|
| RENDERER | c_ptr | required | The renderer which sent the signal |
| PATH | c_ptr | required | The path at which to insert |
| TEXT | c_ptr | required | The text to insert |
| GDATA | c_ptr | required | User data, Not used. |
The column number is passed via the "column-number" gobject data value. The treeview containing the cell is passed via the "view" gobject data value. The row number is passed as a string in the PATH argument. This routine is not normally called by the application developer.
subroutine hl_gtk_listn_toggle_cb(renderer, path, gdata) bind(c)
type(c_ptr), value :: renderer, path, gdataDefault call back for a toggle button in a list
| Argument | Type | Required? | Description |
|---|---|---|---|
| RENDERER | c_ptr | required | The renderer which sent the signal |
| PATH | c_ptr | required | The path at which to insert |
| GDATA | c_ptr | required | User data, Not used. |
The column number is passed via the "column-number" gobject data value. The treeview containing the cell is passed via the "view" gobject data value. The row number is passed as a string in the PATH argument. This routine is not normally called by the application developer.
subroutine hl_gtk_listn_rtoggle_cb(renderer, path, gdata) bind(c)
type(c_ptr), value :: renderer, path, gdataDefault callback for a toggle button in a list
| Argument | Type | Required? | Description |
|---|---|---|---|
| RENDERER | c_ptr | required | The renderer which sent the signal |
| PATH | c_ptr | required | The path at which to insert |
| GDATA | c_ptr | required | User data, Not used. |
The column number is passed via the "column-number" gobject data value. The treeview containing the cell is passed via the "view" gobject data value. The row number is passed as a string in the PATH argument. This routine is not normally called by the application developer.
subroutine hl_gtk_tree_edit_cb(renderer, path, text, gdata) bind(c)
type(c_ptr), value :: renderer, path, text, gdataDefault callback for tree cell edited.
| Argument | Type | Required? | Description |
|---|---|---|---|
| RENDERER | c_ptr | required | The renderer which sent the signal |
| PATH | c_ptr | required | The path at which to insert |
| TEXT | c_ptr | required | The text to insert |
| GDATA | c_ptr | required | User data, not used. |
The column number is passed via the "column-number" gobject data value. The treeview containing the cell is passed via the "view" gobject data value. The row number is passed as a string in the PATH argument.
This routine is not normally called by the application developer.
subroutine hl_gtk_tree_toggle_cb(renderer, path, gdata) bind(c)
type(c_ptr), value :: renderer, path, gdataDefault call back for a toggle button in a tree
| Argument | Type | Required? | Description |
|---|---|---|---|
| RENDERER | c_ptr | required | The renderer which sent the signal |
| PATH | c_ptr | required | The path at which to insert |
| GDATA | c_ptr | required | User data, Not used. |
The column number is passed via the "column-number" gobject data value. The treeview containing the cell is passed via the "view" gobject data value. The row number is passed as a string in the PATH argument. This routine is not normally called by the application developer.
subroutine hl_gtk_tree_rtoggle_cb(renderer, path, gdata) bind(c)
type(c_ptr), value :: renderer, path, gdataDefault call back for a toggle button in a tree with the radio option set.
| Argument | Type | Required? | Description |
|---|---|---|---|
| RENDERER | c_ptr | required | The renderer which sent the signal |
| PATH | c_ptr | required | The path at which to insert |
| GDATA | c_ptr | required | User data, Not used. |
The column number is passed via the "column-number" gobject data value. The treeview containing the cell is passed via the "view" gobject data value. The row number is passed as a string in the PATH argument. This routine is not normally called by the application developer. The routine clears the settings on all buttons at the same level as the button that was pressed.
subroutine hl_gtk_list_tree_set_cell_data_func(list, colno, func, &
& data, destroy_notify)
type(c_ptr), intent(in) :: list
integer(c_int), intent(in) :: colno
type(c_funptr), optional :: func
type(c_ptr), optional :: data
type(c_funptr), optional :: destroy_notifyAdd a custom rendering function to a column of a list or tree
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | The list to which to apply the rendering function |
| COLNO | c_int | required | The column index to which to apply it. |
| FUNC | c_funptr | optional | The function (actually subroutine) to do the rendering (see GtkTreeCellDataFunc, for details). Omit or set to C_NULL_FUNPTR to remove a function. |
| DATA | c_ptr | optional | User data to pass to the function. |
| DESTROY_NOTIFY | c_funptr | optional | A destroy notify subroutine. |
This routine is always accessed by one of the interfaces, hl_gtk_tree_set_cell_data_func or hl_gtk_listn_set_cell_data_func.
subroutine hl_gtk_list_tree_add_column(icol, view, is_list, type, &
& editable, ixpad, iypad, align, titles, sortable, width,&
& renderers, edited, data_edited, edited_text, data_edited_text, &
& toggled, data_toggled, edited_spin, data_edited_spin, edited_combo, &
& data_edited_combo, changed_combo, data_changed_combo, toggled_radio, &
& data_toggled_radio)
integer(c_int), intent(in) :: icol
type(c_ptr), intent(in), target :: view
logical, intent(in) :: is_list
integer(type_kind), intent(in) :: type
integer(c_int), dimension(:), optional, intent(in) :: editable, &
& ixpad, iypad, sortable, width
real(c_float), intent(in), optional, dimension(:) :: align
character(len=*), dimension(:), intent(in), optional :: titles, renderers
type(c_funptr), optional :: edited, edited_text, toggled, edited_spin, &
& edited_combo, changed_combo, toggled_radio
type(c_ptr), optional, intent(in) :: data_edited, data_edited_text, &
& data_toggled, data_edited_spin, data_edited_combo, &
& data_changed_combo, data_toggled_radioAdd a column to a list or tree view. (private)
| Argument | Type | Required? | Description |
|---|---|---|---|
| ICOL | int | required | The column number |
| VIEW | c_ptr | required | The list or tree view to modify |
| IS_LIST | logical | required | .true. for a list, .false. for a tree. |
The optional arguments are identical to the corresponding arguments in hl_gtk_listn_new and hl_gtk_tree_new.
This routine is not called by the application developer, but exists to reduce code duplication.
subroutine hl_gtk_list_tree_set_gvalue(val, ctype, svalue, fvalue, dvalue, &
& ivalue, lvalue, l64value, logvalue, i8value, pbvalue)
type(c_ptr), intent(inout) :: val
integer(type_kind) :: ctype
character(len=*), intent(in), optional :: svalue
real(c_float), intent(in), optional :: fvalue
real(c_double), intent(in), optional :: dvalue
integer(c_int), intent(in), optional :: ivalue
integer(c_long), intent(in), optional :: lvalue
integer(c_int64_t), intent(in), optional :: l64value
logical, intent(in), optional :: logvalue
integer(c_int8_t), intent(in), optional :: i8value
type(c_ptr), intent(in), optional :: pbvalueSet a gvalue to the appropriate type and value to set a list or tree cell. (private)
| Argument | Type | Required? | Description |
|---|---|---|---|
| VAL | c_ptr | required | The C address of the gvalue. |
| CTYPE | int(kind_type) | required | The type of the cell. |
The optional arguments are the same as for the set_cell routines.
subroutine hl_gtk_list_tree_get_gvalue(val, ctype, &
& svalue, fvalue, dvalue, ivalue, lvalue, l64value, logvalue, &
& i8value, pbvalue)
type(c_ptr), intent(in) :: val
integer(type_kind), intent(in) :: ctype
character(len=*), intent(out), optional :: svalue
real(c_float), intent(out), optional :: fvalue
real(c_double), intent(out), optional :: dvalue
integer(c_int), intent(out), optional :: ivalue
integer(c_long), intent(out), optional :: lvalue
integer(c_int64_t), intent(out), optional :: l64value
logical, intent(out), optional :: logvalue
integer(c_int8_t), intent(out), optional :: i8value
type(c_ptr), intent(out), optional :: pbvalueGet the contents of a Gvalue (private)
| Argument | Type | Required? | Description |
|---|---|---|---|
| VAL | c_ptr | required | The GValue |
| CTYPE | int(type_kind) | required | The type of value it contains. |
The output arguments are identical to the get_cell routines.
subroutine hl_gtk_list_tree_type_adjust(types, renderers)
integer(type_kind), dimension(:), intent(inout) :: types
character(len=*), dimension(:), intent(in) :: renderersEnsure that the types are appropriate to the renderers.
| Argument | Type | Required? | Description |
|---|---|---|---|
| TYPES | type_kind | required | The list of types (updated as needed) |
| RENDERERS | f_string() | required | The list of renderers. |
subroutine hl_gtk_list_tree_config_spin(view, colno, vmin, vmax, &
& step, bigstep, value, digits, rate)
type(c_ptr), intent(in) :: view
integer(c_int), intent(in) :: colno
real(c_double), intent(in), optional :: vmin, vmax, step, &
& bigstep, value
integer(c_int), intent(in), optional :: digits
real(c_double), intent(in), optional :: rateSet up a spin button in a list or tree.
| Argument | Type | Required? | Description |
|---|---|---|---|
| VIEW | c_ptr | required | The treeview containing the spin button. |
| COLNO | int | required | The column with the spin button. |
| MIN | double | optional | The minimum value for the spin button |
| MAX | double | optional | The maximum value for the spin button. |
| STEP | double | optional | The step size for the spin button. |
| BIGSTEP | double | optional | The "jump" size for the spin button (not actually very useful). |
| VALUE | double | optional | The value for the spin button. |
| DIGITS | int | optional | How many digits to show. |
| RATE | double | optional | The climb rate. |
This routine is always called through the interfaces, hl_gtk_listn_config_spin or hl_gtk_tree_config_spin
subroutine hl_gtk_list_tree_combo_model_attach(renderer, cmodel, colno)
type(c_ptr), intent(in) :: renderer
type(c_ptr), intent(in), optional :: cmodel
integer(c_int), optional, intent(in) :: colnoCreate a tree model suitable for a GtkCellRendererCombo and attach it to the renderer.
| Argument | Type | Required? | Description |
|---|---|---|---|
| RENDERER | c_ptr | required | The renderer to which the model will be attached. |
| CMODEL | c_ptr | optional | A custom model for the combobox |
| COLNO | int | optional | Which column of the custom model contains the text. |
This routine is automatically called by the list/tree constructor if needed. To explicitly set a different model, use one of its aliases hl_gtk_listn_combo_set_model or hl_gtk_tree_combo_set_model. The default model is a 1-column list with the strings (indices can be obtained from the PATH argument in the edited hander.
subroutine hl_gtk_list_tree_combo_model_config(view, colno, vals, &
& append, has_entry)
type(c_ptr), intent(in) :: view
integer(c_int), intent(in) :: colno
character(len=*), intent(in), dimension(:), optional :: vals
integer(c_int), intent(in), optional :: append, has_entrySet the strings in the combo model.
| Argument | Type | Required? | Description |
|---|---|---|---|
| VIEW | c_ptr | required | The tree view that contains the combo cell renderer. |
| COLNO | c_int | required | The column number of the combo renderer. |
| VALS | f_string() | required | The strings for the combo box. |
| APPEND | c_int | optional | Set to TRUE to add the strings to those already present, otherwise the strings are replaced. |
| HAS_ENTRY | c_int | optional | Set to TRUE to add an entry field to the combo. Set to FALSE to remove an entry field. |
This routine is always accessed by its aliases hl_gtk_tree_config_combo or hl_gtk_listn_config_combo
module gtk_hl_miscAssorted functions and subroutines that don't fit anywhere else.
subroutine hl_gtk_bin_set_label_markup(widget, label)
type(c_ptr) :: widget
character(kind=c_char), dimension(*), intent(in) :: labelAdd a markup label to a button or menu item.
| Argument | Type | Required? | Description |
|---|---|---|---|
| WIDGET | c_ptr | required | The widget to update. |
| LABEL | string | required | The new label string. |
function hl_gtk_separator_new(vertical) result(spacer)
type(c_ptr) :: spacer
integer(c_int), intent(in), optional :: verticalA Version-independent separator.
| Argument | Type | Required? | Description |
|---|---|---|---|
| HORIZONTAL | boolean | optional | Set to TRUE to make a vertical separator. |
- Installation
- My first gtk-fortran application
- Drawing an image in a PNG file (without GUI)
- A program also usable without GUI
- Using Glade3 and gtkf-sketcher (GTK 3)
- Using gtk-fortran as a fpm dependency
- Debugging with GtkInspector
- Learning from examples
- Video tutorials
- How to start my own project from a gtk-fortran example
- git basics
- CMake basics
- Alternatives to CMake
- How to migrate to GTK 4
- How to contribute to gtk-fortran
- How to hack the cfwrapper with other C libraries