Added support for buttons and menuframes with rounded corners.
* Not turned on for default buttons and menuframes right now.
* Updated Deskcalc and Keymap to use buttons with rounded corners.
* Overloaded methods with radium parameters are not virtual right
now so as to not break vtables. Added /*virtual*/ before each
method that should be made virtual in ControlLook.h
* Added a light line to the left border of the down arrow frame
on menu frames as a small visual tweak.
* Replace StrokeRect() with StrokeRoundRect() when drawing the
default button indicator. This gives them a rounded
appearance if the button is also rounded.
* Added protected methods _DrawMenuFieldBackgroundOutside and
_DrawMenuFieldBackgroundInside.
* Created some protected methods to get the edge, frame, and bevel
colors from a passed in base color because it was a mess and I
needed to calculate the colors from mutiple methods. It is much
cleaner now.
* Added myself to ControlLook.cpp authors list. Assigned copyright
to Haiku, Inc. Stippi also retains his copyright.
* Tons of style fixes.
- Change all instances of `if (flags & B_FLAG)` to
`if ((flags & B_FLAG) != 0)`
- Reorder some methods.
- Reorder includes.
- Spacing.
- Updated comments.
This commit is contained in:
@@ -564,9 +564,9 @@ void
|
||||
KeyboardLayoutView::_DrawKeyButton(BView* view, BRect& rect, BRect updateRect,
|
||||
rgb_color base, rgb_color background, bool pressed)
|
||||
{
|
||||
be_control_look->DrawButtonFrame(view, rect, updateRect, base,
|
||||
be_control_look->DrawButtonFrame(view, rect, updateRect, 4.0f, base,
|
||||
background, pressed ? BControlLook::B_ACTIVATED : 0);
|
||||
be_control_look->DrawButtonBackground(view, rect, updateRect,
|
||||
be_control_look->DrawButtonBackground(view, rect, updateRect, 4.0f,
|
||||
base, pressed ? BControlLook::B_ACTIVATED : 0);
|
||||
}
|
||||
|
||||
@@ -622,11 +622,21 @@ KeyboardLayoutView::_DrawKey(BView* view, BRect updateRect, const Key* key,
|
||||
region.Exclude(missingRect);
|
||||
view->ConstrainClippingRegion(®ion);
|
||||
|
||||
_DrawKeyButton(view, rect, updateRect, base, background, pressed);
|
||||
be_control_look->DrawButtonFrame(view, rect, updateRect,
|
||||
4.0f, 4.0f, 0.0f, 0.0f, base, background,
|
||||
pressed ? BControlLook::B_ACTIVATED : 0);
|
||||
|
||||
view->ConstrainClippingRegion(®ion);
|
||||
|
||||
be_control_look->DrawButtonBackground(view, rect, updateRect,
|
||||
4.0f, 4.0f, 0.0f, 0.0f, base,
|
||||
pressed ? BControlLook::B_ACTIVATED : 0);
|
||||
|
||||
rect.left = missingRect.right;
|
||||
_GetAbbreviatedKeyLabelIfNeeded(view, rect, key, text, sizeof(text));
|
||||
|
||||
view->ConstrainClippingRegion(®ion);
|
||||
|
||||
be_control_look->DrawLabel(view, text, rect, updateRect,
|
||||
base, 0, BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE));
|
||||
|
||||
@@ -637,7 +647,18 @@ KeyboardLayoutView::_DrawKey(BView* view, BRect updateRect, const Key* key,
|
||||
|
||||
rect = originalRect;
|
||||
rect.bottom = missingRect.top + 2;
|
||||
_DrawKeyButton(view, rect, updateRect, base, background, pressed);
|
||||
|
||||
be_control_look->DrawButtonFrame(view, rect, updateRect,
|
||||
0.0f, 0.0f, 4.0f, 0.0f, base, background,
|
||||
pressed ? BControlLook::B_ACTIVATED : 0,
|
||||
BControlLook::B_LEFT_BORDER | BControlLook::B_BOTTOM_BORDER);
|
||||
|
||||
view->ConstrainClippingRegion(®ion);
|
||||
|
||||
be_control_look->DrawButtonBackground(view, rect, updateRect,
|
||||
0.0f, 0.0f, 4.0f, 0.0f, base,
|
||||
pressed ? BControlLook::B_ACTIVATED : 0,
|
||||
BControlLook::B_LEFT_BORDER | BControlLook::B_BOTTOM_BORDER);
|
||||
|
||||
missingRect.left = missingRect.right;
|
||||
missingRect.right++;
|
||||
@@ -648,7 +669,20 @@ KeyboardLayoutView::_DrawKey(BView* view, BRect updateRect, const Key* key,
|
||||
rect = originalRect;
|
||||
rect.left = missingRect.right - 2;
|
||||
rect.top = missingRect.top - 2;
|
||||
_DrawKeyButton(view, rect, updateRect, base, background, pressed);
|
||||
|
||||
be_control_look->DrawButtonFrame(view, rect, updateRect,
|
||||
0.0f, 0.0f, 4.0f, 4.0f, base, background,
|
||||
pressed ? BControlLook::B_ACTIVATED : 0,
|
||||
BControlLook::B_LEFT_BORDER | BControlLook::B_RIGHT_BORDER
|
||||
| BControlLook::B_BOTTOM_BORDER);
|
||||
|
||||
view->ConstrainClippingRegion(®ion);
|
||||
|
||||
be_control_look->DrawButtonBackground(view, rect, updateRect,
|
||||
0.0f, 0.0f, 4.0f, 4.0f, base,
|
||||
pressed ? BControlLook::B_ACTIVATED : 0,
|
||||
BControlLook::B_LEFT_BORDER | BControlLook::B_RIGHT_BORDER
|
||||
| BControlLook::B_BOTTOM_BORDER);
|
||||
|
||||
view->ConstrainClippingRegion(NULL);
|
||||
}
|
||||
@@ -1032,9 +1066,9 @@ BRect
|
||||
KeyboardLayoutView::_FrameFor(BRect keyFrame)
|
||||
{
|
||||
BRect rect;
|
||||
rect.left = ceilf(keyFrame.left * fFactor);
|
||||
rect.right = floorf((keyFrame.Width()) * fFactor + rect.left - fGap - 1);
|
||||
rect.top = ceilf(keyFrame.top * fFactor);
|
||||
rect.left = ceilf(keyFrame.left * fFactor);
|
||||
rect.top = ceilf(keyFrame.top * fFactor);
|
||||
rect.right = floorf((keyFrame.Width()) * fFactor + rect.left - fGap - 1);
|
||||
rect.bottom = floorf((keyFrame.Height()) * fFactor + rect.top - fGap - 1);
|
||||
rect.OffsetBy(fOffset);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user