コード例 #1
0
        void CreateTitleLabels()
        {
            nfloat labelWidth = _sheetFrame.Width - 2 * _xMargin;

            // Create the window title label.
            _yCurr -= _labelHeight;
            var titleLabelRect = new CGRect(_xMargin, _yCurr, labelWidth, _labelHeight);
            var titleLabel     = ControlsFactory.NewStandardLabel(titleLabelRect);

            titleLabel.Font        = NSFont.BoldSystemFontOfSize(NSFont.SystemFontSize);
            titleLabel.StringValue = "Uncombine film";
            View.AddSubview(titleLabel);

            // Create the instruction label.
            _yCurr -= _labelHeight + _yLabelsDistance;
            var instructionLabelRect = new CGRect(_xMargin, _yCurr, labelWidth, _labelHeight);
            var instructionLabel     = ControlsFactory.NewStandardLabel(instructionLabelRect);

            instructionLabel.Font        = NSFont.LabelFontOfSize(NSFont.LabelFontSize);
            instructionLabel.StringValue = "Create multiple films, one per distinct screening title";
            View.AddSubview(instructionLabel);

            // Set sample view used to disable resizing.
            _sampleView = titleLabel;
        }
コード例 #2
0
        private void CreateInstructionsLabel()
        {
            var labelHeight = 2 * _labelHeight + 2;

            _yCurr -= labelHeight;
            var rect             = new CGRect(_xMargin, _yCurr, _contentWidth, labelHeight);
            var instructionLabel = ControlsFactory.NewStandardLabel(rect, true);

            instructionLabel.StringValue   = $"Check the boxes to indicate availability for the {AppDelegate.Festival} {AppDelegate.FestivalYear} festival days";
            instructionLabel.LineBreakMode = NSLineBreakMode.ByWordWrapping;
            View.AddSubview(instructionLabel);
        }
コード例 #3
0
        private void CreateFilmTitleLabel()
        {
            _yCurr -= _labelHeight;
            var rect           = new CGRect(_xMargin, _yCurr, _contentWidth, _labelHeight);
            var filmTitleLabel = ControlsFactory.NewStandardLabel(rect, UseTitleBackground);

            filmTitleLabel.StringValue = _film.Title;
            filmTitleLabel.Font        = NSFont.BoldSystemFontOfSize(NSFont.SystemFontSize);
            View.AddSubview(filmTitleLabel);

            // Set sample view used to disable resizing.
            _sampleView = filmTitleLabel;
        }
コード例 #4
0
        private void CreateFilmFanLabels()
        {
            _yCurr -= _labelHeight;
            var xCurr = _xMargin + _labelWidth + _xBetweenControls;
            var rect  = new CGRect(xCurr, _yCurr, _labelWidth, _labelHeight);

            foreach (var fan in ScreeningInfo.FilmFans)
            {
                var fanLabel = ControlsFactory.NewStandardLabel(rect, true);
                fanLabel.StringValue = fan;
                fanLabel.Font        = NSFont.BoldSystemFontOfSize(NSFont.SystemFontSize);
                View.AddSubview(fanLabel);
                xCurr += _controlWidth + _xBetweenControls;
                rect.X = xCurr;
            }
        }
コード例 #5
0
        public static void DisplayScreeningControls(
            List <Screening> screenings,
            NSView screeningsView,
            GoToScreeningDelegate goToScreening,
            ref FilmScreeningControl currentScreeningControl)
        {
            // Initialize the dictionary to find labels by screening.
            _labelByfilmScreening = new Dictionary <Screening, NSTextField> {
            };

            // Initialize dimensions.
            var xLabel       = _buttonWidth + _xBetweenLabels;
            var yScreening   = screeningsView.Frame.Height;
            var contentWidth = screeningsView.Frame.Width;
            var buttonRect   = new CGRect(0, yScreening, _buttonWidth, _labelHeight);
            var labelRect    = new CGRect(xLabel, yScreening, contentWidth - xLabel, _labelHeight);

            foreach (var screening in screenings)
            {
                // Update the vertical position.
                yScreening -= _labelHeight;

                // Create the screening info button.
                buttonRect.Y = yScreening;
                var infoButton = new FilmScreeningControl(buttonRect, screening);
                infoButton.ReDraw();
                infoButton.ScreeningInfoAsked += (sender, e) => goToScreening(screening);
                if (screening == _app.Controller.CurrentScreening)
                {
                    currentScreeningControl          = infoButton;
                    currentScreeningControl.Selected = true;
                }
                screeningsView.AddSubview(infoButton);

                // Create the screening label.
                labelRect.Y = yScreening;
                var screeningLabel = ControlsFactory.NewStandardLabel(labelRect);
                screeningLabel.StringValue = screening.ToFilmScreeningLabelString();
                ColorView.SetScreeningColor(screening, screeningLabel);
                screeningsView.AddSubview(screeningLabel);

                // Link the label to the screening.
                _labelByfilmScreening.Add(screening, screeningLabel);

                yScreening -= _yBetweenLabels;
            }
        }
コード例 #6
0
        private void CreateAllDaysCheckboxes()
        {
            _yCurr -= _labelHeight;

            // Create a label indicating that the checkboxes in this row apply
            // to all festival days.
            var labelRect = new CGRect(_xMargin, _yCurr, _labelWidth, _labelHeight);
            var label     = ControlsFactory.NewStandardLabel(labelRect, true);

            label.StringValue = $"All {FestivalDays.Count} days";
            View.AddSubview(label);

            // Create a checkbox for each film fan.
            var xBox      = _xMargin + _labelWidth + _xBetweenControls;
            var boxAnchor = new CGPoint(xBox, _yCurr);

            CreateFilmFanCheckboxes(View, boxAnchor, FestivalDays, false);
        }
コード例 #7
0
        private void CreatePerDayCheckboxes()
        {
            // Create the document view.
            var n              = FestivalDays.Count;
            var documentWidth  = View.Frame.Width - 2 * _xMargin;
            var documentHeight = n * _labelHeight + (n - 1) * _yBetweenLabels;
            var documentFrame  = new CGRect(0, 0, documentWidth, documentHeight);
            var documentView   = new NSView(documentFrame);

            // Create the scroll view.
            var scrollerHeight = _yCurr - _yControlsMargin - _controlHeight - _yBetweenControls;

            _yCurr -= scrollerHeight;
            var scrollerFrame = new CGRect(_xMargin, _yCurr, documentWidth, scrollerHeight);
            var scrollerView  = ControlsFactory.NewStandardScrollView(scrollerFrame, documentView, true);

            View.AddSubview(scrollerView);

            // Populate the document view.
            var yCurr     = documentView.Frame.Height - _labelHeight;
            var labelRect = new CGRect(0, yCurr, _labelWidth, _labelHeight);

            foreach (var day in FestivalDays)
            {
                // Create the day label.
                var label = ControlsFactory.NewStandardLabel(labelRect, true);
                label.StringValue = Screening.LongDayString(day);
                documentView.AddSubview(label);

                // Create the film fan checkboxes.
                var xCurr        = _labelWidth + _xBetweenControls;
                var daySingleton = new List <DateTime> {
                    day
                };
                CreateFilmFanCheckboxes(documentView, new CGPoint(xCurr, yCurr), daySingleton);

                // Update the vertical position.
                yCurr      -= _labelHeight + _yBetweenLabels;
                labelRect.Y = yCurr;
            }

            // Set sample view used to disable resizing.
            _sampleView = scrollerView;
        }
コード例 #8
0
        private void CreateScrollView()
        {
            // Create the document view displaying information on unplanned films.
            var docRect = new CGRect(0, 0, _scrollViewWidth, _scrollViewHeight);

            _filmsDocumentView             = ControlsFactory.NewStandardLabel(docRect, true);
            _filmsDocumentView.StringValue = InstructionsString();

            // Create the scroll view.
            var scrollViewFrame = new CGRect(_xMargin, _yScrollView, _scrollViewWidth, _scrollViewHeight);

            _filmsScrollView = ControlsFactory.NewStandardScrollView(scrollViewFrame, _filmsDocumentView, true);
            View.AddSubview(_filmsScrollView);

            // Scroll to the instruction text.
            var yScroll = _filmsDocumentView.Frame.Height - _filmsScrollView.Frame.Height;

            _filmsScrollView.ContentView.ScrollToPoint(new CGPoint(0, yScroll));
        }
コード例 #9
0
        private void PopulateTitlesDocumentView()
        {
            // Define dimensions.
            nfloat radioButtonWidth = _titlesDocumentView.Frame.Width - 2 * _xMargin - _xDistance - _labelWidth;
            nfloat xLabel           = _titlesDocumentView.Frame.Width - _xMargin - _labelWidth;

            // Create a vertical list of radiobuttons.
            nfloat yCurr = _titlesDocumentView.Frame.Height;

            foreach (var filmIndex in _filmIndexes)
            {
                // Add an item to the film id list.
                Film film = Presentor.GetFilmByIndex(filmIndex);
                _filmIds.Add(film.FilmId);

                // Adjust the vertical position with control height.
                yCurr -= _controlsHeight;

                // Create a radio button for the film title.
                CGRect   radioButtonRect  = new CGRect(_xMargin, yCurr, radioButtonWidth, _controlsHeight);
                NSButton titleRadioButton = new NSButton(radioButtonRect);
                titleRadioButton.SetButtonType(NSButtonType.Radio);
                titleRadioButton.Action = new ObjCRuntime.Selector("MainTitleChanged:");
                titleRadioButton.State  = film.FilmId == _mainFilmId ? NSCellStateValue.On : NSCellStateValue.Off;
                titleRadioButton.Tag    = film.FilmId;
                titleRadioButton.Title  = film.Title;
                _titlesDocumentView.AddSubview(titleRadioButton);

                // Create a label for the rating.
                CGRect      labelRect   = new CGRect(xLabel, yCurr, _labelWidth, _controlsHeight);
                NSTextField ratingLabel = ControlsFactory.NewStandardLabel(labelRect);
                ratingLabel.Alignment   = NSTextAlignment.Right;
                ratingLabel.StringValue = Presentor.GetFilmByIndex(filmIndex).Rating.ToString();
                _titlesDocumentView.AddSubview(ratingLabel);

                // Ajust the vertical position with the distance between two controls.
                yCurr -= _yControlsDistance;
            }
        }