public ButtonSample() { Button b1 = new Button("Click me"); b1.Clicked += delegate { b1.Label = "Clicked!"; }; PackStart(b1); Button b2 = new Button("Click me"); b2.Style = ButtonStyle.Flat; b2.Clicked += delegate { b2.Label = "Clicked!"; }; PackStart(b2); PackStart(new Button(StockIcons.ZoomIn.WithSize(22))); PackStart(new Button(new CustomImage().WithSize(22), "with red background") { BackgroundColor = Colors.Red }); MenuButton mb = new MenuButton("This is a Menu Button"); Menu men = new Menu(); men.Items.Add(new MenuItem("First")); men.Items.Add(new MenuItem("Second")); men.Items.Add(new MenuItem("Third")); men.Items.Add(new SeparatorMenuItem()); men.Items.Add(new CheckBoxMenuItem("Check") { Checked = true }); men.Items.Add(new RadioButtonMenuItem("Radio") { Checked = true }); men.Items.Add(new MenuItem("With image") { Image = Image.FromResource(typeof(App), "class.png") }); mb.Menu = men; PackStart(mb); foreach (var mi in men.Items) { var cmi = mi; mi.Clicked += delegate { mb.Label = cmi.Label + " Clicked"; }; } ToggleButton tb = new ToggleButton("Toggle me"); PackStart(tb); var b = new Button("Mini button"); b.Style = ButtonStyle.Borderless; PackStart(b); tb = new ToggleButton("Mini toggle"); tb.Style = ButtonStyle.Borderless; PackStart(tb); b = new Button(" ? "); b.Type = ButtonType.Help; PackStart(b); var child = new VBox(); var container = new MyWidget { Content = child }; var button = new Xwt.Button("Click to add a child"); button.Clicked += delegate { child.PackStart(new Xwt.Label("Child" + child.Children.Count())); }; var content = new Xwt.VBox(); content.PackStart(button); content.PackStart(container); PackStart(content); }
public ButtonSample() { Button b1 = new Button("Click me"); b1.Clicked += delegate { b1.Label = "Clicked!"; }; PackStart(b1, false, false); Button b2 = new Button("Click me"); b2.Style = ButtonStyle.Flat; b2.Clicked += delegate { b2.Label = "Clicked!"; }; PackStart(b2); PackStart(new Button(StockIcons.ZoomIn.WithSize(22))); PackStart(new Button(StockIcons.ZoomIn.WithSize(32), "Custom Size") { WidthRequest = 110, MinHeight = 50 }); var hbox = new HBox(); hbox.PackStart(new Button(StockIcons.ZoomIn.WithSize(22), "Zoom In") { ImagePosition = ContentPosition.Top }); hbox.PackStart(new Button(StockIcons.ZoomOut.WithSize(22), "Zoom Out") { ImagePosition = ContentPosition.Bottom }); hbox.PackStart(new Button(StockIcons.Information.WithSize(48), "Info") { ImagePosition = ContentPosition.Top }, true); hbox.PackEnd(new Button("Custom" + Environment.NewLine + "Width") { MinWidth = 110 }); PackStart(hbox); PackStart(new Button(new CustomImage().WithSize(22), "with red background") { BackgroundColor = Colors.Red }); MenuButton mb = new MenuButton("This is a Menu Button"); Menu men = new Menu(); men.Items.Add(new MenuItem("First")); men.Items.Add(new MenuItem("Second")); men.Items.Add(new MenuItem("Third")); men.Items.Add(new SeparatorMenuItem()); men.Items.Add(new MenuItem() { Markup = "<span color='blue'>Formatted</span> Item" }); men.Items.Add(new SeparatorMenuItem()); men.Items.Add(new CheckBoxMenuItem("Check") { Checked = true }); men.Items.Add(new RadioButtonMenuItem("Radio") { Checked = true }); men.Items.Add(new MenuItem("With image") { Image = Image.FromResource(typeof(App), "class.png") }); mb.Menu = men; PackStart(mb); foreach (var mi in men.Items) { var cmi = mi; mi.Clicked += delegate { mb.Markup = cmi.Markup ?? cmi.Label + " Clicked"; }; } ToggleButton tb1 = new ToggleButton("Toggle me"); ToggleButton tb2 = new ToggleButton("Mini toggle"); tb1.Toggled += delegate(object sender, EventArgs e) { if (tb1.Active) { tb1.Label = "Toggled"; } else { tb1.Label = "Untoggled"; } tb2.Active = tb1.Active; }; PackStart(tb1); var b = new Button("Mini button"); b.Style = ButtonStyle.Borderless; PackStart(b); tb2.Style = ButtonStyle.Borderless; tb2.Toggled += delegate(object sender, EventArgs e) { if (tb2.Active) { tb2.Label = "Toggled"; } else { tb2.Label = "Untoggled"; } tb1.Active = tb2.Active; }; PackStart(tb2); b = new Button(" ? "); b.Type = ButtonType.Help; PackStart(b); var fb = new Button("Formatted Content Button"); fb.Markup = "<b>Formatted</b> <span color='blue'>Content</span> Button"; PackStart(fb); var child = new VBox(); var container = new MyWidget { Content = child }; var button = new Xwt.Button("Click to add a child"); button.Clicked += delegate { child.PackStart(new Xwt.Label("Child" + child.Children.Count())); }; var content = new Xwt.VBox(); content.PackStart(button); content.PackStart(container); PackStart(content); }
public ButtonSample() { Button b1 = new Button ("Click me"); b1.Clicked += delegate { b1.Label = "Clicked!"; }; PackStart (b1); Button b2 = new Button ("Click me"); b2.Style = ButtonStyle.Flat; b2.Clicked += delegate { b2.Label = "Clicked!"; }; PackStart (b2); PackStart (new Button (Image.FromIcon (StockIcons.ZoomIn, IconSize.Medium))); MenuButton mb = new MenuButton ("This is a Menu Button"); Menu men = new Menu (); men.Items.Add (new MenuItem ("First")); men.Items.Add (new MenuItem ("Second")); men.Items.Add (new MenuItem ("Third")); men.Items.Add (new SeparatorMenuItem ()); men.Items.Add (new CheckBoxMenuItem ("Check") { Checked = true }); men.Items.Add (new RadioButtonMenuItem ("Radio") { Checked = true }); men.Items.Add (new MenuItem ("With image") { Image = Image.FromResource (typeof(App), "class.png") }); mb.Menu = men; PackStart (mb); foreach (var mi in men.Items) { var cmi = mi; mi.Clicked += delegate { mb.Label = cmi.Label + " Clicked"; }; } ToggleButton tb = new ToggleButton ("Toggle me"); PackStart (tb); var b = new Button ("Mini button"); b.Style = ButtonStyle.Borderless; PackStart (b); tb = new ToggleButton ("Mini toggle"); tb.Style = ButtonStyle.Borderless; PackStart (tb); var child = new VBox (); var container = new MyWidget { Content = child }; var button = new Xwt.Button ("Click to add a child"); button.Clicked += delegate { child.PackStart (new Xwt.Label ("Child" + child.Children.Count ()), BoxMode.Fill); }; var content = new Xwt.VBox (); content.PackStart (button, BoxMode.Fill); content.PackStart (container, BoxMode.Fill); PackStart (content); }
public ButtonSample () { Button b1 = new Button ("Click me"); b1.Clicked += delegate { b1.Label = "Clicked!"; }; PackStart (b1, false, false); Button b2 = new Button ("Click me"); b2.Style = ButtonStyle.Flat; b2.Clicked += delegate { b2.Label = "Clicked!"; }; PackStart (b2); PackStart (new Button (StockIcons.ZoomIn.WithSize (22))); PackStart (new Button (StockIcons.ZoomIn.WithSize (32), "Custom Size") { WidthRequest = 110, MinHeight = 50 }); var hbox = new HBox(); hbox.PackStart (new Button (StockIcons.ZoomIn.WithSize (22), "Zoom In") { ImagePosition = ContentPosition.Top }); hbox.PackStart (new Button (StockIcons.ZoomOut.WithSize (22), "Zoom Out") { ImagePosition = ContentPosition.Bottom }); hbox.PackStart (new Button (StockIcons.Information.WithSize (48), "Info") { ImagePosition = ContentPosition.Top }, true); hbox.PackEnd (new Button ("Custom" + Environment.NewLine + "Width") { MinWidth = 110 }); PackStart (hbox); PackStart (new Button (new CustomImage ().WithSize (22), "with red background") { BackgroundColor = Colors.Red }); MenuButton mb = new MenuButton ("This is a Menu Button"); Menu men = new Menu (); men.Items.Add (new MenuItem ("First")); men.Items.Add (new MenuItem ("Second")); men.Items.Add (new MenuItem ("Third")); men.Items.Add (new SeparatorMenuItem ()); men.Items.Add (new CheckBoxMenuItem ("Check") { Checked = true }); men.Items.Add (new RadioButtonMenuItem ("Radio") { Checked = true }); men.Items.Add (new MenuItem ("With image") { Image = Image.FromResource (typeof(App), "class.png") }); mb.Menu = men; PackStart (mb); foreach (var mi in men.Items) { var cmi = mi; mi.Clicked += delegate { mb.Label = cmi.Label + " Clicked"; }; } ToggleButton tb1 = new ToggleButton ("Toggle me"); ToggleButton tb2 = new ToggleButton ("Mini toggle"); tb1.Toggled += delegate(object sender, EventArgs e) { if (tb1.Active) tb1.Label = "Toggled"; else tb1.Label = "Untoggled"; tb2.Active = tb1.Active; }; PackStart (tb1); var b = new Button ("Mini button"); b.Style = ButtonStyle.Borderless; PackStart (b); tb2.Style = ButtonStyle.Borderless; tb2.Toggled += delegate(object sender, EventArgs e) { if (tb2.Active) tb2.Label = "Toggled"; else tb2.Label = "Untoggled"; tb1.Active = tb2.Active; }; PackStart (tb2); b = new Button (" ? "); b.Type = ButtonType.Help; PackStart (b); var child = new VBox (); var container = new MyWidget { Content = child }; var button = new Xwt.Button ("Click to add a child"); button.Clicked += delegate { child.PackStart (new Xwt.Label ("Child" + child.Children.Count ())); }; var content = new Xwt.VBox (); content.PackStart (button); content.PackStart (container); PackStart (content); }