1
/* GTK - The GIMP Toolkit
2
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free
16
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
21
* file for a list of people on the GTK+ Team. See the ChangeLog
22
* files for a list of changes. These files are distributed with
23
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
29
combo_changed_cb (GtkWidget *combo,
32
GtkWidget *label = GTK_WIDGET (data);
35
active = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
37
gtk_label_set_ellipsize (GTK_LABEL (label), (PangoEllipsizeMode)active);
41
main (int argc, char *argv[])
43
GtkWidget *window, *vbox, *hbox, *label, *combo;
45
gtk_init (&argc, &argv);
47
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
48
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
49
vbox = gtk_vbox_new (0, FALSE);
50
gtk_container_add (GTK_CONTAINER (window), vbox);
51
hbox = gtk_hbox_new (0, FALSE);
52
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
53
label = gtk_label_new ("This label may be ellipsized\nto make it fit.");
54
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
55
combo = gtk_combo_box_new_text ();
56
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "NONE");
57
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "START");
58
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "MIDDLE");
59
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "END");
60
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
61
gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
62
g_signal_connect (combo, "changed", G_CALLBACK (combo_changed_cb), label);
64
gtk_widget_show_all (window);