-
Notifications
You must be signed in to change notification settings - Fork 45
Highlevel api
Currently included
- hl_gtk_window_new; A top-level window.
- hl_gtk_box_new; A packing box
- hl_gtk_box_pack; Pack widget into a box
- hl_gtk_table_new; Make a new table widget
- hl_gtk_table_attach; Put a widget into the table
- hl_gtk_table_expand; Add row or columns to a table
- hl_gtk_notebook_new; Create a new notebook widget
- hl_gtk_notebook_add_page; Add a page to a noteboook widget
- hl_gtk_button_new; A simple button
- hl_gtk_check_button_new; A check button
- hl_gtk_radio_button_new; A radio button with group.
- hl_gtk_radio_group_get_select; Which member of a radio group is selected.
- hl_gtk_radio_group_set_select; Select a member of a radio group.
- hl_gtk_entry_new; A 1-line text box
- hl_gtk_text_view_new; Multiline text view/edit
- hl_gtk_text_view_insert; Insert text to text view
- hl_gtk_text_view_delete; Delete text from text view
- hl_gtk_text_view_get_text; Get text from text view
- hl_gtk_text_view_get_cursor; Get text view cursor location
- hl_gtk_text_view_get_selection; Get text view selection
- hl_gtk_text_view_get_modified; Get modified status
- hl_gtk_text_view_set_modified; Set/clear modified status
- hl_gtk_text_view_get_info; Miscellaneous information
- hl_gtk_listn_new; Create a multi-column list
- hl_gtk_listn_ins; Insert a row to a multi column list
- hl_gtk_listn_rem; Delete a row from a multi column list
- hl_gtk_listn_get_selections; Get the selected row(s) in a multi-column list
- hl_gtk_listn_set_selection; Set the selected row in a multi column list
- hl_gtk_listn_set_cell; Set the value of a cell in a multi column list
- hl_gtk_listn_get_cell; Get the contents of a cell in a multi-column list
- hl_gtk_listn_move_row; Move a row to a new location
- hl_gtk_listn_swap_rows; Exchange 2 rows
- hl_gtk_listn_reorder; New order of rows.
- hl_gtk_listn_get_n_rows; How many rows?
- hl_gtk_listn_set_cell_data_func; Set a rendering function for a list
- hl_gtk_list1_new; A single column list with indexing
- hl_gtk_list1_get_selections; Get the selected row(s) from a list.
- hl_gtk_list1_set_selection; Set the selected row in a single column list
- hl_gtk_list1_ins; Insert a row into a list
- hl_gtk_list1_rem; Delete a row from a list, or clear the list.
- hl_gtk_list1_set_cell; Wrapper for above for a single column list.
- hl_gtk_list1_get_cell; Wrapper for above for a single column list.
- hl_gtk_list1_move_row; Move a row to a new location
- hl_gtk_list1_swap_rows; Exchange 2 rows
- hl_gtk_list1_reorder; New order of rows.
- hl_gtk_list1_get_n_rows; How many rows?
- hl_gtk_list1_set_cell_data_func; Set a rendering function for a list
- hl_gtk_tree_new; Create a tree view
- hl_gtk_tree_ins; Insert a row to a tree view
- hl_gtk_tree_abs_iter; Find the iter for a given "absolute" row
- hl_gtk_tree_row_iter; Find the iter for a given row
- hl_gtk_tree_rem; Delete a row from a tree view
- hl_gtk_tree_get_selections; Get the selected rows of a tree view
- hl_gtk_tree_set_cell; Set a cell in a tree view
- hl_gtk_tree_get_cell; Get the value of a cell in a tree view
- hl_gtk_tree_set_cell_data_func; Set a rendering function for a tree
- hl_gtk_menu_new; Create a menubar.
- hl_gtk_menu_submenu_new; Add a submenu to a menu
- hl_gtk_menu_item_new; Add a button to a menu
- hl_gtk_check_menu_item_new: A checkable item in a menu
- hl_gtk_radio_menu_item_new: A radio checkable item in a menu
- hl_gtk_radio_menu_group_set_select: Select an item in a radio group in a menu
- hl_gtk_progress_bar_new; A progress bar.
- hl_gtk_progress_bar_set; Set the value of a progress bar.
- hl_gtk_message_dialog_show; Show a message dialogue
- hl_gtk_file_chooser_button_new; Simple file chooser button
- hl_gtk_file_chooser_show; Run a more advanced file chooser
- hl_gtk_slider_flt_new; Floating point slider
- hl_gtk_slider_int_new; Integer slider
- hl_gtk_slider_get_value; Get the value of a slider (FP)
- hl_gtk_slider_set_flt; Set a floating point slider
- hl_gtk_slider_set_int; Set an integer slider
- hl_gtk_slider_set_range; Set the limits of a slider (float)
- hl_gtk_slider_set_range_int; Set the limits of a slider (integer)
- hl_gtk_spin_button_flt_new; Floating point spin button
- hl_gtk_spin_button_int_new; Integer slider
- hl_gtk_spin_button_get_value; Get a spin box value
- hl_gtk_spin_button_set_flt; Set a floating point spin box
- hl_gtk_spin_button_set_int; Set an integer spin box
- hl_gtk_spin_button_set_range; Set the limits of a spin box (float)
- hl_gtk_spin_button_set_range_int; Set the limits of a spin box (integer)
- hl_gtk_combo_box_new; Combo box
- hl_gtk_combo_box_add_text; Add an item to combo box
- hl_gtk_combo_box_delete; Delete item
- hl_gtk_combo_box_get_active; Get selected element
- hl_gtk_chooser_resp_cb; Internal signal handler
- hl_gtk_chooser_filt_cb; Internal signal handler
- hl_gtk_widget_add_accelerator; Add an accelerator to a widget
The 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 wierd 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
function hl_gtk_window_new(title, destroy, delete_event, data_destroy, &
& data_delete_event, border, wsize, sensitive, resizable, decorated, &
& deletable, above, below, parent, accel_group) 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, optional, intent(in) :: border
integer, optional, intent(in), dimension(2) :: wsize
integer(kind=c_int), intent(in), optional :: sensitive, resizable, decorated
integer(kind=c_int), intent(in), optional :: deletable, above, below
type(c_ptr), intent(in), optional :: parent
type(c_ptr), intent(out), optional :: accel_group
Higher-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 |
| 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. |
| BELOW | boolean | optional | Set to TRUE to make the window stay below others. |
| PARENT | c_ptr | optional | An optional parent window for the new window. |
| ACCEL_GROUP | c_ptr | optional | An accelerator group, used to add accelerators to widgets within the window. |
function hl_gtk_box_new(horizontal, homogeneous, spacing) result(box)
type(c_ptr) :: box
integer(kind=c_int), intent(in), optional :: horizontal, homogeneous
integer(kind=c_int), intent(in), optional :: spacing
Generic 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(kind=c_int), intent(in), optional :: expand, fill
integer(kind=c_int), intent(in), optional :: padding
integer(kind=c_int), intent(in), optional :: atend
Put 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) result(table)
type(c_ptr) :: table
integer(kind=c_int), intent(in) :: nrows, ncols
integer(kind=c_int), intent(in), optional :: homogeneous
integer(kind=c_int), intent(in), optional :: row_spacing, col_spacing
Utility interface to create a table container
| Argument | Type | Required? | Description |
|---|---|---|---|
| NROWS | c_int | required | The initial number of rows. |
| NCOLS | c_int | required | The initial number of columns. |
| HOMOGENEOUS | boolean | optional | Whether the cells all have the same size. |
| ROW_SPACING | c_int | optional | Spacing between rows. |
| COL_SPACING | c_int | optional | Spacing between columns. |
subroutine hl_gtk_table_attach(table, widget, ix, iy, xspan, yspan, &
& xpad, ypad, xopts, yopts)
type(c_ptr), intent(in) :: table, widget
integer(kind=c_int), intent(in) :: ix, iy
integer(kind=c_int), intent(in), optional :: xspan, yspan
integer(kind=c_int), intent(in), optional :: xpad, ypad
integer(kind=c_int), intent(in), optional :: xopts, yopts
Attach 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) |
| YOPTS | c_int | optional | Y fill/expand options. |
subroutine hl_gtk_table_expand(table, ny, nx)
type(c_ptr), intent(in) :: table
integer(kind=c_int), intent(in), optional :: ny, nx
Add 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.
function hl_gtk_notebook_new(show_tabs, tab_position, popup, &
& scrollable, group) result(nbook)
type(c_ptr) :: nbook
integer(kind=c_int), intent(in), optional :: show_tabs
integer(kind=c_int), intent(in), optional :: tab_position
integer(kind=c_int), intent(in), optional :: popup, scrollable
character(kind=c_char), intent(in), optional, dimension(*), target :: group
Convenience 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. |
function hl_gtk_notebook_add_page(nbook, page, position, at_start, &
& reorderable, detachable, label) result(location)
integer(kind=c_int) :: location
type(c_ptr), intent(in) :: nbook, page
integer(kind=c_int), intent(in), optional :: position
integer(kind=c_int), intent(in), optional :: at_start, reorderable, &
& detachable
character(kind=c_char), dimension(*), intent(in), optional :: label
Convenience 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.
Convenience interfaces for regular buttons, checkboxes and radio menus.
function hl_gtk_button_new(label, clicked, data, tooltip, sensitive, &
& accel_key, accel_mods, accel_group, accel_flags) 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(kind=c_int), intent(in), optional :: sensitive
character(kind=c_char), dimension(*), optional, intent(in) :: accel_key
integer(kind=c_int), optional, intent(in) :: accel_mods, accel_flags
type(c_ptr), optional, intent(in) :: accel_group
Higher-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. |
| ACCEL_KEY | string | optional | Set to the character value or code of a key to use as an accelerator. |
| ACCEL_MODS | c_int | optional | Set to the modifiers for the accelerator. (If not given then GTK_CONTROL_MASK is assumed). |
| ACCEL_GROUP | c_ptr | optional | The accelerator group to which the accelerator is attached, must have been added to the top-level window. |
| ACCEL_FLAGS | c_int | optional | Flags for the accelerator, if not present then GTK_ACCEL_VISIBLE, is used (to hide the accelerator, use ACCEL_FLAGS=0). |
function hl_gtk_check_button_new(label, toggled, data, tooltip, &
& initial_state, sensitive) 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(kind=c_int), intent(in), optional :: initial_state
integer(kind=c_int), intent(in), optional :: sensitive
Higher 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. |
function hl_gtk_radio_button_new(group, label, toggled, data, tooltip, &
& sensitive) result(but)
type(c_ptr) :: but
type(c_ptr), intent(inout) :: group
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(kind=c_int), intent(in), optional :: sensitive
Radio button
| Argument | Type | Required? | Description |
|---|---|---|---|
| GROUP | c_ptr | required | The group to which the button belongs. This is an INOUT argument so it must be a variable of type(c_ptr). To start a new group (menu) initialize the variable to NULL, to add a new button use the value returned from the last call to hl_gtk_radio_button_new. This is the variable which you use to do things like setting the selection. |
| LABEL | string | required | The label for the button. |
| TOGGLED | c_funptr | optional | call back to be executed when the button is toggled |
| DATA | c_ptr | optional | Data to pass to/from the "toggled" callback. |
| TOOLTIP | string | optional | A tooltip for the radio button |
| SENSITIVE | boolean | optional | Whether the widget should initially be sensitive or not. |
subroutine hl_gtk_radio_group_set_select(group, index)
type(c_ptr), intent(in) :: group
integer(kind=c_int), intent(in) :: index
Set the indexth button of a radio group
| Argument | Type | Required? | Description |
|---|---|---|---|
| GROUP | c_ptr | required | The group of the last button added to the radio menu |
| INDEX | integer | required | The index of the button to set (starting from the first as 0). |
function hl_gtk_radio_group_get_select(group) result(index)
integer(kind=c_int) :: index
type(c_ptr) :: group
Find the selected button in a radio group.
| Argument | Type | Required? | Description |
|---|---|---|---|
| GROUP | c_ptr | required | The group of the last button added to the radio menu |
Convenience 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_out_event, data_focus_out, &
& focus_in_event, data_focus_in) result(entry)
type(c_ptr) :: entry
integer, intent(in), optional :: len
integer(c_int), intent(in), optional :: editable
type(c_funptr), optional :: activate
type(c_ptr), optional :: data
character(kind=c_char), dimension(*), intent(in), optional :: tooltip, value
integer(kind=c_int), intent(in), optional :: sensitive
type(c_funptr), optional :: changed, delete_text, insert_text, &
& focus_out_event, focus_in_event
type(c_ptr), optional :: data_changed, data_delete_text, data_insert_text, &
& data_focus_out, data_focus_in
Higher 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 |
subroutine hl_gtk_entry_get_text(entry, text, status)
type(c_ptr), intent(in) :: entry
character(len=*), intent(out) :: text
integer(kind=c_int), optional, intent(out) :: status
Return 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_out_event, &
& data_focus_out, focus_in_event, data_focus_in) result(view)
type(c_ptr) :: view
type(c_ptr), intent(out), optional :: scroll
integer(kind=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(len=*), dimension(:), intent(in), optional :: initial_text
integer(kind=c_int), intent(in), optional :: sensitive
character(kind=c_char), dimension(*), optional :: tooltip
integer(kind=c_int), dimension(:), optional :: ssize
type(c_ptr), intent(out), optional :: buffer
type(c_funptr), optional :: focus_out_event, focus_in_event
type(c_ptr), optional :: data_focus_out, data_focus_in
A 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 |
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(kind=c_int), optional, intent(in) :: line, column
integer(kind=c_int), optional, intent(in) :: replace, at_cursor
type(c_ptr), intent(in), optional :: buffer
Insert 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(kind=c_int), intent(in), optional :: line, column, n_chars, n_lines
type(c_ptr), intent(in), optional :: buffer
Delete 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(kind=c_int), intent(in), optional :: start_column, start_line, &
& end_line, end_column
integer(kind=c_int), intent(in), optional :: hidden
type(c_ptr), intent(in), optional :: buffer
Get 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(kind=c_int), dimension(3) :: ipos
type(c_ptr), intent(in) :: view
type(c_ptr), intent(in), optional :: buffer
Get 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(kind=c_int) :: issel
type(c_ptr), intent(in) :: view
integer(kind=c_int), dimension(3), intent(out) :: s_start, s_end
type(c_ptr), intent(in), optional :: buffer
Get 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(kind=c_int) :: ismod
type(c_ptr), intent(in) :: view
Check 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(kind=c_int), intent(in) :: state
Set/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(kind=c_int), intent(out), optional :: nlines, nchars
integer(kind=c_int), intent(out), optional, allocatable, dimension(:) :: ncline
type(c_ptr), intent(in), optional :: buffer
Get 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 |
These 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. Only "text" displays are supported.
There are three types.
- listn; A multi-column flat list. At present, there is no support for determining selected columns, or for editing the cell contents, because to date I've not been able to decipher the documentation on how to do it.
- list1; A single-column flat list, that allows only string values. (This is now implemented nbby calls to the corresponding listn routines).
- 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, sensitive, &
& tooltip, sortable, editable, colnos, edited, data_edited) result(list)
type(c_ptr) :: list
type(c_ptr), intent(out) :: scroll
integer(kind=c_int), intent(in), optional :: ncols
integer(kind=type_kind), dimension(:), intent(in), optional :: types
type(c_funptr), optional :: changed
type(c_ptr), intent(in), optional :: data
integer(kind=c_int), intent(in), optional :: multiple
integer(kind=c_int), intent(in), optional, dimension(:) :: width
character(len=*), dimension(:), intent(in), optional :: titles
integer(kind=c_int), intent(in), optional :: height, swidth
real(kind=c_float), intent(in), optional, dimension(:) :: align
integer(kind=c_int), intent(in), optional, dimension(:) :: ixpad, iypad
integer(kind=c_int), intent(in), optional :: sensitive
character(kind=c_char), dimension(*), intent(in), optional :: tooltip
integer(kind=c_int), intent(in), optional, dimension(:) :: sortable, editable
integer(kind=c_int), dimension(:), allocatable, intent(out), optional, target :: colnos
type(c_funptr), optional :: edited
type(c_ptr), optional, intent(in) :: data_edited
Make a multi column list
| Argument | Type | Required? | Description |
|---|---|---|---|
| SCROLL | c_ptr | required | The scrollable widget to contain the list. (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. |
| 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. |
| COLNOS | c_int() | optional | An array of column numbers for the editing callback to use, must be an argument to prevent automatic deallocation, must be present if EDITABLE is present. |
| 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. |
At least one of the array arguments or NCOLS must be given. If TYPES is not given, then strings are assumed.
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_ins(list, row)
type(c_ptr), intent(in) :: list
integer(kind=c_int), intent(in), optional :: row
Insert 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) |
subroutine hl_gtk_listn_rem(list, row)
type(c_ptr), intent(in) :: list
integer(kind=c_int), optional, intent(in) :: row
Remove 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(kind=c_int) :: count
type(c_ptr), intent(in) :: list
integer(kind=c_int), dimension(:), allocatable, target, &
& intent(out), optional :: indices
type(c_ptr), optional :: selection
Get 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(kind=c_int), intent(in), optional :: row
Set 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_listn_set_cell(list, row, col, &
& svalue, fvalue, dvalue, ivalue, lvalue, l64value)
type(c_ptr), intent(in) :: list
integer(kind=c_int), intent(in) :: row, col
character(len=*), intent(in), optional :: svalue
real(kind=c_float), intent(in), optional :: fvalue
real(kind=c_double), intent(in), optional :: dvalue
integer(kind=c_int), intent(in), optional :: ivalue
integer(kind=c_long), intent(in), optional :: lvalue
integer(kind=c_int64_t), intent(in), optional :: l64value
Set 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. |
Note that reasonable conversions are made between types.
subroutine hl_gtk_listn_get_cell(list, row, col, &
& svalue, fvalue, dvalue, ivalue, lvalue, l64value)
type(c_ptr), intent(in) :: list
integer(kind=c_int), intent(in) :: row, col
character(len=*), intent(out), optional :: svalue
real(kind=c_float), intent(out), optional :: fvalue
real(kind=c_double), intent(out), optional :: dvalue
integer(kind=c_int), intent(out), optional :: ivalue
integer(kind=c_long), intent(out), optional :: lvalue
integer(kind=c_int64_t), intent(out), optional :: l64value
Retrieve 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. |
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(kind=c_int), intent(in) :: row1
integer(kind=c_int), intent(in), optional :: row2
integer(kind=c_int), intent(in), optional :: after
Move 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(kind=c_int), intent(in) :: row1, row2
Move 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(kind=c_int), intent(in), dimension(:) :: indices
Move 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(kind=c_int) :: nrows
type(c_ptr), intent(in) :: list
Return the number of rows in a list.
| Argument | Type | Required? | Description |
|---|---|---|---|
| LIST | c_ptr | required | the list to query |
subroutine hl_gtk_listn_set_cell_data_func(list, colno, func, &
& data, destroy_notify)
type(c_ptr), intent(in) :: list
integer(kind=c_int), intent(in) :: colno
type(c_funptr), optional :: func
type(c_ptr), optional :: data
type(c_funptr), optional :: destroy_notify
Add 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 |
| COLNO | c_int | required | The column index to which to apply it. |
| FUNC | c_funptr | optional | The function (actually subroutine) |
| details). Omit or set to FNULL 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_list1_new(scroll, width, changed, data, multiple, &
& sensitive, tooltip, title, height) result(list)
type(c_ptr) :: list
type(c_ptr), intent(out) :: scroll
integer(kind=c_int), intent(in), optional :: width
type(c_funptr), intent(in), optional :: changed
type(c_ptr), intent(in), optional :: data
integer(kind=c_int), intent(in), optional :: multiple, sensitive
character(kind=c_char), dimension(*), intent(in), optional :: tooltip
character(len=*), intent(in), optional :: title
integer(kind=c_int), intent(in), optional :: height
A single column selectable list based on the GTK Tree View
| Argument | Type | Required? | Description |
|---|---|---|---|
| SCROLL | c_ptr | required | The scroll box containing 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(kind=c_int), intent(in), optional :: row
Insert 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(kind=c_int), optional, intent(in) :: row
Remove 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(kind=c_int) :: count
type(c_ptr), intent(in) :: list
integer(kind=c_int), dimension(:), allocatable, target, &
& intent(out), optional :: indices
type(c_ptr), optional :: selection
Get 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(kind=c_int), intent(in), optional :: row
Set 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(kind=c_int), intent(in) :: row
character(len=*), intent(in) :: svalue
Set 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(kind=c_int), intent(in) :: row
character(len=*), intent(out) :: svalue
Set 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(kind=c_int), intent(in) :: row1
integer(kind=c_int), intent(in), optional :: row2
integer(kind=c_int), intent(in), optional :: after
Move 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(kind=c_int), intent(in) :: row1, row2
Move 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(kind=c_int), intent(in), dimension(:), target :: indices
Move 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(kind=c_int) :: nrows
type(c_ptr), intent(in) :: list
Return 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_notify
Add 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) |
| details). Omit or set to FNULL 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, sensitive, &
& tooltip, sortable, editable, colnos, edited, data_edited) result(tree)
type(c_ptr) :: tree
type(c_ptr), intent(out) :: scroll
integer(kind=c_int), intent(in), optional :: ncols
integer(kind=type_kind), dimension(:), intent(in), optional :: types
type(c_funptr), optional :: changed
type(c_ptr), intent(in), optional :: data
integer(kind=c_int), intent(in), optional :: multiple
integer(kind=c_int), intent(in), optional, dimension(:) :: width
character(len=*), dimension(:), intent(in), optional :: titles
integer(kind=c_int), intent(in), optional :: height, swidth
real(kind=c_float), intent(in), optional, dimension(:) :: align
integer(kind=c_int), intent(in), optional, dimension(:) :: ixpad, iypad
integer(kind=c_int), intent(in), optional :: sensitive
character(kind=c_char), dimension(*), intent(in), optional :: tooltip
integer(kind=c_int), intent(in), optional, dimension(:) :: sortable, editable
integer(kind=c_int), dimension(:), allocatable, intent(out), optional, target :: colnos
type(c_funptr), optional :: edited
type(c_ptr), optional, intent(in) :: data_edited
Make a tree view
| Argument | Type | Required? | Description |
|---|---|---|---|
| SCROLL | c_ptr | required | The 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. |
| 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. |
| COLNOS | c_int() | optional | An array of column numbers for the editing callback to use, must be an argument to prevent automatic deallocation, must be present if EDITABLE is present. |
| 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. |
At least one of the array arguments or NCOLS must be given. If TYPES is not given, then strings are assumed.
subroutine hl_gtk_tree_edit_cb(renderer, path, text, gdata) bind(c)
type(c_ptr), value :: renderer, path, text, gdata
Default 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_ins(tree, row, absrow)
type(c_ptr), intent(in) :: tree
integer(kind=c_int), intent(in), optional, dimension(:) :: row
integer(kind=c_int), intent(in), optional :: absrow
Insert 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. |
function hl_gtk_tree_abs_iter(tree, iter, index, model) result(valid)
integer(kind=c_int) :: valid
type(c_ptr), intent(in) :: tree
type(gtktreeiter), intent(out), target :: iter
integer(kind=c_int), intent(in) :: index
type(c_ptr), intent(in), optional :: model
Get 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 givem 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(kind=c_int), intent(in), dimension(:) :: row
type(c_ptr), intent(in), optional :: model
Get 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 givem then TREE is ignored |
subroutine hl_gtk_tree_rem(tree, row, absrow)
type(c_ptr), intent(in) :: tree
integer(kind=c_int), optional, intent(in), dimension(:) :: row
integer(kind=c_int), intent(in), optional :: absrow
Remove 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(kind=c_int) :: count
type(c_ptr), intent(in) :: tree
integer(kind=c_int), dimension(:,:), allocatable, target, &
& intent(out), optional :: indices
integer(kind=c_int), dimension(:), allocatable, target, &
& intent(out), optional :: depths
type(c_ptr), optional :: selection
Get 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)
type(c_ptr), intent(in) :: tree
integer(kind=c_int), intent(in), optional :: absrow, col
integer(kind=c_int), intent(in), optional, dimension(:) :: row
character(len=*), intent(in), optional :: svalue
real(kind=c_float), intent(in), optional :: fvalue
real(kind=c_double), intent(in), optional :: dvalue
integer(kind=c_int), intent(in), optional :: ivalue
integer(kind=c_long), intent(in), optional :: lvalue
integer(kind=c_int64_t), intent(in), optional :: l64value
Set 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. |
Note that reasonable conversions are made between types.
subroutine hl_gtk_tree_get_cell(tree, row, col, absrow, &
& svalue, fvalue, dvalue, ivalue, lvalue, l64value)
type(c_ptr), intent(in) :: tree
integer(kind=c_int), intent(in), optional :: absrow, col
integer(kind=c_int), intent(in), optional, dimension(:) :: row
character(len=*), intent(out), optional :: svalue
real(kind=c_float), intent(out), optional :: fvalue
real(kind=c_double), intent(out), optional :: dvalue
integer(kind=c_int), intent(out), optional :: ivalue
integer(kind=c_long), intent(out), optional :: lvalue
integer(kind=c_int64_t), intent(out), optional :: l64value
Retrieve 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 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. |
Note that a similar conversion system to the set_cell routine except that strings can only be returned to SVALUE.
subroutine hl_gtk_tree_set_cell_data_func(list, colno, func, &
& data, destroy_notify)
type(c_ptr), intent(in) :: list
integer(kind=c_int), intent(in) :: colno
type(c_funptr), optional :: func
type(c_ptr), optional :: data
type(c_funptr), optional :: destroy_notify
Add a custom rendering function to a column of a tree
| 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) |
| details). Omit or set to FNULL to remove a function. | |||
| DATA | c_ptr | optional | User data to pass to the function. |
| DESTROY_NOTIFY | c_funptr | optional | A destroy notify subroutine. |
Implements the GtkMenuBar menu system.
function hl_gtk_menu_new(orientation) result(menu)
type(c_ptr) :: menu
integer(kind=c_int), intent(in), optional :: orientation
Menu initializer (mainly for consistency)
| Argument | Type | Required? | Description |
|---|---|---|---|
| ORIENTATION | integer | optional | Whether to lay out the top level horizontaly or vertically. |
function hl_gtk_menu_submenu_new(menu, label, tooltip, pos) result(submenu)
type(c_ptr) :: submenu
type(c_ptr) :: menu
character(kind=c_char), dimension(*), intent(in) :: label
character(kind=c_char), dimension(*), intent(in), optional :: tooltip
integer(kind=c_int), optional :: pos
Make a submenu node
| Argument | Type | Required? | Description |
|---|---|---|---|
| MENU | c_ptr | required | The parent of the submenu |
| LABEL | string | required | The label of the submenu |
| TOOLTIP | string | optional | A tooltip for the submenu. |
| POS | integer | optional | The position at which to insert the item (omit to append) |
function hl_gtk_menu_item_new(menu, label, activate, data, tooltip, &
& pos, tearoff, sensitive, accel_key, accel_mods, accel_group, &
& accel_flags) result(item)
type(c_ptr) :: item
type(c_ptr) :: menu
character(kind=c_char), dimension(*), intent(in), optional :: label
type(c_funptr), optional :: activate
type(c_ptr), optional :: data
character(kind=c_char), dimension(*), intent(in), optional :: tooltip
integer(kind=c_int), optional :: pos
integer(kind=c_int), optional :: tearoff, sensitive
character(kind=c_char), dimension(*), optional, intent(in) :: accel_key
integer(kind=c_int), optional, intent(in) :: accel_mods, accel_flags
type(c_ptr), optional, intent(in) :: accel_group
Make a menu item or separator
| Argument | Type | Required? | Description |
|---|---|---|---|
| MENU | c_ptr | required | The parent menu. |
| LABEL | string | optional | The label for the menu, if absent then insert a separator. |
| ACTIVATE | c_funptr | optional | The callback function for the activate signal |
| DATA | c_ptr | optional | Data to pass to the callback. |
| TOOLTIP | string | optional | A tooltip for the menu item. |
| POS | integer | optional | The position at which to insert the item (omit to append) |
| TEAROFF | boolean | optional | Set to TRUE to make a tearoff point. |
| SENSITIVE | boolean | optional | Set to FALSE to make the widget start in an insensitive state. |
| ACCEL_KEY | string | optional | Set to the character value or code of a key to use as an accelerator. |
| ACCEL_MODS | c_int | optional | Set to the modifiers for the accelerator. (If not given then GTK_CONTROL_MASK is assumed). |
| ACCEL_GROUP | c_ptr | optional | The accelerator group to which the accelerator is attached, must have been added to the top-level window. |
| ACCEL_FLAGS | c_int | optional | Flags for the accelerator, if not present then GTK_ACCEL_VISIBLE, is used (to hide the accelerator, use ACCEL_FLAGS=0). |
function hl_gtk_check_menu_item_new(menu, label, toggled, data, &
& tooltip, pos, initial_state, sensitive) result(item)
type(c_ptr) :: item
type(c_ptr) :: menu
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(kind=c_int), optional :: pos
integer(kind=c_int), optional :: initial_state
integer(kind=c_int), optional :: sensitive
Make a menu item or separator
| Argument | Type | Required? | Description |
|---|---|---|---|
| MENU | c_ptr | required | The parent menu. |
| LABEL | string | required | The label for the menu. |
| TOGGLED | c_funptr | optional | The callback function for the "toggled" signal |
| DATA | c_ptr | optional | Data to pass to the callback. |
| TOOLTIP | string | optional | A tooltip for the menu item. |
| POS | integer | optional | The position at which to insert the item (omit to append) |
| INITIAL_STATE | boolean | optional | Whether the item is initially selected. |
| SENSITIVE | boolean | optional | Set to FALSE to make the widget start in an insensitive state. |
function hl_gtk_radio_menu_item_new(group, menu, label, toggled, data, &
& tooltip, pos, sensitive) result(item)
type(c_ptr) :: group, item
type(c_ptr) :: menu
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(kind=c_int), optional :: pos
integer(kind=c_int), optional :: sensitive
Make a menu item or separator
| Argument | Type | Required? | Description |
|---|---|---|---|
| GROUP | c_ptr | required | The group for the radio item (NULL for a new group). |
| MENU | c_ptr | required | The parent menu. |
| LABEL | string | required | The label for the menu. |
| TOGGLED | c_funptr | optional | The callback function for the "toggled" signal |
| DATA | c_ptr | optional | Data to pass to the callback. |
| TOOLTIP | string | optional | A tooltip for the menu item. |
| POS | integer | optional | The position at which to insert the item (omit to append) |
| SENSITIVE | boolean | optional | Set to FALSE to make the widget start in an insensitive state. |
Implements 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(kind=c_int), optional :: vertical, reversed
real(kind=c_double), optional :: step
Intializer for a progress bar
| Argument | Type | Required? | Description |
|---|---|---|---|
| ORIENTATION | integer | optional | The orientation of the bar. |
| 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(kind=c_double), optional :: val
integer(kind=c_int), optional :: string
character(len=*), intent(in), optional:: text
Set 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
subroutine hl_gtk_progress_bar_set_ii(bar, val, maxv, string, text)
type(c_ptr) :: bar
integer(kind=c_int) :: val, maxv
integer(kind=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
The 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.
function hl_gtk_message_dialog_show(message, button_set, title, type, &
& parent) result(resp)
integer(kind=c_int) :: resp
character(len=*), dimension(:), intent(in) :: message
integer(kind=c_int), intent(in) :: button_set
character(kind=c_char), dimension(*), intent(in), optional :: title
integer(kind=c_int), intent(in), optional :: type
type(c_ptr), intent(in), optional :: parent
A 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 CNULL 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. |
The return value is the response code, not the widget.
hl_gtk_file_chooser_button_new implements the GtkFileChooserButton and its GtkFileChooser options in a convenient package.
hl_gtk_file_chooser_show implements a more 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.
function hl_gtk_file_chooser_button_new(directory, title, &
& width, show_hidden, &
& initial_folder, initial_file, filter, filter_name, file_set, &
& data, sensitive, tooltip) result(cbutton)
type(c_ptr) :: cbutton
integer(kind=c_int), intent(in), optional :: directory
character(kind=c_char), dimension(*), optional, intent(in) :: title
integer(kind=c_int), intent(in), optional :: width
integer(kind=c_int), intent(in), optional :: show_hidden
character(kind=c_char), dimension(*), optional, intent(in) :: initial_folder, initial_file
character(len=*), dimension(:), intent(in), optional :: filter
character(len=*), dimension(:), optional, intent(in) :: filter_name
type(c_funptr), optional :: file_set
type(c_ptr), optional :: data
integer(kind=c_int), intent(in), optional :: sensitive
character(kind=c_char), dimension(*), optional, intent(in) :: tooltip
Bundled file chooser button
| Argument | Type | Required? | Description |
|---|---|---|---|
| DIRECTORY | boolean | optional | Set to TRUE to select directories rather than files. |
| TITLE | string | optional | A title for the button. |
| WIDTH | c_int | optional | A maximum number of characters to show. |
| SHOW_HIDDEN | boolean | optional | Set to TRUE to display hidden files. |
| INITIAL_FOLDER | string | optional | Use to start the search other than in the current directory. |
| INITIAL_FILE | string | optional | An initial file selection. |
| FILTER | string() | optional | An initial list of filename patterns to allow. Each filter is a comma-separated list. |
| FILTER_NAME | string() | optional | Names for the filters. |
| FILE_SET | f_funptr | optional | The callback routine for the "file-set" signal. |
| DATA | c_ptr | optional | User data to pass to the file_Set callback. |
| 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. |
function hl_gtk_file_chooser_show(files, cdir, directory, create, &
& multiple, allow_uri, show_hidden, confirm_overwrite, title, &
& initial_dir, initial_file, filter, filter_name, parent, all, &
& wsize, edit_filters) result(isel)
integer(kind=c_int) :: isel
character(len=*), dimension(:), intent(out), allocatable :: files
character(len=*), intent(out), optional :: cdir
integer(kind=c_int), intent(in), optional :: directory, create, multiple
integer(kind=c_int), intent(in), optional :: allow_uri, show_hidden
integer(kind=c_int), intent(in), optional :: confirm_overwrite
character(kind=c_char), dimension(*), intent(in), optional :: title, initial_dir, initial_file
character(len=*), dimension(:), intent(in), optional :: filter
character(len=*), dimension(:), intent(in), optional :: filter_name
type(c_ptr), intent(in), optional :: parent
integer(kind=c_int), intent(in), optional :: all
integer(kind=c_int), intent(in), dimension(2), optional :: wsize
integer(kind=c_int), intent(in), optional :: edit_filters
Create 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. |
| CONFIRM_OVERWRITE | boolean | optional | Set to TRUE to request confirmation of an overwrite (only used if CREATE is TRUE). |
| TITLE | string | optional | Title for the window. |
| INITIAL_DIR | string | optional | Set the initial directory here instead of the 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. |
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 :: gdata
Callback 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 :: gdata
Callback 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.
GTK 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(kind=c_double), intent(in) :: vmin, vmax, step
integer(kind=c_int), intent(in), optional :: vertical
real(kind=c_double), intent(in), optional :: initial_value
type(c_funptr), optional :: value_changed
type(c_ptr), optional :: data
integer(kind=c_int), optional, intent(in) :: digits
integer(kind=c_int), optional, intent(in) :: sensitive
character(len=*), intent(in), optional:: tooltip
integer(kind=c_int), intent(in), optional :: draw
integer(kind=c_int), intent(in), optional :: length
Floating 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(kind=c_int), intent(in) :: imin, imax
integer(kind=c_int), intent(in), optional :: vertical
integer(kind=c_int), intent(in), optional :: initial_value
type(c_funptr), optional :: value_changed
type(c_ptr), optional :: data
integer(kind=c_int), optional, intent(in) :: sensitive
character(len=*), intent(in), optional:: tooltip ! NB the C-type confuses generic interfaces.
integer(kind=c_int), intent(in), optional :: draw
integer(kind=c_int), intent(in), optional :: length
Floating point 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(kind=c_double) :: val
type(c_ptr) :: slider
Get 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(kind=c_double), intent(in) :: val
Set 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
subroutine hl_gtk_slider_set_int(slider, val)
type(c_ptr), intent(in) :: slider
integer(kind=c_int), intent(in) :: val
Set a floating point 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
subroutine hl_gtk_slider_set_range(slider, lower, upper)
type(c_ptr), intent(in) :: slider
real(kind=c_double), intent(in), optional :: lower, upper
Adjust 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 |
Note 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(kind=c_int), intent(in), optional :: lower, upper
Adjust 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 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) &
& result(spin_button)
type(c_ptr) :: spin_button
real(kind=c_double), intent(in) :: vmin, vmax, step
real(kind=c_double), intent(in), optional :: initial_value
type(c_funptr), optional :: value_changed
type(c_ptr), optional :: data
integer(kind=c_int), optional, intent(in) :: digits
integer(kind=c_int), optional, intent(in) :: sensitive
character(len=*), intent(in), optional:: tooltip ! NB the C-type confuses generic interfaces.
integer(kind=c_int), intent(in), optional :: wrap
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 |
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) result(spin_button)
type(c_ptr) :: spin_button
integer(kind=c_int), intent(in) :: imin, imax
integer(kind=c_int), intent(in), optional :: initial_value
type(c_funptr), optional :: value_changed
type(c_ptr), optional :: data
integer(kind=c_int), optional, intent(in) :: sensitive
character(len=*), intent(in), optional:: tooltip ! NB the C-type confuses generic interfaces.
integer(kind=c_int), intent(in), optional :: wrap
Floating point 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 |
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(kind=c_double) :: val
type(c_ptr) :: spin_button
Get 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(kind=c_double), intent(in) :: val
Set 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
subroutine hl_gtk_spin_button_set_int(spin_button, val)
type(c_ptr), intent(in) :: spin_button
integer(kind=c_int), intent(in) :: val
Set a floating point 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
subroutine hl_gtk_spin_button_set_range(spin_button, lower, upper)
type(c_ptr), intent(in) :: spin_button
real(kind=c_double), intent(in), optional :: lower, upper
Adjust 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 |
Note 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(kind=c_int), intent(in), optional :: lower, upper
Adjust 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 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.
This 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(kind=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(kind=c_int), intent(in), optional :: sensitive
character(kind=c_char), dimension(*), optional, intent(in) :: tooltip
integer(kind=c_int), optional, intent(in) :: active
Creator 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(kind=c_int), intent(in), optional :: index
integer(kind=c_int), intent(in), optional :: at_start
Add 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(cbox, index)
type(c_ptr), intent(in) :: cbox
integer(kind=c_int), intent(in) :: index
Delete 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 |
function hl_gtk_combo_box_get_active(cbox, text, ftext) result(index)
integer(kind=c_int) :: index
type(c_ptr), intent(in) :: cbox
type(c_ptr), intent(out), optional :: text
character(len=*), intent(out), optional :: ftext
Get 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. |
subroutine hl_gtk_widget_add_accelerator(widget, signal, accel_group, &
& accel_key, accel_mods, accel_flags)
type(c_ptr), intent(in) :: widget
character(kind=c_char), dimension(*), intent(in) :: signal
type(c_ptr), intent(in) :: accel_group
character(kind=c_char), dimension(*), intent(in) :: accel_key
integer(kind=c_int), intent(in), optional :: accel_mods, accel_flags
Add an accelerator to a widget (just saves a lot of code duplication)
| Argument | Type | Required? | Description |
|---|---|---|---|
| WIDGET | c_ptr | required | The widget with which the accelerator is associated. |
| SIGNAL | string | required | The signal with which the accelerator is associated |
| ACCEL_GROUP | c_ptr | required | The accelerator group to which the accelerator belongs (must have been created and added to the top-level window). |
| ACCEL_KEY | string | required | The key name to use for the accelerator |
| ACCEL_MODS | c_int | optional | The key modifiers for the accelerator, This defaults to GDK_CONTROL_MASK, set it to 0 to use the unmodified key. |
| ACCEL_FLAGS | c_int | optional | Flags for the accelerator, if not present then GTK_ACCEL_VISIBLE, is used (to hide the accelerator, use ACCEL_FLAGS=0). |
- 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