Geany dev
|
User Interface general utility functions. More...
Data Structures | |
struct | GeanyInterfacePrefs |
Interface preferences. More... | |
struct | GeanyMainWidgets |
Important widgets in the main window. More... | |
Macros | |
#define | ui_hookup_widget(owner, widget, widget_name) |
Sets a name to lookup widget from owner. More... | |
Typedefs | |
typedef struct GeanyInterfacePrefs | GeanyInterfacePrefs |
Interface preferences. | |
typedef struct GeanyMainWidgets | GeanyMainWidgets |
Important widgets in the main window. More... | |
Functions | |
void | ui_add_document_sensitive (GtkWidget *widget) |
Adds a widget to the list of widgets that should be set sensitive/insensitive when some documents are present/no documents are open. More... | |
GtkWidget * | ui_button_new_with_image (const gchar *stock_id, const gchar *text) |
Creates a GtkButton with custom text and a stock image similar to gtk_button_new_from_stock() . More... | |
void | ui_combo_box_add_to_history (GtkComboBoxText *combo_entry, const gchar *text, gint history_len) |
Prepends text to the drop down list, removing a duplicate element in the list if found. More... | |
GtkWidget * | ui_dialog_vbox_new (GtkDialog *dialog) |
Makes a fixed border for dialogs without increasing the button box border. More... | |
void | ui_entry_add_clear_icon (GtkEntry *entry) |
Adds a small clear icon to the right end of the passed entry. More... | |
GtkWidget * | ui_frame_new_with_alignment (const gchar *label_text, GtkWidget **alignment) |
Creates a GNOME HIG-style frame (with no border and indented child alignment). More... | |
gint | ui_get_gtk_settings_integer (const gchar *property_name, gint default_value) |
Reads an integer from the GTK default settings registry (see https://docs.gtk.org/gtk3/class.Settings.html). More... | |
GtkWidget * | ui_image_menu_item_new (const gchar *stock_id, const gchar *label) |
Creates a GtkImageMenuItem with a stock image and a custom label. More... | |
gboolean | ui_is_keyval_enter_or_return (guint keyval) |
Checks whether the passed keyval is the Enter or Return key. More... | |
const gchar * | ui_lookup_stock_label (const gchar *stock_id) |
Finds the label text associated with stock_id. More... | |
GtkWidget * | ui_lookup_widget (GtkWidget *widget, const gchar *widget_name) |
Returns a widget from a name in a component, usually created by Glade. More... | |
void | ui_menu_add_document_items (GtkMenu *menu, GeanyDocument *active, GCallback callback) |
Adds a list of document items to menu. More... | |
void | ui_menu_add_document_items_sorted (GtkMenu *menu, GeanyDocument *active, GCallback callback, GCompareFunc sort_func) |
Adds a list of document items to menu. More... | |
GtkWidget * | ui_path_box_new (const gchar *title, GtkFileChooserAction action, GtkEntry *entry) |
Creates a GtkHBox with entry packed into it and an open button which runs a file chooser, replacing entry text (if successful) with the path returned from the GtkFileChooser . More... | |
void | ui_progress_bar_start (const gchar *text) |
Starts a constantly pulsing progressbar in the right corner of the statusbar (if the statusbar is visible). More... | |
void | ui_progress_bar_stop (void) |
Stops a running progress bar and hides the widget again. More... | |
void | ui_set_statusbar (gboolean log, const gchar *format,...) |
Displays text on the statusbar. More... | |
void | ui_table_add_row (GtkTable *table, gint row,...) G_GNUC_NULL_TERMINATED |
Packs all GtkWidgets passed after the row argument into a table, using one widget per cell. More... | |
void | ui_tree_view_set_tooltip_text_column (GtkTreeView *tree_view, gint column) |
Adds text tooltips to a tree view. More... | |
void | ui_widget_modify_font_from_string (GtkWidget *wid, const gchar *str) |
Modifies the font of a widget using gtk_widget_modify_font(). More... | |
void | ui_widget_set_tooltip_text (GtkWidget *widget, const gchar *text) |
Sets text as the contents of the tooltip for widget. More... | |
User Interface general utility functions.
#define ui_hookup_widget | ( | owner, | |
widget, | |||
widget_name | |||
) |
Sets a name to lookup widget from owner.
owner | Usually a window, dialog or popup menu. |
widget | Widget. |
widget_name | Name. |
typedef struct GeanyMainWidgets GeanyMainWidgets |
Important widgets in the main window.
Accessed by geany->main_widgets
.
void ui_add_document_sensitive | ( | GtkWidget * | widget | ) |
Adds a widget to the list of widgets that should be set sensitive/insensitive when some documents are present/no documents are open.
It will be removed when the widget is destroyed.
widget | The widget to add. |
GtkWidget * ui_button_new_with_image | ( | const gchar * | stock_id, |
const gchar * | text | ||
) |
Creates a GtkButton
with custom text and a stock image similar to gtk_button_new_from_stock()
.
stock_id | A GTK_STOCK_NAME string. |
text | Button label text, can include mnemonics. |
GtkButton
. void ui_combo_box_add_to_history | ( | GtkComboBoxText * | combo_entry, |
const gchar * | text, | ||
gint | history_len | ||
) |
Prepends text to the drop down list, removing a duplicate element in the list if found.
Also ensures there are <= history_len elements.
combo_entry | . |
text | Text to add, or NULL for current entry text. |
history_len | Max number of items, or 0 for default. |
GtkWidget * ui_dialog_vbox_new | ( | GtkDialog * | dialog | ) |
Makes a fixed border for dialogs without increasing the button box border.
dialog | The parent container for the GtkVBox . |
GtkVBox
. void ui_entry_add_clear_icon | ( | GtkEntry * | entry | ) |
Adds a small clear icon to the right end of the passed entry.
A callback to clear the contents of the GtkEntry is automatically added.
entry | The GtkEntry object to which the icon should be attached. |
GtkWidget * ui_frame_new_with_alignment | ( | const gchar * | label_text, |
GtkWidget ** | alignment | ||
) |
Creates a GNOME HIG-style frame (with no border and indented child alignment).
label_text | The label text. |
alignment | An address to store the alignment widget pointer. |
gint ui_get_gtk_settings_integer | ( | const gchar * | property_name, |
gint | default_value | ||
) |
Reads an integer from the GTK default settings registry (see https://docs.gtk.org/gtk3/class.Settings.html).
property_name | The property to read. |
default_value | The default value in case the value could not be read. |
GtkWidget * ui_image_menu_item_new | ( | const gchar * | stock_id, |
const gchar * | label | ||
) |
Creates a GtkImageMenuItem
with a stock image and a custom label.
stock_id | Stock image ID, e.g. GTK_STOCK_OPEN . |
label | Menu item label, can include mnemonics. |
GtkImageMenuItem
.gboolean ui_is_keyval_enter_or_return | ( | guint | keyval | ) |
Checks whether the passed keyval is the Enter or Return key.
There are three different Enter/Return key values (GDK_KEY_Return
, GDK_KEY_ISO_Enter
, GDK_KEY_KP_Enter
). This is just a convenience function.
keyval | A keyval. |
TRUE
if keyval is the one of the Enter/Return key values, otherwise FALSE
. const gchar * ui_lookup_stock_label | ( | const gchar * | stock_id | ) |
Finds the label text associated with stock_id.
stock_id | stock_id to lookup e.g. GTK_STOCK_OPEN . |
GtkWidget * ui_lookup_widget | ( | GtkWidget * | widget, |
const gchar * | widget_name | ||
) |
Returns a widget from a name in a component, usually created by Glade.
Call it with the toplevel widget in the component (i.e. a window/dialog), or alternatively any widget in the component, and the name of the widget you want returned.
widget | Widget with the widget_name property set. |
widget_name | Name to lookup. |
void ui_menu_add_document_items | ( | GtkMenu * | menu, |
GeanyDocument * | active, | ||
GCallback | callback | ||
) |
Adds a list of document items to menu.
menu | Menu. |
active | Which document to highlight, or NULL . |
callback | is used for each menu item's "activate" signal and will be passed the corresponding document pointer as user_data . |
doc->is_valid
in the callback. void ui_menu_add_document_items_sorted | ( | GtkMenu * | menu, |
GeanyDocument * | active, | ||
GCallback | callback, | ||
GCompareFunc | compare_func | ||
) |
Adds a list of document items to menu.
compare_func might be NULL to not sort the documents in the menu. In this case, the order of the document tabs is used.
See document_compare_by_display_name() for an example sort function.
menu | Menu. |
active | Which document to highlight, or NULL . |
callback | is used for each menu item's "activate" signal and will be passed the corresponding document pointer as user_data . |
compare_func | is used to sort the list. Might be NULL to not sort the list. |
doc->is_valid
in the callback. GtkWidget * ui_path_box_new | ( | const gchar * | title, |
GtkFileChooserAction | action, | ||
GtkEntry * | entry | ||
) |
Creates a GtkHBox
with entry packed into it and an open button which runs a file chooser, replacing entry text (if successful) with the path returned from the GtkFileChooser
.
GtkComboBoxEntry
. title | The file chooser dialog title, or NULL . |
action | The mode of the file chooser. |
entry | Can be an unpacked GtkEntry , or the child of an unpacked widget, such as GtkComboBoxEntry . |
GtkHBox
. void ui_progress_bar_start | ( | const gchar * | text | ) |
Starts a constantly pulsing progressbar in the right corner of the statusbar (if the statusbar is visible).
This is a convenience function which adds a timer to pulse the progressbar constantly until ui_progress_bar_stop() is called. You can use this function when you have time consuming asynchronous operation and want to display some activity in the GUI and when you don't know about detailed progress steps. The progressbar widget is hidden by default when it is not active. This function and ui_progress_bar_stop() will show and hide it automatically for you.
You can also access the progressbar widget directly using geany->main_widgets->progressbar
and use the GtkProgressBar API to set discrete fractions to display better progress information. In this case, you need to show and hide the widget yourself. You can find some example code in src/printing.c
.
text | The text to be shown as the progress bar label or NULL to leave it empty. |
void ui_progress_bar_stop | ( | void | ) |
Stops a running progress bar and hides the widget again.
void ui_set_statusbar | ( | gboolean | log, |
const gchar * | format, | ||
... | |||
) |
Displays text on the statusbar.
log | Whether the message should be recorded in the Status window. |
format | A printf -style string. |
void ui_table_add_row | ( | GtkTable * | table, |
gint | row, | ||
... | |||
) |
Packs all GtkWidgets
passed after the row argument into a table, using one widget per cell.
The first widget is not expanded as the table grows, as this is usually a label.
table | |
row | The row number of the table. |
void ui_tree_view_set_tooltip_text_column | ( | GtkTreeView * | tree_view, |
gint | column | ||
) |
Adds text tooltips to a tree view.
This is similar to gtk_tree_view_set_tooltip_column() but considers the column contents to be text, not markup – it uses gtk_tooltip_set_text() rather than gtk_tooltip_set_markup() to set the tooltip's value.
tree_view | The tree view |
column | The column to get the tooltip from |
void ui_widget_modify_font_from_string | ( | GtkWidget * | widget, |
const gchar * | str | ||
) |
Modifies the font of a widget using gtk_widget_modify_font().
widget | The widget. |
str | The font name as expected by pango_font_description_from_string(). |
void ui_widget_set_tooltip_text | ( | GtkWidget * | widget, |
const gchar * | text | ||
) |
Sets text as the contents of the tooltip for widget.
widget | The widget the tooltip should be set for. |
text | The text for the tooltip. |