Tracker: Fix issue with vertical scroll bar border

This issue only manifested itself when the navigation toolbar was shown.

The scrollbar appeared to have no border while the rest did. This issue
manifested when the scrollbar insets were adjusted in hrev49654. The
scroll bar insets were really hiding the bug underlying bug though.

I'll try to explain what was happening and how I fixed it. The PoseView
container, called BorderedView, was showing its top border when the
navigation bar was hidden, and hiding its top border when the navigation
bar was shown.  This (almost) worked because the menu bar provided a
bottom border while the navigation toolbar didn't. However hiding
BorderedView's top border also hid the scroll bar border.

My solution was to draw a bottom border on the navigation toolbar and
then remove the top border from BorderedView unconditionally. So either
the menu bar or the navigation toolbar provides a bottom border and the
BorderedView has no top border.

Fixes #12392
This commit is contained in:
John Scipione 2015-10-14 21:32:55 -07:00
parent e345b60486
commit e01bbf955f
3 changed files with 24 additions and 9 deletions

View File

@ -731,9 +731,7 @@ BContainerWindow::CreatePoseView(Model* model)
&& !fPoseView->IsFilePanel()) {
fNavigator = new BNavigator(model);
fPoseContainer->GridLayout()->AddView(fNavigator, 0, 0, 2);
if (settings.ShowNavigator())
fBorderedView->GroupLayout()->SetInsets(1);
else
if (!settings.ShowNavigator())
fNavigator->Hide();
}
@ -1618,8 +1616,6 @@ BContainerWindow::MessageReceived(BMessage* message)
fPoseContainer->GridLayout()->AddView(fNavigator,
0, 0, 2);
fNavigator->Hide();
fBorderedView->GroupLayout()->SetInsets(1, 0,
1, 1);
SetPathWatchingEnabled(settings.ShowNavigator()
|| settings.ShowFullPathInTitleBar());
}
@ -4072,8 +4068,6 @@ BContainerWindow::ShowNavigator(bool show)
if (PoseView()->VScrollBar())
PoseView()->UpdateScrollRange();
fBorderedView->GroupLayout()->SetInsets(1);
} else {
if (!Navigator() || Navigator()->IsHidden())
return;
@ -4082,7 +4076,6 @@ BContainerWindow::ShowNavigator(bool show)
PoseView()->UpdateScrollRange();
fNavigator->Hide();
fBorderedView->GroupLayout()->SetInsets(1, 0, 1, 1);
}
}

View File

@ -35,6 +35,7 @@ All rights reserved.
#include "Navigator.h"
#include <ControlLook.h>
#include <TextControl.h>
#include <Window.h>
@ -67,7 +68,12 @@ BNavigator::BNavigator(const Model* model)
new BMessage(kNavigatorCommandLocation));
fLocation->SetDivider(0);
GroupLayout()->SetInsets(0, 0, B_USE_HALF_ITEM_INSETS, 0);
GroupLayout()->SetInsets(0.0f, 0.0f, B_USE_HALF_ITEM_INSETS, 1.0f);
// 1px bottom inset used for border
// Needed to draw the bottom border
SetFlags(Flags() | B_WILL_DRAW);
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
}
@ -114,6 +120,21 @@ BNavigator::AllAttached()
}
void
BNavigator::Draw(BRect updateRect)
{
// Draw a 1px bottom border, like BMenuBar
BRect rect(Bounds());
rgb_color base = LowColor();
uint32 flags = 0;
be_control_look->DrawBorder(this, rect, updateRect, base,
B_PLAIN_BORDER, flags, BControlLook::B_BOTTOM_BORDER);
_inherited::Draw(rect & updateRect);
}
void
BNavigator::MessageReceived(BMessage* message)
{

View File

@ -76,6 +76,7 @@ protected:
virtual void MessageReceived(BMessage* msg);
virtual void AttachedToWindow();
virtual void AllAttached();
virtual void Draw(BRect updateRect);
void GoForward(bool option);
// is option key held down?