Add private BViewPort class

* It simplifies putting regular layout-aware views or layout items into
  a BScrollView.
* Not quite complete yet: Height-for-width support is missing, but that
  also requires fixing BScrollView in this respect. Scroll bar auto-hide
  support would be nice as well.
This commit is contained in:
Ingo Weinhold
2013-09-11 04:51:03 +02:00
parent 5c56812d90
commit 88f12ad84f
3 changed files with 360 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
/*
* Copyright 2013, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ingo Weinhold <[email protected]>
*/
#ifndef _VIEW_PORT_H
#define _VIEW_PORT_H
#include <View.h>
namespace BPrivate {
class BViewPort : public BView {
public:
BViewPort(BView* child = NULL);
BViewPort(BLayoutItem* child);
BViewPort(const char* name,
BView* child = NULL);
BViewPort(const char* name,
BLayoutItem* child);
virtual ~BViewPort();
BView* ChildView() const;
void SetChildView(BView* child);
BLayoutItem* ChildItem() const;
void SetChildItem(BLayoutItem* child);
private:
class ViewPortLayout;
friend class ViewPortLayout;
private:
void _Init();
private:
ViewPortLayout* fLayout;
BLayoutItem* fChild;
};
} // namespace BPrivate
using ::BPrivate::BViewPort;
#endif // _VIEW_PORT_H