void CaseViewShowAll(NSObject sender) { float fontSize = 13.0f; nfloat height = HeightWrappedToWidth(CaseTextField, fontSize); if (!isCaseViewExpand) { nfloat orgHeight = CaseTextField.Frame.Size.Height; nfloat offset = height - orgHeight; var oldSize = DescriptionView.Frame.Size; var newSize = new CGSize(oldSize.Width, caseViewHeight + offset); CaseView.SetFrameSize(newSize); var button = (NSButton)CaseView.Subviews [3]; NSAttributedString title = Utility.AttributeTitle("...less", Utility.ColorWithRGB(44, 117, 252, 1.0f), 12); button.Cell.AttributedTitle = title; isCaseViewExpand = true; } else { var oldSize = CaseView.Frame.Size; var newSize = new CGSize(oldSize.Width, caseViewHeight); CaseView.SetFrameSize(newSize); var button = (NSButton)CaseView.Subviews [3]; NSAttributedString title = Utility.AttributeTitle("...more", Utility.ColorWithRGB(44, 117, 252, 1.0f), 12); button.Cell.AttributedTitle = title; isCaseViewExpand = false; } LayoutSubViews(); }
//cases void InitializeCasesView() { if (isFTC) { CaseView.Hidden = false; } else { CaseView.Hidden = true; } if (BookInfo == null) { return; } float fontSize = 13.0f; string description = "What can you expect from your subscription to the new + Cases titles: \n" + "- The same great content you know and trust, automatically updated. \n" + "- Inclusion of new additional content from our unreported judgment \n" + " database: \n" + " - High value text cases chosen based on their high degree of \n" + " relevance to this title; \n" + " - Offline accessibility to this content within your Red title; \n" + " - Ability to link between the analytical and case content within \n" + " this title, and between your other Red titles; \n" + " - Use of Red’s award winning annotation, highlighting and legal \n" + " define features on the text cases within this title. \n" + "\n" + "Please don’t hesitate to contact your Relationship Manager should you have any questions or feedback regarding your subscription. "; CaseTextField.StringValue = description; caseViewHeight = CaseView.Frame.Size.Height; var height = HeightWrappedToWidth(CaseTextField, fontSize); if (height > TEXTVIEW_SIXLINE_HEIGHT) { NSButton moreButton = CreateMoreButton(); DescriptionView.WantsLayer = true; moreButton.Action = new Selector("CaseViewShowAll:"); moreButton.Target = this; CaseView.AddSubview(moreButton); isCaseViewExpand = false; } else { nfloat orgHeight = CaseTextField.Frame.Size.Height; nfloat offset = height - orgHeight; var oldSize = CaseView.Frame.Size; var newSize = new CGSize(oldSize.Width, caseViewHeight + offset); CaseView.SetFrameSize(newSize); } }