void IPlugin.Init(object context) { ISampleTool reflector = context as ISampleTool; mainWindow = reflector.GetMainWindow(); Gtk.Notebook nb = new Gtk.Notebook(); nb.AppendPage(new TextView(), new Gtk.Label("TestPlugin Visualizer")); nb.AppendPage(new DrawingArea(), new Gtk.Label("TestPlugin Visualizer")); nb.ShowAll(); dockItem = mainWindow.DockFrame.AddItem("TestPlugin Visualizer"); dockItem.Visible = true; dockItem.Behavior = DockItemBehavior.Normal; dockItem.Expand = true; dockItem.DrawFrame = true; dockItem.Label = "TestPlugin Visualizer"; dockItem.Content = nb; dockItem.DefaultVisible = true; dockItem.Visible = true; }
void IPlugin.Init(object context) { ISampleTool SampleTool = context as ISampleTool; DockFrame frame = SampleTool.GetMainWindow().DockFrame; Gtk.ScrolledWindow treeViewScrollWindow = new Gtk.ScrolledWindow(); Gtk.Viewport treeViewViewport = new Gtk.Viewport(); treeViewScrollWindow.Add(treeViewViewport); treeViewViewport.Add(treeView); treeViewScrollWindow.ShowAll(); Gtk.ScrolledWindow textEditorScrollWindow = new Gtk.ScrolledWindow(); Gtk.Viewport textEditorViewport = new Gtk.Viewport(); textEditorScrollWindow.Add(textEditorViewport); textEditorViewport.Add(nb); textEditorScrollWindow.ShowAll(); Gtk.TreeViewColumn col = new Gtk.TreeViewColumn(); Gtk.CellRendererText colAssemblyCell = new Gtk.CellRendererText(); col.PackStart(colAssemblyCell, true); col.AddAttribute(colAssemblyCell, "text", 0); if (treeView.GetColumn(0) != null) { treeView.Columns[0] = col; } else { treeView.AppendColumn(col); } treeView.Model = new Gtk.TreeStore(typeof(string)); treeView.Model = homeSubFolders(Environment.GetFolderPath(Environment.SpecialFolder.Personal)); treeView.RowActivated += HandleRowActivated; DockItem treeViewDock = frame.AddItem("TreeViewDock"); treeViewDock.Behavior = DockItemBehavior.Normal; treeViewDock.Expand = true; treeViewDock.DrawFrame = true; treeViewDock.Label = "Files"; treeViewDock.Content = treeViewScrollWindow; treeViewDock.DefaultVisible = true; treeViewDock.Visible = true; DockItem textEditorDock = frame.AddItem("TextEditorDock"); textEditorDock.Behavior = DockItemBehavior.Normal; textEditorDock.Expand = true; textEditorDock.DrawFrame = true; textEditorDock.Label = "Text Editor"; textEditorDock.Content = textEditorScrollWindow; textEditorDock.DefaultVisible = true; textEditorDock.Visible = true; Gtk.MenuBar mainMenuBar = SampleTool.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; } } // 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 Close menu item in File Gtk.MenuItem close = new Gtk.MenuItem("Close"); close.Activated += HandleActivated; (fileMenu.Submenu as Gtk.Menu).Prepend(close); // Setting up the Save menu item in File Gtk.MenuItem save = new Gtk.MenuItem("Save"); save.Activated += HandleSaveActivated; (fileMenu.Submenu as Gtk.Menu).Prepend(save); }