// constructor NavigationInfoPanel::NavigationInfoPanel(BWindow* parent, const BMessage& message, const BMessenger& target) : BWindow(BRect(0, 0, 200, 30), "Navigation Info", B_FLOATING_WINDOW_LOOK, B_FLOATING_SUBSET_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_V_RESIZABLE) , fMessage(message) , fTarget(target) { // create the interface and resize to fit BRect frame = Bounds(); frame.InsetBy(5, 5); frame.bottom = frame.top + 15; // label string view fLabelView = new BStringView(frame, "label", kLabel, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); fLabelView->ResizeToPreferred(); frame = fLabelView->Frame(); // target clip text control frame.OffsetBy(0, frame.Height() + 5); fTargetClipTC = new BTextControl(frame, "clip id", "Target Playlist ID", "", new BMessage(MSG_INVOKE), B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT); fTargetClipTC->ResizeToPreferred(); frame = fTargetClipTC->Frame(); // help string view frame.OffsetBy(0, frame.Height() + 5); BStringView* helpView = new BStringView(frame, "help", "Drag and drop a playlist clip here.", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); BFont font; helpView->GetFont(&font); font.SetFace(B_ITALIC_FACE); font.SetSize(font.Size() * 0.9); helpView->SetFont(&font); helpView->SetAlignment(B_ALIGN_CENTER); helpView->ResizeToPreferred(); // parent view frame = fLabelView->Frame() | fTargetClipTC->Frame() | helpView->Frame(); frame.InsetBy(-5, -5); fInfoView = new InfoView(frame, this); fInfoView->AddChild(fLabelView); fInfoView->AddChild(fTargetClipTC); fInfoView->AddChild(helpView); // resize to fit and adjust size limits ResizeTo(fInfoView->Frame().Width(), fInfoView->Frame().Height()); AddChild(fInfoView); float minWidth, maxWidth, minHeight, maxHeight; GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); minWidth = Frame().Width(); minHeight = maxHeight = Frame().Height(); SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight); // modify the high color after the help view is attached to a window helpView->SetHighColor(tint_color(helpView->LowColor(), B_DISABLED_LABEL_TINT)); helpView->SetFlags(helpView->Flags() | B_FULL_UPDATE_ON_RESIZE); // help the buggy BeOS BStringView (when text alignment != left...) fInfoView->SetEventMask(B_POINTER_EVENTS); // resize controls to the same (maximum) width float maxControlWidth = fLabelView->Frame().Width(); maxControlWidth = max_c(maxControlWidth, fTargetClipTC->Frame().Width()); maxControlWidth = max_c(maxControlWidth, helpView->Frame().Width()); fLabelView->ResizeTo(maxControlWidth, fLabelView->Frame().Height()); fTargetClipTC->ResizeTo(maxControlWidth, fTargetClipTC->Frame().Height()); helpView->ResizeTo(maxControlWidth, helpView->Frame().Height()); // center above parent window BAutolock _(parent); frame = Frame(); BRect parentFrame = parent->Frame(); MoveTo((parentFrame.left + parentFrame.right - frame.Width()) / 2, (parentFrame.top + parentFrame.bottom - frame.Height()) / 2); AddToSubset(parent); }