Ejemplo n.º 1
0
        void SetAdjustments(Gdk.Rectangle allocation)
        {
            hadj.SetBounds(0, allocation.Width, 0, 0, allocation.Width);
            var height = System.Math.Max(allocation.Height, rowHeight * this.win.DataProvider.Count);

            vadj.SetBounds(0, height, rowHeight, allocation.Height, allocation.Height);
        }
Ejemplo n.º 2
0
        void SetAdjustments(bool scrollToSelectedItem = true)
        {
            if (vadj == null)
            {
                return;
            }
            int viewableCats = InCategoryMode ? categories.Count + 1 : 0;

            if (InCategoryMode && categories.Any(cat => cat.CompletionCategory == null))
            {
                viewableCats--;
            }

            var upper = Math.Max(Allocation.Height, (filteredItems.Count + viewableCats) * rowHeight);

            if (upper != vadj.Upper || Allocation.Height != vadj.PageSize)
            {
                vadj.SetBounds(0, upper, rowHeight, Allocation.Height, Allocation.Height);
                if (vadj.Upper <= Allocation.Height)
                {
                    vadj.Value = 0;
                }
            }
            if (scrollToSelectedItem)
            {
                ScrollToSelectedItem();
            }
        }
Ejemplo n.º 3
0
 /// <summary>adjust the scrollbar</summary>
 private void updateScrollbar()
 {
     if (tilegroup != null)
     {
         double pageheight = Allocation.Height - (Allocation.Height % ROW_HEIGHT);
         double upper      = (ROW_HEIGHT * Math.Ceiling((double)tilegroup.Tiles.Count / (double)TILES_PER_ROW));
         vadjustment.SetBounds(0, upper, ROW_HEIGHT, pageheight - ROW_HEIGHT, pageheight);
     }
 }
Ejemplo n.º 4
0
        void AdjustmentChanged(object sender, EventArgs e)
        {
            vAdjustment.SetBounds(0, 1.0,
                                  attachedVAdjustments.Min(adj => adj.StepIncrement / (adj.Upper - adj.Lower)),
                                  attachedVAdjustments.Min(adj => adj.PageIncrement / (adj.Upper - adj.Lower)),
                                  attachedVAdjustments.Min(adj => adj.PageSize / (adj.Upper - adj.Lower)));

            hAdjustment.SetBounds(0, 1.0,
                                  attachedHAdjustments.Min(adj => adj.StepIncrement / (adj.Upper - adj.Lower)),
                                  attachedHAdjustments.Min(adj => adj.PageIncrement / (adj.Upper - adj.Lower)),
                                  attachedHAdjustments.Min(adj => adj.PageSize / (adj.Upper - adj.Lower)));
        }
Ejemplo n.º 5
0
        private void ResetAdjustments()
        {
            if (hadj != null)
            {
                hadj.SetBounds(0, 0, 0, 0, 0);
                hadj.Value = 0;
                hadj.Change();
                hadj.ChangeValue();
            }

            if (vadj != null)
            {
                vadj.SetBounds(0, 0, 0, 0, 0);
                vadj.Value = 0;
                vadj.Change();
                vadj.ChangeValue();
            }
        }
Ejemplo n.º 6
0
    void SetColRows(int c, int r)
    {
        visible_cols = c;
        visible_rows = r;

        QueueDrawArea(0, 0, Allocation.Width, Allocation.Height);

        int page_items = visible_cols * visible_rows;

        max_top = Math.Max(0, image_count - page_items);

        // add visible_cols+1 to force an extra "row" on the
        // adjustment, so that we can still scroll the
        // bottommost row to full visibility, even if it would
        // get rendered as cut off due to window size
        Console.WriteLine("Setting bounds: {0} {1} {2} {3}", 0, image_count + visible_cols + 1, visible_cols, page_items, page_items);
        adjustment.SetBounds(0, image_count + visible_cols + 1, visible_cols, page_items, page_items);
        adjustment.ChangeValue();
    }
Ejemplo n.º 7
0
        public ConnectedVolumeButton() : base()
        {
            // PlayerEngine uses a volume range of 0 to 100
            Adjustment.SetBounds(0.0, 100.0, 5.0, 20.0, 0.0);

            var player = ServiceManager.PlayerEngine;

            if (player.ActiveEngine != null && player.ActiveEngine.IsInitialized)
            {
                SetVolume();
            }
            else
            {
                Sensitive = false;
                player.EngineAfterInitialize += (e) => {
                    Hyena.ThreadAssist.ProxyToMain(delegate {
                        SetVolume();
                        Sensitive = true;
                    });
                };
            }

            player.ConnectEvent(OnPlayerEvent, PlayerEvent.Volume);

            // On OS X we have no hardware mixer but use a software volume mixer in
            // the gstreamer pipeline which resets the volume to 1.0 (max) upon each
            // uri/track change, so we have to set the volume from the widget
            if (Hyena.PlatformDetection.IsMac)
            {
                player.ConnectEvent((args) => {
                    ServiceManager.PlayerEngine.Volume = (ushort)Value;
                }, PlayerEvent.StartOfStream);
            }

            this.ValueChanged += (o, args) => {
                ServiceManager.PlayerEngine.Volume = (ushort)Value;
            };

            // We need to know whether the volume scale is being used
            this.Pressed  += (o, args) => { active = true; };
            this.Released += (o, args) => { active = false; };
        }
Ejemplo n.º 8
0
        void SetAdjustments(bool scrollToSelectedItem = true)
        {
            if (vadj == null)
            {
                return;
            }

            var upper = Math.Max(Allocation.Height, (filteredItems.Count) * rowHeight);

            if (upper != vadj.Upper || Allocation.Height != vadj.PageSize)
            {
                vadj.SetBounds(0, upper, rowHeight, Allocation.Height, Allocation.Height);
                if (vadj.Upper <= Allocation.Height)
                {
                    vadj.Value = 0;
                }
            }
            if (scrollToSelectedItem)
            {
                ScrollToSelectedItem();
            }
        }
Ejemplo n.º 9
0
    /// <summary>adjust the scrollbar</summary>
    private void updateScrollbar()
    {
        double upper = Math.Ceiling((double)gameObjectTypes.Count / (double)TILES_PER_ROW);

        vadjustment.SetBounds(0, upper, 1, ROWS_PER_PAGE - 1, ROWS_PER_PAGE);
    }