1 /* 2 * Copyright 2010, Haiku, Inc. 3 * Copyright 2006, Ingo Weinhold <bonefish@cs.tu-berlin.de>. 4 * All rights reserved. Distributed under the terms of the MIT License. 5 */ 6 7 8 #include <GroupView.h> 9 10 11 BGroupView::BGroupView(enum orientation orientation, float spacing) 12 : 13 BView(NULL, 0, new BGroupLayout(orientation, spacing)) 14 { 15 SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 16 } 17 18 19 BGroupView::BGroupView(const char* name, enum orientation orientation, 20 float spacing) 21 : 22 BView(name, 0, new BGroupLayout(orientation, spacing)) 23 { 24 SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 25 } 26 27 28 BGroupView::BGroupView(BMessage* from) 29 : 30 BView(from) 31 { 32 } 33 34 35 BGroupView::~BGroupView() 36 { 37 } 38 39 40 void 41 BGroupView::SetLayout(BLayout* layout) 42 { 43 // only BGroupLayouts are allowed 44 if (!dynamic_cast<BGroupLayout*>(layout)) 45 return; 46 47 BView::SetLayout(layout); 48 } 49 50 51 BArchivable* 52 BGroupView::Instantiate(BMessage* from) 53 { 54 if (validate_instantiation(from, "BGroupView")) 55 return new BGroupView(from); 56 return NULL; 57 } 58 59 60 BGroupLayout* 61 BGroupView::GroupLayout() const 62 { 63 return dynamic_cast<BGroupLayout*>(GetLayout()); 64 } 65