BControlLook: Introduce ComposeIconSize().
This takes an int32 (e.g. B_MINI_ICON or another constant) and then returns a BSize scaled appropriately, the same as ComposeSpacing() does already for the *_SPACING constants. This will be used to replace icon size computations throughout the tree.
This commit is contained in:
@@ -102,6 +102,7 @@ public:
|
|||||||
virtual float DefaultItemSpacing() const = 0;
|
virtual float DefaultItemSpacing() const = 0;
|
||||||
|
|
||||||
static float ComposeSpacing(float spacing);
|
static float ComposeSpacing(float spacing);
|
||||||
|
static BSize ComposeIconSize(int32 size);
|
||||||
|
|
||||||
virtual uint32 Flags(BControl* control) const = 0;
|
virtual uint32 Flags(BControl* control) const = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,18 @@ BControlLook::ComposeSpacing(float spacing)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BSize
|
||||||
|
BControlLook::ComposeIconSize(int32 size)
|
||||||
|
{
|
||||||
|
float scale = be_plain_font->Size() / 12.0f;
|
||||||
|
if (scale < 1.0f)
|
||||||
|
scale = 1.0f;
|
||||||
|
|
||||||
|
const int32 scaled = size * scale;
|
||||||
|
return BSize(scaled - 1, scaled - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BControlLook::DrawLabel(BView* view, const char* label, const BBitmap* icon,
|
BControlLook::DrawLabel(BView* view, const char* label, const BBitmap* icon,
|
||||||
BRect rect, const BRect& updateRect, const rgb_color& base, uint32 flags,
|
BRect rect, const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||||
|
|||||||
Reference in New Issue
Block a user