Re: Font selection panel as part of notebook
- From: cecashon aol com
- To: ikorot01 gmail com
- Cc: gtk-list gnome org
- Subject: Re: Font selection panel as part of notebook
- Date: Sun, 24 Sep 2017 19:17:49 -0400
Igor,
It sounds like you are determined to hack at this. I would recommend the newer GtkFontChooserWidget but OK. The PangoFcFamily* isn't much help. You need to get your widget pointers and setup up callbacks on your treeviews. Maybe all you need is to connect a "row-activated" to know if the user clicked on a row. To do this you need to find your pointers. If you use gtk_container_forall() you can find them. When doing this you are breaking the design of the font selection widget. It is poor practice. It might be just what you need though.
Eric
/*
gcc -Wall font_selection2.c -o font_selection2 `pkg-config --cflags --libs gtk+-2.0`
gcc -Wall font_selection2.c -o font_selection2 `pkg-config --cflags --libs gtk+-3.0`
Tested with GTK3.18 on Ubuntu16.04
*/
#include<gtk/gtk.h>
static void find_widgets(GtkWidget* widget, gint *count)
{
const char *name = gtk_widget_get_name(widget);
printf("% *d. %s\n", (*count)*2, *count, name);
//Recursive call for each container widget in the file chooser dialog.
if(GTK_IS_CONTAINER(widget))
{
(*count)++;
gtk_container_foreach(GTK_CONTAINER(widget), (GtkCallback)find_widgets, count);
(*count)--;
}
}
int main(int argc, char *argv[])
{
gtk_init (&argc, &argv);
GtkWidget *window=gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "Font Selecton");
gtk_window_set_default_size(GTK_WINDOW(window), 400, 400);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GtkWidget *m_fontPanel=gtk_font_selection_new();
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_container_add(GTK_CONTAINER(window), m_fontPanel);
gtk_widget_show_all(window);
gint count=0;
gtk_container_forall(GTK_CONTAINER(m_fontPanel), (GtkCallback)find_widgets, &count);
gtk_main();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]