Improve dragger hiding, replicant sizing

This commit is contained in:
Jaidyn Ann 2022-06-05 11:53:41 -05:00
parent a6877e0385
commit a0897d1401
3 changed files with 19 additions and 5 deletions

View File

@ -31,13 +31,13 @@ MainWindow::_InitInterface()
BView* controlsView = new BView("Controls", B_WILL_DRAW); BView* controlsView = new BView("Controls", B_WILL_DRAW);
BLayoutBuilder::Group<>(controlsView, B_VERTICAL) 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() .AddGlue()
.End(); .End();
BTabView* tabView = new BTabView("appletTabView"); BTabView* tabView = new BTabView("appletTabView");
tabView->AddTab(new LyricsView(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(300.0, 200.0)))); tabView->AddTab(new CoverView(BRect(BPoint(0,0), BSize(100.0, 100.0))));
tabView->AddTab(controlsView); tabView->AddTab(controlsView);
BLayoutBuilder::Group<>(this, B_VERTICAL, 0.0f) BLayoutBuilder::Group<>(this, B_VERTICAL, 0.0f)

View File

@ -29,7 +29,7 @@ ReplicantView::ReplicantView(BRect frame, const char* name, uint32 draggerPlacem
fDragger->SetViewColor(B_TRANSPARENT_COLOR); fDragger->SetViewColor(B_TRANSPARENT_COLOR);
AddChild(fDragger); AddChild(fDragger);
fTransparentInactivity = true; fTransparentInactivity = false;
fTransparentDragger = false; fTransparentDragger = false;
fInactive = true; fInactive = true;
@ -110,6 +110,15 @@ ReplicantView::MouseDown(BPoint where)
} }
void
ReplicantView::Show()
{
BView::Show();
if (!IsHidden())
SetInactive(fInactive);
}
BPopUpMenu* BPopUpMenu*
ReplicantView::RightClickPopUp(BPopUpMenu* menu) ReplicantView::RightClickPopUp(BPopUpMenu* menu)
{ {
@ -140,10 +149,13 @@ ReplicantView::SetInactive(bool inactive)
{ {
fInactive = inactive; fInactive = inactive;
if (IsHidden())
return;
if (inactive && fTransparentInactivity) if (inactive && fTransparentInactivity)
if (!fDragger->IsHidden() && fTransparentDragger) if (!fDragger->IsHidden() && fTransparentDragger)
fDragger->Hide(); fDragger->Hide();
if (fDragger->IsHidden() && (!fTransparentDragger || !fTransparentInactivity)) if (fDragger->IsHidden() && (!inactive || !fTransparentDragger || !fTransparentInactivity))
fDragger->Show(); fDragger->Show();
Invalidate(); Invalidate();

View File

@ -45,6 +45,8 @@ public:
virtual void MouseDown(BPoint where); virtual void MouseDown(BPoint where);
void Show();
// Populates the given menu with default items // Populates the given menu with default items
virtual BPopUpMenu* RightClickPopUp(BPopUpMenu* menu = NULL); virtual BPopUpMenu* RightClickPopUp(BPopUpMenu* menu = NULL);