示例#1
0
        /// <summary>Initializes a new instance of the <see cref="SeriesView" /> class</summary>
        public SeriesView(ViewBase owner) : base(owner)
        {
            Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.SeriesView.glade");

            vbox1      = (VBox)builder.GetObject("vbox1");
            table1     = (Table)builder.GetObject("table1");
            label4     = (Label)builder.GetObject("label4");
            label5     = (Label)builder.GetObject("label5");
            mainWidget = vbox1;

            graphView1 = new GraphView(this);
            vbox1.PackStart(graphView1.MainWidget, true, true, 0);

            checkpointDropDown    = new DropDownView(this);
            dataSourceDropDown    = new DropDownView(this);
            xDropDown             = new DropDownView(this);
            yDropDown             = new DropDownView(this);
            x2DropDown            = new DropDownView(this);
            y2DropDown            = new DropDownView(this);
            seriesDropDown        = new DropDownView(this);
            lineTypeDropDown      = new DropDownView(this);
            markerTypeDropDown    = new DropDownView(this);
            colourDropDown        = new ColourDropDownView(this);
            lineThicknessDropDown = new DropDownView(this);
            markerSizeDropDown    = new DropDownView(this);

            checkBoxView1             = new CheckBoxView(this);
            checkBoxView1.TextOfLabel = "on top?";
            checkBoxView2             = new CheckBoxView(this);
            checkBoxView2.TextOfLabel = "on right?";
            checkBoxView3             = new CheckBoxView(this);
            checkBoxView3.TextOfLabel = "cumulative?";
            checkBoxView4             = new CheckBoxView(this);
            checkBoxView4.TextOfLabel = "cumulative?";
            checkBoxView5             = new CheckBoxView(this);
            checkBoxView5.TextOfLabel = "Show in legend?";
            checkBoxView6             = new CheckBoxView(this);
            checkBoxView6.TextOfLabel = "Include series name in legend?";

            editView1 = new EditView(this);

            table1.Attach(checkpointDropDown.MainWidget, 1, 2, 0, 1, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(dataSourceDropDown.MainWidget, 1, 2, 1, 2, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(xDropDown.MainWidget, 1, 2, 2, 3, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(yDropDown.MainWidget, 1, 2, 3, 4, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(y2DropDown.MainWidget, 1, 2, 4, 5, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(x2DropDown.MainWidget, 1, 2, 5, 6, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(seriesDropDown.MainWidget, 1, 2, 6, 7, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(lineTypeDropDown.MainWidget, 1, 2, 7, 8, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(markerTypeDropDown.MainWidget, 1, 2, 8, 9, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(colourDropDown.MainWidget, 1, 2, 9, 10, AttachOptions.Fill, 0, 10, 2);

            Image helpImage = new Image(null, "ApsimNG.Resources.help.png");

            helpBox = new EventBox();
            helpBox.Add(helpImage);
            helpBox.ButtonReleaseEvent += Help_ButtonPressEvent;
            HBox filterBox = new HBox();

            filterBox.PackStart(editView1.MainWidget, true, true, 0);
            filterBox.PackEnd(helpBox, false, true, 0);

            //table1.Attach(editView1.MainWidget, 1, 2, 9, 10, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(filterBox, 1, 2, 10, 11, AttachOptions.Fill, 0, 10, 2);

            table1.Attach(checkBoxView1.MainWidget, 2, 3, 2, 3, AttachOptions.Fill, 0, 0, 0);
            table1.Attach(checkBoxView2.MainWidget, 2, 3, 3, 4, AttachOptions.Fill, 0, 0, 0);
            table1.Attach(checkBoxView3.MainWidget, 3, 4, 2, 3, AttachOptions.Fill, 0, 0, 0);
            table1.Attach(checkBoxView4.MainWidget, 3, 4, 3, 4, AttachOptions.Fill, 0, 0, 0);

            table1.Attach(checkBoxView5.MainWidget, 2, 4, 9, 10, AttachOptions.Fill, 0, 0, 0);
            table1.Attach(checkBoxView6.MainWidget, 2, 4, 10, 11, AttachOptions.Fill, 0, 0, 0);

            table1.Attach(lineThicknessDropDown.MainWidget, 3, 4, 7, 8, AttachOptions.Fill, 0, 0, 5);
            table1.Attach(markerSizeDropDown.MainWidget, 3, 4, 8, 9, AttachOptions.Fill, 0, 0, 5);
            mainWidget.Destroyed += _mainWidget_Destroyed;
        }
        void Build()
        {
            Title   = GettextCatalog.GetString("Manage NuGet Packages – Solution");
            Width   = 840;
            Height  = 528;
            Padding = new WidgetSpacing();

            if (Platform.IsWindows)
            {
                packageInfoFontSize = 9;
            }

            // Top part of dialog:
            // Package sources and search.
            var topHBox = new HBox();

            topHBox.Margin = new WidgetSpacing(8, 5, 6, 5);

            // HACK: VoiceOver does not work when using Accessible.Label so workaround this by using
            // Accessible.LabelWidget and hide the label since we do not need it.
            var packageSourceLabel = new Label();

            packageSourceLabel.Text    = GettextCatalog.GetString("Package source");
            packageSourceLabel.Visible = false;
            topHBox.PackStart(packageSourceLabel);

            packageSourceComboBox          = new ComboBox();
            packageSourceComboBox.Name     = "packageSourceComboBox";
            packageSourceComboBox.MinWidth = 200;
            // Does not work:
            //packageSourceComboBox.Accessible.Label = GettextCatalog.GetString ("Package source");
            packageSourceComboBox.Accessible.LabelWidget = packageSourceLabel;
            topHBox.PackStart(packageSourceComboBox);

            tabGroup = new HBox();

            int tabLabelMinWidth = 60;

            browseLabel            = new CustomButtonLabel();
            browseLabel.Text       = GettextCatalog.GetString("Browse");
            browseLabel.Tag        = browseLabel.Text;
            browseLabel.MinWidth   = tabLabelMinWidth;
            browseLabel.MarginLeft = 10;
            tabGroup.PackStart(browseLabel);

            installedLabel          = new CustomButtonLabel();
            installedLabel.Text     = GettextCatalog.GetString("Installed");
            installedLabel.Tag      = installedLabel.Text;
            installedLabel.MinWidth = tabLabelMinWidth;
            tabGroup.PackStart(installedLabel);

            updatesLabel          = new CustomButtonLabel();
            updatesLabel.Text     = GettextCatalog.GetString("Updates");
            updatesLabel.Tag      = updatesLabel.Text;
            updatesLabel.MinWidth = tabLabelMinWidth;
            tabGroup.PackStart(updatesLabel);

            consolidateLabel          = new CustomButtonLabel();
            consolidateLabel.Text     = GettextCatalog.GetString("Consolidate");
            consolidateLabel.Tag      = consolidateLabel.Text;
            consolidateLabel.MinWidth = tabLabelMinWidth;
            tabGroup.PackStart(consolidateLabel);

            topHBox.PackStart(tabGroup);

            packageSearchEntry                  = new SearchTextEntry();
            packageSearchEntry.Name             = "managePackagesDialogSearchEntry";
            packageSearchEntry.WidthRequest     = 187;
            packageSearchEntry.PlaceholderText  = GettextCatalog.GetString("Search");
            packageSearchEntry.Accessible.Label = GettextCatalog.GetString("Package Search");
            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 = Styles.LineBorderColor;
            mainVBox.PackStart(middleFrame, true, true);

            // Error information.
            var packagesListVBox = new VBox();

            packagesListVBox.Spacing         = 0;
            errorMessageHBox                 = new HBox();
            errorMessageHBox.Margin          = new WidgetSpacing();
            errorMessageHBox.BackgroundColor = Styles.ErrorBackgroundColor;
            errorMessageHBox.Visible         = false;
            var errorImage = new ImageView();

            errorImage.Margin = new WidgetSpacing(10, 0, 0, 0);
            errorImage.Image  = ImageService.GetIcon(MonoDevelop.Ide.Gui.Stock.Warning, Gtk.IconSize.Menu);
            errorImage.HorizontalPlacement = WidgetPlacement.End;
            errorMessageHBox.PackStart(errorImage);
            errorMessageLabel           = new Label();
            errorMessageLabel.TextColor = Styles.ErrorForegroundColor;
            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;
            packagesListView.Accessible.Label = GettextCatalog.GetString("Packages");
            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 = GettextCatalog.GetString("Loading package list...");
            loadingSpinnerHBox.PackEnd(loadingSpinnerLabel);

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

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

            noPackagesFoundHBox.HorizontalPlacement = WidgetPlacement.Center;

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

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

            // Package information
            packageInfoVBox = new VBox();
            var packageInfoFrame = new FrameBox();

            packageInfoFrame.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageInfoFrame.BorderWidth     = new WidgetSpacing();
            packageInfoFrame.Content         = packageInfoVBox;
            packageInfoVBox.Margin           = new WidgetSpacing(15, 12, 15, 12);
            var packageInfoContainerVBox = new VBox();

            packageInfoContainerVBox.WidthRequest = 328;
            packageInfoContainerVBox.PackStart(packageInfoFrame, true, true);

            var packageInfoScrollView = new ScrollView();

            packageInfoScrollView.BorderVisible          = false;
            packageInfoScrollView.HorizontalScrollPolicy = ScrollPolicy.Never;
            packageInfoScrollView.Content         = packageInfoContainerVBox;
            packageInfoScrollView.BackgroundColor = Styles.PackageInfoBackgroundColor;
            var packageInfoScrollViewFrame = new FrameBox();

            packageInfoScrollViewFrame.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageInfoScrollViewFrame.BorderWidth     = new WidgetSpacing(1, 0, 0, 0);
            packageInfoScrollViewFrame.BorderColor     = Styles.LineBorderColor;
            packageInfoScrollViewFrame.Content         = packageInfoScrollView;

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

            packageNameLabel           = new Label();
            packageNameLabel.Ellipsize = EllipsizeMode.End;
            Font packageInfoSmallFont = packageNameLabel.Font.WithSize(packageInfoFontSize);
            Font packageInfoBoldFont  = packageInfoSmallFont.WithWeight(FontWeight.Bold);

            packageNameLabel.Font = packageInfoSmallFont;
            packageNameHBox.PackStart(packageNameLabel, true);

            // Projects list view label.
            projectsListViewLabel                 = new Label();
            projectsListViewLabel.Wrap            = WrapMode.Word;
            projectsListViewLabel.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageInfoVBox.PackStart(projectsListViewLabel);

            // Projects list view.
            projectsListViewVBox        = new VBox();
            projectsListViewVBox.Margin = new WidgetSpacing();
            packageInfoVBox.PackStart(projectsListViewVBox, true, true);

            // Package description.
            packageDescription                 = new Label();
            packageDescription.Wrap            = WrapMode.Word;
            packageDescription.Font            = packageNameLabel.Font.WithSize(packageInfoFontSize);
            packageDescription.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageInfoVBox.PackStart(packageDescription);

            // Package id.
            var packageIdHBox = new HBox();

            packageIdHBox.MarginTop = 7;
            packageInfoVBox.PackStart(packageIdHBox);

            var packageIdLabel = new Label();

            packageIdLabel.Font = packageInfoBoldFont;
            packageIdLabel.Text = GettextCatalog.GetString("ID");
            packageIdHBox.PackStart(packageIdLabel);

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

            // Package author
            var packageAuthorHBox = new HBox();

            packageInfoVBox.PackStart(packageAuthorHBox);

            var packageAuthorLabel = new Label();

            packageAuthorLabel.Text = GettextCatalog.GetString("Author");
            packageAuthorLabel.Font = packageInfoBoldFont;
            packageAuthorHBox.PackStart(packageAuthorLabel);

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

            // Package published
            var packagePublishedHBox = new HBox();

            packageInfoVBox.PackStart(packagePublishedHBox);

            var packagePublishedLabel = new Label();

            packagePublishedLabel.Text = GettextCatalog.GetString("Published");
            packagePublishedLabel.Font = packageInfoBoldFont;
            packagePublishedHBox.PackStart(packagePublishedLabel);

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

            // Package downloads
            var packageDownloadsHBox = new HBox();

            packageInfoVBox.PackStart(packageDownloadsHBox);

            var packageDownloadsLabel = new Label();

            packageDownloadsLabel.Text = GettextCatalog.GetString("Downloads");
            packageDownloadsLabel.Font = packageInfoBoldFont;
            packageDownloadsHBox.PackStart(packageDownloadsLabel);

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

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

            packageInfoVBox.PackStart(packageLicenseHBox);

            var packageLicenseLabel = new Label();

            packageLicenseLabel.Text = GettextCatalog.GetString("License");
            packageLicenseLabel.Font = packageInfoBoldFont;
            packageLicenseHBox.PackStart(packageLicenseLabel);

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

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

            packageInfoVBox.PackStart(packageProjectPageHBox);

            var packageProjectPageLabel = new Label();

            packageProjectPageLabel.Text = GettextCatalog.GetString("Project Page");
            packageProjectPageLabel.Font = packageInfoBoldFont;
            packageProjectPageHBox.PackStart(packageProjectPageLabel);

            packageProjectPageLink                  = new LinkLabel();
            packageProjectPageLink.Text             = GettextCatalog.GetString("Visit Page");
            packageProjectPageLink.Font             = packageInfoSmallFont;
            packageProjectPageLink.Accessible.Label = GettextCatalog.GetString("Visit Project Page");
            packageProjectPageHBox.PackEnd(packageProjectPageLink);

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

            var packageDependenciesLabel = new Label();

            packageDependenciesLabel.Text = GettextCatalog.GetString("Dependencies");
            packageDependenciesLabel.Font = packageInfoBoldFont;
            packageDependenciesHBox.PackStart(packageDependenciesLabel);

            packageDependenciesNoneLabel      = new Label();
            packageDependenciesNoneLabel.Text = GettextCatalog.GetString("None");
            packageDependenciesNoneLabel.Font = packageInfoSmallFont;
            packageDependenciesNoneLabel.Accessible.LabelWidget = packageDependenciesLabel;
            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;
            packageDependenciesList.Accessible.LabelWidget = packageDependenciesLabel;
            packageDependenciesListHBox.PackStart(packageDependenciesList, true);

            // Current package version.
            currentPackageVersionHBox                 = new HBox();
            currentPackageVersionHBox.Spacing         = 15;
            currentPackageVersionHBox.Visible         = false;
            currentPackageVersionHBox.BackgroundColor = Styles.PackageInfoBackgroundColor;
            currentPackageVersionHBox.Margin          = new WidgetSpacing(15, 0, 15, 0);
            currentPackageVersionLabel                = new Label();
            currentPackageVersionLabel.BoundsChanged += PackageVersionLabelBoundsChanged;
            currentPackageVersionLabel.Font           = packageInfoSmallFont;
            currentPackageVersionLabel.Text           = GettextCatalog.GetString("Current Version:");
            currentPackageVersionLabel.TextAlignment  = Alignment.End;
            currentPackageVersionHBox.PackStart(currentPackageVersionLabel);

            var currentPackageVersionWithInfoPopoverHBox = new HBox();

            currentPackageVersionWithInfoPopoverHBox.Margin  = new WidgetSpacing();
            currentPackageVersionWithInfoPopoverHBox.Spacing = 0;

            currentPackageVersion      = new Label();
            currentPackageVersion.Font = packageInfoSmallFont;
            currentPackageVersion.Accessible.LabelWidget = currentPackageVersionLabel;
            currentPackageVersionWithInfoPopoverHBox.PackStart(currentPackageVersion);

            currentPackageVersionInfoPopoverWidget          = new InformationPopoverWidget();
            currentPackageVersionInfoPopoverWidget.Severity = Ide.Tasks.TaskSeverity.Information;
            currentPackageVersionInfoPopoverWidget.Margin   = new WidgetSpacing(5, 0, 0, 2);
            currentPackageVersionInfoPopoverWidget.Accessible.LabelWidget = currentPackageVersionLabel;
            currentPackageVersionWithInfoPopoverHBox.PackStart(currentPackageVersionInfoPopoverWidget);

            currentPackageVersionHBox.PackStart(currentPackageVersionWithInfoPopoverHBox);

            // Package versions.
            packageVersionsHBox                 = new HBox();
            packageVersionsHBox.Visible         = false;
            packageVersionsHBox.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageVersionsHBox.Margin          = new WidgetSpacing(15, 0, 15, 12);
            packageVersionsLabel                = new Label();
            packageVersionsLabel.Font           = packageInfoSmallFont;
            packageVersionsLabel.Text           = GettextCatalog.GetString("New Version:");
            packageVersionsLabel.TextAlignment  = Alignment.End;
            packageVersionsHBox.PackStart(packageVersionsLabel);

            packageVersionComboBox      = new ComboBox();
            packageVersionComboBox.Name = "packageVersionComboBox";
            packageVersionComboBox.Accessible.LabelWidget = packageVersionsLabel;
            packageVersionsHBox.Spacing = 15;
            packageVersionsHBox.PackStart(packageVersionComboBox, true, true);

            var packageInfoAndVersionsVBox = new VBox();

            packageInfoAndVersionsVBox.Margin          = new WidgetSpacing();
            packageInfoAndVersionsVBox.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageInfoAndVersionsVBox.PackStart(packageInfoScrollViewFrame, true, true);
            packageInfoAndVersionsVBox.PackStart(currentPackageVersionHBox, false, false);
            packageInfoAndVersionsVBox.PackStart(packageVersionsHBox, false, false);
            middleHBox.PackEnd(packageInfoAndVersionsVBox);

            // 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.Name  = "managePackagesDialogShowPreReleaseCheckBox";
            showPrereleaseCheckBox.Label = GettextCatalog.GetString("Show pre-release packages");
            bottomHBox.PackStart(showPrereleaseCheckBox);

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

            closeButton           = new Button();
            closeButton.Name      = "managePackagesDialogCloseButton";
            closeButton.MinWidth  = 120;
            closeButton.MinHeight = 25;
            closeButton.Label     = GettextCatalog.GetString("Close");
            bottomHBox.PackEnd(closeButton);

            packageSearchEntry.SetFocus();
            packageInfoVBox.Visible = false;
        }
示例#3
0
        private void BuildFooter()
        {
            if (mode == EditorMode.View)
            {
                return;
            }

            HBox button_box = new HBox();

            button_box.Spacing = 6;

            if (TrackCount > 1)
            {
                sync_all_button = new PulsingButton();
                sync_all_button.FocusInEvent += delegate {
                    ForeachWidget <SyncButton> (delegate(SyncButton button) {
                        button.StartPulsing();
                    });
                };

                sync_all_button.FocusOutEvent += delegate {
                    if (sync_all_button.State == StateType.Prelight)
                    {
                        return;
                    }

                    ForeachWidget <SyncButton> (delegate(SyncButton button) {
                        button.StopPulsing();
                    });
                };

                sync_all_button.StateChanged += delegate {
                    if (sync_all_button.HasFocus)
                    {
                        return;
                    }

                    ForeachWidget <SyncButton> (delegate(SyncButton button) {
                        if (sync_all_button.State == StateType.Prelight)
                        {
                            button.StartPulsing();
                        }
                        else
                        {
                            button.StopPulsing();
                        }
                    });
                };

                sync_all_button.Clicked += delegate {
                    InvokeFieldSync();
                };

                Alignment alignment = new Alignment(0.5f, 0.5f, 0.0f, 0.0f);
                HBox      box       = new HBox();
                box.Spacing = 2;
                box.PackStart(new Image(Stock.Copy, IconSize.Button), false, false, 0);
                box.PackStart(new Label(Catalog.GetString("Sync all field _values")), false, false, 0);
                alignment.Add(box);
                sync_all_button.Add(alignment);

                TooltipSetter.Set(tooltip_host, sync_all_button, Catalog.GetString(
                                      "Apply the values of all common fields set for this track to all of the tracks selected in this editor"));

                button_box.PackStart(sync_all_button, false, false, 0);

                foreach (Widget child in ActionArea.Children)
                {
                    child.SizeAllocated += OnActionAreaChildSizeAllocated;
                }

                edit_notif_label        = new Label();
                edit_notif_label.Xalign = 1.0f;
                button_box.PackEnd(edit_notif_label, false, false, 0);
            }

            main_vbox.PackStart(button_box, false, false, 0);
            button_box.ShowAll();
        }
示例#4
0
        public FullScreenView(IBrowsableCollection collection) : base("Full Screen Mode")
        {
            Name = "FullscreenContainer";
            try {
                //scroll = new Gtk.ScrolledWindow (null, null);
                actions = new ActionGroup("joe");

                actions.Add(new ActionEntry [] {
                    new ActionEntry(HideToolbar, Stock.Close,
                                    Catalog.GetString("Hide"),
                                    null,
                                    Catalog.GetString("Hide Toolbar"),
                                    HideToolbarAction),
                    new ActionEntry(ExitFullScreen,
                                    "f-spot-view-restore",
                                    Catalog.GetString("Exit fullscreen"),
                                    null,
                                    null,
                                    ExitAction),
                    new ActionEntry(SlideShow,
                                    "f-spot-slideshow",
                                    Catalog.GetString("Slideshow"),
                                    null,
                                    Catalog.GetString("Start slideshow"),
                                    SlideShowAction),
                });

                actions.Add(new ToggleActionEntry [] {
                    new ToggleActionEntry(Info,
                                          Stock.Info,
                                          Catalog.GetString("Info"),
                                          null,
                                          Catalog.GetString("Image Information"),
                                          InfoAction,
                                          false)
                });

                new Fader(this, 1.0, 3);
                notebook            = new Notebook();
                notebook.ShowBorder = false;
                notebook.ShowTabs   = false;
                notebook.Show();

                scroll = new ScrolledView();
                view   = new PhotoImageView(collection);
                // FIXME this should be handled by the new style setting code
                view.ModifyBg(Gtk.StateType.Normal, this.Style.Black);
                view.PointerMode = ImageView.PointerModeType.Scroll;
                this.Add(notebook);
                view.Show();
                view.MotionNotifyEvent += HandleViewMotion;

                Action rotate_left = new RotateLeftAction(view.Item);
                actions.Add(rotate_left);

                Action rotate_right = new RotateRightAction(view.Item);
                actions.Add(rotate_right);

                scroll.ScrolledWindow.Add(view);
                HBox hhbox = new HBox();
                hhbox.PackEnd(GetButton(HideToolbar), false, true, 0);
                hhbox.PackEnd(GetButton(Info), false, true, 0);
                hhbox.PackStart(GetButton(ExitFullScreen, true), false, false, 0);
                hhbox.PackStart(Add(new PreviousPictureAction(view.Item)), false, false, 0);
                hhbox.PackStart(GetButton(SlideShow), false, true, 0);
                hhbox.PackStart(Add(new NextPictureAction(view.Item)), false, false, 0);
                //hhbox.PackStart (Add (new AutoColor (view.Item)), false, false, 0);

                display = new TextureDisplay(view.Item);
                display.AddEvents((int)(Gdk.EventMask.PointerMotionMask));
                display.ModifyBg(Gtk.StateType.Normal, this.Style.Black);
                display.MotionNotifyEvent += HandleViewMotion;
                Label effect = new Label(Catalog.GetString("Slide transition: "));
                hhbox.PackStart(effect, false, false, 5);
                hhbox.PackStart(display.GetCombo(), false, false, 0);
                display.Show();

                hhbox.PackStart(Add(new RotateLeftAction(view.Item)), false, false, 0);
                hhbox.PackStart(Add(new RotateRightAction(view.Item)), false, false, 0);
                hhbox.BorderWidth = 15;

                tag_view = new TagView();
                hhbox.PackStart(tag_view, false, false, 0);

                //display = new ImageDisplay (view.Item);

                notebook.AppendPage(scroll, null);
                notebook.AppendPage(display, null);

                hhbox.ShowAll();
                //scroll.ShowControls ();

                scroll.Show();
                this.Decorated = false;
                this.Fullscreen();
                this.ButtonPressEvent += HandleButtonPressEvent;

                view.Item.Changed += HandleItemChanged;
                view.GrabFocus();

                controls = new ControlOverlay(this);
                controls.Add(hhbox);
                controls.Dismiss();

                notebook.CurrentPage = 0;
            } catch (System.Exception e) {
                System.Console.WriteLine(e);
            }
        }
        void BuildGui()
        {
            ContentName = "Analytics";

            _headerBox.PackStart(_appNameLabel);
            _headerBox.PackStart(_titleLabel);
            _headerBox.PackEnd(_appsCombo);

            _rangeBox.PackStart(_lastDayToggle);
            _rangeBox.PackStart(_lastWeekToggle);
            _rangeBox.PackStart(_lastMonthToggle);

            _devicesBox.PackStart(_devicesTitleLabel);
            var xwtDevicesPlotView = Toolkit.CurrentEngine.WrapWidget(_devicesPlotView);

            _devicesBox.PackStart(xwtDevicesPlotView, true);

            _countriesBox.PackStart(_countriesTitleLabel);
            var xwtCountriesPlotView = Toolkit.CurrentEngine.WrapWidget(_countriesPlotView);

            _countriesBox.PackStart(xwtCountriesPlotView, true);

            _languagesBox.PackStart(_languagesTitleLabel);
            var xwtLanguagesPlotView = Toolkit.CurrentEngine.WrapWidget(_languagesPlotView);

            _languagesBox.PackStart(xwtLanguagesPlotView, true);

            _usersBox.PackStart(_usersTitleLabel);
            var xwtUsersPlotView = Toolkit.CurrentEngine.WrapWidget(_usersPlotView);

            _usersBox.PackStart(xwtUsersPlotView, true);

            _devicesFrameBox.Content   = _devicesBox;
            _countriesFrameBox.Content = _countriesBox;
            _languagesFrameBox.Content = _languagesBox;
            _usersFrameBox.Content     = _usersBox;

            _firstBox.PackStart(_devicesFrameBox, true);
            _firstBox.PackStart(_countriesFrameBox, true);
            _firstBox.PackStart(_languagesFrameBox, true);

            _secondBox.PackStart(_usersFrameBox, true);

            _durationsBox.PackStart(_durationsTitleLabel);
            _durationsBox.PackStart(_durationsView);

            _statisticsBox.PackStart(_statisticsTitleLabel);
            _statisticsBox.PackStart(_statisticsView);

            _durationsFrameBox.Content  = _durationsBox;
            _statisticsFrameBox.Content = _statisticsBox;

            _thirdBox.PackStart(_durationsFrameBox, true);
            _thirdBox.PackStart(_statisticsFrameBox, true);

            _contentScrollBox.PackStart(_firstBox);
            _contentScrollBox.PackStart(_secondBox);
            _contentScrollBox.PackStart(_thirdBox);

            _contentScroll.Content = _contentScrollBox;

            _contentBox.PackStart(_contentScroll, true);
            _contentBox.PackStart(_contentSpinner, true, WidgetPlacement.Center);

            _mainBox.PackStart(_headerBox);
            _mainBox.PackStart(_rangeBox);
            _mainBox.PackStart(_separator);
            _mainBox.PackEnd(_contentBox, true);
        }
示例#6
0
        public override void Initialize(NodeBuilder[] builders, TreePadOption[] options, string menuPath)
        {
            base.Initialize(builders, options, menuPath);

            testChangedHandler            = (EventHandler)DispatchService.GuiDispatch(new EventHandler(OnDetailsTestChanged));
            testService.TestSuiteChanged += (EventHandler)DispatchService.GuiDispatch(new EventHandler(OnTestSuiteChanged));
            paned = new VPaned();

            VBox            vbox       = new VBox();
            DockItemToolbar topToolbar = Window.GetToolbar(PositionType.Top);

            buttonRunAll             = new Button(new Gtk.Image(Gtk.Stock.GoUp, IconSize.Menu));
            buttonRunAll.Clicked    += new EventHandler(OnRunAllClicked);
            buttonRunAll.Sensitive   = true;
            buttonRunAll.TooltipText = GettextCatalog.GetString("Run all tests");
            topToolbar.Add(buttonRunAll);

            buttonRun             = new Button(new Gtk.Image(Gtk.Stock.Execute, IconSize.Menu));
            buttonRun.Clicked    += new EventHandler(OnRunClicked);
            buttonRun.Sensitive   = true;
            buttonRun.TooltipText = GettextCatalog.GetString("Run test");
            topToolbar.Add(buttonRun);

            buttonStop             = new Button(new Gtk.Image(Gtk.Stock.Stop, IconSize.Menu));
            buttonStop.Clicked    += new EventHandler(OnStopClicked);
            buttonStop.Sensitive   = false;
            buttonStop.TooltipText = GettextCatalog.GetString("Cancel running test");
            topToolbar.Add(buttonStop);
            topToolbar.ShowAll();

            vbox.PackEnd(base.Control, true, true, 0);
            vbox.FocusChain = new Gtk.Widget [] { base.Control };

            paned.Pack1(vbox, true, true);

            detailsPad = new VBox();

            EventBox eb     = new EventBox();
            HBox     header = new HBox();

            eb.Add(header);

            detailLabel         = new HeaderLabel();
            detailLabel.Padding = 6;

            Button hb = new Button(new Gtk.Image("gtk-close", IconSize.SmallToolbar));

            hb.Relief   = ReliefStyle.None;
            hb.Clicked += new EventHandler(OnCloseDetails);
            header.PackEnd(hb, false, false, 0);

            hb          = new Button(new Gtk.Image("gtk-go-back", IconSize.SmallToolbar));
            hb.Relief   = ReliefStyle.None;
            hb.Clicked += new EventHandler(OnGoBackTest);
            header.PackEnd(hb, false, false, 0);

            header.Add(detailLabel);
            Gdk.Color hcol = eb.Style.Background(StateType.Normal);
            hcol.Red   = (ushort)(((double)hcol.Red) * 0.9);
            hcol.Green = (ushort)(((double)hcol.Green) * 0.9);
            hcol.Blue  = (ushort)(((double)hcol.Blue) * 0.9);
            //	eb.ModifyBg (StateType.Normal, hcol);

            detailsPad.PackStart(eb, false, false, 0);

            VPaned panedDetails = new VPaned();

            panedDetails.BorderWidth = 3;
            VBox boxPaned1 = new VBox();

            chart = new TestChart();
            chart.ButtonPressEvent += OnChartButtonPress;
            chart.SelectionChanged += new EventHandler(OnChartDateChanged);
            chart.HeightRequest     = 50;

            Toolbar toolbar = new Toolbar();

            toolbar.IconSize     = IconSize.SmallToolbar;
            toolbar.ToolbarStyle = ToolbarStyle.Icons;
            toolbar.ShowArrow    = false;
            ToolButton but = new ToolButton("gtk-zoom-in");

            but.Clicked += new EventHandler(OnZoomIn);
            toolbar.Insert(but, -1);

            but          = new ToolButton("gtk-zoom-out");
            but.Clicked += new EventHandler(OnZoomOut);
            toolbar.Insert(but, -1);

            but          = new ToolButton("gtk-go-back");
            but.Clicked += new EventHandler(OnChartBack);
            toolbar.Insert(but, -1);

            but          = new ToolButton("gtk-go-forward");
            but.Clicked += new EventHandler(OnChartForward);
            toolbar.Insert(but, -1);

            but          = new ToolButton("gtk-goto-last");
            but.Clicked += new EventHandler(OnChartLast);
            toolbar.Insert(but, -1);

            boxPaned1.PackStart(toolbar, false, false, 0);
            boxPaned1.PackStart(chart, true, true, 0);

            panedDetails.Pack1(boxPaned1, false, false);

            // Detailed test information --------

            infoBook = new ButtonNotebook();
            infoBook.PageLoadRequired += new EventHandler(OnPageLoadRequired);

            // Info - Group summary

            Frame          tf = new Frame();
            ScrolledWindow sw = new ScrolledWindow();

            detailsTree = new TreeView();

            detailsTree.HeadersVisible = true;
            detailsTree.RulesHint      = true;
            detailsStore = new ListStore(typeof(object), typeof(string), typeof(string), typeof(string), typeof(string));

            CellRendererText trtest = new CellRendererText();
            CellRendererText tr;

            TreeViewColumn col3 = new TreeViewColumn();

            col3.Expand = false;
//			col3.Alignment = 0.5f;
            col3.Widget = new Gtk.Image(CircleImage.Success);
            col3.Widget.Show();
            tr = new CellRendererText();
//			tr.Xalign = 0.5f;
            col3.PackStart(tr, false);
            col3.AddAttribute(tr, "markup", 2);
            detailsTree.AppendColumn(col3);

            TreeViewColumn col4 = new TreeViewColumn();

            col4.Expand = false;
//			col4.Alignment = 0.5f;
            col4.Widget = new Gtk.Image(CircleImage.Failure);
            col4.Widget.Show();
            tr = new CellRendererText();
//			tr.Xalign = 0.5f;
            col4.PackStart(tr, false);
            col4.AddAttribute(tr, "markup", 3);
            detailsTree.AppendColumn(col4);

            TreeViewColumn col5 = new TreeViewColumn();

            col5.Expand = false;
//			col5.Alignment = 0.5f;
            col5.Widget = new Gtk.Image(CircleImage.NotRun);
            col5.Widget.Show();
            tr = new CellRendererText();
//			tr.Xalign = 0.5f;
            col5.PackStart(tr, false);
            col5.AddAttribute(tr, "markup", 4);
            detailsTree.AppendColumn(col5);

            TreeViewColumn col1 = new TreeViewColumn();

//			col1.Resizable = true;
//			col1.Expand = true;
            col1.Title = "Test";
            col1.PackStart(trtest, true);
            col1.AddAttribute(trtest, "markup", 1);
            detailsTree.AppendColumn(col1);

            detailsTree.Model = detailsStore;

            sw.Add(detailsTree);
            tf.Add(sw);
            tf.ShowAll();

            TestSummaryPage = infoBook.AddPage(GettextCatalog.GetString("Summary"), tf);

            // Info - Regressions list

            tf = new Frame();
            sw = new ScrolledWindow();
            tf.Add(sw);
            regressionTree = new TreeView();
            regressionTree.HeadersVisible = false;
            regressionTree.RulesHint      = true;
            regressionStore = new ListStore(typeof(object), typeof(string), typeof(Pixbuf));

            CellRendererText trtest2 = new CellRendererText();
            var pr = new CellRendererPixbuf();

            TreeViewColumn col = new TreeViewColumn();

            col.PackStart(pr, false);
            col.AddAttribute(pr, "pixbuf", 2);
            col.PackStart(trtest2, false);
            col.AddAttribute(trtest2, "markup", 1);
            regressionTree.AppendColumn(col);
            regressionTree.Model = regressionStore;
            sw.Add(regressionTree);
            tf.ShowAll();

            TestRegressionsPage = infoBook.AddPage(GettextCatalog.GetString("Regressions"), tf);

            // Info - Failed tests list

            tf = new Frame();
            sw = new ScrolledWindow();
            tf.Add(sw);
            failedTree = new TreeView();
            failedTree.HeadersVisible = false;
            failedTree.RulesHint      = true;
            failedStore = new ListStore(typeof(object), typeof(string), typeof(Pixbuf));

            trtest2 = new CellRendererText();
            pr      = new CellRendererPixbuf();

            col = new TreeViewColumn();
            col.PackStart(pr, false);
            col.AddAttribute(pr, "pixbuf", 2);
            col.PackStart(trtest2, false);
            col.AddAttribute(trtest2, "markup", 1);
            failedTree.AppendColumn(col);
            failedTree.Model = failedStore;
            sw.Add(failedTree);
            tf.ShowAll();

            TestFailuresPage = infoBook.AddPage(GettextCatalog.GetString("Failed tests"), tf);

            // Info - results

            tf = new Frame();
            sw = new ScrolledWindow();
            tf.Add(sw);
            resultView          = new TextView();
            resultView.Editable = false;
            sw.Add(resultView);
            tf.ShowAll();
            TestResultPage = infoBook.AddPage(GettextCatalog.GetString("Result"), tf);

            // Info - Output

            tf = new Frame();
            sw = new ScrolledWindow();
            tf.Add(sw);
            outputView          = new TextView();
            outputView.Editable = false;
            sw.Add(outputView);
            tf.ShowAll();
            TestOutputPage = infoBook.AddPage(GettextCatalog.GetString("Output"), tf);

            panedDetails.Pack2(infoBook, true, true);
            detailsPad.PackStart(panedDetails, true, true, 0);
            paned.Pack2(detailsPad, true, true);

            paned.ShowAll();

            infoBook.HidePage(TestResultPage);
            infoBook.HidePage(TestOutputPage);
            infoBook.HidePage(TestSummaryPage);
            infoBook.HidePage(TestRegressionsPage);
            infoBook.HidePage(TestFailuresPage);

            detailsPad.Sensitive = false;
            detailsPad.Hide();

            detailsTree.RowActivated    += new Gtk.RowActivatedHandler(OnTestActivated);
            regressionTree.RowActivated += new Gtk.RowActivatedHandler(OnRegressionTestActivated);
            failedTree.RowActivated     += new Gtk.RowActivatedHandler(OnFailedTestActivated);

            foreach (UnitTest t in testService.RootTests)
            {
                TreeView.AddChild(t);
            }
        }
        public CustomStatusBar()
        {
            Frame originalFrame = (Frame)Children [0];

            originalFrame.HideAll();

            customFrame = new Frame {
                ShadowType = ShadowType.None
            };
            PackStart(customFrame, true, true, 0);

            HBox contents = new HBox();

            customFrame.Add(contents);

            lblInfo = new Label {
                Ellipsize = EllipsizeMode.End, Xalign = 0
            };
            contents.PackStart(lblInfo, true, true, 0);

            lblNotification = new Label {
                Ellipsize = EllipsizeMode.End, Xalign = 0
            };
            contents.PackStart(lblNotification, true, true, 0);

            customWidgets = AddinManager.GetExtensionNodes("/Warehouse/Presentation/StatusWidget")
                            .Cast <TypeExtensionNode> ()
                            .Select(node => (IStatusWidget)node.CreateInstance())
                            .OrderByDescending(w => w.Order)
                            .ToArray();

            foreach (IStatusWidget widget in customWidgets)
            {
                contents.PackEnd(widget.Widget, false, true, 2);
            }

            customFrame.ShowAll();
            lblNotification.Visible = false;

            if (PlatformHelper.Platform == PlatformTypes.MacOSX)
            {
                HasResizeGrip = true;

                SizeAllocated += delegate { QueueDraw(); };
            }
            else
            {
                if (GdkWindow != null && GdkWindow.State == WindowState.Maximized)
                {
                    HasResizeGrip = false;
                }

                SizeAllocated += delegate
                {
                    if (GdkWindow != null)
                    {
                        HasResizeGrip = GdkWindow.State != WindowState.Maximized;
                    }

                    QueueDraw();
                };
            }
        }
示例#8
0
        void ShowLoadSourceFile(StackFrame sf)
        {
            if (messageOverlayContent != null)
            {
                editor.RemoveOverlay(messageOverlayContent);
                messageOverlayContent = null;
            }
            messageOverlayContent = new HBox();

            var hbox = new HBox();

            hbox.Spacing = 8;
            var label = new Label(GettextCatalog.GetString("{0} not found. Find source file at alternative location.", Path.GetFileName(sf.SourceLocation.FileName)));

            hbox.TooltipText = sf.SourceLocation.FileName;

            var color = (HslColor)editor.Options.GetColorStyle().NotificationText.Foreground;

            label.ModifyFg(StateType.Normal, color);

            int w, h;

            label.Layout.GetPixelSize(out w, out h);

            hbox.PackStart(label, true, true, 0);
            var openButton = new Button(Gtk.Stock.Open);

            openButton.WidthRequest = 60;
            hbox.PackEnd(openButton, false, false, 0);

            const int containerPadding = 8;

            messageOverlayContent.PackStart(hbox, true, true, containerPadding);
            editor.AddOverlay(messageOverlayContent, () => openButton.SizeRequest().Width + w + hbox.Spacing * 5 + containerPadding * 2);

            openButton.Clicked += delegate {
                var dlg = new OpenFileDialog(GettextCatalog.GetString("File to Open"), MonoDevelop.Components.FileChooserAction.Open)
                {
                    TransientFor         = IdeApp.Workbench.RootWindow,
                    ShowEncodingSelector = true,
                    ShowViewerSelector   = true
                };
                if (!dlg.Run())
                {
                    return;
                }
                var newFilePath = dlg.SelectedFile;
                try {
                    if (File.Exists(newFilePath))
                    {
                        if (SourceCodeLookup.CheckFileMd5(newFilePath, sf.SourceLocation.FileHash))
                        {
                            SourceCodeLookup.AddLoadedFile(newFilePath, sf.SourceLocation.FileName);
                            sf.UpdateSourceFile(newFilePath);
                            if (IdeApp.Workbench.OpenDocument(newFilePath, null, sf.SourceLocation.Line, 1, OpenDocumentOptions.Debugger) != null)
                            {
                                this.WorkbenchWindow.CloseWindow(false);
                            }
                        }
                        else
                        {
                            MessageService.ShowWarning(GettextCatalog.GetString("File checksum doesn't match."));
                        }
                    }
                    else
                    {
                        MessageService.ShowWarning(GettextCatalog.GetString("File not found."));
                    }
                } catch (Exception) {
                    MessageService.ShowWarning(GettextCatalog.GetString("Error opening file."));
                }
            };
        }
示例#9
0
        public EqualizerWindow(Window parent) : base(Catalog.GetString("Equalizer"))
        {
            if (instance == null)
            {
                instance = this;
            }

            TransientFor    = parent;
            WindowPosition  = WindowPosition.CenterOnParent;
            TypeHint        = Gdk.WindowTypeHint.Dialog;
            SkipPagerHint   = true;
            SkipTaskbarHint = true;
            AppPaintable    = true;

            SetDefaultSize(-1, 180);

            VBox box = new VBox();

            header_box             = new HBox();
            header_box.BorderWidth = 4;
            header_box.Spacing     = 2;

            box.PackStart(header_box, false, false, 0);
            box.PackStart(new HSeparator(), false, false, 0);

            eq_view             = new EqualizerView();
            eq_view.BorderWidth = 10;
            eq_view.SetSizeRequest(-1, 110);
            eq_view.Frequencies = ((IEqualizer)ServiceManager.PlayerEngine.ActiveEngine).EqualizerFrequencies;
            eq_view.Show();

            eq_enabled_checkbox = new CheckButton(Catalog.GetString("Enabled"));

            eq_preset_combo          = new EqualizerPresetComboBox();
            eq_preset_combo.Changed += OnPresetChanged;
            eq_preset_combo.Show();

            Button new_preset_button = new Button(new Image(Stock.Add, IconSize.Button));

            new_preset_button.Relief   = ReliefStyle.None;
            new_preset_button.Clicked += OnNewPreset;

            Button delete_preset_button = new Button(new Image(Stock.Remove, IconSize.Button));

            delete_preset_button.Relief   = ReliefStyle.None;
            delete_preset_button.Clicked += OnDeletePreset;

            VBox combo_box = new VBox();

            combo_box.PackStart(eq_preset_combo, true, false, 0);

            header_box.PackStart(combo_box, false, false, 0);
            header_box.PackStart(new_preset_button, false, false, 0);
            header_box.PackStart(delete_preset_button, false, false, 0);
            header_box.PackEnd(eq_enabled_checkbox, false, false, 0);

            box.PackStart(eq_view, true, true, 0);

            eq_enabled_checkbox.Active = EqualizerSetting.EnabledSchema.Get();
            eq_preset_combo.ActivatePreferredEqualizer(EqualizerSetting.PresetSchema.Get());

            if (eq_enabled_checkbox.Active)
            {
                // enable equalizer if was enabled last session
                EqualizerManager.Instance.Enable(eq_preset_combo.ActiveEqualizer);
            }

            if (eq_preset_combo.ActiveEqualizer == null)
            {
                // user has no presets, so create one
                OnNewPreset(null, null);

                // enable our new preset (it has no effect though, since all bands are 0db)
                eq_enabled_checkbox.Active = true;
                OnEnableDisable(null, null);
            }

            eq_enabled_checkbox.Clicked += OnEnableDisable;

            Gdk.Geometry limits = new Gdk.Geometry();
            limits.MinWidth  = -1;
            limits.MaxWidth  = -1;
            limits.MinHeight = SizeRequest().Height;
            limits.MaxHeight = Gdk.Screen.Default.Height;
            SetGeometryHints(this, limits, Gdk.WindowHints.MaxSize);

            KeyPressEvent += OnKeyPress;

            Add(box);
            box.ShowAll();
        }
示例#10
0
        public WebViewSample()
        {
            var toolbar = new HBox();
            var back    = new Button("<");
            var forward = new Button(">");
            var lbl     = new Label("Address:");
            var go      = new Button("Go!");
            var stop    = new Button("Stop!");

            stop.Sensitive    = false;
            back.Sensitive    = false;
            forward.Sensitive = false;
            var uri = new TextEntry();

            uri.Text = wb.Url;
            toolbar.PackStart(back);
            toolbar.PackStart(forward);
            toolbar.PackStart(lbl);
            toolbar.PackStart(uri, true);
            toolbar.PackEnd(go);
            toolbar.PackEnd(stop);
            PackStart(toolbar);

            var title = new Label("Title: ");

            PackStart(title);

            PackStart(wb, true);

            pg.Fraction = 0.0;
            var timer = new Timer(100);

            timer.Elapsed += UpdateProgress;
            PackStart(pg);

            var loadhtml = new Button("Load sample Html");

            PackStart(loadhtml);

            wb.TitleChanged += (object sender, EventArgs e) => title.Text = "Title: " + wb.Title;

            wb.Loading += delegate(object sender, EventArgs e) {
                uri.Text       = wb.Url;
                pg.Fraction    = 0.0;
                stop.Sensitive = true;
                timer.Start();
                back.Sensitive    = wb.CanGoBack;
                forward.Sensitive = wb.CanGoForward;
            };
            wb.Loaded += delegate(object sender, EventArgs e) {
                uri.Text       = wb.Url;
                stop.Sensitive = false;
                timer.Stop();
                pg.Fraction       = 1.0;
                back.Sensitive    = wb.CanGoBack;
                forward.Sensitive = wb.CanGoForward;
            };
            wb.NavigateToUrl += delegate(object sender, NavigateToUrlEventArgs e) {
                if (e.Uri.OriginalString.Contains("facebook.com"))
                {
                    e.SetHandled();
                    MessageDialog.ShowMessage("Loading *.facebook.com overriden");
                }
                else
                {
                }
            };

            uri.Activated    += (sender, e) => wb.Url = uri.Text;
            go.Clicked       += (sender, e) => wb.Url = uri.Text;
            stop.Clicked     += (sender, e) => wb.StopLoading();
            back.Clicked     += (sender, e) => wb.GoBack();
            forward.Clicked  += (sender, e) => wb.GoForward();
            loadhtml.Clicked += LoadHtmlString;

            wb.Url = "http://www.xamarin.com";
        }
示例#11
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);
        }
示例#12
0
        public void SetLabel(Gtk.Widget page, Xwt.Drawing.Image icon, string label)
        {
            string labelNoSpaces = label != null?label.Replace(' ', '-') : null;

            this.label = label;
            this.page  = page;
            if (Child != null)
            {
                Gtk.Widget oc = Child;
                Remove(oc);
                oc.Destroy();
            }

            if (label != null)
            {
                Accessible.Name        = $"DockTab.{labelNoSpaces}";
                Accessible.Description = GettextCatalog.GetString("Switch to the {0} tab", label);
                Accessible.SetTitle(label);
                Accessible.SetLabel(label);
            }

            Gtk.HBox box = new HBox();
            box.Accessible.SetShouldIgnore(true);
            box.Spacing = -2;

            if (icon == null)
            {
                icon = ImageService.GetIcon("md-empty");
            }

            tabIcon = new ImageView(icon);
            tabIcon.Accessible.SetShouldIgnore(true);
            tabIcon.Show();
            box.PackStart(tabIcon, false, false, 3);

            if (!string.IsNullOrEmpty(label))
            {
                labelWidget = new ExtendedLabel(label);
                // Ignore the label because the title tab already contains its name
                labelWidget.Accessible.SetShouldIgnore(true);
                labelWidget.UseMarkup = true;
                labelWidget.Name      = label;
                var alignLabel = new Alignment(0.0f, 0.5f, 1, 1);
                alignLabel.Accessible.SetShouldIgnore(true);
                alignLabel.BottomPadding = 0;
                alignLabel.RightPadding  = 15;
                alignLabel.Add(labelWidget);
                box.PackStart(alignLabel, false, false, 0);
            }
            else
            {
                labelWidget = null;
            }

            btnDock             = new ImageButton();
            btnDock.Image       = pixAutoHide;
            btnDock.TooltipText = GettextCatalog.GetString("Auto Hide");
            btnDock.CanFocus    = false;
//			btnDock.WidthRequest = btnDock.HeightRequest = 17;
            btnDock.Clicked          += OnClickDock;
            btnDock.ButtonPressEvent += (o, args) => args.RetVal = true;
            btnDock.WidthRequest      = btnDock.SizeRequest().Width;
            btnDock.Name              = string.Format("btnDock_{0}", labelNoSpaces ?? string.Empty);
            UpdateDockButtonAccessibilityLabels();

            btnClose             = new ImageButton();
            btnClose.Image       = pixClose;
            btnClose.TooltipText = GettextCatalog.GetString("Close");
            btnClose.CanFocus    = false;
//			btnClose.WidthRequest = btnClose.HeightRequest = 17;
            btnClose.WidthRequest = btnDock.SizeRequest().Width;
            btnClose.Clicked     += delegate {
                item.Visible = false;
            };
            btnClose.ButtonPressEvent += (o, args) => args.RetVal = true;
            btnClose.Name              = string.Format("btnClose_{0}", labelNoSpaces ?? string.Empty);
            string realLabel, realHelp;

            if (string.IsNullOrEmpty(label))
            {
                realLabel = GettextCatalog.GetString("Close pad");
                realHelp  = GettextCatalog.GetString("Close the pad");
            }
            else
            {
                realLabel = GettextCatalog.GetString("Close {0}", label);
                realHelp  = GettextCatalog.GetString("Close the {0} pad", label);
            }
            btnClose.Accessible.SetLabel(realLabel);
            btnClose.Accessible.Description = realHelp;

            Gtk.Alignment al = new Alignment(0, 0.5f, 1, 1);
            al.Accessible.SetShouldIgnore(true);
            HBox btnBox = new HBox(false, 0);

            btnBox.Accessible.SetShouldIgnore(true);
            btnBox.PackStart(btnDock, false, false, 3);
            btnBox.PackStart(btnClose, false, false, 1);
            al.Add(btnBox);
            box.PackEnd(al, false, false, 3);

            Add(box);

            // Get the required size before setting the ellipsize property, since ellipsized labels
            // have a width request of 0
            box.ShowAll();
            Show();

            minWidth = tabIcon.SizeRequest().Width + al.SizeRequest().Width + 10;

            UpdateBehavior();
            UpdateVisualStyle();
        }
示例#13
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="ifolder">iFolder Web Object</param>
        public iFolderCreationDialog(iFolderWeb ifolder) : base()
        {
//			this.ifolder = ifolder;
            this.Title        = "";
            this.HasSeparator = false;
//			this.BorderWidth = 10;
            this.Resizable = false;

            this.Icon = new Gdk.Pixbuf(Util.ImagesPath("ifolder16.png"));
            Gdk.Pixbuf bigiFolder =
                new Gdk.Pixbuf(Util.ImagesPath("ifolder48.png"));
            Image folderImage = new Image(bigiFolder);

            VBox vbox = new VBox();

            vbox.BorderWidth = 10;
            vbox.Spacing     = 10;

            HBox h = new HBox();

//			h.BorderWidth = 10;
            h.Spacing = 12;

            folderImage.SetAlignment(0.5F, 0);
            h.PackStart(folderImage, false, false, 0);

            VBox vbox2 = new VBox();

            vbox2.Spacing = 10;

            Label l = new Label("<span weight=\"bold\" size=\"larger\">" +
                                Util.GS("iFolder Created") +
                                "</span>");

            l.LineWrap   = false;
            l.UseMarkup  = true;
            l.Selectable = false;
            l.Xalign     = 0;
            l.Yalign     = 0;
            vbox2.PackStart(l, false, false, 0);

            l          = new Label(Util.GS("The folder you selected is now an iFolder.  To learn more about using iFolder and sharing iFolders with other users, see \"Managing iFolders\" in iFolder Help."));
            l.LineWrap = true;
            l.Xalign   = 0;
            vbox2.PackStart(l, true, true, 0);

            h.PackEnd(vbox2, true, true, 0);

            vbox.PackStart(h);

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

            vbox.PackStart(cbAlignment, true, true, 0);

            cbutton =
                new CheckButton(Util.GS("Do not show this message again."));
            cbAlignment.Add(cbutton);

            vbox.ShowAll();
            this.VBox.Add(vbox);

            this.AddButton(Stock.Close, ResponseType.Ok);
            this.AddButton(Stock.Help, ResponseType.Help);
        }
示例#14
0
        public NewAzureJobView(ViewBase owner) : base(owner)
        {
            SubmitJob = new BackgroundWorker();
            // this vbox holds both alignment objects (which in turn hold the frames)
            VBox vboxPrimary = new VBox(false, 10);

            // this is the alignment object which holds the azure job frame
            Alignment primaryContainer = new Alignment(0f, 0f, 0f, 0f);

            primaryContainer.LeftPadding = primaryContainer.RightPadding = primaryContainer.TopPadding = primaryContainer.BottomPadding = 5;

            // Azure Job Frame
            Frame frmAzure = new Frame("Azure Job");

            Alignment alignTblAzure = new Alignment(0.5f, 0.5f, 1f, 1f);

            alignTblAzure.LeftPadding = alignTblAzure.RightPadding = alignTblAzure.TopPadding = alignTblAzure.BottomPadding = 5;

            // Azure table - contains all fields in the azure job frame
            Table tblAzure = new Table(4, 2, false);

            tblAzure.RowSpacing = 5;
            // Job Name
            Label lblName = new Label("Job Description/Name:");

            lblName.Xalign = 0;
            lblName.Yalign = 0.5f;

            entryName = new Entry();

            tblAzure.Attach(lblName, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            tblAzure.Attach(entryName, 1, 2, 0, 1, (AttachOptions.Fill | AttachOptions.Expand), AttachOptions.Fill, 20, 0);

            // Number of cores
            Label lblCores = new Label("Number of CPU cores to use:");

            lblCores.Xalign = 0;
            lblCores.Yalign = 0.5f;

            // use the same core count options as in MARS (16, 32, 48, 64, ... , 128, 256)
            comboCoreCount = ComboBox.NewText();
            for (int i = 16; i <= 128; i += 16)
            {
                comboCoreCount.AppendText(i.ToString());
            }
            comboCoreCount.AppendText("256");

            comboCoreCount.Active = 0;

            // combo boxes cannot be aligned, so it is placed in an alignment object, which can be aligned
            Alignment comboAlign = new Alignment(0f, 0.5f, 0.25f, 1f);

            comboAlign.Add(comboCoreCount);

            tblAzure.Attach(lblCores, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            tblAzure.Attach(comboAlign, 1, 2, 1, 2, (AttachOptions.Fill | AttachOptions.Expand), AttachOptions.Fill, 20, 0);



            // User doesn't get to choose a model via the form anymore. It comes from the context of the right click

            // Model selection frame
            Frame frmModelSelect = new Frame("Model Selection");

            // Alignment to ensure a 5px border around the inside of the frame
            Alignment alignModel = new Alignment(0f, 0f, 1f, 1f);

            alignModel.LeftPadding = alignModel.RightPadding = alignModel.TopPadding = alignModel.BottomPadding = 5;
            Table tblModel = new Table(2, 3, false);

            tblModel.ColumnSpacing = 5;
            tblModel.RowSpacing    = 10;

            chkSaveModels          = new CheckButton("Save model files");
            chkSaveModels.Toggled += ChkSaveModels_Toggled;
            entryModelPath         = new Entry();
            btnModelPath           = new Button("...");
            btnModelPath.Clicked  += BtnModelPath_Click;

            chkSaveModels.Active = true;
            chkSaveModels.Active = false;


            HBox hboxModelpath = new HBox();

            hboxModelpath.PackStart(entryModelPath, true, true, 0);
            hboxModelpath.PackStart(btnModelPath, false, false, 5);

            tblAzure.Attach(chkSaveModels, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            tblAzure.Attach(hboxModelpath, 1, 2, 2, 3, (AttachOptions.Fill | AttachOptions.Expand), AttachOptions.Fill, 0, 0);

            //Apsim Version Selection frame/table
            Frame frmVersion = new Frame("APSIM Next Generation Version Selection");
            Table tblVersion = new Table(2, 3, false);

            tblVersion.ColumnSpacing = 5;
            tblVersion.RowSpacing    = 10;

            // Alignment to ensure a 5px border on the inside of the frame
            Alignment alignVersion = new Alignment(0f, 0f, 1f, 1f);

            alignVersion.LeftPadding = alignVersion.RightPadding = alignVersion.TopPadding = alignVersion.BottomPadding = 5;

            /*
             * // use from online source
             * // TODO: find/implement a Bob equivalent
             * HBox hbxBob = new HBox();
             * radioBob = new RadioButton("Use APSIM Next Generation from an online source (Bob?)");
             * radioBob.Toggled += new EventHandler(radioBob_Changed);
             * Label lblVersion = new Label("Version:");
             * entryVersion = new Entry();
             * Label lblRevision = new Label("Revision:");
             * entryRevision = new Entry();
             *
             * hbxBob.Add(radioBob);
             * hbxBob.Add(lblVersion);
             * hbxBob.Add(entryVersion);
             * hbxBob.Add(lblRevision);
             * hbxBob.Add(entryRevision);
             *
             * btnBob = new Button("...");
             * btnBob.Clicked += new EventHandler(btnBob_Click);
             *
             * tblVersion.Attach(hbxBob, 0, 2, 0, 1, (AttachOptions.Fill | AttachOptions.Expand), AttachOptions.Fill, 0, 0);
             * tblVersion.Attach(btnBob, 2, 3, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
             */
            // use Apsim from a directory

            radioApsimDir          = new RadioButton("Use APSIM Next Generation from a directory");
            radioApsimDir.Toggled += new EventHandler(RadioApsimDir_Changed);
            // populate this input field with the directory containing this executable
            entryApsimDir        = new Entry(Directory.GetParent(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)).ToString());
            btnApsimDir          = new Button("...");
            btnApsimDir.Clicked += new EventHandler(BtnApsimDir_Click);
            tblVersion.Attach(radioApsimDir, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            tblVersion.Attach(entryApsimDir, 1, 2, 0, 1, (AttachOptions.Fill | AttachOptions.Expand), AttachOptions.Fill, 0, 0);
            tblVersion.Attach(btnApsimDir, 2, 3, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            // use a zipped version of Apsim

            radioApsimZip          = new RadioButton(radioApsimDir, "Use a zipped version of APSIM Next Generation");
            radioApsimZip.Toggled += new EventHandler(RadioApsimZip_Changed);
            entryApsimZip          = new Entry();
            btnApsimZip            = new Button("...");
            btnApsimZip.Clicked   += new EventHandler(BtnApsimZip_Click);

            tblVersion.Attach(radioApsimZip, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            tblVersion.Attach(entryApsimZip, 1, 2, 1, 2, (AttachOptions.Fill | AttachOptions.Expand), AttachOptions.Fill, 0, 0);
            tblVersion.Attach(btnApsimZip, 2, 3, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);



            alignVersion.Add(tblVersion);
            frmVersion.Add(alignVersion);

            tblAzure.Attach(frmVersion, 0, 2, 3, 4, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            // toggle the default radio button to ensure appropriate entries/buttons are greyed out by default
            radioApsimDir.Active = true;
            radioApsimZip.Active = true;
            radioApsimDir.Active = true;

            // add azure job table to azure alignment, and add that to the azure job frame
            alignTblAzure.Add(tblAzure);
            frmAzure.Add(alignTblAzure);

            // Results frame
            Frame frameResults = new Frame("Results");
            // Alignment object to ensure a 10px border around the inside of the results frame
            Alignment alignFrameResults = new Alignment(0f, 0f, 1f, 1f);

            alignFrameResults.LeftPadding = alignFrameResults.RightPadding = alignFrameResults.TopPadding = alignFrameResults.BottomPadding = 10;
            Table tblResults = new Table(4, 3, false);

            tblResults.ColumnSpacing = 5;
            tblResults.RowSpacing    = 5;

            // Auto send email
            chkEmail   = new CheckButton("Send email  upon completion to:");
            entryEmail = new Entry();



            tblResults.Attach(chkEmail, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            tblResults.Attach(entryEmail, 1, 2, 0, 1, (AttachOptions.Expand | AttachOptions.Fill), AttachOptions.Fill, 0, 0);


            // Auto download results
            chkDownload  = new CheckButton("Automatically download results once complete");
            chkSummarise = new CheckButton("Summarise Results");

            tblResults.Attach(chkDownload, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            tblResults.Attach(chkSummarise, 1, 3, 1, 2, (AttachOptions.Fill | AttachOptions.Expand), AttachOptions.Fill, 0, 0);

            // Output dir

            Label lblOutputDir = new Label("Output Directory:");

            lblOutputDir.Xalign = 0;
            entryOutputDir      = new Entry((string)AzureSettings.Default["OutputDir"]);

            Button btnOutputDir = new Button("...");

            btnOutputDir.Clicked += new EventHandler(BtnOutputDir_Click);

            tblResults.Attach(lblOutputDir, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            tblResults.Attach(entryOutputDir, 1, 2, 2, 3, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            tblResults.Attach(btnOutputDir, 2, 3, 2, 3, AttachOptions.Fill, AttachOptions.Fill, 0, 0);


            Alignment alignNameTip = new Alignment(0f, 0f, 1f, 1f);
            Label     lblNameTip   = new Label("(note: if you close Apsim before the job completes, the results will not be automatically downloaded)");

            alignNameTip.Add(lblNameTip);

            tblResults.Attach(alignNameTip, 0, 3, 3, 4, AttachOptions.Fill, AttachOptions.Fill, 0, 0);



            alignFrameResults.Add(tblResults);
            frameResults.Add(alignFrameResults);



            // OK/Cancel buttons

            BtnOK          = new Button("OK");
            BtnOK.Clicked += new EventHandler(BtnOK_Click);
            Button btnCancel = new Button("Cancel");

            btnCancel.Clicked += new EventHandler(BtnCancel_Click);
            HBox hbxButtons = new HBox(true, 0);

            hbxButtons.PackEnd(btnCancel, false, true, 0);
            hbxButtons.PackEnd(BtnOK, false, true, 0);
            Alignment alignButtons = new Alignment(1f, 0f, 0.2f, 0f);

            alignButtons.Add(hbxButtons);
            lblStatus        = new Label("");
            lblStatus.Xalign = 0f;

            // Add Azure frame to primary vbox
            vboxPrimary.PackStart(frmAzure, false, true, 0);
            // add results frame to primary vbox
            vboxPrimary.PackStart(frameResults, false, true, 0);
            vboxPrimary.PackStart(alignButtons, false, true, 0);
            vboxPrimary.PackStart(lblStatus, false, true, 0);
            // Add primary vbox to alignment
            primaryContainer.Add(vboxPrimary);
            mainWidget = primaryContainer;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="service">
        /// The <see cref="StreamrecorderService"/> that is being configured
        /// </param>
        /// <param name="previous_output_folder">
        /// A <see cref="System.String"/> containing the previously configured output directory
        /// </param>
        /// <param name="previous_encoder">
        /// A <see cref="System.String"/> containing the previously configured encoder
        /// </param>
        /// <param name="is_importing_enabled">
        /// A <see cref="System.Boolean"/> indicating whether file scanning was previously enabled
        /// </param>
        /// <param name="is_splitting_enabled">
        /// A <see cref="System.Boolean"/> indicating whether file splitting was previously enabled
        /// </param>
        public StreamrecorderConfigDialog(StreamrecorderService service, string previous_output_folder, string previous_encoder, bool is_importing_enabled, bool is_splitting_enabled)
        {
            streamrecorder_service = service;
            encoderbox.IdColumn    = 0;

            preferences_image.Yalign   = 0f;
            preferences_image.IconName = "gtk-preferences";
            preferences_image.IconSize = (int)IconSize.Dialog;
            preferences_image.Show();
            header_label.Text                 = String.Format(AddinManager.CurrentLocalizer.GetString("{0}Streamrecorder configuration\n{1}"), "<span weight=\"bold\" size=\"larger\">", "</span>");
            header_label.UseMarkup            = true;
            header_label.Wrap                 = true;
            header_label.Yalign               = 0f;
            header_label.Xalign               = 0f;
            description_label.Text            = AddinManager.CurrentLocalizer.GetString("Please select output folder for ripped files and if ripped\n" + "files should be imported to media library.\n");
            description_label.Yalign          = 0f;
            description_label.Xalign          = 0f;
            choose_folder_label.Text          = AddinManager.CurrentLocalizer.GetString("Output folder:");
            choose_encoder_label.Text         = AddinManager.CurrentLocalizer.GetString("Encoder:");
            output_folder.Text                = previous_output_folder;
            choose_output_folder_button.Label = AddinManager.CurrentLocalizer.GetString("_Browse");
            choose_output_folder_button.Image = new Image("gtk-directory", IconSize.Button);
            choose_output_folder_button.ShowAll();
            cancel_button.Label = AddinManager.CurrentLocalizer.GetString("_Cancel");
            cancel_button.Image = new Image("gtk-cancel", IconSize.Button);
            save_button.Label   = AddinManager.CurrentLocalizer.GetString("_Save");
            save_button.Image   = new Image("gtk-save", IconSize.Button);
            enable_import_ripped_songs.Label  = AddinManager.CurrentLocalizer.GetString("Import files to media library");
            enable_import_ripped_songs.Active = StreamrecorderService.IsImportingEnabledEntry.Get().Equals("True") ? true : false;
            enable_automatic_splitting.Label  = AddinManager.CurrentLocalizer.GetString("Enable automatic files splitting by Metadata");
            enable_automatic_splitting.Active = StreamrecorderService.IsFileSplittingEnabledEntry.Get().Equals("True") ? true : false;

            encoderbox.Clear();
            CellRendererText cell = new CellRendererText();

            encoderbox.PackStart(cell, false);
            encoderbox.AddAttribute(cell, "text", 0);
            ListStore store = new ListStore(typeof(string));

            encoderbox.Model = store;

            int row        = -1;
            int chosen_row = -1;

            foreach (string encoder in streamrecorder_service.GetEncoders())
            {
                row++;
                store.AppendValues(encoder);
                if (encoder.Equals(previous_encoder))
                {
                    chosen_row = row;
                    Hyena.Log.DebugFormat("[StreamrecorderConfigDialog] found active encoder in row {1}: {0}", encoder, chosen_row);
                }
            }

            if (chosen_row > -1)
            {
                Gtk.TreeIter iter;
                encoderbox.Model.IterNthChild(out iter, chosen_row);
                encoderbox.SetActiveIter(iter);
            }
            else
            {
                Gtk.TreeIter iter;
                encoderbox.Model.GetIterFirst(out iter);
                encoderbox.SetActiveIter(iter);
            }

            HBox main_container   = new HBox();
            VBox action_container = new VBox();

            main_container.Spacing     = 12;
            main_container.BorderWidth = 6;

            action_container.PackStart(header_label, true, true, 0);
            action_container.PackStart(description_label, true, true, 0);
            VBox choosing_labels = new VBox();

            choosing_labels.PackStart(choose_folder_label, true, true, 5);
            choosing_labels.PackStart(choose_encoder_label, true, true, 5);
            HBox folder_choosing = new HBox();

            folder_choosing.PackStart(output_folder, true, true, 5);
            folder_choosing.PackStart(choose_output_folder_button, true, true, 0);
            VBox box_choosing = new VBox();

            box_choosing.PackStart(folder_choosing, true, true, 0);
            box_choosing.PackStart(encoderbox, true, true, 5);
            HBox all_choosing = new HBox();

            all_choosing.PackStart(choosing_labels, true, true, 0);
            all_choosing.PackStart(box_choosing, true, true, 0);

            action_container.PackStart(all_choosing, true, true, 5);
            action_container.PackStart(enable_automatic_splitting, true, true, 5);
            action_container.PackStart(enable_import_ripped_songs, true, true, 5);

            main_container.PackStart(preferences_image, true, true, 5);
            main_container.PackEnd(action_container, true, true, 5);
            this.ContentArea.PackStart(main_container, true, true, 5);

            AddActionWidget(cancel_button, 0);
            AddActionWidget(save_button, 0);

            choose_output_folder_button.Clicked += new EventHandler(OnChooseOutputFolderButtonClicked);
            cancel_button.Clicked += new EventHandler(OnCancelButtonClicked);
            save_button.Clicked   += new EventHandler(OnSaveButtonClicked);

            Title       = "Streamrecorder configuration";
            IconName    = "gtk-preferences";
            Resizable   = false;
            BorderWidth = 6;
//            HasSeparator = false;
            this.ContentArea.Spacing = 12;

            ShowAll();
        }
示例#16
0
        public WindowBuilder()
        {
            _columnFilter = 0;
            _textToFilter = "";

            _processIdToKill = new List <int>();
            _listStore       = new ListStore(typeof(string), typeof(string), typeof(string), typeof(string),
                                             typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));

            Application.Init();

            _window = new Window("Label sample");
            _window.Resize(1300, 600);
            _window.Title = "Process Watch";
            _window.SetIconFromFile("icons/processIconSmall.png");
            _window.BorderWidth  = 5;
            _window.DeleteEvent += OnWindowClose;

            var aboutButton = new Button();
            var aboutIcon   = new Image();

            aboutIcon.Pixbuf        = new Pixbuf("icons/information.png");
            aboutButton.Image       = aboutIcon;
            aboutButton.TooltipText = "About Process Watch";
            aboutButton.Clicked    += (sender, args) =>
            {
                _aboutDialog.Show();
            };

            _aboutDialog = CreateAboutDialog();

            var filterButton = new Button();

            filterButton.Image       = new Image(Stock.Find, IconSize.Button);
            filterButton.TooltipText = "Filtration utilities";
            filterButton.Clicked    += (sender, args) =>
            {
                if (_filtrationHBox.IsVisible)
                {
                    _filtrationHBox.Hide();
                }
                else
                {
                    _filtrationHBox.ShowAll();
                }
            };

            var windowHBox = new HBox(false, 5);

            windowHBox.PackEnd(aboutButton, false, false, 0);
            windowHBox.PackEnd(filterButton, false, false, 0);

            _processNameEntry          = new Entry();
            _processNameEntry.Changed += OnChanged;

            _processIdEntry               = new Entry();
            _processIdEntry.Changed      += OnChanged;
            _processIdEntry.TextInserted += OnlyNumerical;

            // String values for the combobox - filtration direction
            _filtrationDirectionOptions = new[]
            {
                ">",
                "≥",
                "=",
                "≤",
                "<"
            };

            // String values for the combobox - memory usage units
            _memoryFiltrationDirectionUnits = new[]
            {
                "B",
                "KB",
                "MB",
                "GB"
            };


            _memoryFiltrationEntry = new Entry();
            _memoryFiltrationEntry.MaxWidthChars = 7;
            _memoryFiltrationEntry.WidthChars    = 7;
            _memoryFiltrationEntry.Changed      += OnChanged;
            _memoryFiltrationEntry.TextInserted += OnlyNumerical;

            _memoryFiltrationDirectionComboBox          = new ComboBox(_filtrationDirectionOptions);
            _memoryFiltrationDirectionComboBox.Changed += OnChanged;

            _memoryFiltrationUnitsComboBox          = new ComboBox(_memoryFiltrationDirectionUnits);
            _memoryFiltrationUnitsComboBox.Changed += OnChanged;

            _memoryFiltrationHbox = new HBox();
            _memoryFiltrationHbox.PackStart(_memoryFiltrationDirectionComboBox, false, false, 0);
            _memoryFiltrationHbox.PackStart(_memoryFiltrationEntry, false, false, 0);
            _memoryFiltrationHbox.PackStart(_memoryFiltrationUnitsComboBox, false, false, 0);


            _cpuFiltrationEntry = new Entry();
            _cpuFiltrationEntry.MaxWidthChars = 7;
            _cpuFiltrationEntry.WidthChars    = 7;
            _cpuFiltrationEntry.Changed      += OnChanged;
            _cpuFiltrationEntry.TextInserted += OnlyNumerical;

            _cpuFiltrationDirectionComboBox          = new ComboBox(_filtrationDirectionOptions);
            _cpuFiltrationDirectionComboBox.Changed += OnChanged;

            var cpuFiltrationLabel = new Label("%");

            _cpuFiltrationHbox = new HBox();
            _cpuFiltrationHbox.PackStart(_cpuFiltrationDirectionComboBox, false, false, 0);
            _cpuFiltrationHbox.PackStart(_cpuFiltrationEntry, false, false, 0);
            _cpuFiltrationHbox.PackStart(cpuFiltrationLabel, false, false, 0);


            _filtrationOptions = new[]
            {
                "All processes",
                "Filter by PID",
                "Filter by Process Name",
                "Filter by Memory Usage",
                "Filter by CPU usage",
            };

            var filtrationCombo = new ComboBox(_filtrationOptions);

            filtrationCombo.Changed += ComboOnChanged;

            _filtrationHBox = new HBox(false, 5);
            _filtrationHBox.PackStart(filtrationCombo, false, false, 0);


            string[] columnLabels =
            {
                "PID",
                "Process name",
                "Memory usage",
                "Priority",
                "User CPU Time",
                "Privileged CPU Time",
                "Total CPU Time",
                "CPU usage",
                "Threads",
                "Start Time"
            };


            _treeModelFilter             = new TreeModelFilter(_listStore, null);
            _treeModelFilter.VisibleFunc = Filter;

            var treeModelSort = new TreeModelSort(_treeModelFilter);

            treeModelSort.SetSortFunc(0, WindowBuilderHelper.IdSortFunc);
            treeModelSort.SetSortFunc(1, WindowBuilderHelper.ProcessNameSortFunc);
            treeModelSort.SetSortFunc(2, WindowBuilderHelper.MemoryUsageSortFunc);
            treeModelSort.SetSortFunc(3, WindowBuilderHelper.PrioritySortFunc);
            treeModelSort.SetSortFunc(4, WindowBuilderHelper.UserCpuTimeSortFunc);
            treeModelSort.SetSortFunc(5, WindowBuilderHelper.PrivilegedCpuTimeSortFunc);
            treeModelSort.SetSortFunc(6, WindowBuilderHelper.TotalCpuTimeSortFunc);
            treeModelSort.SetSortFunc(7, WindowBuilderHelper.CpuUsageSortFunc);
            treeModelSort.SetSortFunc(8, WindowBuilderHelper.ThreadCountSortFunc);
            treeModelSort.SetSortFunc(9, WindowBuilderHelper.StartTimeSortFunc);

            var treeView = new TreeView();

            treeView.Model              = treeModelSort;
            treeView.Selection.Mode     = SelectionMode.Multiple;
            treeView.Selection.Changed += OnSelectionChanged;
            treeView.TooltipColumn      = 1;

            // Create a scrollable window
            var scrolledWindow = new ScrolledWindow();

            scrolledWindow.Add(treeView);

            // Create a CellRendererText responsible for proper rendering cell data
            var cellRendererText = new CellRendererText();

            cellRendererText.Alignment = Pango.Alignment.Right;
            cellRendererText.Xalign    = 0.5f;

            // Load the _treeView with TreeViewColumns
            for (int i = 0; i < 10; i++)
            {
                var treeViewColumn = new TreeViewColumn();
                treeViewColumn.Clickable     = true;
                treeViewColumn.Resizable     = true;
                treeViewColumn.Title         = columnLabels[i];
                treeViewColumn.SortIndicator = true;
                treeViewColumn.Alignment     = 0.5f;
                treeViewColumn.Expand        = true;
                treeViewColumn.SortColumnId  = i;
                treeViewColumn.PackStart(cellRendererText, true);
                treeViewColumn.AddAttribute(cellRendererText, "text", i);

                switch (i)
                {
                case 0:
                    break;

                case 1:
                    _window.GetSize(out int width, out int height);
                    treeViewColumn.MaxWidth = Math.Abs(width / 2);
                    break;

                case 2:
                    treeViewColumn.SetCellDataFunc(cellRendererText, WindowBuilderHelper.MemoryUsageFormatter);
                    break;

                case 3:
                    break;

                case 4:
                    treeViewColumn.SetCellDataFunc(cellRendererText, WindowBuilderHelper.UserCpuTimeFormatter);
                    break;

                case 5:
                    treeViewColumn.SetCellDataFunc(cellRendererText, WindowBuilderHelper.PrivilegedCpuTimeFormatter);
                    break;

                case 6:
                    treeViewColumn.SetCellDataFunc(cellRendererText, WindowBuilderHelper.TotalCpuTimeFormatter);
                    break;

                case 7:
                    treeViewColumn.SetCellDataFunc(cellRendererText, WindowBuilderHelper.CpuUsageFormatter);
                    break;

                case 8:
                    break;

                case 9:
                    treeViewColumn.SetCellDataFunc(cellRendererText, WindowBuilderHelper.StartTimeFormatter);
                    break;
                }

                treeView.AppendColumn(treeViewColumn);
            }

            var killButton = new Button("Kill process");

            killButton.Clicked += KillProcess;

            var windowVBox = new VBox(false, 5);

            windowVBox.PackStart(windowHBox, false, false, 0);
            windowVBox.PackStart(_filtrationHBox, false, false, 0);
            windowVBox.PackStart(scrolledWindow, true, true, 0);
            windowVBox.PackStart(killButton, false, false, 0);

            _window.Add(windowVBox);

            // Create an instance of the object Updater
            _processGrabber = new ProcessGrabber();
            // Add a callback executed when _processGrabber takes process data.
            // The callback clears the _treeView content and loads new data
            // Before clearing the _treeView content the callback saves the current scroll position
            _processGrabber.OnResult += (sender, processList) =>
            {
                Application.Invoke(delegate
                {
                    _currentScrollPosition = treeView.Vadjustment.Value;
                    StoreClear();
                    LoadStore(processList);

                    treeView.ShowAll();
                });
            };

            // Add a callback executed after 'Changed' event raised after changing the position of the _treeView
            // When the _treeView content is reloaded the previous scroll position is updated
            treeView.Vadjustment.Changed += (sender, args) =>
            {
                treeView.Vadjustment.Value = _currentScrollPosition;
            };

            // Start the Timer process responsible for grabbing process data periodically
            _processGrabber.Run();

            treeView.ShowAll();
            _window.ShowAll();

            // Hide widgets related to process filtration
            _filtrationHBox.Hide();
        }
示例#17
0
        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(exceptionTypeTip);
                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);
        }
示例#18
0
        public DemoStockBrowser() : base("Stock Icons and Items")
        {
            SetDefaultSize(-1, 500);
            BorderWidth = 8;

            HBox hbox = new HBox(false, 8);

            Add(hbox);

            ScrolledWindow sw = new ScrolledWindow();

            sw.SetPolicy(PolicyType.Never, PolicyType.Automatic);
            hbox.PackStart(sw, false, false, 0);

            ListStore model = CreateModel();

            TreeView treeview = new TreeView(model);

            sw.Add(treeview);

            TreeViewColumn column = new TreeViewColumn();

            column.Title = "Name";
            CellRenderer renderer = new CellRendererPixbuf();

            column.PackStart(renderer, false);
            column.SetAttributes(renderer, "stock_id", Column.Id);
            renderer = new CellRendererText();
            column.PackStart(renderer, true);
            column.SetAttributes(renderer, "text", Column.Name);

            treeview.AppendColumn(column);
            treeview.AppendColumn("Label", new CellRendererText(), "text", Column.Label);
            treeview.AppendColumn("Accel", new CellRendererText(), "text", Column.Accel);
            treeview.AppendColumn("ID", new CellRendererText(), "text", Column.Id);

            Alignment align = new Alignment(0.5f, 0.0f, 0.0f, 0.0f);

            hbox.PackEnd(align, false, false, 0);

            Frame frame = new Frame("Selected Item");

            align.Add(frame);

            VBox vbox = new VBox(false, 8);

            vbox.BorderWidth = 8;
            frame.Add(vbox);

            typeLabel = new Label();
            vbox.PackStart(typeLabel, false, false, 0);
            iconImage = new Gtk.Image();
            vbox.PackStart(iconImage, false, false, 0);
            accelLabel = new Label();
            vbox.PackStart(accelLabel, false, false, 0);
            nameLabel = new Label();
            vbox.PackStart(nameLabel, false, false, 0);
            idLabel = new Label();
            vbox.PackStart(idLabel, false, false, 0);

            treeview.Selection.Mode     = Gtk.SelectionMode.Single;
            treeview.Selection.Changed += new EventHandler(SelectionChanged);

            ShowAll();
        }
示例#19
0
        void SetLayout()
        {
            var vbox = new VBox();

            vbox.Accessible.Role = Xwt.Accessibility.Role.Filler;
            vbox.MinWidth        = 450;

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

            vbox.PackStart(actionLabel);

            var breakpointActionGroup = new VBox {
                MarginLeft = 12
            };

            breakpointActionGroup.Accessible.Role = Xwt.Accessibility.Role.Filler;

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

            var printExpressionGroup = new HBox {
                MarginLeft = 18
            };

            printExpressionGroup.Accessible.Role = Xwt.Accessibility.Role.Filler;

            printExpressionGroup.PackStart(entryPrintExpression, true);

            // We'll ignore this label because the content of the label is included in the accessibility Help text of the
            // entryPrintExpression widget
            printMessageTip.Accessible.Role = Xwt.Accessibility.Role.Filler;

            printExpressionGroup.PackStart(warningPrintExpression);
            breakpointActionGroup.PackStart(printExpressionGroup);

            breakpointActionGroup.PackEnd(printMessageTip);

            vbox.PackStart(breakpointActionGroup);

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

            vbox.PackStart(whenLabel);

            var whenToTakeActionRadioGroup = new VBox {
                MarginLeft = 12
            };

            whenToTakeActionRadioGroup.Accessible.Role = Xwt.Accessibility.Role.Filler;

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

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

                whenToTakeActionRadioGroup.PackStart(hboxFunction);
            }

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

                hboxException = new HBox();
                hboxException.Accessible.Role = Xwt.Accessibility.Role.Filler;

                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);

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

            vbox.PackStart(advancedLabel);

            var vboxAdvancedConditions = new VBox {
                MarginLeft = 30
            };

            vboxAdvancedConditions.Accessible.Role = Xwt.Accessibility.Role.Filler;

            var hboxHitCount = new HBox();

            hboxHitCount.Accessible.Role = Xwt.Accessibility.Role.Filler;
            hboxHitCount.PackStart(ignoreHitType, true);
            hboxHitCount.PackStart(ignoreHitCount);
            vboxAdvancedConditions.PackStart(hboxHitCount);

            vboxAdvancedConditions.PackStart(conditionalHitType);
            hboxCondition = new HBox();
            hboxCondition.Accessible.Role = Xwt.Accessibility.Role.Filler;

            hboxCondition.PackStart(entryConditionalExpression, true);
            hboxCondition.PackStart(warningCondition);
            vboxAdvancedConditions.PackStart(hboxCondition);

            conditionalExpressionTip.Accessible.Role = Xwt.Accessibility.Role.Filler;
            vboxAdvancedConditions.PackEnd(conditionalExpressionTip);

            vbox.PackStart(vboxAdvancedConditions);


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

            Content = vbox;

            OnUpdateControls(null, null);
        }
示例#20
0
        private void Build()
        {
            Icon           = PintaCore.Resources.GetIcon("Menu.Image.Resize.png");
            WindowPosition = WindowPosition.CenterOnParent;

            DefaultWidth  = 300;
            DefaultHeight = 200;

            percentageRadio = new RadioButton(Catalog.GetString("By percentage:"));
            absoluteRadio   = new RadioButton(percentageRadio, Catalog.GetString("By absolute size:"));

            percentageSpinner = new SpinButton(1, 1000, 1);
            widthSpinner      = new SpinButton(1, 10000, 1);
            heightSpinner     = new SpinButton(1, 10000, 1);

            aspectCheckbox = new CheckButton(Catalog.GetString("Maintain aspect ratio"));

            const int spacing   = 6;
            var       main_vbox = new VBox()
            {
                Spacing = spacing, BorderWidth = 12
            };

            var hbox_percent = new HBox()
            {
                Spacing = spacing
            };

            hbox_percent.PackStart(percentageRadio, true, true, 0);
            hbox_percent.PackStart(percentageSpinner, false, false, 0);
            hbox_percent.PackEnd(new Label("%"), false, false, 0);
            main_vbox.PackStart(hbox_percent, false, false, 0);

            main_vbox.PackStart(absoluteRadio, false, false, 0);

            var hbox_width = new HBox()
            {
                Spacing = spacing
            };

            hbox_width.PackStart(new Label(Catalog.GetString("Width:")), false, false, 0);
            hbox_width.PackStart(widthSpinner, false, false, 0);
            hbox_width.PackStart(new Label(Catalog.GetString("pixels")), false, false, 0);
            main_vbox.PackStart(hbox_width, false, false, 0);

            var hbox_height = new HBox()
            {
                Spacing = spacing
            };

            hbox_height.PackStart(new Label(Catalog.GetString("Height:")), false, false, 0);
            hbox_height.PackStart(heightSpinner, false, false, 0);
            hbox_height.PackStart(new Label(Catalog.GetString("pixels")), false, false, 0);
            main_vbox.PackStart(hbox_height, false, false, 0);

            main_vbox.PackStart(aspectCheckbox, false, false, 0);

            VBox.BorderWidth = 2;
            VBox.Add(main_vbox);

            ShowAll();
        }
示例#21
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="information">Error information to be displayed.</param>
        /// <param name="owner"></param>
        public ErrorView(string information, ViewBase owner = null) : base(owner)
        {
            errorWindow = new Window("Error Information")
            {
                TransientFor   = owner.MainWidget.Toplevel as Window,
                WindowPosition = WindowPosition.CenterAlways,
                // Set a default size of 1280x480.
                // Without a default size, the window will resize to fit all of the text in the TextView, which is
                // a bad thing if the text is very long (the window may be bigger than the screen).
                // If we put the text in a ScrolledWindow, we get around this issue, but the window will be tiny.
                // The best solution seems to be a compromise: put the text in a ScrolledWindow,
                // but also set a minimum size for the window.
                WidthRequest  = 1280,
                HeightRequest = 480
            };
            // Capture Keypress events, so the user can close the form via the escape key
            errorWindow.KeyPressEvent += OnKeyPress;

            textArea = new TextView()
            {
                Editable = false,
            };

            ScrolledWindow scroll = new ScrolledWindow()
            {
                HscrollbarPolicy = PolicyType.Automatic,
                VscrollbarPolicy = PolicyType.Automatic,
            };

            scroll.Add(textArea);
            Error = information;

            closeButton          = new Button("Close");
            closeButton.Clicked += Close;
            Alignment alignCloseButton = new Alignment(1, 1, 0, 0)
            {
                closeButton
            };

            copyButton          = new Button("Copy");
            copyButton.Clicked += Copy;
            Alignment alignCopyButton = new Alignment(0, 1, 0, 0)
            {
                copyButton
            };

            HBox buttonContainer = new HBox();

            buttonContainer.PackStart(alignCopyButton, false, false, 0);
            buttonContainer.PackEnd(alignCloseButton, false, false, 0);

            VBox primaryContainer = new VBox()
            {
                Name        = "primaryContainer",
                BorderWidth = 20
            };

            primaryContainer.PackStart(scroll, true, true, 0);
            primaryContainer.PackStart(buttonContainer, false, false, 0);

            errorWindow.Add(primaryContainer);
        }
示例#22
0
        public TabStrip(DockNotebook notebook)
        {
            if (notebook == null)
            {
                throw new ArgumentNullException("notebook");
            }

            Accessible.SetRole(AtkCocoa.Roles.AXTabGroup);

            TabWidth    = 125;
            TargetWidth = 125;
            tracker     = new MouseTracker(this);
            GtkWorkarounds.FixContainerLeak(this);

            innerBox = new HBox(false, 0);
            innerBox.Accessible.SetShouldIgnore(true);
            Add(innerBox);

            this.notebook = notebook;
            WidgetFlags  |= Gtk.WidgetFlags.AppPaintable;
            Events       |= EventMask.PointerMotionMask | EventMask.LeaveNotifyMask | EventMask.ButtonPressMask;

            var arr = new Xwt.ImageView(tabbarPrevImage);

            arr.HeightRequest = arr.WidthRequest = 10;

            var alignment = new Alignment(0.5f, 0.5f, 0.0f, 0.0f);

            alignment.Add(arr.ToGtkWidget());
            PreviousButton                 = new Button(alignment);
            PreviousButton.TooltipText     = Core.GettextCatalog.GetString("Switch to previous document");
            PreviousButton.Relief          = ReliefStyle.None;
            PreviousButton.CanDefault      = PreviousButton.CanFocus = false;
            PreviousButton.Accessible.Name = "DockNotebook.Tabstrip.PreviousButton";
            PreviousButton.Accessible.SetTitle(Core.GettextCatalog.GetString("Previous document"));
            PreviousButton.Accessible.Description = Core.GettextCatalog.GetString("Switch to previous document");

            arr = new Xwt.ImageView(tabbarNextImage);
            arr.HeightRequest = arr.WidthRequest = 10;

            alignment = new Alignment(0.5f, 0.5f, 0.0f, 0.0f);
            alignment.Add(arr.ToGtkWidget());
            NextButton                 = new Button(alignment);
            NextButton.TooltipText     = Core.GettextCatalog.GetString("Switch to next document");
            NextButton.Relief          = ReliefStyle.None;
            NextButton.CanDefault      = NextButton.CanFocus = false;
            NextButton.Accessible.Name = "DockNotebook.Tabstrip.NextButton";
            NextButton.Accessible.SetTitle(Core.GettextCatalog.GetString("Next document"));
            NextButton.Accessible.Description = Core.GettextCatalog.GetString("Switch to next document");

            DropDownButton                 = new MenuButton();
            DropDownButton.TooltipText     = Core.GettextCatalog.GetString("Document List");
            DropDownButton.Relief          = ReliefStyle.None;
            DropDownButton.CanDefault      = DropDownButton.CanFocus = false;
            DropDownButton.Accessible.Name = "DockNotebook.Tabstrip.DocumentListButton";
            DropDownButton.Accessible.SetTitle(Core.GettextCatalog.GetString("Document list"));
            DropDownButton.Accessible.Description = Core.GettextCatalog.GetString("Display the document list menu");

            PreviousButton.ShowAll();
            PreviousButton.NoShowAll = true;
            NextButton.ShowAll();
            NextButton.NoShowAll = true;
            DropDownButton.ShowAll();

            PreviousButton.Name = "MonoDevelop.DockNotebook.BarButton";
            NextButton.Name     = "MonoDevelop.DockNotebook.BarButton";
            DropDownButton.Name = "MonoDevelop.DockNotebook.BarButton";

            innerBox.PackStart(PreviousButton, false, false, 0);
            innerBox.PackStart(NextButton, false, false, 0);
            innerBox.PackEnd(DropDownButton, false, false, 0);

            tracker.HoveredChanged += (sender, e) => {
                if (!tracker.Hovered)
                {
                    SetHighlightedTab(null);
                    UpdateTabWidth(tabEndX - tabStartX);
                    QueueDraw();
                }
            };

            foreach (var tab in notebook.Tabs)
            {
                Accessible.AddAccessibleElement(tab.Accessible);
            }
            UpdateAccessibilityTabs();
            notebook.PageAdded     += PageAddedHandler;
            notebook.PageRemoved   += PageRemovedHandler;
            notebook.TabsReordered += PageReorderedHandler;

            closingTabs = new Dictionary <int, DockNotebookTab> ();
        }
示例#23
0
        public void SetLevel(LevelDescription desc)
        {
            GtkHelpers.FlushAllDeferredEvents();

            Destroyed += LevelAnalysisLayout_Destroyed;

            if (null != Layout)
            {
                Layout.Hide();
                Layout.Destroy();
                Layout             = null;
                SaveSolutionColumn = null;
                LoadSolutionColumn = null;
            }

            LevelDesc = desc;
            LoadAndValidateLevelDesc();

            Solution = LevelManager.ReadLevelSolution(desc.Name);
            if (null == Solution)
            {
                Solution = new LevelSolution();
                Solution.AssumedHandMissileFrequency    = HandMissileFreqency;
                Solution.AssumedHandMissileAvgDamagePct = HandMissileDamantPctAverage;
            }

            TurretSelections = new Dictionary <int, int>();
            RecalculateAllStats();

            Layout = new VBox(false, 0);
            AddWithViewport(Layout);

            HBox field = GtkHelpers.ReadOnlyTextField("Level Name", desc.Name);

            Layout.PackStart(field, false, false, 0);
            field.Show();

            field = GtkHelpers.ReadOnlyTextField("Lives", desc.Lives.ToString());
            Layout.PackStart(field, false, false, 0);
            field.Show();

            field = GtkHelpers.ReadOnlyTextField("Starting Coins", desc.StartingCoins.ToString());
            Layout.PackStart(field, false, false, 0);
            field.Show();


            field = GtkHelpers.TextEntryField("Hand Missile Frequency (sec)", HandMissileFreqency.ToString(), AssumedFireRatePerSecChanged_Changed, true, GtkHelpers.ValueType.Float);
            Layout.PackStart(field, false, false, 0);
            field.Show();


            field = GtkHelpers.TextEntryField("Hand Missile Average Accuracy Handicap", HandMissileDamantPctAverage.ToString(), AssumedHandMissileAccuracyHandicap_Changed, true, GtkHelpers.ValueType.Float);
            Layout.PackStart(field, false, false, 0);
            field.Show();


            WavesTree = new TreeView();
            Layout.PackStart(WavesTree, false, false, 0);
            WavesTree.Show();
            WavesTree.ButtonReleaseEvent += WavesTree_ButtonReleaseEvent;

            List <EnemyDescription> enemies  = LevelManager.GetEnemies();
            ComboBoxText            comboBox = new ComboBoxText();

            foreach (EnemyDescription enemy in enemies)
            {
                comboBox.AppendText(enemy.Name);
            }
            comboBox.Active = 0;


            TreeViewColumn enemyCoumn          = new TreeViewColumn();
            TreeViewColumn countColumn         = new TreeViewColumn();
            TreeViewColumn difficultyColumn    = new TreeViewColumn();
            TreeViewColumn singleEnemyColumn   = new TreeViewColumn();
            TreeViewColumn maxHPPSColumn       = new TreeViewColumn();
            TreeViewColumn maxDPSColumn        = new TreeViewColumn();
            TreeViewColumn simColumn           = new TreeViewColumn();
            TreeViewColumn turretCostVsMaxCoin = new TreeViewColumn();
            TreeViewColumn issuesColumn        = new TreeViewColumn();


            CellRendererText textCellRenderer = new CellRendererText();

            textCellRenderer.Editable = false;

            enemyCoumn.PackStart(textCellRenderer, true);
            enemyCoumn.Title = "Enemy";
            enemyCoumn.AddAttribute(textCellRenderer, "text", 1);
            WavesTree.AppendColumn(enemyCoumn);

            countColumn.PackStart(textCellRenderer, true);
            countColumn.Title = "Count";
            countColumn.AddAttribute(textCellRenderer, "text", 2);
            WavesTree.AppendColumn(countColumn);

            difficultyColumn.PackStart(textCellRenderer, true);
            difficultyColumn.Title = "Difficulty Multiplier";
            difficultyColumn.AddAttribute(textCellRenderer, "text", 3);
            WavesTree.AppendColumn(difficultyColumn);

            //
            // Add column:  Max damage that can be dished to a single enemy given turret coverage + enemy speed
            //

            singleEnemyColumn.PackStart(textCellRenderer, true);
            singleEnemyColumn.Title = "Single Enemy Damage";
            singleEnemyColumn.AddAttribute(textCellRenderer, "text", 4);
            WavesTree.AppendColumn(singleEnemyColumn);

            //
            // Add column: Max hit points of the wave
            //

            maxHPPSColumn.PackStart(textCellRenderer, true);
            maxHPPSColumn.Title = "Max Hitpoints/s";
            maxHPPSColumn.AddAttribute(textCellRenderer, "text", 5);
            WavesTree.AppendColumn(maxHPPSColumn);

            //
            // Add column: Max damage of all the turrets combined firing at full capacity
            //

            maxDPSColumn.PackStart(textCellRenderer, true);
            maxDPSColumn.Title = "Max DPS overall";
            maxDPSColumn.AddAttribute(textCellRenderer, "text", 6);
            WavesTree.AppendColumn(maxDPSColumn);


            //
            // Add column: Simulated damage / kills
            //

            simColumn.PackStart(textCellRenderer, true);
            simColumn.Title = "Sim damage/kills";
            simColumn.AddAttribute(textCellRenderer, "text", 7);
            WavesTree.AppendColumn(simColumn);


            //
            // Add column: Max coin earned by start of wave
            //


            turretCostVsMaxCoin.PackStart(textCellRenderer, true);
            turretCostVsMaxCoin.Title = "Coin Need/Avail";
            turretCostVsMaxCoin.AddAttribute(textCellRenderer, "text", 8);
            WavesTree.AppendColumn(turretCostVsMaxCoin);

            //
            // Solution save/load
            //


            SaveSolutionColumn = new TreeViewColumn();
            LoadSolutionColumn = new TreeViewColumn();;

            SaveSolutionColumn.PackStart(textCellRenderer, true);
            SaveSolutionColumn.Title = "Save Solution";
            SaveSolutionColumn.AddAttribute(textCellRenderer, "text", 9);
            WavesTree.AppendColumn(SaveSolutionColumn);


            LoadSolutionColumn.PackStart(textCellRenderer, true);
            LoadSolutionColumn.Title = "Load Solution";
            LoadSolutionColumn.AddAttribute(textCellRenderer, "text", 10);
            WavesTree.AppendColumn(LoadSolutionColumn);


            //
            // Add column: Issues
            //


            issuesColumn.PackStart(textCellRenderer, true);
            issuesColumn.Title = "Issues";
            issuesColumn.AddAttribute(textCellRenderer, "markup", 11);
            WavesTree.AppendColumn(issuesColumn);

            WavesModel               = new ListStore(typeof(int), typeof(string), typeof(int), typeof(float), typeof(float), typeof(float), typeof(float), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
            WavesTree.Model          = WavesModel;
            WavesTree.Selection.Mode = SelectionMode.Single;


            PopulateTreeWithWaves(desc);


            Table map = GetFieldTable(desc);

            Layout.PackStart(map, false, true, 0);
            map.Show();


            //
            // Allowed turrets
            //

            field = new HBox(true, 10);
            Layout.PackStart(field, true, false, 0);
            field.Show();

            AllowedTurretTree = new TreeView();

            TreeViewColumn availCol   = new TreeViewColumn();
            TreeViewColumn allowedCol = new TreeViewColumn();


            allowedCol.PackStart(textCellRenderer, true);
            allowedCol.Title = "Allowed Turrets";
            allowedCol.AddAttribute(textCellRenderer, "text", 1);
            AllowedTurretTree.AppendColumn(allowedCol);

            AllowedTurretModel               = new ListStore(typeof(int), typeof(string));
            AllowedTurretTree.Model          = AllowedTurretModel;
            AllowedTurretTree.Selection.Mode = SelectionMode.Multiple;

            field.PackEnd(AllowedTurretTree, true, true, 0);
            AllowedTurretTree.Show();

            PopulateTurretTrees(desc);


            Show();
            ShowAll();
        }
        public DefaultPolicyOptionsDialog(Gtk.Window parentWindow)
            : base(parentWindow, new PolicySet(),
                   "/MonoDevelop/ProjectModel/Gui/DefaultPolicyPanels")
        {
            this.Title = GettextCatalog.GetString("Custom Policies");
            editingSet = (PolicySet)DataObject;

            HBox topBar = new HBox();

            topBar.Spacing = 3;
            topBar.PackStart(new Label(GettextCatalog.GetString("Editing Policy:")), false, false, 0);

            policiesCombo = ComboBox.NewText();
            topBar.PackStart(policiesCombo, false, false, 0);

            deleteButton = new Button(GettextCatalog.GetString("Delete Policy"));
            topBar.PackEnd(deleteButton, false, false, 0);

            exportButton             = new MenuButton();
            exportButton.Label       = GettextCatalog.GetString("Export");
            exportButton.MenuCreator = delegate {
                Gtk.Menu menu = new Gtk.Menu();
                MenuItem mi   = new MenuItem(GettextCatalog.GetString("To file..."));
                mi.Activated += HandleToFile;
                menu.Insert(mi, -1);
                mi            = new MenuItem(GettextCatalog.GetString("To project or solution..."));
                mi.Activated += HandleToProject;
                if (!IdeApp.Workspace.IsOpen)
                {
                    mi.Sensitive = false;
                }
                menu.Insert(mi, -1);
                menu.ShowAll();
                return(menu);
            };
            topBar.PackEnd(exportButton, false, false, 0);

            newButton             = new MenuButton();
            newButton.Label       = GettextCatalog.GetString("Add Policy");
            newButton.MenuCreator = delegate {
                Gtk.Menu menu = new Gtk.Menu();
                MenuItem mi   = new MenuItem(GettextCatalog.GetString("New policy..."));
                mi.Activated += HandleNewButtonClicked;
                menu.Insert(mi, -1);
                mi            = new MenuItem(GettextCatalog.GetString("From file..."));
                mi.Activated += HandleFromFile;
                menu.Insert(mi, -1);
                mi            = new MenuItem(GettextCatalog.GetString("From project or solution..."));
                mi.Activated += HandleFromProject;
                if (!IdeApp.Workspace.IsOpen)
                {
                    mi.Sensitive = false;
                }
                menu.Insert(mi, -1);
                menu.ShowAll();
                return(menu);
            };
            topBar.PackEnd(newButton, false, false, 0);

            Alignment align = new Alignment(0f, 0f, 1f, 1f);

            align.LeftPadding   = 9;
            align.TopPadding    = 9;
            align.RightPadding  = 9;
            align.BottomPadding = 9;
            align.Add(topBar);

            HeaderBox ebox = new HeaderBox();

            ebox.GradientBackround = true;
            ebox.SetMargins(0, 1, 0, 0);
            ebox.Add(align);

            ebox.ShowAll();

            VBox.PackStart(ebox, false, false, 0);
            VBox.BorderWidth = 0;
            Box.BoxChild c = (Box.BoxChild)VBox [ebox];
            c.Position = 0;

            foreach (PolicySet ps in PolicyService.GetUserPolicySets())
            {
                PolicySet copy = ps.Clone();
                originalSets [copy] = ps;
                sets.Add(copy);
            }
            FillPolicySets();

            policiesCombo.Changed += HandlePoliciesComboChanged;
            deleteButton.Clicked  += HandleDeleteButtonClicked;
        }
示例#25
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public AzureCredentialsSetup() : base("Azure Batch and Storage Account Information")
        {
            WidthRequest = 500;
            // initialise input fields with the last values used
            batchAccountInput   = new Entry((string)AzureSettings.Default["BatchAccount"]);
            batchUrlInput       = new Entry((string)AzureSettings.Default["BatchUrl"]);
            batchKeyInput       = new Entry((string)AzureSettings.Default["BatchKey"]);
            storageAccountInput = new Entry((string)AzureSettings.Default["StorageAccount"]);
            storageKeyInput     = new Entry((string)AzureSettings.Default["StorageKey"]);
            emailSenderInput    = new Entry((string)AzureSettings.Default["EmailSender"]);
            emailPWInput        = new Entry((string)AzureSettings.Default["EmailPW"]);

            btnLoad          = new Button("Load from File");
            btnLoad.Clicked += LoadCredentialsFromFile;

            btnSave          = new Button("Save");
            btnSave.Clicked += SaveCredentials;

            btnHelp          = new Button("Help");
            btnHelp.Clicked += ProvideHelp;

            HBox buttonContainer = new HBox();

            buttonContainer.PackStart(btnLoad, false, false, 0);
            buttonContainer.PackStart(btnHelp, false, false, 0);
            buttonContainer.PackEnd(btnSave, false, false, 0);

            Table primaryContainer = new Table(10, 2, false);

            primaryContainer.Attach(new Label("Batch Account:")
            {
                Xalign = 0
            }, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
            primaryContainer.Attach(batchAccountInput, 1, 2, 0, 1, (AttachOptions.Fill | AttachOptions.Expand), AttachOptions.Shrink, 0, 0);

            primaryContainer.Attach(new Label("Batch URL:")
            {
                Xalign = 0
            }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
            primaryContainer.Attach(batchUrlInput, 1, 2, 1, 2, (AttachOptions.Fill | AttachOptions.Expand), AttachOptions.Shrink, 0, 0);

            primaryContainer.Attach(new Label("Batch Key:")
            {
                Xalign = 0
            }, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
            primaryContainer.Attach(batchKeyInput, 1, 2, 2, 3, (AttachOptions.Fill | AttachOptions.Expand), AttachOptions.Shrink, 0, 0);

            primaryContainer.Attach(new Label("Storage Account:")
            {
                Xalign = 0
            }, 0, 1, 3, 4, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
            primaryContainer.Attach(storageAccountInput, 1, 2, 3, 4, (AttachOptions.Fill | AttachOptions.Expand), AttachOptions.Shrink, 0, 0);

            primaryContainer.Attach(new Label("Storage Key:")
            {
                Xalign = 0
            }, 0, 1, 4, 5, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
            primaryContainer.Attach(storageKeyInput, 1, 2, 4, 5, (AttachOptions.Fill | AttachOptions.Expand), AttachOptions.Shrink, 0, 0);

            primaryContainer.Attach(new Label(""), 0, 2, 5, 6, (AttachOptions.Fill | AttachOptions.Expand), AttachOptions.Shrink, 0, 0);

            primaryContainer.Attach(new Label("Email Address:")
            {
                Xalign = 0
            }, 0, 1, 6, 7, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
            primaryContainer.Attach(emailSenderInput, 1, 2, 6, 7, (AttachOptions.Fill | AttachOptions.Expand), AttachOptions.Shrink, 0, 0);

            primaryContainer.Attach(new Label("Email Password:"******""), 0, 2, 8, 9, (AttachOptions.Fill | AttachOptions.Expand), AttachOptions.Shrink, 0, 0);

            primaryContainer.Attach(buttonContainer, 0, 2, 9, 10, (AttachOptions.Fill | AttachOptions.Expand), AttachOptions.Shrink, 0, 0);

            Alignment adj = new Alignment(0f, 0f, 1f, 0f); // 3rd argument is 1 to make the controls to scale (horizontally) with viewport size

            adj.LeftPadding = adj.RightPadding = adj.TopPadding = adj.BottomPadding = 15;
            adj.Add(primaryContainer);
            Add(adj);
            adj.ShowAll();
            Show();
        }
示例#26
0
        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);
        }
示例#27
0
        Grid _Toolbar()
        {
            var grid = new Grid {
                ColumnHomogeneous = true, MarginLeft = 10, MarginRight = 10
            };

            var task_status = new TaskStatusIcon {
                ShowOnlyBackgroundTasks = false
            };

            var toolbar = (Toolbar)ActionService.UIManager.GetWidget("/ControlToolbar");

            toolbar.ShowArrow    = false;
            toolbar.ToolbarStyle = ToolbarStyle.Icons;
            toolbar.IconSize     = IconSize.SmallToolbar;
            toolbar.Margin       = 0;

            var next_button = new NextButton(ActionService)
            {
                IconSize = IconSize.SmallToolbar
            };

            ActionService.PopulateToolbarPlaceholder(toolbar, "/ControlToolbar/NextArrowButton", next_button);

            var repeat_button = new RepeatButton {
                Relief = ReliefStyle.None
            };

            ActionService.PopulateToolbarPlaceholder(toolbar, "/ControlToolbar/RepeatButton", repeat_button);

            var seek_slider = new ConnectedSeekSlider();

            var tools_align = new Alignment(0.5f, 0.5f, 0f, 0f);

            tools_align.Child = toolbar;

            var search_align = new Alignment(0.5f, 0.5f, 0f, 0f);

            search_align.Child = _view_container.SearchEntry;

            var lbox = new HBox();

            lbox.PackStart(task_status, false, false, 0);
            lbox.PackStart(tools_align, true, true, 0);

            var rbox = new HBox();

            rbox.PackEnd(search_align, true, true, 0);

            grid.Attach(lbox, 0, 0, 1, 1);
            grid.Attach(seek_slider, 1, 0, 1, 1);
            grid.Attach(rbox, 2, 0, 1, 1);

            _ready.Add(() => {
                task_status.Show();
                next_button.Show();
                repeat_button.Show();
                tools_align.Show();
                search_align.Show();

                lbox.Show();
                seek_slider.Show();
                rbox.Show();
            });

            return(grid);
        }
示例#28
0
        public void SetLabel(Gtk.Widget page, Gdk.Pixbuf icon, string label)
        {
            this.label = label;
            this.page  = page;
            if (Child != null)
            {
                Gtk.Widget oc = Child;
                Remove(oc);
                oc.Destroy();
            }

            Gtk.HBox box = new HBox();
            box.Spacing = 2;

            if (icon != null)
            {
                tabIcon = new ImageView(icon);
                tabIcon.Show();
                box.PackStart(tabIcon, false, false, 0);
            }
            else
            {
                tabIcon = null;
            }

            if (!string.IsNullOrEmpty(label))
            {
                labelWidget = new Label(label);
                //labelWidget.DropShadowVisible = true;
                labelWidget.UseMarkup = true;
                box.PackStart(labelWidget, true, true, 0);
            }
            else
            {
                labelWidget = null;
            }

            btnDock               = new ImageButton();
            btnDock.Image         = pixAutoHide;
            btnDock.InactiveImage = pixAutoHide.WithAlpha(.5);
            btnDock.TooltipText   = Catalog.GetString("Auto Hide");
            btnDock.CanFocus      = false;
//			btnDock.WidthRequest = btnDock.HeightRequest = 17;
            btnDock.Clicked          += OnClickDock;
            btnDock.ButtonPressEvent += (o, args) => args.RetVal = true;
            btnDock.WidthRequest      = btnDock.SizeRequest().Width;

            btnClose               = new ImageButton();
            btnClose.Image         = pixClose;
            btnClose.InactiveImage = pixClose.WithAlpha(.5);
            btnClose.TooltipText   = Catalog.GetString("Close");
            btnClose.CanFocus      = false;
//			btnClose.WidthRequest = btnClose.HeightRequest = 17;
            btnClose.WidthRequest = btnDock.SizeRequest().Width;
            btnClose.Clicked     += delegate {
                item.Visible = false;
            };
            btnClose.ButtonPressEvent += (o, args) => args.RetVal = true;

            Gtk.Alignment al     = new Alignment(0, 0, 1, 1);
            HBox          btnBox = new HBox(false, 3);

            btnBox.PackStart(btnDock, false, false, 0);
            btnBox.PackStart(btnClose, false, false, 0);
            al.Add(btnBox);
            al.LeftPadding = 3;
            al.TopPadding  = 1;
            box.PackEnd(al, false, false, 0);

            Add(box);

            // Get the required size before setting the ellipsize property, since ellipsized labels
            // have a width request of 0
            box.ShowAll();
            Show();

            UpdateBehavior();
            UpdateVisualStyle();
        }
示例#29
0
        public StatusArea()
        {
            theme     = new StatusAreaTheme();
            renderArg = new RenderArg();

            mainContext   = new MainStatusBarContextImpl(this);
            activeContext = mainContext;
            contexts.Add(mainContext);

            VisibleWindow = false;
            NoShowAll     = true;
            WidgetFlags  |= Gtk.WidgetFlags.AppPaintable;

            statusIconBox.BorderWidth = 0;
            statusIconBox.Spacing     = 3;

            Action <bool> animateProgressBar =
                showing => this.Animate("ProgressBarFade",
                                        val => renderArg.ProgressBarAlpha = val,
                                        renderArg.ProgressBarAlpha,
                                        showing ? 1.0f : 0.0f,
                                        easing: Easing.CubicInOut);

            ProgressBegin += delegate {
                renderArg.ShowProgressBar = true;
//				StartBuildAnimation ();
                renderArg.ProgressBarFraction = 0;
                QueueDraw();
                animateProgressBar(true);
            };

            ProgressEnd += delegate {
                renderArg.ShowProgressBar = false;
//				StopBuildAnimation ();
                QueueDraw();
                animateProgressBar(false);
            };

            ProgressFraction += delegate(object sender, FractionEventArgs e) {
                renderArg.ProgressBarFraction = (float)e.Work;
                QueueDraw();
            };

            contentBox.PackStart(messageBox, true, true, 0);
            contentBox.PackEnd(statusIconBox, false, false, 0);
            contentBox.PackEnd(statusIconSeparator = new StatusAreaSeparator(), false, false, 0);
            contentBox.PackEnd(buildResultWidget   = CreateBuildResultsWidget(Orientation.Horizontal), false, false, 0);

            mainAlign              = new Alignment(0, 0.5f, 1, 0);
            mainAlign.LeftPadding  = 12;
            mainAlign.RightPadding = 8;
            mainAlign.Add(contentBox);
            Add(mainAlign);

            mainAlign.ShowAll();
            statusIconBox.Hide();
            statusIconSeparator.Hide();
            buildResultWidget.Hide();
            Show();

            this.ButtonPressEvent += delegate {
                if (sourcePad != null)
                {
                    sourcePad.BringToFront(true);
                }
            };

            statusIconBox.Shown += delegate {
                UpdateSeparators();
            };

            statusIconBox.Hidden += delegate {
                UpdateSeparators();
            };

            messageQueue = new Queue <Message> ();

            tracker                 = new MouseTracker(this);
            tracker.MouseMoved     += (sender, e) => QueueDraw();
            tracker.HoveredChanged += (sender, e) => {
                this.Animate("Hovered",
                             x => renderArg.HoverProgress = x,
                             renderArg.HoverProgress,
                             tracker.Hovered ? 1.0f : 0.0f,
                             easing: Easing.SinInOut);
            };

            IdeApp.FocusIn += delegate {
                // If there was an error while the application didn't have the focus,
                // trigger the error animation again when it gains the focus
                if (errorAnimPending)
                {
                    errorAnimPending = false;
                    TriggerErrorAnimation();
                }
            };
        }
示例#30
0
  public static void Main(string [] args)
  {	
    Application.Init();

    Window win = new Window("EFL# Demo App");	
    win.Resize(640, 480);

    Application.EE.ResizeEvent += AppResizeHandler;

    /* integrate this code in the Window class */
    Edje win_bg = new Edje(Application.EE.Get());
    win_bg.FileSet(DataConfig.DATADIR + "/data/eblocks/themes/e17.edj","window");
    win_bg.Resize(640, 480);
    win_bg.Move(0, 0);
    win_bg.Lower();
    win_bg.Show();
    
    MenuItem item;    
    MenuItem entry;

    MenuBar mb = new MenuBar();
    mb.Move(0, 0);
    mb.Resize(640, 35);
    mb.Spacing = 15;

    item = new MenuItem("_File");
    Menu file_menu = new Menu();
    
    entry = new MenuItem(file_menu.Canvas, "_Open");
    file_menu.Append(entry);
    entry = new MenuItem(file_menu.Canvas, "_Close");
    file_menu.Append(entry);
    entry = new MenuItem(file_menu.Canvas, "_Save");
    file_menu.Append(entry);
    
    item.SubMenu = file_menu;
    
    mb.Append(item);

    item = new MenuItem("_Edit");
    Menu edit_menu = new Menu();
    
    entry = new MenuItem(edit_menu.Canvas, "_Copy");
    edit_menu.Append(entry);
    entry = new MenuItem(edit_menu.Canvas, "_Cut");
    edit_menu.Append(entry);
    entry = new MenuItem(edit_menu.Canvas, "_Paste");
    edit_menu.Append(entry);
    
    item.SubMenu = edit_menu;
    mb.Append(item);

    item = new MenuItem("_About");
    //item.SubMenu = about_menu;
    mb.Append(item);

    mb.Show();

    Button button;	

    HBox box_left = new HBox();
    box_left.Move(0, 37);
    box_left.Resize(70, 480 - 37);
	
    VBox box_icons = new VBox();
    box_icons.Spacing = 0;
    box_icons.Resize(64, 480 - 37);
	
    button = new Button("Tile");
    button.Resize(64, 64);
    box_icons.PackEnd(button);
    button = new Button("Stretch");
    button.Resize(64, 64);
    box_icons.PackEnd(button);	
    button = new Button("Rotate");
    button.Resize(64, 64);
    box_icons.PackEnd(button);	
    button = new Button("Flip");
    button.Resize(64, 64);
    box_icons.PackEnd(button);	
    button = new Button("Quit");
    button.MouseUpEvent += new Enlightenment.Evas.Item.EventHandler(AppQuitButtonHandler);
    button.Resize(64, 64);	
    box_icons.PackEnd(button);		
	
    box_left.PackEnd(box_icons);
	
    Enlightenment.Eblocks.Line vline = new Enlightenment.Eblocks.Line(Application.EE.Get());
    vline.Vertical = true;
    vline.Resize(6, 480 - 37);
	
    box_left.PackEnd(vline);
	
    box_left.Show();
	
    dir = args[0];	
	       	
    imageTable = new Table(Application.EE.Get(), items);
	
    HBox box_images = new HBox();
    box_images.Move(70, 37);
    box_images.Spacing = 0;
    box_images.Resize(640 - 70 - 2, 480 - 37 - 2);
    box_images.PackStart(imageTable);
	
    Application.EE.DataSet("box_images", box_images);
    Application.EE.DataSet("box_left", box_left);
    Application.EE.DataSet("box_icons", box_icons);
    Application.EE.DataSet("win_bg", win_bg);
    Application.EE.DataSet("vline", vline);
    Application.EE.DataSet("mb", mb);
	
    WaitCallback callback = new WaitCallback(Callback);
    ThreadPool.QueueUserWorkItem(callback);	

    win.ShowAll();
	
    Application.Run();
  }   
        public DockItemContainer(DockFrame frame, DockItem item)
        {
            this.frame = frame;
            this.item  = item;

            ResizeMode = Gtk.ResizeMode.Queue;
            Spacing    = 0;

            title           = new Gtk.Label();
            title.Xalign    = 0;
            title.Xpad      = 3;
            title.UseMarkup = true;

            btnDock              = new Button(new Gtk.Image(pixAutoHide));
            btnDock.Relief       = ReliefStyle.None;
            btnDock.CanFocus     = false;
            btnDock.WidthRequest = btnDock.HeightRequest = 17;
            btnDock.Clicked     += OnClickDock;

            btnClose              = new Button(new Gtk.Image(pixClose));
            btnClose.TooltipText  = Catalog.GetString("Hide");
            btnClose.Relief       = ReliefStyle.None;
            btnClose.CanFocus     = false;
            btnClose.WidthRequest = btnClose.HeightRequest = 17;
            btnClose.Clicked     += delegate {
                item.Visible = false;
            };

            HBox box = new HBox(false, 0);

            box.PackStart(title, true, true, 0);
            box.PackEnd(btnClose, false, false, 0);
            box.PackEnd(btnDock, false, false, 0);

            headerAlign            = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
            headerAlign.TopPadding = headerAlign.BottomPadding = headerAlign.RightPadding = headerAlign.LeftPadding = 1;
            headerAlign.Add(box);

            header                     = new EventBox();
            header.Events             |= Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask;
            header.ButtonPressEvent   += HeaderButtonPress;
            header.ButtonReleaseEvent += HeaderButtonRelease;
            header.MotionNotifyEvent  += HeaderMotion;
            header.KeyPressEvent      += HeaderKeyPress;
            header.KeyReleaseEvent    += HeaderKeyRelease;
            header.Add(headerAlign);
            header.ExposeEvent += HeaderExpose;
            header.Realized    += delegate {
                header.GdkWindow.Cursor = handCursor;
            };

            foreach (Widget w in new Widget [] { header, btnDock, btnClose })
            {
                w.EnterNotifyEvent += HeaderEnterNotify;
                w.LeaveNotifyEvent += HeaderLeaveNotify;
            }

            PackStart(header, false, false, 0);
            ShowAll();

            PackStart(item.GetToolbar(PositionType.Top).Container, false, false, 0);

            HBox hbox = new HBox();

            hbox.Show();
            hbox.PackStart(item.GetToolbar(PositionType.Left).Container, false, false, 0);

            contentBox = new HBox();
            contentBox.Show();
            hbox.PackStart(contentBox, true, true, 0);

            hbox.PackStart(item.GetToolbar(PositionType.Right).Container, false, false, 0);

            PackStart(hbox, true, true, 0);

            PackStart(item.GetToolbar(PositionType.Bottom).Container, false, false, 0);

            UpdateBehavior();
        }