private void RemoveExpiredInfoView()
        {
            ExpiredInfoView.RemoveFromSuperview();

            var scrollView     = TocTableView.EnclosingScrollView;
            var scrollViewSize = scrollView.Frame.Size;
            var superViewSize  = scrollView.Superview.Frame.Size;
            var newSize        = new CGSize(scrollViewSize.Width, superViewSize.Height);

            scrollView.SetFrameSize(newSize);
            var newPoint = new CGPoint(0, 0);

            scrollView.SetFrameOrigin(newPoint);
        }
示例#2
0
        void ReleaseDesignerOutlets()
        {
            if (TocTableView != null)
            {
                TocTableView.Dispose();
                TocTableView = null;
            }

            if (ExpiredInfoView != null)
            {
                ExpiredInfoView.Dispose();
                ExpiredInfoView = null;
            }
        }
        private void ShowExpiredInfoView()
        {
            foreach (var view in ExpiredInfoView.Subviews)
            {
                view.RemoveFromSuperview();
            }

            nfloat viewHeight    = LNRConstants.TOCITEMHEIGHT_MIN;
            nfloat tfHeight      = 17;
            var    scrollView    = TocTableView.EnclosingScrollView;
            var    superViewSize = scrollView.Superview.Frame.Size;
            nfloat scrollHeight  = superViewSize.Height - viewHeight;
            var    newSize       = new CGSize(scrollView.Frame.Width, scrollHeight);

            scrollView.SetFrameSize(newSize);
            var newPoint = new CGPoint(0, 0);

            scrollView.SetFrameOrigin(newPoint);

            var infoViewOrg = new CGPoint(0, newSize.Height);

            ExpiredInfoView.SetFrameOrigin(infoViewOrg);

            ExpiredInfoView.WantsLayer            = true;
            ExpiredInfoView.Layer.BackgroundColor = NSColor.Red.CGColor;

            CGRect frame     = ExpiredInfoView.Frame;
            var    expRect   = new CGRect(10, tfHeight + 5, frame.Width - 15, tfHeight);
            var    expiredTF = new NSTextField(expRect);

            expiredTF.Cell.Bordered        = false;
            expiredTF.Cell.Editable        = false;
            expiredTF.Cell.DrawsBackground = false;
            var attributtedTitle = Utility.AttributedTitle("Expired", NSColor.White, "System", 14, NSTextAlignment.Left);

            expiredTF.AttributedStringValue = attributtedTitle;
            expiredTF.AutoresizingMask      = NSViewResizingMask.MinXMargin | NSViewResizingMask.MaxYMargin;
            ExpiredInfoView.AddSubview(expiredTF);

            var dateRect = new CGRect(10, 5, frame.Width - 15, tfHeight);
            var dateTF   = new NSTextField(dateRect);

            dateTF.Cell.Bordered         = false;
            dateTF.Cell.Editable         = false;
            dateTF.Cell.DrawsBackground  = false;
            attributtedTitle             = Utility.AttributedTitle(CurrencyDate, NSColor.Grid, "System", 12, NSTextAlignment.Left);
            dateTF.AttributedStringValue = attributtedTitle;
            dateTF.AutoresizingMask      = NSViewResizingMask.MinXMargin | NSViewResizingMask.MaxYMargin;
            ExpiredInfoView.AddSubview(dateTF);

            var infoRect   = new CGRect(frame.Width - 60, 12, 50, 20);
            var infoButton = new NSButton(infoRect);

            infoButton.Cell.BezelStyle               = NSBezelStyle.ShadowlessSquare;
            infoButton.Cell.AttributedTitle          = Utility.AttributeTitle("Info", NSColor.White, 12);
            infoButton.Cell.AttributedAlternateTitle = Utility.AttributeTitle("Info", NSColor.Black, 12);
            infoButton.Cell.SetButtonType(NSButtonType.MomentaryPushIn);
            infoButton.Bordered = false;
            infoButton.ShowsBorderOnlyWhileMouseInside = true;
            infoButton.WantsLayer            = true;
            infoButton.Layer.BorderColor     = NSColor.White.CGColor;
            infoButton.Layer.BorderWidth     = 1;
            infoButton.Layer.CornerRadius    = 4;
            infoButton.Layer.BackgroundColor = NSColor.Red.CGColor;

            infoButton.Target = this;
            infoButton.Action = new ObjCRuntime.Selector("TitleInfoClick:");
            ExpiredInfoView.AddSubview(infoButton);

            View.AddSubview(ExpiredInfoView);
        }