public MainWindow() : base(Gtk.WindowType.Toplevel) { Build(); player = new Player(this); hscale = this.hscale1; }
private void AllowStaticAccess() { _tvShareBrowser = this.tvShareBrowser; _tvPlaylist = this.tvPlaylist; _cbShareType = this.cbShareType; _hsVolume = this.hsVolume; _hsProgress = this.hsProgress; _tbMute = this.tbMute; _bPrevious = this.bPrevious; _tbPlay = this.tbPlay; _tbStop = this.tbStop; _bNext = this.bNext; _imgNowPlaying = this.imgNowPlaying; _imgLoading = this.imgLoading; _fixedNowPlaying = this.fixedNowPlaying; _lArtist = this.lArtist; _lSong = this.lSong; _lAlbum = this.lAlbum; _lGenre = this.lGenre; _lProgress = this.lProgress; _lDuration = this.lDuration; _lYear = this.lYear; _nbDataContainer = this.nbDataContainer; }
/// <summary> /// Constructor. /// </summary> public SmoothingContent() { HeightRequest = 200; Label title = new Label(); title.Markup = "<b>Smoothing</b>"; PackStart(title, false, false, 5); m_iterationCount = new HScale(1, MeanSmoother.MAX_ITERATIONS, 1); m_iterationCount.Value = MeanSmoother.Iterations; m_iterationCount.CanFocus = false; m_iterationCount.ValueChanged += OnIterationsChanged; CreateField(60, m_iterationCount, "Iterations", "The number of iterations performed by the smoothing algorithm."); m_strength = new HScale(0, 1, 0.01); m_strength.Value = MeanSmoother.Strength; m_strength.CanFocus = false; m_strength.ValueChanged += OnStrengthChanged; CreateField(60, m_strength, "Strength", "The strength of the smoothing effect."); Button smoothButton = new Button(); smoothButton.Label = "Smooth Selected"; smoothButton.CanFocus = false; smoothButton.Clicked += OnSmoothButtonClick; PackStart(smoothButton, false, false, 5); }
private void AttachWidgets(TextView textView) { // This is really different from the C version, but the // C versions seems a little pointless. Button button = new Button("Click Me"); button.Clicked += new EventHandler(EasterEggCB); textView.AddChildAtAnchor(button, buttonAnchor); button.ShowAll(); ComboBox combo = ComboBox.NewText(); combo.AppendText("Option 1"); combo.AppendText("Option 2"); combo.AppendText("Option 3"); textView.AddChildAtAnchor(combo, menuAnchor); HScale scale = new HScale(null); scale.SetRange(0, 100); scale.SetSizeRequest(70, -1); textView.AddChildAtAnchor(scale, scaleAnchor); scale.ShowAll(); Gtk.Image image = Gtk.Image.LoadFromResource("floppybuddy.gif"); textView.AddChildAtAnchor(image, animationAnchor); image.ShowAll(); Entry entry = new Entry(); textView.AddChildAtAnchor(entry, entryAnchor); entry.ShowAll(); }
/// <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(PreferencesKeys.CompletedTasksRange); if (rangeStr == null) { // Set a default value of All rangeStr = ShowCompletedRange.All.ToString(); Application.Preferences.Set(PreferencesKeys.CompletedTasksRange, rangeStr); } currentRange = ParseRange(rangeStr); rangeSlider.Value = (double)currentRange; rangeSlider.FormatValue += OnFormatRangeSliderValue; rangeSlider.ValueChanged += OnRangeSliderChanged; rangeSlider.Show(); this.ExtraWidget = rangeSlider; }
public HScaleCommandBinding(HScale scale, Func <IViewModel, Command> commandFunc, double defaultValue) : base(commandFunc, null) { hScale = scale; this.defaultValue = defaultValue; hScale.Value = defaultValue; }
public JpegCompressionDialog(int defaultQuality, Gtk.Window parent) : base(Catalog.GetString("JPEG Quality"), parent, DialogFlags.Modal | DialogFlags.DestroyWithParent, Stock.Cancel, ResponseType.Cancel, Stock.Ok, ResponseType.Ok) { this.BorderWidth = 6; this.VBox.Spacing = 3; VBox content = new VBox(); content.Spacing = 5; DefaultResponse = ResponseType.Ok; Label label = new Label(Catalog.GetString("Quality: ")); label.Xalign = 0; content.PackStart(label, false, false, 0); compressionLevel = new HScale(1, 100, 1); compressionLevel.Value = defaultQuality; content.PackStart(compressionLevel, false, false, 0); content.ShowAll(); this.VBox.Add(content); AlternativeButtonOrder = new int[] { (int)ResponseType.Ok, (int)ResponseType.Cancel }; }
private void AllowinternalAccess() { _tvShares = tvShares; _tvArtists = tvArtists; _tvGenres = tvGenres; _tvAlbums = tvAlbums; _tvPlaylist = tvPlaylist; _tvFiles = tvFiles; _MainWindow = MainWindow; _nbLeft = nbLeft; _nbRight = nbRight; _hsVolume = hsVolume; _hsProgress = hsProgress; _iConnectionStatus = iConnectionStatus; _lStatus = lStatus; _tbMute = tbMute; _ibPlay = ibPlay; _bStop = bStop; //Configuration tab _eIpAddress = eIpAddress; _eUsername = eUsername; _ePassword = ePassword; _sbUpdateInterval = sbUpdateInterval; _sbConnectionTimeout = sbConnectionTimeout; _chbShowInTaskbar = chbShowInTaskbar; _chbShowInSystemTray = chbShowInSystemTray; }
public override Widget ConfigurationWidget() { VBox h = new VBox(); r = new HScale(0, 100, 1); r.ModifyBg(StateType.Selected, new Color(0xff, 0, 0)); r.Value = 80; r.ValueChanged += SettingsChanged; h.Add(r); g = new HScale(0, 100, 1); g.ModifyBg(StateType.Selected, new Color(0, 0xff, 0)); g.Value = 10; g.ValueChanged += SettingsChanged; h.Add(g); b = new HScale(0, 100, 1); b.ModifyBg(StateType.Selected, new Color(0, 0, 0xff)); b.Value = 10; b.ValueChanged += SettingsChanged; h.Add(b); c = new Curve(); c.CurveType = CurveType.Spline; c.SetRange(0, 255, 0, 255); h.Add(c); Button btn = new Button(Gtk.Stock.Refresh); btn.Clicked += delegate { UpdatePreview(); }; h.Add(btn); return(h); }
protected void OnHscaleScaleValueChanged(object sender, EventArgs e) { HScale hscale = (HScale)sender; this.updateLables(); this.scale = hscale.Value / 10; this.drawingarea1.QueueDraw(); }
public HScaleCommandBinding(HScale scale, Func <IViewModel, Command> commandFunc, double defaultValue, double min, double max, double step, double page) : this(scale, commandFunc, defaultValue) { this.min = min; this.max = max; this.step = step; this.page = page; }
public ZoomSlider(Client app) : base(1f, 0.5f, 0f, 0f) { RightPadding = 16; var box = new HBox() { Spacing = 2 }; // Zoom in/out buttons var zoom_out = new Button(new Image(Stock.ZoomOut, IconSize.Button)) { Relief = ReliefStyle.None }; app.Actions["ZoomOut"].ConnectProxy(zoom_out); var zoom_in = new Button(new Image(Stock.ZoomIn, IconSize.Button)) { Relief = ReliefStyle.None }; app.Actions["ZoomIn"].ConnectProxy(zoom_in); // Slider var slider = new HScale(DocumentIconView.MIN_WIDTH, DocumentIconView.MAX_WIDTH, 1) { WidthRequest = 100, DrawValue = false, Sensitive = false }; bool setting_via_slider = false; slider.ValueChanged += (o, a) => { if (!setting_via_slider) { setting_via_slider = true; app.IconView.Zoom((int)slider.Value, true); setting_via_slider = false; } }; app.IconView.ZoomChanged += () => { if (!setting_via_slider) { setting_via_slider = true; slider.Value = app.IconView.ItemSize; setting_via_slider = false; } }; app.DocumentLoaded += (o, a) => slider.Sensitive = app.Document != null; box.PackStart(zoom_out, false, false, 0); box.PackStart(slider, false, false, 0); box.PackStart(zoom_in, false, false, 0); Child = box; }
public ColorScales(HScale redScale, HScale greenScale, HScale blueScale, HScale alphaScale) { this.redScale = redScale; this.greenScale = greenScale; this.blueScale = blueScale; this.alphaScale = alphaScale; inst = this; }
private void BindToWidget() { foreach (var p in GetObjectProperties(m_objectType)) { var hbox = new HBox(); var label = new Label(p.Name); hbox.Add(label); var value = p.GetValue(ObjectInstance, null); Widget input = null; if (p.PropertyType == typeof(int)) { var spinButton = new SpinButton(0, int.MaxValue, 1); spinButton.Value = Convert.ToDouble(value); input = spinButton; } if (p.PropertyType == typeof(bool)) { var toggle = new ToggleButton(); toggle.Active = Convert.ToBoolean(value); input = toggle; } else if (p.PropertyType == typeof(float) || p.PropertyType == typeof(double)) { var horizontalScale = new HScale(0, 1, 0.05); if (ObjectInstance != null) { horizontalScale.Value = Convert.ToDouble(value); } input = horizontalScale; } else if (p.PropertyType == typeof(TimeSpan)) { var secondsHBox = new HBox(); var seconds = new SpinButton(0, int.MaxValue, 1); seconds.Value = ((TimeSpan)value).TotalSeconds; secondsHBox.Add(seconds); var secondsLabel = new Label("seconds"); secondsHBox.Add(secondsLabel); input = secondsHBox; } if (input != null) { m_widgetMap.Add(p, input); hbox.Add(input); } VBox.Add(hbox); } }
public (string, Widget) CreateHorizontalRange() { var adj = new Adjustment(0.0, 0.0, 101.0, 0.1, 1.0, 1.0); var hScale = new HScale(adj); hScale.SetSizeRequest(200, -1); hScale.ValueChanged += (sender, e) => ApplicationOutput.WriteLine(sender, $"Value Change: {((HScale)sender).Value}"); return("Horizontal", hScale); }
public override Widget CreateEditWidget() { var widget = new HScale((double)min, (double)max, 1.0); widget.Value = (double)value; widget.ChangeValue += (sender, args) => { value = (byte)widget.Value; }; return(widget); }
void ScaleButton(object sender, EventArgs e) { HScale b = (HScale)sender; double val = b.Value; int[] scales = { 1, 2, 5 }; scale = scales[(int)val]; QueueDraw(); }
public static void Main(string[] args) { Application.Init(); Window win = new Window(WindowType.Toplevel); VBox vBox = new VBox(); HScale transparencyScale = new HScale(0, 255, 1) { Value = 255 }; Image image = new Image(); image.SetSizeRequest(200, 200); vBox.PackStart(transparencyScale); vBox.PackStart(image); win.Add(vBox); transparencyScale.ValueChanged += delegate { int transparency = (int)transparencyScale.Value; byte[] tBytes = BitConverter.GetBytes(transparency); Gdk.GC red = new Gdk.GC(win.GdkWindow) { RgbFgColor = new Gdk.Color(255, 0, 0) }; Gdk.GC black = new Gdk.GC(win.GdkWindow) { RgbFgColor = new Gdk.Color(0, 0, 0) }; Gdk.GC translucent = new Gdk.GC(win.GdkWindow) { RgbFgColor = new Gdk.Color(tBytes[0], tBytes[0], tBytes[0]) }; Gdk.GC visible = new Gdk.GC(win.GdkWindow) { RgbFgColor = new Gdk.Color(255, 255, 255) }; Gdk.Pixmap pixmap = new Gdk.Pixmap(win.GdkWindow, 200, 200); pixmap.DrawRectangle(black, true, 0, 0, 200, 200); pixmap.DrawArc(red, true, 20, 20, 160, 160, 0, 23040); Gdk.Pixmap mask = new Gdk.Pixmap(win.GdkWindow, 200, 200); mask.DrawRectangle(visible, true, 0, 0, 200, 200); mask.DrawArc(translucent, true, 0, 0, 100, 100, 0, 23040); mask.DrawArc(translucent, true, 100, 100, 100, 100, 0, 23040); image.SetFromPixmap(pixmap, mask); image.ShowAll(); }; win.ShowAll(); Application.Run(); }
void SetMorphList(Morph[] morphs) { int y = 0; foreach (var morph in morphs) { if (!(morph is MorphVertex) && !(morph is MorphMaterial) && !(morph is MorphUV) && !(morph is MorphSkeleton) && !(morph is MorphGroup)) { continue; } //display morph type string prefix = ""; if (morph is MorphVertex) { prefix = "(V)"; } else if (morph is MorphMaterial) { prefix = "(M)"; } else if (morph is MorphUV) { prefix = "(UV)"; } else if (morph is MorphSkeleton) { prefix = "(B)"; } else if (morph is MorphGroup) { prefix = "(G)"; } Label lbl = new Label(); lbl.Name = "lbl"; lbl.Text = prefix + morph.Name; fixed7.Put(lbl, 0, y); lbl.Show(); // y += 30; HScale scale = new HScale(0, 1, 0.1); scale.WidthRequest = 180; scale.Name = "scale"; scale.Value = morph.MorphDegree; scale.ValueChanged += (sender, e) => { core.AddTask = () => morph.MorphDegree = (float)scale.Value; }; fixed7.Put(scale, 100, y); scale.Show(); y += 40; } }
private HScale CreateSlider(double value, double min, double max, double increment, int numDecimals, bool showLabel, string tooltip = null) { var scale = new HScale(min, max, increment); scale.DrawValue = showLabel; scale.ValuePos = PositionType.Right; scale.Value = value; scale.FormatValue += Scale_FormatValue; scale.ChangeValue += Scale_ChangeValue; return(scale); }
private void Build() { // Section label + line var hbox1 = new HBox(false, 6); label = new Label(); hbox1.PackStart(label, false, false, 0); hbox1.PackStart(new HSeparator(), true, true, 0); // Slider + spinner + reset button var hbox2 = new HBox(false, 6); hscale = new HScale(2, 64, 1); hscale.CanFocus = true; hscale.DrawValue = false; hscale.Digits = 0; hscale.ValuePos = PositionType.Top; hbox2.PackStart(hscale, true, true, 0); spin = new SpinButton(0, 100, 1); spin.CanFocus = true; spin.Adjustment.PageIncrement = 10; spin.ClimbRate = 1; spin.Numeric = true; hbox2.PackStart(spin, false, false, 0); // Reset button button = new Button(); button.WidthRequest = 28; button.HeightRequest = 24; button.CanFocus = true; button.UseUnderline = true; var button_image = new Image(PintaCore.Resources.GetIcon(Stock.GoBack, 16)); button.Add(button_image); var alignment2 = new Alignment(0.5F, 0F, 1F, 0F); alignment2.Add(button); hbox2.PackStart(alignment2, false, false, 0); // Main layout var vbox = new VBox(false, 6); vbox.Add(hbox1); vbox.Add(hbox2); Add(vbox); vbox.ShowAll(); }
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(); }
public MainWindow() : base("Overlaytest") { VBox vBox = new VBox(); _da = new DrawingArea(); _da.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0)); _da.SetSizeRequest(400, 300); _da.DoubleBuffered = false; vBox.PackStart(_da, false, false, 0); _scale = new HScale(0, 1, 0.01); _scale.DrawValue = false; _scale.ValueChanged += ScaleValueChanged; vBox.PackStart(_scale, false, false, 0); HBox hBox = new HBox(); Button btnOpen = new Button(); btnOpen.Label = "Open"; btnOpen.Clicked += ButtonOpenClicked; hBox.PackStart(btnOpen, false, false, 0); Button btnPlay = new Button(); btnPlay.Label = "Play"; btnPlay.Clicked += ButtonPlayClicked; hBox.PackStart(btnPlay, false, false, 0); Button btnPause = new Button(); btnPause.Label = "Pause"; btnPause.Clicked += ButtonPauseClicked; hBox.PackStart(btnPause, false, false, 0); _lbl = new Label(); _lbl.Text = "00:00 / 00:00"; hBox.PackEnd(_lbl, false, false, 0); vBox.PackStart(hBox, false, false, 3); Add(vBox); WindowPosition = Gtk.WindowPosition.Center; DeleteEvent += OnDeleteEvent; GLib.Timeout.Add(1000, new GLib.TimeoutHandler(UpdatePos)); }
void AddSliderIntProperty(string name, int initialvalue, int min, int max) { Gtk.HScale trackbar = new HScale(min, max, (max - min) / 10); trackbar.Value = initialvalue; trackbar.ValueChanged += new EventHandler(FormValueChanged); propertytable.Attach(new Label(name), 0, 1, (uint)nextpropertyindex, (uint)nextpropertyindex + 1); propertytable.Attach(trackbar, 1, 2, (uint)nextpropertyindex, (uint)nextpropertyindex + 1); nextpropertyindex++; // LayoutNewProperty(name, trackbar); ControlsIndex.Add(name, trackbar); }
private Widget BuildSlider(PipelineVariable variable) { if (variable.StepValue <= 0.0) { return(null); } HBox box = new HBox(); HScale slider = new HScale(variable.MinValue, variable.MaxValue, variable.StepValue); slider.DrawValue = true; slider.Digits = variable.StepPrecision; if (variable.DefaultValueNumeric != null) { slider.Value = (double)variable.DefaultValueNumeric; } if (variable.CurrentValueNumeric != null) { slider.Value = (double)variable.CurrentValueNumeric; } slider.ChangeValue += delegate { variable.CurrentValue = slider.Value.ToString(); }; if (variable.MinLabel != null) { Label min_label = new Label(); min_label.Yalign = 0.9f; min_label.Markup = String.Format("<small>{0}</small>", GLib.Markup.EscapeText(variable.MinLabel)); box.PackStart(min_label, false, false, 0); box.Spacing = 5; } box.PackStart(slider, true, true, 0); if (variable.MaxLabel != null) { Label max_label = new Label(); max_label.Yalign = 0.9f; max_label.Markup = String.Format("<small>{0}</small>", GLib.Markup.EscapeText(variable.MaxLabel)); box.PackStart(max_label, false, false, 0); box.Spacing = 5; } box.ShowAll(); return(box); }
static void SetUpGui() { Window w = new Window("Scale Test"); HScale hscale = new HScale(1, 100, 10); hscale.ValueChanged += hscale_value_changed_cb; hscale.Value = 50; w.Add(hscale); w.SetDefaultSize(160, 120); w.ShowAll(); }
public void HScale_LimitationEnabled_ExecuteCalledOnce() { LimitationCommand <double> command = new LimitationCommand <double> ("Test", (obj) => { }); HScale scale = new HScale(1, 4, 1); HScaleCommandBinding binding = new HScaleCommandBinding(scale, (vm) => command, 1); binding.ViewModel = new DummyViewModel(); mockLimitationService.Setup(s => s.CanExecute("Test")).Returns(false); scale.Value = 2; mockLimitationService.Verify((s) => s.MoveToUpgradeDialog("Test"), Times.Once); }
public void HScale_LimitationEnabled_ReturnsToDefaultValue() { LimitationCommand <double> command = new LimitationCommand <double> ("Test", (obj) => {}); HScale scale = new HScale(1, 4, 1); HScaleCommandBinding binding = new HScaleCommandBinding(scale, (vm) => command, 1); binding.ViewModel = new DummyViewModel(); mockLimitationService.Setup(s => s.CanExecute("Test")).Returns(false); scale.Value = 2; Assert.AreEqual(1, scale.Value); }
public void ShowControlBox(Gtk.VBox labels, Gtk.VBox widgets) { Label label = new Label("Target height:"); heightscale = new HScale(minheight, maxheight, (maxheight - minheight) / 20); heightscale.Value = lastheight; heightscale.ValueChanged += new EventHandler(heightscale_ValueChanged); labels.PackEnd(label); widgets.PackEnd(heightscale); labels.ShowAll(); widgets.ShowAll(); }
public void HScale_LimitationEnabled_CommandNotExecuted() { double val = -1; LimitationCommand <double> command = new LimitationCommand <double> ("Test", (obj) => val = obj); HScale scale = new HScale(1, 4, 1); HScaleCommandBinding binding = new HScaleCommandBinding(scale, (vm) => command, 1); binding.ViewModel = new DummyViewModel(); mockLimitationService.Setup(s => s.CanExecute("Test")).Returns(false); scale.Value = 2; Assert.AreEqual(-1, val); }
static void SetUpGui () { Window w = new Window ("Scale Test"); VBox vbox = new VBox (); HScale hscale = new HScale (1, 100, 10); hscale.ValueChanged += hscale_value_changed_cb; hscale.Value = 50; scale_label = new Label (hscale.Value.ToString()); vbox.PackStart (scale_label, true, false, 0); vbox.PackStart (hscale, true, false, 0); w.Add (vbox); w.SetDefaultSize (160, 120); w.ShowAll (); }
static void TestScale (object o, object eventargs) { Window w = new Window ("Scale Test"); VBox vbox = new VBox (); HScale hscale = new HScale (1, 100, 10); hscale.ValueChanged += TestScale_HscaleValueChanged; hscale.Value = 50; scale_label = new Label (hscale.Value.ToString()); vbox.PackStart (scale_label, true, false, 0); vbox.PackStart (hscale, true, false, 0); w.Add (vbox); w.SetDefaultSize (160, 120); w.ShowAll (); }