1 /* 2 * Copyright 2006, Ingo Weinhold <bonefish@cs.tu-berlin.de>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 6 #include <GridView.h> 7 8 9 // constructor 10 BGridView::BGridView(float horizontalSpacing, float verticalSpacing) 11 : BView(NULL, 0, new BGridLayout(horizontalSpacing, verticalSpacing)) 12 { 13 SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 14 } 15 16 // destructor 17 BGridView::~BGridView() 18 { 19 } 20 21 // SetLayout 22 void 23 BGridView::SetLayout(BLayout* layout) 24 { 25 // only BGridLayouts are allowed 26 if (!dynamic_cast<BGridLayout*>(layout)) 27 return; 28 29 BView::SetLayout(layout); 30 } 31 32 // GridLayout 33 BGridLayout* 34 BGridView::GridLayout() const 35 { 36 return dynamic_cast<BGridLayout*>(GetLayout()); 37 } 38