btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / kits / interface / ControlLook.cpp
blob3b0283fe5e6d98e010576e8c59d812895ccd5a7e
1 /*
2 * Copyright 2012-2017 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
7 #include <ControlLook.h>
10 namespace BPrivate {
13 BControlLook::BControlLook()
15 fCachedWorkspace(-1)
20 BControlLook::~BControlLook()
25 float
26 BControlLook::ComposeSpacing(float spacing)
28 switch ((int)spacing) {
29 case B_USE_DEFAULT_SPACING:
30 case B_USE_ITEM_SPACING:
31 return be_control_look->DefaultItemSpacing();
32 case B_USE_HALF_ITEM_SPACING:
33 return ceilf(be_control_look->DefaultItemSpacing() * 0.5f);
34 case B_USE_WINDOW_SPACING:
35 return be_control_look->DefaultItemSpacing();
36 case B_USE_SMALL_SPACING:
37 return ceilf(be_control_look->DefaultItemSpacing() * 0.7f);
38 case B_USE_BIG_SPACING:
39 return ceilf(be_control_look->DefaultItemSpacing() * 1.3f);
42 return spacing;
46 void
47 BControlLook::DrawLabel(BView* view, const char* label, const BBitmap* icon,
48 BRect rect, const BRect& updateRect, const rgb_color& base, uint32 flags,
49 const rgb_color* textColor)
51 DrawLabel(view, label, icon, rect, updateRect, base, flags,
52 DefaultLabelAlignment(), textColor);
56 void
57 BControlLook::GetInsets(frame_type frameType, background_type backgroundType,
58 uint32 flags, float& _left, float& _top, float& _right, float& _bottom)
60 GetFrameInsets(frameType, flags, _left, _top, _right, _bottom);
62 float left, top, right, bottom;
63 GetBackgroundInsets(backgroundType, flags, left, top, right, bottom);
65 _left += left;
66 _top += top;
67 _right += right;
68 _bottom += bottom;
72 void
73 BControlLook::SetBackgroundInfo(const BMessage& backgroundInfo)
75 fBackgroundInfo = backgroundInfo;
76 fCachedWorkspace = -1;
80 // NOTE: May come from a add-on in the future. Initialized in
81 // InterfaceDefs.cpp
82 BControlLook* be_control_look = NULL;
85 } // namespace BPrivate