Rename ScrollArrowView to InlineScrollView
InlineScrollView takes a BView instead of a BMenu as well, and it no longer has flags to do drawing respond to frame changes since this view does neither of those things.
This commit is contained in:
parent
e06f13f911
commit
32f840b768
|
@ -58,8 +58,8 @@ All rights reserved.
|
||||||
#include "DeskbarUtils.h"
|
#include "DeskbarUtils.h"
|
||||||
#include "ExpandoMenuBar.h"
|
#include "ExpandoMenuBar.h"
|
||||||
#include "FSUtils.h"
|
#include "FSUtils.h"
|
||||||
|
#include "InlineScrollView.h"
|
||||||
#include "ResourceSet.h"
|
#include "ResourceSet.h"
|
||||||
#include "ScrollArrowView.h"
|
|
||||||
#include "StatusView.h"
|
#include "StatusView.h"
|
||||||
#include "TeamMenuItem.h"
|
#include "TeamMenuItem.h"
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ BarViewMessageFilter::Filter(BMessage* message, BHandler** target)
|
||||||
TBarView::TBarView(BRect frame, bool vertical, bool left, bool top,
|
TBarView::TBarView(BRect frame, bool vertical, bool left, bool top,
|
||||||
uint32 state, float)
|
uint32 state, float)
|
||||||
: BView(frame, "BarView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW),
|
: BView(frame, "BarView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW),
|
||||||
fScrollArrowView(NULL),
|
fInlineScrollView(NULL),
|
||||||
fBarMenuBar(NULL),
|
fBarMenuBar(NULL),
|
||||||
fExpando(NULL),
|
fExpando(NULL),
|
||||||
fTrayLocation(1),
|
fTrayLocation(1),
|
||||||
|
@ -444,8 +444,8 @@ TBarView::PlaceTray(bool vertSwap, bool leftSwap)
|
||||||
void
|
void
|
||||||
TBarView::PlaceApplicationBar()
|
TBarView::PlaceApplicationBar()
|
||||||
{
|
{
|
||||||
if (fScrollArrowView != NULL)
|
if (fInlineScrollView != NULL)
|
||||||
fScrollArrowView->DetachScrollers();
|
fInlineScrollView->DetachScrollers();
|
||||||
|
|
||||||
if (fExpando != NULL) {
|
if (fExpando != NULL) {
|
||||||
SaveExpandedItems();
|
SaveExpandedItems();
|
||||||
|
@ -454,10 +454,10 @@ TBarView::PlaceApplicationBar()
|
||||||
fExpando = NULL;
|
fExpando = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fScrollArrowView != NULL) {
|
if (fInlineScrollView != NULL) {
|
||||||
fScrollArrowView->RemoveSelf();
|
fInlineScrollView->RemoveSelf();
|
||||||
delete fScrollArrowView;
|
delete fInlineScrollView;
|
||||||
fScrollArrowView = NULL;
|
fInlineScrollView = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BRect screenFrame = (BScreen(Window())).Frame();
|
BRect screenFrame = (BScreen(Window())).Frame();
|
||||||
|
@ -504,8 +504,8 @@ TBarView::PlaceApplicationBar()
|
||||||
fExpando = new TExpandoMenuBar(this, expandoFrame, "ExpandoMenuBar",
|
fExpando = new TExpandoMenuBar(this, expandoFrame, "ExpandoMenuBar",
|
||||||
fVertical, !hideLabels && fState != kFullState);
|
fVertical, !hideLabels && fState != kFullState);
|
||||||
|
|
||||||
fScrollArrowView = new TScrollArrowView(menuScrollFrame, fExpando);
|
fInlineScrollView = new TInlineScrollView(menuScrollFrame, fExpando);
|
||||||
AddChild(fScrollArrowView);
|
AddChild(fInlineScrollView);
|
||||||
|
|
||||||
if (fVertical)
|
if (fVertical)
|
||||||
ExpandItems();
|
ExpandItems();
|
||||||
|
@ -577,9 +577,9 @@ TBarView::SizeWindow(BRect screenFrame)
|
||||||
|
|
||||||
if (fExpando != NULL) {
|
if (fExpando != NULL) {
|
||||||
if (fExpando->CheckForSizeOverrun())
|
if (fExpando->CheckForSizeOverrun())
|
||||||
fScrollArrowView->AttachScrollers();
|
fInlineScrollView->AttachScrollers();
|
||||||
else
|
else
|
||||||
fScrollArrowView->DetachScrollers();
|
fInlineScrollView->DetachScrollers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ class TBarMenuBar;
|
||||||
class TExpandoMenuBar;
|
class TExpandoMenuBar;
|
||||||
class TReplicantTray;
|
class TReplicantTray;
|
||||||
class TDragRegion;
|
class TDragRegion;
|
||||||
class TScrollArrowView;
|
class TInlineScrollView;
|
||||||
class TTeamMenuItem;
|
class TTeamMenuItem;
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ class TBarView : public BView {
|
||||||
void ExpandItems();
|
void ExpandItems();
|
||||||
void _ChangeState(BMessage* message);
|
void _ChangeState(BMessage* message);
|
||||||
|
|
||||||
TScrollArrowView* fScrollArrowView;
|
TInlineScrollView* fInlineScrollView;
|
||||||
TBarMenuBar* fBarMenuBar;
|
TBarMenuBar* fBarMenuBar;
|
||||||
TExpandoMenuBar* fExpando;
|
TExpandoMenuBar* fExpando;
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,8 @@ All rights reserved.
|
||||||
#include "BarWindow.h"
|
#include "BarWindow.h"
|
||||||
#include "DeskbarMenu.h"
|
#include "DeskbarMenu.h"
|
||||||
#include "DeskbarUtils.h"
|
#include "DeskbarUtils.h"
|
||||||
|
#include "InlineScrollView.h"
|
||||||
#include "ResourceSet.h"
|
#include "ResourceSet.h"
|
||||||
#include "ScrollArrowView.h"
|
|
||||||
#include "ShowHideMenuItem.h"
|
#include "ShowHideMenuItem.h"
|
||||||
#include "StatusView.h"
|
#include "StatusView.h"
|
||||||
#include "TeamMenuItem.h"
|
#include "TeamMenuItem.h"
|
||||||
|
@ -269,14 +269,14 @@ TExpandoMenuBar::MessageReceived(BMessage* message)
|
||||||
if (deltaY == 0)
|
if (deltaY == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TScrollArrowView* scrollMenu
|
TInlineScrollView* scrollView
|
||||||
= dynamic_cast<TScrollArrowView*>(Parent());
|
= dynamic_cast<TInlineScrollView*>(Parent());
|
||||||
if (scrollMenu == NULL)
|
if (scrollView == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float largeStep;
|
float largeStep;
|
||||||
float smallStep;
|
float smallStep;
|
||||||
scrollMenu->GetSteps(&smallStep, &largeStep);
|
scrollView->GetSteps(&smallStep, &largeStep);
|
||||||
|
|
||||||
// pressing the option/command/control key scrolls faster
|
// pressing the option/command/control key scrolls faster
|
||||||
if (modifiers() & (B_OPTION_KEY | B_COMMAND_KEY | B_CONTROL_KEY))
|
if (modifiers() & (B_OPTION_KEY | B_COMMAND_KEY | B_CONTROL_KEY))
|
||||||
|
@ -284,7 +284,7 @@ TExpandoMenuBar::MessageReceived(BMessage* message)
|
||||||
else
|
else
|
||||||
deltaY *= smallStep;
|
deltaY *= smallStep;
|
||||||
|
|
||||||
scrollMenu->ScrollBy(deltaY);
|
scrollView->ScrollBy(deltaY);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "ScrollArrowView.h"
|
#include "InlineScrollView.h"
|
||||||
|
|
||||||
#include <ControlLook.h>
|
#include <ControlLook.h>
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
|
@ -125,7 +125,7 @@ UpScrollArrow::MouseDown(BPoint where)
|
||||||
if (!IsEnabled())
|
if (!IsEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TScrollArrowView* parent = dynamic_cast<TScrollArrowView*>(Parent());
|
TInlineScrollView* parent = dynamic_cast<TInlineScrollView*>(Parent());
|
||||||
|
|
||||||
if (parent != NULL) {
|
if (parent != NULL) {
|
||||||
parent->ScrollBy(-kDefaultScrollStep);
|
parent->ScrollBy(-kDefaultScrollStep);
|
||||||
|
@ -178,8 +178,8 @@ DownScrollArrow::MouseDown(BPoint where)
|
||||||
if (!IsEnabled())
|
if (!IsEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TScrollArrowView* grandparent
|
TInlineScrollView* grandparent
|
||||||
= dynamic_cast<TScrollArrowView*>(Parent()->Parent());
|
= dynamic_cast<TInlineScrollView*>(Parent()->Parent());
|
||||||
|
|
||||||
if (grandparent != NULL) {
|
if (grandparent != NULL) {
|
||||||
grandparent->ScrollBy(kDefaultScrollStep);
|
grandparent->ScrollBy(kDefaultScrollStep);
|
||||||
|
@ -191,10 +191,10 @@ DownScrollArrow::MouseDown(BPoint where)
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
TScrollArrowView::TScrollArrowView(BRect frame, BMenu* menu)
|
TInlineScrollView::TInlineScrollView(BRect frame, BView* target)
|
||||||
:
|
:
|
||||||
BView(frame, "menu scroll view", B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS),
|
BView(frame, "inline scroll view", B_FOLLOW_NONE, 0),
|
||||||
fMenu(menu),
|
fTarget(target),
|
||||||
fUpperScrollArrow(NULL),
|
fUpperScrollArrow(NULL),
|
||||||
fLowerScrollArrow(NULL),
|
fLowerScrollArrow(NULL),
|
||||||
fScrollStep(kDefaultScrollStep),
|
fScrollStep(kDefaultScrollStep),
|
||||||
|
@ -204,7 +204,7 @@ TScrollArrowView::TScrollArrowView(BRect frame, BMenu* menu)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TScrollArrowView::~TScrollArrowView()
|
TInlineScrollView::~TInlineScrollView()
|
||||||
{
|
{
|
||||||
if (fUpperScrollArrow != NULL) {
|
if (fUpperScrollArrow != NULL) {
|
||||||
fUpperScrollArrow->RemoveSelf();
|
fUpperScrollArrow->RemoveSelf();
|
||||||
|
@ -221,25 +221,25 @@ TScrollArrowView::~TScrollArrowView()
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TScrollArrowView::AttachedToWindow()
|
TInlineScrollView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
BView::AttachedToWindow();
|
BView::AttachedToWindow();
|
||||||
|
|
||||||
if (fMenu == NULL)
|
if (fTarget == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AddChild(fMenu);
|
AddChild(fTarget);
|
||||||
fMenu->MoveTo(0, 0);
|
fTarget->MoveTo(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TScrollArrowView::DetachedFromWindow()
|
TInlineScrollView::DetachedFromWindow()
|
||||||
{
|
{
|
||||||
BView::DetachedFromWindow();
|
BView::DetachedFromWindow();
|
||||||
|
|
||||||
if (fMenu != NULL)
|
if (fTarget != NULL)
|
||||||
fMenu->RemoveSelf();
|
fTarget->RemoveSelf();
|
||||||
|
|
||||||
if (fUpperScrollArrow != NULL)
|
if (fUpperScrollArrow != NULL)
|
||||||
fUpperScrollArrow->RemoveSelf();
|
fUpperScrollArrow->RemoveSelf();
|
||||||
|
@ -253,9 +253,9 @@ TScrollArrowView::DetachedFromWindow()
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TScrollArrowView::AttachScrollers()
|
TInlineScrollView::AttachScrollers()
|
||||||
{
|
{
|
||||||
if (fMenu == NULL)
|
if (fTarget == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BRect frame = Bounds();
|
BRect frame = Bounds();
|
||||||
|
@ -267,7 +267,7 @@ TScrollArrowView::AttachScrollers()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fMenu->MakeFocus(true);
|
fTarget->MakeFocus(true);
|
||||||
|
|
||||||
if (fUpperScrollArrow == NULL) {
|
if (fUpperScrollArrow == NULL) {
|
||||||
fUpperScrollArrow = new UpScrollArrow(
|
fUpperScrollArrow = new UpScrollArrow(
|
||||||
|
@ -279,10 +279,10 @@ TScrollArrowView::AttachScrollers()
|
||||||
fLowerScrollArrow = new DownScrollArrow(
|
fLowerScrollArrow = new DownScrollArrow(
|
||||||
BRect(0, frame.bottom - 2 * kScrollerHeight + 1, frame.right,
|
BRect(0, frame.bottom - 2 * kScrollerHeight + 1, frame.right,
|
||||||
frame.bottom - kScrollerHeight));
|
frame.bottom - kScrollerHeight));
|
||||||
fMenu->AddChild(fLowerScrollArrow);
|
fTarget->AddChild(fLowerScrollArrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
fMenu->MoveBy(0, kScrollerHeight);
|
fTarget->MoveBy(0, kScrollerHeight);
|
||||||
|
|
||||||
fUpperScrollArrow->SetEnabled(false);
|
fUpperScrollArrow->SetEnabled(false);
|
||||||
fLowerScrollArrow->SetEnabled(true);
|
fLowerScrollArrow->SetEnabled(true);
|
||||||
|
@ -294,7 +294,7 @@ TScrollArrowView::AttachScrollers()
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TScrollArrowView::DetachScrollers()
|
TInlineScrollView::DetachScrollers()
|
||||||
{
|
{
|
||||||
if (!HasScrollers())
|
if (!HasScrollers())
|
||||||
return;
|
return;
|
||||||
|
@ -311,38 +311,38 @@ TScrollArrowView::DetachScrollers()
|
||||||
fUpperScrollArrow = NULL;
|
fUpperScrollArrow = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fMenu) {
|
if (fTarget) {
|
||||||
// We don't remember the position where the last scrolling
|
// We don't remember the position where the last scrolling
|
||||||
// ended, so scroll back to the beginning.
|
// ended, so scroll back to the beginning.
|
||||||
fMenu->MoveBy(0, -kScrollerHeight);
|
fTarget->MoveBy(0, -kScrollerHeight);
|
||||||
fMenu->ScrollTo(0, 0);
|
fTarget->ScrollTo(0, 0);
|
||||||
fValue = 0;
|
fValue = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TScrollArrowView::HasScrollers() const
|
TInlineScrollView::HasScrollers() const
|
||||||
{
|
{
|
||||||
return fMenu != NULL && fUpperScrollArrow != NULL && fLowerScrollArrow != NULL;
|
return fTarget != NULL && fUpperScrollArrow != NULL && fLowerScrollArrow != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TScrollArrowView::SetSmallStep(float step)
|
TInlineScrollView::SetSmallStep(float step)
|
||||||
{
|
{
|
||||||
fScrollStep = step;
|
fScrollStep = step;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TScrollArrowView::GetSteps(float* _smallStep, float* _largeStep) const
|
TInlineScrollView::GetSteps(float* _smallStep, float* _largeStep) const
|
||||||
{
|
{
|
||||||
if (_smallStep != NULL)
|
if (_smallStep != NULL)
|
||||||
*_smallStep = fScrollStep;
|
*_smallStep = fScrollStep;
|
||||||
if (_largeStep != NULL) {
|
if (_largeStep != NULL) {
|
||||||
if (fMenu != NULL)
|
if (fTarget != NULL)
|
||||||
*_largeStep = fMenu->Frame().Height() - fScrollStep;
|
*_largeStep = fTarget->Frame().Height() - fScrollStep;
|
||||||
else
|
else
|
||||||
*_largeStep = fScrollStep * 2;
|
*_largeStep = fScrollStep * 2;
|
||||||
}
|
}
|
||||||
|
@ -350,7 +350,7 @@ TScrollArrowView::GetSteps(float* _smallStep, float* _largeStep) const
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TScrollArrowView::ScrollBy(const float& step)
|
TInlineScrollView::ScrollBy(const float& step)
|
||||||
{
|
{
|
||||||
if (!HasScrollers())
|
if (!HasScrollers())
|
||||||
return;
|
return;
|
||||||
|
@ -361,12 +361,12 @@ TScrollArrowView::ScrollBy(const float& step)
|
||||||
|
|
||||||
if (fValue + step >= fLimit) {
|
if (fValue + step >= fLimit) {
|
||||||
// If we reached the limit, only scroll to the end
|
// If we reached the limit, only scroll to the end
|
||||||
fMenu->ScrollBy(0, fLimit - fValue);
|
fTarget->ScrollBy(0, fLimit - fValue);
|
||||||
fLowerScrollArrow->MoveBy(0, fLimit - fValue);
|
fLowerScrollArrow->MoveBy(0, fLimit - fValue);
|
||||||
fLowerScrollArrow->SetEnabled(false);
|
fLowerScrollArrow->SetEnabled(false);
|
||||||
fValue = fLimit;
|
fValue = fLimit;
|
||||||
} else {
|
} else {
|
||||||
fMenu->ScrollBy(0, step);
|
fTarget->ScrollBy(0, step);
|
||||||
fLowerScrollArrow->MoveBy(0, step);
|
fLowerScrollArrow->MoveBy(0, step);
|
||||||
fValue += step;
|
fValue += step;
|
||||||
}
|
}
|
||||||
|
@ -375,12 +375,12 @@ TScrollArrowView::ScrollBy(const float& step)
|
||||||
fLowerScrollArrow->SetEnabled(true);
|
fLowerScrollArrow->SetEnabled(true);
|
||||||
|
|
||||||
if (fValue + step <= 0) {
|
if (fValue + step <= 0) {
|
||||||
fMenu->ScrollBy(0, -fValue);
|
fTarget->ScrollBy(0, -fValue);
|
||||||
fLowerScrollArrow->MoveBy(0, -fValue);
|
fLowerScrollArrow->MoveBy(0, -fValue);
|
||||||
fUpperScrollArrow->SetEnabled(false);
|
fUpperScrollArrow->SetEnabled(false);
|
||||||
fValue = 0;
|
fValue = 0;
|
||||||
} else {
|
} else {
|
||||||
fMenu->ScrollBy(0, step);
|
fTarget->ScrollBy(0, step);
|
||||||
fLowerScrollArrow->MoveBy(0, step);
|
fLowerScrollArrow->MoveBy(0, step);
|
||||||
fValue += step;
|
fValue += step;
|
||||||
}
|
}
|
|
@ -7,22 +7,21 @@
|
||||||
* Stefano Ceccherini (stefano.ceccherini@gmail.com)
|
* Stefano Ceccherini (stefano.ceccherini@gmail.com)
|
||||||
* John Scipione (jscipione@gmail.com)
|
* John Scipione (jscipione@gmail.com)
|
||||||
*/
|
*/
|
||||||
#ifndef SCROLL_ARROW_VIEW_H
|
#ifndef INLINE_SCROLL_VIEW_H
|
||||||
#define SCROLL_ARROW_VIEW_H
|
#define INLINE_SCROLL_VIEW_H
|
||||||
|
|
||||||
|
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
class BLayout;
|
class BLayout;
|
||||||
class BMenu;
|
|
||||||
class ScrollArrow;
|
class ScrollArrow;
|
||||||
class BPoint;
|
class BPoint;
|
||||||
|
|
||||||
|
|
||||||
class TScrollArrowView : public BView {
|
class TInlineScrollView : public BView {
|
||||||
public:
|
public:
|
||||||
TScrollArrowView(BRect frame, BMenu* menu);
|
TInlineScrollView(BRect frame, BView* target);
|
||||||
virtual ~TScrollArrowView();
|
virtual ~TInlineScrollView();
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void DetachedFromWindow();
|
virtual void DetachedFromWindow();
|
||||||
|
@ -36,7 +35,7 @@ public:
|
||||||
void ScrollBy(const float& step);
|
void ScrollBy(const float& step);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BMenu* fMenu;
|
BView* fTarget;
|
||||||
ScrollArrow* fUpperScrollArrow;
|
ScrollArrow* fUpperScrollArrow;
|
||||||
ScrollArrow* fLowerScrollArrow;
|
ScrollArrow* fLowerScrollArrow;
|
||||||
|
|
||||||
|
@ -46,4 +45,4 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // SCROLL_ARROW_VIEW_H
|
#endif // INLINE_SCROLL_VIEW_H
|
|
@ -27,8 +27,8 @@ Application Deskbar :
|
||||||
DeskbarMenu.cpp
|
DeskbarMenu.cpp
|
||||||
DeskbarUtils.cpp
|
DeskbarUtils.cpp
|
||||||
ExpandoMenuBar.cpp
|
ExpandoMenuBar.cpp
|
||||||
|
InlineScrollView.cpp
|
||||||
PreferencesWindow.cpp
|
PreferencesWindow.cpp
|
||||||
ScrollArrowView.cpp
|
|
||||||
ShowHideMenuItem.cpp
|
ShowHideMenuItem.cpp
|
||||||
StatusView.cpp
|
StatusView.cpp
|
||||||
StatusViewShelf.cpp
|
StatusViewShelf.cpp
|
||||||
|
|
Loading…
Reference in New Issue