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 = B_USE_DEFAULT_SPACING); 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 float ItemWeight(int32 index) const; 37 float ItemWeight(BLayoutItem* item) const; 38 void SetItemWeight(int32 index, float weight, 39 bool invalidateLayout); 40 void SetItemWeight(BLayoutItem* item, float weight); 41 42 void SetCollapsible(bool collapsible); 43 void SetCollapsible(int32 index, bool collapsible); 44 void SetCollapsible(int32 first, int32 last, 45 bool collapsible); 46 47 // void AddChild(BView* child); 48 void AddChild(BView* child, BView* sibling = NULL); 49 bool AddChild(BView* child, float weight); 50 bool AddChild(int32 index, BView* child, 51 float weight); 52 53 bool AddChild(BLayoutItem* child); 54 bool AddChild(BLayoutItem* child, float weight); 55 bool AddChild(int32 index, BLayoutItem* child, 56 float weight); 57 58 virtual void Draw(BRect updateRect); 59 virtual void MouseDown(BPoint where); 60 virtual void MouseUp(BPoint where); 61 virtual void MouseMoved(BPoint where, uint32 transit, 62 const BMessage* message); 63 64 65 virtual void SetLayout(BLayout* layout); 66 // overridden to avoid use 67 68 virtual status_t Archive(BMessage* into, bool deep = true) const; 69 virtual status_t AllUnarchived(const BMessage* from); 70 static BArchivable* Instantiate(BMessage* from); 71 72 protected: 73 virtual void DrawSplitter(BRect frame, 74 const BRect& updateRect, 75 enum orientation orientation, 76 bool pressed); 77 78 private: 79 static void _DrawDefaultSplitter(BView* view, BRect frame, 80 const BRect& updateRect, 81 enum orientation orientation, 82 bool pressed); 83 84 private: 85 BSplitLayout* fSplitLayout; 86 }; 87 88 89 #endif // _SPLIT_VIEW_H 90