Implemented the missing BView::IsHidden(BView *lookingFrom), fixed

BView::IsHidden().
Commented a ToDo: item in BView::Hide().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5417 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2003-11-19 14:56:32 +00:00
parent a8d1f0c354
commit b22232f591
+28 -8
View File
@@ -702,12 +702,15 @@ BRect BView::Frame() const {
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void BView::Hide(){ void
BView::Hide()
{
// TODO: You may hide it by relocating with -17000 coord units to the left??? // TODO: You may hide it by relocating with -17000 coord units to the left???
if ( owner && fShowLevel == 0){ // "I don't think you want to do that" - axeld.
if (owner && fShowLevel == 0) {
check_lock(); check_lock();
owner->session->WriteInt32( AS_LAYER_HIDE ); owner->session->WriteInt32(AS_LAYER_HIDE);
} }
fShowLevel++; fShowLevel++;
@@ -739,20 +742,37 @@ bool BView::IsFocus() const {
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool BView::IsHidden() const{ bool
BView::IsHidden(const BView *lookingFrom) const
{
if (fShowLevel > 0) if (fShowLevel > 0)
return true; return true;
if (owner) // may we be egocentric?
if (owner->IsHidden()) if (lookingFrom == this)
return true; return false;
// we have the same visibility state as our
// parent, if there is one
if (parent) if (parent)
return parent->IsHidden(); return parent->IsHidden();
// if we're the top view, and we're interested
// in the "global" view, we're inheriting the
// state of the window's visibility
if (owner && lookingFrom == NULL)
return owner->IsHidden();
return false; return false;
} }
bool
BView::IsHidden() const
{
return IsHidden(NULL);
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool BView::IsPrinting() const { bool BView::IsPrinting() const {