about button and tooltip in GTK_WINDOW_POPUP
- From: "Cai Qiang" <caiqiang ustc edu>
- To: <gtk-app-devel-list gnome org>
- Subject: about button and tooltip in GTK_WINDOW_POPUP
- Date: Sun, 21 Aug 2005 11:41:49 +0800
Hi,
I encounter below problem when using a GTK_WINDOW_POPUP type gtk_window(see the attached code):
When I use GTK_WINDOW_TOPLEVEL,all work fine:when mouse on button, buuton will float; tooltip also will
display; But in GTK_WINDOW_POPUP case, they don't work.
Do I miss any setting procedure for POPUP type gtk_window? Or is there any method to let TOPLEVEL type
gtk_window not shown in toolbar?
Thanks a lot!
#include <gtk/gtk.h>
gint close_application( GtkWidget *widget, GdkEvent*event, gpointer data )
{
gtk_main_quit();
return(FALSE);
}
int test_main (int argc, char *argv[] )
{
GtkWidget *window, *win_tl;
gtk_init (&argc, &argv);
#if 0
window = gtk_window_new( GTK_WINDOW_POPUP );
#else
window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
#endif
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC (close_application), NULL);
gdk_window_withdraw (GDK_WINDOW(window));
gtk_widget_show (window);
gtk_widget_set_events( window, gtk_widget_get_events( window ) |
GDK_BUTTON_PRESS_MASK );
gtk_signal_connect( GTK_OBJECT(window), "button_press_event",
GTK_SIGNAL_FUNC(close_application), NULL );
GtkWidget *frame;
frame = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(frame),GTK_SHADOW_ETCHED_OUT);
#define FloatWindow window
gtk_container_add(GTK_CONTAINER(FloatWindow),frame);
GtkWidget *vbox;
vbox = gtk_vbox_new(false,0);
gtk_container_add(GTK_CONTAINER(frame),vbox);
GtkTooltips *tooltips;
tooltips = gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips,frame,"frame",NULL);
GtkWidget *button;
button= gtk_button_new();
gtk_container_add(GTK_CONTAINER(button),gtk_image_new_from_stock(GTK_STOCK_FIND,GTK_ICON_SIZE_MENU));
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
g_signal_connect(G_OBJECT(button),"clicked", G_CALLBACK( gtk_main_quit ),NULL);
gtk_tooltips_set_tip(tooltips,button,"Query in the main window",NULL);
gtk_box_pack_start(GTK_BOX(vbox),button,false,false,0);
button= gtk_button_new();
gtk_container_add(GTK_CONTAINER(button),gtk_image_new_from_stock(GTK_STOCK_QUIT,GTK_ICON_SIZE_MENU));
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
g_signal_connect(G_OBJECT(button),"clicked", G_CALLBACK( gtk_main_quit ),NULL);
gtk_tooltips_set_tip(tooltips,button,"Quit",NULL);
gtk_box_pack_start(GTK_BOX(vbox),button,false,false,0);
gtk_widget_show_all(frame);
gtk_main ();
return(0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]