atomes 1.1.14
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
gtk-misc.c File Reference

GTK3/GTK4 utility subroutines, instead of having pre-processor flags everywhere in the code.
Whenever I need to use a GTK function that changed between v3 and v4,
I created an home made function declared in this file, and deal then here with the potential GTK versions issues. More...

#include "global.h"
#include "interface.h"
+ Include dependency graph for gtk-misc.c:

Go to the source code of this file.

Functions

void show_the_widgets (GtkWidget *widg)
 show GtkWidget
 
void widget_set_sensitive (GtkWidget *widg, gboolean sensitive)
 Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
 
void add_container_child (int type, GtkWidget *widg, GtkWidget *child)
 Add a GtkWidget into another GtkWidget.
 
void add_box_child_end (GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
 Add a GtkWidget in a GtkBox at the end position.
 
void add_box_child_start (int orientation, GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
 Add a GtkWidget in a GtkBox at the initial position.
 
GtkWidget * new_gtk_window ()
 create a new GtkWindow
 
GtkWidget * create_win (gchar *str, GtkWidget *parent, gboolean modal, gboolean resiz)
 create a new GtkWindow
 
void run_this_gtk_dialog (GtkWidget *dial, GCallback handler, gpointer data)
 run a GTK (3 and 4) basic GtkDialog
 
GtkWidget * dialogmodal (gchar *str, GtkWindow *parent)
 Create a new dialog modal window.
 
GtkWidget * message_dialogmodal (gchar *message, gchar *title, GtkMessageType mtype, GtkButtonsType buttons, GtkWidget *parent)
 create a modal (cannot be ignored) message window
 
GtkWidget * dialog_cancel_apply (gchar *title, GtkWidget *parent, gboolean resiz)
 create a dialog modal offering a choice to apply something or not
 
void resize_this_window (GtkWidget *window, int x, int y)
 resize this GtkWindow
 
const gchar * entry_get_text (GtkEntry *entry)
 get the text in a GtkEntry
 
void update_entry_int (GtkEntry *entry, int intval)
 update the content of a GtkEntry as int
 
void update_entry_double (GtkEntry *entry, double doubleval)
 update the content of a GtkEntry as double
 
void update_entry_long_double (GtkEntry *entry, double doubleval)
 update the content of a GtkEntry as long double
 
void update_entry_text (GtkEntry *entry, gchar *text)
 update the content of a GtkEntry as string
 
void text_view_set_monospace (GtkWidget *view)
 set the font of a GtkTextView as monospace
 
void gtk_label_align (GtkWidget *lab, float ax, float ay)
 set text alignment in a GtkLabel
 
gboolean is_the_widget_visible (GtkWidget *widg)
 test if a GtkWidget exist, then return if it is visible or not
 
GtkWidget * create_hscale (float min, float max, float delta, float val, int pos, int round, int size, GCallback handler, GCallback scroll_handler, gpointer data)
 create an horizontal scale GtkWidget
 
GtkWidget * create_vscale (float min, float max, float delta, float val, int pos, int round, int size, GCallback handler, GCallback scroll_handler, gpointer data)
 create an vertical scale GtkWidget
 
GtkWidget * create_vbox (int spacing)
 create a GtkBox with vertical orientation
 
GtkWidget * create_hbox (int spacing)
 create a GtkBox with horizontal orientation
 
GtkWidget * dialog_get_content_area (GtkWidget *widg)
 prepare GtkWidget to insert content in a GtkDialog window
 
void layout_add_widget (GtkWidget *layout, GtkWidget *child, int x_pos, int y_pos)
 Add a GtkWidget in a GtkLayout.
 
GtkWidget * add_vbox_to_layout (GtkWidget *layout, int size_x, int size_y)
 Insert a vertical GtkBox in a GtkLatout then send back the GtkBox.
 
GtkWidget * create_layout (int x, int y)
 create a GtkLayout / GtkFixed widget
 
void combo_text_append (GtkWidget *combo, gchar *text)
 append text in GtkComboBox widget
 
void combo_text_prepend (GtkWidget *combo, gchar *text)
 prepend text in GtkComboBox widget
 
GtkWidget * create_combo ()
 create a GtkCombox widget, note deprecated in GTK4
 
void setup_text_tags (GtkTextBuffer *buffer)
 prepare the avialable text tags for the GtkTextBuffer
 
GtkTextBuffer * add_buffer (GCallback handler, gpointer data, gchar *text)
 create a GtkTextBuffer
 
GtkWidget * create_text_view (int dimx, int dimy, int edit, int mono, GCallback handler, gpointer data, gchar *text)
 create a GtkTextView and display some text
 
GdkPixbuf * convert_to_pixbuf (cairo_surface_t *surf)
 convert cairo surface to GdkPixbuf
 
G_MODULE_EXPORT void to_activate_entry (GtkEventControllerFocus *focus, gpointer data)
 GtkEntry activate signal managment.
 
GtkWidget * create_entry (GCallback handler, int dim, int cdim, gboolean key_release, gpointer data)
 Create a GtkEntry.
 
GtkWidget * stock_image (const gchar *stock_id)
 create a GtkImage for the Gtk database
 
GtkWidget * create_image_from_data (int format, gpointer item_image)
 create Gtk image for data
 
GtkWidget * markup_label (gchar *text, int dimx, int dimy, float ax, float ay)
 
ColRGBAduplicate_color (int num, ColRGBA *col)
 duplicate a ColRGBA pointer
 
ColRGBA gdkrgba_to_rgba (GdkRGBA colgdk)
 convert GdkRGBA color to ColRGBA color
 
GdkRGBA colrgba_togtkrgba (ColRGBA col)
 convert ColRGBA color to GdkRGBA color
 
void set_renderer_color (int tocol, GtkCellRenderer *renderer, ColRGBA col)
 set the color of a GtkCellRenderer
 
void button_set_image (GtkButton *but, gchar *text, int format, gpointer image)
 Add an image to a GtkButton.
 
void adjust_label (GtkWidget *lab, int dimx, int dimy, float ax, float ay)
 adjust the text position, and widget size of a GtkLabel
 
GtkWidget * color_button (ColRGBA col, gboolean alpha, int dimx, int dimy, GCallback handler, gpointer data)
 create a color selection button
 
GtkWidget * font_button (gchar *font, int dimx, int dimy, GCallback handler, gpointer data)
 create a font selection button
 
GtkWidget * spin_button (GCallback handler, double value, double start, double end, double step, int digits, int dim, gpointer data)
 create a spin button
 
GtkWidget * check_button (gchar *text, int dimx, int dimy, gboolean state, GCallback handler, gpointer data)
 create a check button
 
GtkWidget * radio_button (gchar *text, int dimx, int dimy, gboolean state, GCallback handler, gpointer data)
 create a radio button
 
GtkWidget * create_button (gchar *text, int image_format, gchar *image, int dimx, int dimy, int relief, GCallback handler, gpointer data)
 create a simple button
 
void set_image_from_icon_name (GtkWidget *widg, gchar *icon)
 set a image from a stock icon name
 
GtkWidget * abox (GtkWidget *box, char *lab, int vspace)
 box creating routine, to help design faster elements for the GUI
 
GtkWidget * bbox (GtkWidget *box, char *lab)
 
GtkWidget * cbox (GtkWidget *box, char *lab)
 
GtkWidget * fbox (GtkWidget *box, char *lab)
 
GtkWidget * create_scroll (GtkWidget *box, int dimx, int dimy, int shadow)
 create a scroll window
 
GtkWidget * create_expander (gchar *name, gchar *file_img)
 create GtkExpander
 
void provide_gtk_css (gchar *css)
 create a css provider based on the css data
 
GtkWidget * destroy_this_widget (GtkWidget *widg)
 destroy a GtkWidget
 
void destroy_this_dialog (GtkDialog *dialog)
 destroy a GtkDialog
 
void destroy_this_native_dialog (GtkNativeDialog *dialog)
 destroy a GtkNativeDialog
 
G_MODULE_EXPORT void run_destroy_dialog (GtkDialog *dialog, gint response_id, gpointer data)
 to destroy a GtkDialog when the dialog emit the closing signal
 
GSList * file_chooser_get_file_names (GtkFileChooser *chooser)
 create a file list from files selected using a GtkFileChooser
 
gchar * file_chooser_get_file_name (GtkFileChooser *chooser)
 get a file name from a GtkFileChooser (single file selected)
 
gchar * file_chooser_get_current_folder (GtkFileChooser *chooser)
 get the current folder for a GtkFileChooser
 
gboolean file_chooser_set_file_name (GtkFileChooser *chooser, gchar *filename)
 set file name in a GtkFilechooser
 
void file_chooser_set_current_folder (GtkFileChooser *chooser)
 set current folder in a GtkFilechooser
 
GtkWidget * create_file_chooser (const gchar *title, GtkWindow *parent, GtkFileChooserAction act, const gchar *act_name)
 create a GtkFileChooser, utility to select file(s)
 
ColRGBA get_button_color (GtkColorChooser *colob)
 get the ColRGBA color from a GtkColorChooser button
 
ColRGBA get_window_color (GtkWidget *color_win)
 get the ColRGBA color from a color selection window
 
void set_color_chooser_color (GtkWidget *color_win, ColRGBA col)
 set the color of a color selection window
 
void pop_menu_at_pointer (GtkWidget *widg, GdkEvent *event)
 popup a menu at pointer location
 
GtkWidget * get_top_level (GtkWidget *widg)
 get the top level container, window, of a widget
 
G_MODULE_EXPORT gboolean destroy_this_window (GtkWidget *win, GdkEvent *event, gpointer data)
 destroy a GtkWindow
 
G_MODULE_EXPORT gboolean hide_this_window (GtkWidget *win, GdkEvent *event, gpointer data)
 hide a GtkWindow
 
void add_gtk_close_event (GtkWidget *widg, GCallback handler, gpointer data)
 add a close event signal and callback to a GtkWidget
 

Detailed Description

GTK3/GTK4 utility subroutines, instead of having pre-processor flags everywhere in the code.
Whenever I need to use a GTK function that changed between v3 and v4,
I created an home made function declared in this file, and deal then here with the potential GTK versions issues.

Author
Sébastien Le Roux sebas.nosp@m.tien.nosp@m..lero.nosp@m.ux@i.nosp@m.pcms..nosp@m.unis.nosp@m.tra.f.nosp@m.r

Definition in file gtk-misc.c.

Function Documentation

◆ abox()

GtkWidget * abox ( GtkWidget * box,
char * lab,
int vspace )

box creating routine, to help design faster elements for the GUI

GtkWidget * bbox (GtkWidget * box, char * lab) GtkWidget * cbox (GtkWidget * box, char * lab) GtkWidget * fbox (GtkWidget * box, char * lab)

Definition at line 1892 of file gtk-misc.c.

◆ add_box_child_end()

void add_box_child_end ( GtkWidget * widg,
GtkWidget * child,
gboolean expand,
gboolean fill,
int padding )

Add a GtkWidget in a GtkBox at the end position.

Parameters
widgthe GtkBox
childthe GtkWidget to add
expandGTK3 only: expandable
fillGTK3 only: fill
paddingGTK3 only: box padding

Definition at line 257 of file gtk-misc.c.

◆ add_box_child_start()

void add_box_child_start ( int orientation,
GtkWidget * widg,
GtkWidget * child,
gboolean expand,
gboolean fill,
int padding )

Add a GtkWidget in a GtkBox at the initial position.

Parameters
orientationhorizontal or vertical
widgthe GtkBox
childthe GtkWidget to add
expandGTK3 only: expandable
fillGTK3 only: fill
paddingGTK3 only: box padding

Definition at line 279 of file gtk-misc.c.

◆ add_buffer()

GtkTextBuffer * add_buffer ( GCallback handler,
gpointer data,
gchar * text )

create a GtkTextBuffer

Parameters
handlerthe callback on buffer changed
datathe associated data pointer
textthe text to display

Definition at line 1151 of file gtk-misc.c.

◆ add_container_child()

void add_container_child ( int type,
GtkWidget * widg,
GtkWidget * child )

Add a GtkWidget into another GtkWidget.

Parameters
typeGTK4 only: the type of container
widgthe container Gtkwidget
childthe child GtkWidget

Definition at line 206 of file gtk-misc.c.

◆ add_gtk_close_event()

void add_gtk_close_event ( GtkWidget * widg,
GCallback handler,
gpointer data )

add a close event signal and callback to a GtkWidget

Parameters
widgthe GtkWidget
handlerthe callback for the close event
datathe associated data pointer

Definition at line 2363 of file gtk-misc.c.

◆ add_vbox_to_layout()

GtkWidget * add_vbox_to_layout ( GtkWidget * layout,
int size_x,
int size_y )

Insert a vertical GtkBox in a GtkLatout then send back the GtkBox.

Parameters
layoutthe GtkLayout
size_xthe x size of the box
size_ythe y size of the box

Definition at line 844 of file gtk-misc.c.

◆ adjust_label()

void adjust_label ( GtkWidget * lab,
int dimx,
int dimy,
float ax,
float ay )

adjust the text position, and widget size of a GtkLabel

Parameters
labthe GtkLabel to adjust
dimxthe x size
dimythe y size
axthe x alignment
aythe y alignment

Definition at line 1688 of file gtk-misc.c.

◆ bbox()

GtkWidget * bbox ( GtkWidget * box,
char * lab )

Definition at line 1901 of file gtk-misc.c.

◆ button_set_image()

void button_set_image ( GtkButton * but,
gchar * text,
int format,
gpointer image )

Add an image to a GtkButton.

Parameters
butthe GtkButton
textthe message to display
formatthe image format
imagethe data of the image

Definition at line 1657 of file gtk-misc.c.

◆ cbox()

GtkWidget * cbox ( GtkWidget * box,
char * lab )

Definition at line 1911 of file gtk-misc.c.

◆ check_button()

GtkWidget * check_button ( gchar * text,
int dimx,
int dimy,
gboolean state,
GCallback handler,
gpointer data )

create a check button

Parameters
textthe message to display
dimxthe x size
dimythe y size
stateChecked or not (1/0)
handlerthe callback for the button
datathe associated data pointer

Definition at line 1779 of file gtk-misc.c.

◆ color_button()

GtkWidget * color_button ( ColRGBA col,
gboolean alpha,
int dimx,
int dimy,
GCallback handler,
gpointer data )

create a color selection button

Parameters
colthe color to use
alphaUse alpha channel (1/0)
dimxSize x of the button
dimySize y of the button
handlerthe callback for the button
datathe associated data pointer

Definition at line 1708 of file gtk-misc.c.

◆ colrgba_togtkrgba()

GdkRGBA colrgba_togtkrgba ( ColRGBA col)

convert ColRGBA color to GdkRGBA color

Parameters
colthe ColRGBA to convert

Definition at line 1614 of file gtk-misc.c.

◆ combo_text_append()

void combo_text_append ( GtkWidget * combo,
gchar * text )

append text in GtkComboBox widget

Parameters
combothe GtkWidget
textthe text to append

Definition at line 880 of file gtk-misc.c.

◆ combo_text_prepend()

void combo_text_prepend ( GtkWidget * combo,
gchar * text )

prepend text in GtkComboBox widget

Parameters
combothe GtkWidget
textthe text to prepend

Definition at line 893 of file gtk-misc.c.

◆ convert_to_pixbuf()

GdkPixbuf * convert_to_pixbuf ( cairo_surface_t * surf)

convert cairo surface to GdkPixbuf

Parameters
surfthe cairo sufrace to convert

Definition at line 1244 of file gtk-misc.c.

◆ create_button()

GtkWidget * create_button ( gchar * text,
int image_format,
gchar * image,
int dimx,
int dimy,
int relief,
GCallback handler,
gpointer data )

create a simple button

Parameters
textthe message to display
image_formatthe image format
imagethe name of the stock image
dimxthe x size
dimythe y size
reliefbutton should appear pressed or not (1/0)
handlerthe callback for the button
datathe associated data pointer

Definition at line 1843 of file gtk-misc.c.

◆ create_combo()

GtkWidget * create_combo ( )

create a GtkCombox widget, note deprecated in GTK4

Definition at line 903 of file gtk-misc.c.

◆ create_entry()

GtkWidget * create_entry ( GCallback handler,
int dim,
int cdim,
gboolean key_release,
gpointer data )

Create a GtkEntry.

Parameters
handlerthe callback
dimthe x size
cdimthe maximum number of character to display
key_releaseUse release event (1/0)
datathe data pointer for the callback

Definition at line 1294 of file gtk-misc.c.

◆ create_expander()

GtkWidget * create_expander ( gchar * name,
gchar * file_img )

create GtkExpander

Parameters
nameName of the expander tab
file_imgimage file to add if required

Definition at line 1964 of file gtk-misc.c.

◆ create_file_chooser()

GtkWidget * create_file_chooser ( const gchar * title,
GtkWindow * parent,
GtkFileChooserAction act,
const gchar * act_name )

create a GtkFileChooser, utility to select file(s)

Parameters
titlethe title of the window
parentthe parent window, if any
actthe action to perform (read or write)
act_namethe action name to display

Definition at line 2199 of file gtk-misc.c.

◆ create_hbox()

GtkWidget * create_hbox ( int spacing)

create a GtkBox with horizontal orientation

Parameters
spacingspacing between elements

Definition at line 793 of file gtk-misc.c.

◆ create_hscale()

GtkWidget * create_hscale ( float min,
float max,
float delta,
float val,
int pos,
int round,
int size,
GCallback handler,
GCallback scroll_handler,
gpointer data )

create an horizontal scale GtkWidget

Parameters
minMin value for the h scale
maxMax value for the h scale
deltathe step on the h scale
valthe value to position to set on the h scale
posthe location where the value is on display
roundthe rounding digit for the value on display
sizethe x size of the GtkWdiget
handlerthe callback to move the h scale
scroll_handlerthe callback on mouse scroll
datathe associated data pointer

Definition at line 724 of file gtk-misc.c.

◆ create_image_from_data()

GtkWidget * create_image_from_data ( int format,
gpointer item_image )

create Gtk image for data

Parameters
formatImage format
item_imagethe data to create the image

Definition at line 1423 of file gtk-misc.c.

◆ create_layout()

GtkWidget * create_layout ( int x,
int y )

create a GtkLayout / GtkFixed widget

Parameters
xthe x size of the widget
ythe y size of the widget

Definition at line 860 of file gtk-misc.c.

◆ create_scroll()

GtkWidget * create_scroll ( GtkWidget * box,
int dimx,
int dimy,
int shadow )

create a scroll window

Parameters
boxthe box to insert the scroll window in, if any
dimxthe x size of the widget
dimythe x size of the widget
shadowAdd shadow (1/0)

Definition at line 1940 of file gtk-misc.c.

◆ create_text_view()

GtkWidget * create_text_view ( int dimx,
int dimy,
int edit,
int mono,
GCallback handler,
gpointer data,
gchar * text )

create a GtkTextView and display some text

Parameters
dimxthe x size of the GtkTextView
dimythe y size of the GtkTextView
editIs the text view editable (1/0)
monoUse monospace font (1/0)
handlerthe callback on buffer changed
datathe associated data pointer
textthe text to display

Definition at line 1179 of file gtk-misc.c.

◆ create_vbox()

GtkWidget * create_vbox ( int spacing)

create a GtkBox with vertical orientation

Parameters
spacingspacing between elements

Definition at line 781 of file gtk-misc.c.

◆ create_vscale()

GtkWidget * create_vscale ( float min,
float max,
float delta,
float val,
int pos,
int round,
int size,
GCallback handler,
GCallback scroll_handler,
gpointer data )

create an vertical scale GtkWidget

Parameters
minMin value for the v scale
maxMax value for the v scale
deltathe step on the v scale
valthe value to position to set on the h scale
posthe location where the value is on display
roundthe rounding digit for the value on display
sizethe x size of the GtkWdiget
handlerthe callback to move the v scale
scroll_handlerthe callback on mouse scroll
datathe associated data pointer

Definition at line 758 of file gtk-misc.c.

◆ create_win()

GtkWidget * create_win ( gchar * str,
GtkWidget * parent,
gboolean modal,
gboolean resiz )

create a new GtkWindow

Parameters
strTitle
parentParent GtkWidget (if any)
modalModal (TRUE/FALSE)
resizCan be re-sized (TRUE/FALSE)

Definition at line 425 of file gtk-misc.c.

◆ destroy_this_dialog()

void destroy_this_dialog ( GtkDialog * dialog)

destroy a GtkDialog

Parameters
dialogthe GtkDialog to destroy

Definition at line 2041 of file gtk-misc.c.

◆ destroy_this_native_dialog()

void destroy_this_native_dialog ( GtkNativeDialog * dialog)

destroy a GtkNativeDialog

Parameters
dialogthe GtkNativeDialog to destroy

Definition at line 2060 of file gtk-misc.c.

◆ destroy_this_widget()

GtkWidget * destroy_this_widget ( GtkWidget * widg)

destroy a GtkWidget

Parameters
widgthe GtkWidget to destroy

Definition at line 2010 of file gtk-misc.c.

◆ destroy_this_window()

G_MODULE_EXPORT gboolean destroy_this_window ( GtkWidget * win,
GdkEvent * event,
gpointer data )

destroy a GtkWindow

Parameters
winthe GtkWindow to destroy
eventthe GdkEvent triggering the signal
datathe associated data pointer

Definition at line 2320 of file gtk-misc.c.

◆ dialog_cancel_apply()

GtkWidget * dialog_cancel_apply ( gchar * title,
GtkWidget * parent,
gboolean resiz )

create a dialog modal offering a choice to apply something or not

Parameters
titlethe message
parentthe parent window, if any
resizIs the new window re-sizable ?

Definition at line 541 of file gtk-misc.c.

◆ dialog_get_content_area()

GtkWidget * dialog_get_content_area ( GtkWidget * widg)

prepare GtkWidget to insert content in a GtkDialog window

Parameters
widgthe GtkDialog window

Definition at line 805 of file gtk-misc.c.

◆ dialogmodal()

GtkWidget * dialogmodal ( gchar * str,
GtkWindow * parent )

Create a new dialog modal window.

Parameters
strTitle
parentParent GtkWindow, if any

Definition at line 490 of file gtk-misc.c.

◆ duplicate_color()

ColRGBA * duplicate_color ( int num,
ColRGBA * col )

duplicate a ColRGBA pointer

Parameters
numSize of the pointer
colColRGBA pointer to duplicate

Definition at line 1582 of file gtk-misc.c.

◆ entry_get_text()

const gchar * entry_get_text ( GtkEntry * entry)

get the text in a GtkEntry

Parameters
entrythe GtkEntry

Definition at line 577 of file gtk-misc.c.

◆ fbox()

GtkWidget * fbox ( GtkWidget * box,
char * lab )

Definition at line 1921 of file gtk-misc.c.

◆ file_chooser_get_current_folder()

gchar * file_chooser_get_current_folder ( GtkFileChooser * chooser)

get the current folder for a GtkFileChooser

Parameters
chooserthe GtkFilechooser

Definition at line 2128 of file gtk-misc.c.

◆ file_chooser_get_file_name()

gchar * file_chooser_get_file_name ( GtkFileChooser * chooser)

get a file name from a GtkFileChooser (single file selected)

Parameters
chooserthe GtkFilechooser

Definition at line 2112 of file gtk-misc.c.

◆ file_chooser_get_file_names()

GSList * file_chooser_get_file_names ( GtkFileChooser * chooser)

create a file list from files selected using a GtkFileChooser

Definition at line 2099 of file gtk-misc.c.

◆ file_chooser_set_current_folder()

void file_chooser_set_current_folder ( GtkFileChooser * chooser)

set current folder in a GtkFilechooser

Parameters
chooserthe GtkFilechooser

Definition at line 2164 of file gtk-misc.c.

◆ file_chooser_set_file_name()

gboolean file_chooser_set_file_name ( GtkFileChooser * chooser,
gchar * filename )

set file name in a GtkFilechooser

Parameters
chooserthe GtkFilechooser
filenamethe file name to appear in the GtkFilechooser

Definition at line 2145 of file gtk-misc.c.

◆ font_button()

GtkWidget * font_button ( gchar * font,
int dimx,
int dimy,
GCallback handler,
gpointer data )

create a font selection button

Parameters
fontthe font to use
dimxSize x of the button
dimySize y of the button
handlerthe callback for the button
datathe associated data pointer

Definition at line 1730 of file gtk-misc.c.

◆ gdkrgba_to_rgba()

ColRGBA gdkrgba_to_rgba ( GdkRGBA colgdk)

convert GdkRGBA color to ColRGBA color

Parameters
colgdkthe GdkRGBA to convert

Definition at line 1597 of file gtk-misc.c.

◆ get_button_color()

ColRGBA get_button_color ( GtkColorChooser * colob)

get the ColRGBA color from a GtkColorChooser button

Parameters
colobthe GtkColorChooser button

Definition at line 2212 of file gtk-misc.c.

◆ get_top_level()

GtkWidget * get_top_level ( GtkWidget * widg)

get the top level container, window, of a widget

Parameters
widgthe GtkWidget

Definition at line 2291 of file gtk-misc.c.

◆ get_window_color()

ColRGBA get_window_color ( GtkWidget * color_win)

get the ColRGBA color from a color selection window

Parameters
color_winthe color selection window

Definition at line 2226 of file gtk-misc.c.

◆ gtk_label_align()

void gtk_label_align ( GtkWidget * lab,
float ax,
float ay )

set text alignment in a GtkLabel

Parameters
labthe GtkLabel
axthe x alignment
aythe Y alignment

Definition at line 681 of file gtk-misc.c.

◆ hide_this_window()

G_MODULE_EXPORT gboolean hide_this_window ( GtkWidget * win,
GdkEvent * event,
gpointer data )

hide a GtkWindow

Parameters
winthe GtkWindow to hide
eventthe GdkEvent triggering the signal
datathe associated data pointer

Definition at line 2347 of file gtk-misc.c.

◆ is_the_widget_visible()

gboolean is_the_widget_visible ( GtkWidget * widg)

test if a GtkWidget exist, then return if it is visible or not

Parameters
widgthe GtkWidget

Definition at line 694 of file gtk-misc.c.

◆ layout_add_widget()

void layout_add_widget ( GtkWidget * layout,
GtkWidget * child,
int x_pos,
int y_pos )

Add a GtkWidget in a GtkLayout.

Parameters
layoutthe GtkLayout
childthe GtkWidget to insert
x_posthe x position to insert at
y_posthe y position to insert at

Definition at line 826 of file gtk-misc.c.

◆ markup_label()

GtkWidget * markup_label ( gchar * text,
int dimx,
int dimy,
float ax,
float ay )

Definition at line 1565 of file gtk-misc.c.

◆ message_dialogmodal()

GtkWidget * message_dialogmodal ( gchar * message,
gchar * title,
GtkMessageType mtype,
GtkButtonsType buttons,
GtkWidget * parent )

create a modal (cannot be ignored) message window

Parameters
messagethe message
titlethe title
mtypethe message type
buttonsthe type of closing button to add
parentthe parent window, if any

Definition at line 511 of file gtk-misc.c.

◆ new_gtk_window()

GtkWidget * new_gtk_window ( )

create a new GtkWindow

Definition at line 328 of file gtk-misc.c.

◆ pop_menu_at_pointer()

void pop_menu_at_pointer ( GtkWidget * widg,
GdkEvent * event )

popup a menu at pointer location

Parameters
widgthe menu to popup
eventthe GdkEvent triggering the signal

Definition at line 2277 of file gtk-misc.c.

◆ provide_gtk_css()

void provide_gtk_css ( gchar * css)

create a css provider based on the css data

Parameters
cssthe css data, use the name of the variable to use the css

Definition at line 1986 of file gtk-misc.c.

◆ radio_button()

GtkWidget * radio_button ( gchar * text,
int dimx,
int dimy,
gboolean state,
GCallback handler,
gpointer data )

create a radio button

Parameters
textthe message to display
dimxthe x size
dimythe y size
stateChecked or not (1/0)
handlerthe callback for the button
datathe associated data pointer

Definition at line 1814 of file gtk-misc.c.

◆ resize_this_window()

void resize_this_window ( GtkWidget * window,
int x,
int y )

resize this GtkWindow

Parameters
windowthe GtkWidget to resize
xthe x size
ythe y size

Definition at line 561 of file gtk-misc.c.

◆ run_destroy_dialog()

G_MODULE_EXPORT void run_destroy_dialog ( GtkDialog * dialog,
gint response_id,
gpointer data )

to destroy a GtkDialog when the dialog emit the closing signal

Parameters
dialogthe GtkDialog to destroy
response_idthe response id
datathe associated data pointer

Definition at line 2078 of file gtk-misc.c.

◆ run_this_gtk_dialog()

void run_this_gtk_dialog ( GtkWidget * dial,
GCallback handler,
gpointer data )

run a GTK (3 and 4) basic GtkDialog

Parameters
dialthe GtkDialog
handlerthe callback
datathe associated data pointer

Definition at line 472 of file gtk-misc.c.

◆ set_color_chooser_color()

void set_color_chooser_color ( GtkWidget * color_win,
ColRGBA col )

set the color of a color selection window

Parameters
color_winthe color selection window
colthe color to use

Definition at line 2241 of file gtk-misc.c.

◆ set_image_from_icon_name()

void set_image_from_icon_name ( GtkWidget * widg,
gchar * icon )

set a image from a stock icon name

Parameters
widgthe GtkImage to modify
iconthe name of the stock icon

Definition at line 1874 of file gtk-misc.c.

◆ set_renderer_color()

void set_renderer_color ( int tocol,
GtkCellRenderer * renderer,
ColRGBA col )

set the color of a GtkCellRenderer

Parameters
tocolApply color (1/0)
rendererthe GtkCellRenderer
colthe color to apply

Definition at line 1633 of file gtk-misc.c.

◆ setup_text_tags()

void setup_text_tags ( GtkTextBuffer * buffer)

prepare the avialable text tags for the GtkTextBuffer

Parameters
bufferthe GtkTextBuffer

Definition at line 915 of file gtk-misc.c.

◆ show_the_widgets()

void show_the_widgets ( GtkWidget * widg)

show GtkWidget

Parameters
widgthe GtkWidget to show

Definition at line 169 of file gtk-misc.c.

◆ spin_button()

GtkWidget * spin_button ( GCallback handler,
double value,
double start,
double end,
double step,
int digits,
int dim,
gpointer data )

create a spin button

Parameters
handlerthe callback for the button
valueInitial value for the spin button
startMinimum value
endMaximum value
stepStep between values
digitsNumber of digits displayed
dimSize x of the button
datathe associated data pointer

Definition at line 1752 of file gtk-misc.c.

◆ stock_image()

GtkWidget * stock_image ( const gchar * stock_id)

create a GtkImage for the Gtk database

Parameters
stock_id

Definition at line 1344 of file gtk-misc.c.

◆ text_view_set_monospace()

void text_view_set_monospace ( GtkWidget * view)

set the font of a GtkTextView as monospace

Parameters
viewthe GtkTextView

Definition at line 667 of file gtk-misc.c.

◆ to_activate_entry()

G_MODULE_EXPORT void to_activate_entry ( GtkEventControllerFocus * focus,
gpointer data )

GtkEntry activate signal managment.

Parameters
focusFocus event controller
datathe associated data pointer

Definition at line 1277 of file gtk-misc.c.

◆ update_entry_double()

void update_entry_double ( GtkEntry * entry,
double doubleval )

update the content of a GtkEntry as double

Parameters
entrythe GtkEntry
doublevalthe new double value to display

Definition at line 613 of file gtk-misc.c.

◆ update_entry_int()

void update_entry_int ( GtkEntry * entry,
int intval )

update the content of a GtkEntry as int

Parameters
entrythe GtkEntry
intvalthe new int value to display

Definition at line 594 of file gtk-misc.c.

◆ update_entry_long_double()

void update_entry_long_double ( GtkEntry * entry,
double doubleval )

update the content of a GtkEntry as long double

Parameters
entrythe GtkEntry
doublevalthe new long double value to display

Definition at line 632 of file gtk-misc.c.

◆ update_entry_text()

void update_entry_text ( GtkEntry * entry,
gchar * text )

update the content of a GtkEntry as string

Parameters
entrythe GtkEntry
textthe new string to display

Definition at line 651 of file gtk-misc.c.

◆ widget_set_sensitive()

void widget_set_sensitive ( GtkWidget * widg,
gboolean sensitive )

Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.

Parameters
widgthe GtkWidget
sensitiveSensitivity

Definition at line 186 of file gtk-misc.c.