コード例 #1
0
        private void HandleTagImageButtonPressEvent(object sender, Gtk.ButtonPressEventArgs args)
        {
            double x = args.Event.X;
            double y = args.Event.Y;

            // translate the centered image to top left corner
            double tag_image_center_x = tag_image_width / 2;
            double tag_image_center_y = tag_image_height / 2;

            double allocation_center_x = tag_image_eventbox.Allocation.Width / 2;
            double allocation_center_y = tag_image_eventbox.Allocation.Height / 2;

            double dx = allocation_center_x - tag_image_center_x;
            double dy = allocation_center_y - tag_image_center_y;

            if (dx < 0)
            {
                dx = 0;
            }
            if (dy < 0)
            {
                dy = 0;
            }

            x -= dx;
            y -= dy;

            // bail if we're in the eventbox but not the image
            if (x < 0 || x > tag_image_width)
            {
                return;
            }
            if (y < 0 || y > tag_image_height)
            {
                return;
            }

            FacebookTagPopup popup = new FacebookTagPopup(friends);
        }
コード例 #2
0
		private void HandleTagImageButtonPressEvent (object sender, Gtk.ButtonPressEventArgs args)
		{
			double x = args.Event.X;
			double y = args.Event.Y;

			// translate the centered image to top left corner
			double tag_image_center_x = tag_image_width / 2;
			double tag_image_center_y = tag_image_height / 2;

			double allocation_center_x = tag_image_eventbox.Allocation.Width / 2;
			double allocation_center_y = tag_image_eventbox.Allocation.Height / 2;

			double dx = allocation_center_x - tag_image_center_x;
			double dy = allocation_center_y - tag_image_center_y;

			if (dx < 0)
				dx = 0;
			if (dy < 0)
				dy = 0;

			x -= dx;
			y -= dy;

			// bail if we're in the eventbox but not the image
			if (x < 0 || x > tag_image_width)
				return;
			if (y < 0 || y > tag_image_height)
				return;

			FacebookTagPopup popup = new FacebookTagPopup (friends);
		}