diff options
author | RSDuck <RSDuck@users.noreply.github.com> | 2020-05-12 16:07:28 +0200 |
---|---|---|
committer | RSDuck <rsduck@users.noreply.github.com> | 2020-06-16 12:06:42 +0200 |
commit | e7d076403df7afd6dc8304196211b49e3ed7f464 (patch) | |
tree | 1d5ff1e743839f271de77f8bd312c985033c6a89 /src/libui_sdl/libui/unix/fontbutton.c | |
parent | 4cff4b52286a7d1a7e40817d52a5d271a937ddc2 (diff) | |
parent | c17f7b100e36edb1c728dbf21c77f9484d1820c6 (diff) |
Merge branch 'generic_jit' of https://github.com/Arisotura/melonDS into generic_jit
Diffstat (limited to 'src/libui_sdl/libui/unix/fontbutton.c')
-rw-r--r-- | src/libui_sdl/libui/unix/fontbutton.c | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/src/libui_sdl/libui/unix/fontbutton.c b/src/libui_sdl/libui/unix/fontbutton.c deleted file mode 100644 index f8047e0..0000000 --- a/src/libui_sdl/libui/unix/fontbutton.c +++ /dev/null @@ -1,70 +0,0 @@ -// 14 april 2016 -#include "uipriv_unix.h" - -struct uiFontButton { - uiUnixControl c; - GtkWidget *widget; - GtkButton *button; - GtkFontButton *fb; - GtkFontChooser *fc; - void (*onChanged)(uiFontButton *, void *); - void *onChangedData; -}; - -uiUnixControlAllDefaults(uiFontButton) - -// TODO NOTE no need to inhibit the signal; font-set is documented as only being sent when the user changes the font -static void onFontSet(GtkFontButton *button, gpointer data) -{ - uiFontButton *b = uiFontButton(data); - - (*(b->onChanged))(b, b->onChangedData); -} - -static void defaultOnChanged(uiFontButton *b, void *data) -{ - // do nothing -} - -uiDrawTextFont *uiFontButtonFont(uiFontButton *b) -{ - PangoFont *f; - PangoFontDescription *desc; - - desc = gtk_font_chooser_get_font_desc(b->fc); - f = pangoDescToPangoFont(desc); - // desc is transfer-full and thus is a copy - pango_font_description_free(desc); - return mkTextFont(f, FALSE); // we hold the initial reference; no need to ref -} - -void uiFontButtonOnChanged(uiFontButton *b, void (*f)(uiFontButton *, void *), void *data) -{ - b->onChanged = f; - b->onChangedData = data; -} - -uiFontButton *uiNewFontButton(void) -{ - uiFontButton *b; - - uiUnixNewControl(uiFontButton, b); - - b->widget = gtk_font_button_new(); - b->button = GTK_BUTTON(b->widget); - b->fb = GTK_FONT_BUTTON(b->widget); - b->fc = GTK_FONT_CHOOSER(b->widget); - - // match behavior on other platforms - gtk_font_button_set_show_style(b->fb, TRUE); - gtk_font_button_set_show_size(b->fb, TRUE); - gtk_font_button_set_use_font(b->fb, FALSE); - gtk_font_button_set_use_size(b->fb, FALSE); - // other customizations - gtk_font_chooser_set_show_preview_entry(b->fc, TRUE); - - g_signal_connect(b->widget, "font-set", G_CALLBACK(onFontSet), b); - uiFontButtonOnChanged(b, defaultOnChanged, NULL); - - return b; -} |