public NodeEditorWidget (DotNetProject project, AddinRegistry reg, ExtensionNodeType ntype, AddinDescription parentAddinDescription, string parentPath, ExtensionNodeDescription node) { this.node = node; this.project = project; tips = new Tooltips (); Spacing = 0; // Header Label label = new Label (); label.Wrap = true; label.WidthRequest = 480; string txt = "<b>" + node.NodeName + "</b>"; if (ntype.Description.Length > 0) txt += "\n" + GLib.Markup.EscapeText (ntype.Description); label.Markup = txt; label.Xalign = 0f; PackStart (label, false, false, 6); PackStart (new HSeparator (), false, false, 0); // Attributes grid = new PropertyGrid (); grid.CurrentObject = new NodeWrapper (project, reg, ntype, parentAddinDescription, parentPath, node); PackStart (grid, true, true, 0); ShowAll (); grid.ShowHelp = true; grid.ShowToolbar = false; }
public BestTray(BestWindow bw, bool autostarted) { this.autostarted = autostarted; Raw = egg_tray_icon_new("Search"); win = bw; win.DeleteEvent += new DeleteEventHandler(WindowDeleteEvent); eventbox = new Gtk.EventBox(); eventbox.CanFocus = true; eventbox.ButtonPressEvent += new ButtonPressEventHandler(ButtonPress); Gdk.Pixbuf smalldog = Images.GetPixbuf("best.png"); eventbox.Add(new Gtk.Image(smalldog.ScaleSimple(24, 24, Gdk.InterpType.Hyper))); KeyBinding binding = Conf.Searching.ShowSearchWindowBinding; string tooltip = String.Format("Beagle Search ({0})", binding.ToReadableString()); tips = new Gtk.Tooltips(); tips.SetTip(eventbox, tooltip, null); tips.Enable(); Add(eventbox); eventbox.ShowAll(); keybinder = new Beagle.Util.XKeybinder(); keybinder.Bind(binding.ToString(), new EventHandler(ShowBeaglePressed)); }
public void Initialize(PropertyDescriptor prop) { if (!prop.PropertyType.IsEnum) { throw new ApplicationException("Flags editor does not support editing values of type " + prop.PropertyType); } property = prop.Label; Spacing = 3; // For small enums, the editor is a list of checkboxes inside a frame // For large enums (>5), use a selector dialog. enm = Registry.LookupEnum(prop.PropertyType.FullName); if (enm.Values.Length < 6) { Gtk.VBox vbox = new Gtk.VBox(true, 3); tips = new Gtk.Tooltips(); flags = new Hashtable(); foreach (Enum value in enm.Values) { EnumValue eval = enm[value]; if (eval.Label == "") { continue; } Gtk.CheckButton check = new Gtk.CheckButton(eval.Label); tips.SetTip(check, eval.Description, eval.Description); uint uintVal = (uint)(int)eval.Value; flags[check] = uintVal; flags[uintVal] = check; check.Toggled += FlagToggled; vbox.PackStart(check, false, false, 0); } Gtk.Frame frame = new Gtk.Frame(); frame.Add(vbox); frame.ShowAll(); PackStart(frame, true, true, 0); } else { flagsLabel = new Gtk.Entry(); flagsLabel.IsEditable = false; flagsLabel.HasFrame = false; flagsLabel.ShowAll(); PackStart(flagsLabel, true, true, 0); Gtk.Button but = new Gtk.Button("..."); but.Clicked += OnSelectFlags; but.ShowAll(); PackStart(but, false, false, 0); } }
public Grid() : base() { BorderWidth = 2; WidgetFlags |= WidgetFlags.NoWindow; lines = new ArrayList(); tips = new Gtk.Tooltips(); group = null; }
public Grid() : base() { BorderWidth = 2; WidgetFlags |= WidgetFlags.NoWindow; lines = new ArrayList (); tips = new Gtk.Tooltips (); group = null; }
// : base("", parent, DialogFlags.DestroyWithParent) public PropertyDialog(Gtk.Window parent) { properties = new Hashtable(); lastItemNumber = 0; tooltips = new Gtk.Tooltips(); // create dialog using glade Glade.XML gxml = new Glade.XML(null, "dialogs.glade", "PropertiesDialog", null); gxml.Autoconnect(this); }
/// <summary> /// Processes the given form for all controls. /// </summary> /// <param name="frm">Form to process</param> /// <param name="tip">ToolTip control</param> /// <history> /// [Curtis_Beard] 07/31/2006 Created /// </history> public static void ProcessForm(Gtk.Window frm, Gtk.Tooltips tip) { // if (__RootNode != null) // { // SetFormText(frm); // // //process controls on form // foreach (Gtk.Widget control in frm.Children) // ProcessControl(control, tip); // // //process menu items on form // if (frm.Menu != null) // { // foreach (MenuItem item in frm.Menu.MenuItems) // { // XmlNode menuNode = __RootNode.SelectSingleNode("screen[@name='" + frm.Name + "']/menu[@index='" + item.Index + "']"); // // if (menuNode != null && menuNode.Attributes["value"] != null) // { // item.Text = menuNode.Attributes["value"].Value; // // ProcessMenuItem(item, item.Index); // } // } // } // } }
protected void Clear() { foreach (object obj in lines) { if (obj is Widget) { ((Widget)obj).Destroy(); } else if (obj is Pair) { Pair p = (Pair)obj; p.Label.Destroy(); p.Editor.Destroy(); } } lines.Clear(); tips = new Gtk.Tooltips(); }
public NodeEditorWidget(DotNetProject project, AddinRegistry reg, ExtensionNodeType ntype, AddinDescription parentAddinDescription, string parentPath, ExtensionNodeDescription node) { this.node = node; this.project = project; tips = new Tooltips(); Spacing = 0; // Header Label label = new Label(); label.Wrap = true; label.WidthRequest = 480; string txt = "<b>" + node.NodeName + "</b>"; if (ntype.Description.Length > 0) { txt += "\n" + GLib.Markup.EscapeText(ntype.Description); } label.Markup = txt; label.Xalign = 0f; PackStart(label, false, false, 6); PackStart(new HSeparator(), false, false, 0); // Attributes grid = new PropertyGrid(); grid.CurrentObject = new NodeWrapper(project, reg, ntype, parentAddinDescription, parentPath, node); PackStart(grid, true, true, 0); ShowAll(); grid.ShowHelp = true; grid.ShowToolbar = false; }
public BestTray (BestWindow bw, bool autostarted) { this.autostarted = autostarted; Raw = egg_tray_icon_new ("Search"); win = bw; win.DeleteEvent += new DeleteEventHandler (WindowDeleteEvent); eventbox = new Gtk.EventBox (); eventbox.CanFocus = true; eventbox.ButtonPressEvent += new ButtonPressEventHandler (ButtonPress); Gdk.Pixbuf smalldog = Images.GetPixbuf ("best.png"); eventbox.Add (new Gtk.Image (smalldog.ScaleSimple (24, 24, Gdk.InterpType.Hyper))); KeyBinding binding = Conf.Searching.ShowSearchWindowBinding; string tooltip = String.Format ("Beagle Search ({0})", binding.ToReadableString ()); tips = new Gtk.Tooltips (); tips.SetTip (eventbox, tooltip, null); tips.Enable (); Add (eventbox); eventbox.ShowAll (); keybinder = new Beagle.Util.XKeybinder (); keybinder.Bind (binding.ToString (), new EventHandler (ShowBeaglePressed)); }
// // Toolbar // // Add Link button, Font menu, Delete button to the window's // toolbar. // Gtk.Toolbar MakeToolbar () { Gtk.Toolbar tb = new Gtk.Toolbar (); tb.Tooltips = true; toolbar_tips = new Gtk.Tooltips (); Gtk.ToolButton search = new Gtk.ToolButton ( new Gtk.Image (Gtk.Stock.Find, tb.IconSize), Catalog.GetString ("Search")); search.IsImportant = true; search.Clicked += SearchActivate; // TODO: If we ever add a way to customize internal keybindings, this will need to change toolbar_tips.SetTip (search, Catalog.GetString ("Search your notes") + " (Ctrl-Shift-F)", null); search.AddAccelerator ("clicked", accel_group, (uint) Gdk.Key.f, (Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask), Gtk.AccelFlags.Visible); search.ShowAll (); tb.Insert (search, -1); link_button = new Gtk.ToolButton ( new Gtk.Image (Gtk.Stock.JumpTo, tb.IconSize), Catalog.GetString ("Link")); link_button.IsImportant = true; link_button.Sensitive = (note.Buffer.Selection != null); link_button.Clicked += LinkToNoteActivate; // TODO: If we ever add a way to customize internal keybindings, this will need to change toolbar_tips.SetTip ( link_button, Catalog.GetString ("Link selected text to a new note") + " (Ctrl-L)", null); link_button.AddAccelerator ("clicked", accel_group, (uint) Gdk.Key.l, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); link_button.ShowAll (); tb.Insert (link_button, -1); ToolMenuButton text_button = new ToolMenuButton (tb, Gtk.Stock.SelectFont, Catalog.GetString ("_Text"), text_menu); text_button.IsImportant = true; text_button.ShowAll (); tb.Insert (text_button, -1); toolbar_tips.SetTip (text_button, Catalog.GetString ("Set properties of text"), null); ToolMenuButton plugin_button = new ToolMenuButton (tb, Gtk.Stock.Execute, Catalog.GetString ("T_ools"), plugin_menu); plugin_button.ShowAll (); tb.Insert (plugin_button, -1); toolbar_tips.SetTip (plugin_button, Catalog.GetString ("Use tools on this note"), null); tb.Insert (new Gtk.SeparatorToolItem (), -1); delete = new Gtk.ToolButton (Gtk.Stock.Delete); delete.Clicked += OnDeleteButtonClicked; delete.ShowAll (); tb.Insert (delete, -1); toolbar_tips.SetTip (delete, Catalog.GetString ("Delete this note"), null); // Don't allow deleting the "Start Here" note... if (note.IsSpecial) delete.Sensitive = false; tb.Insert (new Gtk.SeparatorToolItem (), -1); sync_menu_item = new Gtk.ImageMenuItem (Catalog.GetString ("Synchronize Notes")); sync_menu_item.Image = new Gtk.Image (Gtk.Stock.Convert, Gtk.IconSize.Menu); sync_menu_item.Activated += SyncItemSelected; sync_menu_item.Show (); PluginMenu.Add (sync_menu_item); // We might want to know when various settings are altered. Preferences.SettingChanged += Preferences_SettingChanged; // Update items based on configuration. UpdateMenuItems (); tb.ShowAll (); return tb; }
void requestnewgridregion() { cx = 0; cy = 0; Gtk.Application.Invoke(delegate{ for (int x = 0; x < 9; x++) { regions[x] = new OpenMetaverse.GridRegion(); regions[x].Name = ""; maps[x].SetAsWater(); Gtk.Tooltips name = new Gtk.Tooltips(); name.SetTip(maps[x], "Empty", ""); name.Enable(); } Logger.Log("Requesting map region for current region",Helpers.LogLevel.Debug); requested = true; MainClass.client.Grid.RequestMapRegion(MainClass.client.Network.CurrentSim.Name, GridLayerType.Objects); }); }
void MainClass_onRegister() { requested = false; for (int x = 0; x < 9; x++) { maps[x].SetAsWater(); regions[x] = new OpenMetaverse.GridRegion(); regions[x].Name = ""; Gtk.Tooltips name = new Gtk.Tooltips(); name.SetTip(maps[x], "Empty", ""); name.Enable(); } MainClass.client.Network.SimChanged += new EventHandler<SimChangedEventArgs>(Network_SimChanged); MainClass.client.Grid.GridRegion += new EventHandler<GridRegionEventArgs>(Grid_GridRegion); }
void Grid_GridRegion(object sender, GridRegionEventArgs e) { lock (MainClass.win.grid_regions) { if (!MainClass.win.grid_regions.ContainsKey(e.Region.RegionHandle)) { MainClass.win.grid_regions.Add(e.Region.RegionHandle, e.Region); } } Gtk.Application.Invoke(delegate { Logger.Log("Got grid region for :"+e.Region.Name+" ("+e.Region.RegionHandle.ToString()+")", Helpers.LogLevel.Debug); if (e.Region.RegionHandle == MainClass.client.Network.CurrentSim.Handle && requested==true) { requested = false; cx = (uint)e.Region.X; cy = (uint)e.Region.Y; Logger.Log("Requesting neighbour grid "+(e.Region.X - 1).ToString()+","+(e.Region.Y - 1).ToString()+(e.Region.X + 1).ToString()+(e.Region.Y + 1).ToString(), Helpers.LogLevel.Debug); MainClass.client.Grid.RequestMapBlocks(GridLayerType.Objects, (ushort)(e.Region.X - 1), (ushort)(e.Region.Y - 1), (ushort)(e.Region.X + 1), (ushort)(e.Region.Y + 1), false); } int col = (int)2 - (((int)cx + (int)1) - (int)e.Region.X); //FFS int row = (((int)cy + (int)1) - (int)e.Region.Y); if (row < 0 || row > 2) return; if (col < 0 || col > 2) return; Logger.Log("We found ("+row.ToString()+","+col.ToString()+")",Helpers.LogLevel.Debug); int index = (row * 3) + col; Gtk.Tooltips name = new Gtk.Tooltips(); name.SetTip(maps[index], e.Region.Name, ""); name.Enable(); regions[index]=e.Region; maps[index].SetGridRegion( e.Region.RegionHandle); }); }
public ConfigWindow() { if (DrapesApp.Cfg.Debug == true) Console.WriteLine("Opening Configuration menu"); // Glade autoconnect magic Glade.XML gxml = new Glade.XML (null, "drapes.glade", "winPref", "drapes"); gxml.Autoconnect (this); // Tooltips tooltips = new Tooltips(); // the window it self winPref.DeleteEvent += OnWindowDelete; // help button btnHelp.Clicked += OnHelpClicked; // add/remove wallpaper buttons btnRemove.Clicked += OnRemoveWallpapersClicked; btnAdd.Clicked += OnAddWallpapersClicked; // style selection cmbStyleStore = new ListStore(typeof(string), typeof(Config.Style)); cmbStyleStore.AppendValues("Centered", Config.Style.StyleEnum.STYLE_CENTER); cmbStyleStore.AppendValues("Fill Screen", Config.Style.StyleEnum.STYLE_FILL); cmbStyleStore.AppendValues("Scale", Config.Style.StyleEnum.STYLE_SCALE); cmbStyleStore.AppendValues("Tiled", Config.Style.StyleEnum.STYLE_TILED); cmbStyleStore.AppendValues("Zoom", Config.Style.StyleEnum.STYLE_ZOOM); cmbStyleStore.AppendValues(null, Config.Style.StyleEnum.STYLE_NONE); cmbStyleStore.AppendValues("None", Config.Style.StyleEnum.STYLE_NONE); // breake between styles and none cmbStyle.RowSeparatorFunc = StyleSeparatorFunc; // What stores our data cmbStyle.Model = cmbStyleStore; cmbStyle.Active = (int) DrapesApp.Cfg.Style; cmbStyle.Changed += onStyleChanged; // gray out selection of wallpapers on wallpaper display disabled tvBgList.Sensitive = (DrapesApp.Cfg.Style != Config.Style.StyleEnum.STYLE_NONE); // start on login button cbtAutoStart.Active = DrapesApp.Cfg.AutoStart; cbtAutoStart.Toggled += onAutoStartToggled; if (DrapesApp.AppletStyle == AppletStyle.APPLET_PANEL) { cbtAutoStart.Sensitive = false; tooltips.SetTip(cbtAutoStart, Catalog.GetString("This option is only valid when using the notification tray"), null); } // Bottom butons btnClose.Clicked += onCloseButtonClick; // B: General Tab // CheckButton: Switch wallpaper on start cbtStartSwitch.Clicked += OnStartupChanged; cbtStartSwitch.Active = DrapesApp.Cfg.ShuffleOnStart; // HScale: Wallaper switch timer Gtk.Adjustment adjTimer= new Gtk.Adjustment(1.0, 0.0, 9.0, 1.0, 1.0, 0.0); scaleTimer.Adjustment = adjTimer; scaleTimer.ChangeValue += OnTimerChangeValueEvent; scaleTimer.FormatValue += TimerFormatValue; scaleTimer.Value = (double) DrapesApp.Cfg.SwitchDelay; // CheckButton: Monitor directory toggle cbtMonitor.Active = DrapesApp.Cfg.MonitorEnabled; cbtMonitor.Toggled += this.OnMonitorChanged; // The FileChooserButton fcbDir.Sensitive = DrapesApp.Cfg.MonitorEnabled; fcbDir.LocalOnly = true; // no gnome vfs hacksage if (DrapesApp.Cfg.MonitorDirectory == null) fcbDir.SetCurrentFolder(Config.Defaults.MonitorDirectory); else fcbDir.SetCurrentFolder(DrapesApp.Cfg.MonitorDirectory); fcbDir.SelectionChanged += this.OnMonitorDirChanged; // Events from the settings classConfirmOverwrite DrapesApp.Cfg.MonitorDirectoryChanged += this.OnSettingMonitorDirChanged; DrapesApp.Cfg.MonitorEnabledChanged += this.OnSettingMonitorEnabledChange; DrapesApp.Cfg.SwitchDelayChanged += this.OnSettingTimmerChanged; DrapesApp.Cfg.StyleChanged += this.OnSettingStyleChanged; // E: General Tab // B: Treeview wallpaper list // The one cell we'll be using Gtk.TreeViewColumn tvc = new Gtk.TreeViewColumn(); tvc.Title = Catalog.GetString("selection"); // Toggle cell renderer needs some special setup, it dosen't handle the toggle it self, it needs a call back Gtk.CellRendererToggle tg = new Gtk.CellRendererToggle(); tg.Toggled += OnWallPaperToggled; tg.Xpad = 4; // Preview Image & Description Gtk.CellRendererPixbuf px = new Gtk.CellRendererPixbuf(); Gtk.CellRendererText tx = new Gtk.CellRendererText(); tx.Xpad = 4; px.Mode = CellRendererMode.Inert; tx.Mode = CellRendererMode.Inert; // Pack everything in one cell tvc.PackStart(tg, false); tvc.PackStart(px, false); tvc.PackStart(tx, true); // Our custom column rendering function tvc.SetCellDataFunc(tg, (Gtk.TreeCellDataFunc)RenderList); tvc.SetCellDataFunc(px, (Gtk.TreeCellDataFunc)RenderList); tvc.SetCellDataFunc(tx, (Gtk.TreeCellDataFunc)RenderList); // Just one column that everything is shoved into tvBgList.AppendColumn(tvc); // Tree store // 1st we store the key of the wallpaper // 2nd we store the section name (if needed) tsEntries = new Gtk.TreeStore(typeof(string), typeof(string)); // The various "sorters" tiMatch = tsEntries.AppendValues(null, Catalog.GetString("Perfect fit")); tiAsp43 = tsEntries.AppendValues(null, Catalog.GetString("Regular 4:3")); tiAspWide = tsEntries.AppendValues(null, Catalog.GetString("Widescreen")); tiAspMisc = tsEntries.AppendValues(null, Catalog.GetString("Other")); tsEntries.AppendValues(tiMatch, null, Catalog.GetString("<i>No wallpapers present</i>")); tsEntries.AppendValues(tiAsp43, null, Catalog.GetString("<i>No wallpapers present</i>")); tsEntries.AppendValues(tiAspWide, null, Catalog.GetString("<i>No wallpapers present</i>")); tsEntries.AppendValues(tiAspMisc, null, Catalog.GetString("<i>No wallpapers present</i>")); // Add wallpapers to the Config window GLib.Idle.Add(DelayedLoader); // We need a filter to get rid of all the empty sections tmfFilter = new Gtk.TreeModelFilter(tsEntries, null); tmfFilter.VisibleFunc = FilterEmptySections; // Double click on a row (switch wallpaper, or expand collapse category) tvBgList.RowActivated += OnWallpaperSelected; // The filter is the "proxy" for the TreeView model tvBgList.Model = tmfFilter; // Show everything tvBgList.ExpandAll(); // E: Treeview wallpaper list }
public void Initialize(PropertyDescriptor prop) { if (!prop.PropertyType.IsEnum) throw new ApplicationException ("Flags editor does not support editing values of type " + prop.PropertyType); property = prop.Label; Spacing = 3; // For small enums, the editor is a list of checkboxes inside a frame // For large enums (>5), use a selector dialog. enm = Registry.LookupEnum (prop.PropertyType.FullName); if (enm.Values.Length < 6) { Gtk.VBox vbox = new Gtk.VBox (true, 3); tips = new Gtk.Tooltips (); flags = new Hashtable (); foreach (Enum value in enm.Values) { EnumValue eval = enm[value]; if (eval.Label == "") continue; Gtk.CheckButton check = new Gtk.CheckButton (eval.Label); tips.SetTip (check, eval.Description, eval.Description); uint uintVal = (uint)(int)eval.Value; flags[check] = uintVal; flags[uintVal] = check; check.Toggled += FlagToggled; vbox.PackStart (check, false, false, 0); } Gtk.Frame frame = new Gtk.Frame (); frame.Add (vbox); frame.ShowAll (); PackStart (frame, true, true, 0); } else { flagsLabel = new Gtk.Entry (); flagsLabel.IsEditable = false; flagsLabel.HasFrame = false; flagsLabel.ShowAll (); PackStart (flagsLabel, true, true, 0); Gtk.Button but = new Gtk.Button ("..."); but.Clicked += OnSelectFlags; but.ShowAll (); PackStart (but, false, false, 0); } }
protected void Clear() { foreach (object obj in lines) { if (obj is Widget) ((Widget)obj).Destroy (); else if (obj is Pair) { Pair p = (Pair)obj; p.Label.Destroy (); p.Editor.Destroy (); } } lines.Clear (); tips = new Gtk.Tooltips (); }
public SearchWindow (ISearch search) : base (WindowType.Toplevel) { this.search = search; base.Title = Catalog.GetString ("Desktop Search"); base.Icon = WidgetFu.LoadThemeIcon ("system-search", 16); base.DefaultWidth = 700; base.DefaultHeight = 550; base.DeleteEvent += OnWindowDelete; VBox vbox = new VBox (); vbox.Spacing = 3; uim = new UIManager (this); uim.DomainChanged += OnDomainChanged; uim.SortChanged += OnSortChanged; uim.ToggleDetails += OnToggleDetails; uim.ShowQuickTips += OnShowQuickTips; uim.ShowIndexInfo += OnShowIndexInfo; uim.StartDaemon += OnStartDaemon; uim.StopDaemon += OnStopDaemon; vbox.PackStart (uim.MenuBar, false, false, 0); HBox hbox = new HBox (false, 6); Label label = new Label (Catalog.GetString ("_Find in:")); hbox.PackStart (label, false, false, 0); scope_list = ComboBox.NewText (); foreach (ScopeMapping mapping in scope_mappings) scope_list.AppendText (mapping.label); scope_list.Active = 0; scope_list.Changed += new EventHandler (delegate (object o, EventArgs args) { ComboBox combo = o as ComboBox; if (o == null) return; int active = combo.Active; Log.Debug ("Scope changed: {0} maps to '{1}'", combo.ActiveText, scope_mappings [active].query_mapping); Query (true); }); hbox.PackStart (scope_list, false, false, 0); entry = new Entry (); entry.Activated += OnEntryActivated; hbox.PackStart (entry, true, true, 0); label.MnemonicWidget = entry; uim.FocusSearchEntry += delegate () { entry.GrabFocus (); }; // The auto search after timeout feauture is now optional // and can be disabled. if (Conf.BeagleSearch.GetOption (Conf.Names.BeagleSearchAutoSearch, true)) { entry.Changed += OnEntryResetTimeout; entry.MoveCursor += OnEntryResetTimeout; } button = new Gtk.Button (); Gtk.HBox button_hbox = new Gtk.HBox (false, 2); Gtk.Image icon = new Gtk.Image (Gtk.Stock.Find, Gtk.IconSize.Button); button_hbox.PackStart (icon, false, false, 0); label = new Gtk.Label (Catalog.GetString ("Find Now")); button_hbox.PackStart (label, false, false, 0); button.Add (button_hbox); button.Clicked += OnButtonClicked; Gtk.VBox buttonVBox = new Gtk.VBox (false, 0); buttonVBox.PackStart (button, true, false, 0); hbox.PackStart (buttonVBox, false, false, 0); spinner = new Spinner (); hbox.PackStart (spinner, false, false, 0); HBox padding_hbox = new HBox (); padding_hbox.PackStart (hbox, true, true, 9); vbox.PackStart (padding_hbox, false, true, 6); VBox view_box = new VBox (false, 3); vbox.PackStart (view_box, true, true, 0); HBox na_padding = new HBox (); view_box.PackStart (na_padding, false, true, 0); notification_area = new NotificationArea (); na_padding.PackStart (notification_area, true, true, 3); pages = new Gtk.Notebook (); pages.ShowTabs = false; pages.ShowBorder = false; pages.BorderWidth = 3; view_box.PackStart (pages, true, true, 0); quicktips = new Pages.QuickTips (); quicktips.Show (); pages.Add (quicktips); indexinfo = new Pages.IndexInfo (); indexinfo.Show (); pages.Add (indexinfo); rootuser = new Pages.RootUser (); rootuser.Show (); pages.Add (rootuser); startdaemon = new Pages.StartDaemon (); startdaemon.DaemonStarted += OnDaemonStarted; startdaemon.Show (); pages.Add (startdaemon); panes = new Beagle.Search.Panes (); panes.Show (); pages.Add (panes); view = new GroupView (); view.TileSelected += ShowInformation; panes.MainContents = view; this.statusbar = new Gtk.Statusbar (); vbox.PackEnd (this.statusbar, false, false, 0); Add (vbox); tips = new Gtk.Tooltips (); tips.SetTip (entry, Catalog.GetString ("Type in search terms"), ""); tips.SetTip (button, Catalog.GetString ("Start searching"), ""); tips.Enable (); if (Environment.UserName == "root" && !Conf.Daemon.GetOption (Conf.Names.AllowRoot, false)) { pages.CurrentPage = pages.PageNum (rootuser); entry.Sensitive = button.Sensitive = uim.Sensitive = false; } else { pages.CurrentPage = pages.PageNum (quicktips); } entry.GrabFocus (); StartCheckingIndexingStatus (); }
/// <summary> /// Sets the given control's text property. /// </summary> /// <param name="control">Control to set</param> /// <param name="tip">ToolTip control</param> /// <history> /// [Curtis_Beard] 07/31/2006 Created /// [Curtis_Beard] 11/06/2006 CHG: Use Gtk controls /// </history> public static void SetControlText(Gtk.Widget control, Gtk.Tooltips tip) { if (__RootNode != null) { string formName = ""; XmlNode node = __RootNode.SelectSingleNode("screen[@name='" + formName + "']"); XmlNode controlNode; if (node != null) { //node found, find control controlNode = node.SelectSingleNode("control[@name='" + control.Name + "']"); if (controlNode != null) { //found control node string value = controlNode.Attributes["value"].Value; //text if (control.GetType() == typeof(Gtk.Label)) { ((Gtk.Label)control).Text = value; } else if (control.GetType() == typeof(Gtk.Button)) { ((Gtk.Button)control).Label = value; } else if (control.GetType() == typeof(Gtk.CheckButton)) { ((Gtk.CheckButton)control).Label = value; } else if (control.GetType() == typeof(Gtk.Frame)) { ((Gtk.Frame)control).Label = value; } //tooltip if (tip != null && controlNode.Attributes["tooltip"] != null) { tip.SetTip(control, controlNode.Attributes["tooltip"].Value, string.Empty); } } } } }
/// <summary> /// Initializes all GUI components. /// </summary> /// <history> /// [Curtis_Beard] 11/03/2006 Created /// </history> private void InitializeComponent() { this.SetDefaultSize (Core.GeneralSettings.WindowWidth, Core.GeneralSettings.WindowHeight); if (Core.GeneralSettings.WindowLeft == -1 && Core.GeneralSettings.WindowTop == -1) this.SetPosition(WindowPosition.Center); else this.Move(Core.GeneralSettings.WindowLeft, Core.GeneralSettings.WindowTop); this.DeleteEvent += new DeleteEventHandler(OnWindowDelete); this.Title = Constants.ProductName; this.Icon = Images.GetPixbuf("AstroGrep_Icon.ico"); MainTooltips = new Tooltips(); VBox vbox = new VBox(); vbox.BorderWidth = 0; Frame leftFrame = new Frame(); leftFrame.Shadow = ShadowType.In; leftFrame.WidthRequest = 200; VBox searchBox = new VBox(); VBox searchOptionsBox = new VBox(); searchBox.BorderWidth = 3; searchOptionsBox.BorderWidth = 3; lblSearchStart = new Label("Search Path"); lblSearchStart.SetAlignment(0,0); btnBrowse = new Button(); btnBrowse.SetSizeRequest(32, 20); Gtk.Image img = new Image(); img.Pixbuf = Images.GetPixbuf("folder-open.png"); VBox browseBox = new VBox(); browseBox.PackStart(img, false, false, 0); MainTooltips.SetTip(btnBrowse, "Select the folder to start the search", ""); btnBrowse.Clicked += new EventHandler(btnBrowse_Clicked); btnBrowse.Add(browseBox); cboSearchStart = ComboBoxEntry.NewText(); cboSearchFilter = ComboBoxEntry.NewText(); cboSearchText = ComboBoxEntry.NewText(); LoadComboBoxEntry(cboSearchStart, Core.GeneralSettings.SearchStarts, true); LoadComboBoxEntry(cboSearchFilter, Core.GeneralSettings.SearchFilters, false); LoadComboBoxEntry(cboSearchText, Core.GeneralSettings.SearchTexts, false); cboSearchStart.Changed += new EventHandler(cboSearchStart_Changed); lblSearchFilter = new Label("File Types"); lblSearchFilter.SetAlignment(0,0); lblSearchText = new Label("Search Text"); lblSearchText.SetAlignment(0,0); // search path VBox startVBox = new VBox(); startVBox.BorderWidth = 0; cboSearchStart.WidthRequest = 100; SetActiveComboBoxEntry(cboSearchStart); HBox startHBox = new HBox(); startHBox.BorderWidth = 0; startHBox.PackStart(cboSearchStart, true, true, 0); startHBox.PackEnd(btnBrowse, false, false, 0); startVBox.PackStart(lblSearchStart, false, false, 0); startVBox.PackStart(startHBox, true, false, 0); searchBox.PackStart(startVBox, true, false, 0); // search filter VBox filterVBox = new VBox(); cboSearchFilter.Active = 0; filterVBox.BorderWidth = 0; filterVBox.PackStart(lblSearchFilter, false, false, 0); filterVBox.PackStart(cboSearchFilter, true, false, 0); searchBox.PackStart(filterVBox, true, false, 0); // search text VBox textVBox = new VBox(); cboSearchText.Active = 0; textVBox.BorderWidth = 0; textVBox.PackStart(lblSearchText, false, false, 0); textVBox.PackStart(cboSearchText, true, false, 0); searchBox.PackStart(textVBox, true, false, 0); // Search/Cancel buttons searchBox.PackStart(CreateButtons(), false, false, 0); // Search Options chkRegularExpressions = new CheckButton("Regular Expressions"); chkCaseSensitive = new CheckButton("Case Sensitive"); chkWholeWord = new CheckButton("Whole Word"); chkRecurse = new CheckButton("Recurse"); chkFileNamesOnly = new CheckButton("Show File Names Only"); chkFileNamesOnly.Clicked += new EventHandler(chkFileNamesOnly_Clicked); chkNegation = new CheckButton("Negation"); chkNegation.Clicked += new EventHandler(chkNegation_Clicked); chkLineNumbers = new CheckButton("Line Numbers"); cboContextLines = ComboBox.NewText(); cboContextLines.WidthRequest = 100; cboContextLines.WrapWidth = 3; for (int i = 0; i <= Constants.MAX_CONTEXT_LINES; i++) cboContextLines.AppendText(i.ToString()); lblContextLines = new Label("Context Lines"); HBox cxtBox = new HBox(); cxtBox.BorderWidth = 0; cxtBox.PackStart(cboContextLines, false, false, 3); cxtBox.PackStart(lblContextLines, false, false, 3); searchOptionsBox.PackStart(chkRegularExpressions, true, false, 0); searchOptionsBox.PackStart(chkCaseSensitive, true, false, 0); searchOptionsBox.PackStart(chkWholeWord, true, false, 0); searchOptionsBox.PackStart(chkRecurse, true, false, 0); searchOptionsBox.PackStart(chkFileNamesOnly, true, false, 0); searchOptionsBox.PackStart(chkNegation, true, false, 0); searchOptionsBox.PackStart(chkLineNumbers, true, false, 0); searchOptionsBox.PackStart(cxtBox, true, false, 0); searchBox.PackEnd(searchOptionsBox, true, true, 0); leftFrame.Add(searchBox); panelLeft = new HPaned(); panelLeft.BorderWidth = 0; panelRight = new VPaned(); panelRight.BorderWidth = 0; // File List Gtk.Frame treeFrame = new Gtk.Frame(); treeFrame.Shadow = ShadowType.In; Gtk.ScrolledWindow treeWin = new Gtk.ScrolledWindow(); tvFiles = new Gtk.TreeView (); SetColumnsText(); tvFiles.Model = new ListStore(typeof (string), typeof (string), typeof (string), typeof (string), typeof (int)); (tvFiles.Model as ListStore).DefaultSortFunc = new TreeIterCompareFunc(DefaultTreeIterCompareFunc); tvFiles.Selection.Changed += new EventHandler(Tree_OnSelectionChanged); tvFiles.RowActivated += new RowActivatedHandler(tvFiles_RowActivated); tvFiles.RulesHint = true; tvFiles.HeadersClickable = true; tvFiles.HeadersVisible = true; tvFiles.Selection.Mode = SelectionMode.Multiple; SetSortingFunctions(); treeWin.Add(tvFiles); treeFrame.BorderWidth = 0; treeFrame.Add(treeWin); // txtHits Gtk.Frame ScrolledWindowFrm = new Gtk.Frame(); ScrolledWindowFrm.Shadow = ShadowType.In; Gtk.ScrolledWindow TxtViewWin = new Gtk.ScrolledWindow(); txtViewer = new Gtk.TextView(); txtViewer.Buffer.Text = ""; txtViewer.Editable = false; TxtViewWin.Add(txtViewer); ScrolledWindowFrm.BorderWidth = 0; ScrolledWindowFrm.Add(TxtViewWin); // Add file list and txtHits to right panel panelRight.Pack1(treeFrame, true, true); panelRight.Pack2(ScrolledWindowFrm, true, true); // TLW //Notebook notebook = new Notebook(); // Table table = new Table(3, 6); // Create a new notebook, place the position of the tabs // table.attach(notebook, 0, 6, 0, 1); // Status Bar sbStatus = new Statusbar(); #region Menu bar agMenuAccel = new AccelGroup(); this.AddAccelGroup(agMenuAccel); mbMain = new Gtk.MenuBar(); // File menu mnuFile = new Menu(); MenuItem mnuFileItem = new MenuItem("_File"); mnuFileItem.Submenu = mnuFile; mnuFile.AccelGroup = agMenuAccel; mnuFile.Shown += new EventHandler(mnuFile_Shown); // Edit menu mnuEdit = new Menu(); MenuItem mnuEditItem = new MenuItem("_Edit"); mnuEditItem.Submenu = mnuEdit; mnuEdit.AccelGroup = agMenuAccel; mnuEdit.Shown += new EventHandler(mnuEdit_Shown); // Tools menu mnuTools = new Menu(); MenuItem mnuToolsItem = new MenuItem("_Tools"); mnuToolsItem.Submenu = mnuTools; mnuTools.AccelGroup = agMenuAccel; // Help menu mnuHelp = new Menu(); MenuItem mnuHelpItem = new MenuItem("_Help"); mnuHelpItem.Submenu = mnuHelp; mnuHelp.AccelGroup = agMenuAccel; // File Save menu item SaveMenuItem = new ImageMenuItem(Stock.Save, agMenuAccel); SaveMenuItem.Activated += new EventHandler(SaveMenuItem_Activated); mnuFile.Append(SaveMenuItem); // File Print menu item PrintMenuItem = new ImageMenuItem(Stock.Print, agMenuAccel); PrintMenuItem.Activated += new EventHandler(PrintMenuItem_Activated); mnuFile.Append(PrintMenuItem); // File Separator menu item SeparatorMenuItem Separator1MenuItem = new SeparatorMenuItem(); mnuFile.Append(Separator1MenuItem); // File Exit menu item ExitMenuItem = new ImageMenuItem(Stock.Quit, agMenuAccel); ExitMenuItem.Activated += new EventHandler(ExitMenuItem_Activated); mnuFile.Append(ExitMenuItem); // Edit Select All menu item SelectAllMenuItem = new ImageMenuItem("_Select All Files", agMenuAccel); SelectAllMenuItem.Activated += new EventHandler(SelectAllMenuItem_Activated); mnuEdit.Append(SelectAllMenuItem); // Edit Open Selected menu item OpenSelectedMenuItem = new ImageMenuItem("_Open Selected Files", agMenuAccel); OpenSelectedMenuItem.Activated += new EventHandler(OpenSelectedMenuItem_Activated); mnuEdit.Append(OpenSelectedMenuItem); // Create preferences for every other os except windows if (!Common.IsWindows) { Separator1MenuItem = new SeparatorMenuItem(); mnuEdit.Append(Separator1MenuItem); // Preferences Gtk.ImageMenuItem OptionsMenuItem = new ImageMenuItem(Stock.Preferences, agMenuAccel); OptionsMenuItem.Activated += new EventHandler(OptionsMenuItem_Activated); mnuEdit.Append(OptionsMenuItem); } // Clear MRU List Gtk.ImageMenuItem ClearMRUsMenuItem = new ImageMenuItem("_Clear Most Recently Used Lists", agMenuAccel); ClearMRUsMenuItem.Activated += new EventHandler(ClearMRUsMenuItem_Activated); mnuTools.Append(ClearMRUsMenuItem); Separator1MenuItem = new SeparatorMenuItem(); mnuTools.Append(Separator1MenuItem); // Save Search Options Gtk.ImageMenuItem SaveOptionsMenuItem = new ImageMenuItem("_Save Search Options", agMenuAccel); SaveOptionsMenuItem.Activated += new EventHandler(SaveOptionsMenuItem_Activated); mnuTools.Append(SaveOptionsMenuItem); // Create Options menu for windows if (Common.IsWindows) { // Options menu item Gtk.ImageMenuItem OptionsMenuItem = new ImageMenuItem("_Options...", agMenuAccel); OptionsMenuItem.Activated += new EventHandler(OptionsMenuItem_Activated); OptionsMenuItem.Image = new Gtk.Image(Stock.Preferences, IconSize.Menu); mnuTools.Append(OptionsMenuItem); } // Help About menu item MenuItem AboutMenuItem = new ImageMenuItem(Stock.About, agMenuAccel); AboutMenuItem.Activated += new EventHandler(AboutMenuItem_Activated); mnuHelp.Append(AboutMenuItem); // Add the menus to the menubar mbMain.Append(mnuFileItem); mbMain.Append(mnuEditItem); mbMain.Append(mnuToolsItem); mbMain.Append(mnuHelpItem); // Add the menubar to the Menu panel vbox.PackStart(mbMain, false, false, 0); #endregion // add items to container panelLeft.Pack1(leftFrame, true, false); // TLW //panelLeft.Pack2(tabControl, true, false); panelLeft.Pack2(panelRight, true, false); // set starting position of splitter panelLeft.Position = Core.GeneralSettings.WindowSearchPanelWidth; panelRight.Position = Core.GeneralSettings.WindowFilePanelHeight; vbox.PackStart(panelLeft, true, true, 0); vbox.PackEnd(sbStatus, false, true, 3); this.Add (vbox); this.ShowAll (); }
public SearchWindow(ISearch search) : base(WindowType.Toplevel) { this.search = search; base.Title = Catalog.GetString("Desktop Search"); base.Icon = WidgetFu.LoadThemeIcon("system-search", 16); base.DefaultWidth = 700; base.DefaultHeight = 550; base.DeleteEvent += OnWindowDelete; VBox vbox = new VBox(); vbox.Spacing = 3; uim = new UIManager(this); uim.DomainChanged += OnDomainChanged; uim.SortChanged += OnSortChanged; uim.ToggleDetails += OnToggleDetails; uim.ShowQuickTips += OnShowQuickTips; uim.ShowIndexInfo += OnShowIndexInfo; uim.StartDaemon += OnStartDaemon; uim.StopDaemon += OnStopDaemon; vbox.PackStart(uim.MenuBar, false, false, 0); HBox hbox = new HBox(false, 6); Label label = new Label(Catalog.GetString("_Find in:")); hbox.PackStart(label, false, false, 0); scope_list = ComboBox.NewText(); foreach (ScopeMapping mapping in scope_mappings) { scope_list.AppendText(mapping.label); } scope_list.Active = 0; scope_list.Changed += new EventHandler(delegate(object o, EventArgs args) { ComboBox combo = o as ComboBox; if (o == null) { return; } int active = combo.Active; Log.Debug("Scope changed: {0} maps to '{1}'", combo.ActiveText, scope_mappings [active].query_mapping); Query(true); }); hbox.PackStart(scope_list, false, false, 0); entry = new Entry(); entry.Activated += OnEntryActivated; hbox.PackStart(entry, true, true, 0); label.MnemonicWidget = entry; uim.FocusSearchEntry += delegate() { entry.GrabFocus(); }; // The auto search after timeout feauture is now optional // and can be disabled. if (Conf.BeagleSearch.GetOption(Conf.Names.BeagleSearchAutoSearch, true)) { entry.Changed += OnEntryResetTimeout; entry.MoveCursor += OnEntryResetTimeout; } button = new Gtk.Button(); Gtk.HBox button_hbox = new Gtk.HBox(false, 2); Gtk.Image icon = new Gtk.Image(Gtk.Stock.Find, Gtk.IconSize.Button); button_hbox.PackStart(icon, false, false, 0); label = new Gtk.Label(Catalog.GetString("Find Now")); button_hbox.PackStart(label, false, false, 0); button.Add(button_hbox); button.Clicked += OnButtonClicked; Gtk.VBox buttonVBox = new Gtk.VBox(false, 0); buttonVBox.PackStart(button, true, false, 0); hbox.PackStart(buttonVBox, false, false, 0); spinner = new Spinner(); hbox.PackStart(spinner, false, false, 0); HBox padding_hbox = new HBox(); padding_hbox.PackStart(hbox, true, true, 9); vbox.PackStart(padding_hbox, false, true, 6); VBox view_box = new VBox(false, 3); vbox.PackStart(view_box, true, true, 0); HBox na_padding = new HBox(); view_box.PackStart(na_padding, false, true, 0); notification_area = new NotificationArea(); na_padding.PackStart(notification_area, true, true, 3); pages = new Gtk.Notebook(); pages.ShowTabs = false; pages.ShowBorder = false; pages.BorderWidth = 3; view_box.PackStart(pages, true, true, 0); quicktips = new Pages.QuickTips(); quicktips.Show(); pages.Add(quicktips); indexinfo = new Pages.IndexInfo(); indexinfo.Show(); pages.Add(indexinfo); rootuser = new Pages.RootUser(); rootuser.Show(); pages.Add(rootuser); startdaemon = new Pages.StartDaemon(); startdaemon.DaemonStarted += OnDaemonStarted; startdaemon.Show(); pages.Add(startdaemon); panes = new Beagle.Search.Panes(); panes.Show(); pages.Add(panes); view = new GroupView(); view.TileSelected += ShowInformation; panes.MainContents = view; this.statusbar = new Gtk.Statusbar(); vbox.PackEnd(this.statusbar, false, false, 0); Add(vbox); tips = new Gtk.Tooltips(); tips.SetTip(entry, Catalog.GetString("Type in search terms"), ""); tips.SetTip(button, Catalog.GetString("Start searching"), ""); tips.Enable(); if (Environment.UserName == "root" && !Conf.Daemon.GetOption(Conf.Names.AllowRoot, false)) { pages.CurrentPage = pages.PageNum(rootuser); entry.Sensitive = button.Sensitive = uim.Sensitive = false; } else { pages.CurrentPage = pages.PageNum(quicktips); } entry.GrabFocus(); StartCheckingIndexingStatus(); }