public ListViewEntries() { ListView list = new ListView (); var editableTextField = new DataField<string> (); var nonEditableTextField = new DataField<string> (); ListStore store = new ListStore (editableTextField, nonEditableTextField); list.DataSource = store; list.GridLinesVisible = GridLines.Horizontal; var textCellView = new TextCellView { Editable = true, TextField = editableTextField }; list.Columns.Add (new ListViewColumn ("Editable", textCellView)); list.Columns.Add (new ListViewColumn ("Not Editable", new TextCellView { Editable = false, TextField = nonEditableTextField })); Random rand = new Random (); for (int n = 0; n < 10; n++) { var r = store.AddRow (); store.SetValue (r, editableTextField, "Editable value " + n); store.SetValue (r, nonEditableTextField, "Non-editable value " + n); } PackStart (list, true); var btn = new Button ("Add Row"); btn.Clicked += delegate { var row = store.AddRow (); store.SetValues (row, editableTextField, "New editable text", nonEditableTextField, "New non-editable text"); list.StartEditingCell (row, textCellView); }; PackStart (btn, false, hpos: WidgetPlacement.Start); }
internal void Init(string title, ImmutableArray <ISymbol> members, ImmutableArray <PickMembersOption> options) { this.Title = title; listBoxPublicMembers.Accessible.Description = title; this.Options = options; treeStore.Clear(); foreach (var member in members) { var row = treeStore.AddRow(); treeStore.SetValue(row, symbolIncludedField, false); treeStore.SetValue(row, symbolField, member); treeStore.SetValue(row, symbolTextField, member.ToDisplayString(memberDisplayFormat)); treeStore.SetValue(row, symbolIconField, ImageService.GetIcon(MonoDevelop.Ide.TypeSystem.Stock.GetStockIcon(member))); } if (!options.IsDefaultOrEmpty) { foreach (var option in options) { var checkBox = new CheckBox(option.Title); checkBox.State = option.Value ? CheckBoxState.On : CheckBoxState.Off; checkBox.Toggled += delegate { option.Value = !option.Value; }; contentVBox.PackStart(checkBox); } } }
private void DrawSelectedAsset(AssetProperties assetProperties) { _selectedAssetStore.Clear(); foreach (var file in assetProperties.Asset.Files) { var row = _selectedAssetStore.AddRow(); _selectedAssetStore.SetValue(row, _selectedAssetNameField, file.ReducedPath); var imageSize = imageService.GetImageSize(file.Path); _selectedAssetStore.SetValue(row, _selectedAssetSizeField, imageSize.Width + "x" + imageSize.Height); _selectedAssetStore.SetValue(row, _selectedAssetImageField, Image.FromFile(file.Path).WithBoxSize(30, 30)); } _selectedAssetResultStore.Clear(); if (assetProperties.Result.Value == null) { return; } foreach (var condition in assetProperties.Result.Value) { var row = _selectedAssetResultStore.AddRow(); var resultImage = condition.IsFulfilled ? Image.FromResource("SwissAddinKnife.Resources.success.png") : Image.FromResource("SwissAddinKnife.Resources.unsuccess.png"); _selectedAssetResultStore.SetValue(row, _selectedAssetResultIconField, resultImage.WithBoxSize(15)); _selectedAssetResultStore.SetValue(row, _selectedAssetResultDescriptionField, condition.Description); } }
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 ListView2() { ListView list = new ListView(); editable = new DataField <bool> (); nonEditable = new DataField <bool> (); var textField = new DataField <string> (); ListStore store = new ListStore(editable, nonEditable, textField); list.DataSource = store; list.Columns.Add(new ListViewColumn("Editable", new CheckBoxCellView { Editable = true, ActiveField = editable })); list.Columns.Add(new ListViewColumn("Not Editable", new CheckBoxCellView { Editable = false, ActiveField = nonEditable })); list.Columns.Add(new ListViewColumn("Editable", new TextCellView { Editable = true, TextField = textField })); Random rand = new Random(); for (int n = 0; n < 100; n++) { var r = store.AddRow(); store.SetValue(r, editable, rand.Next(0, 2) == 0); store.SetValue(r, nonEditable, rand.Next(0, 2) == 0); store.SetValue(r, textField, n.ToString()); } PackStart(list, true); }
protected override Widget GetMainControl() { var icon = new DataField <Image> (); var name = new DataField <string> (); var listStore = new ListStore(icon, name); scaffolders = GetScaffolders().Value; foreach (var scaffolder in scaffolders) { var row = listStore.AddRow(); var png = ImageService.GetIcon("md-html-file-icon", Gtk.IconSize.Dnd); listStore.SetValue(row, icon, png); listStore.SetValue(row, name, scaffolder.Name); } listBox = new ListBox(); listBox.Views.Add(new ImageCellView(icon)); listBox.Views.Add(new TextCellView(name)); listBox.DataSource = listStore; listBox.HeightRequest = 300; listBox.WidthRequest = 300; listBox.SelectionChanged += SelectionChanged; listBox.RowActivated += RowActivated; listBox.SelectRow(0); listBox.FocusedRow = 0; listBox.SetFocus(); return(listBox); }
public ListView1() { PackStart (new Label ("The listview should have a red background")); ListView list = new ListView (); 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 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, rand.Next () % 100); } PackStart (list, true); list.RowActivated += delegate(object sender, ListViewRowEventArgs e) { MessageDialog.ShowMessage ("Row " + e.RowIndex + " activated"); }; var but = new Button ("Scroll one line"); but.Clicked += delegate { list.VerticalScrollControl.Value += list.VerticalScrollControl.StepIncrement; }; PackStart (but); }
public ListViewCombos() { ListView list = new ListView (); var indexField = new DataField<int> (); var indexField2 = new DataField<int> (); var itemsField = new DataField<ItemCollection> (); ListStore store = new ListStore (indexField, indexField2, itemsField); list.DataSource = store; list.GridLinesVisible = GridLines.Horizontal; var comboCellView = new ComboBoxCellView { Editable = true, SelectedIndexField = indexField }; comboCellView.Items.Add (1, "one"); comboCellView.Items.Add (2, "two"); comboCellView.Items.Add (3, "three"); list.Columns.Add (new ListViewColumn ("List 1", comboCellView)); var comboCellView2 = new ComboBoxCellView { Editable = true, SelectedIndexField = indexField2, ItemsField = itemsField }; list.Columns.Add (new ListViewColumn ("List 2", comboCellView2)); int p = 0; for (int n = 0; n < 10; n++) { var r = store.AddRow (); store.SetValue (r, indexField, n % 3); var col = new ItemCollection (); for (int i = 0; i < 3; i++) { col.Add (p, "p" + p); p++; } store.SetValues (r, indexField2, n % 3, itemsField, col); } PackStart (list, true); }
public override void Initialize (OptionsDialog dialog, object dataObject) { base.Initialize (dialog, dataObject); config = (SolutionRunConfigInfo)dataObject; store = new ListStore (selectedField, projectNameField, projectField, runConfigField, projectRunConfigsField); listView = new ListView (store); var col1 = new ListViewColumn (GettextCatalog.GetString ("Solution Item")); var cb = new CheckBoxCellView (selectedField); cb.Toggled += SelectionChanged; cb.Editable = true; col1.Views.Add (cb); col1.Views.Add (new TextCellView (projectNameField)); listView.Columns.Add (col1); var configSelView = new ComboBoxCellView (runConfigField); configSelView.Editable = true; configSelView.ItemsField = projectRunConfigsField; var col2 = new ListViewColumn (GettextCatalog.GetString ("Run Configuration"), configSelView); listView.Columns.Add (col2); foreach (var it in config.Solution.GetAllSolutionItems ().Where (si => si.SupportsExecute ()).OrderBy (si => si.Name)) { var row = store.AddRow (); var si = config.EditedConfig.Items.FirstOrDefault (i => i.SolutionItem == it); var sc = si?.RunConfiguration?.Name ?? it.GetDefaultRunConfiguration ()?.Name; var configs = new ItemCollection (); foreach (var pc in it.GetRunConfigurations ()) configs.Add (pc.Name); store.SetValues (row, selectedField, si != null, projectNameField, it.Name, projectField, it, runConfigField, sc, projectRunConfigsField, configs); } }
public ListView1() { PackStart(new Label("The listview should have a red background")); ListView list = new ListView() { BackgroundColor = Colors.Red }; ListStore store = new ListStore(name, icon, text, icon2); list.DataSource = store; list.Columns.Add("Name", icon, name); list.Columns.Add("Text", icon2, text); 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); store.SetValue(r, icon2, png); store.SetValue(r, text, "Text " + n); } PackStart(list, BoxMode.FillAndExpand); }
protected override Widget GetMainControl() { var icon = new DataField <Image> (); var name = new DataField <string> (); var listStore = new ListStore(icon, name); var scaffolders = GetScaffolders().Value; foreach (var scaffolder in scaffolders) { var row = listStore.AddRow(); var png = Image.FromResource("file-web-32.png"); listStore.SetValue(row, icon, png); listStore.SetValue(row, name, scaffolder.Name); } listBox = new ListBox(); listBox.Views.Add(new ImageCellView(icon)); listBox.Views.Add(new TextCellView(name)); listBox.DataSource = listStore; listBox.HeightRequest = 300; listBox.WidthRequest = 300; listBox.SelectionChanged += (sender, e) => Args.Scaffolder = scaffolders [listBox.SelectedRow]; listBox.SelectRow(0); listBox.FocusedRow = 0; listBox.SetFocus(); return(listBox); }
public ListView1() { PackStart (new Label ("The listview should have a red background")); ListView list = new ListView () { BackgroundColor = Colors.Red }; ListStore store = new ListStore (name, icon, text, icon2); list.DataSource = store; list.Columns.Add ("Name", icon, name); list.Columns.Add ("Text", icon2, text); 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); store.SetValue (r, icon2, png); store.SetValue (r, text, "Text " + n); } PackStart (list, BoxMode.FillAndExpand); list.RowActivated += delegate(object sender, ListViewRowEventArgs e) { MessageDialog.ShowMessage ("Row " + e.RowIndex + " activated"); }; }
public ListView2() { ListView list = new ListView (); var editableActiveField = new DataField<bool> (); var nonEditableActiveField = new DataField<bool> (); var textField = new DataField<string> (); var textField2 = new DataField<string> (); var editableField = new DataField<bool> (); var somewhatEditableData = new DataField<bool>(); ListStore store = new ListStore(editableActiveField, nonEditableActiveField, textField, textField2, editableField, somewhatEditableData); list.DataSource = store; list.Columns.Add (new ListViewColumn("Editable", new CheckBoxCellView { Editable = true, ActiveField = editableActiveField })); list.Columns.Add (new ListViewColumn("Not Editable", new CheckBoxCellView { Editable = false, ActiveField = nonEditableActiveField })); list.Columns.Add (new ListViewColumn("Editable", new TextCellView { Editable = true, TextField = textField })); list.Columns.Add(new ListViewColumn("Somewhat Editable", new CheckBoxCellView { EditableField = editableField, ActiveField = somewhatEditableData })); list.Columns.Add (new ListViewColumn("Somewhat Editable", new TextCellView { EditableField = editableField, TextField = textField2 })); Random rand = new Random (); for (int n=0; n<100; n++) { var r = store.AddRow (); store.SetValue (r, editableActiveField, rand.Next(0, 2) == 0); store.SetValue (r, nonEditableActiveField, rand.Next(0, 2) == 0); store.SetValue(r, somewhatEditableData, rand.Next(0, 2) == 0); store.SetValue (r, textField, n.ToString ()); var edit = (n % 2) == 0; store.SetValue (r, editableField, edit); store.SetValue (r, textField2, edit ? "editable" : "not editable"); } PackStart (list, true); }
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 (); 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); }
public ListView1() { PackStart(new Label("The listview should have a red background")); ListView list = new ListView(); 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 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, rand.Next() % 100); } PackStart(list, BoxMode.FillAndExpand); list.RowActivated += delegate(object sender, ListViewRowEventArgs e) { MessageDialog.ShowMessage("Row " + e.RowIndex + " activated"); }; }
void LoadData(BaseTeamFoundationServer server) { server.LoadProjectConnections(); server.ProjectCollections.ForEach(c => c.LoadProjects()); foreach (var col in server.ProjectCollections) { var row = collectionStore.AddRow(); collectionStore.SetValue(row, collectionName, col.Name); collectionStore.SetValue(row, collectionItem, col); } collectionsList.SelectionChanged += (sender, e) => { if (collectionsList.SelectedRow > -1) { var collection = collectionStore.GetValue(collectionsList.SelectedRow, collectionItem); projectsStore.Clear(); foreach (var project in collection.Projects) { var node = projectsStore.AddNode(); var project1 = project; var isSelected = SelectedProjects.Any(x => string.Equals(x.Uri, project1.Uri, StringComparison.OrdinalIgnoreCase)); node.SetValue(isProjectSelected, isSelected); node.SetValue(projectName, project.Name); node.SetValue(projectItem, project); } } }; if (server.ProjectCollections.Any()) { collectionsList.SelectRow(0); } }
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(); 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); }
public ListView2() { ListView list = new ListView(); var editableActiveField = new DataField <bool> (); var nonEditableActiveField = new DataField <bool> (); var textField = new DataField <string> (); var textField2 = new DataField <string> (); var editableField = new DataField <bool> (); var somewhatEditableData = new DataField <bool>(); ListStore store = new ListStore(editableActiveField, nonEditableActiveField, textField, textField2, editableField, somewhatEditableData); list.DataSource = store; list.GridLinesVisible = GridLines.Horizontal; var checkCellView = new CheckBoxCellView { Editable = true, ActiveField = editableActiveField }; checkCellView.Toggled += (sender, e) => { if (list.CurrentEventRow == null) { MessageDialog.ShowError("CurrentEventRow is null. This is not supposed to happen"); } else { store.SetValue(list.CurrentEventRow, textField, "Toggled"); } }; list.Columns.Add(new ListViewColumn("Editable", checkCellView)); list.Columns.Add(new ListViewColumn("Not Editable", new CheckBoxCellView { Editable = false, ActiveField = nonEditableActiveField })); list.Columns.Add(new ListViewColumn("Editable", new TextCellView { Editable = true, TextField = textField })); list.Columns.Add(new ListViewColumn("Somewhat Editable", new CheckBoxCellView { EditableField = editableField, ActiveField = somewhatEditableData })); list.Columns.Add(new ListViewColumn("Somewhat Editable", new TextCellView { EditableField = editableField, TextField = textField2 })); Random rand = new Random(); for (int n = 0; n < 100; n++) { var r = store.AddRow(); store.SetValue(r, editableActiveField, rand.Next(0, 2) == 0); store.SetValue(r, nonEditableActiveField, rand.Next(0, 2) == 0); store.SetValue(r, somewhatEditableData, rand.Next(0, 2) == 0); store.SetValue(r, textField, n.ToString()); var edit = (n % 2) == 0; store.SetValue(r, editableField, edit); store.SetValue(r, textField2, edit ? "editable" : "not editable"); } PackStart(list, true); }
void AppendPackageToListView(PackageViewModel packageViewModel) { int row = packageStore.AddRow(); packageStore.SetValue(row, packageHasBackgroundColorField, IsOddRow(row)); packageStore.SetValue(row, packageCheckBoxAlphaField, GetPackageCheckBoxAlpha()); packageStore.SetValue(row, packageViewModelField, packageViewModel); }
public EnvironmentVariableCollectionEditor() { store = new ListStore(keyField, valueField); list = new ListView(store); PackStart(list, true); TextCellView crt = new TextCellView(); crt.Editable = true; crt.TextField = keyField; var col = list.Columns.Add(GettextCatalog.GetString("Variable"), crt); col.CanResize = true; crt.TextChanged += (s, a) => NotifyChanged(); valueCell = new TextCellView(); valueCell.Editable = true; valueCell.TextField = valueField; col = list.Columns.Add(GettextCatalog.GetString("Value"), valueCell); col.CanResize = true; valueCell.TextChanged += (s, a) => NotifyChanged(); var box = new HBox(); var btn = new Button(GettextCatalog.GetString("Add")); btn.Clicked += delegate { var row = store.AddRow(); list.SelectRow(row); list.StartEditingCell(row, crt); crt.TextChanged += CrtTextChanged; UpdateButtons(); }; box.PackStart(btn); deleteButton = new Button(GettextCatalog.GetString("Remove")); deleteButton.Clicked += delegate { var row = list.SelectedRow; if (row != -1) { store.RemoveRow(row); if (row < store.RowCount) { list.SelectRow(row); } else if (store.RowCount > 0) { list.SelectRow(store.RowCount - 1); } UpdateButtons(); NotifyChanged(); } }; box.PackStart(deleteButton); PackStart(box); UpdateButtons(); }
public ListView1() { PackStart(new Label("The listview should have a red background")); ListView list = new ListView(); 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); }
public void LoadValues(IDictionary <string, string> values) { store.Clear(); foreach (KeyValuePair <string, string> val in values) { store.SetValues(store.AddRow(), keyField, val.Key, valueField, val.Value); } UpdateButtons(); }
protected void Button_plus_Clicked(object sender, EventArgs args) { var dialog = new CharDialog(this.ParentWindow.Icon, (char)32, (char)126); dialog.TransientFor = this.ParentWindow; if (dialog.Run() == Command.Ok) { char start, end; dialog.char1.GetCurrentChar(out start); dialog.char2.GetCurrentChar(out end); SetListValues(listStore.AddRow(), start, end); RefreshButtons(); } dialog.Dispose(); }
private void FillProjects() { foreach (var project in _projects) { var row = _projectsStore.AddRow(); _projectsStore.SetValue(row, _projectSelectedDataField, true); _projectsStore.SetValue(row, _projectNameDataField, project.Name); } }
internal void FillAnalytics() { if (_controller.SelectedApplication == null) { return; } IsLoading(true); _appNameLabel.Text = _controller.SelectedApplication.Name.UppercaseFirst(); Task.Run(async() => { var audienceAnalytics = _controller.LoadAudienceAnalytics(_controller.SelectedApplication.OwnerName, _controller.SelectedApplication.Name); var sessionAnalytics = _controller.LoadSessionAnalytics(_controller.SelectedApplication.OwnerName, _controller.SelectedApplication.Name); await Runtime.RunInMainThread(() => { _devicesPlotView.Model = _controller.CreatePiePlotModel(audienceAnalytics, Models.AudienceAnalyticsType.Devices); _countriesPlotView.Model = _controller.CreatePiePlotModel(audienceAnalytics, Models.AudienceAnalyticsType.Countries); _languagesPlotView.Model = _controller.CreatePiePlotModel(audienceAnalytics, Models.AudienceAnalyticsType.Languages); _usersPlotView.Model = _controller.CreateBarPlotModel(audienceAnalytics); _devicesPlotView.SetSizeRequest(200, 200); _devicesPlotView.ShowAll(); _countriesPlotView.SetSizeRequest(200, 200); _countriesPlotView.ShowAll(); _devicesPlotView.SetSizeRequest(200, 200); _devicesPlotView.ShowAll(); _usersPlotView.ShowAll(); _durationsStore.Clear(); foreach (var item in sessionAnalytics.Durations) { var row = _durationsStore.AddRow(); _durationsStore.SetValue(row, _descriptionField, item.Description); _durationsStore.SetValue(row, _countField, item.Count); } _statisticsStore.Clear(); foreach (var item in sessionAnalytics.Statistics) { var row = _statisticsStore.AddRow(); _statisticsStore.SetValue(row, _statisticsDescriptionField, item.Description); _statisticsStore.SetValue(row, _statisticsCountField, item.Count); _statisticsStore.SetValue(row, _statisticsChangeField, item.Change); } IsLoading(false); }); }); }
internal void FillData() { Loading(true); _listStore.Clear(); Task.Run(async() => { var apps = new List <Models.Application>(); try { apps = _controller.LoadApplications(); } catch (Exception ex) { LoggingService.LogError("Load applications failed.", ex); MessageService.ShowError("An error ocurred loading the applications.", ex); } await Runtime.RunInMainThread(() => { if (apps.Any()) { foreach (var app in apps) { var row = _listStore.AddRow(); _listStore.SetValue(row, _nameField, app.Name); _listStore.SetValue(row, _ownerField, app.OwnerName); _listStore.SetValue(row, _appField, app); } if (apps.Any()) { _listView.SelectRow(0); } } Loading(false); }); }); }
private void UpdateServersList() { serverStore.Clear(); foreach (var server in TFSVersionControlService.Instance.Servers) { var row = serverStore.AddRow(); serverStore.SetValue(row, nameField, server.Name); serverStore.SetValue(row, urlField, server.Uri.ToString()); serverStore.SetValue(row, serverField, server); } }
void FillData(Addin[] addins) { summary.Text = $"Count: {addins.Length}"; foreach (var addin in addins) { int row = listStore.AddRow(); listStore.SetValue(row, labelField, addin.Name); } // TODO: clicking a node should open addin info tab }
private void OnAddWorkingFolder(object sender, EventArgs e) { using (var projectSelect = new ProjectSelectDialog(this.projectCollection)) { if (projectSelect.Run(this) == Command.Ok && !string.IsNullOrEmpty(projectSelect.SelectedPath)) { using (SelectFolderDialog folderSelect = new SelectFolderDialog("Browse For Folder")) { folderSelect.Multiselect = false; folderSelect.CanCreateFolders = true; if (folderSelect.Run(this)) { var row = _workingFoldersStore.AddRow(); _workingFoldersStore.SetValue(row, _tfsFolder, projectSelect.SelectedPath); _workingFoldersStore.SetValue(row, _localFolder, folderSelect.Folder); } } } } }
void FillStore(IEnumerable <CompletionCharacters> completionCharacters) { store.Clear(); foreach (var c in completionCharacters) { var row = store.AddRow(); store.SetValue(row, language, c.Language); store.SetValue(row, completeOnSpace, c.CompleteOnSpace); store.SetValue(row, completeOnChars, c.CompleteOnChars); } }
void FillData(Addin[] addins) { var points = GatherExtensionPoints(addins); summary.Text = $"Count: {points.Length}"; foreach (var point in points) { int row = listStore.AddRow(); listStore.SetValue(row, labelField, point); } }
private void FillStore(List <ExtendedItem> items) { fileStore.Clear(); foreach (var item in items) { var row = fileStore.AddRow(); fileStore.SetValue(row, isCheckedField, true); fileStore.SetValue(row, nameField, item.ServerPath.ItemName); fileStore.SetValue(row, folderField, item.ServerPath.ParentPath); fileStore.SetValue(row, itemField, item); } }
public void AddItems(List <ExtendedItem> items) { listStore.Clear(); foreach (var item in items) { var row = listStore.AddRow(); listStore.SetValue(row, itemField, item); listStore.SetValue(row, isSelectedField, true); VersionControlPath path = item.TargetServerItem; listStore.SetValue(row, nameField, path.ItemName); listStore.SetValue(row, pathField, path.ParentPath); } }
void OnFileDialogClicked(object sender, EventArgs e) { if (fileDialog.Run(this)) { _imagesStore.Clear(); foreach (var fileName in fileDialog.FileNames) { var row = _imagesStore.AddRow(); _imagesStore.SetValue(row, _imageNameField, Path.GetFileNameWithoutExtension(fileName)); _imagesStore.SetValue(row, _imagePathField, fileName); } } }
public override IScrollableWidget CreateScrollableWidget () { DataField<string> text = new DataField<string> (); ListStore s = new ListStore (text); var list = new ListView (s); list.Columns.Add ("Hi", text); for (int n = 0; n < 100; n++) { var r = s.AddRow (); s.SetValue (r, text, n + new string ('.',100)); } return list; }
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); }
public ListViewEntries() { ListView list = new ListView(); var editableTextField = new DataField <string> (); var nonEditableTextField = new DataField <string> (); ListStore store = new ListStore(editableTextField, nonEditableTextField); list.DataSource = store; list.GridLinesVisible = GridLines.Horizontal; var textCellView = new TextCellView { Editable = true, TextField = editableTextField }; list.Columns.Add(new ListViewColumn("Editable", textCellView)); list.Columns.Add(new ListViewColumn("Not Editable", new TextCellView { Editable = false, TextField = nonEditableTextField })); Random rand = new Random(); for (int n = 0; n < 10; n++) { var r = store.AddRow(); store.SetValue(r, editableTextField, "Editable value " + n); store.SetValue(r, nonEditableTextField, "Non-editable value " + n); } PackStart(list, true); var btn = new Button("Add Row"); btn.Clicked += delegate { var row = store.AddRow(); store.SetValues(row, editableTextField, "New editable text", nonEditableTextField, "New non-editable text"); list.StartEditingCell(row, textCellView); }; PackStart(btn, false, hpos: WidgetPlacement.Start); }
public EnvironmentVariableCollectionEditor () { store = new ListStore (keyField, valueField); list = new ListView (store); PackStart (list, true); TextCellView crt = new TextCellView (); crt.Editable = true; crt.TextField = keyField; var col = list.Columns.Add (GettextCatalog.GetString ("Variable"), crt); col.CanResize = true; crt.TextChanged += (s,a) => NotifyChanged (); valueCell = new TextCellView (); valueCell.Editable = true; valueCell.TextField = valueField; col = list.Columns.Add (GettextCatalog.GetString ("Value"), valueCell); col.CanResize = true; valueCell.TextChanged += (s, a) => NotifyChanged (); var box = new HBox (); var btn = new Button (GettextCatalog.GetString ("Add")); btn.Clicked += delegate { var row = store.AddRow (); list.SelectRow (row); list.StartEditingCell (row, crt); crt.TextChanged += CrtTextChanged; UpdateButtons (); }; box.PackStart (btn); deleteButton = new Button (GettextCatalog.GetString ("Remove")); deleteButton.Clicked += delegate { var row = list.SelectedRow; if (row != -1) { store.RemoveRow (row); if (row < store.RowCount) list.SelectRow (row); else if (store.RowCount > 0) list.SelectRow (store.RowCount - 1); UpdateButtons (); NotifyChanged (); } }; box.PackStart (deleteButton); PackStart (box); UpdateButtons (); }
public ListView2() { ListView list = new ListView(); var editableActiveField = new DataField<bool>(); var nonEditableActiveField = new DataField<bool>(); var textField = new DataField<string>(); var textField2 = new DataField<string>(); var editableField = new DataField<bool>(); var somewhatEditableData = new DataField<bool>(); ListStore store = new ListStore(editableActiveField, nonEditableActiveField, textField, textField2, editableField, somewhatEditableData); list.DataSource = store; list.GridLinesVisible = GridLines.Horizontal; var checkCellView = new CheckBoxCellView { Editable = true, ActiveField = editableActiveField }; checkCellView.Toggled += (sender, e) => { if (list.CurrentEventRow == 0) { MessageDialog.ShowError("CurrentEventRow is null. This is not supposed to happen"); } else { store.SetValue(list.CurrentEventRow, textField, "Toggled"); } }; list.Columns.Add(new ListViewColumn("Editable", checkCellView)); list.Columns.Add(new ListViewColumn("Not Editable", new CheckBoxCellView { Editable = false, ActiveField = nonEditableActiveField })); list.Columns.Add(new ListViewColumn("Editable", new TextCellView { Editable = true, TextField = textField })); list.Columns.Add(new ListViewColumn("Somewhat Editable", new CheckBoxCellView { EditableField = editableField, ActiveField = somewhatEditableData })); list.Columns.Add(new ListViewColumn("Somewhat Editable", new TextCellView { EditableField = editableField, TextField = textField2 })); Random rand = new Random(); for (int n = 0; n < 100; n++) { var r = store.AddRow(); store.SetValue(r, editableActiveField, rand.Next(0, 2) == 0); store.SetValue(r, nonEditableActiveField, rand.Next(0, 2) == 0); store.SetValue(r, somewhatEditableData, rand.Next(0, 2) == 0); store.SetValue(r, textField, n.ToString()); var edit = (n % 2) == 0; store.SetValue(r, editableField, edit); store.SetValue(r, textField2, edit ? "editable" : "not editable"); } PackStart(list, true); }
private void FillWorkspaces() { _listStore.Clear(); var workspaces = _showRemoteCheck.State == CheckBoxState.On ? WorkspaceHelper.GetRemoteWorkspaces(this.projectCollection) : WorkspaceHelper.GetLocalWorkspaces(this.projectCollection); foreach (var workspace in workspaces) { var row = _listStore.AddRow(); _listStore.SetValue(row, _name, workspace.Name); _listStore.SetValue(row, _computer, workspace.Computer); _listStore.SetValue(row, _owner, workspace.OwnerName); _listStore.SetValue(row, _comment, workspace.Comment.Replace(Environment.NewLine, " ")); } }
public WidgetFocus() { var text = new TextEntry(); var check = new CheckBox("CheckBox"); var slider = new HSlider(); ListStore store = new ListStore(value); var list = new ListView(store); list.Columns.Add("Value", value); list.HeadersVisible = false; for (int n = 0; n < 10; n++) { var r = store.AddRow(); store.SetValue(r, value, "Value " + n); } var btn1 = new Button("TextEnty"); var btn2 = new Button("Checkbox"); var btn3 = new Button("Slider"); var btn4 = new Button("ListBox"); var btn5 = new Button("Button"); btn1.Clicked += (sender, e) => text.SetFocus(); btn2.Clicked += (sender, e) => check.SetFocus(); btn3.Clicked += (sender, e) => slider.SetFocus(); btn4.Clicked += (sender, e) => list.SetFocus(); btn5.Clicked += (sender, e) => btn1.SetFocus(); var btnBox = new HBox(); btnBox.PackStart(btn1); btnBox.PackStart(btn2); btnBox.PackStart(btn3); btnBox.PackStart(btn4); btnBox.PackStart(btn5); var focusBox = new HBox(); var vbox = new VBox(); vbox.PackStart(text); vbox.PackStart(check); vbox.PackStart(slider); focusBox.PackStart(vbox); focusBox.PackStart(list, true); PackStart(btnBox); PackStart(focusBox, true); }
public WidgetFocus () { var text = new TextEntry (); var check = new CheckBox ("CheckBox"); var slider = new HSlider (); ListStore store = new ListStore (value); var list = new ListView (store); list.Columns.Add ("Value", value); list.HeadersVisible = false; for (int n=0; n<10; n++) { var r = store.AddRow (); store.SetValue (r, value, "Value " + n); } var btn1 = new Button ("TextEnty"); var btn2 = new Button ("Checkbox"); var btn3 = new Button ("Slider"); var btn4 = new Button ("ListBox"); var btn5 = new Button ("Button"); btn1.Clicked += (sender, e) => text.SetFocus (); btn2.Clicked += (sender, e) => check.SetFocus (); btn3.Clicked += (sender, e) => slider.SetFocus (); btn4.Clicked += (sender, e) => list.SetFocus (); btn5.Clicked += (sender, e) => btn1.SetFocus (); var btnBox = new HBox (); btnBox.PackStart (btn1); btnBox.PackStart (btn2); btnBox.PackStart (btn3); btnBox.PackStart (btn4); btnBox.PackStart (btn5); var focusBox = new HBox (); var vbox = new VBox (); vbox.PackStart (text); vbox.PackStart (check); vbox.PackStart (slider); focusBox.PackStart (vbox); focusBox.PackStart (list, true); PackStart (btnBox); PackStart (focusBox, true); }
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); }
public ListView1() { ListView list = new ListView (); ListStore store = new ListStore (name, icon, text, icon2); list.DataSource = store; list.Columns.Add ("Name", icon, name); list.Columns.Add ("Text", icon2, text); 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); store.SetValue (r, icon2, png); store.SetValue (r, text, "Text " + n); } PackStart (list, BoxMode.FillAndExpand); }
public ListView2() { ListView list = new ListView (); editable = new DataField<bool> (); nonEditable = new DataField<bool> (); var textField = new DataField<string> (); ListStore store = new ListStore (editable, nonEditable, textField); list.DataSource = store; list.Columns.Add (new ListViewColumn("Editable", new CheckBoxCellView { Editable = true, ActiveField = editable })); list.Columns.Add (new ListViewColumn("Not Editable", new CheckBoxCellView { Editable = false, ActiveField = nonEditable })); list.Columns.Add (new ListViewColumn("Editable", new TextCellView { Editable = true, TextField = textField })); Random rand = new Random (); for (int n=0; n<100; n++) { var r = store.AddRow (); store.SetValue (r, editable, rand.Next(0, 2) == 0); store.SetValue (r, nonEditable, rand.Next(0, 2) == 0); store.SetValue (r, textField, n.ToString ()); } PackStart (list, true); }
public ComboBoxes () { HBox box = new HBox (); ComboBox c = new ComboBox (); c.Items.Add ("One"); c.Items.Add ("Two"); c.Items.Add ("Three"); c.SelectedIndex = 1; box.PackStart (c); Label la = new Label (); box.PackStart (la); c.SelectionChanged += delegate { la.Text = "Selected: " + (string)c.SelectedItem; }; PackStart (box); box = new HBox (); ComboBox c2 = new ComboBox (); box.PackStart (c2); Button b = new Button ("Fill combo (should grow)"); box.PackStart (b); b.Clicked += delegate { for (int n=0; n<10; n++) { c2.Items.Add ("Item " + new string ('#', n)); } }; PackStart (box); // Combo with custom labels box = new HBox (); ComboBox c3 = new ComboBox (); c3.Items.Add (0, "Combo with custom labels"); c3.Items.Add (1, "One"); c3.Items.Add (2, "Two"); c3.Items.Add (3, "Three"); c3.Items.Add (ItemSeparator.Instance); c3.Items.Add (4, "Maybe more"); var la3 = new Label (); box.PackStart (c3); box.PackStart (la3); c3.SelectionChanged += delegate { la3.Text = string.Format ("Selected item: {0} with label {1}", c3.SelectedItem, c3.SelectedText); }; PackStart (box); box = new HBox (); var c4 = new ComboBoxEntry (); var la4 = new Label (); box.PackStart (c4); box.PackStart (la4); c4.Items.Add (1, "One"); c4.Items.Add (2, "Two"); c4.Items.Add (3, "Three"); c4.TextEntry.PlaceholderText = "This is an entry"; c4.TextEntry.Changed += delegate { la4.Text = "Selected text: " + c4.TextEntry.Text; }; PackStart (box); HBox selBox = new HBox (); Label las = new Label ("Selection:"); selBox.PackStart (las); Button selReplace = new Button ("Replace"); selReplace.Clicked += delegate { c4.TextEntry.SelectedText = "[TEST]"; }; selBox.PackEnd (selReplace); Button selAll = new Button ("Select all"); selAll.Clicked += delegate { c4.TextEntry.SelectionStart = 0; c4.TextEntry.SelectionLength = c4.TextEntry.Text.Length; }; selBox.PackEnd (selAll); Button selPlus = new Button ("+"); selPlus.Clicked += delegate { c4.TextEntry.SelectionLength++; }; selBox.PackEnd (selPlus); Button selRight = new Button (">"); selRight.Clicked += delegate { c4.TextEntry.SelectionStart++; }; selBox.PackEnd (selRight); PackStart (selBox); c4.TextEntry.SelectionChanged += delegate { las.Text = "Selection: (" + c4.TextEntry.CursorPosition + " <-> " + c4.TextEntry.SelectionStart + " + " + c4.TextEntry.SelectionLength + ") " + c4.TextEntry.SelectedText; }; var c5 = new ComboBoxEntry (); c5.TextEntry.TextAlignment = Alignment.Center; c5.TextEntry.Text = "centered text with red background"; c5.BackgroundColor = Colors.Red; c5.Items.Add (1, "One"); c5.Items.Add (2, "Two"); c5.Items.Add (3, "Three"); PackStart (c5); // A complex combobox // Three data fields var imgField = new DataField<Image> (); var textField = new DataField<string> (); var descField = new DataField<string> (); ComboBox cbox = new ComboBox (); ListStore store = new ListStore (textField, imgField, descField); cbox.ItemsSource = store; var r = store.AddRow (); store.SetValue (r, textField, "Information"); store.SetValue (r, descField, "Icons are duplicated on purpose"); store.SetValue (r, imgField, StockIcons.Information); r = store.AddRow (); store.SetValue (r, textField, "Error"); store.SetValue (r, descField, "Another item"); store.SetValue (r, imgField, StockIcons.Error); r = store.AddRow (); store.SetValue (r, textField, "Warning"); store.SetValue (r, descField, "A third item"); store.SetValue (r, imgField, StockIcons.Warning); // Four views to show three data fields cbox.Views.Add (new ImageCellView (imgField)); cbox.Views.Add (new TextCellView (textField)); cbox.Views.Add (new ImageCellView (imgField)); cbox.Views.Add (new TextCellView (descField)); cbox.SelectedIndex = 0; PackStart (cbox); }
public MultiplayerView(LauncherWindow window) { Window = window; this.MinWidth = 250; MultiplayerLabel = new Label("Multiplayer") { Font = Font.WithSize(16), TextAlignment = Alignment.Center }; ServerIPEntry = new TextEntry() { PlaceholderText = "Server IP", Text = UserSettings.Local.LastIP }; ConnectButton = new Button("Connect"); BackButton = new Button("Back"); ServerListView = new ListView() { MinHeight = 200, SelectionMode = SelectionMode.Single }; AddServerButton = new Button("Add server"); RemoveServerButton = new Button("Remove") { Sensitive = false }; ServerCreationBox = new VBox() { Visible = false }; NewServerLabel = new Label("Add new server:") { TextAlignment = Alignment.Center }; NewServerName = new TextEntry() { PlaceholderText = "Name" }; NewServerAddress = new TextEntry() { PlaceholderText = "Address" }; CommitAddNewServer = new Button("Add server"); CancelAddNewServer = new Button("Cancel"); var iconField = new DataField<Image>(); var nameField = new DataField<string>(); var playersField = new DataField<string>(); ServerListStore = new ListStore(iconField, nameField, playersField); ServerListView.DataSource = ServerListStore; ServerListView.HeadersVisible = false; ServerListView.Columns.Add(new ListViewColumn("Icon", new ImageCellView { ImageField = iconField })); ServerListView.Columns.Add(new ListViewColumn("Name", new TextCellView { TextField = nameField })); ServerListView.Columns.Add(new ListViewColumn("Players", new TextCellView { TextField = playersField })); ServerIPEntry.KeyReleased += (sender, e) => { if (e.Key == Key.Return || e.Key == Key.NumPadEnter) ConnectButton_Clicked(sender, e); }; BackButton.Clicked += (sender, e) => { Window.InteractionBox.Remove(this); Window.InteractionBox.PackEnd(Window.MainMenuView); }; ConnectButton.Clicked += ConnectButton_Clicked; ServerListView.SelectionChanged += (sender, e) => { RemoveServerButton.Sensitive = ServerListView.SelectedRow != -1; ServerIPEntry.Sensitive = ServerListView.SelectedRow == -1; }; AddServerButton.Clicked += (sender, e) => { AddServerButton.Sensitive = false; RemoveServerButton.Sensitive = false; ConnectButton.Sensitive = false; ServerListView.Sensitive = false; ServerIPEntry.Sensitive = false; ServerCreationBox.Visible = true; }; CancelAddNewServer.Clicked += (sender, e) => { AddServerButton.Sensitive = true; RemoveServerButton.Sensitive = true; ConnectButton.Sensitive = true; ServerListView.Sensitive = true; ServerIPEntry.Sensitive = true; ServerCreationBox.Visible = false; }; RemoveServerButton.Clicked += (sender, e) => { var server = UserSettings.Local.FavoriteServers[ServerListView.SelectedRow]; ServerListStore.RemoveRow(ServerListView.SelectedRow); UserSettings.Local.FavoriteServers = UserSettings.Local.FavoriteServers.Where( s => s.Name != server.Name && s.Address != server.Address).ToArray(); UserSettings.Local.Save(); }; CommitAddNewServer.Clicked += (sender, e) => { var server = new FavoriteServer { Name = NewServerName.Text, Address = NewServerAddress.Text }; var row = ServerListStore.AddRow(); using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TrueCraft.Launcher.Content.default-server-icon.png")) ServerListStore.SetValue(row, iconField, Image.FromStream(stream)); ServerListStore.SetValue(row, nameField, server.Name); ServerListStore.SetValue(row, playersField, "TODO/50"); UserSettings.Local.FavoriteServers = UserSettings.Local.FavoriteServers.Concat(new[] { server }).ToArray(); UserSettings.Local.Save(); AddServerButton.Sensitive = true; RemoveServerButton.Sensitive = true; ConnectButton.Sensitive = true; ServerListView.Sensitive = true; ServerIPEntry.Sensitive = true; ServerCreationBox.Visible = false; }; foreach (var server in UserSettings.Local.FavoriteServers) { var row = ServerListStore.AddRow(); using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TrueCraft.Launcher.Content.default-server-icon.png")) ServerListStore.SetValue(row, iconField, Image.FromStream(stream)); ServerListStore.SetValue(row, nameField, server.Name); ServerListStore.SetValue(row, playersField, "TODO/50"); } var addServerHBox = new HBox(); AddServerButton.WidthRequest = RemoveServerButton.WidthRequest = 0.5; addServerHBox.PackStart(AddServerButton, true); addServerHBox.PackStart(RemoveServerButton, true); var commitHBox = new HBox(); CancelAddNewServer.WidthRequest = CommitAddNewServer.WidthRequest = 0.5; commitHBox.PackStart(CommitAddNewServer, true); commitHBox.PackStart(CancelAddNewServer, true); ServerCreationBox.PackStart(NewServerLabel); ServerCreationBox.PackStart(NewServerName); ServerCreationBox.PackStart(NewServerAddress); ServerCreationBox.PackStart(commitHBox); this.PackEnd(BackButton); this.PackEnd(ConnectButton); this.PackStart(MultiplayerLabel); this.PackStart(ServerIPEntry); this.PackStart(ServerListView); this.PackStart(addServerHBox); this.PackStart(ServerCreationBox); }
public ComboBoxes() { HBox box = new HBox (); ComboBox c = new ComboBox (); c.Items.Add ("One"); c.Items.Add ("Two"); c.Items.Add ("Three"); c.SelectedIndex = 1; box.PackStart (c); Label la = new Label (); box.PackStart (la); c.SelectionChanged += delegate { la.Text = "Selected: " + (string)c.SelectedItem; }; PackStart (box); box = new HBox (); ComboBox c2 = new ComboBox (); box.PackStart (c2); Button b = new Button ("Fill combo (should grow)"); box.PackStart (b); b.Clicked += delegate { for (int n=0; n<10; n++) { c2.Items.Add ("Item " + new string ('#', n)); } }; PackStart (box); // Combo with custom labels box = new HBox (); ComboBox c3 = new ComboBox (); c3.Items.Add (0, "Combo with custom labels"); c3.Items.Add (1, "One"); c3.Items.Add (2, "Two"); c3.Items.Add (3, "Three"); c3.Items.Add (ItemSeparator.Instance); c3.Items.Add (4, "Maybe more"); var la3 = new Label (); box.PackStart (c3); box.PackStart (la3); c3.SelectionChanged += delegate { la3.Text = string.Format ("Selected item: {0} with label {1}", c3.SelectedItem, c3.SelectedText); }; PackStart (box); box = new HBox (); var c4 = new ComboBoxEntry (); var la4 = new Label (); box.PackStart (c4); box.PackStart (la4); c4.Items.Add (1, "One"); c4.Items.Add (2, "Two"); c4.Items.Add (3, "Three"); c4.TextEntry.PlaceholderText = "This is an entry"; c4.TextEntry.Changed += delegate { la4.Text = "Selected text: " + c4.TextEntry.Text; }; PackStart (box); // A complex combobox // Three data fields var imgField = new DataField<Image> (); var textField = new DataField<string> (); var descField = new DataField<string> (); ComboBox cbox = new ComboBox (); ListStore store = new ListStore (textField, imgField, descField); cbox.ItemsSource = store; var r = store.AddRow (); store.SetValue (r, textField, "Information"); store.SetValue (r, descField, "Icons are duplicated on purpose"); store.SetValue (r, imgField, Image.FromIcon (StockIcons.Information, IconSize.Small)); r = store.AddRow (); store.SetValue (r, textField, "Error"); store.SetValue (r, descField, "Another item"); store.SetValue (r, imgField, Image.FromIcon (StockIcons.Error, IconSize.Small)); r = store.AddRow (); store.SetValue (r, textField, "Warning"); store.SetValue (r, descField, "A third item"); store.SetValue (r, imgField, Image.FromIcon (StockIcons.Warning, IconSize.Small)); // Four views to show three data fields cbox.Views.Add (new ImageCellView (imgField)); cbox.Views.Add (new TextCellView (textField)); cbox.Views.Add (new ImageCellView (imgField)); cbox.Views.Add (new TextCellView (descField)); cbox.SelectedIndex = 0; PackStart (cbox); }
public DefaultFontSelectorBackend () { families = Font.AvailableFontFamilies.ToList (); families.Sort (); storeFonts = new ListStore (dfamily, dfamilymarkup); listFonts.DataSource = storeFonts; listFonts.HeadersVisible = false; listFonts.Columns.Add ("Font", new TextCellView () { TextField = dfamily, MarkupField = dfamilymarkup }); listFonts.MinWidth = 150; foreach (var family in families) { var row = storeFonts.AddRow (); storeFonts.SetValues (row, dfamily, family, dfamilymarkup, "<span font=\"" + family + " " + (listFonts.Font.Size) + "\">" + family + "</span>"); } storeFace = new ListStore (dfaceName, dfaceMarkup, dfaceFont); listFace.DataSource = storeFace; listFace.HeadersVisible = false; listFace.Columns.Add ("Style", new TextCellView () { TextField = dfaceName, MarkupField = dfaceMarkup }); listFace.MinWidth = 60; //listFace.HorizontalScrollPolicy = ScrollPolicy.Never; foreach (var size in DefaultFontSizes) listSize.Items.Add (size); spnSize.Digits = 1; spnSize.MinimumValue = 1; spnSize.MaximumValue = 800; spnSize.IncrementValue = 1; PreviewText = "The quick brown fox jumps over the lazy dog."; spnSize.ValueChanged += (sender, e) => { if (DefaultFontSizes.Contains (spnSize.Value)) { var row = Array.IndexOf(DefaultFontSizes, spnSize.Value); listSize.ScrollToRow(row); listSize.SelectRow(row); } else listSize.UnselectAll (); SetFont(selectedFont.WithSize (spnSize.Value)); }; SelectedFont = Font.SystemFont; UpdateFaceList (selectedFont); // family change not connected at this point, update manually listFonts.SelectionChanged += (sender, e) => { if (listFonts.SelectedRow >= 0) { var newFont = selectedFont.WithFamily (storeFonts.GetValue (listFonts.SelectedRow, dfamily)); UpdateFaceList (newFont); SetFont(newFont); } }; listFace.SelectionChanged += (sender, e) => { if (listFace.SelectedRow >= 0) SetFont (storeFace.GetValue (listFace.SelectedRow, dfaceFont).WithSize (selectedFont.Size)); }; listSize.SelectionChanged += (sender, e) => { if (listSize.SelectedRow >= 0 && Math.Abs (DefaultFontSizes [listSize.SelectedRow] - spnSize.Value) > double.Epsilon) spnSize.Value = DefaultFontSizes[listSize.SelectedRow]; }; VBox familyBox = new VBox (); familyBox.PackStart (new Label ("Font:")); familyBox.PackStart (listFonts, true); VBox styleBox = new VBox (); styleBox.PackStart (new Label ("Style:")); styleBox.PackStart (listFace, true); VBox sizeBox = new VBox (); sizeBox.PackStart (new Label ("Size:")); sizeBox.PackStart (spnSize); sizeBox.PackStart (listSize, true); HBox fontBox = new HBox (); fontBox.PackStart (familyBox, true); fontBox.PackStart (styleBox, true); fontBox.PackStart (sizeBox); VBox mainBox = new VBox (); mainBox.MinWidth = 350; mainBox.MinHeight = 300; mainBox.PackStart (fontBox, true); mainBox.PackStart (new Label ("Preview:")); mainBox.PackStart (previewText); Content = mainBox; }
public void LoadQuery(StoredQuery query) { listView.Columns.Clear(); using (var progress = new MonoDevelop.Ide.ProgressMonitoring.MessageDialogProgressMonitor(true, false, false)) { var fields = CachedMetaData.Instance.Fields; WorkItemStore store = new WorkItemStore(query); var data = store.LoadByPage(progress); if (data.Count > 0) { var firstItem = data[0]; List<IDataField> dataFields = new List<IDataField>(); var mapping = new Dictionary<Field, IDataField<object>>(); foreach (var item in firstItem.WorkItemInfo.Keys) { var field = fields[item]; var dataField = new DataField<object>(); dataFields.Add(dataField); mapping.Add(field, dataField); } if (dataFields.Any()) { workItemField = new DataField<WorkItem>(); dataFields.Insert(0, workItemField); var listStore = new ListStore(dataFields.ToArray()); foreach (var map in mapping) { listView.Columns.Add(map.Key.Name, map.Value); } listView.DataSource = listStore; foreach (var workItem in data) { var row = listStore.AddRow(); listStore.SetValue(row, workItemField, workItem); foreach (var map in mapping) { object value; if (workItem.WorkItemInfo.TryGetValue(map.Key.ReferenceName, out value)) { listStore.SetValue(row, map.Value, value); } else { listStore.SetValue(row, map.Value, null); } } } } } } }
public ListViewCellBounds () { MinHeight = 120; MinWidth = 100; container = new VBox (); ListView = new ListView(); ListView.GridLinesVisible = GridLines.Both; ListStore = new ListStore (name, icon, text, check, progress); ListView.DataSource = ListStore; ListView.Columns.Add ("Name", icon, name); ListView.Columns.Add ("Check", new TextCellView () { TextField = text }, new CustomCell () { ValueField = progress, Size = new Size(20, 20) }, new CheckBoxCellView() { ActiveField = check }); //list.Columns.Add ("Progress", new TextCellView () { TextField = text }, new CustomCell () { ValueField = progress }, new TextCellView () { TextField = text } ); ListView.Columns.Add ("Progress", 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 = ListStore.AddRow (); ListStore.SetValue (r, icon, png); if (rand.Next (50) > 25) { ListStore.SetValue (r, name, "Value \n" + n); ListStore.SetValue (r, check, false); } else { ListStore.SetValue (r, name, "Value " + n); ListStore.SetValue (r, check, true); } ListStore.SetValue (r, text, "Text " + n); ListStore.SetValue (r, progress, new CellData { Value = rand.Next () % 100 }); } ListView.SelectionChanged += (sender, e) => UpdateTracker (ListView.SelectedRow); ListView.MouseMoved += (sender, e) => UpdateTracker (ListView.GetRowAtPosition (e.X, e.Y)); drawer = new ListTrackingCanvas (this); container.PackStart (ListView, true); container.PackStart (drawer); AddChild (container); }
public SingleplayerView(LauncherWindow window) { Worlds.Local = new Worlds(); Worlds.Local.Load(); Window = window; this.MinWidth = 250; SingleplayerLabel = new Label("Singleplayer") { Font = Font.WithSize(16), TextAlignment = Alignment.Center }; WorldListView = new ListView { MinHeight = 200, SelectionMode = SelectionMode.Single }; CreateWorldButton = new Button("New world"); DeleteWorldButton = new Button("Delete") { Sensitive = false }; PlayButton = new Button("Play") { Sensitive = false }; BackButton = new Button("Back"); CreateWorldBox = new VBox() { Visible = false }; NewWorldName = new TextEntry() { PlaceholderText = "Name" }; NewWorldSeed = new TextEntry() { PlaceholderText = "Seed (optional)" }; NewWorldCommit = new Button("Create") { Sensitive = false }; NewWorldCancel = new Button("Cancel"); NameField = new DataField<string>(); WorldListStore = new ListStore(NameField); WorldListView.DataSource = WorldListStore; WorldListView.HeadersVisible = false; WorldListView.Columns.Add(new ListViewColumn("Name", new TextCellView { TextField = NameField, Editable = false })); ProgressLabel = new Label("Loading world...") { Visible = false }; ProgressBar = new ProgressBar() { Visible = false, Indeterminate = true, Fraction = 0 }; BackButton.Clicked += (sender, e) => { Window.MainContainer.Remove(this); Window.MainContainer.PackEnd(Window.MainMenuView); }; CreateWorldButton.Clicked += (sender, e) => { CreateWorldBox.Visible = true; }; NewWorldCancel.Clicked += (sender, e) => { CreateWorldBox.Visible = false; }; NewWorldName.Changed += (sender, e) => { NewWorldCommit.Sensitive = !string.IsNullOrEmpty(NewWorldName.Text); }; NewWorldCommit.Clicked += NewWorldCommit_Clicked; WorldListView.SelectionChanged += (sender, e) => { PlayButton.Sensitive = DeleteWorldButton.Sensitive = WorldListView.SelectedRow != -1; }; PlayButton.Clicked += PlayButton_Clicked; DeleteWorldButton.Clicked += (sender, e) => { var world = Worlds.Local.Saves[WorldListView.SelectedRow]; WorldListStore.RemoveRow(WorldListView.SelectedRow); Worlds.Local.Saves = Worlds.Local.Saves.Where(s => s != world).ToArray(); Directory.Delete(world.BaseDirectory, true); }; foreach (var world in Worlds.Local.Saves) { var row = WorldListStore.AddRow(); WorldListStore.SetValue(row, NameField, world.Name); } var createDeleteHbox = new HBox(); CreateWorldButton.WidthRequest = DeleteWorldButton.WidthRequest = 0.5; createDeleteHbox.PackStart(CreateWorldButton, true); createDeleteHbox.PackStart(DeleteWorldButton, true); CreateWorldBox.PackStart(NewWorldName); CreateWorldBox.PackStart(NewWorldSeed); var newWorldHbox = new HBox(); NewWorldCommit.WidthRequest = NewWorldCancel.WidthRequest = 0.5; newWorldHbox.PackStart(NewWorldCommit, true); newWorldHbox.PackStart(NewWorldCancel, true); CreateWorldBox.PackStart(newWorldHbox); this.PackStart(SingleplayerLabel); this.PackStart(WorldListView); this.PackStart(createDeleteHbox); this.PackStart(PlayButton); this.PackStart(CreateWorldBox); this.PackStart(ProgressLabel); this.PackStart(ProgressBar); this.PackEnd(BackButton); }
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); }