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 #include <binary_compatibility/Interface.h> 10 11 12 namespace BPrivate { 13 14 15 BControlLook::BControlLook() 16 : 17 fCachedWorkspace(-1) 18 { 19 } 20 21 22 BControlLook::~BControlLook() 23 { 24 } 25 26 27 float 28 BControlLook::ComposeSpacing(float spacing) 29 { 30 switch ((int)spacing) { 31 case B_USE_DEFAULT_SPACING: 32 case B_USE_ITEM_SPACING: 33 return be_control_look->DefaultItemSpacing(); 34 case B_USE_HALF_ITEM_SPACING: 35 return ceilf(be_control_look->DefaultItemSpacing() * 0.5f); 36 case B_USE_WINDOW_SPACING: 37 return be_control_look->DefaultItemSpacing(); 38 case B_USE_SMALL_SPACING: 39 return ceilf(be_control_look->DefaultItemSpacing() * 0.7f); 40 case B_USE_BIG_SPACING: 41 return ceilf(be_control_look->DefaultItemSpacing() * 1.3f); 42 } 43 44 return spacing; 45 } 46 47 48 void 49 BControlLook::DrawLabel(BView* view, const char* label, const BBitmap* icon, 50 BRect rect, const BRect& updateRect, const rgb_color& base, uint32 flags, 51 const rgb_color* textColor) 52 { 53 DrawLabel(view, label, icon, rect, updateRect, base, flags, 54 DefaultLabelAlignment(), textColor); 55 } 56 57 58 void 59 BControlLook::GetInsets(frame_type frameType, background_type backgroundType, 60 uint32 flags, float& _left, float& _top, float& _right, float& _bottom) 61 { 62 GetFrameInsets(frameType, flags, _left, _top, _right, _bottom); 63 64 float left, top, right, bottom; 65 GetBackgroundInsets(backgroundType, flags, left, top, right, bottom); 66 67 _left += left; 68 _top += top; 69 _right += right; 70 _bottom += bottom; 71 } 72 73 74 void 75 BControlLook::SetBackgroundInfo(const BMessage& backgroundInfo) 76 { 77 fBackgroundInfo = backgroundInfo; 78 fCachedWorkspace = -1; 79 } 80 81 82 extern "C" void 83 B_IF_GCC_2(_ReservedControlLook1__Q28BPrivate12BControlLook, 84 _ZN8BPrivate12BControlLook21_ReservedControlLook1Ev)( 85 BControlLook* controlLook, BView* view, BRect& rect, 86 const BRect& updateRect, const rgb_color& base, uint32 flags, 87 uint32 borders, border_style borderStyle, uint32 side) 88 { 89 controlLook->DrawTabFrame(view, rect, updateRect, base, flags, borders, 90 borderStyle, side); 91 } 92 93 94 void BControlLook::_ReservedControlLook2() {} 95 void BControlLook::_ReservedControlLook3() {} 96 void BControlLook::_ReservedControlLook4() {} 97 void BControlLook::_ReservedControlLook5() {} 98 void BControlLook::_ReservedControlLook6() {} 99 void BControlLook::_ReservedControlLook7() {} 100 void BControlLook::_ReservedControlLook8() {} 101 void BControlLook::_ReservedControlLook9() {} 102 void BControlLook::_ReservedControlLook10() {} 103 104 105 // Initialized in InterfaceDefs.cpp 106 BControlLook* be_control_look = NULL; 107 108 } // namespace BPrivate 109