コード例 #1
0
        public RecentFileListWindow(string title, Gtk.Window parent, DialogFlags flags, params object[] button_data) : base(title, parent, flags, button_data)
        {
            _searchView = new Gtk.Entry("");
            _searchView.SetSizeRequest(500, 40);
            _searchView.Changed         += _searchView_Changed;
            _searchView.KeyReleaseEvent += HandleSearchViewKeyReleaseEvent;
            _searchView.KeyPressEvent   += HandleKeyPressEvent;
            _searchView.FocusOutEvent   += HandleFocusOutEvent;
            VBox.Add(_searchView);

            CreateTree();
            _scrolledWindow = new Gtk.ScrolledWindow();
            _scrolledWindow.SetSizeRequest(500, 600);
            _scrolledWindow.Add(_treeView);
            VBox.Add(_scrolledWindow);
            _pathLabel = new Gtk.Label();
            _pathLabel.SetSizeRequest(500, 40);
            VBox.Add(_pathLabel);

            MemberExtensionsHelper.Instance.IsDirty = true;
            UpdateDocuments();
            VBox.SetSizeRequest(500, 700);
            this.SetSizeRequest(500, 700);

            CanFocus               = true;
            _searchView.CanFocus   = true;
            _searchView.IsEditable = true;
            _searchView.GrabFocus();
            ShowAll();
        }
コード例 #2
0
        public WelcomeDialog()
        {
            // Window Setup
            WindowPosition = WindowPosition.CenterAlways;
            SetSizeRequest(WINDOW_WIDTH, WINDOW_HEIGHT);
            Resizable = false;
            Title     = "Welcome to my Sample!";
            Events    = Gdk.EventMask.AllEventsMask;
            CanFocus  = true;

            // Elements Setup
            informationLabel = new Label("Welcome to my Sample Visual Studio for Mac Extension. This is window is provided to display some welcome message.");
            informationLabel.Layout.Alignment = Pango.Alignment.Center;

            confirmButton          = new Button();
            confirmButton.Label    = "OK";
            confirmButton.Clicked += (s, e) => {
                PropertyService.Set(Constants.Properties.HasDisplayedWelcomeKey, true);
                PropertyService.SaveProperties();
                Hide();
            };

            // Layout Setup
            VBox.SetSizeRequest(WINDOW_WIDTH, WINDOW_HEIGHT);
            VBox.Add(informationLabel);
            VBox.Add(confirmButton);
            VBox.Events   = Gdk.EventMask.AllEventsMask;
            VBox.CanFocus = true;

            ShowAll();
        }
コード例 #3
0
        public static void Init()
        {
            MKL.Lic("Development Log - GUI.cs", "GNU General Public License 3");
            MKL.Version("Development Log - GUI.cs", "21.08.28");
            Application.Init();
            win = new MainWindow();
            win.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 0));
            win.SetSizeRequest(1200, 800);
            win.Resizable = false;
            win.Title     = $"Development log - version {MKL.Newest} - Coded by: Tricky";
            Tabber        = new Notebook(); Tabber.SetSizeRequest(1000, 770);
            Tabber.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 20));
            Console          = new TextView();
            Console.Editable = false;
            Console.ModifyFont(Pango.FontDescription.FromString("Courier 18"));
            Console.SizeAllocated += new SizeAllocatedHandler(ConsoleDOWN);
            Prompt = new Entry();
            var overlord  = new VBox();
            var superior  = new HBox();
            var sidebar   = new VBox(); sidebar.SetSizeRequest(200, 770);
            var mainarea  = new VBox();
            var cscroll   = new ScrolledWindow();
            var promptbar = new HBox();

            InitSidebar(sidebar);
            win.Add(overlord);
            overlord.Add(superior); superior.SetSizeRequest(1200, 600);
            overlord.Add(cscroll); cscroll.SetSizeRequest(1200, 170); cscroll.Add(Console);
            overlord.Add(promptbar); promptbar.SetSizeRequest(1200, 30); promptbar.Add(Prompt);
            var pOk = new Button("Ok");

            pOk.SetSizeRequest(50, 30);
            pOk.Clicked      += AndACTION;
            Prompt.Activated += AndACTION;
            Prompt.SetSizeRequest(1150, 30);
            promptbar.Add(pOk);
            Console.ModifyBase(StateType.Normal, new Gdk.Color(0, 20, 0));
            Console.ModifyText(StateType.Normal, new Gdk.Color(0, 255, 0));
            Prompt.ModifyBase(StateType.Normal, new Gdk.Color(25, 18, 0));
            Prompt.ModifyText(StateType.Normal, new Gdk.Color(255, 180, 0));
            superior.Add(sidebar);
            superior.Add(mainarea);
            mainarea.Add(Tabber);
            GeneralInit(NewTab("General"));
            TagsInit(NewTab("Tags"));
            InitEntries(NewTab("Entries"));
            InitPrefix(NewTab("AutoPrefix"));
            InitHistory(NewTab("Command History"));
            WriteLn("Welcome to Devlog!");
            WriteLn("Coded by: Tricky");
            WriteLn($"(c) 2016-20{qstr.Left(MKL.Newest,2)} Jeroen P. Broks");
            WriteLn("Released under the terms of the General Public License v3\n");
            AutoEnable();
//#if KEYDEBUG
            //WriteLn("KEYDEBUG is set!");
            //Prompt.KeyPressEvent += KeyDebug;
            //Prompt.KeyPressEvent += StoreProperty;
//#endif
        }
コード例 #4
0
 static public void Configure(Gdk.EventConfigure args)
 {
     Girl.SetSizeRequest(390, 364);
     MenuBoxRoot.SetSizeRequest(args.Width - 390, 364);
     WorkBox.SetSizeRequest(args.Width, args.Height - 364);
     ListRecords.SetSizeRequest(250, args.Height - 364);
     Pages.SetSizeRequest(args.Width - 250, args.Height - 364);
 }
コード例 #5
0
        public static void Main(string[] args)
        {
            MKL.Version("ScenLang - Creation Wizard - ScenLangCreate.cs", "18.10.23");
            MKL.Lic("ScenLang - Creation Wizard - ScenLangCreate.cs", "GNU General Public License 3");
            JCR6_lzma.Init();
            Application.Init();
            MainWindow win = new MainWindow();

            win.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 25));
            win.Title = "ScenLang Creator - version " + MKL.Newest;
            win.SetSizeRequest(1000, 500);
            var mainbox = new HBox(); win.Add(mainbox);

            mainbox.SetSizeRequest(400, 500);
            var mascot = new Image();

            mascot.SetAlignment(0, 1);
            mainbox.Add(mascot);
            LoadMascot(mascot);
            mascot.SetSizeRequest(400, 500);
            workbox = new VBox(); mainbox.Add(workbox);
            workbox.SetSizeRequest(600, 500);
            AddEntry("Project", "Project directory:", true);
            AddEntry("Author", "Author:");
            AddEntry("License", "License:");
            var langbox = new HBox();

            langbox.SetSizeRequest(600, 380);
            var langlabel = new Label("Laguages:\n(Put every language on a new line)");

            langlabel.SetSizeRequest(300, 380);
            langlabel.SetAlignment(0, 0);
            langlabel.ModifyFg(StateType.Normal, new Gdk.Color(255, 255, 0));
            var scroll = new ScrolledWindow();

            Languages = new TextView();
            scroll.Add(Languages);
            scroll.SetSizeRequest(300, 380);
            Languages.ModifyBase(StateType.Normal, new Gdk.Color(0, 18, 25));
            Languages.ModifyText(StateType.Normal, new Gdk.Color(0, 180, 255));
            langbox.Add(langlabel);
            langbox.Add(scroll);
            workbox.Add(langbox);
            var finbox  = new HBox();
            var goforit = new Button("Create Project");

            finbox.Add(new HBox());
            finbox.Add(goforit);
            goforit.Clicked += OnGoForIt;
            workbox.Add(finbox);
            win.ShowAll();
            Application.Run();
        }
コード例 #6
0
        public ConfigureApiKeyDialog()
        {
            const int windowWidth  = 400;
            const int windowHeight = 150;

            this.WindowPosition = WindowPosition.CenterAlways;
            this.SetSizeRequest(windowWidth, windowHeight);
            this.Resizable = false;

            this.Title  = "Set API Key";
            this.Events = Gdk.EventMask.AllEventsMask;
            CanFocus    = true;

            VBox.SetSizeRequest(windowWidth, windowHeight);

            informationLabel = new Label("Enter your API key for Google Translation Services");
            informationLabel.Layout.Alignment = Pango.Alignment.Center;

            apiKeyEntry            = new Entry();
            apiKeyEntry.CanFocus   = true;
            apiKeyEntry.Events     = Gdk.EventMask.AllEventsMask;
            apiKeyEntry.Text       = PropertyService.Get(PropertyKeys.TranslationApiPropertyKey, "");
            apiKeyEntry.IsEditable = true;


            confirmButton          = new Button();
            confirmButton.Label    = "Save API Key";
            confirmButton.Clicked += (object sender, EventArgs e) =>
            {
                PropertyService.Set(PropertyKeys.TranslationApiPropertyKey, apiKeyEntry.Text);
                PropertyService.SaveProperties();
                this.Hide();
            };

            helpButton          = new Button();
            helpButton.Label    = "How Do I Get An API Key?";
            helpButton.Clicked += (object sender, EventArgs e) =>
            {
                Process.Start("https://cloud.google.com/translate/docs/translating-text");
            };

            VBox.Add(informationLabel);
            VBox.Add(apiKeyEntry);
            VBox.Add(confirmButton);
            VBox.Add(helpButton);

            VBox.Events   = Gdk.EventMask.AllEventsMask;
            VBox.CanFocus = true;

            ShowAll();
        }
コード例 #7
0
ファイル: HTMLView.cs プロジェクト: pre078/ApsimX
        // Allow this isn't the obvious way to do the window resizing,
        // I couldn't find any better technique.
        public void OnWidgetExpose(object o, ExposeEventArgs args)
        {
            int height, width;

            frame1.GdkWindow.GetSize(out width, out height);
            vbox2.SetSizeRequest(width, height);
            if (browser is TWWebBrowserIE)
            {
                (browser as TWWebBrowserIE).socket.SetSizeRequest(width, height);
                (browser as TWWebBrowserIE).wb.Height = height;
                (browser as TWWebBrowserIE).wb.Width  = width;
            }
            //else
            //    (browser as TWWebBrowserWK).wb.SetSizeRequest(width, height);
        }
コード例 #8
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        Build();
        ModifyBg(StateType.Normal, new Gdk.Color(50, 50, 50));
        //Design
        VBox allContent = new VBox(false, 2);
        //Alignment hAllign = new Alignment(0, 0, 0, 0);
        //hBox.PackStart(hAllign, false, false, 1);
        //connectionStatus.SetSizeRequest(50, 50);

        Label compLabel       = new Label("Compression Ratio");
        Label imgSizeLabel    = new Label("Image size");
        Label colorDepthLabel = new Label("Color depth");
        Label FPSLabel        = new Label("Frames per second");

        strImgSize.Value = 300;
        FPS.Value        = 60;

        Label uncprsDataLable   = new Label("Uncopressed data");
        Label cprsDataLabel     = new Label("Compressed data");
        Label cycleReceiveLAbel = new Label("Receive cycles per second");
        Label cycleSendLabel    = new Label("Sending cycles per second");
        Label thrSleepLabel     = new Label("Thread sleep time");

        rightSide.Add(imgSizeLabel);
        rightSide.Add(strImgSize);
        rightSide.Add(compLabel);
        rightSide.Add(strImgCompression);
        rightSide.Add(colorDepthLabel);
        rightSide.Add(strImgCD);
        rightSide.Add(FPSLabel);
        rightSide.Add(FPS);
        rightSide.Add(cycleReceiveLAbel);
        rightSide.Add(cycleSpeedReceive);
        rightSide.Add(cycleSendLabel);
        rightSide.Add(cycleSpeedSend);
        rightSide.Add(thrSleepLabel);
        rightSide.Add(thrSleepTime);
        //rightSide.Add(connectionStatus);
        rightSide.Add(aliveMeter);
        //rightSide.Add(currIP);
        rightSide.Add(uncprsDataLable);
        rightSide.Add(dataAmount);
        rightSide.Add(cprsDataLabel);
        rightSide.Add(compressedDataAmount);

        Alignment vAlignRP = new Alignment(0, 0, 1, 0);

        vAlignRP.Add(rightSide);
        vAlignRP.SetSizeRequest(200, 300);

        VBox   connectPart = new VBox(true, 0);
        Button connectBtn  = new Button("Connect");

        connectBtn.Pressed += NetworkLogic.ConnectBtnPressed;
        connectPart.Add(connectIP);
        connectPart.Add(connectBtn);
        Alignment vAlignConnect = new Alignment(0, 0, 1, 0);

        vAlignConnect.Add(connectPart);
        vAlignConnect.SetSizeRequest(200, 200);

        Alignment consoleTop = new Alignment(0, 0, 0, 0);

        consoleTop.Add(consoleTxt);
        VBox consoleLabelHolder = new VBox(false, 0);

        consoleLabelHolder.PackStart(consoleTop);
        consoleLabelHolder.SetSizeRequest(500, 500);


        HBox mainBox = new HBox(false, 0);

        mainBox.SetSizeRequest(600, 480);
        mainBox.Add(vAlignConnect);
        mainBox.Add(vAlignRP);
        mainBox.PackEnd(consoleLabelHolder);

        MenuBar  menuBar  = new MenuBar();
        Menu     fileMenu = new Menu();
        MenuItem file     = new MenuItem("File");

        file.Submenu = fileMenu;
        MenuItem exit = new MenuItem("Exit");

        exit.Activated += OnExitEvent;
        fileMenu.Append(exit);
        menuBar.Append(file);

        allContent.PackStart(menuBar, false, false, 0);
        allContent.PackEnd(mainBox, false, false, 0);

        Add(allContent);

        ShowAll();

        Thread aMC = new Thread(AliveMeterCount);

        aMC.Start();
    }
コード例 #9
0
        private void GenerateTabs()

        {
            VBox tab = new VBox();

            Image img = new Image();

            img.Pixbuf = Images.GetPixbuf("options-general.png");

            tab.PackStart(img, false, false, 2);

            tab.PackEnd(new Label("General"), false, false, 0);

            tab.SetSizeRequest(60, 50);

            tab.ShowAll();

            optionTabs.AppendPage(GenerateGeneral(), tab);



            tab = new VBox();

            img = new Image();

            img.Pixbuf = Images.GetPixbuf("options-text-editors.png");

            tab.PackStart(img, false, false, 2);

            tab.PackEnd(new Label("Text Editors"), false, false, 0);

            tab.SetSizeRequest(60, 50);

            tab.ShowAll();

            optionTabs.AppendPage(GenerateTextEditors(), tab);



            tab = new VBox();

            img = new Image();

            img.Pixbuf = Images.GetPixbuf("options-results.png");

            tab.PackStart(img, false, false, 2);

            tab.PackEnd(new Label("Results"), false, false, 0);

            tab.SetSizeRequest(60, 50);

            tab.ShowAll();

            optionTabs.AppendPage(GenerateResults(), tab);



            tab = new VBox();

            img = new Image();

            img.Pixbuf = Images.GetPixbuf("options-plugins.png");

            tab.PackStart(img, false, false, 2);

            tab.PackEnd(new Label("Plugins"), false, false, 0);

            tab.SetSizeRequest(60, 50);

            tab.ShowAll();

            optionTabs.AppendPage(GeneratePlugins(), tab);



            tab.Dispose();

            img.Dispose();



            optionTabs.SwitchPage += new SwitchPageHandler(optionTabs_SwitchPage);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        private void AddWidgetsAndShow(EditorMode editorMode)
        {
            /* Set a handler for delete_event that immediately
             * exits GTK. */
            DeleteEvent += delete_event;

            if (null != TopLevelHBox)
            {
                TopLevelHBox.Hide();
                TopLevelHBox.Destroy();
                TopLevelHBox = null;
            }

            CurrentMode = editorMode;


            EditorWidget = null;

            switch (editorMode)
            {
            case EditorMode.Level:
                EditorWidget = new LevelEditLayout();
                ((LevelEditLayout)EditorWidget).TreeRefreshNeeded += TreeRefreshNeeded_Event;
                break;

            case EditorMode.Turret:
                EditorWidget = new TurretEditLayout();
                ((TurretEditLayout)EditorWidget).TreeRefreshNeeded += TreeRefreshNeeded_Event;
                break;

            case EditorMode.Enemy:
                EditorWidget = new EnemyEditLayout();
                ((EnemyEditLayout)EditorWidget).TreeRefreshNeeded += TreeRefreshNeeded_Event;
                break;

            case EditorMode.Projectile:
                EditorWidget = new ProjectileEditLayout();
                ((ProjectileEditLayout)EditorWidget).TreeRefreshNeeded += TreeRefreshNeeded_Event;
                break;

            case EditorMode.Analysis:
                EditorWidget = new LevelAnalysisLayout();
                ((LevelAnalysisLayout)EditorWidget).TreeRefreshNeeded += TreeRefreshNeeded_Event;
                break;
            }

            TopLevelHBox = new HBox(false, 0);
            Add(TopLevelHBox);
            TopLevelHBox.Show();

            //
            // Lefthand column
            //

            VBox vbox = new VBox(false, 0);

            TopLevelHBox.PackStart(vbox, false, true, 5);
            vbox.SetSizeRequest(100, -1);
            vbox.Show();

            Button addLevelButton = new Button("+");

            addLevelButton.Clicked += AddButton_Clicked;
            vbox.PackStart(addLevelButton, false, false, 5);
            addLevelButton.Show();

            Button removeLevelButton = new Button("-");

            removeLevelButton.Clicked += RemoveButton_Clicked;
            vbox.PackStart(removeLevelButton, false, false, 5);
            removeLevelButton.Show();

            tree = new TreeView();
            vbox.PackStart(tree, true, true, 0);

            // Create a column for the artist name
            TreeViewColumn   levelColumn       = new TreeViewColumn();
            CellRendererText levelCellRenderer = new CellRendererText();

            levelColumn.PackStart(levelCellRenderer, true);
            levelColumn.AddAttribute(levelCellRenderer, "text", 0);
            tree.AppendColumn(levelColumn);
            ListModel               = new ListStore(typeof(string));
            tree.Model              = ListModel;
            tree.Selection.Mode     = SelectionMode.Single;
            tree.Selection.Changed += TreeSelection_Changed;

            switch (editorMode)
            {
            case EditorMode.Level:
                levelColumn.Title = "Levels";
                PopulateTreeWithLevels();
                break;

            case EditorMode.Turret:
                levelColumn.Title = "Turrets";
                PopulateTreeWithTurrets();
                break;

            case EditorMode.Enemy:
                levelColumn.Title = "Enemies";
                PopulateTreeWithEnemies();
                break;

            case EditorMode.Projectile:
                levelColumn.Title = "Projectiles";
                PopulateTreeWithProjectilees();
                break;

            case EditorMode.Analysis:
                levelColumn.Title = "Analysis";
                PopulateTreeWithLevels();
                break;
            }

            tree.Show();


            //
            // Righthand column
            //

            vbox = new VBox(false, 0);
            TopLevelHBox.PackStart(vbox, true, true, 5);
            vbox.Show();

            HBox modeHbox = new HBox(true, 0);

            vbox.PackStart(modeHbox, false, true, 0);
            modeHbox.Show();

            Button modeButton = new Button("Level");

            modeButton.Show();
            modeButton.Clicked += level_clicked_event;
            modeHbox.PackStart(modeButton, false, false, 5);

            modeButton = new Button("Turret");
            modeButton.Show();
            modeButton.Clicked += turret_clicked_event;
            modeHbox.PackStart(modeButton, false, false, 5);

            modeButton = new Button("Enemy");
            modeButton.Show();
            modeButton.Clicked += enemy_clicked_event;
            modeHbox.PackStart(modeButton, false, false, 5);

            modeButton = new Button("Projectile");
            modeButton.Show();
            modeButton.Clicked += projectile_clicked_event;
            modeHbox.PackStart(modeButton, false, false, 5);

            modeButton = new Button("Analysis");
            modeButton.Show();
            modeButton.Clicked += analysis_clicked_event;
            modeHbox.PackStart(modeButton, false, false, 5);

            vbox.PackStart(EditorWidget, true, true, 5);
            EditorWidget.Show();


            ShowAll();

            LevelManager.WriteAssetDirectory();
        }
コード例 #12
0
        public void SetItems(MenuList items)
        {
            if (Container.Child != null)
            {
                foreach (Gtk.Widget widget in (Container.Child as VBox).Children)
                {
                    if (widget is MenuItemWidget)
                    {
                        (widget as MenuItemWidget).SelectedChanged -= HandleSelectedChanged;
                    }
                    widget.Dispose();
                    widget.Destroy();
                }
                Container.Remove(Container.Child);
            }

            VBox vbox = new VBox();

            Container.Add(vbox);

            Cairo.Color textColor;
            if (IsLight)
            {
                textColor = new Cairo.Color(0.1, 0.1, 0.1);
            }
            else
            {
                textColor = new Cairo.Color(1, 1, 1);
            }

            bool hasIcon = false;

            foreach (MenuItem item in items.DisplayItems)
            {
                if (item.ShowIcons)
                {
                    hasIcon = true;
                    break;
                }
            }

            bool first = true;
            int  width = 1;

            foreach (MenuItem item in items.DisplayItems)
            {
                if (item is SeparatorMenuItem)
                {
                    SeparatorWidget widget = new SeparatorWidget((item as SeparatorMenuItem).Title);
                    widget.TextColor = textColor;

                    if (first)
                    {
                        widget.DrawLine = false;
                    }

                    first = false;
                    vbox.PackStart(widget);
                }
                else
                {
                    MenuItemWidget menuItem = new MenuItemWidget(item);
                    menuItem.SelectedChanged += HandleSelectedChanged;
                    menuItem.TextColor        = textColor;
                    menuItem.MenuShowingIcons = hasIcon;

                    first = false;
                    vbox.PackStart(menuItem, false, false, 0);

                    width = Math.Max(width, menuItem.RequestedWidth);
                }
            }
            vbox.SetSizeRequest(width, -1);

            Container.ShowAll();
        }
コード例 #13
0
ファイル: ResultsWindow.cs プロジェクト: codecopy/core-1
        protected virtual void Build()
        {
            Alignment      align;
            TreeViewColumn column;
            CellRenderer   cell;
            HBox           hbox;

            KeepAbove    = true;
            AppPaintable = true;
            AcceptFocus  = false;
            // This typehint gets the window to raise all the way to top.
            TypeHint = WindowTypeHint.Splashscreen;

            SetColormap();

            frame            = new Frame();
            frame.DrawFill   = true;
            frame.DrawFrame  = true;
            frame.FillColor  = frame.FrameColor = backgroundColor;
            frame.FillAlpha  = .55;
            frame.FrameAlpha = .7;
            frame.Radius     = 0;
            frame.Show();

            vbox = new VBox(false, 0);
            Add(frame);
            frame.Add(vbox);
            vbox.BorderWidth = 3;
            vbox.Show();

            //---------The breadcrum bar---------
            hbox         = new HBox();
            toolbar      = new Toolbar();
            align        = new Alignment(0, .5f, 0, 0);
            resultsLabel = new Label();
            queryLabel   = new Label();
            align.Add(queryLabel);
            hbox.PackStart(align, true, true, 4);
            hbox.PackStart(resultsLabel, false, false, 0);
            hbox.WidthRequest = DefaultWindowWidth - 10;
            toolbar.Add(hbox);
            toolbar.ShowAll();
            vbox.PackStart(toolbar, false, false, 0);


            //---------Results Window
            resultsScrolledWindow = new ScrolledWindow();
            resultsScrolledWindow.SetPolicy(PolicyType.Never, PolicyType.Never);
            resultsScrolledWindow.ShadowType = ShadowType.None;
            vbox.PackStart(resultsScrolledWindow, true, true, 0);
            resultsScrolledWindow.Show();

            resultsTreeview = new TreeView();
            resultsTreeview.EnableSearch   = false;
            resultsTreeview.HeadersVisible = false;
            // If this is not set the tree will call IconDataFunc for all rows to
            // determine the total height of the tree
            resultsTreeview.FixedHeightMode = true;

            resultsScrolledWindow.Add(resultsTreeview);
            resultsTreeview.Show();

            resultsTreeview.Model = new ListStore(new Type[] {
                typeof(Do.Universe.Item),
                typeof(string),
            });

            column        = new TreeViewColumn();
            column.Sizing = Gtk.TreeViewColumnSizing.Fixed;
            // because resultsTreeview.FixedHeightMode = true:

            cell = new CellRendererPixbuf();
            cell.SetFixedSize(-1, 4 + DefaultResultIconSize - (int)cell.Ypad);

            int width, height;

            cell.GetFixedSize(out width, out height);

            column.PackStart(cell, false);
            column.SetCellDataFunc(cell, new TreeCellDataFunc(IconDataFunc));

            vbox.SetSizeRequest(DefaultWindowWidth,
                                (height + 2) * NumberResultsDisplayed +
                                (int)(vbox.BorderWidth * 2) + 20);

            cell = new CellRendererText();
            (cell as CellRendererText).Ellipsize = Pango.EllipsizeMode.End;
            column.PackStart(cell, true);
            column.AddAttribute(cell, "markup", (int)Column.NameColumn);

            resultsTreeview.AppendColumn(column);

            resultsTreeview.Selection.Changed += OnResultRowSelected;
            Shown += OnShown;
        }
コード例 #14
0
ファイル: MainWindow.cs プロジェクト: APCTGroup3/GPL
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        // Make fullscreen and centered
        SetDefaultSize(Screen.Width, Screen.Height);
        SetPosition(WindowPosition.Center);

        //Create vbox to hold UI
        VBox vbox = new VBox(false, 2);

        // Create menu bar
        Toolbar menu = new Toolbar();

        menu.ToolbarStyle = ToolbarStyle.Icons;

        //Make menu items
        ToolButton newBtn = new ToolButton(Stock.New);

        newBtn.TooltipText = "Create a new program";
        newBtn.Clicked    += NewBtnClicked;

        ToolButton saveBtn = new ToolButton(Stock.Save);

        saveBtn.TooltipText = "Save the program";
        saveBtn.Clicked    += SaveBtnClicked;

        ToolButton openBtn = new ToolButton(Stock.Open);

        openBtn.TooltipText = "Open a program";
        openBtn.Clicked    += OpenBtnClicked;

        ToolButton runBtn = new ToolButton(Stock.MediaPlay);

        runBtn.TooltipText = "Run the program";
        runBtn.Clicked    += RunBtnClicked;

        ToolButton nlpLexerSwitchBtn = new ToolButton(Stock.DialogWarning); // NLP Lexer button displayed with warning as it's experimental

        nlpLexerSwitchBtn.TooltipText = "Toggle the experimental NLP lexer";
        nlpLexerSwitchBtn.Clicked    += nlpLexerSwitchBtnClicked;

        ToolButton parseTreeSwitchBtn = new ToolButton(Stock.Indent);

        parseTreeSwitchBtn.TooltipText = "Toggle the Parse Tree display";
        parseTreeSwitchBtn.Clicked    += ParseTreeSwitchBtnClicked;


        //Add menu items to menu bar
        menu.Insert(newBtn, 0);
        menu.Insert(openBtn, 1);
        menu.Insert(saveBtn, 2);
        menu.Insert(runBtn, 3);
        menu.Insert(new SeparatorToolItem(), 4); // Seperate NLP toggle and parse tree toggle from other buttons
        menu.Insert(nlpLexerSwitchBtn, 5);
        menu.Insert(parseTreeSwitchBtn, 5);
        menu.ShowAll();



        //Create TextView
        var editorWindow = new ScrolledWindow(); // Make TextView Scrollable

        editor = new TextView();
        int editorWidth  = this.editor.SizeRequest().Width + 10;
        int editorHeight = this.editor.SizeRequest().Height + 10;

        editor.BorderWidth = 10;
        editor.ModifyBg(StateType.Normal, new Gdk.Color(249, 249, 249));
        editorWindow.Add(editor);


        // Add menu to top of screen
        vbox.PackStart(menu, false, false, 0);

        vbox.SetSizeRequest(editorWidth, editorHeight);

        // Add editor to vbox
        vbox.Add(editorWindow);

        //Add info view to bottom of window
        vbox.PackEnd(this.infoTextView, false, false, 0);
        this.infoTextView.Visible = true; // Make sure info view is visible

        // Add vbox to window
        Add(vbox);

        // Display all children
        ShowAll();
    }