2006-08-26 20:21:15 +04:00
|
|
|
/*
|
2014-04-08 01:14:15 +04:00
|
|
|
* Copyright 2006-2014 Haiku, Inc. All rights reserved.
|
2006-08-26 20:21:15 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _LAYOUT_UTILS_H
|
|
|
|
#define _LAYOUT_UTILS_H
|
|
|
|
|
2013-09-11 06:46:36 +04:00
|
|
|
|
2006-08-26 20:21:15 +04:00
|
|
|
#include <Alignment.h>
|
|
|
|
#include <Rect.h>
|
|
|
|
#include <Size.h>
|
2013-09-11 06:46:36 +04:00
|
|
|
#include <String.h>
|
|
|
|
|
2006-08-26 20:21:15 +04:00
|
|
|
|
2013-09-11 06:46:36 +04:00
|
|
|
class BLayoutItem;
|
2006-08-26 20:21:15 +04:00
|
|
|
class BView;
|
|
|
|
|
2013-09-11 06:46:36 +04:00
|
|
|
|
2006-08-26 20:21:15 +04:00
|
|
|
class BLayoutUtils {
|
|
|
|
public:
|
|
|
|
// static float AddSizesFloat(float a, float b);
|
|
|
|
// static float AddSizesFloat(float a, float b, float c);
|
|
|
|
static float AddDistances(float a, float b);
|
|
|
|
static float AddDistances(float a, float b, float c);
|
|
|
|
static int32 AddSizesInt32(int32 a, int32 b);
|
|
|
|
static int32 AddSizesInt32(int32 a, int32 b, int32 c);
|
|
|
|
// static float SubtractSizesFloat(float a, float b);
|
|
|
|
static int32 SubtractSizesInt32(int32 a, int32 b);
|
|
|
|
static float SubtractDistances(float a, float b);
|
2007-06-09 03:14:48 +04:00
|
|
|
|
|
|
|
static void FixSizeConstraints(float& min, float& max,
|
|
|
|
float& preferred);
|
|
|
|
static void FixSizeConstraints(BSize& min, BSize& max,
|
|
|
|
BSize& preferred);
|
2010-11-19 14:29:52 +03:00
|
|
|
|
2006-08-26 20:21:15 +04:00
|
|
|
static BSize ComposeSize(BSize size, BSize layoutSize);
|
|
|
|
static BAlignment ComposeAlignment(BAlignment alignment,
|
|
|
|
BAlignment layoutAlignment);
|
|
|
|
|
|
|
|
static BRect AlignInFrame(BRect frame, BSize maxSize,
|
|
|
|
BAlignment alignment);
|
|
|
|
static void AlignInFrame(BView* view, BRect frame);
|
2014-04-08 01:14:15 +04:00
|
|
|
static BRect AlignOnRect(BRect rect, BSize size, BAlignment alignment);
|
2010-11-19 20:49:09 +03:00
|
|
|
static BRect MoveIntoFrame(BRect rect, BSize frameSize);
|
2013-09-11 06:46:36 +04:00
|
|
|
|
|
|
|
// debugging
|
|
|
|
static BString GetLayoutTreeDump(BView* view);
|
|
|
|
static BString GetLayoutTreeDump(BLayoutItem* item);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static void _GetLayoutTreeDump(BView* view, int level,
|
|
|
|
BString& _output);
|
|
|
|
static void _GetLayoutTreeDump(BLayoutItem* item,
|
|
|
|
int level, bool isViewLayout,
|
|
|
|
BString& _output);
|
2006-08-26 20:21:15 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _LAYOUT_UTILS_H
|