Ejemplo n.º 1
0
        /// <summary>Populate the main menu tool strip.</summary>
        /// <param name="menuDescriptions">Descriptions for each item.</param>
        public void Populate(List <MenuDescriptionArgs> menuDescriptions)
        {
            accelerators = new AccelGroup();
            foreach (Widget child in toolStrip.Children)
            {
                toolStrip.Remove(child);
                child.Dispose();
            }
            foreach (MenuDescriptionArgs description in menuDescriptions)
            {
                Gtk.Image            image  = null;
                Gdk.Pixbuf           pixbuf = null;
                ManifestResourceInfo info   = Assembly.GetExecutingAssembly().GetManifestResourceInfo(description.ResourceNameForImage);

                if (info != null)
                {
                    pixbuf = new Gdk.Pixbuf(null, description.ResourceNameForImage, 20, 20);
                    image  = new Gtk.Image(pixbuf);
                }
                ToolItem item = new ToolItem();
                item.Expand = true;

                if (description.OnClick == null)
                {
                    Label toolbarlabel = new Label();
                    if (description.RightAligned)
                    {
                        toolbarlabel.Xalign = 1.0F;
                    }
                    toolbarlabel.Xpad        = 10;
                    toolbarlabel.Text        = description.Name;
                    toolbarlabel.TooltipText = description.ToolTip;
                    toolbarlabel.Visible     = !String.IsNullOrEmpty(toolbarlabel.Text);
                    item.Add(toolbarlabel);
                    toolStrip.Add(item);
                    toolStrip.ShowAll();
                }
                else
                {
                    ToolButton button = new ToolButton(image, description.Name);
                    button.Homogeneous = false;
                    button.LabelWidget = new Label(description.Name);
                    button.Clicked    += description.OnClick;
                    if (!string.IsNullOrWhiteSpace(description.ShortcutKey))
                    {
                        Gtk.Accelerator.Parse(description.ShortcutKey, out uint key, out Gdk.ModifierType modifier);
                        button.AddAccelerator("clicked", accelerators, key, modifier, AccelFlags.Visible);
                    }
                    item = button;
                }
                toolStrip.Add(item);
            }
            Window mainWindow = GetMainWindow();

            if (mainWindow != null)
            {
                mainWindow.AddAccelGroup(accelerators);
            }
            toolStrip.ShowAll();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Populate the main menu tool strip.
        /// We rebuild the contents from scratch
        /// </summary>
        /// <param name="menuDescriptions">Menu descriptions for each menu item.</param>
        public void PopulateMainToolStrip(List <MenuDescriptionArgs> menuDescriptions)
        {
            foreach (Widget child in toolStrip.Children)
            {
                toolStrip.Remove(child);
            }
            foreach (MenuDescriptionArgs description in menuDescriptions)
            {
                Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(null, description.ResourceNameForImage, 20, 20);
                ToolButton button = new ToolButton(new Gtk.Image(pixbuf), description.Name);
                button.Homogeneous = false;
                button.LabelWidget = new Label(description.Name);
                Pango.FontDescription font = new Pango.FontDescription();
                font.Size = (int)(8 * Pango.Scale.PangoScale);
                button.LabelWidget.ModifyFont(font);
                if (description.OnClick != null)
                {
                    button.Clicked += description.OnClick;
                }
                toolStrip.Add(button);
            }
            ToolItem item = new ToolItem();

            item.Expand         = true;
            toolbarlabel        = new Label();
            toolbarlabel.Xalign = 1.0F;
            toolbarlabel.Xpad   = 10;
            toolbarlabel.ModifyFg(StateType.Normal, new Gdk.Color(0x99, 0x99, 0x99));
            item.Add(toolbarlabel);
            toolbarlabel.Visible = false;
            toolStrip.Add(item);
            toolStrip.ShowAll();
        }
Ejemplo n.º 3
0
        private ToolItem WidgetToTool(MenuItem widget)
        {
            var item = new ToolItem();

            item.Add((Widget)widget);
            item.WidthRequest = widget.GetWidth();
            return(item);
        }
Ejemplo n.º 4
0
        public void AddWidget(MenuItem widget, int position)
        {
            var item = new ToolItem();

            item.Add((Widget)widget);
            item.WidthRequest = widget.GetWidth();
            Insert(item, position);
        }
Ejemplo n.º 5
0
        public static void AddWidgetItem(this Toolbar tb, Widget w)
        {
            w.Show();
            ToolItem ti = new ToolItem();

            ti.Add(w);
            ti.Show();
            tb.Insert(ti, tb.NItems);
        }
Ejemplo n.º 6
0
        private void Build()
        {
            var vb           = new VBox();
            var hb           = new HBox();
            var toolbar      = new Toolbar();
            var tbiGoToFirst = new ToolButton(Gtk.Stock.GotoFirst);

            tbiGoToFirst.Clicked += OnGoToFirstClicked;
            var tbiGoToPrev = new ToolButton(Gtk.Stock.MediaPrevious);

            tbiGoToPrev.Clicked += OnGoToPrevClicked;
            var tbiGoToNext = new ToolButton(Gtk.Stock.MediaNext);

            tbiGoToNext.Clicked += OnGoToNextClicked;
            var tbiGoToLast = new ToolButton(Gtk.Stock.GotoLast);

            tbiGoToLast.Clicked += OnGoToLastClicked;
            var tbiJumpTo = new ToolButton(Gtk.Stock.JumpTo);

            tbiJumpTo.Clicked += OnJumpToClicked;

            this.pageEntry = new Entry("100000");
            this.pageEntry.WidthRequest = 50;
            this.pageEntry.Show();
            var tbiPageEntry = new ToolItem();

            tbiPageEntry.Add(pageEntry);
            toolbar.Insert(tbiGoToFirst, -1);
            toolbar.Insert(tbiGoToPrev, -1);
            toolbar.Insert(tbiGoToNext, -1);
            toolbar.Insert(tbiGoToLast, -1);
            toolbar.Insert(new SeparatorToolItem(), -1);
            toolbar.Insert(tbiJumpTo, -1);
            toolbar.Insert(tbiPageEntry, -1);
            hb.PackStart(toolbar, true, true, 0);
            this.cbxPageSize          = new ComboBox(new string[] { "20", "50", "100", "200" });
            this.cbxPageSize.Active   = 0;
            this.cbxPageSize.Changed += (sender, e) => PageSize = int.Parse(this.cbxPageSize.ActiveText);
            hb.PackEnd(this.cbxPageSize, false, false, 0);
            hb.PackEnd(new Label("Page Size: "), false, false, 0);
            vb.PackStart(hb, false, false, 0);
            treeView                = new TreeView();
            treeView.Model          = this.store;
            treeView.HeadersVisible = true;
            treeView.AppendColumn("DataTime", new CellRendererText(), "text", 0);
            var sw = new ScrolledWindow();

            sw.ShadowType = ShadowType.In;
            sw.Add(treeView);
            vb.PackStart(sw, true, true, 0);
            AddWithViewport(vb);
        }
Ejemplo n.º 7
0
        private void CreateStatusbar()
        {
            statusBar              = new Toolbar();
            statusBar.ShowArrow    = false;
            statusBar.ToolbarStyle = ToolbarStyle.BothHoriz;
            statusBar.ExposeEvent += StatusBarExposeEvent;

            statusLabel        = new Label();
            statusLabel.Xalign = 0;
            statusLabel.Xpad   = 6;

            ToolItem  statusLabelItem = new ToolItem();
            Alignment statusAlign     = new Alignment(0.5f, 0.5f, 1.0f, 1.0f);

            statusLabelItem.Add(statusLabel);
            statusLabelItem.Expand = true;
            statusBar.Insert(statusLabelItem, -1);
            statusLabelItem.ShowAll();

            taskStatusIcon             = new AnimatedImage();
            taskStatusIcon.Pixbuf      = Gui.LoadIcon(22, "process-working");
            taskStatusIcon.FrameHeight = 22;
            taskStatusIcon.FrameWidth  = 22;
            taskStatusIcon.Load();

            EventBox taskStatusIconBox = new EventBox();

            taskStatusIconBox.MotionNotifyEvent += delegate {
                UpdateTaskStatusIcon();
            };
            taskStatusIconBox.ButtonReleaseEvent += delegate {
                IndexingStatusWindow.Instance.Show();
            };
            taskStatusIconBox.SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
                statusAlign.LeftPadding = (uint)args.Allocation.Width;
            };
            taskStatusIconBox.SetSizeRequest(22, 22);
            taskStatusIconBox.Add(taskStatusIcon);
            taskStatusIconBox.Show();

            ToolItem taskStatusIconItem = new ToolItem();

            taskStatusIconItem.Add(taskStatusIconBox);
            statusBar.Insert(taskStatusIconItem, -1);
            taskStatusIconItem.Show();

            mainVBox.PackStart(statusBar, false, false, 0);

            UpdateTaskStatusIcon();
            UpdateStatusText();
        }
Ejemplo n.º 8
0
        /// <summary>Populate the main menu tool strip.</summary>
        /// <param name="menuDescriptions">Descriptions for each item.</param>
        public void Populate(List <MenuDescriptionArgs> menuDescriptions)
        {
            foreach (Widget child in toolStrip.Children)
            {
                toolStrip.Remove(child);
                child.Destroy();
            }
            foreach (MenuDescriptionArgs description in menuDescriptions)
            {
                Gtk.Image            image  = null;
                Gdk.Pixbuf           pixbuf = null;
                ManifestResourceInfo info   = Assembly.GetExecutingAssembly().GetManifestResourceInfo(description.ResourceNameForImage);

                if (info != null)
                {
                    pixbuf = new Gdk.Pixbuf(null, description.ResourceNameForImage, 20, 20);
                    image  = new Gtk.Image(pixbuf);
                }
                ToolItem item = new ToolItem();
                item.Expand = true;

                if (description.OnClick == null)
                {
                    Label toolbarlabel = new Label();
                    if (description.RightAligned)
                    {
                        toolbarlabel.Xalign = 1.0F;
                    }
                    toolbarlabel.Xpad = 10;
                    toolbarlabel.ModifyFg(StateType.Normal, new Gdk.Color(0x99, 0x99, 0x99));
                    toolbarlabel.Text        = description.Name;
                    toolbarlabel.TooltipText = description.ToolTip;
                    toolbarlabel.Visible     = !String.IsNullOrEmpty(toolbarlabel.Text);
                    item.Add(toolbarlabel);
                    toolStrip.Add(item);
                    toolStrip.ShowAll();
                }
                else
                {
                    ToolButton button = new ToolButton(image, description.Name);
                    button.Homogeneous = false;
                    button.LabelWidget = new Label(description.Name);
                    button.Clicked    += description.OnClick;
                    item = button;
                }
                toolStrip.Add(item);
            }
            toolStrip.ShowAll();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Populate the main menu tool strip.
        /// We rebuild the contents from scratch
        /// </summary>
        /// <param name="menuDescriptions">Menu descriptions for each menu item.</param>
        public void PopulateMainToolStrip(List <MenuDescriptionArgs> menuDescriptions)
        {
            foreach (Widget child in toolStrip.Children)
            {
                toolStrip.Remove(child);
                child.Destroy();
            }
            foreach (MenuDescriptionArgs description in menuDescriptions)
            {
                if (!hasResource(description.ResourceNameForImage))
                {
                    MessageDialog md = new MessageDialog(MainWidget.Toplevel as Window, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok,
                                                         "Program error. Could not locate the resource named " + description.ResourceNameForImage);
                    md.Run();
                    md.Destroy();
                }
                else
                {
                    Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(null, description.ResourceNameForImage, 20, 20);
                    ToolButton button = new ToolButton(new Gtk.Image(pixbuf), description.Name);
                    button.Homogeneous = false;
                    button.LabelWidget = new Label(description.Name);
                    if (description.OnClick != null)
                    {
                        button.Clicked += description.OnClick;
                    }
                    toolStrip.Add(button);
                }
            }
            ToolItem item = new ToolItem();

            item.Expand         = true;
            toolbarlabel        = new Label();
            toolbarlabel.Xalign = 1.0F;
            toolbarlabel.Xpad   = 10;
            toolbarlabel.ModifyFg(StateType.Normal, new Gdk.Color(0x99, 0x99, 0x99));
            item.Add(toolbarlabel);
            toolbarlabel.Visible = false;
            toolStrip.Add(item);
            toolStrip.ShowAll();
        }
Ejemplo n.º 10
0
        public WidgetActionBar(WidgetDesignerFrontend frontend, Stetic.Wrapper.Widget rootWidget)
        {
            this.frontend = frontend;

            editors    = new Hashtable();
            wrappers   = new Hashtable();
            sensitives = new Hashtable();
            invisibles = new Hashtable();
            toggles    = new ArrayList();

            IconSize     = IconSize.Menu;
            Orientation  = Orientation.Horizontal;
            ToolbarStyle = ToolbarStyle.BothHoriz;

            combo     = new WidgetTreeCombo();
            comboItem = new ToolItem();
            comboItem.Add(combo);
            comboItem.ShowAll();
            Insert(comboItem, -1);
            ShowAll();
            RootWidget = rootWidget;
        }
Ejemplo n.º 11
0
        public Navbar(Gtk.IconSize size)
        {
            address = new Entry("address");
            // FIXME: this doesnt't seem to work yet
            // address.Completion = new EntryCompletion ();
            address.WidthChars = 50;
            address.Activated += new EventHandler(OnGoUrl);

            ActionEntry[] actions = new ActionEntry[]
            {
                new ActionEntry("back", Gtk.Stock.GoBack, null, null, GettextCatalog.GetString("Go back"), new EventHandler(OnBackClicked)),
                new ActionEntry("forward", Gtk.Stock.GoForward, null, null, GettextCatalog.GetString("Go forward"), new EventHandler(OnForwardClicked)),
                new ActionEntry("stop", Gtk.Stock.Stop, null, null, GettextCatalog.GetString("Stop loading"), new EventHandler(OnStopClicked)),
                new ActionEntry("reload", Gtk.Stock.Refresh, null, null, GettextCatalog.GetString("Address"), new EventHandler(OnReloadClicked)),
                new ActionEntry("go", Gtk.Stock.Ok, null, null, GettextCatalog.GetString("Load address"), new EventHandler(OnGoUrl))
            };

            ActionGroup ag = new ActionGroup("navbarGroup");

            ag.Add(actions);

            UIManager uim = new UIManager();

            uim.InsertActionGroup(ag, 0);
            uim.AddWidget += new AddWidgetHandler(OnAddWidget);
            uim.AddUiFromString(uiInfo);

            ToolItem item = new ToolItem();

            item.Add(address);

            Toolbar tb = uim.GetWidget("/ui/toolbar") as Toolbar;

            tb.IconSize = size;
            tb.Add(item);
            this.ShowAll();
        }
Ejemplo n.º 12
0
        public MainWindow()
        {
            ToolItem        spacerItem;
            FileSearchEntry searchEntry;
            ToolItem        searchEntryItem;
            Alignment       searchEntryBox;

            object[] attrs = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), true);
            AssemblyTitleAttribute attr    = (AssemblyTitleAttribute)attrs[0];
            AssemblyName           asmName = Assembly.GetExecutingAssembly().GetName();

            string title = $"{attr.Title} (BETA) {asmName.Version} (Protocol Version: {Core.ProtocolVersion})";

            // Create the interface
            window = new Window(title);
            window.SetDefaultSize(850, 550);
            window.DeleteEvent    += on_win_delete;
            window.ConfigureEvent += on_MainWindow_configure_event;
            window.FocusInEvent   += window_FocusInEvent;

            ((ToggleAction)Runtime.BuiltinActions["ToggleMainToolbar"]).Active = Gui.Settings.ShowToolbar;
            Runtime.BuiltinActions["ToggleMainToolbar"].Activated += ToggleMainToolbar_Activated;

            ((ToggleAction)Runtime.BuiltinActions["ToggleMainStatusbar"]).Active = Gui.Settings.ShowStatusBar;
            Runtime.BuiltinActions["ToggleMainStatusbar"].Activated += ToggleMainStatusbar_Activated;
            window.AddAccelGroup(Runtime.UIManager.AccelGroup);

            mainVBox = new VBox();
            window.Add(mainVBox);
            mainVBox.Show();

            if (Runtime.Core.Platform.OSName == "macOS")
            {
                MenuBar menubar = (MenuBar)Runtime.UIManager.GetWidget("/OSXAppMenu");

                Imendio.MacIntegration.Menu.SetMenuBar(menubar);

                MenuItem preferencesItem = (MenuItem)Runtime.UIManager.GetWidget("/OSXAppMenu/NetworkMenu/Preferences");
                MenuItem aboutItem       = (MenuItem)Runtime.UIManager.GetWidget("/OSXAppMenu/NetworkMenu/About");

                IntPtr group = Imendio.MacIntegration.Menu.AddAppMenuGroup();

                Imendio.MacIntegration.Menu.AddAppMenuItem(group, aboutItem, "About Meshwork");

                group = Imendio.MacIntegration.Menu.AddAppMenuGroup();

                Imendio.MacIntegration.Menu.AddAppMenuItem(group, preferencesItem, "Preferences");

                MenuItem quitItem = (MenuItem)Runtime.UIManager.GetWidget("/OSXAppMenu/NetworkMenu/Quit");
                Imendio.MacIntegration.Menu.SetQuitMenuItem(quitItem);
            }
            else
            {
                MenuBar menubar = (MenuBar)Runtime.UIManager.GetWidget("/MainWindowMenuBar");
                mainVBox.PackStart(menubar, false, false, 0);
                menubar.Show();
            }

            toolbar = (Toolbar)Runtime.UIManager.GetWidget("/MainWindowToolbar");
            toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
            toolbar.IconSize     = IconSize.LargeToolbar;

            spacerItem        = new ToolItem();
            spacerItem.Expand = true;
            toolbar.Insert(spacerItem, -1);
            spacerItem.Show();

            searchEntry = new FileSearchEntry();

            searchEntryBox              = new Alignment(0.5f, 0.5f, 0, 0);
            searchEntryBox.LeftPadding  = 4;
            searchEntryBox.RightPadding = 1;
            searchEntryBox.Add(searchEntry);

            searchEntryItem = new ToolItem();
            searchEntryItem.Add(searchEntryBox);

            toolbar.Insert(searchEntryItem, -1);
            searchEntryItem.ShowAll();

            mainVBox.PackStart(toolbar, false, false, 0);

            mainPaned         = new HPaned();
            mainPaned.Mapped += delegate(object sender, EventArgs args) {
                // XXX: Remember the user's last setting instead
                mainPaned.Position = 190;

                // Set some colors
                //infoBoxSeparator.ModifyBg(StateType.Normal, GtkHelper.DarkenColor (mainbar.Style.Background(StateType.Normal), 2));
                //infoSwitcherTree.ModifyBase(StateType.Normal, infoSwitcherTree.Style.Base(StateType.Active));
                //infoSwitcherTree.ModifyBase(StateType.Active, infoBoxSeparator.Style.Base(StateType.Selected));
            };
            mainPaned.Show();
            mainVBox.PackStart(mainPaned, true, true, 0);

            // Create page notebook
            pageNotebook            = new Notebook();
            pageNotebook.ShowTabs   = false;
            pageNotebook.ShowBorder = false;
            mainPaned.Pack2(pageNotebook, true, true);
            pageNotebook.ShowAll();

            // Create sidebar
            sidebar                      = new MainSidebar();
            sidebar.ItemAdded           += sidebar_ItemAdded;
            sidebar.SelectedItemChanged += sidebar_SelectedItemChanged;
            sidebar.AddBuiltinItems();

            mainPaned.Pack1(sidebar, false, false);
            sidebar.ShowAll();

            CreateStatusbar();

            // Apply "view" settings
            toolbar.Visible   = Gui.Settings.ShowToolbar;
            statusBar.Visible = Gui.Settings.ShowStatusBar;

            // Hook up Core events
            Runtime.Core.ShareBuilder.StartedIndexing    += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_StartedIndexing));
            Runtime.Core.ShareBuilder.FinishedIndexing   += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_FinishedIndexing));
            Runtime.Core.ShareBuilder.StoppedIndexing    += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_StoppedIndexing));
            Runtime.Core.ShareBuilder.ErrorIndexing      += (ErrorEventHandler)DispatchService.GuiDispatch(new ErrorEventHandler(sb_ErrorIndexing));
            Runtime.Core.ShareHasher.StartedHashingFile  += (ShareHasherTaskEventHandler)DispatchService.GuiDispatch(new ShareHasherTaskEventHandler(sh_StartedFinished));
            Runtime.Core.ShareHasher.FinishedHashingFile += (ShareHasherTaskEventHandler)DispatchService.GuiDispatch(new ShareHasherTaskEventHandler(sh_StartedFinished));
            Runtime.Core.ShareHasher.QueueChanged        += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sh_QueueChanged));

            Runtime.Core.FileSearchManager.SearchAdded   += (FileSearchEventHandler)DispatchService.GuiDispatch(new FileSearchEventHandler(FileSearchManager_SearchAdded));
            Runtime.Core.FileSearchManager.SearchRemoved += (FileSearchEventHandler)DispatchService.GuiDispatch(new FileSearchEventHandler(FileSearchManager_SearchRemoved));

            window.Resize(Gui.Settings.WindowSize.Width, Gui.Settings.WindowSize.Height);
            window.Move(Gui.Settings.WindowPosition.X, Gui.Settings.WindowPosition.Y);

            SelectedPage = NetworkOverviewPage.Instance;
        }
Ejemplo n.º 13
0
        public SearchResultsPage(FileSearch search)
        {
            VPaned         paned;
            TreeViewColumn column;
            ToolItem       spacerItem;
            ToolItem       filterItem;
            Alignment      filterAlignment;
            ToolButton     searchAgainToolButton;

            this.search = search;

            downloadToolButton             = new ToolButton(new Image("gtk-save", IconSize.LargeToolbar), "Download");
            downloadToolButton.IsImportant = true;
            downloadToolButton.Sensitive   = false;
            downloadToolButton.Clicked    += DownloadToolButtonClicked;

            searchAgainToolButton             = new ToolButton(new Image("gtk-refresh", IconSize.LargeToolbar), "Search Again");
            searchAgainToolButton.IsImportant = true;
            searchAgainToolButton.Clicked    += SearchAgainToolButtonClicked;

            spacerItem        = new ToolItem();
            spacerItem.Expand = true;

            filterButton          = new ToggleButton("Filter Results");
            filterButton.Image    = new Image(Gui.LoadIcon(16, "application-x-executable"));
            filterButton.Toggled += delegate(object o, EventArgs args) {
                this.ShowFilter = filterButton.Active;
            };

            filterAlignment = new Alignment(0.5f, 0.5f, 0, 0);
            filterAlignment.Add(filterButton);

            filterItem = new ToolItem();
            filterItem.Add(filterAlignment);

            browseToolButton             = new ToolButton(new Image("gtk-open", IconSize.LargeToolbar), "Browse");
            browseToolButton.IsImportant = true;
            browseToolButton.Sensitive   = false;
            browseToolButton.Clicked    += BrowseToolButtonClicked;

            toolbar = new Toolbar();
            toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
            toolbar.Insert(downloadToolButton, -1);
            toolbar.Insert(browseToolButton, -1);
            toolbar.Insert(spacerItem, -1);
            toolbar.Insert(filterItem, -1);
            toolbar.Insert(new SeparatorToolItem(), -1);
            toolbar.Insert(searchAgainToolButton, -1);
            toolbar.ShowAll();

            this.PackStart(toolbar, false, false, 0);

            resultCountByTypeCache = new Dictionary <FilterType, int>();

            Gdk.Pixbuf audioPixbuf = Gui.LoadIcon(16, "audio-x-generic");
            Gdk.Pixbuf videoPixbuf = Gui.LoadIcon(16, "video-x-generic");
            Gdk.Pixbuf imagePixbuf = Gui.LoadIcon(16, "image-x-generic");
            Gdk.Pixbuf docPixbuf   = Gui.LoadIcon(16, "x-office-document");
            unknownPixbuf = Gui.LoadIcon(16, "text-x-generic");
            folderPixbuf  = Gui.LoadIcon(16, "folder");

            typeStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(FilterType));
            typeStore.AppendValues(null, "All Results", FilterType.All);
            typeStore.AppendValues(null, "-");
            typeStore.AppendValues(audioPixbuf, "Audio", FilterType.Audio);
            typeStore.AppendValues(videoPixbuf, "Video", FilterType.Video);
            typeStore.AppendValues(imagePixbuf, "Images", FilterType.Image);
            typeStore.AppendValues(docPixbuf, "Documents", FilterType.Document);
            typeStore.AppendValues(folderPixbuf, "Folders", FilterType.Folder);
            typeStore.AppendValues(unknownPixbuf, "Other", FilterType.Other);

            typeTree = new TreeView();
            typeTree.HeadersVisible   = false;
            typeTree.RowSeparatorFunc = delegate(TreeModel m, TreeIter i) {
                string text = (string)m.GetValue(i, 1);
                return(text == "-");
            };
            typeTree.Selection.Changed += TypeSelectionChanged;

            typeTree.Model = typeStore;

            CellRendererPixbuf pixbufCell    = new CellRendererPixbuf();
            CellRendererText   textCell      = new CellRendererText();
            CellRendererText   countTextCell = new CellRendererText();

            countTextCell.Sensitive = false;
            countTextCell.Alignment = Pango.Alignment.Right;
            countTextCell.Xalign    = 1;

            column = new TreeViewColumn();
            column.PackStart(pixbufCell, false);
            column.PackStart(textCell, true);
            column.PackStart(countTextCell, false);
            column.AddAttribute(pixbufCell, "pixbuf", 0);
            column.AddAttribute(textCell, "text", 1);
            column.SetCellDataFunc(countTextCell, new TreeCellDataFunc(TypeCountCellFunc));

            typeTree.AppendColumn(column);

            TreeView artistTree = new TreeView();

            artistTree.HeadersVisible = false;

            TreeView albumTree = new TreeView();

            albumTree.HeadersVisible = false;

            HBox topBox = new HBox();

            topBox.PackStart(Gui.AddScrolledWindow(typeTree), true, true, 0);
            topBox.PackStart(Gui.AddScrolledWindow(artistTree), true, true, 1);
            topBox.PackStart(Gui.AddScrolledWindow(albumTree), true, true, 0);
            topBox.Homogeneous = true;

            resultsStore              = new ListStore(typeof(SearchResult));
            resultsStore.RowInserted += delegate {
                Refilter();
            };
            resultsStore.RowDeleted += delegate {
                Refilter();
            };
            resultsTree = new TreeView();
            resultsTree.RowActivated      += resultsTree_RowActivated;
            resultsTree.ButtonPressEvent  += resultsTree_ButtonPressEvent;
            resultsTree.Selection.Changed += ResultsTreeSelectionChanged;

            imageColumns      = new List <TreeViewColumn>();
            audioColumns      = new List <TreeViewColumn>();
            videoColumns      = new List <TreeViewColumn>();
            fileOnlyColumns   = new List <TreeViewColumn>();
            folderOnlyColumns = new List <TreeViewColumn>();

            column              = new TreeViewColumn();
            column.Title        = "File Name";
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Autosize;
            column.Resizable    = true;
            column.SortColumnId = 0;
            //resultsTree.ExpanderColumn = column;

            CellRenderer cell = new CellRendererPixbuf();

            column.PackStart(cell, false);
            column.SetCellDataFunc(cell, new TreeCellDataFunc(IconFunc));

            cell = new CellRendererText();
            column.PackStart(cell, true);
            column.SetCellDataFunc(cell, new TreeCellDataFunc(FileNameFunc));

            resultsTree.AppendColumn(column);

            column              = resultsTree.AppendColumn("Codec", new CellRendererText(), new TreeCellDataFunc(CodecFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 120;
            column.Resizable    = true;
            column.SortColumnId = 1;
            videoColumns.Add(column);

            column              = resultsTree.AppendColumn("Format", new CellRendererText(), new TreeCellDataFunc(FormatFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 90;
            column.Resizable    = true;
            column.SortColumnId = 2;
            imageColumns.Add(column);

            column              = resultsTree.AppendColumn("Resolution", new CellRendererText(), new TreeCellDataFunc(ResolutionFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 90;
            column.Resizable    = true;
            column.SortColumnId = 3;
            videoColumns.Add(column);
            imageColumns.Add(column);

            column              = resultsTree.AppendColumn("Artist", new CellRendererText(), new TreeCellDataFunc(ArtistFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 110;
            column.Resizable    = true;
            column.SortColumnId = 4;
            audioColumns.Add(column);

            column              = resultsTree.AppendColumn("Album", new CellRendererText(), new TreeCellDataFunc(AlbumFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 110;
            column.Resizable    = true;
            column.SortColumnId = 5;
            audioColumns.Add(column);

            column              = resultsTree.AppendColumn("Bitrate", new CellRendererText(), new TreeCellDataFunc(BitrateFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 70;
            column.Resizable    = true;
            column.SortColumnId = 6;
            audioColumns.Add(column);

            column              = resultsTree.AppendColumn("Size", new CellRendererText(), new TreeCellDataFunc(SizeFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 70;
            column.SortColumnId = 7;
            column.Resizable    = true;
            fileOnlyColumns.Add(column);

            column              = resultsTree.AppendColumn("Sources", new CellRendererText(), new TreeCellDataFunc(SourcesFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 85;
            column.SortColumnId = 8;
            column.Resizable    = true;
            fileOnlyColumns.Add(column);

            column              = resultsTree.AppendColumn("User", new CellRendererText(), new TreeCellDataFunc(UserFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 85;
            column.SortColumnId = 8;
            column.Resizable    = true;
            folderOnlyColumns.Add(column);

            column              = resultsTree.AppendColumn("Full Path", new CellRendererText(), new TreeCellDataFunc(FullPathFunc));
            column.Clickable    = true;
            column.Resizable    = true;
            column.SortColumnId = 9;

            column              = resultsTree.AppendColumn("Info Hash", new CellRendererText(), new TreeCellDataFunc(InfoHashFunc));
            column.Clickable    = true;
            column.Resizable    = true;
            column.SortColumnId = 10;
            fileOnlyColumns.Add(column);

            resultsFilter             = new TreeModelFilter(resultsStore, null);
            resultsFilter.VisibleFunc = resultsFilterFunc;

            resultsSort = new TreeModelSort(resultsFilter);
            for (int x = 0; x < resultsTree.Columns.Length; x++)
            {
                resultsSort.SetSortFunc(x, resultsSortFunc);
            }
            resultsTree.Model = resultsSort;

            ScrolledWindow resultsTreeSW = new ScrolledWindow();

            resultsTreeSW.Add(resultsTree);

            paned = new VPaned();
            paned.Add1(topBox);
            paned.Add2(resultsTreeSW);
            paned.Position = 160;
            paned.ShowAll();

            filterWidget = new FilterWidget(search);
            filterWidget.FiltersChanged += filterWidget_FiltersChanged;
            filterWidget.Hidden         += filterWidget_Hidden;

            this.PackStart(filterWidget, false, false, 0);
            this.PackStart(paned, true, true, 0);

            TypeSelectionChanged(typeTree, EventArgs.Empty);

            search.NewResults     += (EventHandler <SearchResultsEventArgs>)DispatchService.GuiDispatch(new EventHandler <SearchResultsEventArgs>(search_NewResults));
            search.ClearedResults += (EventHandler)DispatchService.GuiDispatch(new EventHandler(search_ClearedResults));

            resultPopupMenu = new Menu();

            browseResultMenuItem            = new ImageMenuItem("Browse");
            browseResultMenuItem.Image      = new Image(Gui.LoadIcon(16, "document-open"));
            browseResultMenuItem.Activated += BrowseToolButtonClicked;
            resultPopupMenu.Append(browseResultMenuItem);

            downloadResultMenuItem            = new ImageMenuItem("Download");
            downloadResultMenuItem.Image      = new Image(Gui.LoadIcon(16, "go-down"));
            downloadResultMenuItem.Activated += DownloadToolButtonClicked;
            resultPopupMenu.Append(downloadResultMenuItem);

            resultPropertiesMenuItem            = new ImageMenuItem(Gtk.Stock.Properties, null);
            resultPropertiesMenuItem.Activated += FilePropertiesButtonClicked;
            resultPopupMenu.Append(resultPropertiesMenuItem);
        }
Ejemplo n.º 14
0
    // pridanie menu a toolbarov do prislusnich widgetov
    private void OnWidgetAdd(object obj, AddWidgetArgs args)
    {
        if (args.Widget is Toolbar) {
            args.Widget.Show();
            if (args.Widget.Name == "toolbarLeft") {
                toolbarLeft = (Toolbar)args.Widget;

                toolbarLeft.ShowAll();
                toolbarLeft.IconSize = IconSize.LargeToolbar;

                vpMenuLeft.Pack1(toolbarLeft, false, false);

            }
            if (args.Widget.Name == "toolbarMiddle") {
                toolbarMiddle = (Toolbar)args.Widget;
                vbMenuMidle.PackEnd(toolbarMiddle,true, true, 0);//true, false,

                ToolItem tic = new ToolItem();
                ToolItem tic2 = new ToolItem();
                ToolItem tic3 = new ToolItem();
                ToolItem til1 = new ToolItem();
                ToolItem til2 = new ToolItem();
                ToolItem til3 = new ToolItem();

                /*Label lbl1 = new Label(MainClass.Languages.Translate("project"));
                Label lbl2 = new Label(MainClass.Languages.Translate("resolution"));
                Label lbl3 = new Label(MainClass.Languages.Translate("device"));*/
                Label lbl1 = new Label(MainClass.Languages.Translate(" "));
                Label lbl2 = new Label(MainClass.Languages.Translate(" "));
                Label lbl3 = new Label(MainClass.Languages.Translate(" "));
                til1.Add(lbl1);
                til2.Add(lbl2);
                til3.Add(lbl3);

                if(MainClass.Platform.IsMac){

                    VBox vboxMenu1 = new VBox();
                    vboxMenu1.PackStart(new Label(),true,false,0);
                    vboxMenu1.PackStart(ddbProject,false,false,0);
                    vboxMenu1.PackEnd(new Label(),true,false,0);

                    VBox vboxMenu2 = new VBox();
                    vboxMenu2.PackStart(new Label(),true,false,0);
                    vboxMenu2.PackStart(ddbResolution,false,false,0);
                    vboxMenu2.PackEnd(new Label(),true,false,0);

                    VBox vboxMenu3 = new VBox();
                    vboxMenu3.PackStart(new Label(),true,false,0);
                    vboxMenu3.PackStart(ddbDevice,false,false,0);
                    vboxMenu3.PackEnd(new Label(),true,false,0);

                    tic.Add(vboxMenu1);
                    tic2.Add(vboxMenu2);
                    tic3.Add(vboxMenu3);

                } else {
                    tic.Add(ddbProject);
                    tic2.Add(ddbResolution);
                    tic3.Add(ddbDevice);

                }
                toolbarMiddle.Insert(tic2, 0);
                toolbarMiddle.Insert(til2, 0);
                //toolbarMiddle.Insert(new SeparatorToolItem(), 0);
                toolbarMiddle.Insert(tic3, 0);
                toolbarMiddle.Insert(til3, 0);
                //toolbarMiddle.Insert(new SeparatorToolItem(), 0);
                toolbarMiddle.Insert(tic, 0);
                toolbarMiddle.Insert(til1, 0);

                toolbarMiddle.ShowAll();
            }
            if (args.Widget.Name == "toolbarRight1") {
                toolbarRight1 = (Toolbar)args.Widget;
                toolbarRight1.IconSize = IconSize.SmallToolbar;
                toolbarRight1.ToolbarStyle = ToolbarStyle.Icons;
                //toolbarRight.
                //hbMenuRight.PackStart(toolbarRight, true, true,0);
                //vbRight.PackStart(toolbarRight1, true, true,0);//Pack1(toolbarRight, true, true);
                tblMenuRight.Attach(toolbarRight1,1,2,0,1,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Fill,0,0);

            }
            if (args.Widget.Name == "toolbarRight2") {
                toolbarRight2 = (Toolbar)args.Widget;
                toolbarRight2.IconSize = IconSize.SmallToolbar;
                toolbarRight2.ToolbarStyle = ToolbarStyle.Icons;
                //toolbarRight2.AccelCanActivate;
                //toolbarRight.
                //hbMenuRight.PackStart(toolbarRight, true, true,0);
                tblMenuRight.Attach(toolbarRight2,1,2,1,2,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Fill,0,0);
                //vbRight.PackEnd(toolbarRight2, true, true,0);//Pack1(toolbarRight, true, true);

            }
        }
        if (args.Widget is MenuBar) {
            mainMenu =(MenuBar)args.Widget;
            mainMenu.Show();

            if(!MainClass.Platform.IsMac)
                vbMenuMidle.PackStart(mainMenu, true, true, 0);
        }
    }
Ejemplo n.º 15
0
        private void CreateToolBars()
        {
            mainToolbar.ToolbarStyle  = ToolbarStyle.Icons;
            toolsPaneBar.ToolbarStyle = ToolbarStyle.Icons;
            toolsPaneBar.Orientation  = Orientation.Vertical;
            toolsToolbar.ToolbarStyle = ToolbarStyle.Icons;
            toolsToolbar.IconSize     = IconSize.Menu;


            ToolButton T = new ToolButton(Stock.New);

            T.Clicked += (s, e) => TheVM.CreateNewFile();
            mainToolbar.Add(T);
            T = new ToolButton(Stock.Open);
            T.ButtonPressEvent += (s, e) => TheVM.Open();
            mainToolbar.Add(T);
            T = new ToolButton(Stock.Save);
            T.ButtonPressEvent += (s, e) => TheVM.Save();
            mainToolbar.Add(T);
            mainToolbar.Add(new SeparatorToolItem());

            T = new ToolButton(Stock.Copy);
            mainToolbar.Add(T);
            T = new ToolButton(Stock.Cut);
            mainToolbar.Add(T);
            T = new ToolButton(Stock.Paste);
            mainToolbar.Add(T);
            T = new ToolButton(Stock.Undo);
            mainToolbar.Add(T);
            T = new ToolButton(Stock.Redo);
            mainToolbar.Add(T);
            mainToolbar.Add(new SeparatorToolItem());

            T = new ToolButton(Stock.Execute);
            mainToolbar.Add(T);
            T.Clicked += (s, e) => TheVM.TheDocument.Recompile();
            T          = cmdAbortCompile = new ToolButton(Stock.Cancel);
            T.Clicked += (s, e) => TheCompiler.Instance.AbortCompilation();
            mainToolbar.Add(T);

            mainToolbar.Add(new SeparatorToolItem());
            T          = new ToolButton(Stock.Quit);
            T.Clicked += (s, e) => Application.Quit();
            mainToolbar.Add(T);

            T = new ToolButton(Stock.Home);
            toolsPaneBar.Add(T);
            T = new ToolButton(Stock.Index);
            toolsPaneBar.Add(T);
            T = new ToolButton(Stock.Execute);
            toolsPaneBar.Add(T);

            // tools toolbar

            /*RadioToolButton RT0 = null;
             * RadioToolButton RT;
             * RT0 = RT = new RadioToolButton(RT0);
             * RT.IconWidget = Properties.Resources.base_cursor.ToImage();
             * toolsToolbar.Add(RT);
             * RT = new RadioToolButton(RT0);
             * RT.IconWidget = Properties.Resources.bmpvert.ToImage();
             * toolsToolbar.Add(RT);
             * RT = new RadioToolButton(null, Stock.Add);
             * //RT.IconWidget = Properties.Resources.bmpvert.ToImage();
             * RT.Label = "jhgjhgJH";
             * toolsToolbar.Add(RT);*/

            T = new ToolButton(Properties.Resources.base_cursor.ToImage(), "");
            toolsToolbar.Add(T);
            ToolButtons.Add(T);
            T = new ToolButton(Properties.Resources.bmpvert.ToImage(), "");
            toolsToolbar.Add(T); ToolButtons.Add(T);
            T = new ToolButton(Properties.Resources.edge.ToImage(), "");
            toolsToolbar.Add(T); ToolButtons.Add(T);
            T = new ToolButton(Properties.Resources.path.ToImage(), "");
            toolsToolbar.Add(T); ToolButtons.Add(T);
            T = new ToolButton(Properties.Resources.Bezier.ToImage(), "");
            toolsToolbar.Add(T); ToolButtons.Add(T);
            T = new ToolButton(Properties.Resources.Smooth.ToImage(), "");
            toolsToolbar.Add(T); ToolButtons.Add(T);
            T = new ToolButton(Properties.Resources.arc.ToImage(), "");
            toolsToolbar.Add(T); ToolButtons.Add(T);
            T = new ToolButton(Properties.Resources.arcedit.ToImage(), "");
            toolsToolbar.Add(T); ToolButtons.Add(T);
            T = new ToolButton(Properties.Resources.Rectangle.ToImage(), "");
            toolsToolbar.Add(T); ToolButtons.Add(T);
            T = new ToolButton(Properties.Resources.Ellipse.ToImage(), "");
            toolsToolbar.Add(T); ToolButtons.Add(T);
            T = new ToolButton(Properties.Resources.grid.ToImage(), "");
            toolsToolbar.Add(T); ToolButtons.Add(T);

            ToolButtons.Each((b, i) =>
            {
                OverlayToolType t = (OverlayToolType)i;
                b.Clicked        += (s, e) => TheVM.CurrentTool = t;
            });

            ToolItem it = new ToolItem();

            it.Add(new Label("Node style:"));
            toolsToolbar.Add(it);
            it = new ToolItem()
            {
                WidthRequest = 100
            };
            it.Add(cmbNodeStyle = ComboBoxEntry.NewText());
            toolsToolbar.Add(it);
            it = new ToolItem();
            it.Add(new Label("Edge style:"));
            toolsToolbar.Add(it);
            it = new ToolItem()
            {
                WidthRequest = 100
            };
            it.Add(cmbEdgeStyle = ComboBoxEntry.NewText());
            toolsToolbar.Add(it);


            toolsToolbar.Add(new SeparatorToolItem());
            T = new ToolButton(Properties.Resources.radial.ToImage(), "");
            toolsToolbar.Add(T);
        }
Ejemplo n.º 16
0
        public ImageToolBarControl(ImageCanvas ic)
        {
            this.ic                 = ic;
            btnShowHideBarier       = new ToggleToolButton("barier-show.png");      //RadioToolButton(group1);//,"barier-show.png");
            btnShowHideBarier.Label = MainClass.Languages.Translate("show_barier_layer");
            btnShowHideBarier.Name  = "btnShowHideBarier";
            //btnShowHideBarier.Relief = ReliefStyle.None;
            btnShowHideBarier.CanFocus    = false;
            btnShowHideBarier.BorderWidth = 1;
            //btnShowHideBarier.WidthRequest = 75;
            btnShowHideBarier.TooltipText = MainClass.Languages.Translate("show_barier_layer_tt");

            btnShowHideBarier.Events   = Gdk.EventMask.AllEventsMask;          // | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask
            btnShowHideBarier.Toggled += delegate(object sender, EventArgs e) {
                this.ic.ShowBarierLayer = btnShowHideBarier.Active;
                SetSensitive(btnShowHideBarier.Active);
                //Console.WriteLine("btnShowHideBarier.Toggled");
            };

            btnEditBarierPoint       = new ToggleToolButton("barier-add.png");       //new RadioToolButton(group2,"barier-add.png");
            btnEditBarierPoint.Name  = "btnEditBarierPoint";
            btnEditBarierPoint.Label = MainClass.Languages.Translate("edit_barier_point");
            //btnEditBarierPoint.Relief = ReliefStyle.None;
            btnEditBarierPoint.CanFocus    = false;
            btnEditBarierPoint.BorderWidth = 1;
            btnEditBarierPoint.TooltipText = MainClass.Languages.Translate("edit_barier_point_tt");
            btnEditBarierPoint.Toggled    += delegate(object sender, EventArgs e) {
                if (btnEditBarierPoint.Active)
                {
                    btnDeleteBarierPoint.Active = false;
                    //btnMovieBarierPoint.Active = false;
                }
            };

            btnDeleteBarierPoint       = new ToggleToolButton("barier-delete.png");      //new RadioToolButton(group2,"barier-delete.png");
            btnDeleteBarierPoint.Name  = "btnDeleteBarierPoint";
            btnDeleteBarierPoint.Label = MainClass.Languages.Translate("delete_barier_point");
            //btnDeleteBarierPoint.Relief = ReliefStyle.None;
            btnDeleteBarierPoint.CanFocus    = false;
            btnDeleteBarierPoint.BorderWidth = 1;
            btnDeleteBarierPoint.TooltipText = MainClass.Languages.Translate("delete_barier_point_tt");
            btnDeleteBarierPoint.Toggled    += delegate(object sender, EventArgs e) {
                if (btnDeleteBarierPoint.Active)
                {
                    btnEditBarierPoint.Active = false;
                    //btnAddBarierPoint.Active = false;
                    //btnMovieBarierPoint.Active = false;
                }
            };

            btnDeleteBarier      = new ToolButton("barier-delete-all.png");
            btnDeleteBarier.Name = "btnDeleteBarier";

            btnDeleteBarier.Label       = MainClass.Languages.Translate("delete_barier");
            btnDeleteBarier.CanFocus    = false;
            btnDeleteBarier.BorderWidth = 1;
            btnDeleteBarier.TooltipText = MainClass.Languages.Translate("delete_barier_tt");
            btnDeleteBarier.Clicked    += delegate(object sender, EventArgs e) {
                MessageDialogs md     = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, "", MainClass.Languages.Translate("delete_barier_question"), Gtk.MessageType.Question);
                int            result = md.ShowDialog();

                if (result != (int)Gtk.ResponseType.Yes)
                {
                    return;
                }

                if (DeleteBarierLayerEvent != null)
                {
                    DeleteBarierLayerEvent(null, null);
                }
            };

            SetSensitive(false);

            this.Insert(btnShowHideBarier, 0);

            this.Insert(btnEditBarierPoint, 1);
            this.Insert(btnDeleteBarierPoint, 2);
            this.Insert(btnDeleteBarier, 3);

            Gtk.ToolButton btnZoomIn = new Gtk.ToolButton("zoom-in.png");
            btnZoomIn.Label       = MainClass.Languages.Translate("zoom_in");
            btnZoomIn.TooltipText = MainClass.Languages.Translate("zoom_in");
            //btnZoomIn.Relief = Gtk.ReliefStyle.None;
            btnZoomIn.CanFocus = false;
            btnZoomIn.Clicked += delegate {
                ZoomIn();
            };

            Gtk.ToolButton btnZoomOriginal = new Gtk.ToolButton("zoom-original.png");
            btnZoomOriginal.Label       = MainClass.Languages.Translate("zoom_original");
            btnZoomOriginal.TooltipText = MainClass.Languages.Translate("zoom_original");
            //btnZoomOriginal.Relief = Gtk.ReliefStyle.None;
            btnZoomOriginal.CanFocus = false;
            btnZoomOriginal.Clicked += delegate {
                cbeZoom.Active = 11;
            };
            //btnZoomOriginal.WidthRequest = btnZoomOriginal.HeightRequest = 19;

            Gtk.ToolButton btnZoomOut = new Gtk.ToolButton("zoom-out.png");
            btnZoomOut.TooltipText = MainClass.Languages.Translate("zoom_out");
            btnZoomOut.Label       = MainClass.Languages.Translate("zoom_out");
            //btnZoomOut.Relief = Gtk.ReliefStyle.None;
            btnZoomOut.CanFocus = false;
            btnZoomOut.Clicked += delegate {
                ZoomOut();
            };

            string[] zoomCollection = new string[] { "3600%", "2400%", "1600%", "1200%", "800%", "700%", "600%", "500%", "400%", "300%", "200%", "100%", "66%", "50%", "33%", "25%", "16%", "12%", "8%", "5%" };
            cbeZoom              = new ComboBoxEntry(zoomCollection);
            cbeZoom.Active       = 11;
            cbeZoom.WidthRequest = 70;
            cbeZoom.Changed     += delegate(object sender, EventArgs e) {
                UpdateScale();
            };

            cbeZoom.Entry.FocusOutEvent += delegate(object o, FocusOutEventArgs args) {
                //Console.WriteLine("FocusOutEvent");
                UpdateScale();
            };

            cbeZoom.Entry.FocusInEvent += delegate(object o, FocusInEventArgs args) {
            };
            cbeZoom.Entry.Changed      += delegate(object sender, EventArgs e) {
                //UpdateScale();
            };

            ToolItem tic = new ToolItem();

            tic.Add(cbeZoom);

            this.Insert(new SeparatorToolItem(), 4);
            this.Insert(btnZoomIn, 5);
            this.Insert(btnZoomOut, 6);
            this.Insert(tic, 7);
            this.Insert(btnZoomOriginal, 8);
        }