From b22232f591b9bfee56d2b8dceb35976cad4340a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 19 Nov 2003 14:56:32 +0000 Subject: [PATCH] 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 --- src/kits/interface/View.cpp | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index 6fae3218b7..4672db8a92 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -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??? - if ( owner && fShowLevel == 0){ +// "I don't think you want to do that" - axeld. + if (owner && fShowLevel == 0) { check_lock(); - - owner->session->WriteInt32( AS_LAYER_HIDE ); + + owner->session->WriteInt32(AS_LAYER_HIDE); } fShowLevel++; @@ -739,20 +742,37 @@ bool BView::IsFocus() const { //--------------------------------------------------------------------------- -bool BView::IsHidden() const{ +bool +BView::IsHidden(const BView *lookingFrom) const +{ if (fShowLevel > 0) return true; - if (owner) - if (owner->IsHidden()) - return true; + // may we be egocentric? + if (lookingFrom == this) + return false; + // we have the same visibility state as our + // parent, if there is one if (parent) 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; } + +bool +BView::IsHidden() const +{ + return IsHidden(NULL); +} + //--------------------------------------------------------------------------- bool BView::IsPrinting() const {