private void createButtons() { FakeButtonCloseSerialPort = new Gtk.Button(); Gtk.Button button_close_serial_port = new Gtk.Button("Close serial port (debug)"); button_close_serial_port.Clicked += new EventHandler(on_button_close_serial_port_clicked); Gtk.Button button_OSX_readme = new Gtk.Button("MacOSX Readme"); button_OSX_readme.Clicked += new EventHandler(on_button_OSX_readme_clicked); //---- button close start ---> Gtk.Button button_close = new Gtk.Button("Close Window"); button_close.Clicked += new EventHandler(on_button_close_clicked); Gtk.AccelGroup ag = new Gtk.AccelGroup(); //button can be called clicking Escape key chronopic_register_win.AddAccelGroup(ag); button_close.AddAccelerator ("activate", ag, new Gtk.AccelKey (Gdk.Key.Escape, Gdk.ModifierType.None, Gtk.AccelFlags.Visible)); //<---- button close end //add buttons to containers Gtk.HButtonBox hbox = new Gtk.HButtonBox(); //hbox.Add(button_close_serial_port); if (UtilAll.GetOSEnum() == UtilAll.OperatingSystems.MACOSX) { hbox.Add(button_OSX_readme); } hbox.Add(button_close); vbox_main.Add(hbox); }
private MenuItem MakeFileMenu() { Menu menu = new Menu(); AccelGroup group = new AccelGroup(); window.AddAccelGroup(group); ImageMenuItem quit = new ImageMenuItem(Stock.Quit, group); quit.AddAccelerator("activate", group, new AccelKey(Gdk.Key.q, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); quit.Activated += new EventHandler(OnFileQuit); menu.Append(quit); MenuItem label = new MenuItem("_File"); label.Submenu = menu; return(label); }
private void createButtons() { Frame frame = new Frame(); frame.ShadowType = ShadowType.In; frame.LabelXalign = 0f; frame.LabelYalign = 0.5f; frame.Label = Catalog.GetString("There is a known problem on macOS:"); Gtk.Label label_macOS = new Gtk.Label( Catalog.GetString("If Chronopic is disconnected after jumps or runs execution,\nthat port will be blocked until restart of machine.")); Gtk.VBox vbox_m = new Gtk.VBox(); vbox_m.PackStart(label_macOS, false, false, 8); Gtk.HBox hbox_m = new Gtk.HBox(); hbox_m.PackStart(vbox_m, false, false, 8); if (UtilAll.GetOSEnum() == UtilAll.OperatingSystems.MACOSX) { frame.Add(hbox_m); vbox_main.Add(frame); } FakeButtonCloseSerialPort = new Gtk.Button(); Gtk.Button button_close_serial_port = new Gtk.Button("Close serial port (debug)"); button_close_serial_port.Clicked += new EventHandler(on_button_close_serial_port_clicked); //---- button close start ---> Gtk.Button button_close = new Gtk.Button("Close Window"); button_close.CanFocus = true; button_close.IsFocus = true; button_close.Clicked += new EventHandler(on_button_close_clicked); Gtk.AccelGroup ag = new Gtk.AccelGroup(); //button can be called clicking Escape key chronopic_register_win.AddAccelGroup(ag); button_close.AddAccelerator ("activate", ag, new Gtk.AccelKey (Gdk.Key.Escape, Gdk.ModifierType.None, Gtk.AccelFlags.Visible)); //<---- button close end //add buttons to containers Gtk.HButtonBox hbox = new Gtk.HButtonBox(); //hbox.Add(button_close_serial_port); hbox.Add(button_close); vbox_main.Add(hbox); }
private void createButtons() { label_macOSX = new Gtk.Label(); label_macOSX.Text = Catalog.GetString("There is a known problem with MacOSX:") + "\n" + Catalog.GetString("If Chronopic is disconnected after jumps or runs execution,\nthat port will be blocked until restart of machine.") + "\n\n" + Catalog.GetString("We are working on a solution."); if (UtilAll.GetOSEnum() == UtilAll.OperatingSystems.MACOSX) { vbox_main.Add(label_macOSX); } FakeButtonCloseSerialPort = new Gtk.Button(); Gtk.Button button_close_serial_port = new Gtk.Button("Close serial port (debug)"); button_close_serial_port.Clicked += new EventHandler(on_button_close_serial_port_clicked); //---- button close start ---> Gtk.Button button_close = new Gtk.Button("Close Window"); button_close.Clicked += new EventHandler(on_button_close_clicked); Gtk.AccelGroup ag = new Gtk.AccelGroup(); //button can be called clicking Escape key chronopic_register_win.AddAccelGroup(ag); button_close.AddAccelerator ("activate", ag, new Gtk.AccelKey (Gdk.Key.Escape, Gdk.ModifierType.None, Gtk.AccelFlags.Visible)); //<---- button close end //add buttons to containers Gtk.HButtonBox hbox = new Gtk.HButtonBox(); //hbox.Add(button_close_serial_port); hbox.Add(button_close); vbox_main.Add(hbox); }
public static Gtk.Window Create() { window = new Window ("Menus"); AccelGroup accel_group = new AccelGroup (); window.AddAccelGroup (accel_group); VBox box1 = new VBox (false, 0); window.Add (box1); MenuBar menubar = new MenuBar (); box1.PackStart (menubar, false, false, 0); Menu menu = Create_Menu (2, true); MenuItem menuitem = new MenuItem ("foo"); menuitem.Submenu = menu; menubar.Append (menuitem); menuitem = new MenuItem ("bar"); menuitem.Submenu = Create_Menu (3, true); menubar.Append (menuitem); Image image = new Image (Stock.Help, IconSize.Menu); menuitem = new ImageMenuItem ("Help"); ((ImageMenuItem) menuitem).Image = image; menuitem.Submenu = Create_Menu (4, true); menuitem.RightJustified = true; menubar.Append (menuitem); menubar = new MenuBar (); box1.PackStart (menubar, false, true, 0); menu = Create_Menu (2, true); menuitem = new MenuItem ("Second menu bar"); menuitem.Submenu = menu; menubar.Append (menuitem); VBox box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, true, true, 0); menu = Create_Menu (1, false); menu.AccelGroup = accel_group; menu.Append (new SeparatorMenuItem ()); menuitem = new CheckMenuItem ("Accelerate Me"); menu.Append (menuitem); menuitem.AddAccelerator ("activate", accel_group, 0xFFBE, 0, AccelFlags.Visible); menuitem = new CheckMenuItem ("Accelerator locked"); menu.Append (menuitem); menuitem.AddAccelerator ("activate", accel_group, 0xFFBF, 0, AccelFlags.Visible | AccelFlags.Locked); menuitem = new CheckMenuItem ("Accelerator Frozen"); menu.Append (menuitem); menuitem.AddAccelerator ("activate", accel_group, 0xFFBF, 0, AccelFlags.Visible); menuitem.AddAccelerator ("activate", accel_group, 0xFFC0, 0, AccelFlags.Visible); OptionMenu option_menu = new OptionMenu (); option_menu.Menu = menu; option_menu.SetHistory (3); box2.PackStart (option_menu, true, true, 0); box1.PackStart (new HSeparator (), false, false, 0); box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, false, true, 0); Button close_button = new Button (Stock.Close); close_button.Clicked += new EventHandler (Close_Button); box2.PackStart (close_button, true, true, 0); close_button.CanDefault = true; close_button.GrabDefault (); window.ShowAll (); return window; }
public Browser (string basedir, IEnumerable<string> sources, string engine) { #if MACOS try { InitMacAppHandlers(); } catch (Exception ex) { Console.Error.WriteLine ("Installing Mac AppleEvent handlers failed. Skipping.\n" + ex); } #endif this.engine = engine; ui = new Glade.XML (null, "browser.glade", "window1", null); ui.Autoconnect (this); MainWindow = (Gtk.Window) ui["window1"]; MainWindow.DeleteEvent += new DeleteEventHandler (delete_event_cb); MainWindow.KeyPressEvent += new KeyPressEventHandler (keypress_event_cb); MainWindow.KeyReleaseEvent += new KeyReleaseEventHandler (keyrelease_event_cb); Stream icon = GetResourceImage ("monodoc.png"); if (icon != null) { monodoc_pixbuf = new Gdk.Pixbuf (icon); MainWindow.Icon = monodoc_pixbuf; } //ellipsizing label for the title title_label = new ELabel (""); title_label.Xalign = 0; Pango.FontDescription fd = new Pango.FontDescription (); fd.Weight = Pango.Weight.Bold; title_label.ModifyFont (fd); title_label.Layout.FontDescription = fd; title_label_box.Add (title_label); title_label.Show (); //colour the bar according to the current style bar_style = bar_eb.Style.Copy (); bar_eb.Style = bar_style; MainWindow.StyleSet += new StyleSetHandler (BarStyleSet); BarStyleSet (null, null); help_tree = Driver.LoadTree (basedir, sources); tree_browser = new TreeBrowser (help_tree, reference_tree, this); // Bookmark Manager init; bookmark_manager = new BookmarkManager(this); // // Tab Notebook and first tab // tabs_nb = new Notebook(); //the Notebook that holds tabs tabs_nb.Scrollable = true; tabs_nb.SwitchPage += new SwitchPageHandler(ChangeTab); help_container.Add(tabs_nb); AddTab(); if ((capabilities & Capabilities.Fonts) != 0) { // Add Menu entries for changing the font Menu aux = (Menu) view1.Submenu; MenuItem sep = new SeparatorMenuItem (); sep.Show (); aux.Append (sep); AccelGroup accel = new AccelGroup (); MainWindow.AddAccelGroup (accel); textLarger = new MenuItem ("_Larger text"); textLarger.Activated += new EventHandler (TextLarger); textLarger.Show (); aux.Append (textLarger); AccelKey ak = new AccelKey (Gdk.Key.plus, Gdk.ModifierType.ControlMask, AccelFlags.Visible); textLarger.AddAccelerator ("activate", accel, ak); textSmaller = new MenuItem ("_Smaller text"); textSmaller.Activated += new EventHandler (TextSmaller); textSmaller.Show (); aux.Append (textSmaller); ak = new AccelKey (Gdk.Key.minus, Gdk.ModifierType.ControlMask, AccelFlags.Visible); textSmaller.AddAccelerator ("activate", accel, ak); textNormal = new MenuItem ("_Original size"); textNormal.Activated += new EventHandler (TextNormal); textNormal.Show (); aux.Append (textNormal); ak = new AccelKey (Gdk.Key.Key_0, Gdk.ModifierType.ControlMask, AccelFlags.Visible); textNormal.AddAccelerator ("activate", accel, ak); } // restore the editing setting editing1.Active = SettingsHandler.Settings.EnableEditing; comments1.Active = SettingsHandler.Settings.ShowComments; cut1.Sensitive = false; paste1.Sensitive = false; // // Other bits // search_index = help_tree.GetSearchIndex(); if (search_index == null) { ppanel = new ProgressPanel ("<b>No Search index found</b>", "Generate", RootTree.MakeSearchIndex, CreateSearchPanel); search_vbox.Add (ppanel); search_vbox.Show (); } else { CreateSearchPanel (); } bookList = new ArrayList (); index_browser = IndexBrowser.MakeIndexBrowser (this); MainWindow.ShowAll(); #if MACOS try { InstallMacMainMenu (); ((MenuBar)ui["menubar1"]).Hide (); } catch (Exception ex) { Console.Error.WriteLine ("Installing Mac IGE Main Menu failed. Skipping.\n" + ex); } #endif }
public BlessMain(string[] args) { Application.Init(); // Catalog.Init(ConfigureDefines.GETTEXT_PACKAGE, ConfigureDefines.LOCALE_DIR); // load main window from glade XML Glade.XML gxml = new Glade.XML(FileResourcePath.GetDataPath("bless.glade"), "MainWindow", "bless"); gxml.Autoconnect(this); // set the application icon MainWindow.Icon = new Gdk.Pixbuf(FileResourcePath.GetDataPath("bless-48x48.png")); string blessConfDir = FileResourcePath.GetUserPath(); // make sure local configuration directory exists try { if (!Directory.Exists(blessConfDir)) { Directory.CreateDirectory(blessConfDir); } } catch (Exception ex) { ErrorAlert ea = new ErrorAlert(Catalog.GetString("Cannot create user configuration directory"), ex.Message + Catalog.GetString("\n\nSome features of Bless may not work properly."), MainWindow); ea.Run(); ea.Destroy(); } Preferences.Proxy.Enable = false; // load default preferences Preferences.Default.Load(FileResourcePath.GetDataPath("default-preferences.xml")); Preferences.Default["Default.Layout.File"] = FileResourcePath.GetDataPath("bless-default.layout"); // load user preferences LoadPreferences(Path.Combine(blessConfDir, "preferences.xml")); Preferences.Instance.AutoSavePath = Path.Combine(blessConfDir, "preferences.xml"); // add the (empty) Menubar and toolbar uiManager = new UIManager(); MainWindow.AddAccelGroup(uiManager.AccelGroup); uiManager.AddUiFromString(uiXml); actionEntries = new ActionEntry[] { new ActionEntry("File", null, Catalog.GetString("_File"), null, null, null), new ActionEntry("Edit", null, Catalog.GetString("_Edit"), null, null, null), new ActionEntry("View", null, Catalog.GetString("_View"), null, null, null), new ActionEntry("Search", null, Catalog.GetString("_Search"), null, null, null), new ActionEntry("Tools", null, Catalog.GetString("_Tools"), null, null, null), new ActionEntry("Help", null, Catalog.GetString("_Help"), null, null, null) }; ActionGroup group = new ActionGroup("MainMenuActions"); group.Add(actionEntries); group.Add(new ToggleActionEntry[] { new ToggleActionEntry("ToolbarAction", null, Catalog.GetString("Toolbar"), null, null, new EventHandler(OnViewToolbarToggled), false) }); uiManager.InsertActionGroup(group, 0); Widget mb = uiManager.GetWidget("/menubar"); MainVBox.PackStart(mb, false, false, 0); MainVBox.ReorderChild(mb, 0); Widget tb = uiManager.GetWidget("/toolbar"); tb.Visible = false; MainVBox.PackStart(tb, false, false, 0); MainVBox.ReorderChild(tb, 1); // create the DataBook dataBook = new DataBook(); dataBook.PageAdded += new DataView.DataViewEventHandler(OnDataViewAdded); dataBook.Removed += new RemovedHandler(OnDataViewRemoved); dataBook.SwitchPage += new SwitchPageHandler(OnSwitchPage); DataViewBox.PackStart(dataBook); // create the widget groups that hold utility widgets WidgetGroup widgetGroup0 = new WidgetGroup(); WidgetGroup widgetGroup1 = new WidgetGroup(); WidgetGroup sideWidgetGroup0 = new WidgetGroup(); WidgetGroup sideWidgetGroup1 = new WidgetGroup(); widgetGroup0.Show(); widgetGroup1.Show(); sideWidgetGroup0.Show(); sideWidgetGroup1.Show(); MainVBox.PackStart(widgetGroup0, false, false, 0); MainVBox.ReorderChild(widgetGroup0, 3); MainVBox.PackStart(widgetGroup1, false, false, 0); MainVBox.ReorderChild(widgetGroup1, 4); DataViewBox.PackStart(sideWidgetGroup0, false, false, 0); DataViewBox.ReorderChild(sideWidgetGroup0, 0); DataViewBox.PackEnd(sideWidgetGroup1, false, false, 0); //MainVBox.ReorderChild(widgetGroup1, 4); Services.File = new FileService(dataBook, MainWindow); Services.Session = new SessionService(dataBook, MainWindow); Services.UI = new UIService(uiManager); //Services.Info=new InfoService(infobar); // Add area plugins PluginManager.AddForType(typeof(AreaPlugin), new object[0]); PluginManager areaPlugins = PluginManager.GetForType(typeof(AreaPlugin)); Area.InitiatePluginTable(); foreach (AreaPlugin p in areaPlugins.Plugins) { Area.AddFactoryItem(p.Name, p.CreateArea); } // Load GUI plugins PluginManager.AddForType(typeof(GuiPlugin), new object[] { MainWindow, uiManager }); PluginManager guiPlugins = PluginManager.GetForType(typeof(GuiPlugin)); foreach (Plugin p in guiPlugins.Plugins) { guiPlugins.LoadPlugin(p); } // load recent file history try { History.Instance.Load(Path.Combine(blessConfDir, "history.xml")); } catch (Exception e) { System.Console.WriteLine(e.Message); } // if user specified files on the command line // try to load them if (args.Length > 0) { Services.File.LoadFiles(args); } else if (Preferences.Instance["Session.LoadPrevious"] == "True") { bool loadIt = true; string prevSessionFile = Path.Combine(blessConfDir, "last.session"); if (Preferences.Instance["Session.AskBeforeLoading"] == "True" && File.Exists(prevSessionFile)) { MessageDialog md = new MessageDialog(MainWindow, DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.YesNo, Catalog.GetString("Do you want to load your previous session?")); ResponseType result = (ResponseType)md.Run(); md.Destroy(); if (result == ResponseType.Yes) { loadIt = true; } else { loadIt = false; } } // try to load previous session if (loadIt) { Services.Session.Load(prevSessionFile); } } // if nothing has been loaded, create a new file if (dataBook.NPages == 0) { ByteBuffer bb = Services.File.NewFile(); // create and setup a DataView DataView dv = Services.File.CreateDataView(bb); // append the DataView to the DataBook dataBook.AppendView(dv, new CloseViewDelegate(Services.File.CloseFile), Path.GetFileName(bb.Filename)); } PreferencesChangedHandler handler = new PreferencesChangedHandler(OnPreferencesChanged); Preferences.Proxy.Subscribe("View.Toolbar.Show", "mainwin", handler); // register drag and drop of files MainWindow.DragDataReceived += OnDragDataReceived; Gtk.Drag.DestSet(MainWindow, DestDefaults.Motion | DestDefaults.Drop, dropTargets, Gdk.DragAction.Copy | Gdk.DragAction.Move); DataViewBox.ShowAll(); Preferences.Proxy.Enable = true; // fire the preferences changed event // so things are setup according to the preferences Preferences.Proxy.NotifyAll(); Application.Run(); }
internal Client(bool loadFiles) { app_count++; Window = new Gtk.Window(Gtk.WindowType.Toplevel) { Title = Catalog.GetString("PDF Mod") }; Window.SetSizeRequest(640, 480); Window.DeleteEvent += delegate(object o, DeleteEventArgs args) { Quit(); args.RetVal = true; }; // PDF Icon View IconView = new DocumentIconView(this); var iconview_sw = new Gtk.ScrolledWindow(); iconview_sw.AddWithViewport(IconView); query_box = new QueryBox(this) { NoShowAll = true }; query_box.Hide(); // ActionManager ActionManager = new Hyena.Gui.ActionManager(); Window.AddAccelGroup(ActionManager.UIManager.AccelGroup); Actions = new Actions(this, ActionManager); // Status bar StatusBar = new Gtk.Statusbar() { HasResizeGrip = true }; status_label = new Label() { Xalign = 0.0f }; StatusBar.PackStart(status_label, true, true, 6); StatusBar.ReorderChild(status_label, 0); var zoom_slider = new ZoomSlider(this); StatusBar.PackEnd(zoom_slider, false, false, 0); StatusBar.ReorderChild(zoom_slider, 1); // Properties editor box EditorBox = new MetadataEditorBox(this) { NoShowAll = true }; EditorBox.Hide(); // Menubar menu_bar = ActionManager.UIManager.GetWidget("/MainMenu") as MenuBar; // Toolbar HeaderToolbar = ActionManager.UIManager.GetWidget("/HeaderToolbar") as Gtk.Toolbar; HeaderToolbar.ShowArrow = false; HeaderToolbar.ToolbarStyle = ToolbarStyle.Icons; HeaderToolbar.Tooltips = true; HeaderToolbar.NoShowAll = true; HeaderToolbar.Visible = Configuration.ShowToolbar; // BookmarksView BookmarkView = new BookmarkView(this); BookmarkView.NoShowAll = true; BookmarkView.Visible = false; var vbox = new VBox(); vbox.PackStart(menu_bar, false, false, 0); vbox.PackStart(HeaderToolbar, false, false, 0); vbox.PackStart(EditorBox, false, false, 0); vbox.PackStart(query_box, false, false, 0); var hbox = new HPaned(); hbox.Add1(BookmarkView); hbox.Add2(iconview_sw); vbox.PackStart(hbox, true, true, 0); vbox.PackStart(StatusBar, false, true, 0); Window.Add(vbox); Window.ShowAll(); if (loadFiles) { RunIdle(LoadFiles); Application.Run(); } }
public MainWindow(Gnome.Program mainProgram) { program = mainProgram; ui = new Glade.XML(null, "lat.glade", "mainWindow", null); ui.Autoconnect(this); // set window icon Global.latIcon = Gdk.Pixbuf.LoadFromResource("lat.png"); Gdk.Pixbuf dirIcon = Gdk.Pixbuf.LoadFromResource("x-directory-remote-server.png"); mainWindow.Icon = dirIcon; // Restore window positions LoadPreference(Preferences.MAIN_WINDOW_WIDTH); LoadPreference(Preferences.MAIN_WINDOW_X); LoadPreference(Preferences.MAIN_WINDOW_MAXIMIZED); LoadPreference(Preferences.MAIN_WINDOW_HPANED); // Watch for any changes Preferences.SettingChanged += OnPreferencesChanged; // Setup views viewsTreeView = new ViewsTreeView(); viewsTreeView.ViewSelected += new ViewSelectedHandler(OnViewSelected); viewScrolledWindow.AddWithViewport(viewsTreeView); viewScrolledWindow.Show(); // Setup browser ldapTreeView = new LdapTreeView(mainWindow); ldapTreeView.dnSelected += new dnSelectedHandler(OnLdapDNSelected); browserScrolledWindow.AddWithViewport(ldapTreeView); browserScrolledWindow.Show(); LoadPreference(Preferences.BROWSER_SELECTION); // Setup schema browser schemaTreeview = new SchemaTreeView(mainWindow); schemaTreeview.schemaSelected += new schemaSelectedHandler(OnSchemaDNSelected); schemaScrolledWindow.AddWithViewport(schemaTreeview); schemaScrolledWindow.Show(); // Setup search searchTreeView = new SearchResultsTreeView(); searchTreeView.SearchResultSelected += new SearchResultSelectedHandler(OnSearchSelected); searchTreeView.Export += OnSearchExport; resultsScrolledWindow.AddWithViewport(searchTreeView); resultsScrolledWindow.Show(); // setup schema objRequiredStore = new ListStore(typeof(string)); objRequiredTreeview.Model = objRequiredStore; objOptionalStore = new ListStore(typeof(string)); objOptionalTreeview.Model = objOptionalStore; objRequiredTreeview.AppendColumn("Required Attributes", new CellRendererText(), "text", 0); objOptionalTreeview.AppendColumn("Optional Attributes", new CellRendererText(), "text", 0); infoVpaned1.Position = 150; ToggleButtons(false); ToggleInfoNotebook(false); templateToolButton.Hide(); // setup menu newAccelGroup = new AccelGroup(); mainWindow.AddAccelGroup(newAccelGroup); // status bar UpdateStatusBar(); #if ENABLE_NETWORKMANAGER Global.Network = NetworkDetect.Instance; Global.Network.StateChanged += OnNetworkStateChanged; #endif #if ENABLE_AVAHI // FIXME: causes delay/crashes on exit for some reason finder = new ServiceFinder(); finder.Found += new FoundServiceEventHandler(OnServerFound); finder.Removed += new RemovedServiceEventHandler(OnServerRemoved); finder.Start(); #endif viewNotebook.SwitchPage += new SwitchPageHandler(OnNotebookViewChanged); if (Global.Connections.ConnectionNames.Length == 0) { new ConnectDialog(); viewsTreeView.Refresh(); ldapTreeView.Refresh(); schemaTreeview.Refresh(); } }
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 = String.Format ("{0} (BETA) {1} (Protocol Version: {2})", attr.Title, asmName.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 (Common.OSName == "Darwin") { 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 Core.ShareBuilder.StartedIndexing += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_StartedIndexing)); Core.ShareBuilder.FinishedIndexing += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_FinishedIndexing)); Core.ShareBuilder.StoppedIndexing += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_StoppedIndexing)); Core.ShareBuilder.ErrorIndexing += (ErrorEventHandler)DispatchService.GuiDispatch(new ErrorEventHandler(sb_ErrorIndexing)); Core.ShareHasher.StartedHashingFile += (ShareHasherTaskEventHandler)DispatchService.GuiDispatch(new ShareHasherTaskEventHandler(sh_StartedFinished)); Core.ShareHasher.FinishedHashingFile += (ShareHasherTaskEventHandler)DispatchService.GuiDispatch(new ShareHasherTaskEventHandler(sh_StartedFinished)); Core.ShareHasher.QueueChanged += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sh_QueueChanged)); Core.FileSearchManager.SearchAdded += (FileSearchEventHandler)DispatchService.GuiDispatch(new FileSearchEventHandler(FileSearchManager_SearchAdded)); 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; }
internal Client (bool loadFiles) { app_count++; Window = new Gtk.Window (Gtk.WindowType.Toplevel) { Title = Catalog.GetString ("PDF Mod") }; Window.SetSizeRequest (640, 480); Window.DeleteEvent += delegate (object o, DeleteEventArgs args) { Quit (); args.RetVal = true; }; // PDF Icon View IconView = new DocumentIconView (this); var iconview_sw = new Gtk.ScrolledWindow (); iconview_sw.AddWithViewport (IconView); query_box = new QueryBox (this) { NoShowAll = true }; query_box.Hide (); // ActionManager ActionManager = new Hyena.Gui.ActionManager (); Window.AddAccelGroup (ActionManager.UIManager.AccelGroup); Actions = new Actions (this, ActionManager); // Status bar StatusBar = new Gtk.Statusbar () { HasResizeGrip = true }; status_label = new Label () { Xalign = 0.0f }; StatusBar.PackStart (status_label, true, true, 6); StatusBar.ReorderChild (status_label, 0); var zoom_slider = new ZoomSlider (this); StatusBar.PackEnd (zoom_slider, false, false, 0); StatusBar.ReorderChild (zoom_slider, 1); // Properties editor box EditorBox = new MetadataEditorBox (this) { NoShowAll = true }; EditorBox.Hide (); // Menubar menu_bar = ActionManager.UIManager.GetWidget ("/MainMenu") as MenuBar; // Toolbar HeaderToolbar = ActionManager.UIManager.GetWidget ("/HeaderToolbar") as Gtk.Toolbar; HeaderToolbar.ShowArrow = false; HeaderToolbar.ToolbarStyle = ToolbarStyle.Icons; HeaderToolbar.Tooltips = true; HeaderToolbar.NoShowAll = true; HeaderToolbar.Visible = Configuration.ShowToolbar; // BookmarksView BookmarkView = new BookmarkView (this); BookmarkView.NoShowAll = true; BookmarkView.Visible = false; var vbox = new VBox (); vbox.PackStart (menu_bar, false, false, 0); vbox.PackStart (HeaderToolbar, false, false, 0); vbox.PackStart (EditorBox, false, false, 0); vbox.PackStart (query_box, false, false, 0); var hbox = new HPaned (); hbox.Add1 (BookmarkView); hbox.Add2 (iconview_sw); vbox.PackStart (hbox, true, true, 0); vbox.PackStart (StatusBar, false, true, 0); Window.Add (vbox); Window.ShowAll (); if (loadFiles) { RunIdle (LoadFiles); Application.Run (); } }
protected override Gtk.Widget CreateWidget(WindowContext context) { Window win; if(HasAttribute("dialog")) { Dialog dialog = new Dialog(); dialog.AddAccelGroup(context.AccelGroup); SetWindowAttribs(dialog); if(Child != null) dialog.VBox.Add(Child.Build(context)); foreach(string s in GetAttribute<Array>("dialog")) { string[] bits = s.Split(':'); string text = bits[0]; int response = 0; if(bits.Length > 4) throw new Exception("Neplatný počet parametrů tlačítka v poli tlačítek dialogu"); if(bits.Length > 1) response = (int)IntLiteral.Parse(bits[1]); Label l = new Label(); l.Markup = text; Button btn; if(bits.Length > 2 && !String.IsNullOrEmpty(bits[2])) { HBox hbox = new HBox(false, 0); hbox.PackStart(ImageExpression.CreateImage(bits[2], IconSize.Button)); hbox.PackStart(l); btn = new Button(hbox); } else btn = new Button(l); btn.ShowAll(); dialog.AddActionWidget(btn, response); if(bits.Length > 3) { switch(bits[3].ToLower()) { case "default": btn.CanDefault = true; dialog.Default = btn; break; case "cancel": // set as cancel action - how? break; case "": case "none": break; default: throw new Exception("Neznámý příznak tlačítka dialogu"); } } } win = dialog; } else { win = new Window(Gtk.WindowType.Toplevel); win.AddAccelGroup(context.AccelGroup); if(Child != null) win.Add(Child.Build(context)); } if(HasAttribute("iconset")) { IconSet icons = IconFactory.LookupDefault(GetAttribute<string>("iconset")); List<Gdk.Pixbuf> list = new List<Gdk.Pixbuf>(); foreach(IconSize size in icons.Sizes) { list.Add(icons.RenderIcon(win.Style, TextDirection.Ltr, StateType.Normal, size, win, "")); } win.IconList = list.ToArray(); } return win; }
static int RunApp(string[] args, int n) { Project = SteticApp.CreateProject(); Project.WidgetAdded += OnWidgetAdded; Project.WidgetRemoved += OnWidgetRemoved; Project.ModifiedChanged += OnProjectModified; Project.ProjectReloaded += OnProjectReloaded; Palette = SteticApp.PaletteWidget; widgetTree = SteticApp.WidgetTreeWidget; Signals = SteticApp.SignalsWidget; propertyTree = SteticApp.PropertiesWidget; ProjectView = new WindowListWidget(); UIManager = new Stetic.UIManager(Project); Glade.XML.CustomHandler = CustomWidgetHandler; Glade.XML glade = new Glade.XML("stetic.glade", "MainWindow"); glade.Autoconnect(typeof(SteticMain)); if (ProjectView.Parent is Gtk.Viewport && ProjectView.Parent.Parent is Gtk.ScrolledWindow) { Gtk.Viewport viewport = (Gtk.Viewport)ProjectView.Parent; Gtk.ScrolledWindow scrolled = (Gtk.ScrolledWindow)viewport.Parent; viewport.Remove(ProjectView); scrolled.Remove(viewport); scrolled.AddWithViewport(ProjectView); } foreach (Gtk.Widget w in glade.GetWidgetPrefix("")) { Gtk.Window win = w as Gtk.Window; if (win != null) { win.AddAccelGroup(UIManager.AccelGroup); win.ShowAll(); } } MainWindow = (Gtk.Window)Palette.Toplevel; WidgetNotebook = (Gtk.Notebook)glade ["notebook"]; WidgetNotebook.SwitchPage += OnPageChanged; ProjectView.ComponentActivated += OnWidgetActivated; widgetTree.SelectionChanged += OnSelectionChanged; #if GTK_SHARP_2_6 // This is needed for both our own About dialog and for ones // the user constructs Gtk.AboutDialog.SetUrlHook(ActivateUrl); #endif if (n < args.Length) { LoadProject(args [n]); } ReadConfiguration(); foreach (string s in Configuration.WidgetLibraries) { SteticApp.AddWidgetLibrary(s); } SteticApp.UpdateWidgetLibraries(false); ProjectView.Fill(Project); Program.Run(); return(0); }