1 /* 2 * Copyright 2012-2017 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include <ControlLook.h> 8 9 10 namespace BPrivate { 11 12 13 BControlLook::BControlLook() 14 : 15 fCachedWorkspace(-1) 16 { 17 } 18 19 20 BControlLook::~BControlLook() 21 { 22 } 23 24 25 float 26 BControlLook::ComposeSpacing(float spacing) 27 { 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); 40 } 41 42 return spacing; 43 } 44 45 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) 50 { 51 DrawLabel(view, label, icon, rect, updateRect, base, flags, 52 DefaultLabelAlignment(), textColor); 53 } 54 55 56 void 57 BControlLook::GetInsets(frame_type frameType, background_type backgroundType, 58 uint32 flags, float& _left, float& _top, float& _right, float& _bottom) 59 { 60 GetFrameInsets(frameType, flags, _left, _top, _right, _bottom); 61 62 float left, top, right, bottom; 63 GetBackgroundInsets(backgroundType, flags, left, top, right, bottom); 64 65 _left += left; 66 _top += top; 67 _right += right; 68 _bottom += bottom; 69 } 70 71 72 void 73 BControlLook::SetBackgroundInfo(const BMessage& backgroundInfo) 74 { 75 fBackgroundInfo = backgroundInfo; 76 fCachedWorkspace = -1; 77 } 78 79 80 void BControlLook::_ReservedControlLook1() {} 81 void BControlLook::_ReservedControlLook2() {} 82 void BControlLook::_ReservedControlLook3() {} 83 void BControlLook::_ReservedControlLook4() {} 84 void BControlLook::_ReservedControlLook5() {} 85 void BControlLook::_ReservedControlLook6() {} 86 void BControlLook::_ReservedControlLook7() {} 87 void BControlLook::_ReservedControlLook8() {} 88 void BControlLook::_ReservedControlLook9() {} 89 void BControlLook::_ReservedControlLook10() {} 90 91 92 // NOTE: May come from a add-on in the future. Initialized in 93 // InterfaceDefs.cpp 94 BControlLook* be_control_look = NULL; 95 96 97 } // namespace BPrivate 98