Gtkcharselection - character selection dialog for gtk+
GtkType |
gtk_char_selection_get_type |
(void); |
GtkWidget* |
gtk_char_selection_new |
(void); |
void |
gtk_char_selection_set_selection |
(GtkCharSelection *charsel, |
gint |
gtk_char_selection_get_selection |
(GtkCharSelection *charsel); |
|
|
No signals |
Description
Char selection is a widget
which contains all the characters in a font.
Connecting a callback to the ok button of the widget you get the selected
char.
Screenshot
Details
struct _GtkCharSelection { GtkWindow window; GtkFontCombo *font_combo; GtkTable *table; GtkToggleButton *button[256]; gint selection; GtkWidget *ok_button; GtkWidget *cancel_button; GtkWidget *action_area; }; |
GtkWidget* gtk_char_selection_new (void); |
Create a new char selection widget
Returns : | a new char selection widget |
void gtk_char_selection_set_selection (GtkCharSelection *charsel, gint selection); |
Set selection (choose a character from the list).
0 is left,upper corner;
256 is right, down corner.
charsel | char selection widget |
selection | the selection number >256 => ignore |
gint gtk_char_selection_get_selection (GtkCharSelection *charsel); |
Get the current selection.
charsel | |
Returns |
#include <gtk/gtk.h> #include <gdk/gdk.h> #include <glib.h> #include "gtkcharsel.h" GtkWidget *charsel; void quit () { gtk_main_quit(); } void ok_clicked(GtkWidget *widget, gpointer data) { GtkCharSelection *charsel; charsel = GTK_CHAR_SELECTION(data); g_print("%d\n",charsel->selection); } int main(int argc, char *argv[]) { gtk_init(&argc, &argv); charsel=gtk_char_selection_new(); gtk_signal_connect (GTK_OBJECT (charsel), "destroy", GTK_SIGNAL_FUNC (quit), NULL); /* gtk_signal_connect (GTK_OBJECT (GTK_CHAR_SELECTION(charsel)->ok_button), "clicked", GTK_SIGNAL_FUNC (ok_clicked), charsel); */ /* gtk_char_selection_set_selection(GTK_CHAR_SELECTION(charsel), 25); */ gtk_widget_show(charsel); gtk_main(); return(0); } |