static void Main(string[] args) { #if GTK Application.Initialize(Xwt.ToolkitType.Gtk); #else Application.Initialize(Xwt.ToolkitType.XamMac); #endif var mainWindow = new MacXwtAccInspectorWindow(); mainWindow.Width = 1024; mainWindow.Height = 768; mainWindow.Title = "Example Debug Xwt.Mac"; var verticalBox = new Xwt.VBox(); mainWindow.Content = verticalBox; var hbox = new Xwt.HBox(); hbox.PackStart(new Xwt.Label("First")); hbox.PackStart(new Xwt.Label("Second")); hbox.PackStart(new Xwt.TextEntry() { Text = "Text1" }); hbox.PackStart(new Xwt.Button() { Label = "Button1" }); verticalBox.PackStart(hbox); mainWindow.Show(); Application.Run(); mainWindow.Dispose(); }
private void Build() { this.Icon = Xwt.Drawing.Image.FromResource("URMSimulator.Resources.urm.png"); this.Title = "About"; this.Resizable = false; this.Buttons.Add(new DialogButton(Command.Close)); vbox1 = new VBox(); image1 = new ImageView(); image1.WidthRequest = 320; image1.HeightRequest = 270; vbox1.PackStart(image1); labelProgramName = new Label(); labelProgramName.TextAlignment = Alignment.Center; vbox1.PackStart(labelProgramName); labelComments = new Label(); labelComments.TextAlignment = Alignment.Center; vbox1.PackStart(labelComments); hbox1 = new HBox(); hbox1.PackStart(new HBox(), true); labelWebsite = new LinkLabel(); labelWebsite.TextAlignment = Alignment.Center; //text aligment doesn't work with Xwt.WPF hbox1.PackStart(labelWebsite, false); hbox1.PackStart(new HBox(), true); vbox1.PackStart(hbox1); this.Content = vbox1; }
public MainWindow() { this.Examples = ExampleLibrary.Examples.GetList().OrderBy(e => e.Category).ToList(); this.plotView = new PlotView(); this.plotView.MinHeight = 554; this.plotView.MinWidth = 625; this.plotView.DefaultTrackerSettings.Enabled = true; this.plotView.DefaultTrackerSettings.Background = Xwt.Drawing.Colors.AliceBlue.WithAlpha (0.9).ToOxyColor(); this.treeView = new TreeView(); this.treeView.MinWidth = 314; this.treeView.Visible = true; var treeModel = new TreeStore(nameCol); TreePosition categoryNode = null; string categoryName = null; foreach (var ex in this.Examples) { if (categoryName == null || categoryName != ex.Category) { categoryNode = treeModel.AddNode ().SetValue (nameCol, ex.Category).CurrentPosition; categoryName = ex.Category; } treeModel.AddNode (categoryNode).SetValue (nameCol, ex.Title); } treeView.Columns.Add ("Example", nameCol); this.treeView.DataSource = treeModel; this.treeView.SelectionChanged += (s, e) => { if (treeView.SelectedRow != null) { var sample = treeModel.GetNavigatorAt (treeView.SelectedRow).GetValue (nameCol); var info = this.Examples.FirstOrDefault(ex => ex.Title == sample); if (info != null) { this.SelectedExample = info; } } }; var hbox = new HBox(); hbox.Spacing = 6; hbox.MinHeight = 554; hbox.MinWidth = 943; hbox.PackStart(this.treeView); hbox.PackStart(this.plotView, true); Content = hbox; this.SelectedExample = this.Examples.FirstOrDefault(); this.Title = "OxyPlot.Xwt Example Browser"; this.CloseRequested += (s, a) => Application.Exit (); }
void BuildGui() { this.Title = GettextCatalog.GetString("Select Work Item"); VBox content = new VBox(); HBox mainBox = new HBox(); queryView.Columns.Add(new ListViewColumn(string.Empty, new TextCellView(titleField))); queryView.DataSource = queryStore; queryView.WidthRequest = 200; BuildQueryView(); mainBox.PackStart(queryView); workItemList.WidthRequest = 400; workItemList.HeightRequest = 400; workItemList.ShowCheckboxes = true; mainBox.PackStart(workItemList, true, true); content.PackStart(mainBox, true, true); HBox buttonBox = new HBox(); Button okButton = new Button(GettextCatalog.GetString("Ok")); okButton.WidthRequest = Constants.ButtonWidth; okButton.Clicked += (sender, e) => Respond(Command.Ok); buttonBox.PackEnd(okButton); content.PackStart(buttonBox); //this.Resizable = false; this.Content = content; AttachEvents(); }
public ThemedImages() { Context.RegisterStyles ("dark", "sel"); var img = Image.FromResource ("zoom-in-16.png"); var img_sel = Image.FromResource ("zoom-in-16.png").WithStyles("sel"); var img_dark = Image.FromResource ("zoom-in-16.png").WithStyles("dark"); var img_dark_sel = Image.FromResource ("zoom-in-16.png").WithStyles("dark", "sel"); var img_row = new HBox (); ImageView imgv = new ImageView () { Image = img }; ImageView imgv_sel = new ImageView () { Image = img_sel }; ImageView imgv_dark = new ImageView () { Image = img_dark }; ImageView imgv_dark_sel = new ImageView () { Image = img_dark_sel }; img_row.PackStart (imgv); img_row.PackStart (imgv_sel); img_row.PackStart (imgv_dark); img_row.PackStart (imgv_dark_sel); PackStart (img_row); var btn_row = new HBox (); Button btn = new Button (img); Button btn_sel = new Button (img_sel); Button btn_dark = new Button (img_dark); Button btn_dark_sel = new Button (img_dark_sel); btn_row.PackStart (btn); btn_row.PackStart (btn_sel); btn_row.PackStart (btn_dark); btn_row.PackStart (btn_dark_sel); PackStart (btn_row); }
void BuildGui() { HBox topPanel = new HBox(); topPanel.MarginTop = 5; VSeparator separator = new VSeparator(); acceptYours.WidthRequest = acceptTheirs.WidthRequest = acceptMerge.WidthRequest = viewBase.WidthRequest = viewTheir.WidthRequest = 120; SetButtonSensitive(); topPanel.PackStart(acceptYours); topPanel.PackStart(acceptTheirs); topPanel.PackStart(acceptMerge); topPanel.PackStart(separator); topPanel.PackStart(viewBase); topPanel.PackStart(viewTheir); topPanel.MinHeight = 30; view.PackStart(topPanel); listView.Columns.Add("Conflict Type", typeField); listView.Columns.Add("Item Name", nameField); listView.Columns.Add("Base Version", versionBaseField); listView.Columns.Add("Server Version", versionTheirField); listView.Columns.Add("Your Version", versionYourField); listView.DataSource = listStore; view.PackStart(listView, true, true); AttachEvents(); }
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 ReportViewer() { // Setup layout boxes vboxContents = new Xwt.VBox(); vboxToolMenu = new Xwt.HBox(); // Setup tool button menu Xwt.Button buttonExport = new Xwt.Button("Export"); buttonExport.Clicked += delegate(object sender, EventArgs e) { SaveAs(); }; vboxToolMenu.PackStart(buttonExport); Xwt.Button buttonPrint = new Xwt.Button("Print"); vboxToolMenu.PackStart(buttonPrint); // Add vboxContent widgets vboxPages = new Xwt.VBox(); vboxContents.PackStart(vboxToolMenu); vboxContents.PackStart(vboxPages); // Setup Controls Contents scrollView = new Xwt.ScrollView(); scrollView.Content = vboxContents; scrollView.VerticalScrollPolicy = ScrollPolicy.Automatic; scrollView.BorderVisible = true; this.PackStart(scrollView, true, true); Parameters = new ListDictionary(); ShowErrors = false; }
public DependenciesSectionWidget (IConfigurationSection section) { this.section = section; widget = new VBox (); if (this.section.Service.Dependencies.Length == 0) { widget.PackStart (new Label { Text = GettextCatalog.GetString ("This service has no dependencies") }); return; } bool firstCategory = true; foreach (var category in this.section.Service.Dependencies.Select (d => d.Category).Distinct ()) { var categoryIcon = new ImageView (category.Icon.WithSize (IconSize.Small)); var categoryLabel = new Label (category.Name); var categoryBox = new HBox (); if (!firstCategory) categoryBox.MarginTop += 5; categoryBox.PackStart (categoryIcon); categoryBox.PackStart (categoryLabel); widget.PackStart (categoryBox); foreach (var dependency in this.section.Service.Dependencies.Where (d => d.Category == category)) { widget.PackStart (new DependencyWidget (section.Service, dependency) { MarginLeft = category.Icon.Size.Width / 2 }); } if (firstCategory) firstCategory = false; } }
public TaskView(IQueueableTask task) { if (task == null) throw new ArgumentNullException(nameof(task)); Task = task; task.StatusChanged += Task_StatusChanged; _nameLabel = new Label { Font = Font.SystemFont.WithWeight(FontWeight.Bold).WithSize(15) }; _descriptionlabel = new Label { Font = Font.SystemFont.WithStyle(FontStyle.Italic) }; _spinner = new Spinner {Visible = false}; var hBox = new HBox(); hBox.PackStart(_spinner); hBox.PackStart(_descriptionlabel); PackStart(_nameLabel); PackStart(hBox); HeightRequest = 64; MinHeight = 64; UpdateLabels(); }
public ReportViewer() { // Setup layout boxes vboxContents = new Xwt.VBox(); vboxToolMenu = new Xwt.HBox(); // Setup tool button menu Xwt.Button buttonExport = new Xwt.Button("Export"); buttonExport.Clicked += delegate(object sender, EventArgs e) { SaveAs(); }; vboxToolMenu.PackStart(buttonExport); Xwt.Button buttonPrint = new Xwt.Button("Print"); vboxToolMenu.PackStart(buttonPrint); // Add vboxContent widgets vboxPages = new Xwt.VBox(); vboxContents.PackStart(vboxToolMenu); vboxContents.PackStart(vboxPages); // Setup Controls Contents scrollView = new Xwt.ScrollView(); scrollView.Content = vboxContents; scrollView.VerticalScrollPolicy = ScrollPolicy.Automatic; scrollView.BorderVisible = true; this.PackStart(scrollView, BoxMode.FillAndExpand); Parameters = new ListDictionary(); ShowErrors = false; }
Widget CreateEditPane() { var hbox = new HBox(); hbox.PackStart(new Toolpane()); hbox.PackStart(new TileEditor()); hbox.PackStart(new PreviewPane()); return hbox; }
public MainWindow() { Menu menu = new Menu (); var file = new MenuItem ("File"); file.SubMenu = new Menu (); file.SubMenu.Items.Add (new MenuItem ("Open")); file.SubMenu.Items.Add (new MenuItem ("New")); file.SubMenu.Items.Add (new MenuItem ("Close")); menu.Items.Add (file); var edit = new MenuItem ("Edit"); edit.SubMenu = new Menu (); edit.SubMenu.Items.Add (new MenuItem ("Copy")); edit.SubMenu.Items.Add (new MenuItem ("Cut")); edit.SubMenu.Items.Add (new MenuItem ("Paste")); menu.Items.Add (edit); MainMenu = menu; HBox box = new HBox (); icon = Image.FromResource (typeof(App), "class.png"); store = new TreeStore (nameCol, iconCol, widgetCol); samplesTree = new TreeView (); samplesTree.Columns.Add ("Name", iconCol, nameCol); AddSample (null, "Boxes", typeof(Boxes)); AddSample (null, "Buttons", typeof(ButtonSample)); AddSample (null, "ComboBox", typeof(ComboBoxes)); // AddSample (null, "Designer", typeof(Designer)); AddSample (null, "Drag & Drop", typeof(DragDrop)); var n = AddSample (null, "Drawing", null); AddSample (n, "Canvas with Widget", typeof(CanvasWithWidget)); AddSample (n, "Chart", typeof(ChartSample)); AddSample (n, "Transformations", typeof(DrawingTransforms)); AddSample (null, "Images", typeof(Images)); AddSample (null, "List View", typeof(ListView1)); AddSample (null, "Notebook", typeof(NotebookSample)); // AddSample (null, "Scroll View", typeof(ScrollWindowSample)); AddSample (null, "Text Entry", typeof(TextEntries)); AddSample (null, "Windows", typeof(Windows)); samplesTree.DataSource = store; box.PackStart (samplesTree); sampleBox = new VBox (); title = new Label ("Sample:"); sampleBox.PackStart (title, BoxMode.None); box.PackStart (sampleBox, BoxMode.FillAndExpand); Content = box; samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged; }
private IEnumerable<Tile> LoadTiles() { yield return CreateTile("Visit ParkitectNexus", App.DImages["parkitectnexus_logo-64x64.png"], Color.FromBytes(0xf3, 0x77, 0x35), _website.Launch); if (OperatingSystem.Detect() == SupportedOperatingSystem.Linux) yield return CreateTile("Download URL", App.DImages["appbar.browser.wire.png"], Color.FromBytes(0xf3, 0x77, 0x35), () => { var entry = new TextEntry(); var box = new HBox(); box.PackStart(new Label("URL:")); box.PackStart(entry, true, true); var dialog = new Dialog { Width = 300, Icon = ParentWindow.Icon, Title = "Enter URL to download", Content = box }; dialog.Buttons.Add(new DialogButton(Command.Cancel)); dialog.Buttons.Add(new DialogButton(Command.Ok)); var result = dialog.Run(ParentWindow); NexusUrl url; if (result.Label.ToLower() == "ok" && NexusUrl.TryParse(entry.Text, out url)) ObjectFactory.GetInstance<IApp>().HandleUrl(url); dialog.Dispose(); }); yield return CreateTile("Launch Parkitect", App.DImages["parkitect_logo.png"], Color.FromBytes(45, 137, 239), () => { _parkitect.Launch(); }); yield return CreateTile("Help", App.DImages["appbar.information.png"], Color.FromBytes(45, 137, 239), () => { // Temporary help solution. Process.Start( "https://parkitectnexus.com/forum/2/parkitectnexus-website-client/70/troubleshooting-mods-and-client"); }); yield return CreateTile("Donate!", App.DImages["appbar.thumbs.up.png"], Color.FromBytes(45, 137, 239), () => { if (MessageDialog.AskQuestion("Maintaining this client and adding new features takes a lot of time.\n" + "If you appreciate our work, please consider sending a donation our way!\n" + "All donations will be used for further development of the ParkitectNexus Client and the website.\n" + "\nSelect Yes to visit PayPal and send a donation.", 1, Command.No, Command.Yes) == Command.Yes) { Process.Start("https://paypal.me/ikkentim"); } }); }
public MyCanvas() { var entry = new TextEntry () { ShowFrame = false }; AddChild (entry, rect); var box = new HBox (); box.PackStart (new Button ("...")); box.PackStart (new TextEntry (), BoxMode.FillAndExpand); AddChild (box, new Rectangle (30, 70, 100, 30)); }
public MyCanvas(bool linear) { var entry = new TextEntry () { ShowFrame = false }; AddChild (entry, rect); var box = new HBox (); box.PackStart (new Button ("...")); box.PackStart (new TextEntry (), true); AddChild (box, new Rectangle (30, 70, 100, 30)); Linear = linear; }
public ProgressWidget() { ProgressMonitor = new ProgressMonitor { Handler = new ProgressWidgetMonitor(this) }; progressBar = new ProgressBar(); text = new Label(); var box = new HBox(); box.PackStart(progressBar); box.PackStart(text, true); Content = box; }
public Boxes() { HBox box1 = new HBox (); VBox box2 = new VBox (); box2.PackStart (new SimpleBox (30), BoxMode.None); box2.PackStart (new SimpleBox (30), BoxMode.None); box2.PackStart (new SimpleBox (30), BoxMode.FillAndExpand); box1.PackStart (box2, BoxMode.FillAndExpand); box1.PackStart (new SimpleBox (30), BoxMode.None); box1.PackStart (new SimpleBox (30), BoxMode.Expand); PackStart (box1, BoxMode.None); HBox box3 = new HBox (); box3.PackEnd (new SimpleBox (30)); box3.PackStart (new SimpleBox (20) {Color = new Color (1, 0.5, 0.5)}); box3.PackEnd (new SimpleBox (40)); box3.PackStart (new SimpleBox (10) {Color = new Color (1, 0.5, 0.5)}); box3.PackEnd (new SimpleBox (30)); box3.PackStart (new SimpleBox (10) {Color = new Color (1, 0.5, 0.5)}, BoxMode.FillAndExpand); PackStart (box3); HBox box4 = new HBox (); Button b = new Button ("Click me"); b.Clicked += delegate { b.Label = "Button has grown"; }; box4.PackStart (new SimpleBox (30), BoxMode.FillAndExpand); box4.PackStart (b); box4.PackStart (new SimpleBox (30), BoxMode.FillAndExpand); PackStart (box4); HBox box5 = new HBox (); Button b2 = new Button ("Hide / Show"); box5.PackStart (new SimpleBox (30), BoxMode.FillAndExpand); var hsb = new SimpleBox (20); box5.PackStart (hsb, BoxMode.None); box5.PackStart (b2); box5.PackStart (new SimpleBox (30), BoxMode.FillAndExpand); b2.Clicked += delegate { hsb.Visible = !hsb.Visible; }; PackStart (box5); HBox box6 = new HBox (); for (int n=0; n<15; n++) { var w = new Label ("TestLabel" + n); w.MinWidth = 10; box6.PackStart (w); } PackStart (box6); }
public DeviceListControl() { deviceListStoreMirror = new List <DeviceInfo> (); uiThreadScheduler = TaskScheduler.Current; // // Device List // deviceListStore = new ListStore(idField, enabledField, nameField); deviceListView = new ListView(deviceListStore); var enabledColumn = new Xwt.ListViewColumn( "Enabled", new Xwt.CheckBoxCellView(enabledField) { Editable = true }); deviceListView.Columns.Add(enabledColumn); var nameColumn = new Xwt.ListViewColumn( "Device", new Xwt.TextCellView(nameField) { Editable = false }); deviceListView.Columns.Add(nameColumn); deviceList.CollectionChanged += (s, e) => { Application.Invoke(() => Devices_CollectionChanged(s, e)); }; PrepopulateList(); deviceListView.ButtonPressed += DeviceListView_ButtonPressed; // // Toolbar // var toolbar = new Xwt.HBox(); toolbar.PackStart(refreshButton); toolbar.PackStart(statusLabel); refreshButton.Clicked += RefreshButton_Clicked; // // Main UI // var vbox = new Xwt.VBox(); vbox.PackStart(toolbar); vbox.PackStart(deviceListView, fill: true, expand: true); Widget = vbox; }
void BuildGui() { this.Title = GettextCatalog.GetString("Rename item") + ": " + item.ServerPath.ItemName; this.Resizable = false; var content = new HBox(); content.PackStart(new Label(GettextCatalog.GetString("New name") + ":")); nameEntry.Text = item.ServerPath.ItemName; nameEntry.WidthRequest = 200; content.PackStart(nameEntry); this.Buttons.Add(Command.Ok, Command.Cancel); this.Content = content; }
void BuildGui() { this.Title = "Get"; this.Resizable = false; VBox content = new VBox(); content.PackStart(new Label(GettextCatalog.GetString("Files") + ":")); listStore = new ListStore(itemField, isSelectedField, nameField, pathField); var checkSell = new CheckBoxCellView(isSelectedField); checkSell.Editable = true; listView.Columns.Add("Name", checkSell, new TextCellView(nameField)); listView.Columns.Add("Folder", new TextCellView(pathField)); listView.MinHeight = 200; listView.DataSource = listStore; content.PackStart(listView); HBox typeBox = new HBox(); typeBox.PackStart(new Label(GettextCatalog.GetString("Version") + ":")); versionBox.Items.Add(0, "Changeset"); versionBox.Items.Add(1, "Latest Version"); versionBox.SelectedItem = 1; versionBox.SelectionChanged += (sender, e) => changeSetNumber.Visible = (int)versionBox.SelectedItem == 0; typeBox.PackStart(versionBox); changeSetNumber.Visible = false; changeSetNumber.WidthRequest = 100; changeSetNumber.MinimumValue = 1; changeSetNumber.MaximumValue = int.MaxValue; changeSetNumber.Value = 0; changeSetNumber.IncrementValue = 1; changeSetNumber.Digits = 0; typeBox.PackStart(changeSetNumber); content.PackStart(typeBox); content.PackStart(forceGet); //content.PackStart(overrideGet); HBox buttonBox = new HBox(); Button okButton = new Button(GettextCatalog.GetString("Get")); okButton.Clicked += OnGet; Button cancelButton = new Button(GettextCatalog.GetString("Cancel")); cancelButton.Clicked += (sender, e) => Respond(Command.Cancel); okButton.WidthRequest = cancelButton.WidthRequest = Constants.ButtonWidth; buttonBox.PackEnd(cancelButton); buttonBox.PackEnd(okButton); content.PackStart(buttonBox); this.Content = content; }
private void Build(string tooltipText) { hbox1 = new HBox(); entry1 = new TextEntry(); hbox1.PackStart(entry1, true); image1 = new ImageView(); image1.Image = StockIcons.Warning; image1.TooltipText = tooltipText; hbox1.PackStart(image1); this.Content = hbox1; }
public CodeIssuePadControl () { var buttonRow = new HBox(); runButton.Clicked += StartAnalyzation; buttonRow.PackStart (runButton); cancelButton.Clicked += StopAnalyzation; cancelButton.Sensitive = false; buttonRow.PackStart (cancelButton); var groupingProvider = new CategoryGroupingProvider { Next = new ProviderGroupingProvider() }; rootGroup = new IssueGroup (groupingProvider, "root group"); var groupingProviderControl = new GroupingProviderChainControl (rootGroup, groupingProviders); buttonRow.PackStart (groupingProviderControl); PackStart (buttonRow); store = new TreeStore (textField, nodeField); view.DataSource = store; view.HeadersVisible = false; view.Columns.Add ("Name", textField); view.SelectionMode = SelectionMode.Multiple; view.RowActivated += OnRowActivated; view.RowExpanding += OnRowExpanding; view.ButtonPressed += HandleButtonPressed; view.ButtonReleased += HandleButtonReleased; PackStart (view, true); IIssueTreeNode node = rootGroup; node.ChildrenInvalidated += (sender, group) => { Application.Invoke (delegate { ClearSiblingNodes (store.GetFirstNode ()); store.Clear (); SyncStateToUi (runner.State); foreach(var child in ((IIssueTreeNode)rootGroup).Children) { var navigator = store.AddNode (); SetNode (navigator, child); SyncNode (navigator); } }); }; node.ChildAdded += HandleRootChildAdded; runner.IssueSink = rootGroup; runner.AnalysisStateChanged += HandleAnalysisStateChanged; }
public MyCanvas (bool linear) { var entry = new TextEntry () { ShowFrame = false }; AddChild (entry, rect); var box = new HBox (); box.PackStart (new Button ("...")); box.PackStart (new TextEntry (), true); AddChild (box, new Rectangle (30, 70, box.Surface.GetPreferredSize().Width, 30)); Linear = linear; stop1 = new Color (0, 1, 0); stop2 = new Color (1, 0, 0); xStart = xEnd = 0; }
public AppWindow() { nativeToolkit = Toolkit.Load (ToolkitType.Cocoa); HBox box = new HBox (); var b = new Button ("Gtk Test Window"); b.Clicked += HandleClicked; box.PackStart (b); b = new Button ("Cocoa Test Window"); b.Clicked += HandleClickedCocoa; box.PackStart (b); Content = box; }
public void Focus() { using (var win = new Window ()) { var w = CreateWidget (); HBox box = new HBox (); TextEntry e = new TextEntry (); box.PackStart (e); box.PackStart (w); win.Content = box; win.Show (); win.Present (); Application.MainLoop.DispatchPendingEvents (); e.SetFocus (); Application.MainLoop.DispatchPendingEvents (); Assert.IsFalse (w.HasFocus); // Assert.IsTrue (w.CanGetFocus); int gotFocus = 0; w.GotFocus += delegate { gotFocus++; }; w.SetFocus (); if (w.CanGetFocus) { Assert.IsTrue (w.HasFocus); Assert.AreEqual (1, gotFocus); int lostFocus = 0; w.LostFocus += delegate { lostFocus++; }; e.SetFocus (); Assert.IsFalse (w.HasFocus); // Assert.AreEqual (1, lostFocus); } else { Assert.IsFalse (w.HasFocus); Assert.AreEqual (0, gotFocus); } } }
public MainView(IPresenterFactory presenterFactory) { _notebook = presenterFactory.InstantiatePresenter<MainNotebook>(); _notebook.Add(presenterFactory.InstantiatePresenter<MenuPageView>(this)); _notebook.Add(presenterFactory.InstantiatePresenter<ModsPageView>(this)); _notebook.Add(presenterFactory.InstantiatePresenter<BlueprintsPageView>(this)); _notebook.Add(presenterFactory.InstantiatePresenter<SavegamesPageView>(this)); _notebook.Add(presenterFactory.InstantiatePresenter<TasksPageView>(this)); PackStart(presenterFactory.InstantiatePresenter<MainHeaderView>()); var sideBox = new VBox { MinWidth = 280, WidthRequest = 280 }; _sidebarContainer = new SidebarContainer(); sideBox.PackStart(_sidebarContainer, true, true); var box = new HBox(); box.PackStart(_notebook, true); box.PackEnd(sideBox); PackStart(box, true, true); _notebook.HandleSizeChangeOnTabChange = true; _notebook.HandleSizeUpdate(); }
public DragDrop() { HBox box = new HBox (); SimpleBox b1 = new SimpleBox (30); box.PackStart (b1, BoxMode.None); b2 = new Button ("Drop here"); box.PackEnd (b2, BoxMode.None); b1.ButtonPressed += delegate { var d = b1.CreateDragOperation (); d.Data.AddValue ("Hola"); var img = Image.FromResource (GetType(), "class.png"); d.SetDragImage (img, (int)img.Size.Width, (int)img.Size.Height); d.AllowedActions = DragDropAction.All; d.Start (); }; b2.SetDragDropTarget (TransferDataType.Text, TransferDataType.Uri); PackStart (box); b2.DragDrop += HandleB2DragDrop; b2.DragOver += HandleB2DragOver; }
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 LauncherWindow() { this.Title = "TrueCraft Launcher"; this.Width = 1200; this.Height = 576; this.User = new TrueCraftUser(); MainContainer = new HBox(); WebScrollView = new ScrollView(); WebView = new WebView("http://truecraft.io/updates"); LoginView = new LoginView(this); OptionView = new OptionView(this); MultiplayerView = new MultiplayerView(this); SingleplayerView = new SingleplayerView(this); InteractionBox = new VBox(); using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TrueCraft.Launcher.Content.truecraft_logo.svg")) TrueCraftLogoImage = new ImageView(Image.FromStream(stream)); WebScrollView.Content = WebView; MainContainer.PackStart(WebScrollView, true); InteractionBox.PackStart(TrueCraftLogoImage); InteractionBox.PackEnd(LoginView); MainContainer.PackEnd(InteractionBox); this.Content = MainContainer; }
public ClipboardSample () { HBox box = new HBox (); var source = new TextEntry (); box.PackStart (source); Button b = new Button ("Copy"); box.PackStart (b); b.Clicked += delegate { Clipboard.SetText (source.Text); }; PackStart (box); box = new HBox (); var dest = new TextEntry (); box.PackStart (dest); b = new Button ("Paste"); box.PackStart (b); b.Clicked += delegate { dest.Text = Clipboard.GetText (); }; PackStart (box); PackStart (new HSeparator ()); box = new HBox (); b = new Button ("Copy complex object"); box.PackStart (b); int n = 0; b.Clicked += delegate { Clipboard.SetData (new ComplexObject () { Data = "Hello world " + (++n) }); }; PackStart (box); box = new HBox (); var destComplex = new TextEntry (); box.PackStart (destComplex); b = new Button ("Paste complex object"); box.PackStart (b); b.Clicked += delegate { ComplexObject ob = Clipboard.GetData<ComplexObject> (); if (ob != null) destComplex.Text = ob.Data; else destComplex.Text = "Data not found"; }; PackStart (box); }
public AppWindow () { nativeToolkit = Toolkit.Load (ToolkitType.Cocoa); HBox box = new HBox (); var b = new Button ("Gtk Test Window"); b.Clicked += HandleClicked; box.PackStart (b, BoxMode.FillAndExpand); b = nativeToolkit.CreateObject<Button> (); b.Label = "Cocoa Test Window"; b.Clicked += HandleClickedCocoa; var wped = Toolkit.CurrentEngine.WrapWidget (b); box.PackStart (wped, BoxMode.FillAndExpand); Content = box; }
public void InvalidAdd2 () { MyContainer co = new MyContainer (); var c1 = new Label ("hi1"); HBox b = new HBox (); b.PackStart (c1); co.InternalAdd (c1); }
public RunConfigurationsPanelWidget(RunConfigurationsPanel panel, OptionsDialog dialog) { this.panel = panel; this.Margin = 6; Spacing = 6; list = new RunConfigurationsList(); this.PackStart(list, true); var box = new Xwt.HBox(); box.Spacing = 6; var btn = new Xwt.Button(GettextCatalog.GetString("New")); btn.Clicked += OnAddConfiguration; box.PackStart(btn, false); copyButton = new Xwt.Button(GettextCatalog.GetString("Duplicate")); copyButton.Clicked += OnCopyConfiguration; box.PackStart(copyButton, false); renameButton = new Xwt.Button(GettextCatalog.GetString("Rename")); renameButton.Clicked += OnRenameConfiguration; box.PackStart(renameButton, false); removeButton = new Xwt.Button(GettextCatalog.GetString("Remove")); removeButton.Clicked += OnRemoveConfiguration; box.PackEnd(removeButton, false); Fill(); this.PackStart(box, false); list.SelectionChanged += (sender, e) => UpdateButtons(); list.RowActivated += (sender, e) => panel.ShowConfiguration((ProjectRunConfiguration)list.SelectedConfiguration); UpdateButtons(); }
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; }