void HandleClicked(object sender, EventArgs e) { if (popover == null) { popover = new Popover (); var table = new Table () { DefaultColumnSpacing = 20, DefaultRowSpacing = 10 }; // table.Margin.SetAll (60); table.Attach (new Label ("Font") { TextAlignment = Alignment.End }, 0, 0); table.Attach (new ComboBox (), 1, 0, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand); table.Attach (new Label ("Family") { TextAlignment = Alignment.End }, 0, 1); table.Attach (new ComboBox (), 1, 1, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand); table.Attach (new Label ("Style") { TextAlignment = Alignment.End }, 0, 2); table.Attach (new ComboBox (), 1, 2, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand); table.Attach (new Label ("Size") { TextAlignment = Alignment.End }, 0, 3); table.Attach (new SpinButton (), 1, 3, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand); var b = new Button ("Add more"); table.Attach (b, 0, 4); int next = 5; b.Clicked += delegate { table.Attach (new Label ("Row " + next), 0, next++); }; table.Margin = 20; popover.Content = table; } // popover.Padding.SetAll (20); popover.Show (Popover.Position.Top, (Button)sender); }
public override Widget CreateWidget() { var t = new Table(); t.Attach(new Label("Hello Worlds"), 0, 0); return(t); }
public Windows() { Button b = new Button ("Show borderless window"); PackStart (b); b.Clicked += delegate { Window w = new Window (); w.Decorated = false; Button c = new Button ("This is a window"); // c.Margin.SetAll (10); w.Content = c; c.Clicked += delegate { w.Dispose (); }; var bpos = b.ScreenBounds; w.Bounds = new Rectangle (bpos.X, bpos.Y + b.Size.Height, w.Bounds.Width, w.Bounds.Height); w.Show (); }; b = new Button ("Show message dialog"); PackStart (b); b.Clicked += delegate { MessageDialog.ShowMessage (ParentWindow, "Hi there!"); }; Button db = new Button ("Show custom dialog"); PackStart (db); db.Clicked += delegate { Dialog d = new Dialog (); d.Title = "This is a dialog"; Table t = new Table (); t.Attach (new Label ("Some field:"), 0, 1, 0, 1); t.Attach (new TextEntry (), 1, 2, 0, 1); t.Attach (new Label ("Another field:"), 0, 1, 1, 2); t.Attach (new TextEntry (), 1, 2, 1, 2); d.Content = t; Command custom = new Command ("Custom"); d.Buttons.Add (new DialogButton (custom)); d.Buttons.Add (new DialogButton ("Custom OK", Command.Ok)); d.Buttons.Add (new DialogButton (Command.Cancel)); d.Buttons.Add (new DialogButton (Command.Ok)); var r = d.Run (this.ParentWindow); db.Label = "Result: " + r.Label; d.Dispose (); }; }
public Tables() { Table t = new Table (); SimpleBox b = new SimpleBox (200, 20); t.Attach (b, 0, 1, 0, 1); b = new SimpleBox (5, 20); t.Attach (b, 1, 2, 0, 1); b = new SimpleBox (250, 20); t.Attach (b, 0, 2, 1, 2, AttachOptions.Expand, AttachOptions.Expand); b = new SimpleBox (300, 20); t.Attach (b, 1, 3, 2, 3); b = new SimpleBox (100, 20); t.Attach (b, 2, 3, 3, 4); b = new SimpleBox (450, 20); t.Attach (b, 0, 3, 4, 5); PackStart (t); HBox box = new HBox (); PackStart (box); t = new Table (); t.Attach (new Label ("One:"), 0, 1, 0, 1); t.Attach (new TextEntry (), 1, 2, 0, 1); t.Attach (new Label ("Two:"), 0, 1, 1, 2); t.Attach (new TextEntry (), 1, 2, 1, 2); t.Attach (new Label ("Three:"), 0, 1, 2, 3); t.Attach (new TextEntry (), 1, 2, 2, 3); box.PackStart (t); }
public ReferenceImageVerifierDialog() { Width = 500; Height = 300; Table table = new Table(); table.DefaultRowSpacing = table.DefaultColumnSpacing = 6; table.Attach(nameLabel = new Label(), 0, 0, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink); table.Attach(new Label("Reference Image"), 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink); table.Attach(new Label("Test Image"), 1, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink); nameLabel.Font = nameLabel.Font.WithWeight(Xwt.Drawing.FontWeight.Bold); img1 = new ImageView(); table.Attach(img1, 0, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill); imgDiff = new ImageView(); table.Attach(imgDiff, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill); img2 = new ImageView(); table.Attach(img2, 2, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill); var buttonBox = new HBox(); table.Attach(buttonBox, 0, 3, 3, 4, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink); closeButton = new Button("Close"); validButton = new Button("Success"); failButton = new Button("Failure"); buttonBox.PackEnd(closeButton); buttonBox.PackEnd(failButton); buttonBox.PackEnd(validButton); closeButton.Clicked += delegate { Respond(Command.Ok); }; failButton.Clicked += delegate { var info = ReferenceImageManager.ImageFailures[currentImage]; info.Fail(); ShowNextImage(); }; validButton.Clicked += delegate { var info = ReferenceImageManager.ImageFailures[currentImage]; info.Validate(); ShowNextImage(); }; Content = table; ShowNextImage(); }
public ReferenceImageVerifierDialog() { Width = 500; Height = 300; Table table = new Table (); table.DefaultRowSpacing = table.DefaultColumnSpacing = 6; table.Attach (nameLabel = new Label (), 0, 0, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink); table.Attach (new Label ("Reference Image"), 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink); table.Attach (new Label ("Test Image"), 1, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink); nameLabel.Font = nameLabel.Font.WithWeight (Xwt.Drawing.FontWeight.Bold); img1 = new ImageView (); table.Attach (img1, 0, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill); imgDiff = new ImageView (); table.Attach (imgDiff, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill); img2 = new ImageView (); table.Attach (img2, 2, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill); var buttonBox = new HBox (); table.Attach (buttonBox, 0, 3, 3, 4, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink); closeButton = new Button ("Close"); validButton = new Button ("Success"); failButton = new Button ("Failure"); buttonBox.PackEnd (closeButton); buttonBox.PackEnd (failButton); buttonBox.PackEnd (validButton); closeButton.Clicked += delegate { Respond (Command.Ok); }; failButton.Clicked += delegate { var info = ReferenceImageManager.ImageFailures[currentImage]; info.Fail (); ShowNextImage (); }; validButton.Clicked += delegate { var info = ReferenceImageManager.ImageFailures[currentImage]; info.Validate (); ShowNextImage (); }; Content = table; ShowNextImage (); }
public Tables() { Table t = new Table (); SimpleBox b = new SimpleBox (200, 20); t.Attach (b, 0, 1, 0, 1); b = new SimpleBox (5, 20); t.Attach (b, 1, 2, 0, 1); b = new SimpleBox (250, 20); t.Attach (b, 0, 2, 1, 2, AttachOptions.Expand, AttachOptions.Expand); b = new SimpleBox (300, 20); t.Attach (b, 1, 3, 2, 3); b = new SimpleBox (100, 20); t.Attach (b, 2, 3, 3, 4); b = new SimpleBox (450, 20); t.Attach (b, 0, 3, 4, 5); PackStart (t); HBox box = new HBox (); PackStart (box); t = new Table (); t.Attach (new Label ("One:"), 0, 1, 0, 1); t.Attach (new TextEntry (), 1, 2, 0, 1); t.Attach (new Label ("Two:"), 0, 1, 1, 2); t.Attach (new TextEntry (), 1, 2, 1, 2); t.Attach (new Label ("Three:"), 0, 1, 2, 3); t.Attach (new TextEntry (), 1, 2, 2, 3); t.InsertRow (1, 2); t.Attach (new Label ("One-and-a-half"), 0, 1, 1, 2); t.Attach (new TextEntry () { PlaceholderText = "Just inserted" }, 1, 2, 1, 2); t.InsertRow (1, 2); t.Attach (new SimpleBox (300, 20), 0, 2, 1, 2); box.PackStart (t); }
public Windows() { Button b = new Button ("Show borderless window"); PackStart (b); b.Clicked += delegate { Window w = new Window (); w.Decorated = false; Button c = new Button ("This is a window"); // c.Margin.SetAll (10); w.Content = c; c.Clicked += delegate { w.Dispose (); }; var bpos = b.ScreenBounds; w.ScreenBounds = new Rectangle (bpos.X, bpos.Y + b.Size.Height, w.Width, w.Height); w.Show (); }; b = new Button ("Show message dialog"); PackStart (b); b.Clicked += delegate { MessageDialog.ShowMessage (ParentWindow, "Hi there!"); }; Button db = new Button ("Show custom dialog"); PackStart (db); db.Clicked += delegate { Dialog d = new Dialog (); d.Title = "This is a dialog"; Table t = new Table (); t.Attach (new Label ("Some field:"), 0, 1, 0, 1); t.Attach (new TextEntry (), 1, 2, 0, 1); t.Attach (new Label ("Another field:"), 0, 1, 1, 2); t.Attach (new TextEntry (), 1, 2, 1, 2); d.Content = t; Command custom = new Command ("Custom"); d.Buttons.Add (new DialogButton (custom)); d.Buttons.Add (new DialogButton ("Custom OK", Command.Ok)); d.Buttons.Add (new DialogButton (Command.Cancel)); d.Buttons.Add (new DialogButton (Command.Ok)); var r = d.Run (this.ParentWindow); db.Label = "Result: " + r.Label; d.Dispose (); }; b = new Button ("Show Open File dialog"); PackStart (b); b.Clicked += delegate { OpenFileDialog dlg = new OpenFileDialog ("Select a file"); dlg.InitialFileName = "Some file"; dlg.Multiselect = true; dlg.Filters.Add (new FileDialogFilter ("Xwt files", "*.xwt")); dlg.Filters.Add (new FileDialogFilter ("All files", "*.*")); if (dlg.Run ()) MessageDialog.ShowMessage ("Files have been selected!", string.Join ("\n", dlg.FileNames)); }; b = new Button ("Show Save File dialog"); PackStart (b); b.Clicked += delegate { SaveFileDialog dlg = new SaveFileDialog ("Select a file"); dlg.InitialFileName = "Some file"; dlg.Multiselect = true; dlg.Filters.Add (new FileDialogFilter ("Xwt files", "*.xwt")); dlg.Filters.Add (new FileDialogFilter ("All files", "*.*")); if (dlg.Run ()) MessageDialog.ShowMessage ("Files have been selected!", string.Join ("\n", dlg.FileNames)); }; b = new Button ("Show Select Folder dialog (Multi select)"); PackStart (b); b.Clicked += delegate { SelectFolderDialog dlg = new SelectFolderDialog ("Select some folder"); dlg.Multiselect = true; if (dlg.Run ()) MessageDialog.ShowMessage ("Folders have been selected!", string.Join ("\n", dlg.Folders)); }; b = new Button ("Show Select Folder dialog (Single select)"); PackStart (b); b.Clicked += delegate { SelectFolderDialog dlg = new SelectFolderDialog ("Select a folder"); dlg.Multiselect = false; if (dlg.Run ()) MessageDialog.ShowMessage ("Folders have been selected!", string.Join ("\n", dlg.Folders)); }; b = new Button ("Show Select Color dialog"); PackStart (b); b.Clicked += delegate { SelectColorDialog dlg = new SelectColorDialog ("Select a color"); dlg.SupportsAlpha = true; dlg.Color = Xwt.Drawing.Colors.AliceBlue; if (dlg.Run (ParentWindow)) MessageDialog.ShowMessage ("A color has been selected!", dlg.Color.ToString ()); }; b = new Button("Show window shown event"); PackStart(b); b.Clicked += delegate { Window w = new Window(); w.Decorated = false; Button c = new Button("This is a window with events on"); w.Content = c; c.Clicked += delegate { w.Dispose(); }; w.Shown += (sender, args) => MessageDialog.ShowMessage("My Parent has been shown"); w.Hidden += (sender, args) => MessageDialog.ShowMessage("My Parent has been hidden"); w.Show(); }; }
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.Attach (hsBox, 0, 0); selBox.Attach (lightBox, 1, 0); box.PackStart (selBox); int entryWidth = 40; VBox entryBox = new VBox (); Table entryTable = new Table (); entryTable.Attach (new Label ("Color:"), 0, 0); entryTable.Attach (colorBox, 1, 5, 0, 1); entryTable.Attach (new HSeparator (), 0, 5, 1, 2); int r = 2; entryTable.Attach (new Label ("Hue:"), 0, r); entryTable.Attach (hueEntry = new TextEntry () { MinWidth = entryWidth }, 1, r++); entryTable.Attach (new Label ("Saturation:"), 0, r); entryTable.Attach (satEntry = new TextEntry () { MinWidth = entryWidth }, 1, r++); entryTable.Attach (new Label ("Light:"), 0, r); entryTable.Attach (lightEntry = new TextEntry () { MinWidth = entryWidth }, 1, r++); r = 2; entryTable.Attach (new Label ("Red:"), 3, r); entryTable.Attach (redEntry = new TextEntry () { MinWidth = entryWidth }, 4, r++); entryTable.Attach (new Label ("Green:"), 3, r); entryTable.Attach (greenEntry = new TextEntry () { MinWidth = entryWidth }, 4, r++); entryTable.Attach (new Label ("Blue:"), 3, r); entryTable.Attach (blueEntry = new TextEntry () { MinWidth = entryWidth }, 4, r++); Label label; entryTable.Attach (alphaSeparator = new HSeparator (), 0, 5, r, ++r); entryTable.Attach (label = new Label ("Opacity:"), 0, r); entryTable.Attach (alphaEntry = new TextEntry () { MinWidth = entryWidth }, 1, 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.Changed += HandleHslChanged; satEntry.Changed += HandleHslChanged; lightEntry.Changed += HandleHslChanged; redEntry.Changed += HandleRgbChanged; greenEntry.Changed += HandleRgbChanged; blueEntry.Changed += HandleRgbChanged; alphaEntry.Changed += HandleAlphaChanged; Color = Colors.White; }
public override Widget CreateWidget() { var t = new Table (); t.Attach (new Label ("Hello Worlds"), 0, 0); return t; }
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.Attach(hsBox, 0, 0); selBox.Attach(lightBox, 1, 0); box.PackStart(selBox); int entryWidth = 40; VBox entryBox = new VBox(); Table entryTable = new Table(); entryTable.Attach(new Label("Color:"), 0, 0); entryTable.Attach(colorBox, 1, 5, 0, 1); entryTable.Attach(new HSeparator(), 0, 5, 1, 2); int r = 2; entryTable.Attach(new Label("Hue:"), 0, r); entryTable.Attach(hueEntry = new TextEntry() { MinWidth = entryWidth }, 1, r++); entryTable.Attach(new Label("Saturation:"), 0, r); entryTable.Attach(satEntry = new TextEntry() { MinWidth = entryWidth }, 1, r++); entryTable.Attach(new Label("Light:"), 0, r); entryTable.Attach(lightEntry = new TextEntry() { MinWidth = entryWidth }, 1, r++); r = 2; entryTable.Attach(new Label("Red:"), 3, r); entryTable.Attach(redEntry = new TextEntry() { MinWidth = entryWidth }, 4, r++); entryTable.Attach(new Label("Green:"), 3, r); entryTable.Attach(greenEntry = new TextEntry() { MinWidth = entryWidth }, 4, r++); entryTable.Attach(new Label("Blue:"), 3, r); entryTable.Attach(blueEntry = new TextEntry() { MinWidth = entryWidth }, 4, r++); Label label; entryTable.Attach(alphaSeparator = new HSeparator(), 0, 5, r, ++r); entryTable.Attach(label = new Label("Opacity:"), 0, r); entryTable.Attach(alphaEntry = new TextEntry() { MinWidth = entryWidth }, 1, 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.Changed += HandleHslChanged; satEntry.Changed += HandleHslChanged; lightEntry.Changed += HandleHslChanged; redEntry.Changed += HandleRgbChanged; greenEntry.Changed += HandleRgbChanged; blueEntry.Changed += HandleRgbChanged; alphaEntry.Changed += HandleAlphaChanged; Color = Colors.White; }