12f86ba45SStephan Aßmus /* 2db68ff23SAugustin Cavalier * Copyright 2012-2017 Haiku, Inc. All rights reserved. 32f86ba45SStephan Aßmus * Distributed under the terms of the MIT License. 42f86ba45SStephan Aßmus */ 5d452ff66SAxel Dörfler 6d452ff66SAxel Dörfler 72f86ba45SStephan Aßmus #include <ControlLook.h> 82f86ba45SStephan Aßmus 9*fb3493dfSJohn Scipione #include <binary_compatibility/Interface.h> 10*fb3493dfSJohn Scipione 11a884b43bSJohn Scipione 122f86ba45SStephan Aßmus namespace BPrivate { 132f86ba45SStephan Aßmus 14a884b43bSJohn Scipione 15db68ff23SAugustin Cavalier BControlLook::BControlLook() 16db68ff23SAugustin Cavalier : 17d63b75faSPhilippe Saint-Pierre fCachedWorkspace(-1) 182f86ba45SStephan Aßmus { 192f86ba45SStephan Aßmus } 202f86ba45SStephan Aßmus 212f86ba45SStephan Aßmus 222f86ba45SStephan Aßmus BControlLook::~BControlLook() 232f86ba45SStephan Aßmus { 242f86ba45SStephan Aßmus } 252f86ba45SStephan Aßmus 262f86ba45SStephan Aßmus 2782ab3167SAlex Wilson float 286648dd3cSAlex Wilson BControlLook::ComposeSpacing(float spacing) 2982ab3167SAlex Wilson { 30e047b40aSAxel Dörfler switch ((int)spacing) { 31e047b40aSAxel Dörfler case B_USE_DEFAULT_SPACING: 32e047b40aSAxel Dörfler case B_USE_ITEM_SPACING: 3382ab3167SAlex Wilson return be_control_look->DefaultItemSpacing(); 34e047b40aSAxel Dörfler case B_USE_HALF_ITEM_SPACING: 35a8b89c6bSStephan Aßmus return ceilf(be_control_look->DefaultItemSpacing() * 0.5f); 36e047b40aSAxel Dörfler case B_USE_WINDOW_SPACING: 376648dd3cSAlex Wilson return be_control_look->DefaultItemSpacing(); 38e047b40aSAxel Dörfler case B_USE_SMALL_SPACING: 39a8b89c6bSStephan Aßmus return ceilf(be_control_look->DefaultItemSpacing() * 0.7f); 40e047b40aSAxel Dörfler case B_USE_BIG_SPACING: 41a8b89c6bSStephan Aßmus return ceilf(be_control_look->DefaultItemSpacing() * 1.3f); 426648dd3cSAlex Wilson } 43e047b40aSAxel Dörfler 446648dd3cSAlex Wilson return spacing; 4582ab3167SAlex Wilson } 4682ab3167SAlex Wilson 4782ab3167SAlex Wilson 48d63b75faSPhilippe Saint-Pierre void 491b848ee7SIngo Weinhold BControlLook::DrawLabel(BView* view, const char* label, const BBitmap* icon, 507a96554cSlooncraz BRect rect, const BRect& updateRect, const rgb_color& base, uint32 flags, 517a96554cSlooncraz const rgb_color* textColor) 521b848ee7SIngo Weinhold { 531b848ee7SIngo Weinhold DrawLabel(view, label, icon, rect, updateRect, base, flags, 547a96554cSlooncraz DefaultLabelAlignment(), textColor); 551b848ee7SIngo Weinhold } 561b848ee7SIngo Weinhold 571b848ee7SIngo Weinhold 581b848ee7SIngo Weinhold void 598719e0dcSIngo Weinhold BControlLook::GetInsets(frame_type frameType, background_type backgroundType, 608719e0dcSIngo Weinhold uint32 flags, float& _left, float& _top, float& _right, float& _bottom) 618719e0dcSIngo Weinhold { 628719e0dcSIngo Weinhold GetFrameInsets(frameType, flags, _left, _top, _right, _bottom); 638719e0dcSIngo Weinhold 648719e0dcSIngo Weinhold float left, top, right, bottom; 658719e0dcSIngo Weinhold GetBackgroundInsets(backgroundType, flags, left, top, right, bottom); 668719e0dcSIngo Weinhold 678719e0dcSIngo Weinhold _left += left; 688719e0dcSIngo Weinhold _top += top; 698719e0dcSIngo Weinhold _right += right; 708719e0dcSIngo Weinhold _bottom += bottom; 718719e0dcSIngo Weinhold } 728719e0dcSIngo Weinhold 738719e0dcSIngo Weinhold 748719e0dcSIngo Weinhold void 75d452ff66SAxel Dörfler BControlLook::SetBackgroundInfo(const BMessage& backgroundInfo) 76d63b75faSPhilippe Saint-Pierre { 77d452ff66SAxel Dörfler fBackgroundInfo = backgroundInfo; 78d63b75faSPhilippe Saint-Pierre fCachedWorkspace = -1; 79d63b75faSPhilippe Saint-Pierre } 80d63b75faSPhilippe Saint-Pierre 81d63b75faSPhilippe Saint-Pierre 82*fb3493dfSJohn Scipione extern "C" void 83*fb3493dfSJohn Scipione B_IF_GCC_2(_ReservedControlLook1__Q28BPrivate12BControlLook, 84*fb3493dfSJohn Scipione _ZN8BPrivate12BControlLook21_ReservedControlLook1Ev)( 85*fb3493dfSJohn Scipione BControlLook* controlLook, BView* view, BRect& rect, 86*fb3493dfSJohn Scipione const BRect& updateRect, const rgb_color& base, uint32 flags, 87*fb3493dfSJohn Scipione uint32 borders, border_style borderStyle, uint32 side) 88*fb3493dfSJohn Scipione { 89*fb3493dfSJohn Scipione controlLook->DrawTabFrame(view, rect, updateRect, base, flags, borders, 90*fb3493dfSJohn Scipione borderStyle, side); 91*fb3493dfSJohn Scipione } 92*fb3493dfSJohn Scipione 93*fb3493dfSJohn Scipione 94fd25b902SAugustin Cavalier void BControlLook::_ReservedControlLook2() {} 95fd25b902SAugustin Cavalier void BControlLook::_ReservedControlLook3() {} 96fd25b902SAugustin Cavalier void BControlLook::_ReservedControlLook4() {} 97fd25b902SAugustin Cavalier void BControlLook::_ReservedControlLook5() {} 98fd25b902SAugustin Cavalier void BControlLook::_ReservedControlLook6() {} 99fd25b902SAugustin Cavalier void BControlLook::_ReservedControlLook7() {} 100fd25b902SAugustin Cavalier void BControlLook::_ReservedControlLook8() {} 101fd25b902SAugustin Cavalier void BControlLook::_ReservedControlLook9() {} 102fd25b902SAugustin Cavalier void BControlLook::_ReservedControlLook10() {} 103fd25b902SAugustin Cavalier 104fd25b902SAugustin Cavalier 105629397f2SFrançois Revol // Initialized in InterfaceDefs.cpp 1062f86ba45SStephan Aßmus BControlLook* be_control_look = NULL; 1072f86ba45SStephan Aßmus 1082f86ba45SStephan Aßmus } // namespace BPrivate 109