/// <summary> /// Constructs a demo object with the appropriate gui. /// </summary> public DemoWindow() : base("Moonfire Games' Gtk Demo") { // Create a window SetDefaultSize(1000, 800); DeleteEvent += OnWindowDelete; demoComponents = new DemoComponents(); // Create a user action manager. var actionManager = new ActionManager(this); actionManager.Add(GetType().Assembly); demoConfiguratorsTab = new DemoConfiguratorsTab(this); actionManager.Add(demoConfiguratorsTab); demoActions = new DemoActions(actionManager); // Load the layout from the file system. layout = new ActionLayout(new FileInfo("ActionLayout1.xml")); actionManager.SetLayout(layout); // Load the keybinding from a file. keybindings = new ActionKeybindings(new FileInfo("ActionKeybindings1.xml")); actionManager.SetKeybindings(keybindings); // Create the window frame var box = new VBox(); Add(box); // Create the components we need before the menu. notebook = new Notebook(); actionManager.Add(new SwitchPageAction(notebook, 0, "Components")); actionManager.Add(new SwitchPageAction(notebook, 1, "Text Editor")); actionManager.Add(new SwitchPageAction(notebook, 2, "Actions")); actionManager.Add(new SwitchPageAction(notebook, 3, "Configurators")); // Create a notebook notebook.BorderWidth = 5; notebook.AppendPage(demoComponents, new Label("Components")); notebook.AppendPage(demoActions, new Label("Actions")); notebook.AppendPage(demoConfiguratorsTab, new Label("Configurators")); // Add the status bar statusbar = new Statusbar(); statusbar.Push(0, "Welcome!"); statusbar.HasResizeGrip = true; // Create the menu menubar = new MenuBar(); // Back everything into place. box.PackStart(CreateGuiMenu(), false, false, 0); box.PackStart(notebook, true, true, 0); box.PackStart(statusbar, false, false, 0); }
/// <summary> /// Initializes a new instance of the <see cref="DemoActions"/> class. /// </summary> public DemoActions(ActionManager actionManager) { this.actionManager = actionManager; // Create a frame with the enable elements. var enableFrame = new Frame("Action Group Sensitivity"); var enableBox = new VBox(); enableBox.BorderWidth = 5; enableFrame.BorderWidth = 5; enableFrame.Add(enableBox); // Add the check buttons. var checkButton = new CheckButton("Enable _Global entries"); checkButton.Name = "Global"; checkButton.Active = true; checkButton.Toggled += OnGroupSensitivityChanged; enableBox.PackStart(checkButton); checkButton = new CheckButton("Enable _View entries"); checkButton.Name = "View"; checkButton.Active = true; checkButton.Toggled += OnGroupSensitivityChanged; enableBox.PackStart(checkButton); checkButton = new CheckButton("Enable _Editor entries"); checkButton.Name = "Editor"; checkButton.Active = true; checkButton.Toggled += OnGroupSensitivityChanged; enableBox.PackStart(checkButton); // Return it PackStart(enableFrame, false, false, 0); PackStart(new Label(""), true, true, 0); }