示例#1
0
        private void OnAddinSizeAllocated(object o, SizeAllocatedArgs args)
        {
            ScrolledWindow scroll;

            if (Parent == null || (scroll = Parent.Parent as ScrolledWindow) == null)
            {
                return;
            }

            AddinTile tile = (AddinTile)o;

            if (tiles.IndexOf(tile) != selected_index)
            {
                return;
            }

            Gdk.Rectangle ta = ((AddinTile)o).Allocation;
            Gdk.Rectangle va = new Gdk.Rectangle(0, (int)scroll.Vadjustment.Value,
                                                 Allocation.Width, Parent.Allocation.Height);

            if (!va.Contains(ta))
            {
                double delta = 0.0;
                if (ta.Bottom > va.Bottom)
                {
                    delta = ta.Bottom - va.Bottom;
                }
                else if (ta.Top < va.Top)
                {
                    delta = ta.Top - va.Top;
                }
                scroll.Vadjustment.Value += delta;
                QueueDraw();
            }
        }
示例#2
0
        private void AppendAddin(Addin addin)
        {
            AddinTile tile = new AddinTile(addin);

            tile.ActiveChanged += OnAddinActiveChanged;
            tile.SizeAllocated += OnAddinSizeAllocated;
            tile.Show();
            tiles.Add(tile);

            box.PackStart(tile, false, false, 0);
        }