Ticket #5525: gridView.patch
File gridView.patch, 2.1 KB (added by , 14 years ago) |
---|
-
headers/os/interface/GridView.h
1 1 /* 2 * Copyright 2006 , Haiku, Inc. All rights reserved.2 * Copyright 2006-2010, Haiku, Inc. All rights reserved. 3 3 * Distributed under the terms of the MIT License. 4 4 */ 5 5 #ifndef _GRID_VIEW_H … … 13 13 public: 14 14 BGridView(float horizontalSpacing = 0.0f, 15 15 float verticalSpacing = 0.0f); 16 BGridView(BMessage* from); 16 17 virtual ~BGridView(); 17 18 18 19 virtual void SetLayout(BLayout* layout); 20 BGridLayout* GridLayout() const; 19 21 20 BGridLayout* GridLayout() const;22 static BArchivable* Instantiate(BMessage* from); 21 23 }; 22 24 23 25 -
src/kits/interface/GridView.cpp
1 1 /* 2 * Copyright 2010, Haiku, Inc. 2 3 * Copyright 2006, Ingo Weinhold <bonefish@cs.tu-berlin.de>. 3 4 * All rights reserved. Distributed under the terms of the MIT License. 4 5 */ … … 6 7 #include <GridView.h> 7 8 8 9 9 // constructor 10 10 11 BGridView::BGridView(float horizontalSpacing, float verticalSpacing) 11 : BView(NULL, 0, new BGridLayout(horizontalSpacing, verticalSpacing)) 12 : 13 BView(NULL, 0, new BGridLayout(horizontalSpacing, verticalSpacing)) 12 14 { 13 15 SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 14 16 } 15 17 16 // destructor 18 19 BGridView::BGridView(BMessage* from) 20 : 21 BView(from) 22 { 23 } 24 25 17 26 BGridView::~BGridView() 18 27 { 19 28 } 20 29 21 // SetLayout 30 22 31 void 23 32 BGridView::SetLayout(BLayout* layout) 24 33 { 25 34 // only BGridLayouts are allowed 35 26 36 if (!dynamic_cast<BGridLayout*>(layout)) 27 37 return; 28 38 29 39 BView::SetLayout(layout); 30 40 } 31 41 32 // GridLayout 42 33 43 BGridLayout* 34 44 BGridView::GridLayout() const 35 45 { 36 46 return dynamic_cast<BGridLayout*>(GetLayout()); 37 47 } 48 49 50 BArchivable* 51 BGridView::Instantiate(BMessage* from) 52 { 53 if (validate_instantiation(from, "BGridView")) 54 return new BGridView(from); 55 return NULL; 56 } 57