void UpdateSensitivity() { foreach (ItemDescriptor item in sensitives.Keys) { Widget w = editors[item.Name] as Widget; if (w != null) { ObjectWrapper wrapper = wrappers [item] as ObjectWrapper; object ob = sensitives.Contains(item) ? wrapper.Wrapped : null; w.Sensitive = item.EnabledFor(ob); } } foreach (ItemDescriptor item in invisibles.Keys) { Widget w = editors[item.Name] as Widget; if (w != null) { ObjectWrapper wrapper = wrappers [item] as ObjectWrapper; object ob = invisibles.Contains(item) ? wrapper.Wrapped : null; w.Visible = item.VisibleFor(ob); } } foreach (CommandDescriptor cmd in toggles) { ToggleToolButton w = editors[cmd.Name] as ToggleToolButton; if (w != null) { ObjectWrapper wrapper = wrappers [cmd] as ObjectWrapper; updating = true; w.Active = cmd.IsToogled(wrapper.Wrapped); updating = false; } } }
void UpdateButtons() { updating = true; foreach (Gtk.Widget c in Children) { Remove(c); } foreach (Gtk.Widget page in notebook.Children) { Gtk.Widget t = notebook.GetTabLabel(page); notebook.SetTabLabel(page, new Gtk.Label("")); // Gtk.Widget nw; // if (t is Gtk.Label) // nw = new Gtk.Label (((Gtk.Label)t).Text); // else // nw = new Gtk.Label (""); ToggleToolButton button = new ToggleToolButton(); button.IsImportant = true; button.LabelWidget = t; button.Clicked += new EventHandler(OnButtonToggled); button.ShowAll(); Insert(button, -1); } updating = false; }
public void SetButton(int index, string label, string icon) { ToggleToolButton button = (ToggleToolButton)Children [index]; button.Label = label; button.StockId = icon; }
private void SetToggleToolButtonActivity(string toggleToolButtonName, bool isActive, EventHandler handler) { ToggleToolButton toggleToolButton = Base.GetWidget(toggleToolButtonName) as ToggleToolButton; toggleToolButton.Toggled -= handler; toggleToolButton.Active = isActive; toggleToolButton.Toggled += handler; }
public ToolbarToggle(ICommand cmd) : base(cmd) { _Button = new ToggleToolButton(cmd.Properties.Icon); _Button.Toggled += new EventHandler(OnToggled); _Button.Label = cmd.Properties.Text; this.Add(_Button); _Button.Show(); this.ShowAll(); }
void FillToolbar() { Toolbar toolbar = new Toolbar(); toolbar.Orientation = Orientation.Vertical; toolbar.ToolbarStyle = ToolbarStyle.Icons; editimage = new Gtk.Image(Helpers.Misc.LoadIcon("longomatch-dash-edit_active", 22)); editbutton = new ToggleToolButton(); editbutton.IconWidget = editimage; editbutton.Toggled += HandleEditToggled; editbutton.TooltipText = Catalog.GetString("Edit dashboard"); toolbar.Add(editbutton); toolbar.Add(new SeparatorToolItem()); linksimage = new Gtk.Image(Helpers.Misc.LoadIcon("longomatch-link-disabled", 22)); linksbutton = new ToggleToolButton(); linksbutton.IconWidget = linksimage; linksbutton.Toggled += HandleLinksToggled; linksbutton.TooltipText = Catalog.GetString("Edit action links"); toolbar.Add(linksbutton); toolbar.Add(new SeparatorToolItem()); popupbutton = new ToggleToolButton(); popupbutton.IconWidget = new Gtk.Image(Helpers.Misc.LoadIcon("longomatch-popup", 22)); popupbutton.Active = true; popupbutton.Toggled += HandlePopupToggled; popupbutton.TooltipText = Catalog.GetString("Disable popup window"); toolbar.Add(popupbutton); toolbar.Add(new SeparatorToolItem()); fitbutton = new RadioToolButton((GLib.SList)null); fitbutton.IconWidget = new Gtk.Image(Helpers.Misc.LoadIcon("longomatch-dash-fit", 22)); fitbutton.Toggled += HandleFitModeToggled; fitbutton.TooltipText = Catalog.GetString("Fit dashboard"); toolbar.Add(fitbutton); fillbutton = new RadioToolButton(fitbutton); fillbutton.IconWidget = new Gtk.Image(Helpers.Misc.LoadIcon("longomatch-dash-fill", 22)); fillbutton.Toggled += HandleFitModeToggled; fillbutton.TooltipText = Catalog.GetString("Fill dashboard"); toolbar.Add(fillbutton); d11button = new RadioToolButton(fitbutton); d11button.IconWidget = new Gtk.Image(Helpers.Misc.LoadIcon("longomatch-dash-11", 22)); d11button.Toggled += HandleFitModeToggled; d11button.TooltipText = Catalog.GetString("1:1 dashboard"); toolbar.Add(d11button); toolbar.ShowAll(); hbox2.PackEnd(toolbar, false, false, 0); editbutton.Active = true; linksbutton.Active = false; }
protected ToggleToolButton AddButton(string label, Gtk.Widget page) { updating = true; ToggleToolButton button = new ToggleToolButton(); button.Label = label; button.IsImportant = true; button.Clicked += new EventHandler(OnButtonToggled); button.ShowAll(); toolbar.Insert(button, -1); notebook.AppendPage(page, new Gtk.Label()); updating = false; return(button); }
public virtual void ShowPage(int npage) { if (notebook.CurrentPage == npage) { ToggleToolButton but = (ToggleToolButton)Children [npage]; but.Active = true; return; } if (updating) { return; } notebook.CurrentPage = npage; }
protected ToggleToolButton AddButton(string label, Gtk.Widget page) { CheckCreateSubViewToolbar(); updating = true; ToggleToolButton button = new ToggleToolButton(); button.Label = label; button.IsImportant = true; button.Clicked += new EventHandler(OnButtonToggled); button.ShowAll(); subViewToolbar.Insert(button, -1); subViewNotebook.AppendPage(page, new Gtk.Label()); page.ShowAll(); EnsureToolbarBoxSeparator(); updating = false; return(button); }
void OnPageChanged(object s, Gtk.SwitchPageArgs args) { if (updating) { return; } updating = true; Gtk.Widget[] buttons = Children; for (int n = 0; n < buttons.Length; n++) { ToggleToolButton b = (ToggleToolButton)buttons [n]; b.Active = (n == args.PageNum); } updating = false; }
void HandlePbToolItemClicked(object sender, EventArgs e) { ToggleToolButton tb = (ToggleToolButton)sender; BaseTool t = FindTool(tb.Label); // Don't let the user unselect the current tool if (CurrentTool != null && t.Name == CurrentTool.Name) { if (prev_index != index) { tb.Active = true; } return; } SetCurrentTool(t); }
protected override void OnToggled() { // If the button was activated, we have to make // all other buttons unactive if (this.Active) { for (int i = 0; i < this.Toolbar.NItems; i++) { ToolItem item = this.Toolbar.GetNthItem(i); // Make sure that it is a toggle and not a separator if (item is ToggleToolButton && this != item) { ToggleToolButton toggle = (ToggleToolButton)item; if (toggle.Active) { toggle.Active = false; } } } } }
protected void ShowPage(int npage) { if (updating) { return; } updating = true; subViewNotebook.CurrentPage = npage; Gtk.Widget[] buttons = subViewToolbar.Children; for (int n = 0; n < buttons.Length; n++) { if (buttons [n] is ToggleToolButton) { ToggleToolButton b = (ToggleToolButton)buttons [n]; b.Active = (n == npage); } } updating = false; }
protected virtual ToggleToolButton CreateToolButton() { Gtk.Image i2 = new Gtk.Image(PintaCore.Resources.GetIcon(Icon)); i2.Show(); ToggleToolButton tool_item = new ToggleToolButton(); tool_item.IconWidget = i2; tool_item.Show(); tool_item.Label = Name; if (ShortcutKey != (Gdk.Key) 0) { tool_item.TooltipText = string.Format("{0}\n{2}: {1}\n\n{3}", Name, ShortcutKey.ToString().ToUpperInvariant(), Catalog.GetString("Shortcut key"), StatusBarText); } else { tool_item.TooltipText = Name; } return(tool_item); }
public virtual void ShowPage(int npage) { if (notebook.CurrentPage == npage) { return; } if (updating) { return; } updating = true; notebook.CurrentPage = npage; Gtk.Widget[] buttons = toolbar.Children; for (int n = 0; n < buttons.Length; n++) { ToggleToolButton b = (ToggleToolButton)buttons [n]; b.Active = (n == npage); } updating = false; }
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); }
public SearchResultWidget() { var vbox = new VBox(); var toolbar = new Toolbar() { Orientation = Orientation.Vertical, IconSize = IconSize.Menu, ToolbarStyle = ToolbarStyle.Icons, }; this.PackStart(vbox, true, true, 0); this.PackStart(toolbar, false, false, 0); labelStatus = new Label() { Xalign = 0, Justify = Justification.Left, }; var hpaned = new HPaned(); vbox.PackStart(hpaned, true, true, 0); vbox.PackStart(labelStatus, false, false, 0); var resultsScroll = new CompactScrolledWindow(); hpaned.Pack1(resultsScroll, true, true); scrolledwindowLogView = new CompactScrolledWindow(); hpaned.Pack2(scrolledwindowLogView, true, true); textviewLog = new TextView() { Editable = false, }; scrolledwindowLogView.Add(textviewLog); store = new ListStore(typeof(SearchResult), typeof(bool) // didRead ); treeviewSearchResults = new PadTreeView() { Model = store, HeadersClickable = true, RulesHint = true, }; treeviewSearchResults.Selection.Mode = Gtk.SelectionMode.Multiple; resultsScroll.Add(treeviewSearchResults); this.ShowAll(); var fileNameColumn = new TreeViewColumn { Resizable = false, SortColumnId = 0, Title = GettextCatalog.GetString("File") }; fileNameColumn.FixedWidth = 200; var fileNamePixbufRenderer = new CellRendererPixbuf(); fileNameColumn.PackStart(fileNamePixbufRenderer, false); fileNameColumn.SetCellDataFunc(fileNamePixbufRenderer, FileIconDataFunc); fileNameColumn.PackStart(treeviewSearchResults.TextRenderer, true); fileNameColumn.SetCellDataFunc(treeviewSearchResults.TextRenderer, FileNameDataFunc); treeviewSearchResults.AppendColumn(fileNameColumn); // TreeViewColumn lineColumn = treeviewSearchResults.AppendColumn (GettextCatalog.GetString ("Line"), new CellRendererText (), ResultLineDataFunc); // lineColumn.SortColumnId = 1; // lineColumn.FixedWidth = 50; // TreeViewColumn textColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Text"), treeviewSearchResults.TextRenderer, ResultTextDataFunc); textColumn.SortColumnId = 2; textColumn.Resizable = false; textColumn.FixedWidth = 300; TreeViewColumn pathColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Path"), treeviewSearchResults.TextRenderer, ResultPathDataFunc); pathColumn.SortColumnId = 3; pathColumn.Resizable = false; pathColumn.FixedWidth = 500; store.SetSortFunc(0, CompareFileNames); // store.SetSortFunc (1, CompareLineNumbers); store.SetSortFunc(3, CompareFilePaths); treeviewSearchResults.RowActivated += TreeviewSearchResultsRowActivated; buttonStop = new ToolButton(Stock.Stop) { Sensitive = false }; buttonStop.Clicked += ButtonStopClicked; buttonStop.TooltipText = GettextCatalog.GetString("Stop"); toolbar.Insert(buttonStop, -1); var buttonClear = new ToolButton(Gtk.Stock.Clear); buttonClear.Clicked += ButtonClearClicked; buttonClear.TooltipText = GettextCatalog.GetString("Clear results"); toolbar.Insert(buttonClear, -1); var buttonOutput = new ToggleToolButton(Gui.Stock.OutputIcon); buttonOutput.Clicked += ButtonOutputClicked; buttonOutput.TooltipText = GettextCatalog.GetString("Show output"); toolbar.Insert(buttonOutput, -1); buttonPin = new ToggleToolButton(Gui.Stock.PinUp); buttonPin.Clicked += ButtonPinClicked; buttonPin.TooltipText = GettextCatalog.GetString("Pin results pad"); toolbar.Insert(buttonPin, -1); store.SetSortColumnId(3, SortType.Ascending); ShowAll(); scrolledwindowLogView.Hide(); }
public Toolbox(ServiceContainer parentServices) { this.parentServices = parentServices; //we need this service, so create it if not present toolboxService = parentServices.GetService(typeof(IToolboxService)) as ToolboxService; if (toolboxService == null) { toolboxService = new ToolboxService(); parentServices.AddService(typeof(IToolboxService), toolboxService); } #region Toolbar toolbar = new Toolbar(); toolbar.ToolbarStyle = ToolbarStyle.Icons; toolbar.IconSize = IconSize.SmallToolbar; base.PackStart(toolbar, false, false, 0); filterToggleButton = new ToggleToolButton(); filterToggleButton.IconWidget = new Image(Stock.MissingImage, IconSize.SmallToolbar); filterToggleButton.Toggled += new EventHandler(toggleFiltering); toolbar.Insert(filterToggleButton, 0); catToggleButton = new ToggleToolButton(); catToggleButton.IconWidget = new Image(Stock.MissingImage, IconSize.SmallToolbar); catToggleButton.Toggled += new EventHandler(toggleCategorisation); toolbar.Insert(catToggleButton, 1); SeparatorToolItem sep = new SeparatorToolItem(); toolbar.Insert(sep, 2); filterEntry = new Entry(); filterEntry.WidthRequest = 150; filterEntry.Changed += new EventHandler(filterTextChanged); #endregion scrolledWindow = new ScrolledWindow(); base.PackEnd(scrolledWindow, true, true, 0); //Initialise model store = new ToolboxStore(); //initialise view nodeView = new NodeView(store); nodeView.Selection.Mode = SelectionMode.Single; nodeView.HeadersVisible = false; //cell renderers CellRendererPixbuf pixbufRenderer = new CellRendererPixbuf(); CellRendererText textRenderer = new CellRendererText(); textRenderer.Ellipsize = Pango.EllipsizeMode.End; //Main column with text, icons TreeViewColumn col = new TreeViewColumn(); col.PackStart(pixbufRenderer, false); col.SetAttributes(pixbufRenderer, "pixbuf", ToolboxStore.Columns.Icon, "visible", ToolboxStore.Columns.IconVisible, "cell-background-gdk", ToolboxStore.Columns.BackgroundColour); col.PackEnd(textRenderer, true); col.SetAttributes(textRenderer, "text", ToolboxStore.Columns.Label, "weight", ToolboxStore.Columns.FontWeight, "cell-background-gdk", ToolboxStore.Columns.BackgroundColour); nodeView.AppendColumn(col); //Initialise self scrolledWindow.VscrollbarPolicy = PolicyType.Automatic; scrolledWindow.HscrollbarPolicy = PolicyType.Never; scrolledWindow.WidthRequest = 150; scrolledWindow.AddWithViewport(nodeView); //selection events nodeView.NodeSelection.Changed += OnSelectionChanged; nodeView.RowActivated += OnRowActivated; //update view when toolbox service updated toolboxService.ToolboxChanged += new EventHandler(tbsChanged); Refresh(); //track expanded state of nodes nodeView.RowCollapsed += new RowCollapsedHandler(whenRowCollapsed); nodeView.RowExpanded += new RowExpandedHandler(whenRowExpanded); //set initial state filterToggleButton.Active = false; catToggleButton.Active = true; }
public SearchResultWidget() { this.Build(); store = new ListStore(typeof(SearchResult), typeof(bool) // didRead ); treeviewSearchResults.Model = store; treeviewSearchResults.Selection.Mode = Gtk.SelectionMode.Multiple; treeviewSearchResults.HeadersClickable = true; treeviewSearchResults.PopupMenu += OnPopupMenu; treeviewSearchResults.ButtonPressEvent += HandleButtonPressEvent; treeviewSearchResults.RulesHint = true; TreeViewColumn fileNameColumn = new TreeViewColumn(); fileNameColumn.Resizable = true; fileNameColumn.SortColumnId = 0; fileNameColumn.Title = GettextCatalog.GetString("File"); var fileNamePixbufRenderer = new CellRendererPixbuf(); fileNameColumn.PackStart(fileNamePixbufRenderer, false); fileNameColumn.SetCellDataFunc(fileNamePixbufRenderer, new Gtk.TreeCellDataFunc(FileIconDataFunc)); CellRendererText fileNameRenderer = new CellRendererText(); fileNameColumn.PackStart(fileNameRenderer, true); fileNameColumn.SetCellDataFunc(fileNameRenderer, new Gtk.TreeCellDataFunc(FileNameDataFunc)); treeviewSearchResults.AppendColumn(fileNameColumn); TreeViewColumn lineColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Line"), new Gtk.CellRendererText(), new Gtk.TreeCellDataFunc(ResultLineDataFunc)); lineColumn.SortColumnId = 1; TreeViewColumn textColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Text"), new Gtk.CellRendererText(), new Gtk.TreeCellDataFunc(ResultTextDataFunc)); textColumn.SortColumnId = 2; textColumn.Resizable = true; TreeViewColumn pathColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Path"), new Gtk.CellRendererText(), new Gtk.TreeCellDataFunc(ResultPathDataFunc)); pathColumn.SortColumnId = 3; pathColumn.Resizable = true; store.SetSortFunc(0, new TreeIterCompareFunc(CompareFileNames)); store.SetSortFunc(1, new TreeIterCompareFunc(CompareLineNumbers)); store.SetSortFunc(3, new TreeIterCompareFunc(CompareFilePaths)); treeviewSearchResults.RowActivated += TreeviewSearchResultsRowActivated; buttonStop = new ToolButton("gtk-stop"); buttonStop.Sensitive = false; buttonStop.Clicked += ButtonStopClicked; buttonStop.TooltipText = GettextCatalog.GetString("Stop"); toolbar.Insert(buttonStop, -1); ToolButton buttonClear = new ToolButton("gtk-clear"); buttonClear.Clicked += ButtonClearClicked; buttonClear.TooltipText = GettextCatalog.GetString("Clear results"); toolbar.Insert(buttonClear, -1); ToggleToolButton buttonOutput = new ToggleToolButton(MonoDevelop.Ide.Gui.Stock.OutputIcon); buttonOutput.Clicked += ButtonOutputClicked; buttonOutput.TooltipText = GettextCatalog.GetString("Show output"); toolbar.Insert(buttonOutput, -1); buttonPin = new ToggleToolButton("md-pin-up"); buttonPin.Clicked += ButtonPinClicked; buttonPin.TooltipText = GettextCatalog.GetString("Pin results pad"); toolbar.Insert(buttonPin, -1); store.SetSortColumnId(3, SortType.Ascending); ShowAll(); scrolledwindowLogView.Hide(); }
public SearchResultWidget() { var vbox = new VBox(); var toolbar = new Toolbar() { Orientation = Orientation.Vertical, IconSize = IconSize.Menu, ToolbarStyle = ToolbarStyle.Icons, }; this.PackStart(vbox, true, true, 0); this.PackStart(toolbar, false, false, 0); labelStatus = new Label() { Xalign = 0, Justify = Justification.Left, }; var hpaned = new HPaned(); vbox.PackStart(hpaned, true, true, 0); vbox.PackStart(labelStatus, false, false, 0); var resultsScroll = new CompactScrolledWindow(); hpaned.Pack1(resultsScroll, true, true); scrolledwindowLogView = new CompactScrolledWindow(); hpaned.Pack2(scrolledwindowLogView, true, true); textviewLog = new TextView() { Editable = false, }; scrolledwindowLogView.Add(textviewLog); store = new ListStore(typeof(SearchResult), typeof(bool) // didRead ); treeviewSearchResults = new PadTreeView() { Model = store, HeadersClickable = true, RulesHint = true, }; treeviewSearchResults.Selection.Mode = Gtk.SelectionMode.Multiple; resultsScroll.Add(treeviewSearchResults); var projectColumn = new TreeViewColumn { Resizable = true, SortColumnId = 1, Title = GettextCatalog.GetString("Project"), Sizing = TreeViewColumnSizing.Fixed, FixedWidth = 100 }; var projectPixbufRenderer = new CellRendererImage(); projectColumn.PackStart(projectPixbufRenderer, false); projectColumn.SetCellDataFunc(projectPixbufRenderer, ResultProjectIconDataFunc); var renderer = treeviewSearchResults.TextRenderer; renderer.Ellipsize = Pango.EllipsizeMode.End; projectColumn.PackStart(renderer, true); projectColumn.SetCellDataFunc(renderer, ResultProjectDataFunc); treeviewSearchResults.AppendColumn(projectColumn); var fileNameColumn = new TreeViewColumn { Resizable = true, SortColumnId = 2, Title = GettextCatalog.GetString("File"), Sizing = TreeViewColumnSizing.Fixed, FixedWidth = 200 }; var fileNamePixbufRenderer = new CellRendererImage(); fileNameColumn.PackStart(fileNamePixbufRenderer, false); fileNameColumn.SetCellDataFunc(fileNamePixbufRenderer, FileIconDataFunc); fileNameColumn.PackStart(renderer, true); fileNameColumn.SetCellDataFunc(renderer, FileNameDataFunc); treeviewSearchResults.AppendColumn(fileNameColumn); TreeViewColumn textColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Text"), renderer, ResultTextDataFunc); textColumn.Resizable = true; textColumn.Sizing = TreeViewColumnSizing.Fixed; textColumn.FixedWidth = 300; pathColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Path"), renderer, ResultPathDataFunc); pathColumn.SortColumnId = 3; pathColumn.Resizable = true; pathColumn.Sizing = TreeViewColumnSizing.Fixed; pathColumn.FixedWidth = 500; store.DefaultSortFunc = DefaultSortFunc; store.SetSortFunc(1, CompareProjectFileNames); store.SetSortFunc(2, CompareFileNames); store.SetSortFunc(3, CompareFilePaths); treeviewSearchResults.RowActivated += TreeviewSearchResultsRowActivated; buttonStop = new ToolButton(new ImageView(Gui.Stock.Stop, Gtk.IconSize.Menu), null) { Sensitive = false }; buttonStop.Clicked += ButtonStopClicked; buttonStop.TooltipText = GettextCatalog.GetString("Stop"); toolbar.Insert(buttonStop, -1); var buttonClear = new ToolButton(new ImageView(Gui.Stock.Clear, Gtk.IconSize.Menu), null); buttonClear.Clicked += ButtonClearClicked; buttonClear.TooltipText = GettextCatalog.GetString("Clear results"); toolbar.Insert(buttonClear, -1); var buttonOutput = new ToggleToolButton(); buttonOutput.IconWidget = new ImageView(Gui.Stock.OutputIcon, Gtk.IconSize.Menu); buttonOutput.Clicked += ButtonOutputClicked; buttonOutput.TooltipText = GettextCatalog.GetString("Show output"); toolbar.Insert(buttonOutput, -1); buttonPin = new ToggleToolButton(); buttonPin.IconWidget = new ImageView(Gui.Stock.PinUp, Gtk.IconSize.Menu); buttonPin.Clicked += ButtonPinClicked; buttonPin.TooltipText = GettextCatalog.GetString("Pin results pad"); toolbar.Insert(buttonPin, -1); // store.SetSortColumnId (3, SortType.Ascending); ShowAll(); scrolledwindowLogView.Hide(); treeviewSearchResults.FixedHeightMode = true; UpdateStyles(); IdeApp.Preferences.ColorScheme.Changed += UpdateStyles; }
public FullScreenView(IBrowsableCollection collection, Window parent) : base("Full Screen Mode") { //going fullscreen on the same screen the parent window Gdk.Screen screen = Screen; int monitor = screen.GetMonitorAtWindow(parent.GdkWindow); Gdk.Rectangle bounds = screen.GetMonitorGeometry(monitor); Move(bounds.X, bounds.Y); string style = "style \"test\" {\n" + "GtkToolbar::shadow_type = GTK_SHADOW_NONE\n" + "}\n" + "class \"GtkToolbar\" style \"test\""; Gtk.Rc.ParseString(style); Name = "FullscreenContainer"; try { //scroll = new Gtk.ScrolledWindow (null, null); actions = new ActionGroup("joe"); actions.Add(new[] { new ActionEntry(HideToolbar, Stock.Close, Catalog.GetString("Hide"), null, Catalog.GetString("Hide toolbar"), HideToolbarAction) }); actions.Add(new[] { new ToggleActionEntry(Info, Stock.Info, Catalog.GetString("Info"), null, Catalog.GetString("Image information"), InfoAction, false) }); Gtk.Action exit_full_screen = new Gtk.Action(ExitFullScreen, Catalog.GetString("Exit fullscreen"), null, null); exit_full_screen.IconName = "view-restore"; exit_full_screen.Activated += ExitAction; actions.Add(exit_full_screen); Gtk.Action slide_show = new Gtk.Action(SlideShow, Catalog.GetString("Slideshow"), Catalog.GetString("Start slideshow"), null); slide_show.IconName = "media-playback-start"; slide_show.Activated += SlideShowAction; actions.Add(slide_show); new WindowOpacityFader(this, 1.0, 600); notebook = new Notebook(); notebook.ShowBorder = false; notebook.ShowTabs = false; notebook.Show(); scroll = new ScrolledView(); scroll.ScrolledWindow.SetPolicy(PolicyType.Never, PolicyType.Never); view = new PhotoImageView(collection); // FIXME this should be handled by the new style setting code view.ModifyBg(Gtk.StateType.Normal, this.Style.Black); Add(notebook); view.Show(); view.MotionNotifyEvent += HandleViewMotion; view.PointerMode = PointerMode.Scroll; scroll.ScrolledWindow.Add(view); Toolbar tbar = new Toolbar(); tbar.ToolbarStyle = Gtk.ToolbarStyle.BothHoriz; tbar.ShowArrow = false; tbar.BorderWidth = 15; ToolItem t_item = (actions [ExitFullScreen]).CreateToolItem() as ToolItem; t_item.IsImportant = true; tbar.Insert(t_item, -1); Gtk.Action action = new PreviousPictureAction(view.Item); actions.Add(action); tbar.Insert(action.CreateToolItem() as ToolItem, -1); play_pause_button = (actions [SlideShow]).CreateToolItem() as ToolButton; tbar.Insert(play_pause_button, -1); action = new NextPictureAction(view.Item); actions.Add(action); tbar.Insert(action.CreateToolItem() as ToolItem, -1); t_item = new ToolItem(); t_item.Child = new Label(Catalog.GetString("Slide transition:")); tbar.Insert(t_item, -1); display = new SlideShow(view.Item); display.AddEvents((int)(Gdk.EventMask.PointerMotionMask)); display.ModifyBg(Gtk.StateType.Normal, Style.Black); display.MotionNotifyEvent += HandleViewMotion; display.Show(); t_item = new ToolItem(); ComboBox combo = ComboBox.NewText(); foreach (var transition in display.Transitions) { combo.AppendText(transition.Name); } combo.Active = 0; combo.Changed += HandleTransitionChanged; t_item.Child = combo; tbar.Insert(t_item, -1); action = new RotateLeftAction(view.Item); actions.Add(action); tbar.Insert(action.CreateToolItem() as ToolItem, -1); action = new RotateRightAction(view.Item); actions.Add(action); tbar.Insert(action.CreateToolItem() as ToolItem, -1); info_button = (ToggleToolButton)((actions [Info]).CreateToolItem() as ToolItem); tbar.Insert(info_button, -1); tbar.Insert((actions [HideToolbar]).CreateToolItem() as ToolItem, -1); notebook.AppendPage(scroll, null); notebook.AppendPage(display, null); tbar.ShowAll(); scroll.Show(); Decorated = false; Fullscreen(); ButtonPressEvent += HandleButtonPressEvent; view.Item.Changed += HandleItemChanged; view.GrabFocus(); hide_cursor_delay = new DelayedOperation(3000, new GLib.IdleHandler(HideCursor)); hide_cursor_delay.Start(); controls = new ControlOverlay(this); controls.Add(tbar); controls.Dismiss(); notebook.CurrentPage = 0; } catch (Exception e) { Log.Exception(e); } }
public SearchResultWidget() { Build(); store = new ListStore(typeof(SearchResult), typeof(bool) // didRead ); treeviewSearchResults.Model = store; treeviewSearchResults.Selection.Mode = Gtk.SelectionMode.Multiple; treeviewSearchResults.HeadersClickable = true; treeviewSearchResults.PopupMenu += OnPopupMenu; treeviewSearchResults.ButtonPressEvent += HandleButtonPressEvent; treeviewSearchResults.RulesHint = true; var fileNameColumn = new TreeViewColumn { Resizable = false, SortColumnId = 0, Title = GettextCatalog.GetString("File") }; fileNameColumn.FixedWidth = 200; var fileNamePixbufRenderer = new CellRendererPixbuf(); fileNameColumn.PackStart(fileNamePixbufRenderer, false); fileNameColumn.SetCellDataFunc(fileNamePixbufRenderer, FileIconDataFunc); var fileNameRenderer = new CellRendererText(); fileNameColumn.PackStart(fileNameRenderer, true); fileNameColumn.SetCellDataFunc(fileNameRenderer, FileNameDataFunc); treeviewSearchResults.AppendColumn(fileNameColumn); // TreeViewColumn lineColumn = treeviewSearchResults.AppendColumn (GettextCatalog.GetString ("Line"), new CellRendererText (), ResultLineDataFunc); // lineColumn.SortColumnId = 1; // lineColumn.FixedWidth = 50; // TreeViewColumn textColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Text"), new CellRendererText(), ResultTextDataFunc); textColumn.SortColumnId = 2; textColumn.Resizable = false; textColumn.FixedWidth = 300; TreeViewColumn pathColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Path"), new CellRendererText(), ResultPathDataFunc); pathColumn.SortColumnId = 3; pathColumn.Resizable = false; pathColumn.FixedWidth = 500; store.SetSortFunc(0, CompareFileNames); // store.SetSortFunc (1, CompareLineNumbers); store.SetSortFunc(3, CompareFilePaths); treeviewSearchResults.RowActivated += TreeviewSearchResultsRowActivated; buttonStop = new ToolButton(Stock.Stop) { Sensitive = false }; buttonStop.Clicked += ButtonStopClicked; buttonStop.TooltipText = GettextCatalog.GetString("Stop"); toolbar.Insert(buttonStop, -1); var buttonClear = new ToolButton(Gtk.Stock.Clear); buttonClear.Clicked += ButtonClearClicked; buttonClear.TooltipText = GettextCatalog.GetString("Clear results"); toolbar.Insert(buttonClear, -1); var buttonOutput = new ToggleToolButton(Gui.Stock.OutputIcon); buttonOutput.Clicked += ButtonOutputClicked; buttonOutput.TooltipText = GettextCatalog.GetString("Show output"); toolbar.Insert(buttonOutput, -1); buttonPin = new ToggleToolButton(Gui.Stock.PinUp); buttonPin.Clicked += ButtonPinClicked; buttonPin.TooltipText = GettextCatalog.GetString("Pin results pad"); toolbar.Insert(buttonPin, -1); store.SetSortColumnId(3, SortType.Ascending); ShowAll(); scrolledwindowLogView.Hide(); }
public MainWindow() { Window win = new Window("Menu Sample App"); win.Resize(800, 650); VBox vbox = new VBox(false, 2); // menu bar MenuBar mb = new MenuBar(); Menu file_menu = new Menu(); MenuItem exit_item = new MenuItem("Exit"); MenuItem save_item = new MenuItem("Save"); MenuItem open_item = new MenuItem("Open"); exit_item.Activated += new EventHandler(on_exit_item_activate); file_menu.Append(open_item); file_menu.Append(save_item); file_menu.Append(exit_item); MenuItem file_item = new MenuItem("File"); file_item.Submenu = file_menu; mb.Append(file_item); vbox.PackStart(mb, false, false, 0); // toolbar Toolbar toolbar = new Toolbar(); ToolButton buttonMove = new ToggleToolButton(); buttonMove.IconWidget = new Gtk.Image("../ops/move.png"); ToolButton buttonSelect = new ToggleToolButton(); buttonSelect.IconWidget = new Gtk.Image("../ops/scale.png"); ToolButton buttonStar = new ToggleToolButton(); var pixbufStar = new Gdk.Pixbuf("../accessories/star.png"); buttonStar.IconWidget = new Gtk.Image(pixbufStar.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); ToolButton buttonAviator = new ToggleToolButton(); var pixbufAv = new Gdk.Pixbuf("../accessories/aviator.png"); buttonAviator.IconWidget = new Gtk.Image(pixbufAv.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); ToolButton buttonHeart = new ToggleToolButton(); var pixbufH = new Gdk.Pixbuf("../accessories/heart.png"); buttonHeart.IconWidget = new Gtk.Image(pixbufH.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); ToolButton buttonNerd = new ToggleToolButton(); var pixbufN = new Gdk.Pixbuf("../accessories/nerd.png"); buttonNerd.IconWidget = new Gtk.Image(pixbufN.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); ToolButton buttonHorns = new ToggleToolButton(); var pixbufHorns = new Gdk.Pixbuf("../accessories/horns.png"); buttonHorns.IconWidget = new Gtk.Image(pixbufHorns.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); ToolButton buttonHalo = new ToggleToolButton(); var pixbufHalo = new Gdk.Pixbuf("../accessories/halo.png"); buttonHalo.IconWidget = new Gtk.Image(pixbufHalo.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); ToolButton buttonTiara = new ToggleToolButton(); var pixbufT = new Gdk.Pixbuf("../accessories/tiara.png"); buttonTiara.IconWidget = new Gtk.Image(pixbufT.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); ToolButton buttonMous = new ToggleToolButton(); var pixbufM = new Gdk.Pixbuf("../accessories/moustache.png"); buttonMous.IconWidget = new Gtk.Image(pixbufM.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); ToolButton buttonLib = new ToggleToolButton(); var pixbufL = new Gdk.Pixbuf("../accessories/librarian.png"); buttonLib.IconWidget = new Gtk.Image(pixbufL.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); SeparatorToolItem sep = new SeparatorToolItem(); toolbar.Insert(buttonMove, -1); toolbar.Insert(buttonSelect, -1); toolbar.Insert(sep, -1); toolbar.Insert(buttonStar, -1); toolbar.Insert(buttonAviator, -1); toolbar.Insert(buttonHeart, -1); toolbar.Insert(buttonNerd, -1); toolbar.Insert(buttonHorns, -1); toolbar.Insert(buttonHalo, -1); toolbar.Insert(buttonTiara, -1); toolbar.Insert(buttonMous, -1); toolbar.Insert(buttonLib, -1); toolbar.ToolbarStyle = ToolbarStyle.BothHoriz; toolbar.ShowArrow = false; vbox.PackStart(toolbar, false, false, 0); ListView list = new ListView("Layer"); vbox.PackStart(list, false, false, 0); Gdk.Pixbuf backgroundImg = new Gdk.Pixbuf("../photos/kitty4.jpg"); Canvas canv = new Canvas(backgroundImg); vbox.PackStart(canv, false, false, 0); win.Add(vbox); win.ShowAll(); }
protected virtual void Build() { global::Stetic.Gui.Initialize(this); // Widget MonoGame.Tools.Pipeline.MainWindow this.UIManager = new global::Gtk.UIManager(); global::Gtk.ActionGroup w1 = new global::Gtk.ActionGroup("Default"); this.FileAction = new global::Gtk.Action("FileAction", global::Mono.Unix.Catalog.GetString("File"), null, null); this.FileAction.ShortLabel = global::Mono.Unix.Catalog.GetString("File"); w1.Add(this.FileAction, null); this.NewAction = new global::Gtk.Action("NewAction", global::Mono.Unix.Catalog.GetString("New..."), null, "gtk-new"); this.NewAction.ShortLabel = global::Mono.Unix.Catalog.GetString("New..."); w1.Add(this.NewAction, "<Control>n"); this.OpenAction = new global::Gtk.Action("OpenAction", global::Mono.Unix.Catalog.GetString("Open..."), null, "gtk-open"); this.OpenAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Open..."); w1.Add(this.OpenAction, "<Control>o"); this.OpenRecentAction = new global::Gtk.Action("OpenRecentAction", global::Mono.Unix.Catalog.GetString("Open Recent"), null, null); this.OpenRecentAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Open Recent"); w1.Add(this.OpenRecentAction, null); this.CloseAction = new global::Gtk.Action("CloseAction", global::Mono.Unix.Catalog.GetString("Close"), null, "gtk-close"); this.CloseAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Close"); w1.Add(this.CloseAction, null); this.ImportAction = new global::Gtk.Action("ImportAction", global::Mono.Unix.Catalog.GetString("Import..."), null, null); this.ImportAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Import..."); w1.Add(this.ImportAction, null); this.SaveAction = new global::Gtk.Action("SaveAction", global::Mono.Unix.Catalog.GetString("Save"), null, "gtk-save"); this.SaveAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Save"); w1.Add(this.SaveAction, "<Control>s"); this.SaveAsAction = new global::Gtk.Action("SaveAsAction", global::Mono.Unix.Catalog.GetString("Save As..."), null, "gtk-save-as"); this.SaveAsAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Save As..."); w1.Add(this.SaveAsAction, null); this.ExitAction = new global::Gtk.Action("ExitAction", global::Mono.Unix.Catalog.GetString("Exit"), null, "gtk-quit"); this.ExitAction.HideIfEmpty = false; this.ExitAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Exit"); w1.Add(this.ExitAction, null); this.EditAction = new global::Gtk.Action("EditAction", global::Mono.Unix.Catalog.GetString("Edit"), null, null); this.EditAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Edit"); w1.Add(this.EditAction, null); this.UndoAction = new global::Gtk.Action("UndoAction", global::Mono.Unix.Catalog.GetString("Undo"), null, "gtk-undo"); this.UndoAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Undo"); w1.Add(this.UndoAction, "<Control>z"); this.RedoAction = new global::Gtk.Action("RedoAction", global::Mono.Unix.Catalog.GetString("Redo"), null, "gtk-redo"); this.RedoAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Redo"); w1.Add(this.RedoAction, "<Control>y"); RenameAction = new Action("RenameAction", global::Mono.Unix.Catalog.GetString("Rename"), null, null); RenameAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Rename"); w1.Add(RenameAction, null); this.DeleteAction = new global::Gtk.Action("DeleteAction", global::Mono.Unix.Catalog.GetString("Delete"), null, "gtk-delete"); this.DeleteAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Delete"); w1.Add(this.DeleteAction, null); this.BuildAction = new global::Gtk.Action("BuildAction", global::Mono.Unix.Catalog.GetString("Build"), null, null); this.BuildAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Build"); w1.Add(this.BuildAction, null); this.BuildAction1 = new global::Gtk.Action("BuildAction1", global::Mono.Unix.Catalog.GetString("Build"), null, "gtk-execute"); this.BuildAction1.ShortLabel = global::Mono.Unix.Catalog.GetString("Build"); w1.Add(this.BuildAction1, "<Mod2>F6"); this.RebuildAction = new global::Gtk.Action("RebuildAction", global::Mono.Unix.Catalog.GetString("Rebuild"), null, "gtk-execute"); this.RebuildAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Rebuild"); w1.Add(this.RebuildAction, null); this.CleanAction = new global::Gtk.Action("CleanAction", global::Mono.Unix.Catalog.GetString("Clean"), null, null); this.CleanAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Clean"); w1.Add(this.CleanAction, null); this.DebugModeAction = new global::Gtk.ToggleAction("DebugModeAction", global::Mono.Unix.Catalog.GetString("Debug Mode"), null, null); this.DebugModeAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Debug Mode"); w1.Add(this.DebugModeAction, null); this.FilterOutputAction = new global::Gtk.ToggleAction("FilterOutputAction", global::Mono.Unix.Catalog.GetString("Filter Output"), null, null); this.FilterOutputAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Filter Output"); this.FilterOutputAction.Active = true; w1.Add(this.FilterOutputAction, null); this.HelpAction = new global::Gtk.Action("HelpAction", global::Mono.Unix.Catalog.GetString("Help"), null, null); this.HelpAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Help"); w1.Add(this.HelpAction, null); this.ViewHelpAction = new global::Gtk.Action("ViewHelpAction", global::Mono.Unix.Catalog.GetString("View Help"), null, "gtk-help"); this.ViewHelpAction.ShortLabel = global::Mono.Unix.Catalog.GetString("View Help"); w1.Add(this.ViewHelpAction, "<Mod2>F1"); this.AboutAction = new global::Gtk.Action("AboutAction", global::Mono.Unix.Catalog.GetString("About"), null, "gtk-about"); this.AboutAction.ShortLabel = global::Mono.Unix.Catalog.GetString("About"); w1.Add(this.AboutAction, null); this.CancelBuildAction = new global::Gtk.Action("CancelBuildAction", global::Mono.Unix.Catalog.GetString("Cancel Build"), null, "gtk-stop"); this.CancelBuildAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Cancel Build"); w1.Add(this.CancelBuildAction, null); this.AddAction = new global::Gtk.Action("AddAction", global::Mono.Unix.Catalog.GetString("Add"), null, null); this.AddAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Add"); w1.Add(this.AddAction, null); this.NewItemAction = new global::Gtk.Action("NewItemAction", global::Mono.Unix.Catalog.GetString("New Item..."), null, "gtk-file"); this.NewItemAction.ShortLabel = global::Mono.Unix.Catalog.GetString("New Item..."); w1.Add(this.NewItemAction, null); this.NewFolderAction = new global::Gtk.Action("NewFolderAction", global::Mono.Unix.Catalog.GetString("New Folder..."), null, "gtk-directory"); this.NewFolderAction.ShortLabel = global::Mono.Unix.Catalog.GetString("New Folder..."); w1.Add(this.NewFolderAction, null); this.ExistingItemAction = new global::Gtk.Action("ExistingItemAction", global::Mono.Unix.Catalog.GetString("Existing Item..."), null, null); this.ExistingItemAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Add Existing Item..."); w1.Add(this.ExistingItemAction, null); this.ExistingFolderAction = new global::Gtk.Action("ExistingFolderAction", global::Mono.Unix.Catalog.GetString("Existing Folder..."), null, null); this.ExistingFolderAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Add Existing Folder..."); w1.Add(this.ExistingFolderAction, null); this.UIManager.InsertActionGroup(w1, 0); this.AddAccelGroup(this.UIManager.AccelGroup); this.Name = "MonoGame.Tools.Pipeline.MainWindow"; this.Icon = global::Gdk.Pixbuf.LoadFromResource("MonoGame.Tools.Pipeline.App.ico"); this.WindowPosition = ((global::Gtk.WindowPosition)(4)); // Container child MonoGame.Tools.Pipeline.MainWindow.Gtk.Container+ContainerChild this.vbox2 = new global::Gtk.VBox(); this.vbox2.Name = "vbox2"; // Container child vbox2.Gtk.Box+BoxChild this.UIManager.AddUiFromString("<ui><menubar name='menubar1'><menu name='FileAction' action='FileAction'><menuitem name='NewAction' action='NewAction'/><menuitem name='OpenAction' action='OpenAction'/><menuitem name='OpenRecentAction' action='OpenRecentAction'/><menuitem name='CloseAction' action='CloseAction'/><separator/><menuitem name='ImportAction' action='ImportAction'/><separator/><menuitem name='SaveAction' action='SaveAction'/><menuitem name='SaveAsAction' action='SaveAsAction'/><separator/><menuitem name='ExitAction' action='ExitAction'/></menu><menu name='EditAction' action='EditAction'><menuitem name='UndoAction' action='UndoAction'/><menuitem name='RedoAction' action='RedoAction'/><separator/><menu name='AddAction' action='AddAction'><menuitem name='NewItemAction' action='NewItemAction'/><menuitem name='NewFolderAction' action='NewFolderAction'/><separator/><menuitem name='ExistingItemAction' action='ExistingItemAction'/><menuitem name='ExistingFolderAction' action='ExistingFolderAction'/></menu><separator/><menuitem name='RenameAction' action='RenameAction'/><menuitem name='DeleteAction' action='DeleteAction'/></menu><menu name='BuildAction' action='BuildAction'><menuitem name='BuildAction1' action='BuildAction1'/><menuitem name='RebuildAction' action='RebuildAction'/><menuitem name='CleanAction' action='CleanAction'/><menuitem name='CancelBuildAction' action='CancelBuildAction'/><separator name='sep1'/><menuitem name='DebugModeAction' action='DebugModeAction'/><menuitem name='FilterOutputAction' action='FilterOutputAction'/></menu><menu name='HelpAction' action='HelpAction'><menuitem name='ViewHelpAction' action='ViewHelpAction'/><separator/><menuitem name='AboutAction' action='AboutAction'/></menu></menubar></ui>"); this.menubar1 = ((global::Gtk.MenuBar)(this.UIManager.GetWidget("/menubar1"))); this.menubar1.Name = "menubar1"; this.vbox2.Add(this.menubar1); toolBar1 = new Toolbar(); toolNew = new ToolButton(new Image(null, "Toolbar.New.png"), "New"); toolNew.TooltipText = toolNew.Label; toolBar1.Add(toolNew); toolOpen = new ToolButton(new Image(null, "Toolbar.Open.png"), "Open"); toolOpen.TooltipText = toolOpen.Label; toolBar1.Add(toolOpen); toolSave = new ToolButton(new Image(null, "Toolbar.Save.png"), "Save"); toolSave.TooltipText = toolSave.Label; toolBar1.Add(toolSave); toolBar1.Add(new SeparatorToolItem()); toolNewItem = new ToolButton(new Image(null, "Toolbar.NewItem.png"), "Add New Item"); toolNewItem.TooltipText = toolNewItem.Label; toolBar1.Add(toolNewItem); toolAddItem = new ToolButton(new Image(null, "Toolbar.ExistingItem.png"), "Add Existing Item"); toolAddItem.TooltipText = toolAddItem.Label; toolBar1.Add(toolAddItem); toolNewFolder = new ToolButton(new Image(null, "Toolbar.NewFolder.png"), "Add New Folder"); toolNewFolder.TooltipText = toolNewFolder.Label; toolBar1.Add(toolNewFolder); toolAddFolder = new ToolButton(new Image(null, "Toolbar.ExistingFolder.png"), "Add Existing Folder"); toolAddFolder.TooltipText = toolAddFolder.Label; toolBar1.Add(toolAddFolder); toolBar1.Add(new SeparatorToolItem()); toolBuild = new ToolButton(new Image(null, "Toolbar.Build.png"), "Build"); toolBuild.TooltipText = toolBuild.Label; toolBar1.Add(toolBuild); toolRebuild = new ToolButton(new Image(null, "Toolbar.Rebuild.png"), "Rebuild"); toolRebuild.TooltipText = toolRebuild.Label; toolBar1.Add(toolRebuild); toolClean = new ToolButton(new Image(null, "Toolbar.Clean.png"), "Clean"); toolClean.TooltipText = toolClean.Label; toolBar1.Add(toolClean); toolBar1.Add(new SeparatorToolItem()); toolFilterOutput = new ToggleToolButton(); toolFilterOutput.Label = toolFilterOutput.TooltipText = "Filter Output"; toolFilterOutput.IconWidget = new Image(null, "Toolbar.FilterOutput.png"); toolBar1.Add(toolFilterOutput); if (!Global.UseHeaderBar) { this.vbox2.PackStart(toolBar1, false, true, 0); } global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.menubar1])); w2.Position = 0; w2.Expand = false; w2.Fill = false; // Container child vbox2.Gtk.Box+BoxChild this.hpaned1 = new global::Gtk.HPaned(); this.hpaned1.CanFocus = true; this.hpaned1.Name = "hpaned1"; this.hpaned1.Position = 179; // Container child hpaned1.Gtk.Paned+PanedChild this.vpaned2 = new global::Gtk.VPaned(); this.vpaned2.CanFocus = true; this.vpaned2.Name = "vpaned2"; this.vpaned2.Position = 247; // Container child vpaned2.Gtk.Paned+PanedChild this.projectview1 = new global::MonoGame.Tools.Pipeline.ProjectView(); this.projectview1.Events = ((global::Gdk.EventMask)(256)); this.projectview1.Name = "projectview1"; this.vpaned2.Add(this.projectview1); global::Gtk.Paned.PanedChild w3 = ((global::Gtk.Paned.PanedChild)(this.vpaned2 [this.projectview1])); w3.Resize = false; // Container child vpaned2.Gtk.Paned+PanedChild this.propertiesview1 = new global::MonoGame.Tools.Pipeline.PropertiesView(); this.propertiesview1.Events = ((global::Gdk.EventMask)(256)); this.propertiesview1.Name = "propertiesview1"; this.vpaned2.Add(this.propertiesview1); global::Gtk.Paned.PanedChild w4 = ((global::Gtk.Paned.PanedChild)(this.vpaned2 [this.propertiesview1])); w4.Resize = false; this.hpaned1.Add(this.vpaned2); global::Gtk.Paned.PanedChild w5 = ((global::Gtk.Paned.PanedChild)(this.hpaned1 [this.vpaned2])); w5.Resize = false; // Container child hpaned1.Gtk.Paned+PanedChild buildOutput1 = new BuildOutput(); this.hpaned1.Add(this.buildOutput1); this.vbox2.Add(this.hpaned1); global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hpaned1])); w8.Position = 2; this.Add(this.vbox2); treeview1 = new TreeView(); #if GTK3 if (Global.UseHeaderBar) { Builder builder = new Builder(null, "MonoGame.Tools.Pipeline.Gtk.MainWindow.HeaderBar.glade", null); hbar = new HeaderBar(builder.GetObject("headerbar").Handle); builder.Autoconnect(this); hbar.AttachToWindow(this); hbar.ShowCloseButton = true; hbar.Show(); foreach (var o in menubar1.Children) { menubar1.Remove(o); menu2.Insert(o, 4); } new_button.Clicked += OnNewActionActivated; save_button.Clicked += OnSaveActionActivated; build_button.Clicked += OnBuildAction1Activated; rebuild_button.Clicked += OnRebuildActionActivated; cancel_button.Clicked += OnCancelBuildActionActivated; filteroutput_button.ButtonReleaseEvent += ToggleFilterOutput; filteroutput_button.Sensitive = true; vbox2.Remove(menubar1); open_menubutton = new MenuButton(open_button.Handle); var popover = new Popover(open_menubutton); var vbox = new VBox(); vbox.WidthRequest = 350; vbox.HeightRequest = 300; Gtk3Wrapper.gtk_tree_view_set_activate_on_single_click(treeview1.Handle, true); treeview1.HeadersVisible = false; treeview1.EnableGridLines = TreeViewGridLines.Horizontal; treeview1.HoverSelection = true; treeview1.RowActivated += delegate(object o, RowActivatedArgs args) { popover.Hide(); TreeIter iter; if (!recentListStore.GetIter(out iter, args.Path)) { return; } OpenProject(recentListStore.GetValue(iter, 1).ToString()); }; ScrolledWindow scroll1 = new ScrolledWindow(); scroll1.WidthRequest = 350; scroll1.HeightRequest = 300; scroll1.Add(treeview1); vbox.PackStart(scroll1, true, true, 0); var openButton = new Button("Open Other..."); openButton.Clicked += delegate(object sender, System.EventArgs e) { popover.Hide(); OnOpenActionActivated(sender, e); }; vbox.PackStart(openButton, false, true, 0); vbox.ShowAll(); popover.Add(vbox); open_menubutton.Popup = popover; } #endif this.Title = basetitle; if ((this.Child != null)) { this.Child.ShowAll(); } this.DefaultWidth = 751; this.DefaultHeight = 557; #if GTK3 Gdk.Geometry geom = new Gdk.Geometry(); geom.MinWidth = 400; geom.MinHeight = 300; this.SetGeometryHints(this, geom, Gdk.WindowHints.MinSize); #endif this.Show(); this.DeleteEvent += new global::Gtk.DeleteEventHandler(this.OnDeleteEvent); this.NewAction.Activated += new global::System.EventHandler(this.OnNewActionActivated); this.toolNew.Clicked += OnNewActionActivated; this.OpenAction.Activated += new global::System.EventHandler(this.OnOpenActionActivated); this.toolOpen.Clicked += OnOpenActionActivated; this.CloseAction.Activated += new global::System.EventHandler(this.OnCloseActionActivated); this.ImportAction.Activated += new global::System.EventHandler(this.OnImportActionActivated); this.SaveAction.Activated += new global::System.EventHandler(this.OnSaveActionActivated); this.toolSave.Clicked += OnSaveActionActivated; this.SaveAsAction.Activated += new global::System.EventHandler(this.OnSaveAsActionActivated); this.ExitAction.Activated += new global::System.EventHandler(this.OnExitActionActivated); this.UndoAction.Activated += new global::System.EventHandler(this.OnUndoActionActivated); this.RedoAction.Activated += new global::System.EventHandler(this.OnRedoActionActivated); RenameAction.Activated += this.OnRenameActionActivated; this.DeleteAction.Activated += new global::System.EventHandler(this.OnDeleteActionActivated); this.BuildAction1.Activated += new global::System.EventHandler(this.OnBuildAction1Activated); toolBuild.Clicked += OnBuildAction1Activated; this.RebuildAction.Activated += new global::System.EventHandler(this.OnRebuildActionActivated); toolRebuild.Clicked += OnRebuildActionActivated; this.CleanAction.Activated += new global::System.EventHandler(this.OnCleanActionActivated); toolClean.Clicked += OnCleanActionActivated; this.ViewHelpAction.Activated += new global::System.EventHandler(this.OnViewHelpActionActivated); this.AboutAction.Activated += new global::System.EventHandler(this.OnAboutActionActivated); this.NewItemAction.Activated += new global::System.EventHandler(this.OnNewItemActionActivated); this.toolNewItem.Clicked += OnNewItemActionActivated; this.NewFolderAction.Activated += new global::System.EventHandler(this.OnNewFolderActionActivated); this.toolNewFolder.Clicked += OnNewFolderActionActivated; this.ExistingItemAction.Activated += new global::System.EventHandler(this.OnAddItemActionActivated); this.toolAddItem.Clicked += OnAddItemActionActivated; this.ExistingFolderAction.Activated += new global::System.EventHandler(this.OnAddFolderActionActivated); this.toolAddFolder.Clicked += OnAddFolderActionActivated; this.DebugModeAction.Activated += new global::System.EventHandler(this.OnDebugModeActionActivated); this.FilterOutputAction.Activated += OnFilterOutputActionActivated; this.toolFilterOutput.ButtonReleaseEvent += ToggleFilterOutput; this.CancelBuildAction.Activated += new global::System.EventHandler(this.OnCancelBuildActionActivated); this.SizeAllocated += MainWindow_SizeAllocated; }
public MainWindow() : base("Main Window") { SetDefaultSize(800, 650); DeleteEvent += new DeleteEventHandler(delete_cb); bool isUniform = false; int margin = 5; VBox topPanel = new VBox(isUniform, margin); HBox layCan = new HBox(isUniform, margin); VBox layout = new VBox(isUniform, margin); VBox layBtn = new VBox(isUniform, margin); ButtonPressEvent += new ButtonPressEventHandler(ButtonPressHandler); MotionNotifyEvent += new MotionNotifyEventHandler(MotionNotifyHandler); ButtonReleaseEvent += new ButtonReleaseEventHandler(ButtonReleaseHandler); // menu bar MenuBar mb = new MenuBar(); Menu file_menu = new Menu(); MenuItem exit_item = new MenuItem("Exit"); MenuItem save_item = new MenuItem("Save"); MenuItem open_item = new MenuItem("Open"); exit_item.Activated += new EventHandler(on_exit_item_activate); open_item.Activated += new EventHandler(OnOpenCallback); save_item.Activated += new EventHandler(onSaveCallback); file_menu.Append(open_item); file_menu.Append(save_item); file_menu.Append(exit_item); MenuItem file_item = new MenuItem("File"); file_item.Submenu = file_menu; mb.Append(file_item); layout.Add(Align(mb, 0, 0.5f, 1, 1)); // toolbar Toolbar toolbar = new Toolbar(); ToolButton buttonMove = new ToggleToolButton(); buttonMove.IconWidget = new Gtk.Image("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/ops/move.png"); buttonMove.Clicked += new EventHandler(OnMoveClick); ToolButton buttonSelect = new ToggleToolButton(); buttonSelect.IconWidget = new Gtk.Image("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/ops/scale.png"); buttonSelect.Clicked += new EventHandler(OnSelectClick); ToolButton buttonStar = new ToggleToolButton(); var pixbufStar = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/star.png"); buttonStar.IconWidget = new Gtk.Image(pixbufStar.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); buttonStar.Clicked += new EventHandler(OnStarClick); ToolButton buttonAviator = new ToggleToolButton(); var pixbufAv = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/aviator.png"); buttonAviator.IconWidget = new Gtk.Image(pixbufAv.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); buttonAviator.Clicked += new EventHandler(OnAviatorClick); ToolButton buttonHeart = new ToggleToolButton(); var pixbufH = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/heart.png"); buttonHeart.IconWidget = new Gtk.Image(pixbufH.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); buttonHeart.Clicked += new EventHandler(OnHeartClick); ToolButton buttonNerd = new ToggleToolButton(); var pixbufN = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/nerd.png"); buttonNerd.IconWidget = new Gtk.Image(pixbufN.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); buttonNerd.Clicked += new EventHandler(OnNerdClick); ToolButton buttonHorns = new ToggleToolButton(); var pixbufHorns = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/horns.png"); buttonHorns.IconWidget = new Gtk.Image(pixbufHorns.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); buttonHorns.Clicked += new EventHandler(OnHornsClick); ToolButton buttonHalo = new ToggleToolButton(); var pixbufHalo = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/halo.png"); buttonHalo.IconWidget = new Gtk.Image(pixbufHalo.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); buttonHalo.Clicked += new EventHandler(OnHaloClick); ToolButton buttonTiara = new ToggleToolButton(); var pixbufT = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/tiara.png"); buttonTiara.IconWidget = new Gtk.Image(pixbufT.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); buttonTiara.Clicked += new EventHandler(OnTiaraClick); ToolButton buttonMous = new ToggleToolButton(); var pixbufM = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/moustache.png"); buttonMous.IconWidget = new Gtk.Image(pixbufM.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); buttonMous.Clicked += new EventHandler(OnMousClick); ToolButton buttonLib = new ToggleToolButton(); var pixbufL = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/librarian.png"); buttonLib.IconWidget = new Gtk.Image(pixbufL.ScaleSimple(30, 30, Gdk.InterpType.Bilinear)); buttonLib.Clicked += new EventHandler(OnLibClick); SeparatorToolItem sep = new SeparatorToolItem(); toolbar.Insert(buttonMove, -1); toolbar.Insert(buttonSelect, -1); toolbar.Insert(sep, -1); toolbar.Insert(buttonStar, -1); toolbar.Insert(buttonAviator, -1); toolbar.Insert(buttonHeart, -1); toolbar.Insert(buttonNerd, -1); toolbar.Insert(buttonHorns, -1); toolbar.Insert(buttonHalo, -1); toolbar.Insert(buttonTiara, -1); toolbar.Insert(buttonMous, -1); toolbar.Insert(buttonLib, -1); toolbar.ToolbarStyle = ToolbarStyle.BothHoriz; toolbar.ShowArrow = false; layout.Add(Align(toolbar, 0, 0.25f, 1, 0)); layBtn.Add(Align(_list, 1, 0, 0, 1)); Button btn = new Button("Delete layer"); btn.Clicked += new EventHandler(btn_click); layBtn.Add(Align(btn, 0, 0, 1, 1)); layCan.Add(Align(layBtn, 1, 0, 0, 1)); layCan.Add(Align(_canv, 1, 0, 1, 1)); topPanel.Add(Align(layout, 1, 0, 1, 1)); topPanel.Add(Align(layCan, 1, 0, 0, 1)); Add(topPanel); ShowAll(); }