-
Notifications
You must be signed in to change notification settings - Fork 46
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_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_list1_new; A single column list with indexing
- hl_gtk_list1_get_selections; Get the selected row(s) from a 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_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_menu_new; Create a menubar.
- hl_gtk_menu_submenu; Add a submenu to a menu
- hl_gtk_menu_item; Add a button to 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_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_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
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) result(win)
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 to of others. |
BELOW | boolean | optional | Set to TRUE to make the window stay below others. |
subroutine hl_gtk_box_pack(box, child, expand, fill, padding, 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)
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)
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)
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, homogeneous, group) result(nbook)
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. |
HOMOGENEOUS | boolean | optional | Whether the tabs are all the same size. |
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)
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_check_button_new(label, toggled, data, tooltip, &
& initial_state, sensitive) result(but)
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)
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)
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)
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) result(entry)
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 signal was 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. |
subroutine hl_gtk_entry_get_text(entry, text, 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) result(view)
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/ |
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)
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)
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)
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)
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)
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)
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)
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)
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) result(list)
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. |
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_ins(list, 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)
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)
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_cell(list, row, col, &
& svalue, fvalue, dvalue, ivalue, lvalue, 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)
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)
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)
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)
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)
Return 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)
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). |
subroutine hl_gtk_list1_ins(list, text, 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)
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)
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_cell(list, row, 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)
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)
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)
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)
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)
Return the number of rows in a list.
Argument | Type | Required? | Description |
---|---|---|---|
LIST | c_ptr | required | the list to query |
function hl_gtk_tree_new(scroll, ncols, types, changed, data, multiple,&
& width, titles, height, swidth, align, ixpad, iypad, sensitive, &
& tooltip, sortable) result(tree)
Make a tree veiw
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. |
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_ins(tree, row, 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)
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)
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)
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)
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)
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, N.B., column zero is the hidden index column. (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)
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.
Implements the GtkMenuBar menu system.
function hl_gtk_menu_new(orientation) result(menu)
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)
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) &
& result(item)
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. |
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)
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)
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)
Set 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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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
function hl_gtk_spin_button_flt_new(vmin, vmax, step, initial_value, &
& value_changed, data, digits, sensitive, tooltip, wrap) &
& result(spin_button)
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)
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)
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)
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)
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
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) result(cbox)
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. |
subroutine hl_gtk_combo_box_add_text(cbox, text, index, 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)
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)
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. |
- 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