[interfacekit] PATCH: BView::IsHidden()
- From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
- To: "OpenBeOS Interface Kit" <interfacekit@xxxxxxxxxxxxx>
- Date: Wed, 19 Nov 2003 07:26:44 +0100 CET
Hi,
I've added the missing BView::IsHidden(BView *lookingFrom) method, and
fixed the former BView::IsHidden() method.
I also couldn't resist and applied our style guide to those two methods
to let the idea of its existence grow in your mind (slowly but
steadily).
And, I commented one "ToDo:" item in BView::Hide(), too.
If you'd be okay, I'd happily commit the patch.
Bye,
Axel.
Index: View.cpp
===================================================================
RCS file: /cvsroot/open-beos/current/src/kits/interface/View.cpp,v
retrieving revision 1.11
diff -u -r1.11 View.cpp
--- View.cpp 10 Nov 2003 19:47:16 -0000 1.11
+++ View.cpp 19 Nov 2003 06:20:45 -0000
@@ -702,12 +702,15 @@
//---------------------------------------------------------------------------
-void BView::Hide(){
-// TODO: You may hide it by relocating with -17000 coord units to the left???
- if ( owner && fShowLevel == 0){
+void
+BView::Hide()
+{
+ // TODO: You may hide it by relocating with -17000 coord units to the
left???
+ // "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,18 +742,35 @@
//---------------------------------------------------------------------------
-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);
}
//---------------------------------------------------------------------------
- Follow-Ups:
- [interfacekit] Re: PATCH: BView::IsHidden()
- From: Adi Oanca
Other related posts:
- » [interfacekit] PATCH: BView::IsHidden()
- » [interfacekit] Re: PATCH: BView::IsHidden()
- » [interfacekit] Re: PATCH: BView::IsHidden()
- » [interfacekit] Re: PATCH: BView::IsHidden()
- » [interfacekit] Re: PATCH: BView::IsHidden()
- [interfacekit] Re: PATCH: BView::IsHidden()
- From: Adi Oanca