mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
b3d5f148e6
* examples/*/Makefile (CFLAGS): add deprecation guards. * docs/tutorial/gtk-tut.sgml, examples/*/*.c: make most examples deprecation-clean; the major offenders right now are the examples that make heavy use of completely deprecated or broken widgets: list, tree, text, pixmap, paned and progressbar. These will have to be redone from scratch. * demos/Makefile.am (INCLUDES): add -DGDK_PIXBUF_DISABLE_DEPRECATED.
54 lines
1.4 KiB
C
54 lines
1.4 KiB
C
|
|
#include <stdlib.h>
|
|
#include <gtk/gtk.h>
|
|
|
|
int main( int argc,
|
|
char *argv[] )
|
|
{
|
|
GtkWidget *window;
|
|
GtkWidget *event_box;
|
|
GtkWidget *label;
|
|
|
|
gtk_init (&argc, &argv);
|
|
|
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
gtk_window_set_title (GTK_WINDOW (window), "Event Box");
|
|
|
|
g_signal_connect (GTK_OBJECT (window), "destroy",
|
|
GTK_SIGNAL_FUNC (exit), NULL);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
|
|
|
/* Create an EventBox and add it to our toplevel window */
|
|
|
|
event_box = gtk_event_box_new ();
|
|
gtk_container_add (GTK_CONTAINER(window), event_box);
|
|
gtk_widget_show (event_box);
|
|
|
|
/* Create a long label */
|
|
|
|
label = gtk_label_new ("Click here to quit, quit, quit, quit, quit");
|
|
gtk_container_add (GTK_CONTAINER (event_box), label);
|
|
gtk_widget_show (label);
|
|
|
|
/* Clip it short. */
|
|
gtk_widget_set_size_request (label, 110, 20);
|
|
|
|
/* And bind an action to it */
|
|
gtk_widget_set_events (event_box, GDK_BUTTON_PRESS_MASK);
|
|
g_signal_connect (GTK_OBJECT(event_box), "button_press_event",
|
|
GTK_SIGNAL_FUNC (exit), NULL);
|
|
|
|
/* Yet one more thing you need an X window for ... */
|
|
|
|
gtk_widget_realize (event_box);
|
|
gdk_window_set_cursor (event_box->window, gdk_cursor_new (GDK_HAND1));
|
|
|
|
gtk_widget_show (window);
|
|
|
|
gtk_main ();
|
|
|
|
return 0;
|
|
}
|