utils/gtk.h file

GTK utils.

Contents

Classes

struct _ZGObjectImpl
GObject struct (from GObject source code), used where hacks are needed.

Typedefs

using ZGObjectImpl = struct _ZGObjectImpl
GObject struct (from GObject source code), used where hacks are needed.

Functions

void z_gtk_list_store_splice(GListStore* store, GPtrArray* ptr_array)
Removes all items and re-populates the list store.
auto z_gtk_message_dialog_get_label(GtkMessageDialog* self, const int secondary) -> GtkLabel*
Returns the primary or secondary label of the given GtkMessageDialog.
void z_gtk_configure_simple_combo_box(GtkComboBox* cb, GtkTreeModel* model)
Configures a simple value-text combo box using the given model.
void z_gtk_button_set_icon_name_and_text(GtkButton* btn, const char* name, const char* text, bool icon_first, GtkOrientation orientation, int spacing)
Sets the icon name and optionally text.
auto z_gtk_toggle_button_new_with_icon(const char* name) -> GtkToggleButton*
Creates a toggle button with the given icon name.
auto z_gtk_toggle_button_new_with_icon_and_text(const char* name, const char* text, bool icon_first, GtkOrientation orientation, int spacing) -> GtkToggleButton*
Creates a toggle button with the given icon name.
auto z_gtk_button_new_with_icon_and_text(const char* name, const char* text, bool icon_first, GtkOrientation orientation, int spacing) -> GtkButton*
Creates a button with the given icon name and text.
auto z_gtk_button_new_with_resource(IconType icon_type, const char* name) -> GtkButton*
Creates a button with the given resource name as icon.
auto z_gtk_toggle_button_new_with_resource(IconType icon_type, const char* name) -> GtkToggleButton*
Creates a toggle button with the given resource name as icon.
auto z_gtk_create_menu_item_full(const gchar* label_name, const gchar* icon_name, const char* detailed_action) -> GMenuItem*
Creates a menu item.
auto z_gtk_get_single_selection_pointer(GtkTreeView* tv, int column) -> void*
Returns a pointer stored at the given selection.
auto z_gtk_get_tooltip_for_action(const char* detailed_action, const char* tooltip) -> char*
Gets the tooltip for the given action on the given widget.
void z_gtk_widget_set_tooltip_for_action(GtkWidget* widget, const char* detailed_action, const char* tooltip)
Sets the tooltip for the given action on the given widget.
void z_gtk_set_tooltip_for_actionable(GtkActionable* actionable, const char* tooltip)
Sets the tooltip and finds the accel keys and appends them to the tooltip in small text.
void z_gtk_widget_remove_style_class(GtkWidget* widget, const gchar* class_name)
Removes the given style class from the widget.
static auto z_gtk_widget_get_device(GtkWidget* widget) -> GdkDevice*
Gets the GdkDevice for a GtkWidget.
static void z_gtk_widget_get_mask(GtkWidget* widget, GdkModifierType* mask)
Sets the GdkModifierType given for the widget.
static auto z_gtk_keyval_is_alt(const guint keyval) -> int
Returns if the keyval is an Alt key.
static auto z_gtk_keyval_is_ctrl(const guint keyval) -> int
Returns if the keyval is a Control key.
static auto z_gtk_keyval_is_arrow(const guint keyval) -> int
Returns if the keyval is an arrow key.
static auto z_gtk_keyval_is_shift(const guint keyval) -> int
Returns if the keyval is a Shift key.
auto z_gtk_widget_get_nth_child(GtkWidget* widget, int index) -> GtkWidget*
Returns the nth child of a container.
void z_gtk_combo_box_set_ellipsize_mode(GtkComboBox* self, PangoEllipsizeMode ellipsize)
Sets the ellipsize mode of each text cell renderer in the combo box.
void z_gtk_button_set_emblem(GtkButton* btn, const char* emblem_icon)
Sets the given emblem to the button, or unsets the emblem if emblem_icon is NULL.
void z_gtk_setup_foldable_notebook(GtkNotebook* notebook)
Makes the given notebook foldable.
void z_gtk_widget_set_margin(GtkWidget* widget, int margin)
Sets the margin on all 4 sides on the widget.
auto z_gtk_activate_dir_link_func(GtkLabel* label, char* uri, void* data) -> bool
Callback to use for simple directory links.
void z_gtk_notebook_make_detachable(GtkNotebook* notebook, GtkWindow* parent_window)
Makes the given GtkNotebook detachable to a new window.
void z_gtk_message_dialog_wrap_message_area_in_scroll(GtkMessageDialog* dialog, int min_width, int min_height)
Wraps the message area in a scrolled window.
auto z_gtk_text_buffer_get_full_text(GtkTextBuffer* buffer) -> char*
Returns the full text contained in the text buffer.
void z_gtk_generate_screenshot_image(GtkWidget* widget, const char* type, char** option_keys, char** option_values, char** ret_dir, char** ret_path, bool accept_fallback)
Generates a screenshot image for the given widget.
void z_gtk_actionable_set_action_from_setting(GtkActionable* actionable, GSettings* settings, const char* key)
Sets the action target of the given GtkActionable to be binded to the given setting.
auto z_gtk_tree_view_column_get_column_id(GtkTreeViewColumn* col) -> int
Returns column number or -1 if not found or on error.
void z_gtk_scrolled_window_get_visible_rect(GtkScrolledWindow* scroll, graphene_rect_t* rect)
Gets the visible rectangle from the scrolled window's adjustments.
auto z_gtk_dialog_run(GtkDialog* dialog, bool destroy_on_close) -> int
Mimics the blocking behavior.
void z_gtk_show_context_menu_from_g_menu(GtkPopoverMenu* popover_menu, double x, double y, GMenu* menu)
The popover must already exist as a children of its intended widget (or a common parent).
auto z_gtk_drop_target_get_selected_action(GtkDropTarget* drop_target) -> GdkDragAction
Returns the bitmask of the selected action during a drop (eg, GDK_ACTION_COPY).
auto z_gdk_clipboard_get_text(GdkClipboard* clipboard) -> char*
Returns the text on the clipboard, or NULL if there is nothing or the content is not text.
auto z_gdk_pixbuf_new_from_icon_name(const char* icon_name, int width, int height, int scale, GError** error) -> GdkPixbuf*
Creates a new pixbuf for the given icon scaled at the given width/height.
auto z_gdk_texture_new_from_icon_name(const char* icon_name, int width, int height, int scale) -> GdkTexture*
Creates a new texture for the given icon scaled at the given width/height.
void z_gtk_widget_print_hierarchy(GtkWidget* widget)
Prints the widget's hierarchy (parents).
auto z_gtk_simple_action_shortcut_func(GtkWidget* widget, GVariant* args, gpointer user_data) -> gboolean
A shortcut callback to use for simple actions.
auto z_gtk_widget_find_child_of_type(GtkWidget* widget, GType type) -> GtkWidget*
Recursively searches the children of widget for a child of type type.