public ToolBarSlider (int min, int max, int step, int value) { hscale = new HScale (min, max, step); hscale.WidthRequest = 150; hscale.Value = value; hscale.ValuePos = PositionType.Left; hscale.Show (); Add (hscale); Show (); }
/// <summary> /// Create and show a slider (HScale) that will allow the user to /// customize how far in the past to show completed items. /// </summary> private void CreateRangeSlider() { // There are five (5) different values allowed here: // "Yesterday", "Last7Days", "LastMonth", "LastYear", or "All" // Create the slider with 5 distinct "stops" rangeSlider = new HScale (0, 4, 1); rangeSlider.SetIncrements (1, 1); rangeSlider.WidthRequest = 100; rangeSlider.DrawValue = true; // TODO: Set the initial value and range string rangeStr = Application.Preferences.Get (Preferences.CompletedTasksRange); if (rangeStr == null) { // Set a default value of All rangeStr = ShowCompletedRange.All.ToString (); Application.Preferences.Set (Preferences.CompletedTasksRange, rangeStr); } currentRange = ParseRange (rangeStr); rangeSlider.Value = (double)currentRange; rangeSlider.FormatValue += OnFormatRangeSliderValue; rangeSlider.ValueChanged += OnRangeSliderChanged; rangeSlider.Show (); this.ExtraWidget = rangeSlider; }
private Widget CreateBottomBar() { HButtonBox buttonBox = new HButtonBox (); buttonBox.Layout = ButtonBoxStyle.Edge; toggleSidebarButton = new Button (); toggleSidebarButton.Label = Catalog.GetString ("Close Sidebar"); toggleSidebarButton.Relief = ReliefStyle.None; toggleSidebarButton.Clicked += OnToggleSidebarButtonClicked; toggleSidebarButton.Show (); buttonBox.PackStart (toggleSidebarButton, false, false, 0); personHScale = new HScale (1, 3, 1); personHScale.DrawValue = false; personHScale.ValueChanged += OnPersonHScaledValueChanged; personHScale.Show (); buttonBox.PackEnd (personHScale, false, false, 0); buttonBox.Show (); return buttonBox; }