private void BuildViews() { VBox source_box = new VBox(); views_pane = new HPaned(); PersistentPaneController.Control(views_pane, SourceViewWidth); view_container = new ViewContainer(); source_view = new SourceView(); composite_view = new CompositeTrackSourceContents(); Hyena.Widgets.ScrolledWindow source_scroll = new Hyena.Widgets.ScrolledWindow(); source_scroll.AddWithFrame(source_view); composite_view.TrackView.HeaderVisible = false; view_container.Content = composite_view; source_box.PackStart(source_scroll, true, true, 0); source_box.PackStart(new UserJobTileHost(), false, false, 0); source_view.SetSizeRequest(125, -1); view_container.SetSizeRequest(425, -1); views_pane.Pack1(source_box, false, false); views_pane.Pack2(view_container, true, false); source_box.ShowAll(); view_container.Show(); views_pane.Show(); primary_vbox.PackStart(views_pane, true, true, 0); }
void BuildGui() { ContentName = "SkiaSharp Fiddle"; _headerBox.PackStart(_widthLabel, false, false, 0); _headerBox.PackStart(_widthEntry, false, false, 0); _headerBox.PackStart(_heightLabel, false, false, 0); _headerBox.PackStart(_heightEntry, false, false, 0); _codeBox.PackStart(_codeLabel, false, false, 0); _codeBox.PackEnd(_textEditor, true, true, 0); _codeFrame.Add(_codeBox); _outputBox.PackStart(_outputLabel, false, false, 0); _outputBox.PackEnd(_skWidget, true, true, 0); _outputFrame.Add(_outputBox); _contentBox.Pack1(_codeFrame, true, true); _contentBox.Pack2(_outputFrame, false, false); _messagesBox.PackStart(_messagesLabel, false, false, 0); _messagesBox.PackEnd(_messagesView, true, true, 0); _messagesFrame.Add(_messagesBox); _mainBox.PackStart(_headerBox, false, false, 0); _mainBox.PackStart(_contentBox, true, true, 0); _mainBox.PackStart(_messagesFrame, true, true, 0); _mainBox.ShowAll(); }
/// <summary> /// Creates the GUI from code elements. /// </summary> private void CreateGui() { // Hook up the accelerator group. accelerators = new AccelGroup(); AddAccelGroup(accelerators); // The main frame has a VBox to arrange all the components. The VBox // contains the menu, the primary text editor, and a status bar. var vertical = new VBox(false, 0); Add(vertical); // The center part of the area has a horizontal separator with the // bulk of the text editor on the left. var pane = new HPaned { Position = 1024 - 256, BorderWidth = 0, }; // Create the various components and add them to the vertical box. Widget menuBarWidget = CreateGuiMenubar(); Widget panelsWidget = CreatePanelArea(); Widget textEditorWidget = CreateGuiEditor(); Widget statusBarWidget = CreateGuiStatusbar(); pane.Pack1(textEditorWidget, true, true); pane.Pack2(panelsWidget, true, true); vertical.PackStart(menuBarWidget, false, false, 0); vertical.PackStart(pane, true, true, 0); vertical.PackStart(statusBarWidget, false, false, 0); }
protected override void OnShown() { var vbox = new VBox(); var views_pane = new HPaned(); PersistentPaneController.Control(views_pane, SourceViewWidth); _view_container = new ViewContainer(); _source_view = new SourceView(); var source_scroll = new ScrolledWindow(); _view_container.Content = _composite = new SimpleListSourceContents(); var toolbar = _Toolbar(); _status = _Statusbar(); source_scroll.Add(_source_view); _source_box = new VBox(); _source_box.PackStart(source_scroll, true, true, 0); _source_box.PackEnd(_cover_art, false, false, 0); views_pane.Pack1(_source_box, true, true); views_pane.Pack2(_view_container, true, true); vbox.PackStart(_status, false, false, 0); vbox.PackStart(views_pane, true, true, 0); vbox.PackStart(toolbar, false, false, 0); Add(vbox); foreach (var _ in _ready) { _(); } _ready.Clear(); _composite.Widget.Show(); _view_container.Show(); _source_view.Show(); source_scroll.Show(); _source_box.Show(); CoverArt(); _status.Show(); views_pane.Show(); toolbar.Show(); vbox.Show(); ConnectEvents(); base.OnShown(); }
/// <summary> /// Constructor. /// </summary> public MainContent(MainWindow window) { // the left controls ActiveMeshControls activeMesh = new ActiveMeshControls(); HSeparator separator = new HSeparator(); MeshList meshList = new MeshList(); VBox leftControls = new VBox(false, 0); leftControls.WidthRequest = 250; leftControls.PackStart(activeMesh, false, false, 0); leftControls.PackStart(separator, false, false, 0); leftControls.PackStart(meshList, true, true, 0); Frame leftFrame = new Frame(); leftFrame.Shadow = ShadowType.EtchedIn; leftFrame.Add(leftControls); // the scene content VBox sceneBox = new VBox(); m_sceneWindow = SceneWindow.CreateSceneWindow(); SceneToolbar sceneToolbar = new SceneToolbar(window, m_sceneWindow); sceneBox.PackStart(sceneToolbar, false, false, 0); sceneBox.PackStart(m_sceneWindow, true, true, 0); // the right controls SmoothingContent smoothing = new SmoothingContent(); VBox rightControls = new VBox(false, 0); rightControls.WidthRequest = 250; rightControls.PackStart(smoothing, true, true, 0); Frame rightFrame = new Frame(); rightFrame.Shadow = ShadowType.EtchedIn; rightFrame.Add(rightControls); // fit everything into the main window HPaned pan1 = new HPaned(); HPaned pan2 = new HPaned(); pan1.Pack1(leftFrame, false, false); pan1.Pack2(sceneBox, true, true); pan2.Pack1(pan1, true, true); pan2.Pack2(rightFrame, false, false); PackStart(pan2, true, true, 0); KeyPressEvent += m_sceneWindow.OnKeyPress; Time.SetStartTime(); GLib.Idle.Add(Update); }
public TestResultsPad() { testService.TestSuiteChanged += new EventHandler(OnTestSuiteChanged); IdeApp.Workspace.WorkspaceItemClosed += OnWorkspaceItemClosed; panel = new VBox(); // Results notebook book = new HPaned(); panel.PackStart(book, true, true, 0); panel.FocusChain = new Gtk.Widget [] { book }; // Failures tree failuresTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView(); failuresTreeView.HeadersVisible = false; failuresStore = new TreeStore(typeof(Xwt.Drawing.Image), typeof(string), typeof(object), typeof(string), typeof(int), typeof(int)); var pr = new CellRendererImage(); CellRendererText tr = new CellRendererText(); TreeViewColumn col = new TreeViewColumn(); col.PackStart(pr, false); col.AddAttribute(pr, "image", 0); col.PackStart(tr, false); col.AddAttribute(tr, "markup", 1); failuresTreeView.AppendColumn(col); failuresTreeView.Model = failuresStore; var sw = new MonoDevelop.Components.CompactScrolledWindow(); sw.ShadowType = ShadowType.None; sw.Add(failuresTreeView); book.Pack1(sw, true, true); outputView = new MonoDevelop.Ide.Gui.Components.LogView.LogTextView(); outputView.ModifyFont(FontService.MonospaceFont); outputView.Editable = false; bold = new TextTag("bold"); bold.Weight = Pango.Weight.Bold; outputView.Buffer.TagTable.Add(bold); sw = new MonoDevelop.Components.CompactScrolledWindow(); sw.ShadowType = ShadowType.None; sw.Add(outputView); book.Pack2(sw, true, true); outputViewScrolled = sw; failuresTreeView.RowActivated += OnRowActivated; failuresTreeView.Selection.Changed += OnRowSelected; failuresTreeView.DoPopupMenu = delegate(EventButton evt) { IdeApp.CommandService.ShowContextMenu(failuresTreeView, evt, "/MonoDevelop/NUnit/ContextMenu/TestResultsPad"); }; Control.ShowAll(); outputViewScrolled.Hide(); }
public MainComponentBuilderForm() { mainComponentBuilderForm = new Glade.XML(null, "MainComponentBuilderForm.glade", "mainView", null); mainComponentBuilderForm.Autoconnect(this); //Terminamos de construir el gui. projectView = new ProjectView(); hpaned1.Pack1(projectView.GetWidget(), true, true); componentView = new ComponentView(); hpaned1.Pack2(componentView.GetWidget(), true, true); hpaned1.ShowAll(); }
public TestResultsPad() { testService.TestSuiteChanged += new EventHandler(OnTestSuiteChanged); panel = new VBox(); // Results notebook book = new HPaned(); panel.PackStart(book, true, true, 0); panel.FocusChain = new Gtk.Widget [] { book }; // Failures tree failuresTreeView = new TreeView(); failuresTreeView.HeadersVisible = false; failuresStore = new TreeStore(typeof(Pixbuf), typeof(string), typeof(object), typeof(string)); var pr = new CellRendererPixbuf(); CellRendererText tr = new CellRendererText(); TreeViewColumn col = new TreeViewColumn(); col.PackStart(pr, false); col.AddAttribute(pr, "pixbuf", 0); col.PackStart(tr, false); col.AddAttribute(tr, "markup", 1); failuresTreeView.AppendColumn(col); failuresTreeView.Model = failuresStore; var sw = new MonoDevelop.Components.CompactScrolledWindow(); sw.ShadowType = ShadowType.None; sw.Add(failuresTreeView); book.Pack1(sw, true, true); outputView = new TextView(); outputView.Editable = false; bold = new TextTag("bold"); bold.Weight = Pango.Weight.Bold; outputView.Buffer.TagTable.Add(bold); sw = new MonoDevelop.Components.CompactScrolledWindow(); sw.ShadowType = ShadowType.None; sw.Add(outputView); book.Pack2(sw, true, true); outputViewScrolled = sw; failuresTreeView.ButtonReleaseEvent += new Gtk.ButtonReleaseEventHandler(OnPopupMenu); failuresTreeView.RowActivated += OnRowActivated; failuresTreeView.Selection.Changed += OnRowSelected; Control.ShowAll(); outputViewScrolled.Hide(); }
private void BuildViews() { source_box = new VBox(); views_pane = new HPaned(); PersistentPaneController.Control(views_pane, SourceViewWidth); view_container = new ViewContainer(); source_view = new SourceView(); composite_view = new CompositeTrackSourceContents(); Container source_scroll; Hyena.Widgets.ScrolledWindow window; if (ApplicationContext.CommandLine.Contains("smooth-scroll")) { window = new Hyena.Widgets.SmoothScrolledWindow(); } else { window = new Hyena.Widgets.ScrolledWindow(); } window.Add(source_view); source_scroll = window; composite_view.TrackView.HeaderVisible = false; view_container.Content = composite_view; source_box.PackStart(source_scroll, true, true, 0); source_box.PackStart(new UserJobTileHost(), false, false, 0); UpdateCoverArtDisplay(); source_view.SetSizeRequest(125, -1); view_container.SetSizeRequest(425, -1); views_pane.Pack1(source_box, false, false); views_pane.Pack2(view_container, true, false); source_box.ShowAll(); view_container.Show(); views_pane.Show(); primary_vbox.PackStart(views_pane, true, true, 0); }
public ConfigForm() : base(WindowType.Toplevel) { // Setup GUI WindowPosition = WindowPosition.Center; DefaultSize = new Gdk.Size(500, 350); _headerBar = new HeaderBar(); _headerBar.ShowCloseButton = true; _headerBar.Title = "SwitchCam"; var btnClickMe = new Gtk.Button(); btnClickMe.AlwaysShowImage = true; btnClickMe.Image = Image.NewFromIconName("document-new-symbolic", IconSize.Button); _headerBar.PackStart(btnClickMe); Titlebar = _headerBar; var vpanned1 = new VPaned(); vpanned1.Position = 300; var hpanned = new HPaned(); hpanned.Position = 100; _treeView = new TreeView(); _treeView.HeadersVisible = false; hpanned.Pack1(_treeView, false, true); _notebook = new Notebook(); var scroll1 = new ScrolledWindow(); var vpanned = new VPaned(); vpanned.Position = 300; _boxContent = new Box(Orientation.Vertical, 0); _boxContent.Margin = 8; vpanned.Pack1(_boxContent, false, false); scroll1.Child = vpanned; _notebook.AppendPage(scroll1, new Label { Text = "Data", Expand = true }); hpanned.Pack2(_notebook, false, true); vpanned1.Pack1(hpanned, false, true); var box = new Box(Orientation.Horizontal, 0); box.Margin = 8; vpanned1.Pack2(box, false, true); var grid = new Grid { RowSpacing = 2, ColumnSpacing = 2 }; box.PackStart(grid, false, false, 0); var btn = new Gtk.Button("Take Picture"); btn.Clicked += TakePicture; grid.Attach(btn, 0, 0, 1, 1); Child = vpanned1; // Fill up data FillUpTreeView(); // Connect events _treeView.Selection.Changed += Selection_Changed; Destroyed += OnDestroy; try { ConfigureButton(); } catch (Exception e) { MMALLog.Logger.Debug($"Something went wrong while configuring the button. {e.Message} {e.StackTrace}"); } }
private void BuildViews() { source_box = new VBox(); views_pane = new HPaned(); PersistentPaneController.Control(views_pane, SourceViewWidth); view_container = new ViewContainer(); source_view = new SourceView(); composite_view = new CompositeTrackSourceContents(); Container source_scroll; if (PlatformDetection.IsMeeGo) { source_scroll = new Gtk.ScrolledWindow() { HscrollbarPolicy = PolicyType.Never, VscrollbarPolicy = PolicyType.Automatic, ShadowType = ShadowType.None }; source_scroll.Add(source_view); var color = new Gdk.Color((byte)0xe6, (byte)0xe6, (byte)0xe6); Gdk.Colormap.System.AllocColor(ref color, true, true); source_view.ModifyBase(StateType.Normal, color); } else { Hyena.Widgets.ScrolledWindow window; if (ApplicationContext.CommandLine.Contains("smooth-scroll")) { window = new Hyena.Widgets.SmoothScrolledWindow(); } else { window = new Hyena.Widgets.ScrolledWindow(); } window.AddWithFrame(source_view); source_scroll = window; } composite_view.TrackView.HeaderVisible = false; view_container.Content = composite_view; source_box.PackStart(source_scroll, true, true, 0); source_box.PackStart(new UserJobTileHost(), false, false, 0); UpdateCoverArtDisplay(); source_view.SetSizeRequest(125, -1); view_container.SetSizeRequest(425, -1); views_pane.Pack1(source_box, false, false); views_pane.Pack2(view_container, true, false); source_box.ShowAll(); view_container.Show(); views_pane.Show(); primary_vbox.PackStart(views_pane, true, true, 0); }
static void Main() { #if TRACE System.Diagnostics.TextWriterTraceListener listener = new System.Diagnostics.TextWriterTraceListener(System.Console.Out); System.Diagnostics.Trace.Listeners.Add(listener); #endif Application.Init(); #region Packing and layout Window window = new Window("AspNetEdit Host Sample"); window.SetDefaultSize(1000, 700); window.DeleteEvent += new DeleteEventHandler(window_DeleteEvent); VBox outerBox = new VBox(); window.Add(outerBox); HPaned leftBox = new HPaned(); outerBox.PackEnd(leftBox, true, true, 0); HPaned rightBox = new HPaned(); leftBox.Add2(rightBox); geckoFrame = new Frame(); geckoFrame.Shadow = ShadowType.In; rightBox.Pack1(geckoFrame, true, false); #endregion #region Toolbar // * Save/Open Toolbar buttons = new Toolbar(); outerBox.PackStart(buttons, false, false, 0); ToolButton saveButton = new ToolButton(Stock.Save); buttons.Add(saveButton); saveButton.Clicked += new EventHandler(saveButton_Clicked); ToolButton openButton = new ToolButton(Stock.Open); buttons.Add(openButton); openButton.Clicked += new EventHandler(openButton_Clicked); buttons.Add(new SeparatorToolItem()); // * Clipboard ToolButton undoButton = new ToolButton(Stock.Undo); buttons.Add(undoButton); undoButton.Clicked += new EventHandler(undoButton_Clicked); ToolButton redoButton = new ToolButton(Stock.Redo); buttons.Add(redoButton); redoButton.Clicked += new EventHandler(redoButton_Clicked); ToolButton cutButton = new ToolButton(Stock.Cut); buttons.Add(cutButton); cutButton.Clicked += new EventHandler(cutButton_Clicked); ToolButton copyButton = new ToolButton(Stock.Copy); buttons.Add(copyButton); copyButton.Clicked += new EventHandler(copyButton_Clicked); ToolButton pasteButton = new ToolButton(Stock.Paste); buttons.Add(pasteButton); pasteButton.Clicked += new EventHandler(pasteButton_Clicked); buttons.Add(new SeparatorToolItem()); // * Text style ToolButton boldButton = new ToolButton(Stock.Bold); buttons.Add(boldButton); boldButton.Clicked += new EventHandler(boldButton_Clicked); ToolButton italicButton = new ToolButton(Stock.Italic); buttons.Add(italicButton); italicButton.Clicked += new EventHandler(italicButton_Clicked); ToolButton underlineButton = new ToolButton(Stock.Underline); buttons.Add(underlineButton); underlineButton.Clicked += new EventHandler(underlineButton_Clicked); ToolButton indentButton = new ToolButton(Stock.Indent); buttons.Add(indentButton); indentButton.Clicked += new EventHandler(indentButton_Clicked); ToolButton unindentButton = new ToolButton(Stock.Unindent); buttons.Add(unindentButton); unindentButton.Clicked += new EventHandler(unindentButton_Clicked); buttons.Add(new SeparatorToolItem()); // * Toolbox ToolButton toolboxAddButton = new ToolButton(Stock.Add); buttons.Add(toolboxAddButton); toolboxAddButton.Clicked += new EventHandler(toolboxAddButton_Clicked); #endregion #region Designer services and host //set up the services ServiceContainer services = new ServiceContainer(); services.AddService(typeof(INameCreationService), new NameCreationService()); services.AddService(typeof(ISelectionService), new SelectionService()); services.AddService(typeof(IEventBindingService), new EventBindingService(window)); services.AddService(typeof(ITypeResolutionService), new TypeResolutionService()); ExtenderListService extListServ = new AspNetEdit.Editor.ComponentModel.ExtenderListService(); services.AddService(typeof(IExtenderListService), extListServ); services.AddService(typeof(IExtenderProviderService), extListServ); services.AddService(typeof(ITypeDescriptorFilterService), new TypeDescriptorFilterService()); toolboxService = new ToolboxService(); services.AddService(typeof(IToolboxService), toolboxService); //create our host host = new DesignerHost(services); host.NewFile(); host.Activate(); #endregion #region Designer UI and panels IRootDesigner rootDesigner = (IRootDesigner)host.GetDesigner(host.RootComponent); RootDesignerView designerView = (RootDesignerView)rootDesigner.GetView(ViewTechnology.Passthrough); geckoFrame.Add(designerView); PropertyGrid p = new PropertyGrid(services); p.WidthRequest = 200; rightBox.Pack2(p, false, false); Toolbox toolbox = new Toolbox(services); leftBox.Pack1(toolbox, false, false); toolboxService.PopulateFromAssembly(System.Reflection.Assembly.GetAssembly(typeof(System.Web.UI.Control))); toolboxService.AddToolboxItem(new TextToolboxItem("<table><tr><td></td><td></td></tr><tr><td></td><td></td></tr></table>", "Table"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<div style=\"width: 100px; height: 100px;\"></div>", "Div"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<hr />", "Horizontal Rule"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<select><option></option></select>", "Select"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<img src=\"\" />", "Image"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<textarea cols=\"20\" rows=\"2\"></textarea>", "Textarea"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"hidden\" />", "Input [Hidden]"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"radio\" />", "Input [Radio]"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"checkbox\" />", "Input [Checkbox]"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"password\" />", "Input [Password]"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"file\" />", "Input [File]"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"text\" />", "Input [Text]"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"submit\" value=\"submit\" />", "Input [Submit]"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"reset\" value=\"reset\" />", "Input [Reset]"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"button\" value=\"button\" />", "Input [Button]"), "Html"); toolbox.Refresh(); #endregion window.ShowAll(); Application.Run(); }
public BubbleChartView(ViewBase owner = null) : base(owner) { vpaned1 = new VPaned(); mainWidget = vpaned1; mainWidget.Destroyed += OnDestroyed; graphView = new DirectedGraphView(this); vpaned1.Pack1(graphView.MainWidget, true, true); VBox vbox1 = new VBox(false, 0); ctxBox = new VBox(false, 0); // Arc selection: rules & actions VBox arcSelBox = new VBox(); Label l1 = new Label("Rules"); l1.Xalign = 0; arcSelBox.PackStart(l1, true, true, 0); RuleList = new EditorView(owner); RuleList.TextHasChangedByUser += OnRuleChanged; //RuleList.ScriptMode = false; ScrolledWindow rules = new ScrolledWindow(); rules.ShadowType = ShadowType.EtchedIn; rules.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); rules.Add((RuleList as ViewBase).MainWidget); (RuleList as ViewBase).MainWidget.ShowAll(); arcSelBox.PackStart(rules, true, true, 0); rules.Show(); Label l2 = new Label("Actions"); l2.Xalign = 0; arcSelBox.PackStart(l2, true, true, 0); ActionList = new EditorView(owner); ActionList.TextHasChangedByUser += OnActionChanged; //ActionList.ScriptMode = false; ScrolledWindow actions = new ScrolledWindow(); actions.ShadowType = ShadowType.EtchedIn; actions.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); actions.Add((ActionList as ViewBase).MainWidget); (ActionList as ViewBase).MainWidget.ShowAll(); arcSelBox.PackStart(actions, true, true, 0); actions.Show(); arcSelWdgt = arcSelBox as Widget; arcSelWdgt.Hide(); ctxBox.PackStart(arcSelWdgt, true, true, 0); // Node selection: Grid t1 = new Grid(); Label l3 = new Label("Name"); l3.Xalign = 0; t1.Attach(l3, 0, 0, 1, 1); Label l4 = new Label("Description"); l4.Xalign = 0; t1.Attach(l4, 0, 1, 1, 1); Label l5 = new Label("Colour"); l5.Xalign = 0; t1.Attach(l5, 0, 2, 1, 1); nameEntry = new Entry(); nameEntry.Changed += OnNameChanged; nameEntry.Xalign = 0; // Setting the WidthRequest to 350 will effectively // set the minimum size, beyond which it cannot be further // shrunk by dragging the HPaned's splitter. nameEntry.WidthRequest = 350; t1.Attach(nameEntry, 1, 0, 1, 1); descEntry = new Entry(); descEntry.Xalign = 0; descEntry.Changed += OnDescriptionChanged; descEntry.WidthRequest = 350; t1.Attach(descEntry, 1, 1, 1, 1); colourChooser = new ColorButton(); colourChooser.Xalign = 0; colourChooser.ColorSet += OnColourChanged; colourChooser.WidthRequest = 350; t1.Attach(colourChooser, 1, 2, 1, 1); nodeSelWdgt = t1; ctxBox.PackStart(t1, true, true, 0); // Info Label l6 = new Label(); l6.LineWrap = true; l6.Text = "<left-click>: select a node or arc.\n" + "<right-click>: shows a context-sensitive menu.\n\n" + "Once a node/arc is selected, it can be dragged to a new position.\n\n" + "Nodes are created by right-clicking on a blank area.\n\n" + "Transition arcs are created by firstly selecting a source node,\n" + "then right-clicking over a target node."; infoWdgt = l6 as Widget; infoWdgt.ShowAll(); l6.Xalign = 0; l6.Yalign = 0; l6.Wrap = false; Alignment infoWdgtWrapper = new Alignment(0, 0, 1, 0); infoWdgtWrapper.Add(infoWdgt); //ctxBox.PackStart(infoWdgt, true, true, 0); //vbox1.PackStart(ctxBox, false, false, 0); PropertiesView = new PropertyView(this); ((ScrolledWindow)((ViewBase)PropertiesView).MainWidget).HscrollbarPolicy = PolicyType.Never; // settingsBox = new Table(2, 2, false); // settingsBox.Attach(new Label("Initial State"), 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0); // combobox1 = new ComboBox(); // combobox1.PackStart(comboRender, false); // combobox1.AddAttribute(comboRender, "text", 0); // combobox1.Model = comboModel; // settingsBox.Attach(combobox1, 1, 2, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0); // chkVerbose = new CheckButton(); // chkVerbose.Toggled += OnToggleVerboseMode; // settingsBox.Attach(new Label("Verbose Mode"), 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0); // settingsBox.Attach(chkVerbose, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0); hpaned1 = new HPaned(); hpaned2 = new HPaned(); Frame frame1 = new Frame("Rotation Settings"); frame1.Add(((ViewBase)PropertiesView).MainWidget); frame1.ShadowType = ShadowType.In; Frame frame2 = new Frame(); frame2.Add(hpaned2); frame2.ShadowType = ShadowType.In; ctxFrame = new Frame(); ctxFrame.Add(ctxBox); ctxFrame.ShadowType = ShadowType.In; Frame frame4 = new Frame("Instructions"); frame4.Add(infoWdgtWrapper); frame4.ShadowType = ShadowType.In; hpaned1.Pack1(frame1, false, false); hpaned1.Pack2(frame2, true, false); hpaned2.Pack1(ctxFrame, true, false); hpaned2.Pack2(frame4, true, false); hpaned1.ShowAll(); Alignment halign = new Alignment(0, 0, 1, 1); halign.Add(hpaned1); vpaned1.Pack2(halign, false, false); vpaned1.Show(); graphView.OnGraphObjectSelected += OnGraphObjectSelected; graphView.OnGraphObjectMoved += OnGraphObjectMoved; //combobox1.Changed += OnComboBox1SelectedValueChanged; contextMenuHelper = new ContextMenuHelper(graphView.MainWidget); contextMenuHelper.ContextMenu += OnPopup; ContextMenu.SelectionDone += OnContextMenuDeactivated; ContextMenu.Mapped += OnContextMenuRendered; // Ensure the menu is populated Select(null); }
public DebuggerWindow(string title) : base(title) { Gdk.RGBA black = new Gdk.RGBA(); black.Parse("#000000"); this.SetSizeRequest(640, 480); var hPaned = new HPaned(); #region Disassembly Text View Setup disassemblyTextView = new TextView(disassemblyBuffer) { Editable = false, Monospace = true }; CreateTags(disassemblyBuffer); scrollWindow = new ScrolledWindow { BorderWidth = 5, ShadowType = ShadowType.In }; scrollWindow.Add(disassemblyTextView); hPaned.Pack1(scrollWindow, true, false); #endregion var box = new Box(Orientation.Vertical, 6); var buttonBox = new Box(Orientation.Horizontal, 6); var pauseButton = new Button(); pauseButton.Clicked += delegate(object obj, EventArgs args) { Program.DebugControl(Program.DebugOptions.Pause); }; pauseButton.Label = "Pause"; var stepButton = new Button(); stepButton.Clicked += delegate(object obj, EventArgs args) { Program.DebugControl(Program.DebugOptions.Step); }; stepButton.Label = "Step"; var playButton = new Button(); playButton.Clicked += delegate(object obj, EventArgs args) { Program.DebugControl(Program.DebugOptions.Play); }; playButton.Label = "Play"; var resetButton = new Button(); resetButton.Clicked += delegate(object obj, EventArgs args) { Program.Reset(); }; resetButton.Label = "Reset"; buttonBox.PackStart(pauseButton, false, true, 2); buttonBox.PackStart(stepButton, false, true, 2); buttonBox.PackStart(playButton, false, true, 2); buttonBox.PackStart(resetButton, false, true, 2); box.PackStart(buttonBox, false, false, 2); var watchLabel = new Label("Watch"); box.PackStart(watchLabel, false, false, 2); watchTextView = new TextView(watchBuffer) { Editable = false, Monospace = true }; CreateTags(watchBuffer); box.PackStart(watchTextView, true, true, 2); hPaned.Pack2(box, false, false); Add(hPaned); }
public void InitializeWindow() { // Menubar _primaryWindowContainer = new VBox(); _primaryWindowMenuBar = new MenuBar(); _primaryMenuItemFile = new MenuItem(); _primaryWindowMenuFile = new Menu(); _primaryWindowMenuQuitItem = new MenuItem(); _primaryWindowInstallLinkHandler = new MenuItem(); _primaryMenuItemAbout = new MenuItem(); // Top level window pane. _primaryWindowPane = new HPaned(); _primaryWindowLeftContainer = new VBox(); // Left side User Settings Pane _userSettingsParentFrame = new Frame(); _userSettingsParentContainer = new VBox(); _gameInfoParentFrame = new Frame(); _gameInfoParentContainer = new VBox(); // Left Side Current State Field _currentStateFrame = new Frame(); _currentStateContainer = new Box(Orientation.Vertical, 0); _currentStateLabel = new Label(); // Left Side Game Code Fields _gameCodeParentFrame = new Frame(); _gameCodeLayoutContainer = new HBox(); _gameCodeCopyButton = new Button(); _gameCodeEntryField = new Entry(); // Left Side Websocket/Host Control _hostControlFrame = new Frame(); _hostControlLayoutContainer = new VBox(); _urlHostEntryFrame = new Frame(); _urlHostEntryLayoutContainer = new HBox(); _urlHostEntryField = new Entry(); _connectCodeParentFrame = new Frame(); _connectCodeLayoutContainer = new HBox(); _connectCodeSubmitButton = new Button(); _connectCodeEntryField = new Entry(); // Right Side Console _consoleScrolledWindow = new ScrolledWindow(); _consoleLayoutContainer = new VBox(); _consoleParentFrame = new Frame(); _consoleTextView = new TextView(); // _primaryWindowContainer.Name = "_primaryWindowContainer"; _primaryWindowContainer.PackStart(_primaryWindowMenuBar, false, false, 2); _primaryWindowContainer.PackStart(_primaryWindowPane, true, true, 0); _primaryWindowMenuBar.Name = "_primaryWindowMenuBar"; _primaryWindowMenuBar.Append(_primaryMenuItemFile); _primaryWindowMenuBar.Append(_primaryMenuItemAbout); _primaryMenuItemFile.Name = "_primaryMenuItemFile"; _primaryMenuItemFile.Label = "File"; _primaryMenuItemFile.Submenu = _primaryWindowMenuFile; _primaryMenuItemAbout.Name = "_primaryMenuItemAbout"; _primaryMenuItemAbout.Label = "About"; _primaryMenuItemAbout.Activated += _primaryWindowMenuItemAbout_Activated; _primaryWindowMenuFile.Name = "_primaryWindowMenu"; _primaryWindowMenuFile.Append(_primaryWindowInstallLinkHandler); _primaryWindowMenuFile.Append(_primaryWindowMenuQuitItem); _primaryWindowMenuQuitItem.Name = "_primaryWindowMenuQuitItem"; _primaryWindowMenuQuitItem.Label = "Quit"; _primaryWindowMenuQuitItem.Activated += _primaryWindowMenuQuitItem_Activated; _primaryWindowInstallLinkHandler.Name = "_primaryWindowInstallLinkHandler"; _primaryWindowInstallLinkHandler.Label = "One-Click Connection Management"; _primaryWindowInstallLinkHandler.Activated += _primaryWindowInstallLinkWindow_Dialog; // _primaryWindowPane definition (splitContainer1) _primaryWindowPane.Name = "_primaryWindowPane"; _primaryWindowPane.SetSizeRequest(824, 476); _primaryWindowPane.Position = 180; _primaryWindowPane.Pack1(_primaryWindowLeftContainer, true, false); _primaryWindowPane.Pack2(_consoleParentFrame, true, false); _primaryWindowLeftContainer.PackStart(_userSettingsParentFrame, true, true, 10); _primaryWindowLeftContainer.Name = "_primaryWindowLeftContainerH"; _primaryWindowLeftContainer.Margin = 5; // UserSettings _userSettingsParentFrame.Label = "Settings"; _userSettingsParentFrame.Name = "_userSettingsParentFrame"; _userSettingsParentFrame.SetSizeRequest(276, 274); _userSettingsParentFrame.Add(_userSettingsParentContainer); _userSettingsParentContainer.Margin = 5; _userSettingsParentContainer.PackStart(_gameInfoParentFrame, true, false, 10); _userSettingsParentContainer.PackStart(_hostControlFrame, true, false, 10); _userSettingsParentContainer.Name = "_userSettingsParentContainer"; _gameInfoParentFrame.Name = "_gameInfoParentFrame"; _gameInfoParentFrame.Label = "Game Information"; _gameInfoParentFrame.SetSizeRequest(55, 40); _gameInfoParentFrame.Add(_gameInfoParentContainer); _gameInfoParentContainer.Name = "_gameInfoParentContainer"; _gameInfoParentContainer.PackStart(_currentStateFrame, true, false, 10); _gameInfoParentContainer.PackStart(_gameCodeParentFrame, true, false, 10); _gameInfoParentContainer.Margin = 5; // CurrentStateFrame _currentStateFrame.Add(_currentStateContainer); _currentStateFrame.Label = "Current State"; _currentStateFrame.Name = "_currentStateFrame"; _currentStateFrame.SetSizeRequest(55, 40); // CurrentStateBox _currentStateContainer.Name = "_currentStateContainer"; _currentStateContainer.SetSizeRequest(55, 40); _currentStateContainer.PackStart(_currentStateLabel, true, false, 5); _currentStateContainer.Halign = Align.Center; _currentStateContainer.Valign = Align.Center; // CurrentState _currentStateLabel.Name = "_currentStateLabel"; _currentStateLabel.Text = "Disconnected"; // // GAME CODE UI BLOCK // // _gameCodeParentFrame _gameCodeParentFrame.Add(_gameCodeLayoutContainer); _gameCodeParentFrame.Name = "_gameCodeParentFrame"; _gameCodeParentFrame.Label = "Game Code"; _gameCodeLayoutContainer.Name = "_gameCodeLayoutContainer"; _gameCodeLayoutContainer.MarginBottom = 7; _gameCodeLayoutContainer.SetSizeRequest(25, 25); _gameCodeLayoutContainer.PackStart(_gameCodeEntryField, true, false, 10); _gameCodeLayoutContainer.PackStart(_gameCodeCopyButton, true, false, 10); _gameCodeCopyButton.SetSizeRequest(20, 25); _gameCodeCopyButton.Name = "_gameModeCopyButton"; _gameCodeCopyButton.Label = "Copy"; _gameCodeCopyButton.Clicked += _gameCodeCopyButton_Click; _gameCodeEntryField.Xalign = (float)0.5; _gameCodeEntryField.SetSizeRequest(50, 20); _gameCodeEntryField.IsEditable = false; // HOST CONTROL UI BLOCK _hostControlFrame.Name = "_hostControlFrame"; _hostControlFrame.Label = "Server Connection"; _hostControlFrame.Add(_hostControlLayoutContainer); _hostControlLayoutContainer.Name = "_hostControlLayoutContainer"; _hostControlLayoutContainer.Margin = 5; _hostControlLayoutContainer.SetSizeRequest(25, 20); _hostControlLayoutContainer.PackStart(_urlHostEntryFrame, true, false, 5); _hostControlLayoutContainer.PackStart(_connectCodeParentFrame, true, false, 5); _urlHostEntryFrame.Name = "_urlHostEntryFrame"; _urlHostEntryFrame.Label = "Server URL"; _urlHostEntryFrame.Add(_urlHostEntryLayoutContainer); _urlHostEntryLayoutContainer.Name = "_urlHostEntryLayoutContainer"; _urlHostEntryLayoutContainer.SetSizeRequest(70, 20); _urlHostEntryLayoutContainer.PackStart(_urlHostEntryField, true, false, 5); _urlHostEntryLayoutContainer.MarginBottom = 5; _connectCodeParentFrame.Name = "_connectCodeParentFrame"; _connectCodeParentFrame.Label = "Connect Code"; _connectCodeParentFrame.Add(_connectCodeLayoutContainer); _connectCodeLayoutContainer.Name = "_connectCodeLayoutContainer"; _connectCodeLayoutContainer.SetSizeRequest(25, 20); _connectCodeLayoutContainer.PackStart(_connectCodeEntryField, true, false, 5); _connectCodeLayoutContainer.PackStart(_connectCodeSubmitButton, true, false, 5); _connectCodeLayoutContainer.MarginBottom = 5; _connectCodeEntryField.Name = "_connectCodeEntryField"; _connectCodeEntryField.Xalign = (float)0.5; _connectCodeEntryField.SetSizeRequest(70, 20); _connectCodeEntryField.MaxLength = 8; _connectCodeSubmitButton.Name = "_connectCodeSubmitButton"; _connectCodeSubmitButton.Label = "Submit"; _connectCodeSubmitButton.SetSizeRequest(30, 20); _connectCodeSubmitButton.Clicked += _connectCodeSubmitButton_Click; _connectCodeSubmitButton.CanDefault = true; // Right Side _consoleParentFrame.Name = "_consoleParentFrame"; _consoleParentFrame.Label = "Console"; _consoleParentFrame.Add(_consoleLayoutContainer); _consoleLayoutContainer.Name = "_consoleLayoutContainer"; _consoleLayoutContainer.PackStart(_consoleScrolledWindow, true, true, 5); _consoleLayoutContainer.Margin = 5; _consoleScrolledWindow.Name = "_consoleScrolledWindow"; _consoleScrolledWindow.Add(_consoleTextView); _consoleTextView.Name = "_consoleTextView"; _consoleTextView.Editable = false; _consoleTextView.WrapMode = WrapMode.Word; //_autoScrollCheckMenuItem.Name = "_autoscrollMenuItem"; _consoleTextView.PopulatePopup += _consoleTextView_OnPopulateContextMenu; _consoleTextView.Buffer.Changed += _consoleTextView_BufferChanged; SetDefaultSize(824, 476); Add(_primaryWindowContainer); }
private void BuildGui() { HBox headerBox = new HBox(); headerBox.PackStart(new Label(GettextCatalog.GetString("Workspace") + ":"), false, false, 0); _workspaceComboBox.Model = _workspaceStore; var workspaceTextRenderer = new CellRendererText(); _workspaceComboBox.PackStart(workspaceTextRenderer, true); _workspaceComboBox.SetAttributes(workspaceTextRenderer, "text", 1); headerBox.PackStart(_workspaceComboBox, false, false, 0); headerBox.PackStart(manageButton, false, false, 0); headerBox.PackStart(refreshButton, false, false, 0); _view.PackStart(headerBox, false, false, 0); HPaned mainBox = new HPaned(); VBox treeViewBox = new VBox(); TreeViewColumn treeColumn = new TreeViewColumn(); treeColumn.Title = "Folders"; var repoImageRenderer = new CellRendererPixbuf(); treeColumn.PackStart(repoImageRenderer, false); treeColumn.SetAttributes(repoImageRenderer, "pixbuf", 1); var folderTextRenderer = new CellRendererText(); treeColumn.PackStart(folderTextRenderer, true); treeColumn.SetAttributes(folderTextRenderer, "text", 2); _treeView.AppendColumn(treeColumn); treeViewBox.WidthRequest = 250; ScrolledWindow scrollContainer = new ScrolledWindow(); scrollContainer.Add(_treeView); treeViewBox.PackStart(scrollContainer, true, true, 0); mainBox.Pack1(treeViewBox, false, false); VBox rightBox = new VBox(); HBox headerRightBox = new HBox(); headerRightBox.PackStart(new Label(GettextCatalog.GetString("Local Path") + ":"), false, false, 0); Alignment leftAlign = new Alignment(0, 0, 0, 0); _localFolder.Justify = Justification.Left; leftAlign.Add(_localFolder); headerRightBox.PackStart(leftAlign); rightBox.PackStart(headerRightBox, false, false, 0); var itemNameColumn = new TreeViewColumn(); itemNameColumn.Title = "Name"; var itemIconRenderer = new CellRendererPixbuf(); itemNameColumn.PackStart(itemIconRenderer, false); itemNameColumn.SetAttributes(itemIconRenderer, "pixbuf", 1); var itemNameRenderer = new CellRendererText(); itemNameColumn.PackStart(itemNameRenderer, true); itemNameColumn.SetAttributes(itemNameRenderer, "text", 2); _listView.AppendColumn(itemNameColumn); _listView.AppendColumn("Pending Change", new CellRendererText(), "text", 3); _listView.AppendColumn("User", new CellRendererText(), "text", 4); _listView.AppendColumn("Latest", new CellRendererText(), "text", 5); _listView.AppendColumn("Last Check-in", new CellRendererText(), "text", 6); _listView.Selection.Mode = SelectionMode.Multiple; _listView.Model = _listStore; var listViewScollWindow = new ScrolledWindow(); listViewScollWindow.Add(_listView); rightBox.PackStart(listViewScollWindow, true, true, 0); mainBox.Pack2(rightBox, true, true); _view.PackStart(mainBox, true, true, 0); AttachEvents(); _view.ShowAll(); }
public OpeningBrowserUI(OpeningsDb db) : base() { menubar = new AppMenuBar (); title = Catalog.GetString ("Opening Browser"); accel = new AccelGroup (); menubar.quitMenuItem. AddAccelerator ("activate", accel, new AccelKey (Gdk.Key. q, Gdk. ModifierType. ControlMask, AccelFlags. Visible)); toolbutton = new ToolButton (Stock.Info); toolbutton.Label = Catalog.GetString ("Openings"); toolbutton.ShowAll (); this.db = db; store = new TreeStore (typeof (string), typeof (int), typeof (string)); this.db.PopulateTree (store); view = new TreeView (); view.Model = store; view.AppendColumn (Catalog. GetString ("Moves"), new CellRendererText (), "text", 0); view.AppendColumn (Catalog. GetString ("Variations"), new CellRendererText (), "text", 1); view.AppendColumn (Catalog. GetString ("Name"), new CellRendererText (), "markup", 2); ScrolledWindow win = new ScrolledWindow (); win.SetPolicy (PolicyType.Automatic, PolicyType.Automatic); win.Add (view); boardWidget = new GameViewerBoard (); HPaned split = new HPaned (); VBox box = new VBox (); box.PackStart (boardWidget, true, true, 2); split.Pack1 (box, false, true); // resize, shrink split.Pack2 (win, true, true); split.ShowAll (); //split.Position = 400; int width, height; CsBoardApp.Instance.Window.GetSize (out width, out height); split.Position = (int) Math.Round (width * 0.5f); split.PositionSet = true; PackStart (split, true, true, 2); view.CursorChanged += OnCursorChanged; ShowAll (); }
public SearchResultWidget() { var vbox = new VBox(); var toolbar = new Toolbar() { Orientation = Orientation.Vertical, IconSize = IconSize.Menu, ToolbarStyle = ToolbarStyle.Icons, }; this.PackStart(vbox, true, true, 0); this.PackStart(toolbar, false, false, 0); labelStatus = new Label() { Xalign = 0, Justify = Justification.Left, }; var hpaned = new HPaned(); vbox.PackStart(hpaned, true, true, 0); vbox.PackStart(labelStatus, false, false, 0); var resultsScroll = new CompactScrolledWindow(); hpaned.Pack1(resultsScroll, true, true); scrolledwindowLogView = new CompactScrolledWindow(); hpaned.Pack2(scrolledwindowLogView, true, true); textviewLog = new TextView() { Editable = false, }; scrolledwindowLogView.Add(textviewLog); store = new ListStore(typeof(SearchResult), typeof(bool) // didRead ); treeviewSearchResults = new PadTreeView() { Model = store, HeadersClickable = true, RulesHint = true, }; treeviewSearchResults.Selection.Mode = Gtk.SelectionMode.Multiple; resultsScroll.Add(treeviewSearchResults); var projectColumn = new TreeViewColumn { Resizable = true, SortColumnId = 1, Title = GettextCatalog.GetString("Project"), Sizing = TreeViewColumnSizing.Fixed, FixedWidth = 100 }; var projectPixbufRenderer = new CellRendererImage(); projectColumn.PackStart(projectPixbufRenderer, false); projectColumn.SetCellDataFunc(projectPixbufRenderer, ResultProjectIconDataFunc); var renderer = treeviewSearchResults.TextRenderer; renderer.Ellipsize = Pango.EllipsizeMode.End; projectColumn.PackStart(renderer, true); projectColumn.SetCellDataFunc(renderer, ResultProjectDataFunc); treeviewSearchResults.AppendColumn(projectColumn); var fileNameColumn = new TreeViewColumn { Resizable = true, SortColumnId = 2, Title = GettextCatalog.GetString("File"), Sizing = TreeViewColumnSizing.Fixed, FixedWidth = 200 }; var fileNamePixbufRenderer = new CellRendererImage(); fileNameColumn.PackStart(fileNamePixbufRenderer, false); fileNameColumn.SetCellDataFunc(fileNamePixbufRenderer, FileIconDataFunc); fileNameColumn.PackStart(renderer, true); fileNameColumn.SetCellDataFunc(renderer, FileNameDataFunc); treeviewSearchResults.AppendColumn(fileNameColumn); TreeViewColumn textColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Text"), renderer, ResultTextDataFunc); textColumn.Resizable = true; textColumn.Sizing = TreeViewColumnSizing.Fixed; textColumn.FixedWidth = 300; pathColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Path"), renderer, ResultPathDataFunc); pathColumn.SortColumnId = 3; pathColumn.Resizable = true; pathColumn.Sizing = TreeViewColumnSizing.Fixed; pathColumn.FixedWidth = 500; store.DefaultSortFunc = DefaultSortFunc; store.SetSortFunc(1, CompareProjectFileNames); store.SetSortFunc(2, CompareFileNames); store.SetSortFunc(3, CompareFilePaths); treeviewSearchResults.RowActivated += TreeviewSearchResultsRowActivated; buttonStop = new ToolButton(new ImageView(Gui.Stock.Stop, Gtk.IconSize.Menu), null) { Sensitive = false }; buttonStop.Clicked += ButtonStopClicked; buttonStop.TooltipText = GettextCatalog.GetString("Stop"); toolbar.Insert(buttonStop, -1); var buttonClear = new ToolButton(new ImageView(Gui.Stock.Clear, Gtk.IconSize.Menu), null); buttonClear.Clicked += ButtonClearClicked; buttonClear.TooltipText = GettextCatalog.GetString("Clear results"); toolbar.Insert(buttonClear, -1); var buttonOutput = new ToggleToolButton(); buttonOutput.IconWidget = new ImageView(Gui.Stock.OutputIcon, Gtk.IconSize.Menu); buttonOutput.Clicked += ButtonOutputClicked; buttonOutput.TooltipText = GettextCatalog.GetString("Show output"); toolbar.Insert(buttonOutput, -1); buttonPin = new ToggleToolButton(); buttonPin.IconWidget = new ImageView(Gui.Stock.PinUp, Gtk.IconSize.Menu); buttonPin.Clicked += ButtonPinClicked; buttonPin.TooltipText = GettextCatalog.GetString("Pin results pad"); toolbar.Insert(buttonPin, -1); // store.SetSortColumnId (3, SortType.Ascending); ShowAll(); scrolledwindowLogView.Hide(); treeviewSearchResults.FixedHeightMode = true; UpdateStyles(); IdeApp.Preferences.ColorScheme.Changed += UpdateStyles; }
/// <summary> /// Constructor /// </summary> public MainForm(string[] args) : base(null) { commandLineArguments = args; // Gtk.Settings.Default.SetLongProperty("gtk-button-images", 1, ""); // Gtk.Settings.Default.ThemeName = "Raleigh"; // The following code for changing theme settings comes from https://github.com/picoe/Eto/issues/442 // The XftRgba setting makes a big difference on Windows // Get the Global Settings //Settings setts = Gtk.Settings.Default; // This enables clear text on Win32, makes the text look a lot less crappy //setts.XftRgba = "rgb"; // This enlarges the size of the controls based on the dpi //setts.XftDpi = 96; // By Default Anti-aliasing is enabled, if you want to disable it for any reason set this value to 0 // setts.XftAntialias = 0; // Enable text hinting // setts.XftHinting = 1; // setts.XftHintstyle = "hintslight"; // setts.XftHintstyle = "hintfull"; // Load the Theme // Gtk.CssProvider css_provider = new Gtk.CssProvider(); // css_provider.LoadFromPath("themes/DeLorean-3.14/gtk-3.0/gtk.css"); // css_provider.LoadFromPath("themes/DeLorean-Dark-3.14/gtk-3.0/gtk.css"); // Gtk.StyleContext.AddProviderForScreen(Gdk.Screen.Default, css_provider, 800) // Glade can generate files in two different formats: libglade or GtkBuilder. // libglade is the older format; GtkBuilder is intended to eventually replace it. // However, in the GtkSharp layer (well, version 2 anyway), the support for // GtkBuilder lacks the ability to autoconnect widgets and events contained // in the glade descriptions. The connections must be done manually. // In GtkSharp version 3, though, Builder does have an Autoconnect member for // event connections. // What is the better way to add resources to a .NET assembly? // Should we use the .resx mechanism, or just add things and // set their Build Action to "Embedded Resource"? // Depending on how the resources are added, they are read in // slightly different ways, apparently. So we might instead have: // Builder Gui = new Builder(); // Gui.AddFromString(GTKUserInterface.Properties.Resources.MainForm); // Here's how we load the form description using an embedded GtkBuilder file // Builder Gui = new Builder("GTKUserInterface.Resources.Glade.MainForm.glade"); // window1 = (Window)Gui.GetObject("window1"); // hpaned1 = (HPaned)Gui.GetObject("hpaned1"); // And here's part of how it works with libglade format. // The "[Widget]" attributes are part of the libglade // autoconnection stuff, replacing the need for the .GetObject // calls used with GtkBuilder. //Console.WriteLine("") //Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("ApsimNG.Resources.Glade.MainForm.glade"); //Glade.XML gxmla = new Glade.XML(s, "mainWindow", null); Glade.XML gxml = new Glade.XML("ApsimNG.Resources.Glade.MainForm.glade", "mainWindow"); gxml.Autoconnect(this); _mainWidget = mainWindow; mainWindow.Icon = new Gdk.Pixbuf(null, "ApsimNG.Resources.apsim logo32.png"); Presenter1 = new Presenters.TabbedExplorerPresenter(); Presenter2 = new Presenters.TabbedExplorerPresenter(); TabbedExplorerView ExplorerView1 = new TabbedExplorerView(this); TabbedExplorerView ExplorerView2 = new TabbedExplorerView(this); Presenter1.Attach(ExplorerView1); Presenter2.Attach(ExplorerView2); hpaned1.Pack1(ExplorerView1.MainWidget, true, true); hpaned1.Pack2(ExplorerView2.MainWidget, true, true); hpaned1.PositionSet = true; hpaned1.Child2.Hide(); hpaned1.Child2.NoShowAll = true; Console.WriteLine("Getting assembly version"); // Get the version of the current assembly. Version version = Assembly.GetExecutingAssembly().GetName().Version; if (version.Major == 0) { mainWindow.Title = "APSIM (Custom Build)"; } else { mainWindow.Title = "APSIM " + version.ToString(); } try { if (Utility.Configuration.Settings.MainFormMaximized) { mainWindow.GdkWindow.Maximize(); } else { System.Drawing.Point location = Utility.Configuration.Settings.MainFormLocation; System.Drawing.Size size = Utility.Configuration.Settings.MainFormSize; mainWindow.Move(location.X, location.Y); mainWindow.Resize(size.Width, size.Height); } } catch (System.Exception) { mainWindow.GdkWindow.Maximize(); } // Look for a script specified on the command line. if (commandLineArguments != null && commandLineArguments.Length > 0) { if (commandLineArguments[0].EndsWith(".cs")) { try { ProcessStartupScript(commandLineArguments[0]); } catch (Exception err) { ErrorMessage = err.Message; if (err.InnerException != null) { ErrorMessage += "\r\n" + err.InnerException.Message; } ErrorMessage += "\r\n" + err.StackTrace; queryClose = false; mainWindow.Destroy(); // Is this right? } } else if (commandLineArguments[0].EndsWith(".apsimx")) { Presenter1.OpenApsimXFileInTab(commandLineArguments[0]); } } }
// VERY IMPORTANT!!!!!!!!!!!! // After the call to Application.Init() NullReferenceExceptions // will no longer be thrown. This is an active bug in GtkSharp // and can be tracked here https://github.com/GtkSharp/GtkSharp/issues/155 // Hopefully this can be fixed sooner rather than later... static void Main() { Backend = Logic.Init(); CultureInfo.CurrentCulture = CultureInfo.InvariantCulture; Value a = new Value(0b00_00_00_00_01_01_01_01_10_10_10_10_11_11_11_11, 16); Value b = new Value(0b00_01_10_11_00_01_10_11_00_01_10_11_00_01_10_11, 16); Console.WriteLine($"Resolve: {Value.Resolve(a, b)}"); Console.WriteLine($"And: {Value.And(a, b)}"); Console.WriteLine($"Or: {Value.Or(a, b)}"); Console.WriteLine($"Not: {Value.Not(a)}"); Application.Init(); GLib.ExceptionManager.UnhandledException += ExceptionManager_UnhandledException; Window wnd = new Window("Logik"); wnd.Resize(1600, 800); Notebook nbook = new Notebook(); var circuitEditor = new CircuitEditor(); nbook.AppendPage(circuitEditor.DrawingArea, new Label("Circuit editor")); nbook.AppendPage(new Label("TODO: Package editor"), new Label("Package editor")); Notebook sideBar = new Notebook(); var components = new ComponentView(new List <ComponentFolder> { new ComponentFolder("Test folder 1", new List <Component.Component>() { new Component.Component("Test comp 1", "x-office-document"), new Component.Component("Test comp 2", "x-office-document"), new Component.Component("Test comp 3", "x-office-document"), }), new ComponentFolder("Test folder 2", new List <Component.Component>() { new Component.Component("Another test comp 1", "x-office-document"), new Component.Component("Another test comp 2", "x-office-document"), new Component.Component("Another test comp 3", "x-office-document"), }), }); sideBar.AppendPage(components.TreeView, new Label("Components")); var hierarchy = new HierarchyView(new HierarchyComponent("Top comp", "x-office-document", new List <HierarchyComponent>() { new HierarchyComponent("Test Comp 1", "x-office-document", new List <HierarchyComponent>() { new HierarchyComponent("Test Nested Comp 1", "x-office-document", new List <HierarchyComponent>()), }), new HierarchyComponent("Test Comp 2", "x-office-document", new List <HierarchyComponent>() { new HierarchyComponent("Test Nested Comp 1", "x-office-document", new List <HierarchyComponent>()), new HierarchyComponent("Test Nested Comp 2", "x-office-document", new List <HierarchyComponent>()), }), new HierarchyComponent("Test Comp 3", "x-office-document", new List <HierarchyComponent>()), })); sideBar.AppendPage(hierarchy.TreeView, new Label("Hierarchy")); HPaned hPaned = new HPaned(); hPaned.Pack1(sideBar, false, false); hPaned.Pack2(nbook, true, false); //Add the label to the form VBox box = new VBox(false, 0); box.PackStart(CreateMenuBar(wnd), false, false, 0); box.PackStart(CreateToolbar(circuitEditor), false, false, 0); box.PackEnd(hPaned, true, true, 0); box.Expand = true; wnd.Add(box); wnd.Destroyed += Wnd_Destroyed; wnd.ShowAll(); Application.Run(); }
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 = $"{attr.Title} (BETA) {asmName.Version} (Protocol 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 (Runtime.Core.Platform.OSName == "macOS") { 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 Runtime.Core.ShareBuilder.StartedIndexing += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_StartedIndexing)); Runtime.Core.ShareBuilder.FinishedIndexing += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_FinishedIndexing)); Runtime.Core.ShareBuilder.StoppedIndexing += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_StoppedIndexing)); Runtime.Core.ShareBuilder.ErrorIndexing += (ErrorEventHandler)DispatchService.GuiDispatch(new ErrorEventHandler(sb_ErrorIndexing)); Runtime.Core.ShareHasher.StartedHashingFile += (ShareHasherTaskEventHandler)DispatchService.GuiDispatch(new ShareHasherTaskEventHandler(sh_StartedFinished)); Runtime.Core.ShareHasher.FinishedHashingFile += (ShareHasherTaskEventHandler)DispatchService.GuiDispatch(new ShareHasherTaskEventHandler(sh_StartedFinished)); Runtime.Core.ShareHasher.QueueChanged += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sh_QueueChanged)); Runtime.Core.FileSearchManager.SearchAdded += (FileSearchEventHandler)DispatchService.GuiDispatch(new FileSearchEventHandler(FileSearchManager_SearchAdded)); Runtime.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; }
public SearchResultWidget() { var vbox = new VBox(); var toolbar = new Toolbar() { Orientation = Orientation.Vertical, IconSize = IconSize.Menu, ToolbarStyle = ToolbarStyle.Icons, }; this.PackStart(vbox, true, true, 0); this.PackStart(toolbar, false, false, 0); labelStatus = new Label() { Xalign = 0, Justify = Justification.Left, }; var hpaned = new HPaned(); vbox.PackStart(hpaned, true, true, 0); vbox.PackStart(labelStatus, false, false, 0); var resultsScroll = new CompactScrolledWindow(); hpaned.Pack1(resultsScroll, true, true); scrolledwindowLogView = new CompactScrolledWindow(); hpaned.Pack2(scrolledwindowLogView, true, true); textviewLog = new TextView() { Editable = false, }; scrolledwindowLogView.Add(textviewLog); store = new ListStore(typeof(SearchResult), typeof(bool) // didRead ); treeviewSearchResults = new PadTreeView() { Model = store, HeadersClickable = true, RulesHint = true, }; treeviewSearchResults.Selection.Mode = Gtk.SelectionMode.Multiple; resultsScroll.Add(treeviewSearchResults); this.ShowAll(); var fileNameColumn = new TreeViewColumn { Resizable = false, SortColumnId = 0, Title = GettextCatalog.GetString("File") }; fileNameColumn.FixedWidth = 200; var fileNamePixbufRenderer = new CellRendererPixbuf(); fileNameColumn.PackStart(fileNamePixbufRenderer, false); fileNameColumn.SetCellDataFunc(fileNamePixbufRenderer, FileIconDataFunc); fileNameColumn.PackStart(treeviewSearchResults.TextRenderer, true); fileNameColumn.SetCellDataFunc(treeviewSearchResults.TextRenderer, FileNameDataFunc); treeviewSearchResults.AppendColumn(fileNameColumn); // TreeViewColumn lineColumn = treeviewSearchResults.AppendColumn (GettextCatalog.GetString ("Line"), new CellRendererText (), ResultLineDataFunc); // lineColumn.SortColumnId = 1; // lineColumn.FixedWidth = 50; // TreeViewColumn textColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Text"), treeviewSearchResults.TextRenderer, ResultTextDataFunc); textColumn.SortColumnId = 2; textColumn.Resizable = false; textColumn.FixedWidth = 300; TreeViewColumn pathColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Path"), treeviewSearchResults.TextRenderer, ResultPathDataFunc); pathColumn.SortColumnId = 3; pathColumn.Resizable = false; pathColumn.FixedWidth = 500; store.SetSortFunc(0, CompareFileNames); // store.SetSortFunc (1, CompareLineNumbers); store.SetSortFunc(3, CompareFilePaths); treeviewSearchResults.RowActivated += TreeviewSearchResultsRowActivated; buttonStop = new ToolButton(Stock.Stop) { Sensitive = false }; buttonStop.Clicked += ButtonStopClicked; buttonStop.TooltipText = GettextCatalog.GetString("Stop"); toolbar.Insert(buttonStop, -1); var buttonClear = new ToolButton(Gtk.Stock.Clear); buttonClear.Clicked += ButtonClearClicked; buttonClear.TooltipText = GettextCatalog.GetString("Clear results"); toolbar.Insert(buttonClear, -1); var buttonOutput = new ToggleToolButton(Gui.Stock.OutputIcon); buttonOutput.Clicked += ButtonOutputClicked; buttonOutput.TooltipText = GettextCatalog.GetString("Show output"); toolbar.Insert(buttonOutput, -1); buttonPin = new ToggleToolButton(Gui.Stock.PinUp); buttonPin.Clicked += ButtonPinClicked; buttonPin.TooltipText = GettextCatalog.GetString("Pin results pad"); toolbar.Insert(buttonPin, -1); store.SetSortColumnId(3, SortType.Ascending); ShowAll(); scrolledwindowLogView.Hide(); }
public static Widget show_chat_form() { //新建窗体,标题是Hello World var win = new Gtk.Window("聊天"); win.SetDefaultSize(800, 600); //win.SetSizeRequest(800, 600); //窗体关闭后退出应用 //win.DeleteEvent += (s, e) => //{ // Gtk.Application.Quit(); //}; win.WindowPosition = WindowPosition.Center; //win.Resizable = false; win.BorderWidth = 10; var paned1 = new VPaned(); win.Add(paned1); var paned2 = new HPaned(); paned1.SetSizeRequest(200, -1); paned2.SetSizeRequest(200, -1); paned1.Add(paned2); var button1 = new Button("按钮一"); paned1.Pack1(button1, true, false); var button2 = new Button("按钮二"); paned2.Pack1(button2, true, false); var paned3 = new VPaned(); paned3.SetSizeRequest(200, -1); paned2.Pack2(paned3, true, false); //var button3 = new Button("按钮三"); RecvChatWidget = new TextView(); var recvScrollView = new ScrolledWindow(); recvScrollView.Add(RecvChatWidget); //RecvChatWidget.SizeAllocated += new SizeAllocatedHandler(ScrollToBottom); paned3.Pack1(recvScrollView, true, false); //var button4 = new Button("按钮四"); SendChatWidget = new TextView(); var sendScrollView = new ScrolledWindow(); sendScrollView.Add(SendChatWidget); var vbox = new VBox(false, 0); var hbox = new VBox(true, 0); var sendMsgBtn = new Button("发送消息"); sendMsgBtn.Clicked += (s, e) => { TextIter start, end; RecvChatWidget.Buffer.GetBounds(out start, out end); RecvChatWidget.Buffer.Insert(ref end, SendChatWidget.Buffer.Text); RecvChatWidget.Buffer.Insert(ref end, "\n"); RecvChatWidget.ScrollToIter(RecvChatWidget.Buffer.EndIter, 0.0, false, 0.0, 0.0); }; hbox.PackStart(sendMsgBtn, false, false, 0); vbox.PackStart(hbox, false, false, 0); vbox.PackEnd(sendScrollView, true, true, 0); paned3.Pack2(vbox, true, false); win.ShowAll(); return(paned1); }