mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
ccb1f08ef8
Thu Jul 22 01:05:16 2004 Matthias Clasen <maclas@gmx.de> * configure.in: Require Pango 1.5.1 (for ellipsisation). * gtk/gtklabel.h: * gtk/gtklabel.c (gtk_label_class_init): Add a new :ellipsise property which controls ellipsisation of the label. (#125250, Tim Van Wassenhove, patch by James M. Cape) * tests/testellipsise.c: Simple test for ellipsisation.
69 lines
2.3 KiB
C
69 lines
2.3 KiB
C
/* GTK - The GIMP Toolkit
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free
|
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*/
|
|
|
|
/*
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
* files for a list of changes. These files are distributed with
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
*/
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
static void
|
|
combo_changed_cb (GtkWidget *combo,
|
|
gpointer data)
|
|
{
|
|
GtkWidget *label = GTK_WIDGET (data);
|
|
gint active;
|
|
|
|
active = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
|
|
|
|
gtk_label_set_ellipsize (GTK_LABEL (label), (PangoEllipsizeMode)active);
|
|
}
|
|
|
|
int
|
|
main (int argc, char *argv[])
|
|
{
|
|
GtkWidget *window, *vbox, *hbox, *label, *combo;
|
|
|
|
gtk_init (&argc, &argv);
|
|
|
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
vbox = gtk_vbox_new (0, FALSE);
|
|
gtk_container_add (GTK_CONTAINER (window), vbox);
|
|
hbox = gtk_hbox_new (0, FALSE);
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
|
label = gtk_label_new ("This label may be ellipsized\nto make it fit.");
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
|
|
combo = gtk_combo_box_new_text ();
|
|
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "NONE");
|
|
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "START");
|
|
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "MIDDLE");
|
|
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "END");
|
|
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
|
|
gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
|
|
g_signal_connect (combo, "changed", G_CALLBACK (combo_changed_cb), label);
|
|
|
|
gtk_widget_show_all (window);
|
|
|
|
gtk_main ();
|
|
|
|
return 0;
|
|
}
|