Gtk.MenuBar CreateMenus () { AccelGroup group = new AccelGroup (); MenuBar bar = new MenuBar (); Menu file_menu = new Menu (); MenuItem file_menu_item = new MenuItem ("_File"); file_menu_item.Submenu = file_menu; ImageMenuItem file_exit = new ImageMenuItem (Gtk.Stock.Quit, group); file_exit.Activated += new EventHandler (exit_cb); file_menu.Append (file_exit); bar.Append (file_menu_item); Menu help_menu = new Menu (); ImageMenuItem help_menu_item = new ImageMenuItem (Gtk.Stock.Help, group); help_menu_item.Submenu = help_menu; ImageMenuItem file_help = new ImageMenuItem (Gnome.Stock.About, group); file_help.Activated += new EventHandler (about_cb); help_menu.Append (file_help); bar.Append (help_menu_item); bar.ShowAll (); return bar; }
public AppMenu(DebugManager mgr, AccelGroup agr, Settings set, Window parent, DebugPane pane, string argsOverride) { settings = set; debugPane = pane; debugManager = mgr; menuBar = new MenuBar(); preferences = new PreferencesDialog(set, parent, argsOverride); menuBar.Append(CreateFileMenu(agr)); menuBar.Append(CreateEditMenu(agr)); menuBar.Append(CreateViewMenu(agr)); menuBar.Append(CreateDebuggerMenu(agr)); menuBar.Append(CreateHelpMenu(agr)); debugManager.DebuggerBusy += OnDebuggerBusy; debugManager.DebuggerReady += OnDebuggerReady; debugManager.DebuggerStarted += OnDebuggerStarted; debugManager.DebuggerExited += OnDebuggerExited; menuBar.Destroyed += OnDestroy; debuggerStop.Sensitive = false; debuggerInterrupt.Sensitive = false; foreach (MenuItem m in commandMacros) m.Sensitive = false; }
private MenuBar CreateMenu(MenuItem[] items) { var acc = new MenuBar(); foreach (var item in items) acc.Append(Map(item)); return acc; }
public MenuBarController() { MenuBar mb = new MenuBar(); Menu filemenu = new Menu(); MenuItem file = new MenuItem("File"); file.Submenu = filemenu; ImageMenuItem importDirectoryMenuItem = new ImageMenuItem("Import Directory"); importDirectoryMenuItem.Activated += ImportDirectoryMenuItemOnActivated; filemenu.Append(importDirectoryMenuItem); ImageMenuItem open = new ImageMenuItem(Stock.Open); filemenu.Append(open); SeparatorMenuItem sep = new SeparatorMenuItem(); filemenu.Append(sep); ImageMenuItem exit = new ImageMenuItem(Stock.Quit); exit.Activated += (sender, args) => Application.Quit(); filemenu.Append(exit); mb.Append(file); View = mb; }
public static void Main21 (string[] args) { Application.Init(); Window win = new Window ("Menu Sample App"); win.DeleteEvent += new DeleteEventHandler (delete_cb); win.DefaultWidth = 200; win.DefaultHeight = 150; VBox box = new VBox (false, 2); MenuBar mb = new MenuBar (); Menu file_menu = new Menu (); MenuItem exit_item = new MenuItem("Exit"); exit_item.Activated += new EventHandler (exit_cb); file_menu.Append (exit_item); MenuItem file_item = new MenuItem("File"); file_item.Submenu = file_menu; mb.Append (file_item); box.PackStart(mb, false, false, 0); Button btn = new Button ("Yep, that's a menu"); box.PackStart(btn, true, true, 0); win.Add (box); win.ShowAll (); Application.Run (); }
public VolatileReader() : base("Volatile Reader") { this.Build (); SetDefaultSize(250,200); SetPosition(Gtk.WindowPosition.Center); DeleteEvent += delegate(object o, DeleteEventArgs args) { Application.Quit(); }; MenuBar bar = new MenuBar(); Menu fileMenu = new Menu(); MenuItem fileMenuItem = new MenuItem("File"); fileMenuItem.Submenu = fileMenu; MenuItem exit = new MenuItem("Exit"); exit.Activated += delegate(object sender, EventArgs e) { Application.Quit(); }; MenuItem openFile = new MenuItem("Open file..."); openFile.Activated += OpenFile; fileMenu.Append(openFile); fileMenu.Append(exit); bar.Append(fileMenuItem); _vbox = new VBox(false, 2); _vbox.PackStart(bar, false, false, 0); this.Add(_vbox); this.ShowAll(); }
private Gtk.MenuBar CreateMenu () { MenuBar menu = new MenuBar (); // File Menu fileSub = new Menu (); MenuItem file = new MenuItem ("File"); file.Submenu = fileSub; MenuItem login = new MenuItem ("Login"); MenuItem exit = new MenuItem ("Exit"); fileSub.Append (login); fileSub.Append (exit); // Options Menu optionSub = new Menu (); MenuItem option = new MenuItem ("Options"); option.Submenu = optionSub; MenuItem preferences = new MenuItem ("Preferences"); optionSub.Append (preferences); // Help Menu helpSub = new Menu (); MenuItem help = new MenuItem ("Help"); help.Submenu = helpSub; MenuItem about = new MenuItem ("About"); helpSub.Append (about); // Menubar menu.Append (file); menu.Append (option); menu.Append (help); return menu; }
public MainWindow_Table() : base("Table") { SetDefaultSize(250, 230); SetPosition(WindowPosition.Center); DeleteEvent += delegate { Application.Quit(); }; VBox vbox = new VBox(false, 2); MenuBar mb = new MenuBar(); Menu filemenu = new Menu(); MenuItem file = new MenuItem("File"); file.Submenu = filemenu; mb.Append(file); vbox.PackStart(mb, false, false, 0); Table table = new Table(5, 4, true); table.Attach(new Button("Cls"), 0, 1, 0, 1); table.Attach(new Button("Bck"), 1, 2, 0, 1); table.Attach(new Label(), 2, 3, 0, 1); table.Attach(new Button("Close"), 3, 4, 0, 1); table.Attach(new Button("7"), 0, 1, 1, 2); table.Attach(new Button("8"), 1, 2, 1, 2); table.Attach(new Button("9"), 2, 3, 1, 2); table.Attach(new Button("/"), 3, 4, 1, 2); table.Attach(new Button("4"), 0, 1, 2, 3); table.Attach(new Button("5"), 1, 2, 2, 3); table.Attach(new Button("6"), 2, 3, 2, 3); table.Attach(new Button("*"), 3, 4, 2, 3); table.Attach(new Button("1"), 0, 1, 3, 4); table.Attach(new Button("2"), 1, 2, 3, 4); table.Attach(new Button("3"), 2, 3, 3, 4); table.Attach(new Button("-"), 3, 4, 3, 4); table.Attach(new Button("0"), 0, 1, 4, 5); table.Attach(new Button("."), 1, 2, 4, 5); table.Attach(new Button("="), 2, 3, 4, 5); table.Attach(new Button("+"), 3, 4, 4, 5); vbox.PackStart(new Entry(), false, false, 0); vbox.PackEnd(table, true, true, 0); Add(vbox); ShowAll(); }
public DemoMenus () : base ("Menus") { AccelGroup accel_group = new AccelGroup (); AddAccelGroup (accel_group); VBox box1 = new VBox (false, 0); Add (box1); MenuBar menubar = new MenuBar (); box1.PackStart (menubar, false, true, 0); MenuItem menuitem = new MenuItem ("test\nline2"); menuitem.Submenu = CreateMenu (2, true); menubar.Append (menuitem); MenuItem menuitem1 = new MenuItem ("foo"); menuitem1.Submenu = CreateMenu (3, true); menubar.Append (menuitem1); menuitem = new MenuItem ("bar"); menuitem.Submenu = CreateMenu (4, true); menuitem.RightJustified = true; menubar.Append (menuitem); VBox box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, false, true, 0); Button close = new Button ("close"); close.Clicked += new EventHandler (CloseClicked); box2.PackStart (close, true, true, 0); close.CanDefault = true; close.GrabDefault (); ShowAll (); }
private void Init () { Menu helpMenu = new Menu (); MenuItem aboutItem = new MenuItem ("About"); aboutItem.Activated += HandleAboutActivated; helpMenu.Append (aboutItem); MenuItem helpItem = new MenuItem ("Help"); helpItem.Submenu = helpMenu; MenuBar menuBar = new MenuBar (); menuBar.Append (helpItem); var vbox = new Gtk.VBox (); vbox.PackStart (menuBar, false, false, 0); this.Add (vbox); }
void IPlugin.Init(object context) { morphose = context as IDataMorphose; Gtk.MenuBar mainMenuBar = morphose.GetMainMenu(); Gtk.MenuItem fileMenu = null; // Find the File menu if present foreach (Gtk.Widget w in mainMenuBar.Children) { if (w.Name == "FileAction") { fileMenu = w as Gtk.MenuItem; break; } } // If not present - create it if (fileMenu == null) { Gtk.Menu menu = new Gtk.Menu(); fileMenu = new Gtk.MenuItem("File"); fileMenu.Submenu = menu; mainMenuBar.Append(fileMenu); } // Setting up the Import and Export menu item in File menu Gtk.MenuItem import = new Gtk.MenuItem("Import"); import.Activated += OnImportActivated; (fileMenu.Submenu as Gtk.Menu).Prepend(import); Gtk.MenuItem export = new Gtk.MenuItem("Export"); export.Activated += OnExportActivated; (fileMenu.Submenu as Gtk.Menu).Prepend(export); }
void CreateMenuBar() { topMenu = new Gtk.MenuBar(); Menu fileMenu = new Menu(); MenuItem file = new MenuItem("File"); file.Submenu = fileMenu; AccelGroup agr = new AccelGroup(); AddAccelGroup(agr); ImageMenuItem exit = new ImageMenuItem(Stock.Quit, agr); exit.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.q, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); exit.Activated += onButtonPressEvent; fileMenu.Append(exit); topMenu.Append(file); ((VBox)fullViewVBox).PackStart(topMenu, false, false, 0); ((Gtk.Box.BoxChild)fullViewVBox [topMenu]).Position = 0; topMenu.ShowAll(); }
private MenuBar CreateNormalMenu() { MenuBar menubar = new MenuBar (); AccelGroup agrp = new AccelGroup(); this.AddAccelGroup(agrp); Menu iFolderMenu = new Menu(); NewMenuItem = new ImageMenuItem (Util.GS("_Upload a Folder...")); NewMenuItem.Image = new Image( new Gdk.Pixbuf(Util.ImagesPath("ifolder-upload16.png"))); iFolderMenu.Append(NewMenuItem); NewMenuItem.AddAccelerator("activate", agrp, new AccelKey(Gdk.Key.N, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); NewMenuItem.Activated += new EventHandler(AddiFolderHandler); DownloadMenuItem = new ImageMenuItem (Util.GS("_Download...")); DownloadMenuItem.Image = new Image( new Gdk.Pixbuf(Util.ImagesPath("ifolder-download16.png"))); MergeMenuItem = new ImageMenuItem( Util.GS("Merge to Folder")); MergeMenuItem.Image = new Image( new Gdk.Pixbuf(Util.ImagesPath("ifolder-download16.png"))); iFolderMenu.Append(DownloadMenuItem); iFolderMenu.Append(MergeMenuItem); DownloadMenuItem.Activated += new EventHandler(DownloadAvailableiFolderHandler); MergeMenuItem.Activated += new EventHandler(MergeAvailableiFolderHandler); DeleteMenuItem = new ImageMenuItem (Util.GS("Dele_te From Server")); DeleteMenuItem.Image = new Image(Stock.Delete, Gtk.IconSize.Menu); iFolderMenu.Append(DeleteMenuItem); DeleteMenuItem.Activated += new EventHandler(DeleteFromServerHandler); RemoveMenuItem = new ImageMenuItem (Util.GS("Re_move my membership")); RemoveMenuItem.Image = new Image(Stock.Delete, Gtk.IconSize.Menu); iFolderMenu.Append(RemoveMenuItem); RemoveMenuItem.Activated += new EventHandler(RemoveMembershipHandler); iFolderMenu.Append(new SeparatorMenuItem()); OpenMenuItem = new ImageMenuItem ( Stock.Open, agrp ); iFolderMenu.Append(OpenMenuItem); OpenMenuItem.Activated += new EventHandler(OnOpenSynchronizedFolder); ShareMenuItem = new MenuItem (Util.GS("Share _with...")); iFolderMenu.Append(ShareMenuItem); ShareMenuItem.Activated += new EventHandler(OnShareSynchronizedFolder); ConflictMenuItem = new MenuItem (Util.GS("Resolve conflic_ts")); iFolderMenu.Append(ConflictMenuItem); ConflictMenuItem.Activated += new EventHandler(OnResolveConflicts); SyncNowMenuItem = new MenuItem(Util.GS("S_ynchronize now")); iFolderMenu.Append(SyncNowMenuItem); SyncNowMenuItem.Activated += new EventHandler(OnSynchronizeNow); RevertMenuItem = new ImageMenuItem (Util.GS("_Revert to a Normal Folder")); RevertMenuItem.Image = new Image(Stock.Undo, Gtk.IconSize.Menu); iFolderMenu.Append(RevertMenuItem); RevertMenuItem.Activated += new EventHandler(RemoveiFolderHandler); PropMenuItem = new ImageMenuItem (Stock.Properties, agrp); iFolderMenu.Append(PropMenuItem); PropMenuItem.Activated += new EventHandler(OnShowFolderProperties); iFolderMenu.Append(new SeparatorMenuItem()); MigrateMenuItem = new MenuItem(Util.GS("_Migrate iFolder")); Menu MigrateMenu = new Menu(); MigrateMenuSubItem = new MenuItem(Util.GS("Migrate from 2.x")); MigrateMenu.Append(MigrateMenuSubItem); MigrateMenuItem.Submenu = MigrateMenu; iFolderMenu.Append( MigrateMenuItem); MigrateMenuSubItem.Activated += new EventHandler(Migrate2xClickedHandler); iFolderMenu.Append(new SeparatorMenuItem()); CloseMenuItem = new ImageMenuItem (Stock.Close, agrp); iFolderMenu.Append(CloseMenuItem); CloseMenuItem.Activated += new EventHandler(CloseEventHandler); QuitMenuItem = new ImageMenuItem(Stock.Quit, agrp); iFolderMenu.Append(QuitMenuItem); QuitMenuItem.Activated += new EventHandler(QuitEventHandler); MenuItem iFolderMenuItem = new MenuItem(Util.GS("i_Folder")); iFolderMenuItem.Submenu = iFolderMenu; menubar.Append (iFolderMenuItem); Menu EditMenu = new Menu(); AccountsMenuItem = new MenuItem (Util.GS("_Account Settings...")); EditMenu.Append(AccountsMenuItem); AccountsMenuItem.Activated += new EventHandler(AccountsMenuItemHandler); PreferencesMenuItem = new ImageMenuItem(Util.GS("_Preferences")); PreferencesMenuItem.Image = new Image(Stock.Preferences, Gtk.IconSize.Menu); EditMenu.Append(PreferencesMenuItem); PreferencesMenuItem.Activated += new EventHandler(ShowPreferencesHandler); MenuItem EditMenuItem = new MenuItem(Util.GS("_Edit")); EditMenuItem.Submenu = EditMenu; menubar.Append(EditMenuItem); Menu ViewMenu = new Menu(); RefreshMenuItem = new ImageMenuItem(Stock.Refresh, agrp); ViewMenu.Append(RefreshMenuItem); RefreshMenuItem.Activated += new EventHandler(RefreshiFoldersHandler); ViewMenu.Append(new SeparatorMenuItem()); SyncLogMenuItem = new MenuItem (Util.GS("Synchronization _Log")); ViewMenu.Append(SyncLogMenuItem); SyncLogMenuItem.Activated += new EventHandler(SyncLogMenuItemHandler); ViewMenu.Append(new SeparatorMenuItem()); ViewServeriFoldersMenuItem = new CheckMenuItem(Util.GS("View _available iFolders")); ViewMenu.Append(ViewServeriFoldersMenuItem); ViewServeriFoldersMenuItem.Toggled += new EventHandler(OnToggleViewServeriFoldersMenuItem); if((bool)ClientConfig.Get(ClientConfig.KEY_IFOLDER_DEBUG_COLOR_PALETTE)) { MenuItem showColorPaletteMenuItem = new MenuItem("Show _Color Palette (FIXME: Remove this before shipping)..."); ViewMenu.Append(showColorPaletteMenuItem); showColorPaletteMenuItem.Activated += ShowColorPalette; } MenuItem ViewMenuItem = new MenuItem(Util.GS("_View")); ViewMenuItem.Submenu = ViewMenu; menubar.Append(ViewMenuItem); Menu SecurityMenu = new Menu(); RecoveryMenuItem = new MenuItem(Util.GS("_Key Recovery")); SecurityMenu.Append(RecoveryMenuItem); ImportMenuSubItem = new MenuItem(Util.GS("Import Decrypted Keys")); ExportMenuSubItem = new MenuItem(Util.GS("Export Encrypted Keys")); ImportMenuSubItem.Activated += new EventHandler(ImportClicked); ExportMenuSubItem.Activated += new EventHandler(ExportClicked); Menu recoverMenu = new Menu(); recoverMenu.Append( ExportMenuSubItem); recoverMenu.Append( ImportMenuSubItem); RecoveryMenuItem.Submenu = recoverMenu;; ResetPassMenuItem = new MenuItem(Util.GS("Reset _Passphrase")); ResetPassMenuItem.Activated += new EventHandler(OnResetPassMenuItem); SecurityMenu.Append(ResetPassMenuItem); ResetPasswordMenuItem = new MenuItem(Util.GS("Change Password")); ResetPasswordMenuItem.Activated += new EventHandler(OnResetPasswordMenuItem); SecurityMenu.Append(ResetPasswordMenuItem); MenuItem MainSecurityMenuItem = new MenuItem (Util.GS ("_Security")); MainSecurityMenuItem.Submenu = SecurityMenu; menubar.Append (MainSecurityMenuItem); Menu HelpMenu = new Menu(); HelpMenuItem = new ImageMenuItem(Stock.Help, agrp); HelpMenu.Append(HelpMenuItem); HelpMenuItem.Activated += new EventHandler(OnHelpMenuItem); AboutMenuItem = new ImageMenuItem(Util.GS("A_bout")); AboutMenuItem.Image = new Image(Gnome.Stock.About, Gtk.IconSize.Menu); HelpMenu.Append(AboutMenuItem); AboutMenuItem.Activated += new EventHandler(OnAbout); MenuItem MainHelpMenuItem = new MenuItem(Util.GS("_Help")); MainHelpMenuItem.Submenu = HelpMenu; menubar.Append(MainHelpMenuItem); return menubar; }
public SparkleLog(string path) : base("") { LocalPath = path; string name = System.IO.Path.GetFileName (LocalPath); SetDefaultSize (480, 640); SetPosition (WindowPosition.Center); BorderWidth = 0; // TRANSLATORS: {0} is a folder name, and {1} is a server address Title = String.Format(_("Recent Events in ‘{0}’"), name); IconName = "folder-sparkleshare"; DeleteEvent += delegate { Close (); }; // Adds a hidden menubar that contains to enable keyboard // shortcuts to close the log MenuBar = new MenuBar (); MenuItem file_item = new MenuItem ("File"); Menu file_menu = new Menu (); MenuItem close_1 = new MenuItem ("Close1"); MenuItem close_2 = new MenuItem ("Close2"); // adds specific Ctrl+W and Esc key accelerators to Log Window AccelGroup accel_group = new AccelGroup (); AddAccelGroup (accel_group); // Close on Esc close_1.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.W, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); close_1.Activated += delegate { Close (); }; // Close on Ctrl+W close_2.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.Escape, Gdk.ModifierType.None, AccelFlags.Visible)); close_2.Activated += delegate { Close (); }; file_menu.Append (close_1); file_menu.Append (close_2); file_item.Submenu = file_menu; MenuBar.Append (file_item); // Hacky way to hide the menubar, but the accellerators // will simply be disabled when using Hide () MenuBar.HeightRequest = 1; MenuBar.ModifyBg (StateType.Normal, Style.Background (StateType.Normal)); LayoutVertical = new VBox (false, 0); LayoutVertical.PackStart (CreateEventLog (), true, true, 0); HButtonBox dialog_buttons = new HButtonBox { Layout = ButtonBoxStyle.Edge, BorderWidth = 12 }; Button open_folder_button = new Button (_("_Open Folder")) { UseUnderline = true }; open_folder_button.Clicked += delegate (object o, EventArgs args) { Process process = new Process (); process.StartInfo.FileName = Defines.OPEN_COMMAND; process.StartInfo.Arguments = LocalPath.Replace (" ", "\\ "); // Escape space-characters process.Start (); Close (); }; Button close_button = new Button (Stock.Close); close_button.Clicked += delegate { Close (); }; dialog_buttons.Add (open_folder_button); dialog_buttons.Add (close_button); LayoutVertical.PackStart (new HSeparator (), false, false, 0); // We have to hide the menubar somewhere... LayoutVertical.PackStart (MenuBar, false, false, 0); LayoutVertical.PackStart (dialog_buttons, false, false, 0); Add (LayoutVertical); }
private void BuildMenu() { menuBar = new MenuBar(); filemenu = new Menu(); file = new MenuItem("File"); file.Submenu = filemenu; exit = new MenuItem("Exit"); exit.Activated += OnExitActivated; filemenu.Append(exit); aboutmenu = new Menu (); about = new MenuItem("About"); about.Submenu = aboutmenu; aboutApp = new MenuItem ("About Application"); aboutApp.Activated += OnAboutActivated; aboutmenu.Append (aboutApp); menuBar.Append(file); menuBar.Append (about); }
//Contains all of the components which are on the window private void setupWindow() { //Vertical box (3 sections) which is the main container VBox MainVBox = new VBox(false, 6); /*********************Start of menu bar components*********************/ //Note: Flow of menus are: //Menubar contains MenuItems (e.g. File, Edit, About, etc...) //MenuItems contains one Menu (i.e. a Submenu) //Menu contains multiple MenuItems (e.g. Save, Save As, Load, etc...) MenuBar MainMenuBar = new MenuBar (); Menu FileMenu = new Menu (); MenuItem File = new MenuItem ("File"); File.Submenu = FileMenu; MenuItem ExitItem = new MenuItem ("Exit"); ExitItem.Activated += quitProgram; FileMenu.Append (ExitItem); Menu GestureMenu = new Menu (); MenuItem Gesture = new MenuItem ("Gestures"); Gesture.Submenu = GestureMenu; MenuItem LoadGesture = new MenuItem ("Load Gesture"); LoadGesture.Activated += openGesture; GestureMenu.Append (LoadGesture); MenuItem SaveGestureItem = new MenuItem ("Save Gesture"); SaveGestureItem.Activated += createGesture; GestureMenu.Append (SaveGestureItem); Menu PointsMenu = new Menu (); MenuItem Points = new MenuItem ("Data Points"); Points.Submenu = PointsMenu; MenuItem LoadPointsItem = new MenuItem ("Load Points"); LoadPointsItem.Activated += loadDataPoints; PointsMenu.Append (LoadPointsItem); MenuItem RecordPointsItem = new MenuItem ("Record Points"); RecordPointsItem.Activated += recordPoints; PointsMenu.Append (RecordPointsItem); MenuItem BatchRecognizeItem = new MenuItem ("Batch Recognize"); BatchRecognizeItem.Activated += batchRecognize; PointsMenu.Append (BatchRecognizeItem); Menu HelpMenu = new Menu (); MenuItem Help = new MenuItem ("Help"); Help.Submenu = HelpMenu; MenuItem AboutMenuItem = new MenuItem("About"); HelpMenu.Append (AboutMenuItem); MainMenuBar.Append (File); MainMenuBar.Append (Gesture); MainMenuBar.Append (Points); MainMenuBar.Append (Help); /*********************End of menu bar components*********************/ //Drawing area which is the core component of the application dArea = new DrawingArea (); dArea.SetSizeRequest (500, 500); //Horizontal box (4 sections) which contains all of the buttons along the //bottom of the window HBox ButtonHBox = new HBox (false, 6); /*********************Start of Buttons*********************/ Button BtnCreateGesture = new Button ("Create"); Button BtnRecognizeGesture = new Button ("Recognize"); Button BtnClearScreen = new Button ("Clear"); Button BtnRecordPoints = new Button ("Record points"); Button BtnChangeColour = new Button ("Change colour"); //Button functions BtnCreateGesture.Clicked += new EventHandler (createGesture); BtnRecognizeGesture.Clicked += new EventHandler (recognizeGesture); BtnClearScreen.Clicked += new EventHandler (clearScreen); BtnRecordPoints.Clicked += new EventHandler (recordPoints); BtnChangeColour.Clicked += changeColour; //Adding buttons to the current horizontal box ButtonHBox.PackStart (BtnCreateGesture, true, false, 0); ButtonHBox.PackStart (BtnRecognizeGesture, true, false, 0); ButtonHBox.PackStart (BtnClearScreen, true, false, 0); ButtonHBox.PackStart (BtnRecordPoints, true, false, 0); ButtonHBox.PackStart (BtnChangeColour, true, false, 0); /*********************End of Buttons*********************/ //Status bar which shows the score and recognized gesture sBar = new Statusbar (); sBar.Push (1, "Ready"); //Entry box for batch function name to be used on the files batchFunctionName = new Entry ("Recorded points function name"); batchFunctionName.AddEvents ( (int)Gdk.EventMask.ButtonPressMask ); batchFunctionName.ButtonPressEvent += clearTextBox; //Adding all components to the Vertical box MainVBox.PackStart (MainMenuBar, false, false, 0); MainVBox.PackStart (dArea, false, false, 0); MainVBox.PackStart (ButtonHBox, false, false, 0); MainVBox.PackStart (batchFunctionName, false, false, 0); MainVBox.PackStart (sBar, false, false, 0); Add (MainVBox); ShowAll (); //Surface 'pattern' for area to be covered surface = new ImageSurface(Format.Argb32, 500, 500); //Adding mouse events to the drawing area and assigning functions dArea.AddEvents( //Mouse Related Events (int)Gdk.EventMask.PointerMotionMask |(int)Gdk.EventMask.ButtonPressMask |(int)Gdk.EventMask.ButtonReleaseMask ); //Repaint the Canvas Internally. dArea.ExposeEvent += OnDrawingAreaExposed; //Do this on MousePress inside Area dArea.ButtonPressEvent += OnMousePress; //Do this on MouseReleased inside Area dArea.ButtonReleaseEvent += OnMouseRelease; //Do this if a Motion Occurs inside the Drawing Area dArea.MotionNotifyEvent += OnMouseMotion2; //Assigning close function to the window DeleteEvent += delegate { Application.Quit(); }; //Checking to see if bool for using the dot function is true //And assigning the required function as the delegate's operation //Note: This will always be true, no current way to switch while //application is running, has not been needed as of yet if (isDot) { Painter = new DrawShape (DrawDot); myoPainter = new DrawShape (DrawDot); } else { Painter = new DrawShape (DrawLine); } }
private MenuBar BuildMenuBar() { MenuBar mb = new MenuBar (); Menu file_menu = new Menu (); MenuItem new_item = new MenuItem("New Window"); MenuItem open_item = new MenuItem("Open"); MenuItem save_item = new MenuItem("Save"); MenuItem save_as_item = new MenuItem("Save As"); MenuItem exit_item = new MenuItem("Exit"); new_item.Activated += new EventHandler (OnNew); open_item.Activated += new EventHandler (OnOpen); save_item.Activated += new EventHandler (OnSave); save_as_item.Activated += new EventHandler (OnSaveAs); exit_item.Activated += new EventHandler (OnExit); file_menu.Append (new_item); file_menu.Append (new MenuItem()); file_menu.Append (open_item); file_menu.Append (save_item); file_menu.Append (save_as_item); file_menu.Append (new MenuItem()); file_menu.Append (exit_item); Menu view_menu = new Menu(); CheckMenuItem lines_item = new CheckMenuItem("Line numbers"); CheckMenuItem eol_item = new CheckMenuItem("EOL marker"); CheckMenuItem tab_item = new CheckMenuItem("Tab marker"); CheckMenuItem ruler_item = new CheckMenuItem("Vertical ruler"); CheckMenuItem invalid_item = new CheckMenuItem("Invalid lines"); lines_item.Active = textEditor.ShowLineNumbers; eol_item.Active = textEditor.ShowEOLMarkers; tab_item.Active = textEditor.ShowTabs; ruler_item.Active = textEditor.ShowVRuler; invalid_item.Active = textEditor.ShowInvalidLines; lines_item.Toggled += new EventHandler (OnLineNumbersToggled); eol_item.Toggled += new EventHandler (OnEOLToggled); tab_item.Toggled += new EventHandler (OnTabToggled); ruler_item.Toggled += new EventHandler (OnRulerToggled); invalid_item.Toggled += new EventHandler (OnInvalidToggled); view_menu.Append(lines_item); view_menu.Append(invalid_item); view_menu.Append(tab_item); view_menu.Append(eol_item); view_menu.Append(ruler_item); Menu tools_menu = new Menu(); MenuItem font_item = new MenuItem("Font"); font_item.Activated += new EventHandler(OnFont); tools_menu.Append(font_item); MenuItem file_item = new MenuItem("File"); file_item.Submenu = file_menu; MenuItem view_item = new MenuItem("View"); view_item.Submenu = view_menu; MenuItem tools_item = new MenuItem("Tools"); tools_item.Submenu = tools_menu; mb.Append (file_item); mb.Append (view_item); mb.Append (tools_item); return mb; }
public DemoMain() { window = new Gtk.Window("TestForm1"); Gtk.HBox hbox = new Gtk.HBox(false, 0); hbox1 = new Gtk.HBox(false, 0); Gtk.HBox hbox2 = new Gtk.HBox(false, 0); Gtk.HBox hbox3 = new Gtk.HBox(false, 0); hbox.Add(hbox1); window.SetDefaultSize(600, 400); window.DeleteEvent += new DeleteEventHandler(WindowDelete); button1 = new Gtk.Button("button1"); button1.Clicked += Button1Clicked; button2 = new Gtk.Button("button2"); button3 = new Gtk.Button("button3"); Gtk.Button button4 = new Gtk.Button("button4"); button4.Clicked += Button4Clicked; Gtk.Button button5 = new Gtk.Button("button5"); Gtk.Button button6 = new Gtk.Button("button6"); Gtk.Button button7 = new Gtk.Button("button7"); button7.Sensitive = false; scaleButton1 = new Gtk.ScaleButton(0, 0, 100, 10, new string [0]); hbox1.Add(hbox3); hbox1.Add(hbox2); hbox1.Add(button3); hbox1.Add(button2); button3.Accessible.Description = "help text 3"; button3.Sensitive = false; label1 = new Gtk.Label("label1"); textBox1 = new Gtk.Entry(); Gtk.Entry textBox2 = new Gtk.Entry(); textBox2.Visibility = false; textBox2.Sensitive = false; textBox2.IsEditable = false; textBox3 = new Gtk.TextView(); // TODO: scrollbars Gtk.CheckButton checkbox1 = new Gtk.CheckButton("checkbox1"); Gtk.CheckButton checkbox2 = new Gtk.CheckButton("checkbox2"); checkbox2.Sensitive = false; Gtk.TreeStore store = new Gtk.TreeStore(typeof(string), typeof(string)); Gtk.TreeIter [] iters = new Gtk.TreeIter [2]; iters [0] = store.AppendNode(); store.SetValues(iters [0], "item 1", "item 1 (2)"); iters [1] = store.AppendNode(iters [0]); store.SetValues(iters [1], "item 1a", "item 1a (2)"); iters [0] = store.AppendNode(); store.SetValues(iters [0], "item 2", "item 2 (2)"); iters [1] = store.AppendNode(iters [0]); store.SetValues(iters [1], "item 2a", "item 2a (2)"); iters [1] = store.AppendNode(iters [0]); store.SetValues(iters [1], "item 2b", "item 2b (2)"); treeView1 = new Gtk.TreeView(store); AddTreeViewColumn(treeView1, 0, "column 1"); treeView1.CollapseAll(); treeView2 = new Gtk.TreeView(store); AddTreeViewColumn(treeView2, 0, "column 1"); AddTreeViewColumn(treeView2, 1, "column 2"); treeView2.CollapseAll(); treeView2.Accessible.Name = "treeView2"; tableStore = new Gtk.TreeStore(typeof(string), typeof(string), typeof(string), typeof(string)); iters [0] = tableStore.AppendNode(); tableStore.SetValues(iters [0], "False", "Alice", "24", ""); iters [0] = tableStore.AppendNode(); tableStore.SetValues(iters [0], "True", "Bob", "28", ""); dataGridView1 = new Gtk.TreeView(tableStore); dataGridView1 = new Gtk.TreeView(tableStore); dataGridView1 = new Gtk.TreeView(tableStore); AddTreeViewColumn(dataGridView1, 0, "Gender"); AddTreeViewColumn(dataGridView1, 1, "Name"); AddTreeViewColumn(dataGridView1, 2, "Age"); dataGridView1.Accessible.Name = "dataGridView1"; hboxPanel = new Gtk.HBox(); Gtk.Button btnRemoveTextBox = new Gtk.Button("Remove"); btnRemoveTextBox.Clicked += RemoveTextBoxClicked; Gtk.Button btnAddTextBox = new Gtk.Button("Add"); btnAddTextBox.Clicked += AddTextBoxClicked; txtCommand = new Gtk.Entry(); txtCommand.Accessible.Name = "txtCommand"; Gtk.Button btnRun = new Gtk.Button("Run"); btnRun.Clicked += btnRunClicked; hboxPanel.Add(btnRemoveTextBox); hboxPanel.Add(btnAddTextBox); Gtk.TreeStore treeStore = new Gtk.TreeStore(typeof(string)); Gtk.TreeIter iter = treeStore.AppendNode(); treeStore.SetValue(iter, 0, "Item 0"); iter = treeStore.AppendNode(); treeStore.SetValue(iter, 0, "Item 1"); listView1 = new Gtk.TreeView(treeStore); AddTreeViewColumn(listView1, 0, "items"); listView1.Accessible.Name = "listView1"; listView1.ExpandAll(); hbox2.Add(button5); hbox2.Add(checkbox1); hbox2.Add(checkbox2); hbox2.Add(button4); hbox2.Accessible.Name = "groupBox2"; hbox3.Add(button7); hbox3.Add(button6); hbox3.Sensitive = false; hbox3.Accessible.Name = "groupBox3"; hbox.Add(textBox3); hbox.Add(textBox2); hbox.Add(textBox1); hbox.Add(label1); hbox.Add(button1); hbox.Add(treeView1); hbox.Add(treeView2); hbox.Add(listView1); hbox.Add(dataGridView1); hbox.Add(txtCommand); hbox.Add(btnRun); hbox.Add(hboxPanel); hbox.Add(scaleButton1); Gtk.Menu file = new Gtk.Menu(); file.Append(new Gtk.MenuItem("_New")); file.Append(new Gtk.MenuItem("_Open")); file.Append(new Gtk.CheckMenuItem("Check")); Gtk.MenuItem fileItem = new Gtk.MenuItem("File"); fileItem.Submenu = file; Gtk.Menu edit = new Gtk.Menu(); edit.Append(new Gtk.MenuItem("_Undo")); edit.Append(new Gtk.SeparatorMenuItem()); edit.Append(new Gtk.MenuItem("_Cut")); edit.Append(new Gtk.MenuItem("Copy")); edit.Append(new Gtk.MenuItem("_Paste")); Gtk.MenuItem editItem = new Gtk.MenuItem("Edit"); editItem.Submenu = edit; Gtk.MenuBar menuBar = new Gtk.MenuBar(); menuBar.Append(fileItem); menuBar.Append(editItem); hbox.Add(menuBar); hbox.Add(new Gtk.SpinButton(0, 100, 1)); hbox.Add(new Gtk.ToggleButton("ToggleButton")); Gtk.Adjustment adj = new Gtk.Adjustment(50, 0, 100, 1, 10, 10); hbox.Add(new Gtk.VScrollbar(adj)); window.Add(hbox); window.ShowAll(); }
private void CreateMenubar() { menubar = new MenuBar(); // Now define an accelerator group. AccelGroup aGroup = new AccelGroup(); this.AddAccelGroup(aGroup); // Build File menu item. Menu fileMenu = new Menu(); Menu editMenu = new Menu(); Menu viewMenu = new Menu(); Menu helpMenu = new Menu(); MenuItem menuItem = new MenuItem("_File"); MenuItem editItem = new MenuItem("_Edit"); MenuItem viewItem = new MenuItem("_View"); MenuItem helpItem = new MenuItem("_Help"); menuItem.Submenu = fileMenu; editItem.Submenu = editMenu; viewItem.Submenu = viewMenu; helpItem.Submenu = helpMenu; menubar.Append(menuItem); menubar.Append(editItem); menubar.Append(viewItem); menubar.Append(helpItem); // File | New Window | New Tab | Open File | Open Location| Close Tab | Save As | Print | Exit menu Item. MenuItem newWindowItem = new MenuItem("New window"); newWindowItem.Activated += new EventHandler(NewWindow_Activated); fileMenu.Append(newWindowItem); MenuItem newTabItem = new MenuItem("New Tab"); newTabItem.Activated += new EventHandler(NewTab_Activated); fileMenu.Append(newTabItem); MenuItem openFileItem = new MenuItem("Open File"); openFileItem.Activated += new EventHandler(NewTab_Activated); fileMenu.Append(openFileItem); MenuItem openlocationItem = new MenuItem("Open Location"); openlocationItem.Activated += new EventHandler(NewTab_Activated); fileMenu.Append(openlocationItem); MenuItem closeTabItem = new MenuItem("Close Tab"); closeTabItem.Activated += new EventHandler(NewTab_Activated); fileMenu.Append(closeTabItem); MenuItem saveAsItem = new ImageMenuItem(Stock.SaveAs, aGroup); saveAsItem.Activated += new EventHandler(NewTab_Activated); fileMenu.Append(saveAsItem); MenuItem printItem = new ImageMenuItem(Stock.Print, aGroup); printItem.Activated += new EventHandler(NewTab_Activated); fileMenu.Append(printItem); menuItem = new ImageMenuItem(Stock.Quit, aGroup); menuItem.Activated += new EventHandler(FileQuit_Activated); fileMenu.Append(menuItem); // Build Edit -> Undo Redo | Cut Copy Paste Select All menu Item. MenuItem undoItem = new ImageMenuItem(Stock.Undo, aGroup); editMenu.Append(undoItem); MenuItem redoItem = new ImageMenuItem(Stock.Redo, aGroup); editMenu.Append(redoItem); MenuItem cutItem = new ImageMenuItem(Stock.Cut, aGroup); editMenu.Append(cutItem); MenuItem copyItem = new ImageMenuItem(Stock.Copy, aGroup); editMenu.Append(copyItem); MenuItem pasteItem = new ImageMenuItem(Stock.Paste, aGroup); editMenu.Append(pasteItem); MenuItem selectAllItem = new ImageMenuItem(Stock.SelectAll, aGroup); editMenu.Append(selectAllItem); MenuItem findItem = new ImageMenuItem(Stock.Find, aGroup); editMenu.Append(findItem); //Help | Help | About MenuItem aboutItem = new ImageMenuItem(Stock.About, aGroup); aboutItem.Activated += new EventHandler(HelpAbout_Activated); helpMenu.Append(aboutItem); MenuItem helphelpItem = new ImageMenuItem(Stock.Help, aGroup); helphelpItem.Activated += new EventHandler(HelpHelp_Activated); helpMenu.Append(helphelpItem); }
public MenuBar CreateMenuBar () { MenuBar menuBar = new MenuBar (); Menu menu; MenuItem item; MenuItem barItem; // File menu menu = new Menu (); item = new MenuItem ("New SQL# _Window"); item.Activated += new EventHandler (OnMenu_FileNewSqlWindow); menu.Append (item); menu.Append (new SeparatorMenuItem ()); item = new MenuItem ("_New"); item.Activated += new EventHandler (OnMenu_FileNew); menu.Append (item); item = new MenuItem ("_Open..."); item.Activated += new EventHandler (OnMenu_FileOpen); menu.Append (item); item = new MenuItem ("_Save"); item.Activated += new EventHandler (OnMenu_FileSave); menu.Append (item); item = new MenuItem ("Save _As..."); item.Activated += new EventHandler (OnMenu_FileSaveAs); menu.Append (item); item = new MenuItem ("Close"); item.Activated += new EventHandler (OnMenu_FileClose); menu.Append (item); menu.Append (new SeparatorMenuItem ()); item = new MenuItem ("E_xit"); item.Activated += new EventHandler (OnMenu_FileExit); menu.Append (item); barItem = new MenuItem ("_File"); barItem.Submenu = menu; menuBar.Append (barItem); // Edit menu menu = new Menu (); item = new MenuItem ("Clear Text Output"); item.Activated += new EventHandler (OnMenu_EditClearTextOutput); menu.Append (item); /* TODO: do the Edit menu - for now - comment out item = new MenuItem ("Cu_t"); //item.Activated += new EventHandler (OnMenu_EditCut); menu.Append (item); item = new MenuItem ("_Copy"); //item.Activated += new EventHandler (OnMenu_EditCopy); menu.Append (item); item = new MenuItem ("_Paste"); //item.Activated += new EventHandler (OnMenu_EditPaste); menu.Append (item); item = new MenuItem ("_Delete"); //item.Activated += new EventHandler (OnMenu_EditDelete); menu.Append (item); menu.Append (new SeparatorMenuItem ()); item = new MenuItem ("_Find and Replace..."); //item.Activated += new EventHandler (OnMenu_EditFindReplace); menu.Append (item); menu.Append (new SeparatorMenuItem ()); item = new MenuItem ("_Options"); //item.Activated += new EventHandler (OnMenu_EditOptions); menu.Append (item); */ barItem = new MenuItem ("_Edit"); barItem.Submenu = menu; menuBar.Append (barItem); // Session menu menu = new Menu (); item = new MenuItem ("_Connect"); item.Activated += new EventHandler (OnMenu_SessionConnect); menu.Append (item); item = new MenuItem ("_Disconnect"); item.Activated += new EventHandler (OnMenu_SessionDisconnect); menu.Append (item); item = new MenuItem ("_Disconnect All"); item.Activated += new EventHandler (OnMenu_SessionDisconnectAll); menu.Append (item); barItem = new MenuItem ("_Session"); barItem.Submenu = menu; menuBar.Append (barItem); // Command menu menu = new Menu (); item = new MenuItem ("_Execute Command"); item.Activated += new EventHandler (OnMenu_CommandExecuteCommand); menu.Append (item); item = new MenuItem ("_Execute Script"); item.Activated += new EventHandler (OnMenu_CommandExecuteScript); menu.Append (item); item = new MenuItem ("_Execute With Output to XML"); item.Activated += new EventHandler (OnMenu_CommandExecuteXML); menu.Append (item); item = new MenuItem ("_Execute With Output to CSV"); item.Activated += new EventHandler (OnMenu_CommandExecuteCSV); menu.Append (item); barItem = new MenuItem ("_Command"); barItem.Submenu = menu; menuBar.Append (barItem); // Help menu // Command menu menu = new Menu (); item = new MenuItem ("_About"); item.Activated += new EventHandler (OnMenu_HelpAbout); menu.Append (item); barItem = new MenuItem ("_Help"); barItem.Submenu = menu; menuBar.Append (barItem); return menuBar; }
void CreateMenuBar() { topMenu = new Gtk.MenuBar(); Menu fileMenu = new Menu(); MenuItem file = new MenuItem("File"); file.Submenu = fileMenu; AccelGroup agr = new AccelGroup(); AddAccelGroup(agr); ImageMenuItem exit = new ImageMenuItem(Stock.Quit, agr); exit.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.q, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); exit.Activated += onButtonPressEvent; fileMenu.Append(exit); topMenu.Append(file); ((VBox)fullViewVBox).PackStart (topMenu, false, false, 0); ((Gtk.Box.BoxChild) fullViewVBox [topMenu]).Position = 0; topMenu.ShowAll (); }
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; }
private MenuBar CreateWelcomeMenuBar() { MenuBar menubar = new MenuBar (); AccelGroup agrp = new AccelGroup(); this.AddAccelGroup(agrp); Menu menu = new Menu(); ImageMenuItem imageMenuItem = new ImageMenuItem (Util.GS("Connect to a _server")); Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(Util.ImagesPath("add-account.png")); pixbuf = pixbuf.ScaleSimple(24, 24, Gdk.InterpType.Bilinear); imageMenuItem.Image = new Image(pixbuf); menu.Append(imageMenuItem); imageMenuItem.AddAccelerator("activate", agrp, new AccelKey(Gdk.Key.S, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); imageMenuItem.Activated += new EventHandler(OnAddNewAccount); menu.Append(new SeparatorMenuItem()); imageMenuItem = new ImageMenuItem (Stock.Close, agrp); menu.Append(imageMenuItem); imageMenuItem.Activated += new EventHandler(CloseEventHandler); imageMenuItem = new ImageMenuItem(Stock.Quit, agrp); menu.Append(imageMenuItem); imageMenuItem.Activated += new EventHandler(QuitEventHandler); MenuItem menuItem = new MenuItem(Util.GS("i_Folder")); menuItem.Submenu = menu; menubar.Append (menuItem); menu = new Menu(); imageMenuItem = new ImageMenuItem(Util.GS("_Preferences")); imageMenuItem.Image = new Image(Stock.Preferences, Gtk.IconSize.Menu); menu.Append(imageMenuItem); imageMenuItem.Activated += new EventHandler(ShowPreferencesHandler); menuItem = new MenuItem(Util.GS("_Edit")); menuItem.Submenu = menu; menubar.Append(menuItem); menu = new Menu(); imageMenuItem = new ImageMenuItem(Stock.Help, agrp); menu.Append(imageMenuItem); imageMenuItem.Activated += new EventHandler(OnHelpMenuItem); imageMenuItem = new ImageMenuItem(Util.GS("A_bout")); imageMenuItem.Image = new Image(Gnome.Stock.About, Gtk.IconSize.Menu); menu.Append(imageMenuItem); imageMenuItem.Activated += new EventHandler(OnAbout); menuItem = new MenuItem(Util.GS("_Help")); menuItem.Submenu = menu; menubar.Append(menuItem); return menubar; }
public Gui() { dlayer = new DataLayer (); window_addtag.SetSizeRequest (100, 100); window.Icon = new Gdk.Pixbuf ("lipsticktower.jpg"); //Kalle, Andreas :: Call for Icon! Gtk.Entry tagEntry = new Gtk.Entry (); Gtk.VBox tagbox = new Gtk.VBox (false, 0); tagbox.PackStart (tagEntry, true, true, 0); window_addtag.Add (tagbox); window_addtag.ShowAll (); window.SetSizeRequest (300, 500); window.DeleteEvent += DeleteEvent; window.Icon = new Gdk.Pixbuf ("lipsticktower.jpg"); //Kalle, Andreas :: Call for Icon! Gtk.VBox box = new Gtk.VBox (false, 0); Gtk.HBox top = new Gtk.HBox (false, 0); //Gtk.ComboBox selector = new Gtk.ComboBox (); Gtk.ComboBox selector = ComboBox.NewText (); ScrolledWindow scroll = new ScrolledWindow (); filterEntry = new Gtk.Entry (); filterEntry.MaxLength = 1; filterEntry.Changed += OnFilterEntryTextChanged; //Gtk.TreeView tree = new Gtk.TreeView (); tree.HeadersVisible = false; tree.Reorderable = true; tree.EnableSearch = false; tree.RowActivated += OnRowActivate; Gtk.TreeViewColumn iconCol = new Gtk.TreeViewColumn ( ); iconCol.Title = "Icon"; Gtk.CellRendererPixbuf iconCell = new Gtk.CellRendererPixbuf (); iconCol.PackStart (iconCell, true); iconCol.SetCellDataFunc (iconCell, new Gtk.TreeCellDataFunc (RenderIcon)); Gtk.TreeViewColumn primCol = new Gtk.TreeViewColumn ( ); primCol.Title = "Primary Info"; Gtk.CellRendererText primInfoCell = new Gtk.CellRendererText (); primCol.PackStart (primInfoCell, true); primCol.SetCellDataFunc (primInfoCell, new Gtk.TreeCellDataFunc (RenderPrimary)); Gtk.TreeViewColumn secCol = new Gtk.TreeViewColumn ( ); secCol.Title = "Secondary Info"; Gtk.CellRendererText secInfoCell = new Gtk.CellRendererText (); secCol.PackStart (secInfoCell, true); secCol.SetCellDataFunc (secInfoCell, new Gtk.TreeCellDataFunc (RenderSecondary)); projects = DataLayer.GetProjectNames (); foreach (string project in projects) { Console.WriteLine (project); selector.AppendText (project); } selector.Changed += new EventHandler (OnSelectorChanged); //Store AssetStore = dlayer.GetAssets (projID); /*filter = new Gtk.TreeModelFilter (AssetStore, null); filter.VisibleFunc = new Gtk.TreeModelFilterVisibleFunc (FilterTree); tree.Model = filter;*/ //tree.Model = dlayer.GetAssets (projID); tree.AppendColumn (iconCol); tree.AppendColumn (primCol); tree.AppendColumn (secCol); MenuBar menu = new MenuBar (); Menu fileMenu = new Menu(); MenuItem menuItem = new MenuItem("_File"); menuItem.Submenu = fileMenu; menu.Append(menuItem); Statusbar status = new Statusbar (); Toolbar tool = new Toolbar (); ToolButton plus = new ToolButton (Gtk.Stock.Add); plus.Clicked += OnAddClicked; ToolButton minus = new ToolButton (Gtk.Stock.Remove); minus.Clicked += OnMinusClicked; box.PackStart (menu, false, true, 0); box.PackStart (tool, false, true, 0); tool.Insert(minus, 0); tool.Insert(plus, 0); top.PackStart (filterEntry, true, true, 0); top.PackStart (selector, true, true, 0); box.PackStart (top, false, true, 0); scroll.Add (tree); box.PackStart (scroll, true, true, 0); box.PackStart (status, false, true, 0); window.Add (box); window.ShowAll (); }
/// <summary>Crea el menu de la aplicacion</summary> /// <returns>El menu superior de la ventana</returns> private MenuBar crearMenu() { menu = new MenuBar(); group = new AccelGroup(); menuArchivo = new Menu(); menuAyuda = new Menu(); menuConsola = new Menu(); menuConsolaZoom = new Menu(); menuItemConsola = new MenuItem("_Emulacion"); menuItemArchivo = new MenuItem("_Archivo"); menuItemAyuda = new MenuItem("A_yuda"); menuItemAyudaAcerca = new MenuItem("A_cerca de..."); menuItemConsolaZoom = new MenuItem("_Zoom"); menuItemConsolaZoom1x = new MenuItem("1x"); menuItemConsolaZoom2x = new MenuItem("2x"); menuItemConsolaZoom3x = new MenuItem("3x"); menuItemConsolaZoom4x = new MenuItem("4x"); menuItemConsolaIniciar = new MenuItem("_Iniciar"); menuItemConsolaReset = new MenuItem("Re_set"); menuItemConsolaReanudar = new MenuItem("_Reanudar"); menuItemConsolaPausa = new MenuItem("_Pausa"); menuItemConsolaParar = new MenuItem("Pa_rar"); menuItemConsolaDebug = new MenuItem("_Debug"); menuItemArchivoSalir = new ImageMenuItem(Gtk.Stock.Quit, group); menuItemArchivoAbrir = new ImageMenuItem(Gtk.Stock.Open, group); menuItemAyuda.Submenu = menuAyuda; menuAyuda.Append(menuItemAyudaAcerca); menuItemArchivo.Submenu = menuArchivo; menuArchivo.Append(menuItemArchivoAbrir); menuArchivo.Append(menuItemArchivoSalir); menuItemConsola.Submenu = menuConsola; menuConsola.Append(menuItemConsolaZoom); menuConsola.Append(menuItemConsolaIniciar); menuConsola.Append(menuItemConsolaReanudar); menuConsola.Append(menuItemConsolaPausa); menuConsola.Append(menuItemConsolaParar); menuConsola.Append(menuItemConsolaDebug); menuConsolaZoom.Append(menuItemConsolaZoom1x); menuConsolaZoom.Append(menuItemConsolaZoom2x); menuConsolaZoom.Append(menuItemConsolaZoom3x); menuConsolaZoom.Append(menuItemConsolaZoom4x); menuItemConsolaZoom.Submenu = menuConsolaZoom; menu.Append(menuItemArchivo); menu.Append(menuItemConsola); menu.Append(menuItemAyuda); menuItemAyuda.RightJustified = true; menuItemConsolaIniciar.Sensitive = false; menuItemConsolaReanudar.Sensitive = false; menuItemConsolaPausa.Sensitive = false; menuItemConsolaParar.Sensitive = false; menuItemConsolaDebug.Sensitive = false; menuItemArchivoSalir.Activated += new EventHandler(Exit_App); menuItemArchivoAbrir.Activated += new EventHandler(Open_File); menuItemConsolaParar.Activated += new EventHandler(Stop_Emu); menuItemConsolaPausa.Activated += new EventHandler(Pause_Emu); menuItemConsolaIniciar.Activated += new EventHandler(Start_Emu); menuItemConsolaReset.Activated += new EventHandler(Reset_Emu); menuItemConsolaReanudar.Activated += new EventHandler(Resume_Emu); menuItemConsolaZoom1x.Activated += new EventHandler(Zoom_1x); menuItemConsolaZoom2x.Activated += new EventHandler(Zoom_2x); menuItemConsolaZoom3x.Activated += new EventHandler(Zoom_3x); menuItemConsolaZoom4x.Activated += new EventHandler(Zoom_4x); menuItemConsolaDebug.Activated += new EventHandler(Debug); menuItemAyudaAcerca.Activated += new EventHandler(About); return menu; }
private void CreateMainMenu(VBox shell) { // Main menu main_menu = new MenuBar () { Name = "main_menu" }; main_menu.Append (new Gtk.Action ("file", Catalog.GetString ("_File")).CreateMenuItem ()); main_menu.Append (new Gtk.Action ("edit", Catalog.GetString ("_Edit")).CreateMenuItem ()); view_menu = (MenuItem)new Gtk.Action ("view", Catalog.GetString ("_View")).CreateMenuItem (); main_menu.Append (view_menu); main_menu.Append (new Gtk.Action ("image", Catalog.GetString ("_Image")).CreateMenuItem ()); main_menu.Append (new Gtk.Action ("layers", Catalog.GetString ("_Layers")).CreateMenuItem ()); main_menu.Append (new Gtk.Action ("adjustments", Catalog.GetString ("_Adjustments")).CreateMenuItem ()); main_menu.Append (new Gtk.Action ("effects", Catalog.GetString ("Effe_cts")).CreateMenuItem ()); window_menu = (MenuItem)new Gtk.Action ("window", Catalog.GetString ("_Window")).CreateMenuItem (); window_menu.Submenu = new Menu (); main_menu.Append (window_menu); Gtk.Action pads = new Gtk.Action ("pads", Mono.Unix.Catalog.GetString ("Show Pad"), null, null); view_menu.Submenu = new Menu (); show_pad = (Menu)((Menu)(view_menu.Submenu)).AppendItem (pads.CreateSubMenuItem ()).Submenu; main_menu.Append (new Gtk.Action ("help", Catalog.GetString ("_Help")).CreateMenuItem ()); PintaCore.Actions.CreateMainMenu (main_menu); shell.PackStart (main_menu, false, false, 0); }
public DemoMain () { window = new Gtk.Window ("TestForm1"); Gtk.HBox hbox = new Gtk.HBox (false, 0); hbox1 = new Gtk.HBox (false, 0); Gtk.HBox hbox2 = new Gtk.HBox (false, 0); Gtk.HBox hbox3 = new Gtk.HBox (false, 0); hbox.Add (hbox1); window.SetDefaultSize (600, 400); window.DeleteEvent += new DeleteEventHandler (WindowDelete); button1 = new Gtk.Button ("button1"); button1.Clicked += Button1Clicked; button2 = new Gtk.Button ("button2"); button3 = new Gtk.Button ("button3"); Gtk.Button button4 = new Gtk.Button ("button4"); button4.Clicked += Button4Clicked; Gtk.Button button5 = new Gtk.Button ("button5"); Gtk.Button button6 = new Gtk.Button ("button6"); Gtk.Button button7 = new Gtk.Button ("button7"); button7.Sensitive = false; scaleButton1 = new Gtk.ScaleButton (0, 0, 100, 10, new string [0]); hbox1.Add (hbox3); hbox1.Add (hbox2); hbox1.Add (button3); hbox1.Add (button2); button3.Accessible.Description = "help text 3"; button3.Sensitive = false; label1 = new Gtk.Label ("label1"); textBox1 = new Gtk.Entry (); Gtk.Entry textBox2 = new Gtk.Entry (); textBox2.Visibility = false; textBox2.Sensitive = false; textBox2.IsEditable = false; textBox3 = new Gtk.TextView (); // TODO: scrollbars Gtk.CheckButton checkbox1 = new Gtk.CheckButton ("checkbox1"); Gtk.CheckButton checkbox2 = new Gtk.CheckButton ("checkbox2"); checkbox2.Sensitive = false; Gtk.TreeStore store = new Gtk.TreeStore (typeof (string), typeof (string)); Gtk.TreeIter [] iters = new Gtk.TreeIter [2]; iters [0] = store.AppendNode (); store.SetValues (iters [0], "item 1", "item 1 (2)"); iters [1] = store.AppendNode (iters [0]); store.SetValues (iters [1], "item 1a", "item 1a (2)"); iters [0] = store.AppendNode (); store.SetValues (iters [0], "item 2", "item 2 (2)"); iters [1] = store.AppendNode (iters [0]); store.SetValues (iters [1], "item 2a", "item 2a (2)"); iters [1] = store.AppendNode (iters [0]); store.SetValues (iters [1], "item 2b", "item 2b (2)"); treeView1 = new Gtk.TreeView (store); AddTreeViewColumn (treeView1, 0, "column 1"); treeView1.CollapseAll (); treeView2 = new Gtk.TreeView (store); AddTreeViewColumn (treeView2, 0, "column 1"); AddTreeViewColumn (treeView2, 1, "column 2"); treeView2.CollapseAll (); treeView2.Accessible.Name = "treeView2"; tableStore = new Gtk.TreeStore (typeof (string), typeof (string), typeof (string), typeof (string)); iters [0] = tableStore.AppendNode (); tableStore.SetValues (iters [0], "False", "Alice", "24", ""); iters [0] = tableStore.AppendNode (); tableStore.SetValues (iters [0], "True", "Bob", "28", ""); dataGridView1 = new Gtk.TreeView (tableStore); dataGridView1 = new Gtk.TreeView (tableStore); dataGridView1 = new Gtk.TreeView (tableStore); AddTreeViewColumn (dataGridView1, 0, "Gender"); AddTreeViewColumn (dataGridView1, 1, "Name"); AddTreeViewColumn (dataGridView1, 2, "Age"); dataGridView1.Accessible.Name = "dataGridView1"; hboxPanel = new Gtk.HBox (); Gtk.Button btnRemoveTextBox = new Gtk.Button ("Remove"); btnRemoveTextBox.Clicked += RemoveTextBoxClicked; Gtk.Button btnAddTextBox = new Gtk.Button ("Add"); btnAddTextBox.Clicked += AddTextBoxClicked; txtCommand = new Gtk.Entry (); txtCommand.Accessible.Name = "txtCommand"; Gtk.Button btnRun = new Gtk.Button ("Run"); btnRun.Clicked += btnRunClicked; hboxPanel.Add (btnRemoveTextBox); hboxPanel.Add (btnAddTextBox); Gtk.TreeStore treeStore = new Gtk.TreeStore (typeof (string)); Gtk.TreeIter iter = treeStore.AppendNode (); treeStore.SetValue (iter, 0, "Item 0"); iter = treeStore.AppendNode (); treeStore.SetValue (iter, 0, "Item 1"); listView1 = new Gtk.TreeView (treeStore); AddTreeViewColumn (listView1, 0, "items"); listView1.Accessible.Name = "listView1"; listView1.ExpandAll (); hbox2.Add (button5); hbox2.Add (checkbox1); hbox2.Add (checkbox2); hbox2.Add (button4); hbox2.Accessible.Name = "groupBox2"; hbox3.Add (button7); hbox3.Add (button6); hbox3.Sensitive = false; hbox3.Accessible.Name = "groupBox3"; hbox.Add (textBox3); hbox.Add (textBox2); hbox.Add (textBox1); hbox.Add (label1); hbox.Add (button1); hbox.Add (treeView1); hbox.Add (treeView2); hbox.Add (listView1); hbox.Add (dataGridView1); hbox.Add (txtCommand); hbox.Add (btnRun); hbox.Add (hboxPanel); hbox.Add (scaleButton1); Gtk.Menu file = new Gtk.Menu (); file.Append (new Gtk.MenuItem ("_New")); file.Append (new Gtk.MenuItem ("_Open")); file.Append (new Gtk.CheckMenuItem ("Check")); Gtk.MenuItem fileItem = new Gtk.MenuItem ("File"); fileItem.Submenu = file; Gtk.Menu edit = new Gtk.Menu (); edit.Append (new Gtk.MenuItem ("_Undo")); edit.Append (new Gtk.SeparatorMenuItem ()); edit.Append (new Gtk.MenuItem ("_Cut")); edit.Append (new Gtk.MenuItem ("Copy")); edit.Append (new Gtk.MenuItem ("_Paste")); Gtk.MenuItem editItem = new Gtk.MenuItem ("Edit"); editItem.Submenu = edit; Gtk.MenuBar menuBar = new Gtk.MenuBar (); menuBar.Append (fileItem); menuBar.Append (editItem); hbox.Add (menuBar); hbox.Add (new Gtk.SpinButton (0, 100, 1)); hbox.Add (new Gtk.ToggleButton ("ToggleButton")); Gtk.Adjustment adj = new Gtk.Adjustment (50, 0, 100, 1, 10, 10); hbox.Add (new Gtk.VScrollbar (adj)); window.Add (hbox); window.ShowAll (); }
public RatingEntryTestModule() : base("Rating Entry") { VBox pbox = new VBox (); Add (pbox); Menu m = new Menu (); MenuBar b = new MenuBar (); MenuItem item = new MenuItem ("Rate Me!"); item.Submenu = m; b.Append (item); m.Append (new MenuItem ("Apples")); m.Append (new MenuItem ("Pears")); m.Append (new RatingMenuItem ()); m.Append (new ImageMenuItem ("gtk-remove", null)); m.ShowAll (); pbox.PackStart (b, false, false, 0); VBox box = new VBox (); box.BorderWidth = 10; box.Spacing = 10; pbox.PackStart (box, true, true, 0); RatingEntry entry1 = new RatingEntry (); box.PackStart (entry1, true, true, 0); RatingEntry entry2 = new RatingEntry (); box.PackStart (entry2, false, false, 0); box.PackStart (new Entry ("Normal GtkEntry"), false, false, 0); RatingEntry entry3 = new RatingEntry (); Pango.FontDescription fd = entry3.PangoContext.FontDescription.Copy (); fd.Size = (int)(fd.Size * Pango.Scale.XXLarge); entry3.OverrideFont (fd); fd.Dispose (); box.PackStart (entry3, true, true, 0); pbox.ShowAll (); }
// }}} // MainWindow::_createMenuBar() {{{ /// <summary>Build main window's menu bar.</summary> /// <returns>void</returns> private void _createMenuBar() { MenuBar mBar = new MenuBar(); AccelGroup group = new AccelGroup(); this.AddAccelGroup(group); // file Menu mFile = new Menu(); MenuItem miFile = new MenuItem("_File"); miFile.Submenu = mFile; mBar.Append(miFile); // file->open ImageMenuItem miOpen = new ImageMenuItem(Stock.Open, group); miOpen.AddAccelerator("activate", group, new AccelKey(Gdk.Key.o, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); miOpen.Activated += new EventHandler(onMenuItemOpenActivate); mFile.Append(miOpen); // file->quit ImageMenuItem miExit = new ImageMenuItem(Stock.Quit, group); miExit.AddAccelerator("activate", group, new AccelKey(Gdk.Key.q, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); miExit.Activated += new EventHandler(onMenuItemExitActivate); mFile.Append(miExit); // edit Menu mEdit = new Menu(); MenuItem miEdit = new MenuItem("_Edit"); miEdit.Submenu = mEdit; mBar.Append(miEdit); // edit->preferences ImageMenuItem miPref = new ImageMenuItem(Stock.Preferences, group); miPref.AddAccelerator("activate", group, new AccelKey(Gdk.Key.o, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); miPref.Activated += new EventHandler(onMenuItemPrefActivate); mEdit.Append(miPref); // Help Menu mQuestion = new Menu(); MenuItem miQuestion = new MenuItem("_Help"); miQuestion.Submenu = mQuestion; mBar.Append(miQuestion); // Help / About MenuItem miAbout = new MenuItem("_About"); miAbout.Activated += new EventHandler(onMenuItemAboutActivate); mQuestion.Append(miAbout); this._vBox.PackStart(mBar, false, true, 0); }
private MenuBar CreateNormalMenu() { MenuBar menubar = new MenuBar (); AccelGroup agrp = new AccelGroup(); this.AddAccelGroup(agrp); Menu iFolderMenu = new Menu(); NewMenuItem = new ImageMenuItem (Util.GS("_Upload a folder...")); NewMenuItem.Image = new Image( new Gdk.Pixbuf(Util.ImagesPath("ifolder24.png"))); iFolderMenu.Append(NewMenuItem); NewMenuItem.AddAccelerator("activate", agrp, new AccelKey(Gdk.Key.N, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); NewMenuItem.Activated += new EventHandler(AddiFolderHandler); DownloadMenuItem = new MenuItem (Util.GS("_Download...")); iFolderMenu.Append(DownloadMenuItem); DownloadMenuItem.Activated += new EventHandler(DownloadAvailableiFolderHandler); DeleteMenuItem = new ImageMenuItem (Util.GS("Dele_te from server")); DeleteMenuItem.Image = new Image(Stock.Delete, Gtk.IconSize.Menu); iFolderMenu.Append(DeleteMenuItem); DeleteMenuItem.Activated += new EventHandler(DeleteFromServerHandler); RemoveMenuItem = new ImageMenuItem (Util.GS("Re_move my membership")); RemoveMenuItem.Image = new Image(Stock.Delete, Gtk.IconSize.Menu); iFolderMenu.Append(RemoveMenuItem); RemoveMenuItem.Activated += new EventHandler(RemoveMembershipHandler); iFolderMenu.Append(new SeparatorMenuItem()); OpenMenuItem = new ImageMenuItem ( Stock.Open, agrp ); iFolderMenu.Append(OpenMenuItem); OpenMenuItem.Activated += new EventHandler(OnOpenSynchronizedFolder); ShareMenuItem = new MenuItem (Util.GS("Share _with...")); iFolderMenu.Append(ShareMenuItem); ShareMenuItem.Activated += new EventHandler(OnShareSynchronizedFolder); ConflictMenuItem = new MenuItem (Util.GS("Resolve conflic_ts")); iFolderMenu.Append(ConflictMenuItem); ConflictMenuItem.Activated += new EventHandler(OnResolveConflicts); SyncNowMenuItem = new MenuItem(Util.GS("S_ynchronize now")); iFolderMenu.Append(SyncNowMenuItem); SyncNowMenuItem.Activated += new EventHandler(OnSynchronizeNow); RevertMenuItem = new ImageMenuItem (Util.GS("C_hange to a normal folder")); RevertMenuItem.Image = new Image(Stock.Undo, Gtk.IconSize.Menu); iFolderMenu.Append(RevertMenuItem); RevertMenuItem.Activated += new EventHandler(RemoveiFolderHandler); PropMenuItem = new ImageMenuItem (Stock.Properties, agrp); iFolderMenu.Append(PropMenuItem); PropMenuItem.Activated += new EventHandler(OnShowFolderProperties); iFolderMenu.Append(new SeparatorMenuItem()); CloseMenuItem = new ImageMenuItem (Stock.Close, agrp); iFolderMenu.Append(CloseMenuItem); CloseMenuItem.Activated += new EventHandler(CloseEventHandler); QuitMenuItem = new ImageMenuItem(Stock.Quit, agrp); iFolderMenu.Append(QuitMenuItem); QuitMenuItem.Activated += new EventHandler(QuitEventHandler); MenuItem iFolderMenuItem = new MenuItem(Util.GS("i_Folder")); iFolderMenuItem.Submenu = iFolderMenu; menubar.Append (iFolderMenuItem); Menu EditMenu = new Menu(); AccountsMenuItem = new MenuItem (Util.GS("_Account Settings...")); EditMenu.Append(AccountsMenuItem); AccountsMenuItem.Activated += new EventHandler(AccountsMenuItemHandler); PreferencesMenuItem = new ImageMenuItem(Util.GS("_Preferences")); PreferencesMenuItem.Image = new Image(Stock.Preferences, Gtk.IconSize.Menu); EditMenu.Append(PreferencesMenuItem); PreferencesMenuItem.Activated += new EventHandler(ShowPreferencesHandler); MenuItem EditMenuItem = new MenuItem(Util.GS("_Edit")); EditMenuItem.Submenu = EditMenu; menubar.Append(EditMenuItem); Menu ViewMenu = new Menu(); RefreshMenuItem = new ImageMenuItem(Stock.Refresh, agrp); ViewMenu.Append(RefreshMenuItem); RefreshMenuItem.Activated += new EventHandler(RefreshiFoldersHandler); ViewMenu.Append(new SeparatorMenuItem()); SyncLogMenuItem = new MenuItem (Util.GS("Synchronization _Log")); ViewMenu.Append(SyncLogMenuItem); SyncLogMenuItem.Activated += new EventHandler(SyncLogMenuItemHandler); ViewMenu.Append(new SeparatorMenuItem()); ViewServeriFoldersMenuItem = new CheckMenuItem(Util.GS("View _available iFolders")); ViewMenu.Append(ViewServeriFoldersMenuItem); ViewServeriFoldersMenuItem.Toggled += new EventHandler(OnToggleViewServeriFoldersMenuItem); MenuItem showColorPaletteMenuItem = new MenuItem("Show _Color Palette (FIXME: Remove this before shipping)..."); ViewMenu.Append(showColorPaletteMenuItem); showColorPaletteMenuItem.Activated += ShowColorPalette; MenuItem ViewMenuItem = new MenuItem(Util.GS("_View")); ViewMenuItem.Submenu = ViewMenu; menubar.Append(ViewMenuItem); Menu HelpMenu = new Menu(); HelpMenuItem = new ImageMenuItem(Stock.Help, agrp); HelpMenu.Append(HelpMenuItem); HelpMenuItem.Activated += new EventHandler(OnHelpMenuItem); AboutMenuItem = new ImageMenuItem(Util.GS("A_bout")); AboutMenuItem.Image = new Image(Gnome.Stock.About, Gtk.IconSize.Menu); HelpMenu.Append(AboutMenuItem); AboutMenuItem.Activated += new EventHandler(OnAbout); MenuItem MainHelpMenuItem = new MenuItem(Util.GS("_Help")); MainHelpMenuItem.Submenu = HelpMenu; menubar.Append(MainHelpMenuItem); return menubar; }
/// <summary> /// Initializes all GUI components. /// </summary> /// <history> /// [Curtis_Beard] 11/03/2006 Created /// </history> private void InitializeComponent() { this.SetDefaultSize (Core.GeneralSettings.WindowWidth, Core.GeneralSettings.WindowHeight); if (Core.GeneralSettings.WindowLeft == -1 && Core.GeneralSettings.WindowTop == -1) this.SetPosition(WindowPosition.Center); else this.Move(Core.GeneralSettings.WindowLeft, Core.GeneralSettings.WindowTop); this.DeleteEvent += new DeleteEventHandler(OnWindowDelete); this.Title = Constants.ProductName; this.Icon = Images.GetPixbuf("AstroGrep_Icon.ico"); MainTooltips = new Tooltips(); VBox vbox = new VBox(); vbox.BorderWidth = 0; Frame leftFrame = new Frame(); leftFrame.Shadow = ShadowType.In; leftFrame.WidthRequest = 200; VBox searchBox = new VBox(); VBox searchOptionsBox = new VBox(); searchBox.BorderWidth = 3; searchOptionsBox.BorderWidth = 3; lblSearchStart = new Label("Search Path"); lblSearchStart.SetAlignment(0,0); btnBrowse = new Button(); btnBrowse.SetSizeRequest(32, 20); Gtk.Image img = new Image(); img.Pixbuf = Images.GetPixbuf("folder-open.png"); VBox browseBox = new VBox(); browseBox.PackStart(img, false, false, 0); MainTooltips.SetTip(btnBrowse, "Select the folder to start the search", ""); btnBrowse.Clicked += new EventHandler(btnBrowse_Clicked); btnBrowse.Add(browseBox); cboSearchStart = ComboBoxEntry.NewText(); cboSearchFilter = ComboBoxEntry.NewText(); cboSearchText = ComboBoxEntry.NewText(); LoadComboBoxEntry(cboSearchStart, Core.GeneralSettings.SearchStarts, true); LoadComboBoxEntry(cboSearchFilter, Core.GeneralSettings.SearchFilters, false); LoadComboBoxEntry(cboSearchText, Core.GeneralSettings.SearchTexts, false); cboSearchStart.Changed += new EventHandler(cboSearchStart_Changed); lblSearchFilter = new Label("File Types"); lblSearchFilter.SetAlignment(0,0); lblSearchText = new Label("Search Text"); lblSearchText.SetAlignment(0,0); // search path VBox startVBox = new VBox(); startVBox.BorderWidth = 0; cboSearchStart.WidthRequest = 100; SetActiveComboBoxEntry(cboSearchStart); HBox startHBox = new HBox(); startHBox.BorderWidth = 0; startHBox.PackStart(cboSearchStart, true, true, 0); startHBox.PackEnd(btnBrowse, false, false, 0); startVBox.PackStart(lblSearchStart, false, false, 0); startVBox.PackStart(startHBox, true, false, 0); searchBox.PackStart(startVBox, true, false, 0); // search filter VBox filterVBox = new VBox(); cboSearchFilter.Active = 0; filterVBox.BorderWidth = 0; filterVBox.PackStart(lblSearchFilter, false, false, 0); filterVBox.PackStart(cboSearchFilter, true, false, 0); searchBox.PackStart(filterVBox, true, false, 0); // search text VBox textVBox = new VBox(); cboSearchText.Active = 0; textVBox.BorderWidth = 0; textVBox.PackStart(lblSearchText, false, false, 0); textVBox.PackStart(cboSearchText, true, false, 0); searchBox.PackStart(textVBox, true, false, 0); // Search/Cancel buttons searchBox.PackStart(CreateButtons(), false, false, 0); // Search Options chkRegularExpressions = new CheckButton("Regular Expressions"); chkCaseSensitive = new CheckButton("Case Sensitive"); chkWholeWord = new CheckButton("Whole Word"); chkRecurse = new CheckButton("Recurse"); chkFileNamesOnly = new CheckButton("Show File Names Only"); chkFileNamesOnly.Clicked += new EventHandler(chkFileNamesOnly_Clicked); chkNegation = new CheckButton("Negation"); chkNegation.Clicked += new EventHandler(chkNegation_Clicked); chkLineNumbers = new CheckButton("Line Numbers"); cboContextLines = ComboBox.NewText(); cboContextLines.WidthRequest = 100; cboContextLines.WrapWidth = 3; for (int i = 0; i <= Constants.MAX_CONTEXT_LINES; i++) cboContextLines.AppendText(i.ToString()); lblContextLines = new Label("Context Lines"); HBox cxtBox = new HBox(); cxtBox.BorderWidth = 0; cxtBox.PackStart(cboContextLines, false, false, 3); cxtBox.PackStart(lblContextLines, false, false, 3); searchOptionsBox.PackStart(chkRegularExpressions, true, false, 0); searchOptionsBox.PackStart(chkCaseSensitive, true, false, 0); searchOptionsBox.PackStart(chkWholeWord, true, false, 0); searchOptionsBox.PackStart(chkRecurse, true, false, 0); searchOptionsBox.PackStart(chkFileNamesOnly, true, false, 0); searchOptionsBox.PackStart(chkNegation, true, false, 0); searchOptionsBox.PackStart(chkLineNumbers, true, false, 0); searchOptionsBox.PackStart(cxtBox, true, false, 0); searchBox.PackEnd(searchOptionsBox, true, true, 0); leftFrame.Add(searchBox); panelLeft = new HPaned(); panelLeft.BorderWidth = 0; panelRight = new VPaned(); panelRight.BorderWidth = 0; // File List Gtk.Frame treeFrame = new Gtk.Frame(); treeFrame.Shadow = ShadowType.In; Gtk.ScrolledWindow treeWin = new Gtk.ScrolledWindow(); tvFiles = new Gtk.TreeView (); SetColumnsText(); tvFiles.Model = new ListStore(typeof (string), typeof (string), typeof (string), typeof (string), typeof (int)); (tvFiles.Model as ListStore).DefaultSortFunc = new TreeIterCompareFunc(DefaultTreeIterCompareFunc); tvFiles.Selection.Changed += new EventHandler(Tree_OnSelectionChanged); tvFiles.RowActivated += new RowActivatedHandler(tvFiles_RowActivated); tvFiles.RulesHint = true; tvFiles.HeadersClickable = true; tvFiles.HeadersVisible = true; tvFiles.Selection.Mode = SelectionMode.Multiple; SetSortingFunctions(); treeWin.Add(tvFiles); treeFrame.BorderWidth = 0; treeFrame.Add(treeWin); // txtHits Gtk.Frame ScrolledWindowFrm = new Gtk.Frame(); ScrolledWindowFrm.Shadow = ShadowType.In; Gtk.ScrolledWindow TxtViewWin = new Gtk.ScrolledWindow(); txtViewer = new Gtk.TextView(); txtViewer.Buffer.Text = ""; txtViewer.Editable = false; TxtViewWin.Add(txtViewer); ScrolledWindowFrm.BorderWidth = 0; ScrolledWindowFrm.Add(TxtViewWin); // Add file list and txtHits to right panel panelRight.Pack1(treeFrame, true, true); panelRight.Pack2(ScrolledWindowFrm, true, true); // TLW //Notebook notebook = new Notebook(); // Table table = new Table(3, 6); // Create a new notebook, place the position of the tabs // table.attach(notebook, 0, 6, 0, 1); // Status Bar sbStatus = new Statusbar(); #region Menu bar agMenuAccel = new AccelGroup(); this.AddAccelGroup(agMenuAccel); mbMain = new Gtk.MenuBar(); // File menu mnuFile = new Menu(); MenuItem mnuFileItem = new MenuItem("_File"); mnuFileItem.Submenu = mnuFile; mnuFile.AccelGroup = agMenuAccel; mnuFile.Shown += new EventHandler(mnuFile_Shown); // Edit menu mnuEdit = new Menu(); MenuItem mnuEditItem = new MenuItem("_Edit"); mnuEditItem.Submenu = mnuEdit; mnuEdit.AccelGroup = agMenuAccel; mnuEdit.Shown += new EventHandler(mnuEdit_Shown); // Tools menu mnuTools = new Menu(); MenuItem mnuToolsItem = new MenuItem("_Tools"); mnuToolsItem.Submenu = mnuTools; mnuTools.AccelGroup = agMenuAccel; // Help menu mnuHelp = new Menu(); MenuItem mnuHelpItem = new MenuItem("_Help"); mnuHelpItem.Submenu = mnuHelp; mnuHelp.AccelGroup = agMenuAccel; // File Save menu item SaveMenuItem = new ImageMenuItem(Stock.Save, agMenuAccel); SaveMenuItem.Activated += new EventHandler(SaveMenuItem_Activated); mnuFile.Append(SaveMenuItem); // File Print menu item PrintMenuItem = new ImageMenuItem(Stock.Print, agMenuAccel); PrintMenuItem.Activated += new EventHandler(PrintMenuItem_Activated); mnuFile.Append(PrintMenuItem); // File Separator menu item SeparatorMenuItem Separator1MenuItem = new SeparatorMenuItem(); mnuFile.Append(Separator1MenuItem); // File Exit menu item ExitMenuItem = new ImageMenuItem(Stock.Quit, agMenuAccel); ExitMenuItem.Activated += new EventHandler(ExitMenuItem_Activated); mnuFile.Append(ExitMenuItem); // Edit Select All menu item SelectAllMenuItem = new ImageMenuItem("_Select All Files", agMenuAccel); SelectAllMenuItem.Activated += new EventHandler(SelectAllMenuItem_Activated); mnuEdit.Append(SelectAllMenuItem); // Edit Open Selected menu item OpenSelectedMenuItem = new ImageMenuItem("_Open Selected Files", agMenuAccel); OpenSelectedMenuItem.Activated += new EventHandler(OpenSelectedMenuItem_Activated); mnuEdit.Append(OpenSelectedMenuItem); // Create preferences for every other os except windows if (!Common.IsWindows) { Separator1MenuItem = new SeparatorMenuItem(); mnuEdit.Append(Separator1MenuItem); // Preferences Gtk.ImageMenuItem OptionsMenuItem = new ImageMenuItem(Stock.Preferences, agMenuAccel); OptionsMenuItem.Activated += new EventHandler(OptionsMenuItem_Activated); mnuEdit.Append(OptionsMenuItem); } // Clear MRU List Gtk.ImageMenuItem ClearMRUsMenuItem = new ImageMenuItem("_Clear Most Recently Used Lists", agMenuAccel); ClearMRUsMenuItem.Activated += new EventHandler(ClearMRUsMenuItem_Activated); mnuTools.Append(ClearMRUsMenuItem); Separator1MenuItem = new SeparatorMenuItem(); mnuTools.Append(Separator1MenuItem); // Save Search Options Gtk.ImageMenuItem SaveOptionsMenuItem = new ImageMenuItem("_Save Search Options", agMenuAccel); SaveOptionsMenuItem.Activated += new EventHandler(SaveOptionsMenuItem_Activated); mnuTools.Append(SaveOptionsMenuItem); // Create Options menu for windows if (Common.IsWindows) { // Options menu item Gtk.ImageMenuItem OptionsMenuItem = new ImageMenuItem("_Options...", agMenuAccel); OptionsMenuItem.Activated += new EventHandler(OptionsMenuItem_Activated); OptionsMenuItem.Image = new Gtk.Image(Stock.Preferences, IconSize.Menu); mnuTools.Append(OptionsMenuItem); } // Help About menu item MenuItem AboutMenuItem = new ImageMenuItem(Stock.About, agMenuAccel); AboutMenuItem.Activated += new EventHandler(AboutMenuItem_Activated); mnuHelp.Append(AboutMenuItem); // Add the menus to the menubar mbMain.Append(mnuFileItem); mbMain.Append(mnuEditItem); mbMain.Append(mnuToolsItem); mbMain.Append(mnuHelpItem); // Add the menubar to the Menu panel vbox.PackStart(mbMain, false, false, 0); #endregion // add items to container panelLeft.Pack1(leftFrame, true, false); // TLW //panelLeft.Pack2(tabControl, true, false); panelLeft.Pack2(panelRight, true, false); // set starting position of splitter panelLeft.Position = Core.GeneralSettings.WindowSearchPanelWidth; panelRight.Position = Core.GeneralSettings.WindowFilePanelHeight; vbox.PackStart(panelLeft, true, true, 0); vbox.PackEnd(sbStatus, false, true, 3); this.Add (vbox); this.ShowAll (); }
private MenuBar CreateShortcutsBar() { // Adds a hidden menubar that contains to enable keyboard // shortcuts to close the log MenuBar menu_bar = new MenuBar (); MenuItem file_item = new MenuItem ("File"); Menu file_menu = new Menu (); MenuItem close_1 = new MenuItem ("Close1"); MenuItem close_2 = new MenuItem ("Close2"); // adds specific Ctrl+W and Esc key accelerators to Log Window AccelGroup accel_group = new AccelGroup (); AddAccelGroup (accel_group); // Close on Esc close_1.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.W, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); close_1.Activated += delegate { HideAll (); }; // Close on Ctrl+W close_2.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.Escape, Gdk.ModifierType.None, AccelFlags.Visible)); close_2.Activated += delegate { HideAll (); }; file_menu.Append (close_1); file_menu.Append (close_2); file_item.Submenu = file_menu; menu_bar.Append (file_item); // Hacky way to hide the menubar, but the accellerators // will simply be disabled when using Hide () menu_bar.HeightRequest = 1; menu_bar.ModifyBg (StateType.Normal, Style.Background (StateType.Normal)); return menu_bar; }
public MenuBar CreateMenuBar () { MenuBar menuBar = new MenuBar (); Menu menu; Menu submenu; MenuItem item; MenuItem barItem; MenuItem subitem; // File menu menu = new Menu (); item = new MenuItem ("New SQL# _Window"); item.Activated += new EventHandler (OnMenu_FileNewSqlWindow); menu.Append (item); menu.Append (new SeparatorMenuItem ()); item = new MenuItem ("_New"); item.Activated += new EventHandler (OnMenu_FileNew); menu.Append (item); item = new MenuItem ("_Open..."); item.Activated += new EventHandler (OnMenu_FileOpen); menu.Append (item); item = new MenuItem ("_Save"); item.Activated += new EventHandler (OnMenu_FileSave); menu.Append (item); item = new MenuItem ("Save _As..."); item.Activated += new EventHandler (OnMenu_FileSaveAs); menu.Append (item); item = new MenuItem ("Close"); item.Activated += new EventHandler (OnMenu_FileClose); menu.Append (item); menu.Append (new SeparatorMenuItem ()); // TODO: submenu Save Output submenu = new Menu (); subitem = new MenuItem ("CSV - Comma Separated Values"); //subitem.Activated += new EventHandler (OnMenu_FileSaveOutput_CSV); submenu.Append(subitem); subitem = new MenuItem ("TAB - Tab Separated Values"); //subitem.Activated += new EventHandler (OnMenu_FileSaveOutput_TAB); submenu.Append(subitem); subitem = new MenuItem ("XML"); //subitem.Activated += new EventHandler (OnMenu_FileSaveOutput_XML); submenu.Append(subitem); item = new MenuItem ("Save _Output..."); item.Submenu = submenu; menu.Append (item); menu.Append (new SeparatorMenuItem ()); item = new MenuItem ("E_xit"); item.Activated += new EventHandler (OnMenu_FileExit); menu.Append (item); barItem = new MenuItem ("_File"); barItem.Submenu = menu; menuBar.Append (barItem); // Edit menu menu = new Menu (); item = new MenuItem ("_Undo"); //item.Activated += new EventHandler (OnMenu_EditUndo); menu.Append (item); item = new MenuItem ("_Redo"); //item.Activated += new EventHandler (OnMenu_EditRedo); menu.Append (item); menu.Append (new SeparatorMenuItem ()); item = new MenuItem ("Cu_t"); //item.Activated += new EventHandler (OnMenu_EditCut); menu.Append (item); item = new MenuItem ("_Copy"); //item.Activated += new EventHandler (OnMenu_EditCopy); menu.Append (item); item = new MenuItem ("_Paste"); //item.Activated += new EventHandler (OnMenu_EditPaste); menu.Append (item); item = new MenuItem ("_Delete"); //item.Activated += new EventHandler (OnMenu_EditDelete); menu.Append (item); menu.Append (new SeparatorMenuItem ()); item = new MenuItem ("_Find and Replace..."); //item.Activated += new EventHandler (OnMenu_EditFindReplace); menu.Append (item); menu.Append (new SeparatorMenuItem ()); item = new MenuItem ("_Options"); //item.Activated += new EventHandler (OnMenu_EditOptions); menu.Append (item); barItem = new MenuItem ("_Edit"); barItem.Submenu = menu; menuBar.Append (barItem); // Session menu menu = new Menu (); item = new MenuItem ("_Connect"); item.Activated += new EventHandler (OnMenu_SessionConnect); menu.Append (item); item = new MenuItem ("_Disconnect"); item.Activated += new EventHandler (OnMenu_SessionDisconnect); menu.Append (item); barItem = new MenuItem ("_Session"); barItem.Submenu = menu; menuBar.Append (barItem); // Command menu menu = new Menu (); item = new MenuItem ("_Execute"); item.Activated += new EventHandler (OnMenu_CommandExecute); menu.Append (item); item = new MenuItem ("_Execute With Output to XML"); item.Activated += new EventHandler (OnMenu_CommandExecuteXML); menu.Append (item); item = new MenuItem ("_Execute With Output to CSV"); item.Activated += new EventHandler (OnMenu_CommandExecuteCSV); menu.Append (item); item = new MenuItem ("_Execute With Output to HTML"); item.Activated += new EventHandler (OnMenu_CommandExecuteHTML); menu.Append (item); barItem = new MenuItem ("_Command"); barItem.Submenu = menu; menuBar.Append (barItem); return menuBar; }