Exemple #1
0
/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_font_selection_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
  gchar *preview_text;

  preview_text = gb_widget_input_string (data, PreviewText);
  if (data->apply)
    gtk_font_selection_set_preview_text (GTK_FONT_SELECTION (widget),
					 preview_text);
}
Exemple #2
0
GtkWidget *
font_create_widget (GtkWidget * dlg)
{
  GtkWidget *w;

  w = font = gtk_font_selection_new ();
  gtk_widget_set_name (w, "yad-font-widget");

  if (options.font_data.preview)
    gtk_font_selection_set_preview_text (GTK_FONT_SELECTION (w), options.font_data.preview);

  /* font must be set after widget inserted in toplevel */
  if (options.common_data.font)
    g_signal_connect_after (G_OBJECT (w), "realize", G_CALLBACK (realize_cb), NULL);

  return w;
}
Exemple #3
0
/* Sets the text displayed in the preview area. */
int
clip_GTK_FONTSELECTIONSETPREVIEWTEXT(ClipMachine * ClipMachineMemory)
{
   C_widget *cfsel = _fetch_cw_arg(ClipMachineMemory);

   gchar    *preview_text = _clip_parc(ClipMachineMemory, 2);

   CHECKCWID(cfsel, GTK_IS_FONT_SELECTION);
   CHECKOPT(2, CHARACTER_type_of_ClipVarType);
   if (_clip_parinfo(ClipMachineMemory, 2) == UNDEF_type_of_ClipVarType)
      preview_text = "\0";
   LOCALE_TO_UTF(preview_text);
   gtk_font_selection_set_preview_text(GTK_FONT_SELECTION(cfsel->widget), preview_text);
   FREE_TEXT(preview_text);
   return 0;
 err:
   return 1;
}
Exemple #4
0
int
main (int argc, char *argv[])
{
  GtkWidget *window;
  GtkWidget *hbox;
  GtkWidget *fontsel;
  
  gtk_init (NULL, NULL);
    
  fontsel = gtk_font_selection_new ();

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_size_request (window, 600, 600);
  hbox = gtk_hbox_new (FALSE, 6);
  gtk_container_add (GTK_CONTAINER (window), hbox);

#ifndef GTK_DISABLE_DEPRECATED
  g_object_ref (gtk_font_selection_get_size_list (GTK_FONT_SELECTION (fontsel)));
  g_object_ref (gtk_font_selection_get_family_list (GTK_FONT_SELECTION (fontsel)));
  g_object_ref (gtk_font_selection_get_face_list (GTK_FONT_SELECTION (fontsel)));

  gtk_container_add (GTK_CONTAINER (hbox), gtk_font_selection_get_size_list (GTK_FONT_SELECTION (fontsel)));
  gtk_container_add (GTK_CONTAINER (hbox), gtk_font_selection_get_family_list (GTK_FONT_SELECTION (fontsel)));
  gtk_container_add (GTK_CONTAINER (hbox), gtk_font_selection_get_face_list (GTK_FONT_SELECTION (fontsel)));
#endif 

  gtk_container_add (GTK_CONTAINER (hbox), fontsel);

  gtk_widget_show_all (window);

  g_signal_connect (G_OBJECT (window), "delete-event",          G_CALLBACK(gtk_main_quit), NULL);
  g_signal_connect (G_OBJECT (fontsel), "notify::font-name",    G_CALLBACK(notify_font_name_cb), NULL);
  g_signal_connect (G_OBJECT (fontsel), "notify::preview-text", G_CALLBACK(notify_preview_text_cb), NULL);

  gtk_font_selection_set_font_name (GTK_FONT_SELECTION (fontsel), "Bitstream Vera Sans 45");
  gtk_font_selection_set_preview_text (GTK_FONT_SELECTION (fontsel), "[user@host ~]$ ");

  gtk_main ();

  gtk_widget_destroy (window);

  return 0;
}