From a0897d14011f8b5d2cc09e2d9218327eb0f0d5d5 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann Date: Sun, 5 Jun 2022 11:53:41 -0500 Subject: [PATCH] Improve dragger hiding, replicant sizing --- src/MainWindow.cpp | 6 +++--- src/ReplicantView.cpp | 16 ++++++++++++++-- src/ReplicantView.h | 2 ++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 8333733..378a6a0 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -31,13 +31,13 @@ MainWindow::_InitInterface() BView* controlsView = new BView("Controls", B_WILL_DRAW); BLayoutBuilder::Group<>(controlsView, B_VERTICAL) - .Add(new VolumeView(BRect(BPoint(0,0), BSize(200.0, 20.0)))) + .Add(new VolumeView(BRect(BPoint(0,0), BSize(100.0, 20.0)))) .AddGlue() .End(); BTabView* tabView = new BTabView("appletTabView"); - tabView->AddTab(new LyricsView(BRect(BPoint(0,0), BSize(300.0, 200.0)))); - tabView->AddTab(new CoverView(BRect(BPoint(0,0), BSize(300.0, 200.0)))); + tabView->AddTab(new LyricsView(BRect(BPoint(0,0), BSize(100.0, 100.0)))); + tabView->AddTab(new CoverView(BRect(BPoint(0,0), BSize(100.0, 100.0)))); tabView->AddTab(controlsView); BLayoutBuilder::Group<>(this, B_VERTICAL, 0.0f) diff --git a/src/ReplicantView.cpp b/src/ReplicantView.cpp index dc69183..077eea4 100644 --- a/src/ReplicantView.cpp +++ b/src/ReplicantView.cpp @@ -29,7 +29,7 @@ ReplicantView::ReplicantView(BRect frame, const char* name, uint32 draggerPlacem fDragger->SetViewColor(B_TRANSPARENT_COLOR); AddChild(fDragger); - fTransparentInactivity = true; + fTransparentInactivity = false; fTransparentDragger = false; fInactive = true; @@ -110,6 +110,15 @@ ReplicantView::MouseDown(BPoint where) } +void +ReplicantView::Show() +{ + BView::Show(); + if (!IsHidden()) + SetInactive(fInactive); +} + + BPopUpMenu* ReplicantView::RightClickPopUp(BPopUpMenu* menu) { @@ -140,10 +149,13 @@ ReplicantView::SetInactive(bool inactive) { fInactive = inactive; + if (IsHidden()) + return; + if (inactive && fTransparentInactivity) if (!fDragger->IsHidden() && fTransparentDragger) fDragger->Hide(); - if (fDragger->IsHidden() && (!fTransparentDragger || !fTransparentInactivity)) + if (fDragger->IsHidden() && (!inactive || !fTransparentDragger || !fTransparentInactivity)) fDragger->Show(); Invalidate(); diff --git a/src/ReplicantView.h b/src/ReplicantView.h index cc3d885..f833f42 100644 --- a/src/ReplicantView.h +++ b/src/ReplicantView.h @@ -45,6 +45,8 @@ public: virtual void MouseDown(BPoint where); + void Show(); + // Populates the given menu with default items virtual BPopUpMenu* RightClickPopUp(BPopUpMenu* menu = NULL);