1/*
2 * Copyright 2006, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef	_LAYOUT_UTILS_H
6#define	_LAYOUT_UTILS_H
7
8#include <Alignment.h>
9#include <Rect.h>
10#include <Size.h>
11
12class BView;
13
14class BLayoutUtils {
15public:
16//	static	float				AddSizesFloat(float a, float b);
17//	static	float				AddSizesFloat(float a, float b, float c);
18	static	float				AddDistances(float a, float b);
19	static	float				AddDistances(float a, float b, float c);
20	static	int32				AddSizesInt32(int32 a, int32 b);
21	static	int32				AddSizesInt32(int32 a, int32 b, int32 c);
22//	static	float				SubtractSizesFloat(float a, float b);
23	static	int32				SubtractSizesInt32(int32 a, int32 b);
24	static	float				SubtractDistances(float a, float b);
25
26	static	void				FixSizeConstraints(float& min, float& max,
27									float& preferred);
28	static	void				FixSizeConstraints(BSize& min, BSize& max,
29									BSize& preferred);
30
31	static	BSize				ComposeSize(BSize size, BSize layoutSize);
32	static	BAlignment			ComposeAlignment(BAlignment alignment,
33									BAlignment layoutAlignment);
34
35	static	BRect				AlignInFrame(BRect frame, BSize maxSize,
36									BAlignment alignment);
37	static	void				AlignInFrame(BView* view, BRect frame);
38	static	BRect				MoveIntoFrame(BRect rect, BSize frameSize);
39};
40
41#endif	//	_LAYOUT_UTILS_H
42