void ClearDescriptions() { while (descriptionBox.Children.Length > 0) { var child = descriptionBox.Children [0]; descriptionBox.Remove(child); child.Destroy(); } }
private void ClearVbox(VBox v) { var elementi = v.AllChildren; foreach (Widget x in elementi) { v.Remove(x); } }
void RecentFilesChanged(object sender, EventArgs e) { //this can get called by async dispatch after the widget is destroyed if (destroyed) { return; } foreach (var c in box.Children) { box.Remove(c); c.Destroy(); } Gtk.HBox hbox = new HBox(); var btn = new WelcomePageListButton(GettextCatalog.GetString("New..."), null, newProjectIcon, "monodevelop://MonoDevelop.Ide.Commands.FileCommands.NewProject"); btn.WidthRequest = (int)(Styles.WelcomeScreen.Pad.Solutions.SolutionTile.Width / 2.3); btn.BorderPadding = 6; btn.LeftTextPadding = 24; hbox.PackStart(btn, false, false, 0); btn = new WelcomePageListButton(GettextCatalog.GetString("Open..."), null, openProjectIcon, "monodevelop://MonoDevelop.Ide.Commands.FileCommands.OpenFile"); btn.WidthRequest = (int)(Styles.WelcomeScreen.Pad.Solutions.SolutionTile.Width / 2.3); btn.BorderPadding = 6; btn.LeftTextPadding = 24; hbox.PackStart(btn, false, false, 0); box.PackStart(hbox, false, false, 0); //TODO: pinned files foreach (var recent in DesktopService.RecentFiles.GetProjects().Take(itemCount)) { var filename = recent.FileName; var accessed = recent.TimeStamp; var pixbuf = ImageService.GetPixbuf(GetIcon(filename), IconSize.Dnd); var button = new WelcomePageListButton(recent.DisplayName, System.IO.Path.GetDirectoryName(filename), pixbuf, "project://" + filename); button.BorderPadding = 2; button.AllowPinning = true; button.Pinned = recent.IsFavorite; //FIXME: update times as needed. currently QueryTooltip causes crashes on Windows //button.QueryTooltip += delegate (object o, QueryTooltipArgs args) { // args.Tooltip.Text = filename + "\n" + TimeSinceEdited (accessed); // args.RetVal = true; //}; //button.HasTooltip = true; button.TooltipText = filename + "\n" + TimeSinceEdited(accessed); box.PackStart(button, false, false, 0); button.PinClicked += delegate { DesktopService.RecentFiles.SetFavoriteFile(filename, button.Pinned); }; } this.ShowAll(); }
private void PopulatePersonView() { List <Widget> children = new List <Widget> (vbox.Children); foreach (Widget child in children) { vbox.Remove(child); try { child.Destroy(); } catch {} } // personCardMap.Clear (); if (model == null) { Logger.Debug("PersonView.PopulatePersonView returning since the model is null."); return; } TreeIter iter; // Loop through the model, create the PersonCard objects and add // them into the vbox. if (model.GetIterFirst(out iter)) { do { Person person = model.GetValue(iter, 0) as Person; if (person == null) { continue; } TreePath path = model.GetPath(iter); PersonCard card = new PersonCard(person); card.Size = personCardSize; card.ShowAll(); vbox.PackStart(card, false, false, 0); vbox.ReorderChild(card, path.Indices [0]); // personCardMap[iter] = card; } while (model.IterNext(ref iter)); } }
/// <summary> /// Removes a expression from the expression list. /// </summary> /// <param name="widget"> /// A <see cref="SyntacticalExpressionWidget"/> /// </param> public void RemoveExpression(SyntacticalExpressionWidget widget) { synEdExpressionsVB.Remove(widget); foreach (SyntacticalExpressionWidget childWidget in synEdExpressionsVB.Children) { childWidget.CheckPosition(); } }
public ScrollWindowSample() { ScrollView v1 = new ScrollView(); VBox b1 = new VBox(); for (int n = 0; n < 30; n++) { b1.PackStart(new Label("Line " + n), BoxMode.None); } Button u = new Button("Click to remove"); u.Clicked += delegate { b1.Remove(u); }; b1.PackStart(u); v1.Content = b1; v1.VerticalScrollPolicy = ScrollPolicy.Always; v1.BorderVisible = false; PackStart(v1, BoxMode.FillAndExpand); ScrollView v2 = new ScrollView(); VBox b2 = new VBox(); for (int n = 0; n < 10; n++) { b2.PackStart(new Label("Line " + n), BoxMode.None); } v2.Content = b2; v2.VerticalScrollPolicy = ScrollPolicy.Never; PackStart(v2, BoxMode.FillAndExpand); ScrollView v3 = new ScrollView(); VBox b3 = new VBox(); Button b = new Button("Click to add items"); b.Clicked += delegate { for (int n = 0; n < 10; n++) { b3.PackStart(new Label("Line " + n), BoxMode.None); } }; b3.PackStart(b); v3.Content = b3; v3.VerticalScrollPolicy = ScrollPolicy.Automatic; PackStart(v3, BoxMode.FillAndExpand); ScrollView v4 = new ScrollView(); PackStart(v4, BoxMode.FillAndExpand); var sb = new ScrollableCanvas(); v4.Content = sb; v4.VerticalScrollPolicy = ScrollPolicy.Always; }
public void Clear() { tiles.ForEach(tile => { tile.Hide(); tile.ActiveChanged -= OnTileActiveChanged; tile.SizeAllocated -= OnTileSizeAllocated; tile.Owner = null; box.Remove(tile); tile.Dispose(); tile.Destroy(); }); tiles.Clear(); foreach (Widget child in box.Children) { box.Remove(child); child.Dispose(); child.Destroy(); } }
public void OnServiceRemoved(object o, ServiceArgs args) { Logger.Debug("TargetWindow:OnServiceRemoved called for {0}", args.ServiceInfo.Name); Gtk.Application.Invoke(delegate { Logger.Debug("Remove the service {0}", args.ServiceInfo.Name); if (targets.ContainsKey(args.ServiceInfo.ID)) { targetVBox.Remove(targets[args.ServiceInfo.ID]); targets.Remove(args.ServiceInfo.ID); } }); }
/// <summary> /// Add a user control to the right hand panel. If Control is null then right hand panel will be cleared. /// </summary> /// <param name="control">The control to add.</param> public void AddRightHandView(object control) { // Remove existing right hand view. foreach (var child in rightHandView.Children) { if (child != (descriptionView as ViewBase)?.MainWidget) { rightHandView.Remove(child); child.Cleanup(); } } ViewBase view = control as ViewBase; if (view != null) { CurrentRightHandView = view; rightHandView.PackEnd(view.MainWidget, true, true, 0); rightHandView.ShowAll(); } }
protected override void SetChild(IWidgetBackend child) { if (dialogChild != null) { mainBox.Remove(dialogChild); } dialogChild = child != null ? ((ViewBackend)child).Frontend : null; if (dialogChild != null) { mainBox.PackStart(dialogChild, BoxMode.FillAndExpand); } }
/// <summary> /// Loads the service details for the given service /// </summary> public void LoadService(IConnectedService service) { if (service != null) { service.StatusChanged -= HandleServiceStatusChanged; foreach (var child in sections.Children.ToArray()) { sections.Remove(child); child.Dispose(); } } this.service = details.Service = service; ConfigurationSectionWidget lastSection = null; if (service.DependenciesSection != null) { var dependencies = lastSection = new ConfigurationSectionWidget(service.DependenciesSection); dependencies.BorderLeft = dependencies.BorderRight = dependencies.BorderBottom = true; dependencies.BorderTop = false; dependencies.BorderWidth = 1; sections.PackStart(dependencies); if (service.Status != Status.Added) { dependencies.Expanded = true; } } foreach (var section in service.Sections) { var w = lastSection = new ConfigurationSectionWidget(section); w.BorderLeft = w.BorderRight = w.BorderBottom = true; w.BorderTop = false; w.BorderWidth = 1; sections.PackStart(w); } if (lastSection != null) { lastSection.CornerRadius = new Components.RoundedFrameBox.BorderCornerRadius(0, 0, 6, 6); } service.StatusChanged += HandleServiceStatusChanged; // expand the first unconfigured section if the service is already added to the project if (service.Status == Status.Added) { ExpandFirstOrUnconfiguredSection(); } Accessible.Label = service.DisplayName; }
public ClosableExpander AddListItem(string name, Widget widget, PObject obj) { if (noContentLabel != null) { contentBox.Remove(noContentLabel); noContentLabel.Destroy(); noContentLabel = null; } var expander = new ClosableExpander(); expanders++; expander.ContentLabel = name; expander.SetWidget(widget); expander.BorderWidth = 4; expander.Closed += delegate(object sender, EventArgs e) { var expanderWidget = (ClosableExpander)sender; if (!RequestClose(expanderWidget)) { return; } expanders--; obj.Remove(); if (expanderWidget.Parent == contentBox) { contentBox.Remove(expanderWidget); } expanderWidget.Destroy(); if (expanders == 0) { Clear(); } }; contentBox.PackStart(expander, true, true, 0); contentBox.Show(); expander.Expanded = false; return(expander); }
private void SetRunToStart() { ((Image)ToolbarRun.IconWidget).Pixbuf = new Gdk.Pixbuf(null, "media-playback-start-22.png"); ToolbarRun.Label = Catalog.GetString("Run"); MenuSystemRun.Sensitive = true; MenuSystemStop.Sensitive = false; StatusBar.Pop(1); StatusBar.Push(1, String.Format(Catalog.GetString("Elapsed time: {0}"), engine.ElapsedTime)); SchematicBox.Remove(progress); }
protected override void OnReallocate() { var rowBounds = ListView.GetRowBounds(CurrentRow, true); SetChildBounds(container, Bounds); container.Remove(drawer); container.PackStart(drawer); if (tracker != null) { SetChildBounds(tracker, rowBounds); tracker.QueueDraw(); } }
public void ShowToolset(string key) { Console.WriteLine("Show {0}", key); if (_toolsets.ContainsKey(key)) { if (_currentToolset != null) { _contentBox.Remove(_currentToolset); } _currentToolset = _toolsets[key]; _contentBox.PackStart(_currentToolset); } }
private void HandleSamplesTreeSelectionChanged(object sender, EventArgs e) { if (samplesTree.SelectedRow == null) { return; } if (currentSample != null) { sampleBox.Remove(currentSample); } Type t = store.GetNavigatorAt(samplesTree.SelectedRow).GetValue(widgetCol); if (t == null) { return; } currentSample = new VBox(); HBox row = null; var icons = t.GetProperties(BindingFlags.Public | BindingFlags.Static); for (int i = 0; i < icons.Length; i++) { if (i % 3 == 0) { if (row != null) { currentSample.PackStart(row); } row = new HBox(); } if (icons [i].PropertyType != typeof(Image)) { continue; } Image img = (Image)(icons [i].GetValue(typeof(Image), null)); row.PackStart(new ImageView(img.WithSize(IconSize.Large))); row.PackStart(new ImageView(img.WithSize(IconSize.Medium))); row.PackStart(new ImageView(img.WithSize(IconSize.Small))); } currentSample.PackStart(row); sampleBox.PackStart(currentSample); }
void HandleSamplesTreeSelectionChanged(object sender, EventArgs e) { if (samplesTree.SelectedRow != null) { // Remove currentInteraction if there is one if (currentInteraction != null) { // must already have a valid plot sample with the interaction added to it PlotSample ps = (PlotSample)currentWidget; PlotCanvas pc = ps.PlotCanvas; // Remove current interaction from PlotCanvas pc.RemoveInteraction(currentInteraction); currentInteraction = null; } // get newSample from selected row TreePosition viewRow = samplesTree.SelectedRow; TreeNavigator storeRow = store.GetNavigatorAt(viewRow); Sample newSample = storeRow.GetValue(sampleCol); TreePosition newCategory = newSample.Category; if (newCategory == interactionCategory) { // only allow interaction if there is already a plotSample if (currentCategory == plotCategory) { PlotSample ps = (PlotSample)currentWidget; PlotCanvas pc = ps.PlotCanvas; // Add new interaction to existing PlotCanvas currentInteraction = newSample.Interaction; pc.AddInteraction(currentInteraction); } } else { // plotCategory or testCategory currentCategory = newCategory; if (currentWidget != null) { sampleBox.Remove(currentWidget); } if (newSample.Type != null) { currentWidget = (Widget)Activator.CreateInstance(newSample.Type); sampleBox.PackStart(currentWidget, true); Dump(currentWidget, 0); } } } }
public void Reset() { if (Wrapper.Children.Length > 0) { Wrapper.Remove(Wrapper.Children [0]); } foreach (Button button in Buttons) { Buttons.Remove(button); } ShowAll(); }
protected override async Task OnLoad(CancellationToken cancellationToken) { if (box == null) { box = new VBox(); box.Accessible.SetShouldIgnore(true); Add(box); box.Show(); } var control = await contentLoader(cancellationToken); if (cancellationToken.IsCancellationRequested) { return; } if (viewControl != null) { box.Remove(viewControl); viewControl = null; } if (control != null) { viewControl = control.GetNativeWidget <Gtk.Widget> (); box.PackStart(viewControl, true, true, 0); if (bottomToolbar != null) { box.ReorderChild(bottomToolbar.Container, box.Children.Length - 1); } } if (pathDocPending != null) { ShowPathBar(pathDocPending); pathDocPending = null; } ContentInserted?.Invoke(this, EventArgs.Empty); }
void MessageBusChangeState(object sender, QuizStateEventArgs e) { var removeWidgets = mainContainer.Children.Where(c => c is IMainContent); foreach (var widget in removeWidgets) { mainContainer.Remove(widget); } switch (e.NewState) { case QuizState.Begin: playerDisplay.ResetPressHighlight(); mainContainer.PackStart(new NameEntryDisplay(), true, true, 4); buttonField.CurrentButtons = Buttons.Category; break; case QuizState.Category: playerDisplay.ResetPressHighlight(); mainContainer.PackStart(new CategoryDisplay(), true, true, 4); buttonField.CurrentButtons = Buttons.Category; break; case QuizState.Question: MessageBus.Instance.BuzzHelper.WaitForPress(); mainContainer.PackStart(new QuestionDisplay(), true, true, 4); buttonField.CurrentButtons = Buttons.Question; break; case QuizState.Answer: MessageBus.Instance.BuzzHelper.CancelWait(); playerDisplay.ResetPressHighlight(); mainContainer.PackStart(new QuestionDisplay(), true, true, 4); buttonField.CurrentButtons = Buttons.Answer; break; case QuizState.Finish: playerDisplay.ResetPressHighlight(); mainContainer.PackStart(new FinishDisplay(), true, true, 4); buttonField.CurrentButtons = Buttons.End; break; default: break; } this.ShowAll(); }
void Button_Clicked(object sender, EventArgs e) { TouchButtonIcon button = (TouchButtonIcon)sender; EntryBoxValidationButton entryBoxValidationButton = (button.Parent.Parent.Parent as EntryBoxValidationButton); _vbox.Remove(entryBoxValidationButton); _datesList.Remove(Convert.ToDateTime(entryBoxValidationButton.EntryValidation.Text)); //Trigger Event OnChange(); if (_debug) { ListValue(); } }
void buttonDelete_Clicked(object sender, EventArgs e) { TouchButtonIcon button = (TouchButtonIcon)sender; EntryBoxValidationButton entryBoxValidationButton = (button.Parent.Parent.Parent as EntryBoxValidationButton); _vbox.Remove(entryBoxValidationButton); _fileList.Remove(entryBoxValidationButton.EntryValidation.Text); //Trigger Event OnChange(); if (_debug) { ListValue(); } }
public void ShowTools() { // Remove any open editor, if present. if (current_editor != null) { active_editor.Hide(); widgets.Remove(active_editor); active_editor = null; current_editor.Restore(); current_editor = null; } // No need to build the widget twice. if (buttons != null) { buttons.Show(); return; } if (widgets == null) { widgets = new VBox(false, 0) { NoShowAll = true }; widgets.Show(); var widgets_port = new Viewport(); widgets_port.Add(widgets); Add(widgets_port); widgets_port.ShowAll(); } // Build the widget (first time we call this method). buttons = new VButtonBox { BorderWidth = 5, Spacing = 5, LayoutStyle = ButtonBoxStyle.Start }; foreach (var editor in editors) { PackButton(editor); } buttons.Show(); widgets.Add(buttons); }
public void Reset() { Header = ""; Description = ""; if (Wrapper.Children.Length > 0) { Wrapper.Remove(Wrapper.Children [0]); } foreach (Button button in Buttons) { Buttons.Remove(button); } ShowAll(); }
public void Fill(SolutionFolder parentCombine, SolutionItem entry, ISolutionItemFeature[] features) { selectedFeatures.Clear(); selectedEditors.Clear(); this.entry = entry; this.parentCombine = parentCombine; foreach (Gtk.Widget w in box.Children) { box.Remove(w); w.Destroy(); } // Show enabled features at the beginning foreach (ISolutionItemFeature feature in features) { if (feature.GetSupportLevel(parentCombine, entry) == FeatureSupportLevel.Enabled) { Gtk.Widget editor = AddFeature(feature); selectedFeatures.Add(feature); selectedEditors.Add(editor); } } foreach (ISolutionItemFeature feature in features) { if (feature.GetSupportLevel(parentCombine, entry) != FeatureSupportLevel.Enabled) { AddFeature(feature); } } if (box.Children.Length == 0) { // No features Label lab = new Label(); lab.Xalign = 0; lab.Text = GettextCatalog.GetString("There are no additional features available for this project."); box.PackStart(lab, false, false, 0); lab.Show(); } if (scrolled.Child == null) { scrolled.AddWithViewport(box); } }
private void Btn_ButtonPressEvent(object sender, ButtonPressEventArgs args) { for (int i = 0; i < tabs.Count; i++) { if (tabs[i].button == sender) { selectedIndex = i; tabs[i].button.Bold = true; propsVBox.PackStart(tabs[i].properties, false, false, 0); } else { tabs[i].button.Bold = false; propsVBox.Remove(tabs[i].properties); } } }
public ScrollWindowSample() { ScrollView v1 = new ScrollView (); VBox b1 = new VBox (); for (int n=0; n<30; n++) b1.PackStart (new Label ("Line " + n), BoxMode.None); Button u = new Button ("Click to remove"); u.Clicked += delegate { b1.Remove (u); }; b1.PackStart (u); v1.Content = b1; v1.VerticalScrollPolicy = ScrollPolicy.Always; v1.BorderVisible = false; PackStart (v1, BoxMode.FillAndExpand); ScrollView v2 = new ScrollView (); VBox b2 = new VBox (); for (int n=0; n<10; n++) b2.PackStart (new Label ("Line " + n), BoxMode.None); v2.Content = b2; v2.VerticalScrollPolicy = ScrollPolicy.Never; PackStart (v2, BoxMode.FillAndExpand); ScrollView v3 = new ScrollView (); VBox b3 = new VBox (); Button b = new Button ("Click to add items"); b.Clicked += delegate { for (int n=0; n<10; n++) b3.PackStart (new Label ("Line " + n), BoxMode.None); }; b3.PackStart (b); v3.Content = b3; v3.VerticalScrollPolicy = ScrollPolicy.Automatic; PackStart (v3, BoxMode.FillAndExpand); ScrollView v4 = new ScrollView (); PackStart (v4, BoxMode.FillAndExpand); var sb = new ScrollableCanvas (); v4.Content = sb; v4.VerticalScrollPolicy = ScrollPolicy.Always; }
private void TaskManager_TaskRemoved(object sender, QueueableTaskEventArgs e) { var count = _taskManager.Count; DisplayName = count == 0 ? "Tasks" : $"Tasks ({count})"; var tv = _taskViews.FirstOrDefault(v => v.Task == e.Task); if (tv == null) { return; } Application.Invoke(() => { _taskViews.Remove(tv); _vBox.Remove(tv); }); }
void HandleSamplesTreeSelectionChanged(object sender, EventArgs e) { if (samplesTree.SelectedRow != null) { if (currentSample != null) { sampleBox.Remove(currentSample); } Sample s = store.GetNavigatorAt(samplesTree.SelectedRow).GetValue(widgetCol); if (s.Type != null) { if (s.Widget == null) { s.Widget = (Widget)Activator.CreateInstance(s.Type); } sampleBox.PackStart(s.Widget, BoxMode.FillAndExpand); } } }
protected override void OnReallocate() { if (CurrentRow == null) { CurrentRow = TreeStore.GetFirstNode(); } var rowBounds = TreeView.GetRowBounds(CurrentRow.CurrentPosition, true); SetChildBounds(container, Bounds); container.Remove(drawer); container.PackStart(drawer); container.QueueForReallocate(); if (tracker != null) { SetChildBounds(tracker, rowBounds); tracker.QueueDraw(); } }
public void LoadImages(XDocument doc) { if (posts != null) { foreach (VBox post in posts.Children) { foreach (Widget obj in post.Children) { post.Remove(obj); obj.Destroy(); } posts.Remove(post); post.Destroy(); } } posts = new VBox(); vbox3.PackStart(posts, true, true, 1); IEnumerable <XElement> posts_list = doc.XPathSelectElements("/posts/post"); foreach (XElement elem in posts_list) { VBox post = new VBox(); string title = elem.XPathSelectElement("title").Value; string description = elem.XPathSelectElement("description").Value; post.PackStart(new Label(title), true, true, 1); IEnumerable <XElement> urls_list = elem.XPathSelectElements("img/url"); foreach (XElement urls in urls_list) { Gtk.EventBox eventBox = new Gtk.EventBox(); string file_img_default = urls.XPathSelectElement("default").Value; string file_img_original = urls.XPathSelectElement("original").Value; Gtk.Image new_img = new Gtk.Image(file_img_default); eventBox.Add(new_img); eventBox.ButtonPressEvent += delegate { new Project.ImgWindow(title, description, file_img_original); }; post.PackEnd(eventBox, true, true, 1); } posts.PackStart(post, true, true, 1); } posts_list = null; ShowAll(); }