button resize
- From: Michal Tomcanyi <michal tomcanyi matfyz cz>
- To: gtk-app-devel-list gnome org
- Subject: button resize
- Date: Fri, 1 Aug 2003 20:49:15 +0200
Hello all,
I have a button with packed image in it and want to resize image when
the button is resized. The problem is I don't know which signal/event to
catch.
I tried a simple example, where button is packed directly in a toplevel
window and being resized together with the window. When I attached
"configure-event" callback, it was never called. ( The event mask was
set to GDK_ALL_EVENTS_MASK for window as well as for the button).
Signals "size-allocate" and "size-request" are called together with
"clicked" signal, which I don't want.
Is there any clean solution for this? Thank you for any ideas
Michal
------- The code ----------
include <gtk/gtk.h>
gboolean button_catch(GtkButton *button, GdkEventConfigure *e,
gpointer data) {
if (data)
g_print("Caught: %s\n",(gchar *)data);
else g_print("Caught\n");
return(FALSE); /* call default handlers */
}
int main(int argc, char *argv[]) {
GtkWidget *window, *button;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_add_events(window,GDK_ALL_EVENTS_MASK);
g_signal_connect(G_OBJECT(window), "destroy",
G_CALLBACK(gtk_main_quit), NULL);
gtk_window_set_default_size(GTK_WINDOW(window), 300, 300);
button = gtk_button_new();
gtk_widget_add_events(button,GDK_ALL_EVENTS_MASK);
g_signal_connect(G_OBJECT(button),"configure-event",
G_CALLBACK(button_catch),"configure-event");
gtk_container_add(GTK_CONTAINER(window),button);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]