private void AddFilterRow(FileSearchFilter filter) { FilterWidgetRow newRow = new FilterWidgetRow(filter); newRow.Changed += filter_Changed; this.PackStart(newRow, false, false, 0); newRow.ShowAll(); // XXX: box.ReorderChild(newRow, }
private void RemoveFilter(FileSearchFilter filter) { search.Filters.Remove(filter); foreach (Widget child in this) { FilterWidgetRow row = (FilterWidgetRow)child; if (row.Filter == filter) { row.Destroy(); if (this.Children.Length == 0) { this.Hide(); } if (FiltersChanged != null) { FiltersChanged(this, EventArgs.Empty); } return; } } }
public FilterEntry(FileSearchFilter filter) { this.filter = filter; tooltip = new FakeTooltip(this); this.FocusInEvent += this_FocusChangeEvent; this.FocusOutEvent += this_FocusChangeEvent; this.Changed += this_Changed; /* ListStore store = new ListStore(typeof(string), typeof(string)); store.AppendValues("(VGA)", "640x480"); store.AppendValues("(SVGA)", "800x600"); store.AppendValues("(720p)", "1280x720"); store.AppendValues("(1080i)", "1920x1080"); CellRendererText textCell = new CellRendererText(); EntryCompletion completion = new EntryCompletion(); completion.MinimumKeyLength = 0; completion.PopupSingleMatch = true; completion.PopupCompletion = true; completion.TextColumn = 1; completion.PackStart(textCell, true); completion.AddAttribute(textCell, "text", 0); completion.Model = store; this.Completion = completion; */ }
private void AddFilter(FileSearchFilter filter) { search.Filters.Add(filter); AddFilterRow(filter); }
public FilterWidgetRow(FileSearchFilter filter) : base(0, 0, 1, 1) { TreeIter iter; CellRendererText textCell; ListStore store; this.filter = filter; matchTypeStore = new ListStore(typeof(string), typeof(FileSearchFilterComparison)); textCell = new CellRendererText(); matchTypeComboBox = new ComboBox(); matchTypeComboBox.Model = matchTypeStore; matchTypeComboBox.PackStart(textCell, true); matchTypeComboBox.AddAttribute(textCell, "text", 0); matchTypeComboBox.RowSeparatorFunc = ComboSeparatorFunc; matchTypeComboBox.Changed += MatchTypeChanged; textCell = new CellRendererText(); store = new ListStore(typeof(string), typeof(FilterEntryMode), typeof(FileSearchFilterField)); filterTextEntry = new FilterEntry(filter); filterTextEntry.Changed += FilterTextChanged; fieldComboBox = new ComboBox(); fieldComboBox.PackStart(textCell, true); fieldComboBox.AddAttribute(textCell, "text", 0); fieldComboBox.SetCellDataFunc(textCell, FieldComboDataFunc); store.AppendValues("File Name", FilterEntryMode.String, FileSearchFilterField.FileName); store.AppendValues("Size", FilterEntryMode.Size, FileSearchFilterField.Size); store.AppendValues("-"); store.AppendValues("(Audio)", null); store.AppendValues("Artist", FilterEntryMode.String, FileSearchFilterField.Artist); store.AppendValues("Album", FilterEntryMode.String, FileSearchFilterField.Album); store.AppendValues("Bitrate", FilterEntryMode.Speed, FileSearchFilterField.Bitrate); store.AppendValues("-"); store.AppendValues("(Video)", null); store.AppendValues("Resolution", FilterEntryMode.Dimentions, FileSearchFilterField.Resolution); store.AppendValues("-"); store.AppendValues("(Images)", null); store.AppendValues("Dimentions", FilterEntryMode.Dimentions, FileSearchFilterField.Dimentions); fieldComboBox.Model = store; fieldComboBox.RowSeparatorFunc = ComboSeparatorFunc; fieldComboBox.Changed += FieldChanged; /* if (fieldComboBox.Model.GetIterFirst(out iter)) { fieldComboBox.SetActiveIter(iter); } */ addButton = new Button(); addButton.Relief = ReliefStyle.None; addButton.Image = new Image(Gui.LoadIcon(16, "list-add")); addButton.Clicked += AddButtonClicked; removeButton = new Button(); removeButton.Relief = ReliefStyle.None; removeButton.Image = new Image(Gui.LoadIcon(16, "list-remove")); removeButton.Clicked += RemoveButtonClicked; box = new HBox(); box.PackStart(fieldComboBox, false, false, 0); box.PackStart(matchTypeComboBox, false, false, 3); box.PackStart(filterTextEntry, true, true, 0); box.PackStart(removeButton, false, false, 0); box.PackStart(addButton, false, false, 0); this.TopPadding = 3; this.BottomPadding = 3; this.Add(box); fieldComboBox.Model.GetIterFirst(out iter); do { FileSearchFilterField field = (FileSearchFilterField)fieldComboBox.Model.GetValue(iter, 2); if (field == filter.Field) { fieldComboBox.SetActiveIter(iter); break; } } while (fieldComboBox.Model.IterNext(ref iter)); matchTypeComboBox.Model.GetIterFirst(out iter); do { FileSearchFilterComparison comp = (FileSearchFilterComparison)matchTypeComboBox.Model.GetValue(iter, 1); if (comp == filter.Comparison) { matchTypeComboBox.SetActiveIter(iter); break; } } while (matchTypeComboBox.Model.IterNext(ref iter)); filterTextEntry.Text = filter.Text; }