Draw a nice menu background on the inline scroll view and when scroll faster when you push control/option/command and click the little arrow button.
This commit is contained in:
@@ -170,17 +170,17 @@ TBarMenuBar::RemoveSeperatorItem()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TBarMenuBar::Draw(BRect rect)
|
TBarMenuBar::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
// want to skip the fancy BMenuBar drawing code.
|
// want to skip the fancy BMenuBar drawing code.
|
||||||
BMenu::Draw(rect);
|
BMenu::Draw(updateRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TBarMenuBar::DrawBackground(BRect rect)
|
TBarMenuBar::DrawBackground(BRect updateRect)
|
||||||
{
|
{
|
||||||
BMenu::DrawBackground(rect);
|
BMenu::DrawBackground(updateRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -741,14 +741,14 @@ TExpandoMenuBar::MenuLayout() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TExpandoMenuBar::Draw(BRect update)
|
TExpandoMenuBar::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
BMenu::Draw(update);
|
BMenu::Draw(updateRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TExpandoMenuBar::DrawBackground(BRect)
|
TExpandoMenuBar::DrawBackground(BRect updateRect)
|
||||||
{
|
{
|
||||||
if (fVertical)
|
if (fVertical)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -146,11 +146,23 @@ UpScrollArrow::MouseDown(BPoint where)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
TInlineScrollView* parent = dynamic_cast<TInlineScrollView*>(Parent());
|
TInlineScrollView* parent = dynamic_cast<TInlineScrollView*>(Parent());
|
||||||
|
if (parent == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
if (parent != NULL) {
|
float smallStep;
|
||||||
parent->ScrollBy(-kDefaultScrollStep);
|
float largeStep;
|
||||||
snooze(5000);
|
parent->GetSteps(&smallStep, &largeStep);
|
||||||
}
|
|
||||||
|
BMessage* message = Window()->CurrentMessage();
|
||||||
|
int32 modifiers = 0;
|
||||||
|
message->FindInt32("modifiers", &modifiers);
|
||||||
|
// pressing the option/command/control key scrolls faster
|
||||||
|
if ((modifiers & (B_OPTION_KEY | B_COMMAND_KEY | B_CONTROL_KEY)) != 0)
|
||||||
|
parent->ScrollBy(-largeStep);
|
||||||
|
else
|
||||||
|
parent->ScrollBy(-smallStep);
|
||||||
|
|
||||||
|
snooze(5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -200,11 +212,23 @@ DownScrollArrow::MouseDown(BPoint where)
|
|||||||
|
|
||||||
TInlineScrollView* grandparent
|
TInlineScrollView* grandparent
|
||||||
= dynamic_cast<TInlineScrollView*>(Parent()->Parent());
|
= dynamic_cast<TInlineScrollView*>(Parent()->Parent());
|
||||||
|
if (grandparent == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
if (grandparent != NULL) {
|
float smallStep;
|
||||||
grandparent->ScrollBy(kDefaultScrollStep);
|
float largeStep;
|
||||||
snooze(5000);
|
grandparent->GetSteps(&smallStep, &largeStep);
|
||||||
}
|
|
||||||
|
BMessage* message = Window()->CurrentMessage();
|
||||||
|
int32 modifiers = 0;
|
||||||
|
message->FindInt32("modifiers", &modifiers);
|
||||||
|
// pressing the option/command/control key scrolls faster
|
||||||
|
if ((modifiers & (B_OPTION_KEY | B_COMMAND_KEY | B_CONTROL_KEY)) != 0)
|
||||||
|
grandparent->ScrollBy(largeStep);
|
||||||
|
else
|
||||||
|
grandparent->ScrollBy(smallStep);
|
||||||
|
|
||||||
|
snooze(5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -251,11 +275,23 @@ LeftScrollArrow::MouseDown(BPoint where)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
TInlineScrollView* parent = dynamic_cast<TInlineScrollView*>(Parent());
|
TInlineScrollView* parent = dynamic_cast<TInlineScrollView*>(Parent());
|
||||||
|
if (parent == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
if (parent != NULL) {
|
float smallStep;
|
||||||
parent->ScrollBy(-kDefaultScrollStep);
|
float largeStep;
|
||||||
snooze(5000);
|
parent->GetSteps(&smallStep, &largeStep);
|
||||||
}
|
|
||||||
|
BMessage* message = Window()->CurrentMessage();
|
||||||
|
int32 modifiers = 0;
|
||||||
|
message->FindInt32("modifiers", &modifiers);
|
||||||
|
// pressing the option/command/control key scrolls faster
|
||||||
|
if ((modifiers & (B_OPTION_KEY | B_COMMAND_KEY | B_CONTROL_KEY)) != 0)
|
||||||
|
parent->ScrollBy(-largeStep);
|
||||||
|
else
|
||||||
|
parent->ScrollBy(-smallStep);
|
||||||
|
|
||||||
|
snooze(5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -304,11 +340,23 @@ RightScrollArrow::MouseDown(BPoint where)
|
|||||||
|
|
||||||
TInlineScrollView* grandparent
|
TInlineScrollView* grandparent
|
||||||
= dynamic_cast<TInlineScrollView*>(Parent()->Parent());
|
= dynamic_cast<TInlineScrollView*>(Parent()->Parent());
|
||||||
|
if (grandparent == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
if (grandparent != NULL) {
|
float smallStep;
|
||||||
grandparent->ScrollBy(kDefaultScrollStep);
|
float largeStep;
|
||||||
snooze(5000);
|
grandparent->GetSteps(&smallStep, &largeStep);
|
||||||
}
|
|
||||||
|
BMessage* message = Window()->CurrentMessage();
|
||||||
|
int32 modifiers = 0;
|
||||||
|
message->FindInt32("modifiers", &modifiers);
|
||||||
|
// pressing the option/command/control key scrolls faster
|
||||||
|
if ((modifiers & (B_OPTION_KEY | B_COMMAND_KEY | B_CONTROL_KEY)) != 0)
|
||||||
|
grandparent->ScrollBy(largeStep);
|
||||||
|
else
|
||||||
|
grandparent->ScrollBy(smallStep);
|
||||||
|
|
||||||
|
snooze(5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -318,7 +366,7 @@ RightScrollArrow::MouseDown(BPoint where)
|
|||||||
TInlineScrollView::TInlineScrollView(BRect frame, BView* target,
|
TInlineScrollView::TInlineScrollView(BRect frame, BView* target,
|
||||||
enum orientation orientation)
|
enum orientation orientation)
|
||||||
:
|
:
|
||||||
BView(frame, "inline scroll view", B_FOLLOW_NONE, 0),
|
BView(frame, "inline scroll view", B_FOLLOW_NONE, B_WILL_DRAW),
|
||||||
fTarget(target),
|
fTarget(target),
|
||||||
fBeginScrollArrow(NULL),
|
fBeginScrollArrow(NULL),
|
||||||
fEndScrollArrow(NULL),
|
fEndScrollArrow(NULL),
|
||||||
@@ -375,6 +423,15 @@ TInlineScrollView::DetachedFromWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TInlineScrollView::Draw(BRect updateRect)
|
||||||
|
{
|
||||||
|
BRect frame = Bounds();
|
||||||
|
be_control_look->DrawButtonBackground(this, frame, updateRect,
|
||||||
|
ui_color(B_MENU_BACKGROUND_COLOR));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
@@ -481,7 +538,8 @@ TInlineScrollView::DetachScrollers()
|
|||||||
bool
|
bool
|
||||||
TInlineScrollView::HasScrollers() const
|
TInlineScrollView::HasScrollers() const
|
||||||
{
|
{
|
||||||
return fTarget != NULL && fBeginScrollArrow != NULL && fEndScrollArrow != NULL;
|
return fTarget != NULL && fBeginScrollArrow != NULL
|
||||||
|
&& fEndScrollArrow != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -498,10 +556,7 @@ TInlineScrollView::GetSteps(float* _smallStep, float* _largeStep) const
|
|||||||
if (_smallStep != NULL)
|
if (_smallStep != NULL)
|
||||||
*_smallStep = fScrollStep;
|
*_smallStep = fScrollStep;
|
||||||
if (_largeStep != NULL) {
|
if (_largeStep != NULL) {
|
||||||
if (fTarget != NULL)
|
*_largeStep = fScrollStep * 3;
|
||||||
*_largeStep = fTarget->Frame().Height() - fScrollStep;
|
|
||||||
else
|
|
||||||
*_largeStep = fScrollStep * 2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ public:
|
|||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void DetachedFromWindow();
|
virtual void DetachedFromWindow();
|
||||||
|
|
||||||
|
virtual void Draw(BRect updateRect);
|
||||||
|
|
||||||
void AttachScrollers();
|
void AttachScrollers();
|
||||||
void DetachScrollers();
|
void DetachScrollers();
|
||||||
bool HasScrollers() const;
|
bool HasScrollers() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user