GTK + mouse enters left button signal

Source: Internet
Author: User
Tags gtk
<span style= "FONT-SIZE:18PX;" > #include <stdio.h> #include <gtk/gtk.h> void Enter_button (Gtkwidget *widget, gpointer data) {G_print ("
Enter button\n ");
	} void Leave_button (Gtkwidget *widget, gpointer data) {G_print ("Leave button\n");} int main (int argc, char* argv[]) {
	Gtkwidget *window;
	Gtkwidget *fixed;

	Gtkwidget *button;

	Gtk_init (&AMP;ARGC, &AMP;ARGV);
	window = Gtk_window_new (gtk_window_toplevel);
	Gtk_window_set_position (Gtk_window (window), gtk_win_pos_center);
	Gtk_window_set_default_size (Gtk_window (window), 250,200);

	Gtk_window_set_title (Gtk_window (window), "gtkfixed");
	Fixed = Gtk_fixed_new ();

	Gtk_container_add (Gtk_container (window), fixed);
	button = Gtk_button_new_with_label ("button");
	Gtk_fixed_put (gtk_fixed (fixed), button, 150, 50);
	
	Gtk_widget_set_size_request (Button, 80, 35);
	g_signal_connect_swapped (Gtk_window (window), "Destroy", G_callback (Gtk_main_quit), NULL); G_signal_connect (Gtk_button (Button), "Enter", G_callback (Enter_button), NULL);
	G_signal_connect (Gtk_button (Button), "Leave", G_callback (Leave_button), NULL);
	Gtk_widget_show_all (window);
	Gtk_main ();
return 0; } </span>

Online people ask: button on the toolbar this method can not be used

People on the Internet answered:

You can put the button in the Gtkeventbox, and then put the Eventbox into toolbar, so that Eventbox motion-notify-event can be processed.

Mouse move-in and move-out handler functions
Static Gboolean Banner_image_motion_notify_handler (gtkwidget *widget,gdkeventmotion *event,gpointer data)
{
Mouse Move in
if (Event->type = = gdk_enter_notify) {//Enter the thumbnail, you will cancel the autohide temporary thread
Banner_cancel_autohide ();
Mouse out control
} else if (Event->type = = gdk_leave_notify) {//need to re-open autohide thread
Banner_autohide_tip_window ();
}

Return false;//no need to process anymore.
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.