示例#1
0
        public SubmitFeedbackWindow(string category)
        {
            Icon = App.Icon;
            Title = "Thanks for your feedback!";

            Resizable = false;

            VBox vbox = new VBox();

            var text = new TextEntry()
            {
                MinWidth = 500,
                MinHeight = 200,
                MultiLine = true,
                Text = ""
            };

            vbox.PackStart(text);
            {
                HBox box = new HBox();

                Button btn;
                box.PackEnd(btn = new Button(" Cancel "));
                btn.Clicked += (s, e) => { Close(); };

                box.PackEnd(btn = new Button(" Submit "));
                btn.Clicked += (s, e) =>
                {
                    string feedback = text.Text;
                    new Task(() =>
                        {
                            if (feedback.Length > 10)
                            {
                                string URL = "http://yuhrney.square7.ch/4Plug/feedback.php";
                                WebClient webClient = new WebClient();
                                webClient.Proxy = null;

                                NameValueCollection formData = new NameValueCollection();

                                formData["feedback"] = string.Format("{3} - {1} {2}\n{5}\n{4}", App.WindowTitle, Environment.OSVersion.Platform, Xwt.Toolkit.CurrentEngine.Type, DateTime.Now.ToString("dd MMM HH:mm:ss", CultureInfo.InvariantCulture), feedback, category).Trim();

                                byte[] responseBytes = webClient.UploadValues(URL, "POST", formData);
                                string responsefromserver = Encoding.UTF8.GetString(responseBytes);
                                Console.WriteLine(responsefromserver);
                                webClient.Dispose();
                            }

                        }).Start();
                    Close();
                };

                vbox.PackStart(box);

                Content = vbox;
            }
        }
示例#2
0
文件: Boxes.cs 项目: joncham/xwt
        public Boxes()
        {
            HBox box1 = new HBox ();

            VBox box2 = new VBox ();
            box2.PackStart (new SimpleBox (30), BoxMode.None);
            box2.PackStart (new SimpleBox (30), BoxMode.None);
            box2.PackStart (new SimpleBox (30), BoxMode.FillAndExpand);

            box1.PackStart (box2, BoxMode.FillAndExpand);
            box1.PackStart (new SimpleBox (30), BoxMode.None);
            box1.PackStart (new SimpleBox (30), BoxMode.Expand);
            PackStart (box1, BoxMode.None);

            HBox box3 = new HBox ();
            box3.PackEnd (new SimpleBox (30));
            box3.PackStart (new SimpleBox (20) {Color = new Color (1, 0.5, 0.5)});
            box3.PackEnd (new SimpleBox (40));
            box3.PackStart (new SimpleBox (10) {Color = new Color (1, 0.5, 0.5)});
            box3.PackEnd (new SimpleBox (30));
            box3.PackStart (new SimpleBox (10) {Color = new Color (1, 0.5, 0.5)}, BoxMode.FillAndExpand);
            PackStart (box3);

            HBox box4 = new HBox ();
            Button b = new Button ("Click me");
            b.Clicked += delegate {
                b.Label = "Button has grown";
            };
            box4.PackStart (new SimpleBox (30), BoxMode.FillAndExpand);
            box4.PackStart (b);
            box4.PackStart (new SimpleBox (30), BoxMode.FillAndExpand);
            PackStart (box4);

            HBox box5 = new HBox ();
            Button b2 = new Button ("Hide / Show");
            box5.PackStart (new SimpleBox (30), BoxMode.FillAndExpand);
            var hsb = new SimpleBox (20);
            box5.PackStart (hsb, BoxMode.None);
            box5.PackStart (b2);
            box5.PackStart (new SimpleBox (30), BoxMode.FillAndExpand);
            b2.Clicked += delegate {
                hsb.Visible = !hsb.Visible;
            };
            PackStart (box5);

            HBox box6 = new HBox ();
            for (int n=0; n<15; n++) {
                var w = new Label ("TestLabel" + n);
                w.MinWidth = 10;
                box6.PackStart (w);
            }
            PackStart (box6);
        }
        public ReferenceImageVerifierDialog()
        {
            Width = 500;
            Height = 300;

            Table table = new Table ();
            table.DefaultRowSpacing = table.DefaultColumnSpacing = 6;

            table.Add (nameLabel = new Label (), 0, 0, hexpand:true);
            table.Add (new Label ("Reference Image"), 0, 1, hexpand:true);
            table.Add (new Label ("Test Image"), 1, 1, hexpand:true);
            nameLabel.Font = nameLabel.Font.WithWeight (Xwt.Drawing.FontWeight.Bold);

            img1 = new ImageView ();
            table.Add (img1, 0, 2, hexpand:true, vexpand:true);

            imgDiff = new ImageView ();
            table.Add (imgDiff, 1, 2, hexpand:true, vexpand:true);

            img2 = new ImageView ();
            table.Add (img2, 2, 2, hexpand:true, vexpand:true);

            var buttonBox = new HBox ();
            table.Add (buttonBox, 0, 3, colspan:2, hexpand:true);

            closeButton = new Button ("Close");
            validButton = new Button ("Success");
            failButton = new Button ("Failure");

            buttonBox.PackEnd (closeButton);
            buttonBox.PackEnd (failButton);
            buttonBox.PackEnd (validButton);

            closeButton.Clicked += delegate {
                Respond (Command.Ok);
            };

            failButton.Clicked += delegate {
                var info = ReferenceImageManager.ImageFailures[currentImage];
                info.Fail ();
                ShowNextImage ();
            };

            validButton.Clicked += delegate {
                var info = ReferenceImageManager.ImageFailures[currentImage];
                info.Validate ();
                ShowNextImage ();
            };

            Content = table;
            ShowNextImage ();
        }
		void IOptionsPanel.Initialize (OptionsDialog dialog, object dataObject)
		{
			this.ExpandHorizontal = true;
			this.ExpandVertical = true;
			this.HeightRequest = 400;
			list = new ListView ();
			store = new ListStore (language, completeOnSpace, completeOnChars);

			var languageColumn = list.Columns.Add (GettextCatalog.GetString ("Language"), language);
			languageColumn.CanResize = true;

			var checkBoxCellView = new CheckBoxCellView (completeOnSpace);
			checkBoxCellView.Editable = true;
			var completeOnSpaceColumn = list.Columns.Add (GettextCatalog.GetString ("Complete on space"), checkBoxCellView);
			completeOnSpaceColumn.CanResize = true;

			var textCellView = new TextCellView (completeOnChars);
			textCellView.Editable = true;
			var doNotCompleteOnColumn = list.Columns.Add (GettextCatalog.GetString ("Do complete on"), textCellView);
			doNotCompleteOnColumn.CanResize = true;
			list.DataSource = store;
			PackStart (list, true, true);

			var hbox = new HBox ();
			var button = new Button ("Reset to default");
			button.Clicked += delegate {
				FillStore (CompletionCharacters.GetDefaultCompletionCharacters ());
			};	
			hbox.PackEnd (button, false, false);
			PackEnd (hbox, false, true);
			FillStore (CompletionCharacters.GetCompletionCharacters ());
		}
        public MainView(IPresenterFactory presenterFactory)
        {
            _notebook = presenterFactory.InstantiatePresenter<MainNotebook>();
            _notebook.Add(presenterFactory.InstantiatePresenter<MenuPageView>(this));
            _notebook.Add(presenterFactory.InstantiatePresenter<ModsPageView>(this));
            _notebook.Add(presenterFactory.InstantiatePresenter<BlueprintsPageView>(this));
            _notebook.Add(presenterFactory.InstantiatePresenter<SavegamesPageView>(this));
            _notebook.Add(presenterFactory.InstantiatePresenter<TasksPageView>(this));

            PackStart(presenterFactory.InstantiatePresenter<MainHeaderView>());

            var sideBox = new VBox
            {
                MinWidth = 280,
                WidthRequest = 280
            };

            _sidebarContainer = new SidebarContainer();
            sideBox.PackStart(_sidebarContainer, true, true);
            var box = new HBox();

            box.PackStart(_notebook, true);
            box.PackEnd(sideBox);

            PackStart(box, true, true);

            _notebook.HandleSizeChangeOnTabChange = true;
            _notebook.HandleSizeUpdate();
        }
示例#6
0
        public LauncherWindow()
        {
            this.Title = "TrueCraft Launcher";
            this.Width = 1200;
            this.Height = 576;
            this.User = new TrueCraftUser();

            MainContainer = new HBox();
            WebScrollView = new ScrollView();
            WebView = new WebView("http://truecraft.io/updates");
            LoginView = new LoginView(this);
            OptionView = new OptionView(this);
            MultiplayerView = new MultiplayerView(this);
            SingleplayerView = new SingleplayerView(this);
            InteractionBox = new VBox();

            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TrueCraft.Launcher.Content.truecraft_logo.svg"))
                TrueCraftLogoImage = new ImageView(Image.FromStream(stream));

            WebScrollView.Content = WebView;
            MainContainer.PackStart(WebScrollView, true);
            InteractionBox.PackStart(TrueCraftLogoImage);
            InteractionBox.PackEnd(LoginView);
            MainContainer.PackEnd(InteractionBox);

            this.Content = MainContainer;
        }
示例#7
0
        public DragDrop()
        {
            HBox box = new HBox ();

            SimpleBox b1 = new SimpleBox (30);
            box.PackStart (b1, BoxMode.None);

            b2 = new Button ("Drop here");
            box.PackEnd (b2, BoxMode.None);

            b1.ButtonPressed += delegate {
                var d = b1.CreateDragOperation ();
                d.Data.AddValue ("Hola");
                var img = Image.FromResource (GetType(), "class.png");
                d.SetDragImage (img, (int)img.Size.Width, (int)img.Size.Height);
                d.AllowedActions = DragDropAction.All;
                d.Start ();
            };

            b2.SetDragDropTarget (TransferDataType.Text, TransferDataType.Uri);
            PackStart (box);

            b2.DragDrop += HandleB2DragDrop;
            b2.DragOver += HandleB2DragOver;
        }
        void BuildGui()
        {
            this.Title = GettextCatalog.GetString("Select Work Item");
            VBox content = new VBox();
            HBox mainBox = new HBox();
            queryView.Columns.Add(new ListViewColumn(string.Empty, new TextCellView(titleField)));
            queryView.DataSource = queryStore;
            queryView.WidthRequest = 200;
            BuildQueryView();
            mainBox.PackStart(queryView);

            workItemList.WidthRequest = 400;
            workItemList.HeightRequest = 400;
            workItemList.ShowCheckboxes = true;

            mainBox.PackStart(workItemList, true, true);

            content.PackStart(mainBox, true, true);

            HBox buttonBox = new HBox();

            Button okButton = new Button(GettextCatalog.GetString("Ok"));
            okButton.WidthRequest = Constants.ButtonWidth;
            okButton.Clicked += (sender, e) => Respond(Command.Ok);
            buttonBox.PackEnd(okButton);

            content.PackStart(buttonBox);
            //this.Resizable = false;
            this.Content = content;

            AttachEvents();
        }
示例#9
0
        public SplashWindow()
        {
            Icon = App.Icon;

            Width = 550;

            Title = "4Plug First Use";
            Resizable = false;

            VBox V = new VBox();
            Content = V;

            Label lbl;

            lbl = new Label("A small introduction.") { Font = Font.FromName("Segoe UI Light 24"), TextColor = PluginType.Vpk.GetColor() };
            V.PackStart(lbl);

            lbl = new Label("This tool allows you to quickly enable/disable mods as well as install new ones.");
            V.PackStart(lbl);

            lbl = new Label(""); V.PackStart(lbl);

            lbl = new Label("This is what a mod looks like in 4Plug!") { Font = Font.FromName("Segoe UI Light 24"), TextColor = PluginType.Unknown.GetColor() };
            V.PackStart(lbl);

            lbl = new Label("You can enable/disable mods by clicking on the image.");
            V.PackStart(lbl);

            //lbl = new Label("Uninstalled mods are saved in the \"custom_\" instead of the \"custom\" folder of you game.");
            //V.PackStart(lbl);

            lbl = new Label("");

            DummyPluginWidget dummy = new DummyPluginWidget(lbl);
            dummy.MarginTop += 16;
            dummy.MarginBottom += 8;
            V.PackStart(dummy);

            V.PackStart(lbl);

            lbl = new Label(""); V.PackStart(lbl);

            {
                HBox box = new HBox();
                Button btn;

                btn = new Button(" Got it! ");
                box.PackEnd(btn);
                btn.Clicked += (s, e) => { Close(); };

                Label lbl2;
                lbl2 = new Label(" Feel free to leave feedback (mainmenu -> submit feedback) later ");
                box.PackStart(lbl2);
                //btn.Clicked += (s, e) => { new SubmitFeedbackWindow("via Splash Window").Run(); };

                V.PackStart(box);
            }
        }
示例#10
0
        public LauncherWindow()
        {
            this.Title = "TrueCraft Launcher";
            this.Width = 1200;
            this.Height = 576;
            this.User = new TrueCraftUser();

            MainContainer = new HBox();
            WebScrollView = new ScrollView();
            WebView = new WebView("http://truecraft.io/updates");
            LoginView = new LoginView(this);
            OptionView = new OptionView(this);
            MultiplayerView = new MultiplayerView(this);
            SingleplayerView = new SingleplayerView(this);

            WebScrollView.Content = WebView;
            MainContainer.PackStart(WebScrollView, true);
            MainContainer.PackEnd(LoginView);

            this.Content = MainContainer;
        }
示例#11
0
        public RunConfigurationsPanelWidget(RunConfigurationsPanel panel, OptionsDialog dialog)
        {
            this.panel = panel;

            this.Margin = 6;
            Spacing     = 6;

            list = new RunConfigurationsList();
            this.PackStart(list, true);

            var box = new Xwt.HBox();

            box.Spacing = 6;

            var btn = new Xwt.Button(GettextCatalog.GetString("New"));

            btn.Clicked += OnAddConfiguration;
            box.PackStart(btn, false);

            copyButton          = new Xwt.Button(GettextCatalog.GetString("Duplicate"));
            copyButton.Clicked += OnCopyConfiguration;
            box.PackStart(copyButton, false);

            renameButton          = new Xwt.Button(GettextCatalog.GetString("Rename"));
            renameButton.Clicked += OnRenameConfiguration;
            box.PackStart(renameButton, false);

            removeButton          = new Xwt.Button(GettextCatalog.GetString("Remove"));
            removeButton.Clicked += OnRemoveConfiguration;
            box.PackEnd(removeButton, false);

            Fill();

            this.PackStart(box, false);

            list.SelectionChanged += (sender, e) => UpdateButtons();
            list.RowActivated     += (sender, e) => panel.ShowConfiguration((ProjectRunConfiguration)list.SelectedConfiguration);
            UpdateButtons();
        }
示例#12
0
 public HelpWindow()
 {
     VBox mainContent = new VBox ();
     _messageDisplay = new RichTextView {
         WidthRequest = 500
     };
     ScrollView scroller = new ScrollView (_messageDisplay) {
         VerticalScrollPolicy = ScrollPolicy.Automatic,
                      HorizontalScrollPolicy = ScrollPolicy.Never,
                      HeightRequest = 500
     };
     mainContent.PackStart (scroller);
     HBox buttonRow = new HBox ();
     Button ok = new Button {
         Label = I18N._ ("Close"),
               Image = Icons.Ok
     };
     ok.Clicked += (sender, args) => Close ();
     buttonRow.PackEnd (ok);
     mainContent.PackEnd (buttonRow);
     Content = mainContent;
     Width = 400;
 }
            void BuildContent(string license)
            {
                double textWidth = 480;
                double textHeight = 480;
                VBox mainContent = new VBox ();

                RichTextView textView = new RichTextView ();
                textView.LoadText (license, TextFormat.Markdown);
                textView.MinWidth = textWidth;
                ScrollView scroller = new ScrollView (textView);
                scroller.HorizontalScrollPolicy = ScrollPolicy.Never;
                scroller.VerticalScrollPolicy = ScrollPolicy.Automatic;
                scroller.MinHeight = textHeight;
                scroller.MinWidth = textWidth + textView.MarginLeft + textView.MarginRight + 20;
                mainContent.PackStart (scroller);

                HBox buttonRow = new HBox ();
                Button ok = new Button { Label = I18N._ ("Close"), Image = Icons.Ok };
                ok.Clicked += (sender, args) => Close ();
                buttonRow.PackEnd (ok);
                mainContent.PackEnd (buttonRow);

                Content = mainContent;
            }
示例#14
0
        public ColorPopover(ColorPicker picker)
        {
            this.picker = picker;

            OriginalColor = picker.Color;

            var h = new HBox();
            var leftBox = new VBox();
            h.PackStart(leftBox);

            Content = h;

            {
                HBox box = new HBox();
                box.PackStart(new Label("R") { WidthRequest = 50 });
                box.PackStart(rSlider = new HSlider() { WidthRequest = 100, MinimumValue = 0, MaximumValue = 255 });
                box.PackStart(rText = new TextEntry() { WidthRequest = 50 });
                leftBox.PackStart(box);
            }
            {
                HBox box = new HBox();
                box.PackStart(new Label("G") { WidthRequest = 50 });
                box.PackStart(gSlider = new HSlider() { WidthRequest = 100, MinimumValue = 0, MaximumValue = 255 });
                box.PackStart(gText = new TextEntry() { WidthRequest = 50 });
                leftBox.PackStart(box);
            }
            {
                HBox box = new HBox();
                box.PackStart(new Label("B") { WidthRequest = 50 });
                box.PackStart(bSlider = new HSlider() { WidthRequest = 100, MinimumValue = 0, MaximumValue = 255 });
                box.PackStart(bText = new TextEntry() { WidthRequest = 50 });
                leftBox.PackStart(box);
            }
            {
                HBox box = new HBox();
                box.PackStart(new Label("Alpha") { WidthRequest = 50 });
                box.PackStart(aSlider = new HSlider() { WidthRequest = 100, MinimumValue = 0, MaximumValue = 255 });
                box.PackStart(aText = new TextEntry() { WidthRequest = 50 });
                leftBox.PackStart(box);
            }

            EventHandler setSlider = (s, e) => { if (enableEvents) SetColor(Color.FromBytes((byte)rSlider.Value, (byte)gSlider.Value, (byte)bSlider.Value, (byte)aSlider.Value), (Widget)s); };

            rSlider.ValueChanged += setSlider;
            gSlider.ValueChanged += setSlider;
            bSlider.ValueChanged += setSlider;
            aSlider.ValueChanged += setSlider;

            rText.Changed += (s, e) => { if (enableEvents) { byte i; if (byte.TryParse(rText.Text, out i)) SetColor(Color.FromBytes(i, (byte)gSlider.Value, (byte)bSlider.Value, (byte)aSlider.Value), rText); } };
            gText.Changed += (s, e) => { if (enableEvents) { byte i; if (byte.TryParse(gText.Text, out i)) SetColor(Color.FromBytes((byte)rSlider.Value, i, (byte)bSlider.Value, (byte)aSlider.Value), gText); } };
            bText.Changed += (s, e) => { if (enableEvents) { byte i; if (byte.TryParse(bText.Text, out i)) SetColor(Color.FromBytes((byte)rSlider.Value, (byte)gSlider.Value, i, (byte)aSlider.Value), bText); } };
            aText.Changed += (s, e) => { if (enableEvents) { byte i; if (byte.TryParse(aText.Text, out i)) SetColor(Color.FromBytes((byte)rSlider.Value, (byte)gSlider.Value, (byte)bSlider.Value, i), aText); } };

            {
                HBox box = new HBox();
                TextEntry text;
                hexText = text = new TextEntry();
                text.Changed += (s, e) =>
                {
                    if (enableEvents)
                    {
                        Color c;
                        if (App.TryParseColor(hexText.Text, out c))
                            SetColor(c, hexText);
                    }
                };
                box.PackStart(text);

                sourceText = text = new TextEntry();
                text.Changed += (s, e) =>
                {
                    if (enableEvents)
                    {
                        Color c;
                        if (App.TryParseColor(sourceText.Text, out c))
                            SetColor(c, sourceText);
                    }
                };
                box.PackStart(text);
                leftBox.PackStart(box);
            }

            {
                HBox box = new HBox();
                Button btn;
                btn = new Button(" Reset to Default ");
                btn.Clicked += (s, e) => { picker.Color = picker.DefaultColor; };
                box.PackEnd(btn);

                btn = new Button(" Discard Changes ");
                btn.Clicked += (s, e) => { picker.Color = OriginalColor; };
                box.PackEnd(btn);
                leftBox.PackStart(box);
            }
        }
		void SetLayout ()
		{
			var vbox = new VBox ();
			vbox.MinWidth = 450;

			vbox.PackStart (new Label (GettextCatalog.GetString ("Breakpoint Action")) {
				Font = vbox.Font.WithWeight (FontWeight.Bold)
			});

			var breakpointActionGroup = new VBox {
				MarginLeft = 12
			};

			breakpointActionGroup.PackStart (breakpointActionPause);
			breakpointActionGroup.PackStart (breakpointActionPrint);

			var printExpressionGroup = new HBox {
				MarginLeft = 18
			};

			printExpressionGroup.PackStart (entryPrintExpression, true);
			printExpressionGroup.PackStart (warningPrintExpression);
			breakpointActionGroup.PackStart (printExpressionGroup);

			breakpointActionGroup.PackEnd (printMessageTip);

			vbox.PackStart (breakpointActionGroup);

			vbox.PackStart (new Label (GettextCatalog.GetString ("When to Take Action")) {
				Font = vbox.Font.WithWeight (FontWeight.Bold)
			});

			var whenToTakeActionRadioGroup = new VBox {
				MarginLeft = 12
			};

			// Function group
			{
				whenToTakeActionRadioGroup.PackStart (stopOnFunction);

				hboxFunction.PackStart (entryFunctionName, true);
				hboxFunction.PackEnd (warningFunction);

				whenToTakeActionRadioGroup.PackStart (hboxFunction);
			}

			// Exception group
			{
				whenToTakeActionRadioGroup.PackStart (stopOnException);

				hboxException = new HBox ();
				hboxException.PackStart (entryExceptionType, true);
				hboxException.PackEnd (warningException);

				vboxException.PackStart (hboxException);
				vboxException.PackStart (checkIncludeSubclass);
				whenToTakeActionRadioGroup.PackStart (vboxException);
			}

			// Location group
			{
				whenToTakeActionRadioGroup.PackStart (stopOnLocation);

				hboxLocation.PackStart (entryLocationFile, true);
				hboxLocation.PackStart (warningLocation);
				vboxLocation.PackEnd (hboxLocation);

				whenToTakeActionRadioGroup.PackStart (vboxLocation);
			}
			vbox.PackStart (whenToTakeActionRadioGroup);

			vbox.PackStart (new Label (GettextCatalog.GetString ("Advanced Conditions")) {
				Font = vbox.Font.WithWeight (FontWeight.Bold)
			});

			var vboxAdvancedConditions = new VBox {
				MarginLeft = 30
			};
			var hboxHitCount = new HBox ();
			hboxHitCount.PackStart (ignoreHitType, true);
			hboxHitCount.PackStart (ignoreHitCount);
			vboxAdvancedConditions.PackStart (hboxHitCount);

			vboxAdvancedConditions.PackStart (conditionalHitType);
			hboxCondition = new HBox ();
			hboxCondition.PackStart (entryConditionalExpression, true);
			hboxCondition.PackStart (warningCondition);
			vboxAdvancedConditions.PackStart (hboxCondition);
			vboxAdvancedConditions.PackEnd (conditionalExpressionTip);

			vbox.PackStart (vboxAdvancedConditions);


			Buttons.Add (new DialogButton (Command.Cancel));
			Buttons.Add (buttonOk);

			Content = vbox;

			if (IdeApp.Workbench != null) {
				Gtk.Widget parent = ((Gtk.Widget)Xwt.Toolkit.CurrentEngine.GetNativeWidget (vbox)).Parent;
				while (parent != null && !(parent is Gtk.Window))
					parent = parent.Parent;
				if (parent is Gtk.Window)
					((Gtk.Window)parent).TransientFor = IdeApp.Workbench.RootWindow;
			}

			OnUpdateControls (null, null);
		}
示例#16
0
        void BuildContent()
        {
            _configTable = new Table { MinWidth = 300 };
            ScrollView scrollView = new ScrollView (_configTable) {
                ExpandHorizontal = true,
                         ExpandVertical = true,
                         HorizontalScrollPolicy = ScrollPolicy.Never,
                         MinHeight = 300,
                         MinWidth = 300
            };
            HBox buttonBox = new HBox ();
            _addButton = new Button (I18N._ ("Add")) { Image = Icons.Add };
            _okButton = new Button (I18N._ ("Save")) { Image = Icons.Ok };
            _cancelButton = new Button (I18N._ ("Cancel")) {
                Image = Icons.Cancel,
                      Style = ButtonStyle.Flat
            };
            _undoButton = new Button (I18N._ ("Undo")) {
                Image = Icons.Undo,
                      Style = ButtonStyle.Flat,
                      Visible = false
            };
            buttonBox.PackEnd (_okButton);
            buttonBox.PackEnd (_addButton);
            buttonBox.PackStart (_cancelButton);
            buttonBox.PackStart (_undoButton);

            VBox box = new VBox ();
            box.PackStart (scrollView, true, true);
            box.PackEnd (buttonBox);
            Content = box;
        }
示例#17
0
		void Build ()
		{
			Title = Catalog.GetString ("Add Packages");
			Width = 820;
			Height = 520;
			Padding = new WidgetSpacing ();

			// Top part of dialog:
			// Package sources and search.
			var topHBox = new HBox ();
			topHBox.Margin = new WidgetSpacing (8, 5, 6, 5);

			packageSourceComboBox = new ComboBox ();
			packageSourceComboBox.MinWidth = 200;
			topHBox.PackStart (packageSourceComboBox);

			packageSearchEntry = new SearchTextEntry ();
			packageSearchEntry.WidthRequest = 187;
			topHBox.PackEnd (packageSearchEntry);

			this.HeaderContent = topHBox;

			// Middle of dialog:
			// Packages and package information.
			var mainVBox = new VBox ();
			Content = mainVBox;

			var middleHBox = new HBox ();
			middleHBox.Spacing = 0;
			var middleFrame = new FrameBox ();
			middleFrame.Content = middleHBox;
			middleFrame.BorderWidth = new WidgetSpacing (0, 0, 0, 1);
			middleFrame.BorderColor = lineBorderColor;
			mainVBox.PackStart (middleFrame, true, true);

			// Error information.
			var packagesListVBox = new VBox ();
			packagesListVBox.Spacing = 0;
			errorMessageHBox = new HBox ();
			errorMessageHBox.Margin = new WidgetSpacing ();
			errorMessageHBox.BackgroundColor = Colors.Orange;
			errorMessageHBox.Visible = false;
			var errorImage = new ImageView ();
			errorImage.Margin = new WidgetSpacing (10, 0, 0, 0);
			errorImage.Image = ImageService.GetIcon (Stock.Warning, Gtk.IconSize.Menu);
			errorImage.HorizontalPlacement = WidgetPlacement.End;
			errorMessageHBox.PackStart (errorImage);
			errorMessageLabel = new Label ();
			errorMessageLabel.TextColor = Colors.White;
			errorMessageLabel.Margin = new WidgetSpacing (5, 5, 5, 5);
			errorMessageLabel.Wrap = WrapMode.Word;
			errorMessageHBox.PackStart (errorMessageLabel, true);
			packagesListVBox.PackStart (errorMessageHBox);

			// Packages list.
			middleHBox.PackStart (packagesListVBox, true, true);
			packagesListView = new ListView ();
			packagesListView.BorderVisible = false;
			packagesListView.HeadersVisible = false;
			packagesListVBox.PackStart (packagesListView, true, true);

			// Loading spinner.
			var loadingSpinnerHBox = new HBox ();
			loadingSpinnerHBox.HorizontalPlacement = WidgetPlacement.Center;
			var loadingSpinner = new Spinner ();
			loadingSpinner.Animate = true;
			loadingSpinner.MinWidth = 20;
			loadingSpinnerHBox.PackStart (loadingSpinner);

			loadingSpinnerLabel = new Label ();
			loadingSpinnerLabel.Text = Catalog.GetString ("Loading package list...");
			loadingSpinnerHBox.PackEnd (loadingSpinnerLabel);

			loadingSpinnerFrame = new FrameBox ();
			loadingSpinnerFrame.Visible = false;
			loadingSpinnerFrame.BackgroundColor = Colors.White;
			loadingSpinnerFrame.Content = loadingSpinnerHBox;
			loadingSpinnerFrame.BorderWidth = new WidgetSpacing ();
			packagesListVBox.PackStart (loadingSpinnerFrame, true, true);

			// No packages found label.
			var noPackagesFoundHBox = new HBox ();
			noPackagesFoundHBox.HorizontalPlacement = WidgetPlacement.Center;

			var noPackagesFoundLabel = new Label ();
			noPackagesFoundLabel.Text = Catalog.GetString ("No matching packages found.");
			noPackagesFoundHBox.PackEnd (noPackagesFoundLabel);

			noPackagesFoundFrame = new FrameBox ();
			noPackagesFoundFrame.Visible = false;
			noPackagesFoundFrame.BackgroundColor = Colors.White;
			noPackagesFoundFrame.Content = noPackagesFoundHBox;
			noPackagesFoundFrame.BorderWidth = new WidgetSpacing ();
			packagesListVBox.PackStart (noPackagesFoundFrame, true, true);

			// Package information
			packageInfoVBox = new VBox ();
			var packageInfoFrame = new FrameBox ();
			packageInfoFrame.BackgroundColor = packageInfoBackgroundColor;
			packageInfoFrame.BorderWidth = new WidgetSpacing ();
			packageInfoFrame.Content = packageInfoVBox;
			packageInfoVBox.Margin = new WidgetSpacing (15, 12, 15, 12);
			var packageInfoContainerVBox = new VBox ();
			packageInfoContainerVBox.WidthRequest = 240;
			packageInfoContainerVBox.PackStart (packageInfoFrame, true, true);

			var packageInfoScrollView = new ScrollView ();
			packageInfoScrollView.BorderVisible = false;
			packageInfoScrollView.HorizontalScrollPolicy = ScrollPolicy.Never;
			packageInfoScrollView.Content = packageInfoContainerVBox;
			packageInfoScrollView.BackgroundColor = packageInfoBackgroundColor;
			var packageInfoScrollViewFrame = new FrameBox ();
			packageInfoScrollViewFrame.BackgroundColor = packageInfoBackgroundColor;
			packageInfoScrollViewFrame.BorderWidth = new WidgetSpacing (1, 0, 0, 0);
			packageInfoScrollViewFrame.BorderColor = lineBorderColor;
			packageInfoScrollViewFrame.Content = packageInfoScrollView;
			middleHBox.PackEnd (packageInfoScrollViewFrame);

			// Package name and version.
			var packageNameHBox = new HBox ();
			packageInfoVBox.PackStart (packageNameHBox);

			packageNameLabel = new Label ();
			packageNameLabel.Ellipsize = EllipsizeMode.End;
			Font packageInfoSmallFont = packageNameLabel.Font.WithScaledSize (0.8);
			packageNameHBox.PackStart (packageNameLabel, true);

			packageVersionLabel = new Label ();
			packageVersionLabel.TextAlignment = Alignment.End;
			packageNameHBox.PackEnd (packageVersionLabel);

			// Package description.
			packageDescription = new Label ();
			packageDescription.Wrap = WrapMode.Word;
			packageDescription.Font = packageNameLabel.Font.WithScaledSize (0.9);
			packageDescription.BackgroundColor = packageInfoBackgroundColor;
			packageInfoVBox.PackStart (packageDescription);

			// Package id.
			var packageIdHBox = new HBox ();
			packageIdHBox.MarginTop = 7;
			packageInfoVBox.PackStart (packageIdHBox);

			var packageIdLabel = new Label ();
			packageIdLabel.Font = packageInfoSmallFont;
			packageIdLabel.Markup = Catalog.GetString ("<b>Id</b>");
			packageIdHBox.PackStart (packageIdLabel);

			packageId = new Label ();
			packageId.Ellipsize = EllipsizeMode.End;
			packageId.TextAlignment = Alignment.End;
			packageId.Font = packageInfoSmallFont;
			packageIdLink = new LinkLabel ();
			packageIdLink.Ellipsize = EllipsizeMode.End;
			packageIdLink.TextAlignment = Alignment.End;
			packageIdLink.Font = packageInfoSmallFont;
			packageIdHBox.PackEnd (packageIdLink, true);
			packageIdHBox.PackEnd (packageId, true);

			// Package author
			var packageAuthorHBox = new HBox ();
			packageInfoVBox.PackStart (packageAuthorHBox);

			var packageAuthorLabel = new Label ();
			packageAuthorLabel.Markup = Catalog.GetString ("<b>Author</b>");
			packageAuthorLabel.Font = packageInfoSmallFont;
			packageAuthorHBox.PackStart (packageAuthorLabel);

			packageAuthor = new Label ();
			packageAuthor.TextAlignment = Alignment.End;
			packageAuthor.Ellipsize = EllipsizeMode.End;
			packageAuthor.Font = packageInfoSmallFont;
			packageAuthorHBox.PackEnd (packageAuthor, true);

			// Package published
			var packagePublishedHBox = new HBox ();
			packageInfoVBox.PackStart (packagePublishedHBox);

			var packagePublishedLabel = new Label ();
			packagePublishedLabel.Markup = Catalog.GetString ("<b>Published</b>");
			packagePublishedLabel.Font = packageInfoSmallFont;
			packagePublishedHBox.PackStart (packagePublishedLabel);

			packagePublishedDate = new Label ();
			packagePublishedDate.Font = packageInfoSmallFont;
			packagePublishedHBox.PackEnd (packagePublishedDate);

			// Package downloads
			var packageDownloadsHBox = new HBox ();
			packageInfoVBox.PackStart (packageDownloadsHBox);

			var packageDownloadsLabel = new Label ();
			packageDownloadsLabel.Markup = Catalog.GetString ("<b>Downloads</b>");
			packageDownloadsLabel.Font = packageInfoSmallFont;
			packageDownloadsHBox.PackStart (packageDownloadsLabel);

			packageDownloads = new Label ();
			packageDownloads.Font = packageInfoSmallFont;
			packageDownloadsHBox.PackEnd (packageDownloads);

			// Package license.
			var packageLicenseHBox = new HBox ();
			packageInfoVBox.PackStart (packageLicenseHBox);

			var packageLicenseLabel = new Label ();
			packageLicenseLabel.Markup = Catalog.GetString ("<b>License</b>");
			packageLicenseLabel.Font = packageInfoSmallFont;
			packageLicenseHBox.PackStart (packageLicenseLabel);

			packageLicenseLink = new LinkLabel ();
			packageLicenseLink.Text = Catalog.GetString ("View License");
			packageLicenseLink.Font = packageInfoSmallFont;
			packageLicenseHBox.PackEnd (packageLicenseLink);

			// Package project page.
			var packageProjectPageHBox = new HBox ();
			packageInfoVBox.PackStart (packageProjectPageHBox);

			var packageProjectPageLabel = new Label ();
			packageProjectPageLabel.Markup = Catalog.GetString ("<b>Project Page</b>");
			packageProjectPageLabel.Font = packageInfoSmallFont;
			packageProjectPageHBox.PackStart (packageProjectPageLabel);

			packageProjectPageLink = new LinkLabel ();
			packageProjectPageLink.Text = Catalog.GetString ("Visit Page");
			packageProjectPageLink.Font = packageInfoSmallFont;
			packageProjectPageHBox.PackEnd (packageProjectPageLink);

			// Package dependencies
			var packageDependenciesHBox = new HBox ();
			packageInfoVBox.PackStart (packageDependenciesHBox);

			var packageDependenciesLabel = new Label ();
			packageDependenciesLabel.Markup = Catalog.GetString ("<b>Dependencies</b>");
			packageDependenciesLabel.Font = packageInfoSmallFont;
			packageDependenciesHBox.PackStart (packageDependenciesLabel);

			packageDependenciesNoneLabel = new Label ();
			packageDependenciesNoneLabel.Text = Catalog.GetString ("None");
			packageDependenciesNoneLabel.Font = packageInfoSmallFont;
			packageDependenciesHBox.PackEnd (packageDependenciesNoneLabel);

			// Package dependencies list.
			packageDependenciesListHBox = new HBox ();
			packageDependenciesListHBox.Visible = false;
			packageInfoVBox.PackStart (packageDependenciesListHBox);

			packageDependenciesList = new Label ();
			packageDependenciesList.Wrap = WrapMode.WordAndCharacter;
			packageDependenciesList.Margin = new WidgetSpacing (5);
			packageDependenciesList.Font = packageInfoSmallFont;
			packageDependenciesListHBox.PackStart (packageDependenciesList, true);

			// Bottom part of dialog:
			// Show pre-release packages and Close/Add to Project buttons.
			var bottomHBox = new HBox ();
			bottomHBox.Margin = new WidgetSpacing (8, 5, 14, 10);
			bottomHBox.Spacing = 5;
			mainVBox.PackStart (bottomHBox);

			showPrereleaseCheckBox = new CheckBox ();
			showPrereleaseCheckBox.Label = Catalog.GetString ("Show pre-release packages");
			bottomHBox.PackStart (showPrereleaseCheckBox);

			addPackagesButton = new Button ();
			addPackagesButton.MinWidth = 120;
			addPackagesButton.MinHeight = 25;
			addPackagesButton.Label = Catalog.GetString ("Add Package");
			bottomHBox.PackEnd (addPackagesButton);

			var closeButton = new Button ();
			closeButton.MinWidth = 120;
			closeButton.MinHeight = 25;
			closeButton.Label = Catalog.GetString ("Close");
			closeButton.Clicked += (sender, e) => Close ();
			bottomHBox.PackEnd (closeButton);

			packageSearchEntry.SetFocus ();
			packageInfoVBox.Visible = false;
		}
示例#18
0
		public ComboBoxes ()
		{
			HBox box = new HBox ();
			ComboBox c = new ComboBox ();
			c.Items.Add ("One");
			c.Items.Add ("Two");
			c.Items.Add ("Three");
			c.SelectedIndex = 1;
			box.PackStart (c);
			Label la = new Label ();
			box.PackStart (la);
			c.SelectionChanged += delegate {
				la.Text = "Selected: " + (string)c.SelectedItem;
			};
			PackStart (box);
			
			box = new HBox ();
			ComboBox c2 = new ComboBox ();
			box.PackStart (c2);
			Button b = new Button ("Fill combo (should grow)");
			box.PackStart (b);
			b.Clicked += delegate {
				for (int n=0; n<10; n++) {
					c2.Items.Add ("Item " + new string ('#', n));
				}
			};
			PackStart (box);
			
			// Combo with custom labels
			
			box = new HBox ();
			ComboBox c3 = new ComboBox ();
			c3.Items.Add (0, "Combo with custom labels");
			c3.Items.Add (1, "One");
			c3.Items.Add (2, "Two");
			c3.Items.Add (3, "Three");
			c3.Items.Add (ItemSeparator.Instance);
			c3.Items.Add (4, "Maybe more");
			var la3 = new Label ();
			box.PackStart (c3);
			box.PackStart (la3);
			c3.SelectionChanged += delegate {
				la3.Text = string.Format ("Selected item: {0} with label {1}",
				                          c3.SelectedItem,
				                          c3.SelectedText);
			};
			PackStart (box);
			
			box = new HBox ();
			var c4 = new ComboBoxEntry ();
			var la4 = new Label ();
			box.PackStart (c4);
			box.PackStart (la4);
			
			c4.Items.Add (1, "One");
			c4.Items.Add (2, "Two");
			c4.Items.Add (3, "Three");
			c4.TextEntry.PlaceholderText = "This is an entry";
			c4.TextEntry.Changed += delegate {
				la4.Text = "Selected text: " + c4.TextEntry.Text;
			};
			PackStart (box);

			HBox selBox = new HBox ();
			Label las = new Label ("Selection:");
			selBox.PackStart (las);
			Button selReplace = new Button ("Replace");
			selReplace.Clicked += delegate {
				c4.TextEntry.SelectedText = "[TEST]";
			};
			selBox.PackEnd (selReplace);
			Button selAll = new Button ("Select all");
			selAll.Clicked += delegate {
				c4.TextEntry.SelectionStart = 0;
				c4.TextEntry.SelectionLength = c4.TextEntry.Text.Length;
			};
			selBox.PackEnd (selAll);
			Button selPlus = new Button ("+");
			selPlus.Clicked += delegate {
				c4.TextEntry.SelectionLength++;
			};
			selBox.PackEnd (selPlus);
			Button selRight = new Button (">");
			selRight.Clicked += delegate {
				c4.TextEntry.SelectionStart++;
			};
			selBox.PackEnd (selRight);
			PackStart (selBox);

			c4.TextEntry.SelectionChanged += delegate {
				las.Text = "Selection: (" + c4.TextEntry.CursorPosition + " <-> " + c4.TextEntry.SelectionStart + " + " + c4.TextEntry.SelectionLength + ") " + c4.TextEntry.SelectedText;
			};


			var c5 = new ComboBoxEntry ();
			c5.TextEntry.TextAlignment = Alignment.Center;
			c5.TextEntry.Text = "centered text with red background";
			c5.BackgroundColor = Colors.Red;
			c5.Items.Add (1, "One");
			c5.Items.Add (2, "Two");
			c5.Items.Add (3, "Three");
			PackStart (c5);

			// A complex combobox
			
			// Three data fields
			var imgField = new DataField<Image> ();
			var textField = new DataField<string> ();
			var descField = new DataField<string> ();
			
			ComboBox cbox = new ComboBox ();
			ListStore store = new ListStore (textField, imgField, descField);
			
			cbox.ItemsSource = store;
			var r = store.AddRow ();
			store.SetValue (r, textField, "Information");
			store.SetValue (r, descField, "Icons are duplicated on purpose");
			store.SetValue (r, imgField, StockIcons.Information);
			r = store.AddRow ();
			store.SetValue (r, textField, "Error");
			store.SetValue (r, descField, "Another item");
			store.SetValue (r, imgField, StockIcons.Error);
			r = store.AddRow ();
			store.SetValue (r, textField, "Warning");
			store.SetValue (r, descField, "A third item");
			store.SetValue (r, imgField, StockIcons.Warning);
			
			// Four views to show three data fields
			cbox.Views.Add (new ImageCellView (imgField));
			cbox.Views.Add (new TextCellView (textField));
			cbox.Views.Add (new ImageCellView (imgField));
			cbox.Views.Add (new TextCellView (descField));
			
			cbox.SelectedIndex = 0;
			
			PackStart (cbox);
		}
示例#19
0
文件: Arff.cs 项目: jfreax/BAIMP
        public override Widget Options()
        {
            if (main != null) {
                main.Dispose();
            }

            main = new VBox();

            // filename
            HBox file = new HBox();
            filenameEntry = new TextEntry();
            filenameEntry.Text = Filename;
            filenameEntry.ReadOnly = true;
            filenameEntry.ShowFrame = false;
            filenameEntry.BackgroundColor = Color.FromBytes(232, 232, 232);

            Button browseButton = new Button("Browse...");
            browseButton.SetFocus();
            browseButton.Clicked += Browse;

            // print to std out
            HBox exportToStdOutBox = new HBox();
            CheckBox exportTSCheck = new CheckBox();

            exportToStdOutBox.PackStart(new Label("Export to standard out?"));
            exportToStdOutBox.PackEnd(exportTSCheck);
            exportTSCheck.Toggled += delegate {
                if (exportTSCheck.Active) {
                    browseButton.Style = ButtonStyle.Flat;
                    browseButton.Clicked -= Browse;
                    exportToStdOut = true;
                } else {
                    browseButton.Style = ButtonStyle.Normal;
                    browseButton.Clicked += Browse;
                    exportToStdOut = false;
                }
            };

            file.PackStart(filenameEntry, true);
            file.PackEnd(browseButton);

            main.PackEnd(file, true);
            main.PackEnd(exportToStdOutBox, true);

            return main;
        }
        private void BuildGui()
        {
            this.Title = GettextCatalog.GetString("Manage Workspaces" + " - " + projectCollection.Server.Name + " - " + projectCollection.Name);
            this.Resizable = false;
            VBox content = new VBox();
            content.PackStart(new Label(GettextCatalog.GetString("Showing all local workspaces to which you have access, and all remote workspaces which you own.")));
            content.PackStart(new Label(GettextCatalog.GetString("Workspaces:")));

            _listView.Columns.Add(new ListViewColumn(GettextCatalog.GetString("Name"), new TextCellView(_name)));
            _listView.Columns.Add(new ListViewColumn(GettextCatalog.GetString("Computer"), new TextCellView(_computer)));
            _listView.Columns.Add(new ListViewColumn(GettextCatalog.GetString("Owner"), new TextCellView(_owner)));
            _listView.Columns.Add(new ListViewColumn(GettextCatalog.GetString("Comment"), new TextCellView(_comment)));
            _listView.MinHeight = 200;
            _listView.DataSource = _listStore;

            content.PackStart(_listView);

            HBox remoteBox = new HBox();

            _showRemoteCheck.Clicked += (sender, e) => FillWorkspaces();
            remoteBox.PackStart(_showRemoteCheck);
            remoteBox.PackStart(new Label(GettextCatalog.GetString("Show remote workspaces")));
            content.PackStart(remoteBox);

            HBox buttonBox = new HBox();
            Button addWorkspaceButton = new Button(GettextCatalog.GetString("Add")) { MinWidth = Constants.ButtonWidth };
            addWorkspaceButton.Clicked += AddWorkspaceClick;
            Button editWorkspaceButton = new Button(GettextCatalog.GetString("Edit")) { MinWidth = Constants.ButtonWidth };
            editWorkspaceButton.Clicked += EditWorkspaceClick;
            Button removeWorkspaceButton = new Button(GettextCatalog.GetString("Remove")) { MinWidth = Constants.ButtonWidth };
            removeWorkspaceButton.Clicked += RemoveWorkspaceClick;
            Button closeButton = new Button(GettextCatalog.GetString("Close")) { MinWidth = Constants.ButtonWidth };
            closeButton.Clicked += (sender, e) => this.Respond(Command.Close);

            buttonBox.PackStart(addWorkspaceButton);
            buttonBox.PackStart(editWorkspaceButton);
            buttonBox.PackStart(removeWorkspaceButton);
            buttonBox.PackEnd(closeButton);

            content.PackStart(buttonBox);

            this.Content = content;

            FillWorkspaces();
        }
示例#21
0
        public ButtonSample()
        {
            Button b1 = new Button("Click me");
            b1.Clicked += delegate
            {
                b1.Label = "Clicked!";
            };
            PackStart(b1, false, false);

            Button b2 = new Button("Click me");
            b2.Style = ButtonStyle.Flat;
            b2.Clicked += delegate
            {
                b2.Label = "Clicked!";
            };
            PackStart(b2);

            PackStart(new Button(StockIcons.ZoomIn.WithSize(22)));
            PackStart(new Button(StockIcons.ZoomIn.WithSize(32), "Custom Size") { WidthRequest = 110, MinHeight = 50 });

            var hbox = new HBox();
            hbox.PackStart(new Button(StockIcons.ZoomIn.WithSize(22), "Zoom In") { ImagePosition = ContentPosition.Top });
            hbox.PackStart(new Button(StockIcons.ZoomOut.WithSize(22), "Zoom Out") { ImagePosition = ContentPosition.Bottom });
            hbox.PackStart(new Button(StockIcons.Information.WithSize(48), "Info") { ImagePosition = ContentPosition.Top }, true);
            hbox.PackEnd(new Button("Custom" + Environment.NewLine + "Width") { MinWidth = 110 });
            PackStart(hbox);

            PackStart(new Button(new CustomImage().WithSize(22), "with red background") { BackgroundColor = Colors.Red });

            MenuButton mb = new MenuButton("This is a Menu Button");
            Menu men = new Menu();
            men.Items.Add(new MenuItem("First"));
            men.Items.Add(new MenuItem("Second"));
            men.Items.Add(new MenuItem("Third"));
            men.Items.Add(new SeparatorMenuItem());
            men.Items.Add(new CheckBoxMenuItem("Check") { Checked = true });
            men.Items.Add(new RadioButtonMenuItem("Radio") { Checked = true });
            men.Items.Add(new MenuItem("With image") { Image = Image.FromResource(typeof(App), "class.png") });

            mb.Menu = men;
            PackStart(mb);
            foreach (var mi in men.Items)
            {
                var cmi = mi;
                mi.Clicked += delegate
                {
                    mb.Label = cmi.Label + " Clicked";
                };
            }

            ToggleButton tb1 = new ToggleButton("Toggle me");
            ToggleButton tb2 = new ToggleButton("Mini toggle");
            tb1.Toggled += delegate(object sender, EventArgs e)
            {
                if (tb1.Active)
                    tb1.Label = "Toggled";
                else
                    tb1.Label = "Untoggled";
                tb2.Active = tb1.Active;
            };
            PackStart(tb1);

            var b = new Button("Mini button");
            b.Style = ButtonStyle.Borderless;
            PackStart(b);

            tb2.Style = ButtonStyle.Borderless;
            tb2.Toggled += delegate(object sender, EventArgs e)
            {
                if (tb2.Active)
                    tb2.Label = "Toggled";
                else
                    tb2.Label = "Untoggled";
                tb1.Active = tb2.Active;
            };
            PackStart(tb2);

            b = new Button(" ? ");
            b.Type = ButtonType.Help;
            PackStart(b);

            var child = new VBox();
            var container = new MyWidget { Content = child };

            var button = new Xwt.Button("Click to add a child");
            /*
            button.Clicked += delegate {
                child.PackStart (new Xwt.Label ("Child" + child.Children.Count ()));
            };
            */
            var content = new Xwt.VBox();
            content.PackStart(button);
            content.PackStart(container);

            PackStart(content);
        }
        protected override void PopulateViewBoxWithTitle(VBox vBox, IAsset asset)
        {
            base.PopulateViewBoxWithTitle(vBox, asset);

            var mod = asset as IModAsset;

            var version = new HBox();
            version.PackStart(new Label("Version"));
            version.PackEnd(new Label(mod.Information.IsDevelopment ? "IN DEVELOPMENT" : mod.Tag)
            {
                TextAlignment = Alignment.End
            });

            var enabled = new HBox();
            enabled.PackStart(new Label("Enabled"));

            var enabledCheckbox = new CheckBox
            {
                Active = mod.Information.IsEnabled,
                Sensitive = !mod.Information.IsDevelopment
            };

            if (!mod.Information.IsDevelopment)
                enabledCheckbox.Clicked += (sender, args) =>
                {
                    mod.Information.IsEnabled = !mod.Information.IsEnabled;
                    mod.SaveInformation();
                };

            enabled.PackEnd(enabledCheckbox);

            vBox.PackStart(version);
            vBox.PackStart(enabled);
        }
        void BuildGui()
        {
            this.Title = "Select Projects";
            this.Resizable = false;
            var vBox = new VBox();
            var hbox = new HBox();
            collectionsList.DataSource = collectionStore;
            collectionsList.Views.Add(new TextCellView(collectionName));
            collectionsList.MinWidth = 200;
            collectionsList.MinHeight = 300;
            hbox.PackStart(collectionsList);

            projectsList.DataSource = projectsStore;
            projectsList.MinWidth = 200;
            projectsList.MinHeight = 300;
            var checkView = new CheckBoxCellView(isProjectSelected) { Editable = true };
            checkView.Toggled += (sender, e) =>
            {
                var row = projectsList.CurrentEventRow;
                var node = projectsStore.GetNavigatorAt(row);
                var isSelected = !node.GetValue(isProjectSelected); //Xwt gives previous value
                var project = node.GetValue(projectItem);
                if (isSelected && !SelectedProjects.Any(p => string.Equals(p.Uri, project.Uri)))
                {
                    SelectedProjects.Add(project);
                }
                if (!isSelected && SelectedProjects.Any(p => string.Equals(p.Uri, project.Uri)))
                {
                    SelectedProjects.RemoveAll(p => string.Equals(p.Uri, project.Uri));
                }
            };
            projectsList.Columns.Add(new ListViewColumn("", checkView));
            projectsList.Columns.Add(new ListViewColumn("Name", new TextCellView(projectName)));
            hbox.PackEnd(projectsList);

            vBox.PackStart(hbox);

            Button ok = new Button(GettextCatalog.GetString("OK"));
            ok.Clicked += (sender, e) => Respond(Command.Ok);

            Button cancel = new Button(GettextCatalog.GetString("Cancel"));
            cancel.Clicked += (sender, e) => Respond(Command.Cancel);

            ok.MinWidth = cancel.MinWidth = Constants.ButtonWidth;

            var buttonBox = new HBox();
            buttonBox.PackEnd(ok);
            buttonBox.PackEnd(cancel);
            vBox.PackStart(buttonBox);

            this.Content = vBox;
        }
		void Build ()
		{
			Width = 400;
			Title = GettextCatalog.GetString ("Add Package Source");
			int labelWidth = 80;

			var mainVBox = new VBox ();
			Content = mainVBox;

			// Package source name.
			var packageSourceNameHBox = new HBox ();
			mainVBox.PackStart (packageSourceNameHBox);

			var packageSourceNameLabel = new Label ();
			packageSourceNameLabel.Text = GettextCatalog.GetString ("Name");
			packageSourceNameLabel.TextAlignment = Alignment.End;
			packageSourceNameLabel.WidthRequest = labelWidth;
			packageSourceNameHBox.PackStart (packageSourceNameLabel);

			packageSourceNameTextEntry = new TextEntry ();
			packageSourceNameHBox.PackEnd (packageSourceNameTextEntry, true);

			// Package source URL.
			var packageSourceUrlHBox = new HBox ();
			mainVBox.PackStart (packageSourceUrlHBox);

			var packageSourceUrlLabel = new Label ();
			packageSourceUrlLabel.Text = GettextCatalog.GetString ("URL");
			packageSourceUrlLabel.TextAlignment = Alignment.End;
			packageSourceUrlLabel.WidthRequest = labelWidth;
			packageSourceUrlHBox.PackStart (packageSourceUrlLabel);

			packageSourceUrlTextEntry = new TextEntry ();
			packageSourceUrlHBox.PackEnd (packageSourceUrlTextEntry, true);

			// Package source username.
			var packageSourceUserNameHBox = new HBox ();
			mainVBox.PackStart (packageSourceUserNameHBox);

			var packageSourceUserNameLabel = new Label ();
			packageSourceUserNameLabel.Text = GettextCatalog.GetString ("Username");
			packageSourceUserNameLabel.TextAlignment = Alignment.End;
			packageSourceUserNameLabel.WidthRequest = labelWidth;
			packageSourceUserNameHBox.PackStart (packageSourceUserNameLabel);

			packageSourceUserNameTextEntry = new TextEntry ();
			packageSourceUserNameTextEntry.PlaceholderText = GettextCatalog.GetString ("Private sources only");
			packageSourceUserNameHBox.PackEnd (packageSourceUserNameTextEntry, true);

			// Package source password.
			var packageSourcePasswordHBox = new HBox ();
			mainVBox.PackStart (packageSourcePasswordHBox);

			var packageSourcePasswordLabel = new Label ();
			packageSourcePasswordLabel.Text = GettextCatalog.GetString ("Password");
			packageSourcePasswordLabel.TextAlignment = Alignment.End;
			packageSourcePasswordLabel.WidthRequest = labelWidth;
			packageSourcePasswordHBox.PackStart (packageSourcePasswordLabel);

			packageSourcePasswordTextEntry = new PasswordEntry ();
			packageSourcePasswordTextEntry.PlaceholderText = GettextCatalog.GetString ("Private sources only");
			packageSourcePasswordHBox.PackEnd (packageSourcePasswordTextEntry, true);

			// Buttons at bottom of dialog.
			var cancelButton = new DialogButton (Command.Cancel);
			Buttons.Add (cancelButton);

			addPackageSourceButton = new DialogButton (Command.Ok);
			addPackageSourceButton.Label = GettextCatalog.GetString ("Add Source");
			addPackageSourceButton.Sensitive = false;
			Buttons.Add (addPackageSourceButton);

			savePackageSourceButton = new DialogButton (Command.Apply);
			savePackageSourceButton.Label = GettextCatalog.GetString ("Save");
			savePackageSourceButton.Visible = false;
			Buttons.Add (savePackageSourceButton);
		}
        private void BuildGui()
        {
            this.Resizable = false;
            _nameEntry.WidthRequest = _ownerEntry.WidthRequest = _computerEntry.WidthRequest = 400;

            VBox content = new VBox();
            Table entryTable = new Table();
            entryTable.Add(new Label(GettextCatalog.GetString("Name") + ":"), 0, 0); 
            entryTable.Add(_nameEntry, 1, 0);

            entryTable.Add(new Label(GettextCatalog.GetString("Owner") + ":"), 0, 1); 
            entryTable.Add(_ownerEntry, 1, 1);

            entryTable.Add(new Label(GettextCatalog.GetString("Computer") + ":"), 0, 2); 
            entryTable.Add(_computerEntry, 1, 2);

//            entryTable.Add(new Label(GettextCatalog.GetString("Permissions") + ":"), 0, 3); 
//            _permissions.Items.Add(0, "Private workspace");
//            _permissions.Items.Add(1, "Public workspace (limited)");
//            _permissions.Items.Add(2, "Public workspace");
//            entryTable.Add(_permissions, 1, 3);

            content.PackStart(entryTable);

            content.PackStart(new Label(GettextCatalog.GetString("Comment") + ":"));
            _commentEntry.MultiLine = true; //Not working yet
            content.PackStart(_commentEntry);

            content.PackStart(new Label(GettextCatalog.GetString("Working folders") + ":"));
            _workingFoldersView.DataSource = _workingFoldersStore;
            _workingFoldersView.MinHeight = 150;
            _workingFoldersView.MinWidth = 300;

            var tfsFolderView = new TextCellView(_tfsFolder);
            tfsFolderView.Editable = true;

            var localFolderView = new TextCellView(_localFolder);

            _workingFoldersView.Columns.Add(new ListViewColumn("Source Control Floder", tfsFolderView));
            _workingFoldersView.Columns.Add(new ListViewColumn("Local Floder", localFolderView));

            content.PackStart(_workingFoldersView);

            HBox buttonBox = new HBox();

            Button addButton = new Button(GettextCatalog.GetString("Add"));
            addButton.MinWidth = Constants.ButtonWidth;
            addButton.Clicked += OnAddWorkingFolder;

            Button removeButton = new Button(GettextCatalog.GetString("Remove"));
            removeButton.MinWidth = Constants.ButtonWidth;
            removeButton.Clicked += OnRemoveWorkingFolder;

            Button okButton = new Button(GettextCatalog.GetString("OK"));
            okButton.MinWidth = Constants.ButtonWidth;
            okButton.Clicked += OnAddEditWorkspace;

            Button cancelButton = new Button(GettextCatalog.GetString("Cancel"));
            cancelButton.MinWidth = Constants.ButtonWidth;
            cancelButton.Clicked += (sender, e) => Respond(Command.Cancel);

            buttonBox.PackStart(addButton);
            buttonBox.PackStart(removeButton);
            buttonBox.PackEnd(okButton);
            buttonBox.PackEnd(cancelButton);

            content.PackStart(buttonBox);

            this.Content = content;

            if (_action == DialogAction.Create)
            {
                this.Title = "Add Workspace" + " - " + projectCollection.Server.Name + " - " + projectCollection.Name;
                FillFieldsDefault();
            }
            else
            {
                this.Title = "Edit Workspace " + _workspace.Name + " - " + projectCollection.Server.Name + " - " + projectCollection.Name;
                FillFields();
                FillWorkingFolders();
            }
        }
示例#26
0
文件: StatusBar.cs 项目: jfreax/BAIMP
        /// <summary>
        /// Initializes the widgets.
        /// </summary>
        void InitializeUI()
        {
            endBox = new VBox();
            endBox.PackEnd(threadLabel);

            logBox = new HBox();
            logLevelChooser = new LogLevelChooser(currentLogLevel);
            logLevelChooser.MarginRight = 10;
            logLevelChooser.LogLevelChanged += delegate {
                CurrentLogLevel = logLevelChooser.SelectedLogLevel;
            };
            logLevelChooser.MenuShow += delegate {
                AutoCollapse = false;
            };
            logLevelChooser.MenuHide += delegate {
                AutoCollapse = true;
            };

            logBox.PackStart(logEntry, true);
            logBox.PackEnd(logLevelChooser);
            logFrame.Content = logBox;
            PackStart(logFrame, true, true);
            PackEnd(endBox);

            int completionPortThreads;
            ThreadPool.GetMaxThreads(out maxThreads, out completionPortThreads);
        }
		public SolutionRunConfigurationsPanelWidget (SolutionRunConfigurationsPanel panel, OptionsDialog dialog)
		{
			this.panel = panel;

			Margin = 6;
			Spacing = 6;

			list = new RunConfigurationsList ();
			PackStart (list, true);

			var box = new Xwt.HBox ();
			box.Spacing = 6;

			var btn = new Xwt.Button (GettextCatalog.GetString ("New"));
			btn.Clicked += OnAddConfiguration;
			box.PackStart (btn, false);

			copyButton = new Xwt.Button (GettextCatalog.GetString ("Duplicate"));
			copyButton.Clicked += OnCopyConfiguration;
			box.PackStart (copyButton, false);

			renameButton = new Xwt.Button (GettextCatalog.GetString ("Rename"));
			renameButton.Clicked += OnRenameConfiguration;
			box.PackStart (renameButton, false);

			removeButton = new Xwt.Button (GettextCatalog.GetString ("Remove"));
			removeButton.Clicked += OnRemoveConfiguration;
			box.PackEnd (removeButton, false);

			Fill ();

			PackStart (box, false);

			list.SelectionChanged += (sender, e) => UpdateButtons ();
			list.RowActivated += (sender, e) => panel.ShowConfiguration ((MultiItemSolutionRunConfiguration)list.SelectedConfiguration);
			UpdateButtons ();
		}
        void BuildGui()
        {
            this.Title = "Get";
            this.Resizable = false;
            VBox content = new VBox();
            content.PackStart(new Label(GettextCatalog.GetString("Files") + ":"));

            listStore = new ListStore(itemField, isSelectedField, nameField, pathField);
            var checkSell = new CheckBoxCellView(isSelectedField);
            checkSell.Editable = true;
            listView.Columns.Add("Name", checkSell, new TextCellView(nameField));
            listView.Columns.Add("Folder", new TextCellView(pathField));
            listView.MinHeight = 200;
            listView.DataSource = listStore;

            content.PackStart(listView);

            HBox typeBox = new HBox();
            typeBox.PackStart(new Label(GettextCatalog.GetString("Version") + ":"));
            versionBox.Items.Add(0, "Changeset");
            versionBox.Items.Add(1, "Latest Version");
            versionBox.SelectedItem = 1;
            versionBox.SelectionChanged += (sender, e) => changeSetNumber.Visible = (int)versionBox.SelectedItem == 0;
            typeBox.PackStart(versionBox);
            changeSetNumber.Visible = false;
            changeSetNumber.WidthRequest = 100;
            changeSetNumber.MinimumValue = 1;
            changeSetNumber.MaximumValue = int.MaxValue;
            changeSetNumber.Value = 0;
            changeSetNumber.IncrementValue = 1;
            changeSetNumber.Digits = 0;
            typeBox.PackStart(changeSetNumber);
            content.PackStart(typeBox);

            content.PackStart(forceGet);
            //content.PackStart(overrideGet);

            HBox buttonBox = new HBox();
            Button okButton = new Button(GettextCatalog.GetString("Get"));
            okButton.Clicked += OnGet;
            Button cancelButton = new Button(GettextCatalog.GetString("Cancel"));
            cancelButton.Clicked += (sender, e) => Respond(Command.Cancel);
            okButton.WidthRequest = cancelButton.WidthRequest = Constants.ButtonWidth;

            buttonBox.PackEnd(cancelButton);
            buttonBox.PackEnd(okButton);
            content.PackStart(buttonBox);

            this.Content = content;
        }
示例#29
0
        /// <summary>
        /// builds dialog window
        /// </summary>
        void BuildContent()
        {
            Table table = new Table ();

            _jackdPathEntry = BuildRow (table, 0, I18N._ ("Jackd Startup Path"), I18N._ ("e.g. /usr/bin/jackd"));
            _jackdPathEntry.FileSelector ();
            _jackdGeneralOptionsEntry = BuildRow (table, 1, I18N._ ("General Options"), I18N._ ("optional"));
            _jackdDriverEntry = BuildRow (table, 2, I18N._ ("Driver Infrastructure"), I18N._ ("e.g. alsa"));
            _jackdDriverOptionsEntry = BuildRow (table, 3, I18N._ ("Driver Options"), I18N._ ("optional"));

            HBox buttonBox = new HBox ();
            _okButton = new Button (I18N._ ("Save")) { Image = Icons.Ok };
            _cancelButton = new Button (I18N._ ("Cancel")) {
                Image = Icons.Cancel,
                      Style = ButtonStyle.Flat
            };
            buttonBox.PackStart (_cancelButton);
            buttonBox.PackEnd (_okButton);

            VBox box = new VBox ();
            box.PackStart (table);
            box.PackEnd (buttonBox);
            Content = box;
        }
示例#30
0
 void BuildContent()
 {
     VBox mainContent = new VBox ();
     _programName = new Label ();
     _programName.Font = _programName.Font.WithScaledSize (1.5).WithWeight (FontWeight.Bold);
     mainContent.PackStart (_programName);
     _comments = new Label ();
     _comments.Wrap = WrapMode.Word;
     mainContent.PackStart (_comments);
     _copyright = new Label ();
     _copyright.Font = _copyright.Font.WithScaledSize (0.8);
     mainContent.PackStart (_copyright);
     _website = new LinkLabel ();
     _website.Font = _website.Font.WithScaledSize (0.8);
     mainContent.PackStart (_website);
     HBox buttonRow = new HBox ();
     Button authors = new Button {
         Label = I18N._ ("Authors"),
         Image = Icons.Info
     };
     authors.Clicked += (sender, args) => ShowAuthors ();
     buttonRow.PackStart (authors);
     Button license = new Button {
         Label = I18N._ ("License"),
         Image = Icons.Info
     };
     license.Clicked += (sender, args) => ShowLicense ();
     buttonRow.PackStart (license);
     Button ok = new Button { Label = I18N._ ("Close"), Image = Icons.Ok };
     ok.Clicked += (sender, args) => Close ();
     buttonRow.PackEnd (ok);
     mainContent.PackEnd (buttonRow);
     Content = mainContent;
 }
示例#31
0
        private Widget CreateTopBar()
        {
            var topBox = new HBox();

            lblTitle = new Label {
                Text = Card.Title,
                Font = Font.WithWeight(FontWeight.Bold).WithSize(20),
                TextAlignment = Alignment.Center,
                Wrap = WrapMode.Word,
                Visible = false
            };
            topBox.PackStart(lblTitle, true);

            txtTitle = new TextEntry {
                Text = Card.Title,
                Font = lblTitle.Font,
                TextAlignment = Alignment.Center,
                Visible = false
            };
            topBox.PackStart(txtTitle, true);

            btnEdit = new ToggleButton(ResourcesManager.GetImage("pencil.png"));
            topBox.PackEnd(btnEdit);

            return topBox;
        }
示例#32
0
        public ReferenceImageVerifierDialog()
        {
            Width  = 500;
            Height = 300;

            Table table = new Table();

            table.DefaultRowSpacing = table.DefaultColumnSpacing = 6;

            table.Add(nameLabel = new Label(), 0, 0, hexpand: true);
            table.Add(new Label("Reference Image"), 0, 1, hexpand: true);
            table.Add(new Label("Test Image"), 1, 1, hexpand: true);
            nameLabel.Font = nameLabel.Font.WithWeight(Xwt.Drawing.FontWeight.Bold);

            img1 = new ImageView();
            var frame = new FrameBox {
                Content     = img1,
                BorderColor = Xwt.Drawing.Colors.Gray,
                BorderWidth = 1
            };

            table.Add(frame, 0, 2, hexpand: true, vexpand: true, hpos: WidgetPlacement.Center, vpos: WidgetPlacement.Center);

            imgDiff = new ImageView();
            frame   = new FrameBox {
                Content     = imgDiff,
                BorderColor = Xwt.Drawing.Colors.Gray,
                BorderWidth = 1
            };
            table.Add(frame, 1, 2, hexpand: true, vexpand: true, hpos: WidgetPlacement.Center, vpos: WidgetPlacement.Center);

            img2  = new ImageView();
            frame = new FrameBox {
                Content     = img2,
                BorderColor = Xwt.Drawing.Colors.Gray,
                BorderWidth = 1
            };
            table.Add(frame, 2, 2, hexpand: true, vexpand: true, hpos: WidgetPlacement.Center, vpos: WidgetPlacement.Center);

            var buttonBox = new HBox();

            table.Add(buttonBox, 0, 3, colspan: 2, hexpand: true);

            closeButton = new Button("Close");
            validButton = new Button("Success");
            failButton  = new Button("Failure");

            buttonBox.PackEnd(closeButton);
            buttonBox.PackEnd(failButton);
            buttonBox.PackEnd(validButton);

            closeButton.Clicked += delegate {
                Respond(Command.Ok);
            };

            failButton.Clicked += delegate {
                var info = ReferenceImageManager.ImageFailures[currentImage];
                info.Fail();
                ShowNextImage();
            };

            validButton.Clicked += delegate {
                var info = ReferenceImageManager.ImageFailures[currentImage];
                info.Validate();
                ShowNextImage();
            };

            Content = table;
            ShowNextImage();
        }