Esempio n. 1
0
 private void DeviceDisconnected(object sender, EventArgs args)
 {
     if (!(sender is IDevice))
     {
         return;
     }
     Gtk.Application.Invoke(delegate {
         foreach (IDeviceInformation deviceInformation in _DeviceInformations)
         {
             if (deviceInformation.Device == (IDevice)sender)
             {
                 _HBox.Remove(deviceInformation.Separator);
                 _HBox.Remove(deviceInformation.Widget);
                 _DeviceInformations.Remove(deviceInformation);
                 int height = 0;
                 int width  = 0;
                 this.GetSize(out width, out height);
                 this.Resize(10, height);
                 Gtk.TreeIter iter = _DeviceNodes[deviceInformation];
                 _ListStore.Remove(ref iter);
                 break;
             }
         }
     });
 }
Esempio n. 2
0
        private void AppendStep(StepBase step)
        {
            int curIndex = steps.IndexOf(currentStep);

            for (int i = steps.Count - 1; i > curIndex; i--)
            {
                StepTag t = tags [curIndex];
                hboSteps.Remove(t);
                tags.RemoveAt(i);
                StepBase s = steps [i];
                s.StatusChanged -= step_StatusChanged;
                steps.RemoveAt(i);
            }

            steps.Add(step);
            step.Assistant      = this;
            step.StatusChanged += step_StatusChanged;

            StepTag tag = new StepTag(step);

            tag.Show();
            tag.Toggled += Tag_Toggled;
            hboSteps.PackStart(tag, false, true, 0);
            tags.Add(tag);

            SetActiveStep(step);
        }
Esempio n. 3
0
        private void SetUpVarieties(Planting planting)
        {
            string[] labels = new string[Varieties.Count];
            keys = new VarietyKeySeq[Varieties.Count];
            var en = Varieties.Keys.GetEnumerator();

            for (int i = 0; en.MoveNext() && i < Varieties.Count; i++)
            {
                keys[i]   = en.Current;
                labels[i] = GardenData.LoadedData.GetVariety(en.Current).Name + " x " + Varieties[en.Current].Count;
            }
            VarityBox = new ComboBoxEntry(labels);


            VarityBox.Changed += (object sender, EventArgs e) =>
            {
                VarietyRemoveButton.Sensitive = VarityBox.Active >= 0;
                VarietyEditButton.Sensitive   = VarityBox.Active >= 0;
            };


            if (VarietiesLabeledHBox != null)
            {
                VarietiesInnerHBox.Remove(VarietyRemoveButton);
                VarietiesInnerHBox.Remove(VarietyEditButton);
                RemoveLabeledEntry(VarietiesLabeledHBox);
            }

            VarietyRemoveButton           = new Button("Remove");
            VarietyRemoveButton.Sensitive = false;

            VarietyRemoveButton.Clicked += (object sender, EventArgs e) =>
            {
                Varieties.Remove(keys[VarityBox.Active]);
                SetUpVarieties(planting);
            };

            VarietyEditButton           = new Button("Edit");
            VarietyEditButton.Sensitive = false;
            VarietyEditButton.Clicked  += (sender, e) =>
            {
                EditPlantingInfoWindow.ShowPlantingInfoWindow(Varieties[keys[VarityBox.Active]], (plantingInfo) =>
                {
                    GardenDrawingArea area = GardenDrawingArea.ActiveInstance;
                    area.Draw();
                    MainWindow.GetInstance().ShowAreaSelectionInfo(area.SelectedArea);
                }, planting, GardenData.LoadedData.GetVariety(keys[VarityBox.Active]).Name);
            };

            VarietiesInnerHBox = new HBox();
            VarietiesInnerHBox.Add(VarityBox);

            VarietiesInnerHBox.Add(VarietyEditButton);
            VarietiesInnerHBox.Add(VarietyRemoveButton);
            VarietiesLabeledHBox = AddLabeledEntry("Varieties", VarietiesInnerHBox);
            ShowAll();
        }
        void DetachTabstrip(GtkShellDocumentViewContainer item)
        {
            bottomBarBox.Remove(item.tabstrip);
            item.OnDetachedTabstripFromParent();

            // Make the tab corresponding to the item visible again, since we are removing its tabstrip from our tab area
            var localTab = tabstrip.Tabs.FirstOrDefault(t => t.Tag == item);

            if (localTab != null)
            {
                localTab.Visible = true;
            }
        }
Esempio n. 5
0
        private void BuildBands()
        {
            foreach (Widget widget in band_box.Children)
            {
                band_box.Remove(widget);
            }

            if (frequencies == null || frequencies.Length <= 0)
            {
                frequencies = new uint[0];
                band_scales = new EqualizerBandScale[0];
                return;
            }

            band_scales = new EqualizerBandScale[10];

            for (uint i = 0; i < 10; i++)
            {
                // Translators: {0} is a numerical value, Hz and kHz are Hertz unit symbols
                string label = frequencies[i] < 1000 ?
                               String.Format(Catalog.GetString("{0} Hz"), frequencies[i]) :
                               String.Format(Catalog.GetString("{0} kHz"), (int)Math.Round(frequencies[i] / 1000.0));

                band_scales[i] = new EqualizerBandScale(i, range[1] * 10, range[0] * 10, range[2] * 10, label);
                band_scales[i].ValueChanged += OnEqualizerValueChanged;
                band_scales[i].Show();

                band_box.PackStart(band_scales[i], true, true, 0);
            }
        }
        /// <summary>
        /// Removes a widget from the container.
        /// </summary>
        /// <param name="widget">
        /// The <see cref="ExpressionItemWidget"/> that will be removed
        /// </param>
        public void RemoveItem(ExpressionItemWidget widget)
        {
            expItemsBox.Remove(widget);


            if (expItemsBox.Children.Length == 0)
            {
                expItemsScroller.HeightRequest = 85;
            }
            else
            {
                int maxRequest = -1;

                foreach (ExpressionItemWidget childWidget in expItemsBox.Children)
                {
                    if (maxRequest < childWidget.HeightRequest)
                    {
                        maxRequest = childWidget.HeightRequest;
                    }

                    childWidget.CheckPosition();
                }


                expItemsScroller.HeightRequest = maxRequest + 20;
            }
        }
Esempio n. 7
0
        public void Remove(int index)
        {
            Widget child = m_box.Children [index];

            m_box.Remove(child);

            if (m_Selected == index)
            {
                m_Selected = -1;
            }
            else if (m_Selected >= index)
            {
                m_Selected--;
            }

            if (m_Hovered >= index)
            {
                m_Hovered--;
            }

            if (this.ModeRemoved != null)
            {
                this.ModeRemoved(this, new ModeButtonEventArgs(index, child));
            }

            this.QueueDraw();
        }
Esempio n. 8
0
 ///<summary>
 ///	Updates the showing of the removal button.
 ///</summary>
 private void UpdateRemoveButton()
 {
     if (showRemoveButton)
     {
         if (removeButton == null)
         {
             Gtk.Image actionImage = new Gtk.Image(Utilities.GetIcon("gtk-stop", 24));
             removeButton             = new Gtk.Button();
             removeButton.BorderWidth = 0;
             removeButton.Relief      = Gtk.ReliefStyle.None;
             removeButton.CanFocus    = false;
             removeButton.Clicked    += OnRemoveClicked;
             removeButton.Image       = actionImage;
             removeBox.PackStart(removeButton, false, false, 0);
             removeButton.Show();
             toolTips.SetTip(removeButton,
                             Catalog.GetString("Remove this person"),
                             Catalog.GetString("Remove this person"));
         }
         // if a remove has been requested already for this user, make the button not sensitive
         removeButton.Sensitive = !removeRequested;
     }
     else
     {
         if (removeButton != null)
         {
             removeBox.Remove(removeButton);
             removeButton = null;
         }
     }
 }
Esempio n. 9
0
 void UpdateStaticInfo()
 {
     if (Debater != null)
     {
         HBox c = infoWidgets["roleAndClub"] as HBox;
         if (Debater.Role.IsTeamMember)
         {
             SetMarkup(c.Children[1], GLib.Markup.EscapeText(Debater.Role.TeamName)
                       + "\n" + GLib.Markup.EscapeText(Debater.Club.Name));
         }
         else if (Debater.Role.IsJudge)
         {
             HBox hboxStars = c.Children[0] as HBox;
             foreach (Widget w in hboxStars)
             {
                 hboxStars.Remove(w);
             }
             // Display stars for judgeQuality
             for (int i = 0; i < Debater.Role.JudgeQuality; i++)
             {
                 hboxStars.Add(new Image(MiscHelpers.LoadIcon("face-smile")));
             }
             if (Debater.Role.JudgeQuality > 0)
             {
                 c.Spacing = 6;
             }
             SetMarkup(c.Children[1], Debater.Club.Name);
         }
     }
 }
Esempio n. 10
0
 void HideStatusIcon(StatusIcon icon)
 {
     statusIconBox.Remove(icon.EventBox);
     if (statusIconBox.Children.Length == 0)
     {
         statusIconBox.Hide();
     }
     icon.EventBox.Destroy();
 }
Esempio n. 11
0
 public void Clear()
 {
     ellipsized = true;
     currentTab = -1;
     foreach (Widget w in box.Children)
     {
         box.Remove(w);
         w.Destroy();
     }
 }
Esempio n. 12
0
        /// <summary>
        /// Remove an item from this container.
        /// </summary>
        /// <param name="widget">
        /// A <see cref="ExpressionItemWidget"/>
        /// </param>
        public void RemoveItem(ExpressionItemWidget widget)
        {
            expGroupItemsBox.Remove(widget);

            foreach (ExpressionItemWidget childWidget in expGroupItemsBox)
            {
                childWidget.CheckPosition();
            }

            CheckHeight();
        }
Esempio n. 13
0
 void UpdateStyle(object sender = null, EventArgs e = null)
 {
     OnUpdateStyle();
     if (label != null)
     {
         box.Remove(label);
         box.PackStart(label = CreateLabel());
         box.ShowAll();
         Update();
     }
     QueueResize();
 }
Esempio n. 14
0
        //Process here the AccordionChildButton Events, only here we have access to BackOffice Objects. Ex.: _hboxContent
        protected void accordion_Clicked(object sender, EventArgs e)
        {
            try
            {
                dynamic clickedButton;

                if (sender.GetType() == typeof(AccordionParentButton))
                {
                    clickedButton = (AccordionParentButton)sender;
                }
                else
                {
                    clickedButton = (AccordionChildButton)sender;
                }

                //Show Button Content if its a Chield Button
                if (clickedButton.GetType() == typeof(AccordionChildButton))
                {
                    if (clickedButton.Content != null)
                    {
                        if (_nodeContent != null)
                        {
                            _hboxContent.Remove(_nodeContent);
                        }
                        _nodeContent = clickedButton.Content;
                        //Store active content button nodeContentActiveButton to reference to have access to Name, used for previleges etc
                        _accordion.CurrentChildButtonContent = clickedButton;
                        _labelActiveContent.Text             = clickedButton.Label;

                        if (!_nodeContent.Visible)
                        {
                            _nodeContent.Visible = true;
                        }
                        _hboxContent.PackStart(_nodeContent);
                    }
                    else
                    {
                        if (clickedButton.ExternalAppFileName != null)
                        {
                            FrameworkUtils.ExecuteExternalProcess(clickedButton.ExternalAppFileName);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
        private void SetValueEntry(QueryValueEntry entry)
        {
            if (first)
            {
                first = false;
            }
            else
            {
                value_box.Remove(value_box.Children [0]);
            }

            current_value_entry = entry;
            value_box.PackStart(current_value_entry, false, true, 0);
            current_value_entry.ShowAll();
        }
Esempio n. 16
0
        /// <summary>
        /// Hide all Entry widgets and clear their input values.
        /// </summary>
        private void HideAllEntryWidgets()
        {
            _processNameEntry.Text      = "";
            _processIdEntry.Text        = "";
            _memoryFiltrationEntry.Text = "";
            _cpuFiltrationEntry.Text    = "";

            // Loop through all _filtrationHBox children and remove all of them but 'GtkComboBox'
            _filtrationHBox.Foreach(widget =>
            {
                if (widget.Name != "GtkComboBox")
                {
                    _filtrationHBox.Remove(widget);
                }
            });
        }
Esempio n. 17
0
 void UpdateImage()
 {
     if (string.IsNullOrEmpty (icon)) {
         if (image != null) {
             box.Remove (image);
             image.Destroy ();
             image = null;
         }
         return;
     }
     if (image == null) {
         image = new Gtk.Image ();
         int w, h;
         Gtk.Icon.SizeLookup (iconSize, out w, out h);
         image.IconSize = w;
         box.PackStart (image, false, false, 0);
         box.ReorderChild (image, 0);
     }
     image.Pixbuf = ImageService.GetPixbuf (icon, iconSize);
 }
 void UpdateImage()
 {
     if (string.IsNullOrEmpty(icon))
     {
         if (image != null)
         {
             box.Remove(image);
             image.Destroy();
             image = null;
         }
         return;
     }
     if (image == null)
     {
         image = new ImageView();
         box.PackStart(image, false, false, 0);
         box.ReorderChild(image, 0);
     }
     image.Image = ImageService.GetIcon(icon, iconSize);
 }
Esempio n. 19
0
        public void PlaceFilmstrip(Orientation pos, bool force)
        {
            if (!force && filmstrip.Orientation == pos)
            {
                return;
            }
            filmstrip.Orientation = pos;

            System.Collections.IEnumerator widgets;
            switch (pos)
            {
            case Orientation.Horizontal:
                widgets = inner_hbox.AllChildren.GetEnumerator();
                while (widgets.MoveNext())
                {
                    if (widgets.Current == filmstrip)
                    {
                        inner_hbox.Remove(filmstrip);
                        break;
                    }
                }
                inner_vbox.PackStart(filmstrip, false, false, 0);
                inner_vbox.ReorderChild(filmstrip, 0);
                break;

            case Orientation.Vertical:
                widgets = inner_vbox.AllChildren.GetEnumerator();
                while (widgets.MoveNext())
                {
                    if (widgets.Current == filmstrip)
                    {
                        inner_vbox.Remove(filmstrip);
                        break;
                    }
                }
                inner_hbox.PackEnd(filmstrip, false, false, 0);
                break;
            }
            Preferences.Set(Preferences.FILMSTRIP_ORIENTATION, (int)pos);
        }
Esempio n. 20
0
        public void Reset()
        {
            Header      = "";
            Description = "";

            if (OptionArea.Children.Length > 0)
            {
                OptionArea.Remove(OptionArea.Children [0]);
            }

            if (Wrapper.Children.Length > 0)
            {
                Wrapper.Remove(Wrapper.Children [0]);
            }

            foreach (Button button in Buttons)
            {
                Buttons.Remove(button);
            }

            ShowAll();
        }
Esempio n. 21
0
        private void BuildToolbars(IWorkspace workspace)
        {
            _toolBarBox.Remove(_toolBar);
            _toolBar.Destroy();                         // make sure the old one is cleaned up!
            _toolBar = new Toolbar();
            _toolBar.ToolbarStyle = ToolbarStyle.Icons;
            _toolBarBox.PackStart(_toolBar, true, true, 0);
            _tooltips = new Tooltips();

            ActionModelRoot model = new ActionModelRoot("");

            //model.Merge(WorkstationModel.ToolManager.ToolbarModel);
            model.Merge(DesktopApplication.ToolSet.ToolbarModel);
            if (workspace != null)
            {
                //model.Merge(workspace.ToolManager.ToolbarModel);
                model.Merge(workspace.ToolSet.ToolbarModel);
            }
            GtkToolbarBuilder.BuildToolbar(_toolBar, _tooltips, model);

            _toolBar.ShowAll();
        }
        public void ShowMessage(Image image, string message, bool isMarkup)
        {
            if (message == lastText)
            {
                return;
            }
            sourcePad = null;
            lastText  = message;
            DispatchService.AssertGuiThread();
            if (currentStatusImage != image)
            {
                if (currentStatusImage != null)
                {
                    messageBox.Remove(currentStatusImage);
                }
                currentStatusImage = image;
                if (image != null)
                {
                    image.SetPadding(0, 0);
                    messageBox.PackStart(image, false, false, 3);
                    messageBox.ReorderChild(image, 1);
                    image.Show();
                }
            }

            string txt = !String.IsNullOrEmpty(message) ? " " + message.Replace("\n", " ") : "";

            if (isMarkup)
            {
                statusLabel.Markup = txt;
            }
            else
            {
                statusLabel.Text = txt;
            }
        }
Esempio n. 23
0
        private void Refresh()
        {
            box.Show();

            try {
                if (left is string)
                {
                    diff = new Diff((string)left, (string)right, true, true);
                }
                else if (left is string[])
                {
                    diff = new Diff((string[])left, (string[])right, null, null);
                }
            } catch (Exception e) {
                Console.Error.WriteLine(e.ToString());
                return;
            }

            if (widget != null)
            {
                pos = widget.Position;
                box.Remove(widget);
                widget.Dispose();
            }

            DiffWidget.Options opts = new DiffWidget.Options();
            opts.Font      = DesktopService.DefaultMonospaceFont;
            opts.LeftName  = "Repository";
            opts.RightName = "Working Copy";
            widget         = new DiffWidget(diff, opts);

            box.Add(widget);
            box.ShowAll();

            widget.ExposeEvent += new ExposeEventHandler(OnExposed);
        }
Esempio n. 24
0
        public void Remove(int index)
        {
            if (ModeCount <= 0)
            {
                return;
            }
            Widget child = m_box.Children [index];

            modeCount--;
            if (ModeCount <= 0)
            {
                Sensitive = false;
            }
            m_box.Remove(child);

            if (selected == index)
            {
                selected = -1;
            }
            else if (selected >= index)
            {
                selected--;
            }

            if (m_Hovered >= index)
            {
                m_Hovered--;
            }

            if (ModeRemoved != null)
            {
                ModeRemoved(this, new ModeButtonEventArgs(index, child));
            }

            QueueDraw();
        }
 void HideStatusIcon(StatusIcon icon)
 {
     statusIconBox.Remove(icon.EventBox);
     icon.EventBox.Destroy();
 }
Esempio n. 26
0
        public ListViewAssociation(bool simple = true)
        {
            if (simple)
            {
                listViewFilter = new ListBoxFilter <T> {
                    List          = new List <T> (),
                    MinHeight     = 200,
                    MinWidth      = 300,
                    SelectionMode = selectionMode,
                };
            }
            else
            {
                listViewFilter = new ListView <T> {
                    List          = new List <T> (),
                    MinHeight     = 200,
                    MinWidth      = 600,
                    SelectionMode = selectionMode,
                };
            }

            add.Clicked += delegate {
                var dialogo = new Dialog {
                    Title = string.Format(Application.TranslationCatalog.GetString("Add {0}"), Title),
                };

                if (simple)
                {
                    listViewFilter = new ListBoxFilter <T> {
                        List          = new List <T> (),
                        MinHeight     = 200,
                        MinWidth      = 300,
                        SelectionMode = selectionMode,
                    };
                }
                else
                {
                    var listViewSelector = new ListView <T> {
                        List          = new List <T> (),
                        MinHeight     = 200,
                        MinWidth      = 600,
                        SelectionMode = selectionMode,
                    };
                    listViewSelector.RemoveColumnAt(columnsRemoved);
                    listViewFilter = listViewSelector;
                }

                dialogo.Buttons.Add(Command.Cancel, Command.Add);

                listViewFilter.List = ListAvailable.Except(List).ToList();

                var box = new HBox();
                box.PackStart((Widget)listViewFilter, true, true);
                dialogo.Content = box;
                if (dialogo.Run() == Command.Add)
                {
                    //TODO permitir multiseleccion para poder agregar de a mas de un elemento a la vez
                    if (listViewFilter.SelectedItems.Count == 0)
                    {
                        MessageDialog.ShowWarning(Application.TranslationCatalog.GetString("Must select a item."));
                    }
                    else
                    {
                        foreach (var item in listViewFilter.SelectedItems)
                        {
                            if (OnSimilarity(List, item))
                            {
                                MessageDialog.ShowWarning(Application.TranslationCatalog.GetString("A validation rule prevents adding this item."));
                            }
                            else
                            {
                                if (AddItem != null)
                                {
                                    OnAddItem(item);
                                }
                                else
                                {
                                    listView.Add(item);
                                }
                            }
                        }
                        OnChanged();
                    }
                }

                box.Remove((Widget)listViewFilter);
                dialogo.Close();
            };

            remove.Clicked += delegate {
                //TODO ver como resolver que se puedan remover multiples items a la vez
                var row = listView.SelectedRow;
                if (row == -1)
                {
                    MessageDialog.ShowMessage(string.Format(Application.TranslationCatalog.GetString("Select a {0} to remove"), TypeName()));
                }
                else
                {
                    if (OnPreventRemove(listView.SelectedItem))
                    {
                        MessageDialog.ShowWarning(Application.TranslationCatalog.GetString("A validation rule prevents you from deleting the selected item"));
                    }
                    else
                    {
                        OnRemoveItem(listView.SelectedItem);
                        listView.Remove();
                        OnChanged();
                    }
                }
            };

            actions.PackStart(add);
            actions.PackStart(remove);
            PackStart(listView, true, true);
            PackEnd(actions, false, true);
        }
Esempio n. 27
0
        public ListViewAction()
        {
            add.Clicked += delegate {
                var dialogo = new Dialog {
                    Title = string.Format(Application.TranslationCatalog.GetString("New {0}"), Title),
                };

                dialogo.Buttons.Add(Command.Cancel, Command.Add);

                var item = new T();
                ItemUI.ValuesClean();
                ItemUI.Item = item;
                OnBeforeAdd(item);
                ItemUI.ValuesRefresh();
                ItemUI.Editable(true);
                var w   = (Widget)ItemUI;
                var box = new HBox();
                box.PackStart(w, true, true);
                dialogo.Content = box;
                if (dialogo.Run() == Command.Add)
                {
                    ItemUI.ValuesTake();
                    if (OnPreventAdd(ItemUI.Item))
                    {
                        MessageDialog.ShowWarning(Application.TranslationCatalog.GetString("A validation rule prevents you from add the item"));
                    }
                    else if (OnSimilarity(List, ItemUI.Item))
                    {
                        MessageDialog.ShowWarning(Application.TranslationCatalog.GetString("A similar element already exists in the list. Try to modify the existing one"));
                    }
                    else
                    {
                        listView.Add(item);
                        listView.SelectedItem = item;
                        ScrollTo(item);
                        OnItemEdited(ItemUI.Item);
                        OnChanged();
                    }
                }

                box.Remove(w);
                dialogo.Close();
            };

            edit.Clicked += delegate {
                var dialogo = new Dialog {
                    Title = string.Format(Application.TranslationCatalog.GetString("Edit {0}"), Title),
                };

                dialogo.Buttons.Add(Command.Cancel, Command.Apply);

                var row = listView.SelectedRow;
                if (row == -1)
                {
                    MessageDialog.ShowMessage(string.Format(Application.TranslationCatalog.GetString("Select a {0} to edit"), Title));
                }
                else
                {
                    ItemUI.ValuesClean();
                    ItemUI.Item = listView.SelectedItem;
                    ItemUI.ValuesRefresh();
                    ItemUI.Editable(true);
                    var widget = (Widget)ItemUI;
                    var box    = new HBox();
                    box.PackStart(widget, true, true);
                    dialogo.Content = box;
                    if (dialogo.Run() == Command.Apply)
                    {
                        ItemUI.ValuesTake();
                        if (OnSimilarity(List, ItemUI.Item))
                        {
                            MessageDialog.ShowWarning(Application.TranslationCatalog.GetString("A similar element already exists in the list. Try to modify the existing one"));
                        }
                        else
                        {
                            listView.FillRow(row, listView.SelectedItem);
                            OnItemEdited(ItemUI.Item);
                            OnChanged();
                        }
                    }
                    box.Remove(widget);
                    dialogo.Close();
                }
            };

            remove.Clicked += delegate {
                var row = listView.SelectedRow;
                if (row == -1)
                {
                    MessageDialog.ShowMessage(string.Format(Application.TranslationCatalog.GetString("Select a {0} to remove"), Title));
                }
                else
                {
                    if (OnPreventRemove(listView.SelectedItem))
                    {
                        MessageDialog.ShowWarning(Application.TranslationCatalog.GetString("A validation rule prevents you from deleting the selected item"));
                    }
                    else
                    {
                        listView.Remove();
                        OnChanged();
                    }
                }
            };

            listView.RowActivated += delegate(object sender, ListViewRowEventArgs e) {
                OnRowActivated();
                if (ShowOnRowActivated)
                {
                    var dialogo = new Dialog {
                        Title = Title,
                    };

                    if (e.RowIndex == -1)
                    {
                        MessageDialog.ShowMessage(string.Format(Application.TranslationCatalog.GetString("Select a {0} to show"), Title));
                    }
                    else
                    {
                        ItemUI.ValuesClean();
                        ItemUI.Item = listView.SelectedItem;
                        ItemUI.ValuesRefresh();
                        ItemUI.Editable(false);
                        var widget = (Widget)ItemUI;
                        var box    = new HBox();
                        box.PackStart(widget, true, true);
                        dialogo.Content = box;
                        dialogo.Run();
                        box.Remove(widget);
                        dialogo.Close();
                    }
                }
            };

            actions.PackStart(add);
            actions.PackStart(edit);
            actions.PackStart(remove);
            PackStart(listView, true, true);
            PackEnd(actions, false, true);
        }
Esempio n. 28
0
        public ListBoxAction(IController <T> controller = null)
        {
            add.Clicked += delegate {
                var dialogo = new Dialog {
                    Title = string.Format(Application.TranslationCatalog.GetString("Add {0}"), Title),
                };

                dialogo.Buttons.Add(Command.Cancel, Command.Add);

                var w = new ListBoxFilter <T> {
                    List      = ListAvailable.Except(List).ToList() ?? controller.List.Except(List).ToList(),
                    MinHeight = 200,
                    MinWidth  = 300
                };
                var box = new HBox();
                box.PackStart(w, true, true);
                dialogo.Content = box;
                if (dialogo.Run() == Command.Add)
                {
                    if (w.SelectedItems.Count == 0)
                    {
                        MessageDialog.ShowWarning(Application.TranslationCatalog.GetString("Must select a item."));
                    }
                    else if (List.Contains(w.SelectedItem))
                    {
                        MessageDialog.ShowWarning(Application.TranslationCatalog.GetString("The item already exists in the list."));
                    }
                    else
                    {
                        OnAddItem(w.SelectedItem);
                        listBox.List.Add(w.SelectedItem);
                        listBox.Items.Add(w.SelectedItem);
                        OnChanged();
                    }
                }

                box.Remove(w);
                dialogo.Close();
            };

            remove.Clicked += delegate {
                var row = listBox.SelectedRow;
                if (row == -1)
                {
                    MessageDialog.ShowMessage(string.Format(Application.TranslationCatalog.GetString("Select a {0} to remove"), typeof(T).Name.Humanize()));
                }
                else
                {
                    if (OnPreventRemove(listBox.SelectedItem))
                    {
                        MessageDialog.ShowWarning(Application.TranslationCatalog.GetString("A validation rule prevents you from deleting the selected item"));
                    }
                    else
                    {
                        OnRemoveItem(listBox.SelectedItem);
                        listBox.List.Remove(listBox.SelectedItem);
                        listBox.Items.Remove(listBox.SelectedItem);
                        OnChanged();
                    }
                }
            };

            actions.PackStart(add);
            actions.PackStart(remove);
            PackStart(listBox, true, true);
            PackEnd(actions, false, true);
        }
Esempio n. 29
0
 public void RemoveButton(Button button)
 {
     button_box.Remove(button);
 }
Esempio n. 30
0
        public void ShowAddins(object[] data)
        {
            selectedEntry.Clear();
            selectedAddin.Clear();
            eboxButs.Visible = true;
            topHeaderBox.Hide();
            urlButton.Hide();

            if (titleIcon != null)
            {
                boxTitle.Remove(titleIcon);
                titleIcon.Destroy();
                titleIcon = null;
            }

            foreach (var img in previewImages)
            {
                ((Gtk.Container)img.Parent).Remove(img);
                img.Destroy();
            }
            previewImages.Clear();

            if (data.Length == 1)
            {
                headerBox.Show();
                ShowAddin(data[0]);
            }
            else if (data.Length > 1)
            {
                headerBox.Hide();
                StringBuilder sb = new StringBuilder();
                sb.Append(Catalog.GetString("Multiple selection:\n\n"));
                bool allowUpdate    = AllowInstall;
                bool allowInstall   = true;
                bool allowUninstall = AllowInstall;
                bool allowEnable    = true;
                bool allowDisable   = true;

                foreach (object o in data)
                {
                    Addin installed;
                    if (o is Addin)
                    {
                        Addin a = (Addin)o;
                        installed = a;
                        selectedAddin.Add(a);
                        sb.Append(a.Name);
                    }
                    else
                    {
                        AddinRepositoryEntry entry = (AddinRepositoryEntry)o;
                        selectedEntry.Add(entry);
                        sb.Append(entry.Addin.Name);
                        installed = AddinManager.Registry.GetAddin(Addin.GetIdName(entry.Addin.Id));
                    }
                    if (installed != null)
                    {
                        if (GetUpdate(installed) == null)
                        {
                            allowUpdate = false;
                        }
                        allowInstall = false;
                        if (installed.Enabled)
                        {
                            allowEnable = false;
                        }
                        else
                        {
                            allowDisable = false;
                        }
                    }
                    else
                    {
                        allowEnable = allowDisable = allowUninstall = allowUpdate = false;
                    }

                    sb.Append('\n');
                    labelDesc.Text = sb.ToString();

                    if (allowEnable)
                    {
                        btnDisable.Visible = true;
                        btnDisable.Label   = Catalog.GetString("Enable");
                    }
                    else if (allowDisable)
                    {
                        btnDisable.Visible = true;
                        btnDisable.Label   = Catalog.GetString("Disable");
                    }
                    else
                    {
                        btnDisable.Visible = false;
                    }
                    btnInstall.Visible   = allowInstall;
                    btnUninstall.Visible = allowUninstall;
                    btnUpdate.Visible    = allowUpdate;
                }
            }
            else
            {
                headerBox.Hide();
                btnDisable.Visible   = false;
                btnInstall.Visible   = false;
                btnUninstall.Visible = false;
                btnUpdate.Visible    = false;
                eboxButs.Visible     = false;
                labelDesc.Text       = Catalog.GetString("No selection");
            }
        }