static void SetupEntry(SpinButton spinButton, Label labelWidget, string labelText) { labelWidget.Text = GetLabelWithColon(labelText); spinButton.Accessible.Label = labelText; spinButton.Accessible.LabelWidget = labelWidget; }
public SpinButtonSample () { var spn1 = new SpinButton(); spn1.MinimumValue = -100; spn1.MaximumValue = 100; spn1.IncrementValue = 1; spn1.Digits = 0; PackStart (spn1); var spn2 = new SpinButton(); spn2.MinimumValue = 0; spn2.MaximumValue = 1; spn2.Digits = 3; spn2.IncrementValue = 0.01; spn2.Style = ButtonStyle.Borderless; PackStart (spn2); var spn3 = new SpinButton(); spn3.MinimumValue = -10; spn3.MaximumValue = 20; spn3.Digits = 1; spn3.IncrementValue = 0.1; spn3.Wrap = true; PackStart (spn3); var spn4 = new SpinButton(); spn4.IsIndeterminate = true; spn4.IndeterminateMessage = "I have no initial value"; var defColor = spn4.BackgroundColor; spn4.BackgroundColor = Colors.Red; spn4.ValueChanged += (sender, e) => spn4.BackgroundColor = defColor; PackStart (spn4); }
public ListView1 () { PackStart (new Label ("The listview should have a red background")); ListView list = new ListView (); list.GridLinesVisible = GridLines.Both; ListStore store = new ListStore (name, icon, text, icon2, progress); list.DataSource = store; list.Columns.Add ("Name", icon, name); list.Columns.Add ("Text", icon2, text); list.Columns.Add ("Progress", new TextCellView () { TextField = text }, new CustomCell () { ValueField = progress }); var png = Image.FromResource (typeof(App), "class.png"); Random rand = new Random (); for (int n=0; n<100; n++) { var r = store.AddRow (); store.SetValue (r, icon, png); store.SetValue (r, name, "Value " + n); store.SetValue (r, icon2, png); store.SetValue (r, text, "Text " + n); store.SetValue (r, progress, new CellData { Value = rand.Next () % 100 }); } PackStart (list, true); list.RowActivated += delegate(object sender, ListViewRowEventArgs e) { MessageDialog.ShowMessage ("Row " + e.RowIndex + " activated"); }; Menu contextMenu = new Menu (); contextMenu.Items.Add (new MenuItem ("Test menu")); list.ButtonPressed += delegate(object sender, ButtonEventArgs e) { int row = list.GetRowAtPosition(new Point(e.X, e.Y)); if (e.Button == PointerButton.Right && row >= 0) { // Set actual row to selected list.SelectRow(row); contextMenu.Popup(list, e.X, e.Y); } }; var but = new Button ("Scroll one line"); but.Clicked += delegate { list.VerticalScrollControl.Value += list.VerticalScrollControl.StepIncrement; }; PackStart (but); var spnValue = new SpinButton (); spnValue.MinimumValue = 0; spnValue.MaximumValue = 99; spnValue.IncrementValue = 1; spnValue.Digits = 0; var btnScroll = new Button ("Go!"); btnScroll.Clicked += (sender, e) => list.ScrollToRow((int)spnValue.Value); HBox scrollActBox = new HBox (); scrollActBox.PackStart (new Label("Scroll to Value: ")); scrollActBox.PackStart (spnValue); scrollActBox.PackStart (btnScroll); PackStart (scrollActBox); }
public ListBoxSample () { // Default list box ListBox list = new ListBox (); for (int n=0; n<100; n++) list.Items.Add ("Value " + n); PackStart (list, true); // Custom list box ListBox customList = new ListBox (); customList.GridLinesVisible = true; ListStore store = new ListStore (name, icon); customList.DataSource = store; customList.Views.Add (new ImageCellView (icon)); customList.Views.Add (new TextCellView (name)); var png = Image.FromResource (typeof(App), "class.png"); for (int n=0; n<100; n++) { var r = store.AddRow (); store.SetValue (r, icon, png); store.SetValue (r, name, "Value " + n); } PackStart (customList, true); var spnValue = new SpinButton (); spnValue.MinimumValue = 0; spnValue.MaximumValue = 99; spnValue.IncrementValue = 1; spnValue.Digits = 0; var btnScroll = new Button ("Go!"); btnScroll.Clicked += (sender, e) => customList.ScrollToRow((int)spnValue.Value); HBox scrollActBox = new HBox (); scrollActBox.PackStart (new Label("Scroll to Value: ")); scrollActBox.PackStart (spnValue); scrollActBox.PackStart (btnScroll); PackStart (scrollActBox); }
void Build () { checkProjectCodeOnly = new CheckBox (GettextCatalog.GetString ("Debug project code only; do not step into framework code.")); PackStart (checkProjectCodeOnly); checkStepOverPropertiesAndOperators = new CheckBox (GettextCatalog.GetString ("Step over properties and operators")); PackStart (checkStepOverPropertiesAndOperators); checkAllowEval = new CheckBox (GettextCatalog.GetString ("Allow implicit property evaluation and method invocation")); checkAllowEval.Toggled += OnCheckAllowEvalToggled; PackStart (checkAllowEval); checkAllowToString = new CheckBox (GettextCatalog.GetString ("Call string-conversion function on objects in variables windows")); checkAllowToString.MarginLeft = 18; PackStart (checkAllowToString); checkShowBaseGroup = new CheckBox (GettextCatalog.GetString ("Show inherited class members in a base class group")); PackStart (checkShowBaseGroup); checkGroupPrivate = new CheckBox (GettextCatalog.GetString ("Group non-public members")); PackStart (checkGroupPrivate); checkGroupStatic = new CheckBox (GettextCatalog.GetString ("Group static members")); PackStart (checkGroupStatic); var evalBox = new HBox (); evalBox.PackStart (new Label (GettextCatalog.GetString ("Evaluation Timeout:"))); spinTimeout = new SpinButton (); spinTimeout.ClimbRate = 100; spinTimeout.Digits = 0; spinTimeout.IncrementValue = 100; spinTimeout.MaximumValue = 1000000; spinTimeout.MinimumValue = 0; spinTimeout.Wrap = false; spinTimeout.WidthRequest = 80; evalBox.PackStart (spinTimeout); evalBox.PackStart (new Label (GettextCatalog.GetString ("ms"))); PackStart (evalBox); PackStart (new Label () { Markup = "<b>" + GettextCatalog.GetString ("Advanced options") + "</b>" }); enableLogging = new CheckBox (GettextCatalog.GetString ("Enable diagnostic logging", BrandingService.ApplicationName)); PackStart (enableLogging); }
public DefaultColorSelectorBackend () { HBox box = new HBox (); Table selBox = new Table (); hsBox = new HueBox (); hsBox.Light = 0.5; lightBox = new LightBox (); hsBox.SelectionChanged += delegate { lightBox.Hue = hsBox.SelectedColor.Hue; lightBox.Saturation = hsBox.SelectedColor.Saturation; }; colorBox = new ColorSelectionBox () { MinHeight = 20 }; selBox.Add (hsBox, 0, 0); selBox.Add (lightBox, 1, 0); box.PackStart (selBox); const int entryWidth = 40; VBox entryBox = new VBox (); Table entryTable = new Table (); entryTable.Add (new Label ("Color:"), 0, 0); entryTable.Add (colorBox, 1, 0, colspan:4); entryTable.Add (new HSeparator (), 0, 1, colspan:5); int r = 2; entryTable.Add (new Label ("Hue:"), 0, r); entryTable.Add (hueEntry = new SpinButton () { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 360, Digits = 0, IncrementValue = 1 }, 1, r++); entryTable.Add (new Label ("Saturation:"), 0, r); entryTable.Add (satEntry = new SpinButton () { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 100, Digits = 0, IncrementValue = 1 }, 1, r++); entryTable.Add (new Label ("Light:"), 0, r); entryTable.Add (lightEntry = new SpinButton () { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 100, Digits = 0, IncrementValue = 1 }, 1, r++); r = 2; entryTable.Add (new Label ("Red:"), 3, r); entryTable.Add (redEntry = new SpinButton () { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r++); entryTable.Add (new Label ("Green:"), 3, r); entryTable.Add (greenEntry = new SpinButton () { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r++); entryTable.Add (new Label ("Blue:"), 3, r); entryTable.Add (blueEntry = new SpinButton () { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r++); Label label; entryTable.Add (alphaSeparator = new HSeparator (), 0, r++, colspan:5); entryTable.Add (label = new Label ("Opacity:"), 0, r); entryTable.Add (alphaSlider = new HSlider () { MinimumValue = 0, MaximumValue = 255, }, 1, r, colspan: 3); entryTable.Add (alphaEntry = new SpinButton () { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r); alphaControls.Add (alphaSeparator); alphaControls.Add (label); alphaControls.Add (alphaEntry); entryBox.PackStart (entryTable); box.PackStart (entryBox); Content = box; hsBox.SelectionChanged += delegate { HandleColorBoxSelectionChanged (); }; lightBox.SelectionChanged += delegate { HandleColorBoxSelectionChanged (); }; hueEntry.ValueChanged += HandleHslChanged; satEntry.ValueChanged += HandleHslChanged; lightEntry.ValueChanged += HandleHslChanged; redEntry.ValueChanged += HandleRgbChanged; greenEntry.ValueChanged += HandleRgbChanged; blueEntry.ValueChanged += HandleRgbChanged; alphaEntry.ValueChanged += HandleAlphaChanged; alphaSlider.ValueChanged += HandleAlphaChanged; Color = Colors.White; }
private void Build() { this.Icon = Xwt.Drawing.Image.FromResource("URMSimulator.Resources.urm.png"); this.Title = "URM Simulator"; this.Width = 800; this.Height = 600; this.Padding = 0; vbox1 = new VBox(); vpanned1 = new VPaned(); te1 = new TextEditor(); te1.Document.MimeType = "text/x-urm"; te1.Document.Text = savedContent; te1.OnUndoRedoStackChanged += (sender, e) => ReloadMenuAndTitleEnding(); vpanned1.Panel1.Content = te1; vpanned1.Panel1.Resize = true; vbox2 = new VBox(); label1 = new Label("Input:"); label1.MarginLeft = 5; vbox2.PackStart(label1, false); entry1 = new TextEntry(); entry1.PlaceholderText = "0 0 0 0 0 0 0 0 0 0"; vbox2.PackStart(entry1, false); hbox1 = new HBox(); label2 = new Label("Output:"); label2.MarginLeft = 5; hbox1.PackStart(label2, true); label3 = new Label("Register length:"); hbox1.PackStart(label3, false); sb1 = new SpinButton(); sb1.MinimumValue = 1; sb1.Digits = 0; sb1.IncrementValue = 1; sb1.MaximumValue = 100; sb1.Value = regCount; sb1.ValueChanged += (sender, e) => regCount = (int)sb1.Value; sb1.TextInput += (sender, e) => regCount = (int)sb1.Value; hbox1.PackStart(sb1, false); vbox2.PackStart(hbox1, false); scroll1 = new ScrollView(); scroll1.HeightRequest = 80; scroll1.VerticalScrollPolicy = ScrollPolicy.Never; scroll1.BorderVisible = true; web1 = new WebView(); web1.WidthRequest = 2000; scroll1.Content = web1; vbox2.PackStart(scroll1, true); vpanned1.Panel2.Content = vbox2; vpanned1.Panel2.Resize = false; if (Toolkit.CurrentEngine.Type == ToolkitType.Wpf) vpanned1.Position = this.Height - 120; vbox1.PackStart(vpanned1, true); button1 = new Button("Continue Debugging"); button1.Visible = false; button1.Clicked += (sender, e) => ContinueDebugging(); vbox1.PackStart(button1, false); this.Content = vbox1; te1.SetFocus(); BuildMenu(); }
public DefaultColorSelectorBackend() { HBox box = new HBox(); Table selBox = new Table(); hsBox = new HueBox(); hsBox.Light = 0.5; lightBox = new LightBox(); hsBox.SelectionChanged += delegate { lightBox.Hue = hsBox.SelectedColor.Hue; lightBox.Saturation = hsBox.SelectedColor.Saturation; }; colorBox = new ColorSelectionBox() { MinHeight = 20 }; selBox.Add(hsBox, 0, 0); selBox.Add(lightBox, 1, 0); box.PackStart(selBox); const int entryWidth = 40; VBox entryBox = new VBox(); Table entryTable = new Table(); entryTable.Add(new Label("Color:"), 0, 0); entryTable.Add(colorBox, 1, 0, colspan: 4); entryTable.Add(new HSeparator(), 0, 1, colspan: 5); int r = 2; entryTable.Add(new Label("Hue:"), 0, r); entryTable.Add(hueEntry = new SpinButton() { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 360, Digits = 0, IncrementValue = 1 }, 1, r++); entryTable.Add(new Label("Saturation:"), 0, r); entryTable.Add(satEntry = new SpinButton() { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 100, Digits = 0, IncrementValue = 1 }, 1, r++); entryTable.Add(new Label("Light:"), 0, r); entryTable.Add(lightEntry = new SpinButton() { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 100, Digits = 0, IncrementValue = 1 }, 1, r++); r = 2; entryTable.Add(new Label("Red:"), 3, r); entryTable.Add(redEntry = new SpinButton() { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r++); entryTable.Add(new Label("Green:"), 3, r); entryTable.Add(greenEntry = new SpinButton() { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r++); entryTable.Add(new Label("Blue:"), 3, r); entryTable.Add(blueEntry = new SpinButton() { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r++); Label label; entryTable.Add(alphaSeparator = new HSeparator(), 0, r++, colspan: 5); entryTable.Add(label = new Label("Opacity:"), 0, r); entryTable.Add(alphaSlider = new HSlider() { MinimumValue = 0, MaximumValue = 255, }, 1, r, colspan: 3); entryTable.Add(alphaEntry = new SpinButton() { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r); alphaControls.Add(alphaSeparator); alphaControls.Add(label); alphaControls.Add(alphaEntry); entryBox.PackStart(entryTable); box.PackStart(entryBox); Content = box; hsBox.SelectionChanged += delegate { HandleColorBoxSelectionChanged(); }; lightBox.SelectionChanged += delegate { HandleColorBoxSelectionChanged(); }; hueEntry.ValueChanged += HandleHslChanged; satEntry.ValueChanged += HandleHslChanged; lightEntry.ValueChanged += HandleHslChanged; redEntry.ValueChanged += HandleRgbChanged; greenEntry.ValueChanged += HandleRgbChanged; blueEntry.ValueChanged += HandleRgbChanged; alphaEntry.ValueChanged += HandleAlphaChanged; alphaSlider.ValueChanged += HandleAlphaChanged; Color = Colors.White; }
public ListBoxSample() { // Default list box ListBox list = new ListBox(); for (int n = 0; n < 100; n++) list.Items.Add("Value " + n); list.KeyPressed += (sender, e) => { if (e.Key == Key.Insert) { int r = list.SelectedRow + 1; list.Items.Insert(r, "Value " + list.Items.Count + 1); list.ScrollToRow(r); list.SelectRow(r); list.FocusedRow = r; } }; PackStart(list, true); // Custom list box ListBox customList = new ListBox(); customList.GridLinesVisible = true; ListStore store = new ListStore(name, icon); customList.DataSource = store; customList.Views.Add(new ImageCellView(icon)); customList.Views.Add(new TextCellView(name)); var png = Image.FromResource(typeof(Application), "class.png"); for (int n = 0; n < 100; n++) { var r = store.AddRow(); store.SetValue(r, icon, png); store.SetValue(r, name, "Value " + n); } customList.KeyPressed += (sender, e) => { if (e.Key == Key.Insert) { var r = store.InsertRowAfter(customList.SelectedRow < 0 ? 0 : customList.SelectedRow); store.SetValue(r, icon, png); store.SetValue(r, name, "Value " + (store.RowCount + 1)); customList.ScrollToRow(r); customList.SelectRow(r); customList.FocusedRow = r; } }; PackStart(customList, true); var spnValue = new SpinButton(); spnValue.MinimumValue = 0; spnValue.MaximumValue = 99; spnValue.IncrementValue = 1; spnValue.Digits = 0; var btnScroll = new Button("Go!"); btnScroll.Clicked += (sender, e) => customList.ScrollToRow((int)spnValue.Value); HBox scrollActBox = new HBox(); scrollActBox.PackStart(new Label("Scroll to Value: ")); scrollActBox.PackStart(spnValue); scrollActBox.PackStart(btnScroll); PackStart(scrollActBox); }
public DefaultColorSelectorBackend() { HBox box = new HBox(); Table selBox = new Table(); hsBox = new HueBox(); hsBox.Light = 0.5; lightBox = new LightBox(); hsBox.SelectionChanged += delegate { lightBox.Hue = hsBox.SelectedColor.Hue; lightBox.Saturation = hsBox.SelectedColor.Saturation; }; colorBox = new ColorSelectionBox() { MinHeight = 20 }; selBox.Add(hsBox, 0, 0); selBox.Add(lightBox, 1, 0); box.PackStart(selBox); const int entryWidth = 40; VBox entryBox = new VBox(); Table entryTable = new Table(); entryTable.Add(CreateLabel(Application.TranslationCatalog.GetString("Color:")), 0, 0); entryTable.Add(colorBox, 1, 0, colspan: 4); entryTable.Add(new HSeparator(), 0, 1, colspan: 5); int r = 2; var hueLabel = CreateLabel(); entryTable.Add(hueLabel, 0, r); entryTable.Add(hueEntry = new SpinButton() { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 360, Digits = 0, IncrementValue = 1 }, 1, r++); SetupEntry(hueEntry, hueLabel, Application.TranslationCatalog.GetString("Hue")); var satLabel = CreateLabel(); entryTable.Add(satLabel, 0, r); entryTable.Add(satEntry = new SpinButton() { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 100, Digits = 0, IncrementValue = 1 }, 1, r++); SetupEntry(satEntry, satLabel, Application.TranslationCatalog.GetString("Saturation")); var lightLabel = CreateLabel(); entryTable.Add(lightLabel, 0, r); entryTable.Add(lightEntry = new SpinButton() { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 100, Digits = 0, IncrementValue = 1 }, 1, r++); SetupEntry(lightEntry, lightLabel, Application.TranslationCatalog.GetString("Light")); r = 2; var redLabel = CreateLabel(); entryTable.Add(redLabel, 3, r); entryTable.Add(redEntry = new SpinButton() { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r++); SetupEntry(redEntry, redLabel, Application.TranslationCatalog.GetString("Red")); var greenLabel = CreateLabel(); entryTable.Add(greenLabel, 3, r); entryTable.Add(greenEntry = new SpinButton() { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r++); SetupEntry(greenEntry, greenLabel, Application.TranslationCatalog.GetString("Green")); var blueLabel = CreateLabel(); entryTable.Add(blueLabel, 3, r); entryTable.Add(blueEntry = new SpinButton() { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r++); SetupEntry(blueEntry, blueLabel, Application.TranslationCatalog.GetString("Blue")); entryTable.Add(alphaSeparator = new HSeparator(), 0, r++, colspan: 5); var alphaLabel = CreateLabel(); entryTable.Add(alphaLabel, 0, r); entryTable.Add(alphaSlider = new HSlider() { MinimumValue = 0, MaximumValue = 255, }, 1, r, colspan: 3); entryTable.Add(alphaEntry = new SpinButton() { MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r); SetupEntry(alphaEntry, alphaLabel, Application.TranslationCatalog.GetString("Opacity")); // Don't allow the slider to get keyboard focus, as it doesn't really work with the keyboard and the opacity // spin button takes its place alphaSlider.CanGetFocus = false; alphaSlider.Accessible.Label = Application.TranslationCatalog.GetString("Opacity"); alphaControls.Add(alphaSeparator); alphaControls.Add(alphaLabel); alphaControls.Add(alphaEntry); entryBox.PackStart(entryTable); box.PackStart(entryBox); Content = box; hsBox.SelectionChanged += HandleColorBoxSelectionChanged; lightBox.SelectionChanged += HandleColorBoxSelectionChanged; hueEntry.ValueChanged += HandleHslChanged; satEntry.ValueChanged += HandleHslChanged; lightEntry.ValueChanged += HandleHslChanged; redEntry.ValueChanged += HandleRgbChanged; greenEntry.ValueChanged += HandleRgbChanged; blueEntry.ValueChanged += HandleRgbChanged; alphaEntry.ValueChanged += HandleAlphaChanged; alphaSlider.ValueChanged += HandleAlphaChanged; Color = Colors.White; }