1 /* 2 * Copyright 2006-2010, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _SPLIT_VIEW_H 6 #define _SPLIT_VIEW_H 7 8 #include <View.h> 9 10 class BSplitLayout; 11 12 13 class BSplitView : public BView { 14 public: 15 BSplitView( 16 enum orientation orientation 17 = B_HORIZONTAL, 18 float spacing = 0.0f); 19 BSplitView(BMessage* from); 20 virtual ~BSplitView(); 21 22 void SetInsets(float left, float top, float right, 23 float bottom); 24 void GetInsets(float* left, float* top, 25 float* right, float* bottom) const; 26 27 float Spacing() const; 28 void SetSpacing(float spacing); 29 30 orientation Orientation() const; 31 void SetOrientation(enum orientation orientation); 32 33 float SplitterSize() const; 34 void SetSplitterSize(float size); 35 36 37 void SetCollapsible(bool collapsible); 38 void SetCollapsible(int32 index, bool collapsible); 39 void SetCollapsible(int32 first, int32 last, 40 bool collapsible); 41 42 // void AddChild(BView* child); 43 void AddChild(BView* child, BView* sibling = NULL); 44 bool AddChild(BView* child, float weight); 45 bool AddChild(int32 index, BView* child, 46 float weight); 47 48 bool AddChild(BLayoutItem* child); 49 bool AddChild(BLayoutItem* child, float weight); 50 bool AddChild(int32 index, BLayoutItem* child, 51 float weight); 52 53 virtual void Draw(BRect updateRect); 54 virtual void MouseDown(BPoint where); 55 virtual void MouseUp(BPoint where); 56 virtual void MouseMoved(BPoint where, uint32 transit, 57 const BMessage* message); 58 59 60 virtual void SetLayout(BLayout* layout); 61 // overridden to avoid use 62 63 virtual status_t Archive(BMessage* into, bool deep = true) const; 64 virtual status_t AllUnarchived(const BMessage* from); 65 static BArchivable* Instantiate(BMessage* from); 66 67 protected: 68 virtual void DrawSplitter(BRect frame, 69 const BRect& updateRect, 70 enum orientation orientation, 71 bool pressed); 72 73 private: 74 static void _DrawDefaultSplitter(BView* view, BRect frame, 75 const BRect& updateRect, 76 enum orientation orientation, 77 bool pressed); 78 79 private: 80 BSplitLayout* fSplitLayout; 81 }; 82 83 84 #endif // _SPLIT_VIEW_H 85