Re: swap images on click event.
- From: Yury Aliaev <mutab0r rambler ru>
- To: gtk-app-devel-list gnome org
- Subject: Re: swap images on click event.
- Date: Mon, 05 Dec 2005 11:36:49 +0300
Craig Harding scripsit:
Ok, how can I show/hide the images? This is a breakdown of the code I'm
working on:
--------------
play_button = gtk_image_new_from_file ("/usr/local/pixmaps/play.png");
pause_button = gtk_image_new_from_file("/usr/local/pixmaps/pause3.png");
hbox = gtk_hbox_new(FALSE,0);
play_event_box = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (play_event_box), play_button);
gtk_container_add (GTK_CONTAINER (play_event_box), pause_button);
gtk_box_pack_start(hbox, play_event_box, FALSE, FALSE, 2);
gtk_container_add (GTK_CONTAINER (applet), hbox);
gtk_widget_show_all (GTK_WIDGET (applet));
/* This should be added here otherwise all images will be shown
simultaneously. */
gtk_widget_hide (pause_button); // or play_button
g_signal_connect (G_OBJECT (play_event_box), "button_release_event",
G_CALLBACK (on_play_button_press), pause_button);
g_signal_connect (G_OBJECT (play_event_box), "button_release_event",
G_CALLBACK (on_play_button_press), play_button);
static gboolean on_play_button_press (GtkWidget
*event_box,GdkEventButton *event,gpointer data) {
// do show/hide stuff here....? how do I do it?
Just use gtk_widget_hide()/gtk_widget_show() functions with appropriate
arguments.
}
Regards,
Yury.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]