* cleanup
* fixed SetViewColor() - I have no idea why it compiled before * changed SetHidden() to make less of a difference between the top view and other views, the clipping is now always rebuilt git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17527 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -119,7 +119,7 @@ ViewLayer::ViewLayer(BRect frame, BPoint scrollingOffset, const char* name,
|
|||||||
fDrawState->SetSubPixelPrecise(fFlags & B_SUBPIXEL_PRECISE);
|
fDrawState->SetSubPixelPrecise(fFlags & B_SUBPIXEL_PRECISE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
|
||||||
ViewLayer::~ViewLayer()
|
ViewLayer::~ViewLayer()
|
||||||
{
|
{
|
||||||
if (fViewBitmap != NULL)
|
if (fViewBitmap != NULL)
|
||||||
@@ -144,7 +144,7 @@ ViewLayer::~ViewLayer()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bounds
|
|
||||||
BRect
|
BRect
|
||||||
ViewLayer::Bounds() const
|
ViewLayer::Bounds() const
|
||||||
{
|
{
|
||||||
@@ -154,7 +154,7 @@ ViewLayer::Bounds() const
|
|||||||
return bounds;
|
return bounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConvertToVisibleInTopView
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToVisibleInTopView(BRect* bounds) const
|
ViewLayer::ConvertToVisibleInTopView(BRect* bounds) const
|
||||||
{
|
{
|
||||||
@@ -166,7 +166,7 @@ ViewLayer::ConvertToVisibleInTopView(BRect* bounds) const
|
|||||||
fParent->ConvertToVisibleInTopView(bounds);
|
fParent->ConvertToVisibleInTopView(bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// AttachedToWindow
|
|
||||||
void
|
void
|
||||||
ViewLayer::AttachedToWindow(WindowLayer* window)
|
ViewLayer::AttachedToWindow(WindowLayer* window)
|
||||||
{
|
{
|
||||||
@@ -186,7 +186,6 @@ ViewLayer::AttachedToWindow(WindowLayer* window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// DetachedFromWindow
|
|
||||||
void
|
void
|
||||||
ViewLayer::DetachedFromWindow()
|
ViewLayer::DetachedFromWindow()
|
||||||
{
|
{
|
||||||
@@ -200,7 +199,10 @@ ViewLayer::DetachedFromWindow()
|
|||||||
child->DetachedFromWindow();
|
child->DetachedFromWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddChild
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::AddChild(ViewLayer* layer)
|
ViewLayer::AddChild(ViewLayer* layer)
|
||||||
{
|
{
|
||||||
@@ -341,7 +343,7 @@ ViewLayer::TopLayer()
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CountChildren
|
|
||||||
uint32
|
uint32
|
||||||
ViewLayer::CountChildren(bool deep) const
|
ViewLayer::CountChildren(bool deep) const
|
||||||
{
|
{
|
||||||
@@ -355,7 +357,7 @@ ViewLayer::CountChildren(bool deep) const
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CollectTokensForChildren
|
|
||||||
void
|
void
|
||||||
ViewLayer::CollectTokensForChildren(BList* tokenMap) const
|
ViewLayer::CollectTokensForChildren(BList* tokenMap) const
|
||||||
{
|
{
|
||||||
@@ -365,7 +367,7 @@ ViewLayer::CollectTokensForChildren(BList* tokenMap) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ViewAt
|
|
||||||
ViewLayer*
|
ViewLayer*
|
||||||
ViewLayer::ViewAt(const BPoint& where, BRegion* windowContentClipping)
|
ViewLayer::ViewAt(const BPoint& where, BRegion* windowContentClipping)
|
||||||
{
|
{
|
||||||
@@ -384,6 +386,16 @@ ViewLayer::ViewAt(const BPoint& where, BRegion* windowContentClipping)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ViewLayer::SetName(const char* string)
|
||||||
|
{
|
||||||
|
fName.SetTo(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::SetFlags(uint32 flags)
|
ViewLayer::SetFlags(uint32 flags)
|
||||||
{
|
{
|
||||||
@@ -537,6 +549,9 @@ ViewLayer::UpdateOverlay()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToParent(BPoint* point) const
|
ViewLayer::ConvertToParent(BPoint* point) const
|
||||||
{
|
{
|
||||||
@@ -545,7 +560,7 @@ ViewLayer::ConvertToParent(BPoint* point) const
|
|||||||
point->y += fFrame.top - fScrollingOffset.y;
|
point->y += fFrame.top - fScrollingOffset.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConvertToParent
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToParent(BRect* rect) const
|
ViewLayer::ConvertToParent(BRect* rect) const
|
||||||
{
|
{
|
||||||
@@ -554,7 +569,7 @@ ViewLayer::ConvertToParent(BRect* rect) const
|
|||||||
fFrame.top - fScrollingOffset.y);
|
fFrame.top - fScrollingOffset.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConvertToParent
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToParent(BRegion* region) const
|
ViewLayer::ConvertToParent(BRegion* region) const
|
||||||
{
|
{
|
||||||
@@ -563,7 +578,7 @@ ViewLayer::ConvertToParent(BRegion* region) const
|
|||||||
fFrame.top - fScrollingOffset.y);
|
fFrame.top - fScrollingOffset.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConvertFromParent
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertFromParent(BPoint* point) const
|
ViewLayer::ConvertFromParent(BPoint* point) const
|
||||||
{
|
{
|
||||||
@@ -572,7 +587,7 @@ ViewLayer::ConvertFromParent(BPoint* point) const
|
|||||||
point->y += fScrollingOffset.y - fFrame.top;
|
point->y += fScrollingOffset.y - fFrame.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConvertFromParent
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertFromParent(BRect* rect) const
|
ViewLayer::ConvertFromParent(BRect* rect) const
|
||||||
{
|
{
|
||||||
@@ -581,7 +596,7 @@ ViewLayer::ConvertFromParent(BRect* rect) const
|
|||||||
fScrollingOffset.y - fFrame.top);
|
fScrollingOffset.y - fFrame.top);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConvertFromParent
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertFromParent(BRegion* region) const
|
ViewLayer::ConvertFromParent(BRegion* region) const
|
||||||
{
|
{
|
||||||
@@ -698,13 +713,6 @@ ViewLayer::ConvertFromScreenForDrawing(BPoint* point) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ViewLayer::SetName(const char* string)
|
|
||||||
{
|
|
||||||
fName.SetTo(string);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
@@ -780,7 +788,7 @@ ViewLayer::MoveBy(int32 x, int32 y, BRegion* dirtyRegion)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResizeBy
|
|
||||||
void
|
void
|
||||||
ViewLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
|
ViewLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
|
||||||
{
|
{
|
||||||
@@ -843,7 +851,7 @@ ViewLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
|
|||||||
RebuildClipping(false);
|
RebuildClipping(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParentResized
|
|
||||||
void
|
void
|
||||||
ViewLayer::ParentResized(int32 x, int32 y, BRegion* dirtyRegion)
|
ViewLayer::ParentResized(int32 x, int32 y, BRegion* dirtyRegion)
|
||||||
{
|
{
|
||||||
@@ -862,7 +870,7 @@ ViewLayer::ParentResized(int32 x, int32 y, BRegion* dirtyRegion)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScrollBy
|
|
||||||
void
|
void
|
||||||
ViewLayer::ScrollBy(int32 x, int32 y, BRegion* dirtyRegion)
|
ViewLayer::ScrollBy(int32 x, int32 y, BRegion* dirtyRegion)
|
||||||
{
|
{
|
||||||
@@ -1190,21 +1198,21 @@ ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
|
|||||||
void
|
void
|
||||||
ViewLayer::MouseDown(BMessage* message, BPoint where)
|
ViewLayer::MouseDown(BMessage* message, BPoint where)
|
||||||
{
|
{
|
||||||
// empty hook methods
|
// empty hook method
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::MouseUp(BMessage* message, BPoint where)
|
ViewLayer::MouseUp(BMessage* message, BPoint where)
|
||||||
{
|
{
|
||||||
// empty hook methods
|
// empty hook method
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::MouseMoved(BMessage* message, BPoint where)
|
ViewLayer::MouseMoved(BMessage* message, BPoint where)
|
||||||
{
|
{
|
||||||
// empty hook methods
|
// empty hook method
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1218,13 +1226,15 @@ ViewLayer::SetHidden(bool hidden)
|
|||||||
fHidden = hidden;
|
fHidden = hidden;
|
||||||
|
|
||||||
// recurse into children and update their visible flag
|
// recurse into children and update their visible flag
|
||||||
if (fParent) {
|
|
||||||
bool oldVisible = fVisible;
|
bool oldVisible = fVisible;
|
||||||
UpdateVisibleDeep(fParent->IsVisible());
|
UpdateVisibleDeep(fParent ? fParent->IsVisible() : !fHidden);
|
||||||
if (oldVisible != fVisible) {
|
if (oldVisible != fVisible) {
|
||||||
// Include or exclude us from the parent area, and update the
|
// Include or exclude us from the parent area, and update the
|
||||||
// children's clipping as well when the view will be visible
|
// children's clipping as well when the view will be visible
|
||||||
fParent->RebuildClipping(!hidden);
|
if (fParent)
|
||||||
|
fParent->RebuildClipping(fVisible);
|
||||||
|
else
|
||||||
|
RebuildClipping(fVisible);
|
||||||
|
|
||||||
if (fWindow) {
|
if (fWindow) {
|
||||||
// trigger a redraw
|
// trigger a redraw
|
||||||
@@ -1238,20 +1248,17 @@ ViewLayer::SetHidden(bool hidden)
|
|||||||
fWindow->RecycleRegion(dirty);
|
fWindow->RecycleRegion(dirty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
UpdateVisibleDeep(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsHidden
|
|
||||||
bool
|
bool
|
||||||
ViewLayer::IsHidden() const
|
ViewLayer::IsHidden() const
|
||||||
{
|
{
|
||||||
return fHidden;
|
return fHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateVisibleDeep
|
|
||||||
void
|
void
|
||||||
ViewLayer::UpdateVisibleDeep(bool parentVisible)
|
ViewLayer::UpdateVisibleDeep(bool parentVisible)
|
||||||
{
|
{
|
||||||
@@ -1273,7 +1280,10 @@ ViewLayer::UpdateVisibleDeep(bool parentVisible)
|
|||||||
overlay->Hide();
|
overlay->Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarkBackgroundDirty
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::MarkBackgroundDirty()
|
ViewLayer::MarkBackgroundDirty()
|
||||||
{
|
{
|
||||||
@@ -1282,7 +1292,7 @@ ViewLayer::MarkBackgroundDirty()
|
|||||||
child->MarkBackgroundDirty();
|
child->MarkBackgroundDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddTokensForLayersInRegion
|
|
||||||
void
|
void
|
||||||
ViewLayer::AddTokensForLayersInRegion(BMessage* message,
|
ViewLayer::AddTokensForLayersInRegion(BMessage* message,
|
||||||
BRegion& region,
|
BRegion& region,
|
||||||
@@ -1299,7 +1309,7 @@ ViewLayer::AddTokensForLayersInRegion(BMessage* message,
|
|||||||
windowContentClipping);
|
windowContentClipping);
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddTokensForLayersInRegion
|
|
||||||
void
|
void
|
||||||
ViewLayer::AddTokensForLayersInRegion(BPrivate::PortLink& link,
|
ViewLayer::AddTokensForLayersInRegion(BPrivate::PortLink& link,
|
||||||
BRegion& region,
|
BRegion& region,
|
||||||
@@ -1316,7 +1326,7 @@ ViewLayer::AddTokensForLayersInRegion(BPrivate::PortLink& link,
|
|||||||
windowContentClipping);
|
windowContentClipping);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrintToStream
|
|
||||||
void
|
void
|
||||||
ViewLayer::PrintToStream() const
|
ViewLayer::PrintToStream() const
|
||||||
{
|
{
|
||||||
@@ -1340,7 +1350,7 @@ ViewLayer::PrintToStream() const
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// RebuildClipping
|
|
||||||
void
|
void
|
||||||
ViewLayer::RebuildClipping(bool deep)
|
ViewLayer::RebuildClipping(bool deep)
|
||||||
{
|
{
|
||||||
@@ -1375,7 +1385,7 @@ ViewLayer::RebuildClipping(bool deep)
|
|||||||
fScreenClippingValid = false;
|
fScreenClippingValid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScreenClipping
|
|
||||||
BRegion&
|
BRegion&
|
||||||
ViewLayer::ScreenClipping(BRegion* windowContentClipping, bool force) const
|
ViewLayer::ScreenClipping(BRegion* windowContentClipping, bool force) const
|
||||||
{
|
{
|
||||||
@@ -1405,7 +1415,7 @@ ViewLayer::ScreenClipping(BRegion* windowContentClipping, bool force) const
|
|||||||
return fScreenClipping;
|
return fScreenClipping;
|
||||||
}
|
}
|
||||||
|
|
||||||
// InvalidateScreenClipping
|
|
||||||
void
|
void
|
||||||
ViewLayer::InvalidateScreenClipping(bool deep)
|
ViewLayer::InvalidateScreenClipping(bool deep)
|
||||||
{
|
{
|
||||||
@@ -1418,7 +1428,7 @@ ViewLayer::InvalidateScreenClipping(bool deep)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// _MoveScreenClipping
|
|
||||||
void
|
void
|
||||||
ViewLayer::_MoveScreenClipping(int32 x, int32 y, bool deep)
|
ViewLayer::_MoveScreenClipping(int32 x, int32 y, bool deep)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,10 +40,6 @@ class ViewLayer {
|
|||||||
|
|
||||||
virtual ~ViewLayer();
|
virtual ~ViewLayer();
|
||||||
|
|
||||||
void SetName(const char* string);
|
|
||||||
const char* Name() const
|
|
||||||
{ return fName.String(); }
|
|
||||||
|
|
||||||
int32 Token() const
|
int32 Token() const
|
||||||
{ return fToken; }
|
{ return fToken; }
|
||||||
|
|
||||||
@@ -53,9 +49,14 @@ class ViewLayer {
|
|||||||
|
|
||||||
void SetResizeMode(uint32 resizeMode)
|
void SetResizeMode(uint32 resizeMode)
|
||||||
{ fResizeMode = resizeMode; }
|
{ fResizeMode = resizeMode; }
|
||||||
|
|
||||||
|
void SetName(const char* string);
|
||||||
|
const char* Name() const
|
||||||
|
{ return fName.String(); }
|
||||||
|
|
||||||
|
void SetFlags(uint32 flags);
|
||||||
uint32 Flags() const
|
uint32 Flags() const
|
||||||
{ return fFlags; }
|
{ return fFlags; }
|
||||||
void SetFlags(uint32 flags);
|
|
||||||
|
|
||||||
BPoint ScrollingOffset() const;
|
BPoint ScrollingOffset() const;
|
||||||
|
|
||||||
@@ -141,6 +142,8 @@ class ViewLayer {
|
|||||||
{ return fViewColor; }
|
{ return fViewColor; }
|
||||||
void SetViewColor(const RGBColor& color)
|
void SetViewColor(const RGBColor& color)
|
||||||
{ fViewColor = color; }
|
{ fViewColor = color; }
|
||||||
|
void SetViewColor(const rgb_color& color)
|
||||||
|
{ fViewColor = color; }
|
||||||
|
|
||||||
ServerBitmap* ViewBitmap() const
|
ServerBitmap* ViewBitmap() const
|
||||||
{ return fViewBitmap; }
|
{ return fViewBitmap; }
|
||||||
|
|||||||
Reference in New Issue
Block a user