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 ();
            }
Пример #2
0
        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");

            arcSelBox.PackStart(l1, true, true, 0); l1.Show();
            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.AddWithViewport((RuleList as ViewBase).MainWidget);
            (RuleList as ViewBase).MainWidget.ShowAll();
            arcSelBox.PackStart(rules, true, true, 0); rules.Show();

            Label l2 = new Label("Actions");

            arcSelBox.PackStart(l2, true, true, 0); l2.Show();
            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.AddWithViewport((ActionList as ViewBase).MainWidget);
            (ActionList as ViewBase).MainWidget.ShowAll();
            arcSelBox.PackStart(actions, true, true, 0); actions.Show();
            arcSelWdgt = arcSelBox as Widget;
            arcSelWdgt.HideAll();
            ctxBox.PackStart(arcSelWdgt, true, true, 0);

            // Node selection:
            Table t1 = new Table(3, 2, false);
            Label l3 = new Label("Name");

            l3.Xalign = 0;
            t1.Attach(l3, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            Label l4 = new Label("Description");

            l4.Xalign = 0;
            t1.Attach(l4, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            Label l5 = new Label("Colour");

            l5.Xalign = 0;
            t1.Attach(l5, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            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, 2, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            descEntry              = new Entry();
            descEntry.Xalign       = 0;
            descEntry.Changed     += OnDescriptionChanged;
            descEntry.WidthRequest = 350;
            t1.Attach(descEntry, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            colourChooser              = new ColorButton();
            colourChooser.Xalign       = 0;
            colourChooser.ColorSet    += OnColourChanged;
            colourChooser.WidthRequest = 350;
            t1.Attach(colourChooser, 1, 2, 2, 3, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            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.\n";
            infoWdgt = l6 as Widget;
            infoWdgt.ShowAll();
            Alignment infoWdgtWrapper = new Alignment(0, 0, 0, 0);

            infoWdgtWrapper.Add(infoWdgt);
            //ctxBox.PackStart(infoWdgt, true, true, 0);
            //vbox1.PackStart(ctxBox, false, false, 0);

            settingsBox = new VBox();
            //settingsBox.PackStart(new Label("Initial State"), false, false, 0);
            combobox1 = new ComboBox();
            combobox1.PackStart(comboRender, false);
            combobox1.AddAttribute(comboRender, "text", 0);
            combobox1.Model = comboModel;
            settingsBox.PackStart(combobox1, false, false, 0);


            hpaned1 = new HPaned();
            hpaned2 = new HPaned();
            Frame frame1 = new Frame("Initial State");

            frame1.Add(settingsBox);
            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);
        }
Пример #3
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();
        }
        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();
        }
Пример #5
0
        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(Ide.Gui.Stock.Stop)
            {
                Sensitive = false
            };

            buttonStop.Clicked += ButtonStopClicked;

            buttonStop.TooltipText = GettextCatalog.GetString("Stop");
            toolbar.Insert(buttonStop, -1);

            var buttonClear = new ToolButton(Ide.Gui.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();
            treeviewSearchResults.FixedHeightMode = true;
        }
Пример #6
0
        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);
        }
Пример #7
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();
        }
Пример #8
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}");
            }
        }
Пример #9
0
        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);
        }
Пример #10
0
        public TestResultsPad()
        {
            UnitTestService.TestSuiteChanged     += new EventHandler(OnTestSuiteChanged);
            IdeApp.Workspace.WorkspaceItemClosed += OnWorkspaceItemClosed;

            panel = new VBox {
                Name = "testResultBox"
            };

            // 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 {
                Name = "testResultsTree"
            };
            failuresTreeView.HeadersVisible = false;
            failuresStore = new TreeStore(typeof(Xwt.Drawing.Image), typeof(string), typeof(object), typeof(string), typeof(int), typeof(int));
            SemanticModelAttribute modelAttr = new SemanticModelAttribute("store__Image", "store__Message", "store__RootTest",
                                                                          "store__FileName", "store__FileNumber", "store__ErrorOrStackTrace");

            TypeDescriptor.AddAttributes(failuresStore, modelAttr);

            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 {
                Name = "testResultOutput"
            };
            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/UnitTesting/ContextMenu/TestResultsPad");
            };

            panel.ShowAll();

            outputViewScrolled.Hide();
        }