示例#1
0
        private void ProxyEventToCell(Gdk.Event evnt, bool press)
        {
            IInteractiveCell icell;

            Gdk.Rectangle icell_area;
            bool          redraw = ProxyEventToCell(evnt, press, out icell, out icell_area);

            int xoffset = HadjustmentValue;
            int yoffset = VadjustmentValue;

            if (last_icell_area != icell_area)
            {
                if (last_icell != null && last_icell.PointerLeaveEvent())
                {
                    QueueDrawArea(last_icell_area.X - xoffset, last_icell_area.Y - yoffset,
                                  last_icell_area.Width, last_icell_area.Height);
                }
                last_icell      = icell;
                last_icell_area = icell_area;
            }

            if (redraw)
            {
                QueueDrawArea(icell_area.X - xoffset, icell_area.Y - yoffset,
                              icell_area.Width, icell_area.Height);
            }
        }
 void InvalidateLastIcell()
 {
     if (last_icell != null && last_icell.CursorLeaveEvent())
     {
         QueueDirtyRegion(last_icell_area);
         last_icell      = null;
         last_icell_area = Gdk.Rectangle.Zero;
     }
 }
        void ProxyEventToCell(Gdk.Event evnt, bool press)
        {
            IInteractiveCell icell;

            Gdk.Rectangle icell_area;
            bool          redraw = ProxyEventToCell(evnt, press, out icell, out icell_area);

            int xoffset = HadjustmentValue;
            int yoffset = VadjustmentValue;

            if (last_icell_area != icell_area)
            {
                if (last_icell != null && last_icell.CursorLeaveEvent())
                {
                    QueueDirtyRegion(new Gdk.Rectangle()
                    {
                        X      = last_icell_area.X - xoffset,
                        Y      = last_icell_area.Y - yoffset,
                        Width  = last_icell_area.Width,
                        Height = last_icell_area.Height
                    });
                }
                last_icell      = icell;
                last_icell_area = icell_area;
            }

            if (redraw)
            {
                QueueDirtyRegion(new Gdk.Rectangle()
                {
                    X      = icell_area.X - xoffset,
                    Y      = icell_area.Y - yoffset,
                    Width  = icell_area.Width,
                    Height = icell_area.Height
                });
            }
        }
        bool ProxyEventToCell(Gdk.Event evnt, bool press,
                              out IInteractiveCell icell, out Gdk.Rectangle icell_area)
        {
            icell_area = Gdk.Rectangle.Zero;

            int evnt_x, evnt_y;
            int x, y, row_index;

            x = y = 0;

            var evnt_button = evnt as Gdk.EventButton;
            var evnt_motion = evnt as Gdk.EventMotion;

            if (evnt_motion != null)
            {
                evnt_x = (int)evnt_motion.X;
                evnt_y = (int)evnt_motion.Y;
            }
            else if (evnt_button != null)
            {
                evnt_x = (int)evnt_button.X;
                evnt_y = (int)evnt_button.Y;
            }
            else
            {
                // Possibly EventCrossing, for the leave event
                icell = last_icell;
                return(false);
            }

            Column column;

            if (!GetEventCell(evnt_x, evnt_y, out icell, out column, out row_index))
            {
                return(false);
            }

            x = evnt_x - list_interaction_alloc.X;
            y = evnt_y - list_interaction_alloc.Y;

            // Turn the view-absolute coordinates into cell-relative coordinates
            var cached_column = GetCachedColumnForColumn(column);

            x -= cached_column.X1 - HadjustmentValue;
            int page_offset = VadjustmentValue % ChildSize.Height;

            y = (y + page_offset) % ChildSize.Height;

            var view_point = GetViewPointForModelRow(row_index);

            icell_area.Y      = (int)view_point.Y + list_interaction_alloc.Y + Allocation.Y;
            icell_area.X      = cached_column.X1 + list_rendering_alloc.X;
            icell_area.Width  = cached_column.Width;
            icell_area.Height = ChildSize.Height;

            // Send the cell a synthesized input event
            if (evnt_motion != null)
            {
                return(icell.CursorMotionEvent(new Point(x, y)));
            }
            else
            {
                return(icell.ButtonEvent(new Point(x, y), press, evnt_button.Button));
            }
        }
示例#5
0
        private bool ProxyEventToCell(Gdk.Event evnt, bool press, out IInteractiveCell icell, out Gdk.Rectangle icell_area)
        {
            icell      = null;
            icell_area = Gdk.Rectangle.Zero;

            int evnt_x, evnt_y;
            int x, y, row_index;

            x = y = row_index = 0;

            Gdk.EventButton evnt_button = evnt as Gdk.EventButton;
            Gdk.EventMotion evnt_motion = evnt as Gdk.EventMotion;

            if (evnt_motion != null)
            {
                evnt_x = (int)evnt_motion.X;
                evnt_y = (int)evnt_motion.Y;
            }
            else if (evnt_button != null)
            {
                evnt_x = (int)evnt_button.X;
                evnt_y = (int)evnt_button.Y;
            }
            else
            {
                // Possibly EventCrossing, for the leave event
                icell = last_icell;
                return(false);
            }

            Column column;

            if (!GetEventCell <IInteractiveCell> (evnt_x, evnt_y, out icell, out column, out row_index))
            {
                return(false);
            }

            x = evnt_x - list_interaction_alloc.X;
            y = evnt_y - list_interaction_alloc.Y;

            // Turn the view-absolute coordinates into cell-relative coordinates
            CachedColumn cached_column = GetCachedColumnForColumn(column);

            x -= cached_column.X1 - HadjustmentValue;
            int page_offset = VadjustmentValue % RowHeight;

            y = (y + page_offset) % RowHeight;

            icell_area.X      = cached_column.X1 + Allocation.X;
            icell_area.Y      = (int)GetYAtRow(row_index) + list_interaction_alloc.Y + Allocation.Y;
            icell_area.Width  = cached_column.Width;
            icell_area.Height = RowHeight;

            // Send the cell a synthesized input event
            if (evnt_motion != null)
            {
                return(icell.MotionEvent(x, y, evnt_motion));
            }
            else
            {
                return(icell.ButtonEvent(x, y, press, evnt_button));
            }
        }