haiku/headers/os/interface/GridLayoutBuilder.h
Alex Wilson 82ab316723 Add default spacing for Layouts (#5614)
* introduce B_USE_DEFAULT_SPACING, which works somewhat like B_SIZE_UNSET and B_ALIGN_HORIZONTAL_UNSET
* introduce static float BControlLook::ComposeItemSpacing(float spacing), which checks uses be_control_look->DefaultItemSpacing().
* modify layouts to use BControlLook::ComposeItemSpacing() in SetInsets and SetSpacing methods.
* default insets are still 0, 0, 0, 0, but can be set to default spacing by passing B_USE_DEFAULT_SPACING
* I've found two regressions, patches incoming, please report others on #5614.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38512 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-02 22:58:24 +00:00

41 lines
1.2 KiB
C++

/*
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GRID_LAYOUT_BUILDER_H
#define _GRID_LAYOUT_BUILDER_H
#include <GridView.h>
class BGridLayoutBuilder {
public:
BGridLayoutBuilder(float horizontal
= B_USE_DEFAULT_SPACING,
float vertical = B_USE_DEFAULT_SPACING);
BGridLayoutBuilder(BGridLayout* layout);
BGridLayoutBuilder(BGridView* view);
BGridLayout* GridLayout() const;
BGridLayoutBuilder& GetGridLayout(BGridLayout** _layout);
BView* View() const;
BGridLayoutBuilder& GetView(BView** _view);
BGridLayoutBuilder& Add(BView* view, int32 column, int32 row,
int32 columnCount = 1, int32 rowCount = 1);
BGridLayoutBuilder& Add(BLayoutItem* item, int32 column, int32 row,
int32 columnCount = 1, int32 rowCount = 1);
BGridLayoutBuilder& SetColumnWeight(int32 column, float weight);
BGridLayoutBuilder& SetRowWeight(int32 row, float weight);
BGridLayoutBuilder& SetInsets(float left, float top, float right,
float bottom);
operator BGridLayout*();
private:
BGridLayout* fLayout;
};
#endif // _GRID_LAYOUT_BUILDER_H