2006-08-26 20:21:15 +04:00
|
|
|
/*
|
2010-07-20 12:24:19 +04:00
|
|
|
* Copyright 2006-2010, Haiku, Inc. All rights reserved.
|
2006-08-26 20:21:15 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _SPLIT_VIEW_H
|
|
|
|
#define _SPLIT_VIEW_H
|
|
|
|
|
|
|
|
#include <View.h>
|
|
|
|
|
|
|
|
class BSplitLayout;
|
|
|
|
|
|
|
|
|
|
|
|
class BSplitView : public BView {
|
|
|
|
public:
|
|
|
|
BSplitView(
|
2009-08-27 15:12:41 +04:00
|
|
|
enum orientation orientation
|
|
|
|
= B_HORIZONTAL,
|
2010-09-03 02:58:24 +04:00
|
|
|
float spacing = B_USE_DEFAULT_SPACING);
|
2010-07-20 12:24:19 +04:00
|
|
|
BSplitView(BMessage* from);
|
2006-08-26 20:21:15 +04:00
|
|
|
virtual ~BSplitView();
|
|
|
|
|
2009-06-23 14:56:22 +04:00
|
|
|
void SetInsets(float left, float top, float right,
|
|
|
|
float bottom);
|
2009-08-27 15:12:41 +04:00
|
|
|
void GetInsets(float* left, float* top,
|
|
|
|
float* right, float* bottom) const;
|
2009-06-23 14:56:22 +04:00
|
|
|
|
2006-08-26 20:21:15 +04:00
|
|
|
float Spacing() const;
|
|
|
|
void SetSpacing(float spacing);
|
|
|
|
|
|
|
|
orientation Orientation() const;
|
|
|
|
void SetOrientation(enum orientation orientation);
|
|
|
|
|
|
|
|
float SplitterSize() const;
|
|
|
|
void SetSplitterSize(float size);
|
|
|
|
|
2011-01-01 15:08:49 +03:00
|
|
|
float ItemWeight(int32 index) const;
|
|
|
|
float ItemWeight(BLayoutItem* item) const;
|
|
|
|
void SetItemWeight(int32 index, float weight,
|
|
|
|
bool invalidateLayout);
|
|
|
|
void SetItemWeight(BLayoutItem* item, float weight);
|
2006-08-26 20:21:15 +04:00
|
|
|
|
|
|
|
void SetCollapsible(bool collapsible);
|
|
|
|
void SetCollapsible(int32 index, bool collapsible);
|
|
|
|
void SetCollapsible(int32 first, int32 last,
|
|
|
|
bool collapsible);
|
|
|
|
|
|
|
|
// void AddChild(BView* child);
|
|
|
|
void AddChild(BView* child, BView* sibling = NULL);
|
|
|
|
bool AddChild(BView* child, float weight);
|
|
|
|
bool AddChild(int32 index, BView* child,
|
|
|
|
float weight);
|
|
|
|
|
|
|
|
bool AddChild(BLayoutItem* child);
|
|
|
|
bool AddChild(BLayoutItem* child, float weight);
|
|
|
|
bool AddChild(int32 index, BLayoutItem* child,
|
|
|
|
float weight);
|
|
|
|
|
|
|
|
virtual void Draw(BRect updateRect);
|
|
|
|
virtual void MouseDown(BPoint where);
|
|
|
|
virtual void MouseUp(BPoint where);
|
|
|
|
virtual void MouseMoved(BPoint where, uint32 transit,
|
|
|
|
const BMessage* message);
|
|
|
|
|
|
|
|
|
|
|
|
virtual void SetLayout(BLayout* layout);
|
|
|
|
// overridden to avoid use
|
|
|
|
|
2010-07-20 12:24:19 +04:00
|
|
|
virtual status_t Archive(BMessage* into, bool deep = true) const;
|
|
|
|
virtual status_t AllUnarchived(const BMessage* from);
|
|
|
|
static BArchivable* Instantiate(BMessage* from);
|
|
|
|
|
2006-08-26 20:21:15 +04:00
|
|
|
protected:
|
|
|
|
virtual void DrawSplitter(BRect frame,
|
2009-06-20 19:03:33 +04:00
|
|
|
const BRect& updateRect,
|
2009-08-27 15:12:41 +04:00
|
|
|
enum orientation orientation,
|
|
|
|
bool pressed);
|
2006-08-26 20:21:15 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
static void _DrawDefaultSplitter(BView* view, BRect frame,
|
2009-06-20 19:03:33 +04:00
|
|
|
const BRect& updateRect,
|
2009-08-27 15:12:41 +04:00
|
|
|
enum orientation orientation,
|
|
|
|
bool pressed);
|
2006-08-26 20:21:15 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
BSplitLayout* fSplitLayout;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _SPLIT_VIEW_H
|