History log of /haiku/src/kits/interface/ControlLook.cpp
Revision Date Author Comments
# e6a598a2 12-Sep-2021 Máximo Castañeda <antiswen@yahoo.es>

ControlLook: fix clipping

Remove ConstrainClippingRegion calls as they do not take into
account view transformations.
Clip drawing to the drawing rect, not the updated area.

Fixes #12890

Change-Id: Ie76cb83e0af03213008da78407de25261daea5df
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4457
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# c1353b74 08-Nov-2022 Augustin Cavalier <waddlesplash@gmail.com>

BControlLook: Fix corner spacing calculation.

Fixes #18046. Ideally app_server would just use
this to pick the size of corners...

Change-Id: I2dc243d55321b3fc0fa90faf415d9b04abf9c376
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5780
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 8672fc27 28-Sep-2022 Augustin Cavalier <waddlesplash@gmail.com>

InterfaceDefs: Adjust and introduce new spacing/insets constants.

* Nothing in the tree and few things outside it used BIG_{SPACING|INSETS};
it seems a value of 15px (at default font size) is not that useful.
There are, however, a lot of things around the tree that use multiples
of 20px. So, make BIG be that, with the intent to replace those
with BIG directly.

* Introduce CORNER_{SPACING|INSETS}. There are a lot of applications
(e.g. Tracker, Terminal, Debugger etc.) which use scroll bar width/height
to metrically align controls with the window frame or with some other
control which contains scroll bars. Rather than have to invoke
BScrollBar or BControlLook directly to get the value, we should just
derive the size of scrollbars from a spacing constant instead
and get rid of the custom function. (For now it is just replaced.)
This reuses the old values for BIG, as it is equal to 14px at default.

* Introduce BORDER_{SPACING|INSETS}. This is equal to the typical border
size of 1px at default font size (or lower) and uses floor() instead of
ciel() to compute what the size should be (i.e. it will remain 1px
at 150%/18pt and only go up at 200%/24pt.) This will allow a lot of
the hardcoded border sizes around the tree and elsewhere to use
ComposeSpacing() instead.

Change-Id: Iaea3fa30364859888e816a9d61ac156268d70758
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5702
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: nephele <nep@packageloss.eu>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 1be85605 25-Aug-2022 Augustin Cavalier <waddlesplash@gmail.com>

Add casts to appease GCC2 following recent changes.


# 874a2a72 25-Aug-2022 Augustin Cavalier <waddlesplash@gmail.com>

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.


# 325ab89b 06-Jun-2021 Pascal Abresch <nep@packageloss.eu>

ControlLook: fix minor code style violation

Change-Id: I0b3e80e7ba4418f06c20fd02f96cb2932623fd71
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4102
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 409d65c0 01-May-2021 Pascal Abresch <nep@packageloss.eu>

Decorator: Introduce Scroll bar size call

Change-Id: I07f08c2893d832e431c29ae753e0a93d6e619701
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3892
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: X512 <danger_mail@list.ru>


# 1482b250 04-Mar-2020 John Scipione <jscipione@gmail.com>

IK: Update scroll bars for alternative control look

Scroll bars should look and work identically to before on
HaikuControlLook.

Add DrawScrollBarButton() and DrawScrollBarThumb() and
DrawScrollBarBorder() methods. These methods are used to draw scroll
bars in a generic way so that they can be drawn differently by alternative
control look's (e.g. BeControlLook). Also it gives us back drawing of
scroll bar knobs. However the knob setting is not exposed in the
interface in this commit.

These methods are in addition to the 2 existing DrawScrollBarBackground()
methods that draw the scroll bar background. One draws the area above and
below the thumb and the other is called by the first to actually draw the
area.

The rest of the drawing besides the backgrounds was being done in
BScrollBar before. To draw the scroll bar arrows and thumb we were recyling
other ControlLook methods, while this worked well enough on HaikuControlLook
it wasn't flexible enough for alternative control looks.

DrawScrollBarButton() is used to draw the four scroll buttons and is
typically (so far) used in combination with DrawArrowShape().

DrawScrollBarThumb() draws the scroll bar thumb.

DrawScrollBarBorder() draws a 1px border around the entire scroll bar,
potentially B_KEYBOARD_NAVIGATION_COLOR if focused (although this is
feature not currently used.)

Draw unscrollable scroll bars as if they were disabled including the
buttons with their arrow shapes, background, and thumb.

Add FBC backwords compatibility macros in ControlLook.cpp

Change-Id: I9237c5ce45d17d674785111d51de951e5686306b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/351
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# fb3493df 14-Aug-2019 John Scipione <jscipione@gmail.com>

BControlLook: Move tab frame drawing into DrawTabFrame()

The tab frame is drawn behind the tabs.

Create a new DrawTabFrame method in BControlLook and HaikuControlLook
that draws the tab frame background.

Until now we've been reusing the DrawInactiveTab method to draw the tab frame
in BTabView. While this works on HaikuControlLook, it doesn't work on other
ControlLook's (such as BeControlLook) that draw their tab frame differently.

Add FBC method to preserve binary compatibility on gcc2 and gcc4.

Move DrawTabFrame method to where _ReservedControlLook1 was in header.

Set rect to area of tab frame in TabView instead of doing the
calculation in HaikuControlLook so that others may benefit.

Change-Id: I513e238914f6d680f495659b6ec902df15555015
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1936
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 629397f2 01-May-2019 François Revol <revol@free.fr>

Add basic support for loading ControlLook add-ons

app_server just passes the add-on path around.

Maybe we should make sure the add-on can be loaded when setting it.

Change-Id: I3acd3299782a22c1666bd5435dbf3d8053e359fa
Reviewed-on: https://review.haiku-os.org/c/1430
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# fd25b902 14-Aug-2018 Augustin Cavalier <waddlesplash@gmail.com>

BControlLook: Add FBC padding.

Fixes #14295.


# db68ff23 10-Sep-2017 Augustin Cavalier <waddlesplash@gmail.com>

Interface Kit: Make BControlLook a proper pure-virtual base class.

All of its prior functionality has been moved into HaikuControlLook.
This paves the way for customizeable control looks, which I intend to implement
in the future as part of decorators.

This is being pushed now because libbe ABI was already broken due to the
Notifications changes, so this is riding that so we only have to do a mass
rebuild once.


# cf3524e0 26-Aug-2017 Kacper Kasper <kacperkasper@gmail.com>

Fix WebPositive drawing glitches.

* Introduced with recent BTabView changes.
* Adjust drawing tabs a bit.
* Remove trailing whitespace.

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 0d1bb791 20-Aug-2017 Adrien Destugues <pulkomandy@pulkomandy.tk>

BControlLook: remove broken intersection check

When using BAffineTransform, the update rect is not in the same
coordinate space as the drawing rectangle. Hence, testing them for
intersection does not work, and leads to not drawing buttons which are
in fact visible.

Moreover, the code in BControlLook does not perform only drawing, it is
also expected to update the drawing rect, so other functions may reuse
it later (for example, drawing a button border also computes the
rectangle for the button background). Because of this, it is not
possible to skip the drawing completely, or we could break the layout of
the client.

Fixes #13664


# a34769a0 16-Aug-2017 Kacper Kasper <kacperkasper@gmail.com>

BTabView: cleanup draw function.

* Slightly changes how tabs look.

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# b8d9fcbe 16-Aug-2017 Adrien Destugues <pulkomandy@pulkomandy.tk>

Revert "ControlLook: remove some bogus clipping"

This reverts commit b277177477148c83d79ba7f0b4737709f023f068.


# b2771774 16-Aug-2017 Adrien Destugues <pulkomandy@pulkomandy.tk>

ControlLook: remove some bogus clipping

ConstrainClippingRegion was used in BControlLook to limit drawing to
inside the update rect. There are two problems with that:
- It would ignore any other clipping set by the application, as calls to
ConstrainClippingRegion are not cumulative,
- ConstrainClippingRegion ignores transforms on the view, so on a
transformed view, we would not draw anything in most cases.

If constrained clipping is needed here, it should be achieved using
ClipToPicture instead.


# c7fabe22 29-Jan-2017 Kacper Kasper <kacperkasper@gmail.com>

ControlLook: Fix redraw issues introduced in hrev50893.

* I was pretty sure that I didn't change the logic, but turns out
I was wrong. Sorry about that.
* Adjusted copy-pasted comments.

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>

Fixes #13238.


# 2332ebfd 21-Jan-2017 Kacper Kasper <kacperkasper@gmail.com>

ControlLook: Add side parameter to tab drawing functions.

* This allows drawing tabs on any side of the view.

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 88510bc0 21-Jan-2017 Kacper Kasper <kacperkasper@gmail.com>

ControlLook: Fix drawing of right bottom tab corner.`

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 3798bf90 22-Oct-2016 Augustin Cavalier <waddlesplash@gmail.com>

Use the kDesktopWindowLook/kDesktopWindowFeel constants from WindowPrivate.h...

... instead of redefining them, or including a private Tracker header to
get them.


# 3490eda8 29-Apr-2016 John Scipione <jscipione@gmail.com>

ControlLook: Rename border param to borderStyle

border vs. borders is confusing.

BTabView: Rename border param to borderStyle

BTabView docs: rename border param to borderStyle

enumerate border styles in docs


# 5b2aa7f8 22-Mar-2016 John Scipione <jscipione@gmail.com>

ControlLook: style changes only

whitespace
indent fix (tiny)


# 37f9a292 18-Jan-2016 looncraz <looncraz@looncraz.net>

Improve Default BButton Appearance

Change control border color to 172, 172, 172 and use for default button
indicator drawing.

People doing an in-place upgrade will need to modify the border color from
its previous default manually or by pressing "Default" in the Appearance
preflet. This is a one-time annoyance.

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>

Fixes: #12589


# faf00c7f 10-Jan-2016 looncraz <looncraz@looncraz.net>

ControlLook - Desktop Labels

Enforce use of proper colors in DrawLabel() when on the desktop.

This repairs an issue where the text looks wrong in ActivityMonitor when it is a
desktop replicant and likely other unreported issues.

Fixes #12576.

Signed-off-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>


# c9bd4d84 06-Jan-2016 looncraz <looncraz@looncraz.net>

Interface Kit: Correct button colors.

What appeared to be multiple issues was just one issue: BButton was drawing the
control background color for its border, whereas the previous system drew the
control low color, which was the parent's view color.

Neither is correct, no border should be drawn at all.

This made it appear that the default button was larger than it was and also
made it appear that some apps had a "white" border around the buttons.

In addition, BButton can now use the default BControl color behavior and
BButton exclusively adopt either parental or system colors without worrying
about the case in which another view has set the button's view color manually.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 7a96554c 09-Dec-2015 looncraz <looncraz@looncraz.net>

kits/interface: Convert to using Set*UIColor.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
Patches 0003-0017 from looncraz, unmodified.


# e047b40a 25-Aug-2015 Axel Dörfler <axeld@pinc-software.de>

Interface Kit: use different spacing constants.

* While this breaks binary compatibility with earlier Haiku releases,
use values that are less likely to clash with actual use cases.
* Specifically, using a negative spacing is one way to get rid of the
border of BScrollViews, to put them into a window neatly.
* Also, BControlLook now uses a switch to resolve them.


# 8359b407 13-Mar-2015 John Scipione <jscipione@gmail.com>

CheckBox: Center the check mark again

See 46b39e83 Changed rounding behavior for StrokeLine.

This effectively undoes the change in rounding behavior from that commit.


# 22af0f18 16-Mar-2015 John Scipione <jscipione@gmail.com>

RadioButton: Scale mark to font size

This way the amount of inset varies, small font get small inset,
large fonts get large inset.


# c7756ee1 11-Mar-2015 John Scipione <jscipione@gmail.com>

ControlLook: Use std::max() instead of max_c()

It's a little silly to cast an integer literal to an int32 but the compiler
insisted.


# 6905b4fa 11-Mar-2015 John Scipione <jscipione@gmail.com>

ControlLook: Style fixes

No {}'s for single line, compare against 0 explicitly


# ec9d05b0 24-Feb-2015 John Scipione <jscipione@gmail.com>

ControlLook: Remove erroneous PopState() call.

This may have contributed to some drawing issues on the keymap app.


# 6f207787 10-Dec-2014 Adrien Destugues <pulkomandy@gmail.com>

ControlLook: fix DrawActiveTab with subpixel rectangle

Fixes #4078.

When font hinting is disabled, the width of a string may not be an
integer number of pixels. This results in the tab position also being
non-integer, and the drawing code doesn't handle this, resulting in part
of the tab being shifted 1px to the right.

Snap the rectangle to the pixel grid so the runding error doesn't
happen.


# 539dc1bc 02-Dec-2014 John Scipione <jscipione@gmail.com>

A bunch of style fixes

No functional changes intended


# 37456be7 06-Oct-2014 Adrien Destugues <pulkomandy@gmail.com>

Make use of the "invalid control" look flag

* Use a red border for BTextControl when the invalid flag is set.


# e439b003 07-Apr-2014 John Scipione <jscipione@gmail.com>

Fix button label position, try number 2

Create and use BLayoutUtils::AlignOnRect() to position the button label
in BControlLook::DrawLabel().

AlignOnRect(), unlike AlignInFrame(), provides the possibility to return
a rectangle with dimensions greater than the available size.

Add some comments above the methods in LayoutUtils that indicate such.

Also update copyright headers in LayoutUtils and ControlLook


# 4e8acd32 07-Apr-2014 John Scipione <jscipione@gmail.com>

ControlLook::DrawLabel() tiny style changes


# c79ddce4 04-Apr-2014 John Scipione <jscipione@gmail.com>

Revert "Fix button label position"

This reverts commit 1c69e1c306186ef5f58e377835ed00a51ffcc955.


# 1c69e1c3 01-Apr-2014 John Scipione <jscipione@gmail.com>

Fix button label position

This reverts a portion of hrev46580 concerning placement of a label on a button.
The label was draw too low on the button in some cases, notably in Keymap.
Restoring the old code for the icon-less case fixes the problem.

There still may be a problem drawing labels on buttons with icons, but, the code
should behave the same as it did in hrev46580 for that case, which is when
buttons with icons was introduced.


# a0848a19 29-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BButton: Add optional pop-up marker

* Add behavior constant B_POP_UP_BEHAVIOR which adds a pop-up marker
to the button (similar to that of BMenuField).
* Add methods [Set]PopUpMessage(). To set/get the the message that is
sent to the button's target when the pop-up marker is clicked.


# 87f392c9 29-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BControlLook::GetFrameInsets(): Fix button insets

The button frame is 3 pixels wide, but that includes one pixel that
actually belongs to the background, which is accounted for by
GetBackgroundInsets().
Removes the additional one pixel inset accidentally introduced earlier.


# a249edfb 28-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BButton: Add flat property

* Add methods SetFlat()/IsFlat(). A flat button doesn't draw its frame,
unless the mouse is hovering over it or it is otherwise activated.
* As a side effect this change also activates the hover glow that was
already implemented in BControlLook, but not activated in BButton.


# 6af520e2 21-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BControlLook::DrawLabel(): Fix off-by-one error

* BFont::TruncateString() expects a pixel count (as opposed to a pixel
distance). That would cause a tightly fitting string to be truncated.
* Round the result of StringWidth() to avoid drawing at a non-integer
location.


# 1b848ee7 21-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BControlLook: Add DrawLabel() variants with icon

A label, a bitmap, or both can be specified.


# 8719e0dc 21-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BControlLook: Add methods for getting insets

* Update the previously unused frame_type and background_type enums.
* Add methods GetFrameInsets(), GetBackgroundInsets(), GetInsets() to
get the insets for a given frame type, background type, or both
respectively.


# df37cd4e 20-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BCheckBox: Add tri-state support

* Add possible control state B_CONTROL_PARTIALLY_ON and support it in
BCheckBox and BControlLook.
* BCheckBox: Add partialStateToOff property defining whether the
partial state should transition to off. Defaults to false (i.e.
partial to on).


# 5c56812d 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BControlLook::ComposeSpacing(): Avoid non-integers


# d38ba8f7 13-Aug-2013 John Scipione <jscipione@gmail.com>

ControlLook: Check IsFocus() first

Otherwise we make two unnecessary function calls for every control
in a window where only one of them is the focus control.

Thanks Stippi.


# 59655dcb 12-Aug-2013 John Scipione <jscipione@gmail.com>

Update control focus flag. Fixes #9915

Parent window must be active for control to draw as focused. This
affects all controls that draw their focus ring using ControlLook
including but not limited to BButton, BCheckBox, and BRadioButton.

I won't pretend to know what is "right" but the behavior now matches
BeOS R5.


# a8b89c6b 04-Aug-2013 Stephan Aßmus <superstippi@gmx.de>

BControlLook: The spacing values need to be rounded...

... or they will cause all sorts of graphics glitches and layout
problems.


# e724b26f 08-Jul-2013 John Scipione <jscipione@gmail.com>

Remove enum elaborated type specifier

...from orientation params. Elaborated type specifiers are not needed
for C++ code and removing them makes doxygen happy. Verified working
on both gcc2h and gcc4h builds.


# 83864481 23-Apr-2013 Jérôme Duval <jerome.duval@gmail.com>

ControlLook: fixed wrong conversion to uint32


# 17c9912b 07-Apr-2013 John Scipione <jscipione@gmail.com>

Another tweak, make the left diagonal arrows flush left.

This moves the left up and left down arrows 1px to the left so that they are
flush with the left side of the container they're drawn in.


# 348cd0c5 07-Apr-2013 John Scipione <jscipione@gmail.com>

Tweak the diagonal arrows so they are square


# 1b41173c 06-Apr-2013 John Scipione <jscipione@gmail.com>

Add diagonal arrows to ControlLook DrawArrowShape() method


# f44a56ca 03-Mar-2013 Ryan Leavengood <leavengood@gmail.com>

Add back moving the pen to origin in BControlLook arrow drawing.

Removing this did not affect scrollbar arrow buttons, but made the
arrows disappear on the Deskbar.

Clearly, BControlLook cannot be changed without extensive testing.


# f9b1a47f 03-Mar-2013 Ryan Leavengood <leavengood@gmail.com>

Use be_control_look for BScrollBar and FakeScrollBar.

Remove all code which checks for be_control_look being NULL.

Also fix the DrawArrowShape method in be_control_look so the arrow is aligned,
as per the previous commit. In addition the code to offset the arrow when the
scroll button is pressed was unnecessary.

There is still some room for improvement, and I am not happy with the
BControlLook behavior here, as noted in some TODOs.


# 5666b4f7 19-Oct-2012 John Scipione <jscipione@gmail.com>

Preserve the clipping constraints of the parent view...

when drawing the following controls:
* SliderBar
* ActiveTab
* MenuField

This is a followup commit based on the change made for buttons in
hrev44708 in response to bug #8700. It is good practice to always preserve
the parent view's clipping constraints.

Stippi and Axel can you you at this commit and make sure this is kosher?

+alpha4


# 4fa76719 17-Oct-2012 John Scipione <jscipione@gmail.com>

Save and restore button clipping constraints.

This fixes #8700


# d7f6b4c1 19-Aug-2012 Ryan Leavengood <leavengood@gmail.com>

ControlLook: Don't tint the selected menu item color.

Now that we use the actual selected menu item ui_color, this tinting is not
needed. In fact it makes the selected item too dark.

Thanks diver for noticing.


# 4bb5af76 15-Jul-2012 John Scipione <jscipione@gmail.com>

Add control mark color setting. #8054

An enhancement adding a setting to Colors under Appearance to
set the mark color of radio button and check box controls.


# 41651bb3 17-Apr-2012 John Scipione <jscipione@gmail.com>

Small code simplication cleanup and add comment.


# 88969219 17-Apr-2012 John Scipione <jscipione@gmail.com>

Fix Deskcalc drawing rounded corners on the desktop as a replicant, although I am not sure why I'm even bothering at this point.


# 3244c2bc 16-Apr-2012 John Scipione <jscipione@gmail.com>

Whoops, remove constraints after drawing slider bar.


# a884b43b 19-Mar-2012 John Scipione <jscipione@gmail.com>

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.


# 41836758 02-Mar-2012 Rene Gollent <anevilyak@gmail.com>

Move black/white color constant definitions to header.

Previously, there were two instances of the actual variables, named in
ControlLook.cpp and Utilities.cpp. This caused clashes on gcc4 builds, leading
to various crashes during initialization. Instead we now declare them as
static constants in the header itself as is done for various other interface
color constants elsewhere. Fixes ticket #8358.


# d452ff66 26-Feb-2012 Axel Dörfler <axeld@pinc-software.de>

Added some reserved fields to BControlLook.

* This makes future changes less troublesome, although we should also add
some virtual slots there (probably just dozens of it, though, that's why
I was being lazy).
* Don't pass messages by value; they are copied twice this way.
* Minor coding style corrections, automatic whitespace cleanup.


# d63b75fa 22-Feb-2012 Philippe Saint-Pierre <stpere@gmail.com>

Outline of labels/strings drawn to desktop

* Rather than duplicating the decision taking logic involving wheter or not to draw
the outline or glow in every replicant, update be_control_look to make it more
generic.
* The Monitoring of the background preferences is now only done in Tracker (where it
was already being done).
* Add a BControlLook::B_IGNORE_OUTLINE flag to avoid this new behaviour.
* Remove that said logic from ActivityMonitor and use be_control_look.
* Use the ignore flag in DeskCalc to avoid the outline in its case.

Should fix #7716, #7291.


# d90a465e 17-Jun-2011 Alex Wilson <yourpalal2@gmail.com>

Change the value of other spacing/inset constants so that B_USE_DEFAULT_SPACING has its own unique value. Also adjust BControlLook::ComposeSpacing() to reflect this.
closes #7447


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42222 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6648dd3c 07-Jun-2011 Alex Wilson <yourpalal2@gmail.com>

* Add new spacing/inset constants for the layout API. For now, leave B_USE_DEFAULT_SPACING, but this will go soon.
* Rename BControlLook::ComposeItemSpacing() to ComposeSpacing(), and extend it to handle the new constants.
* Adjust users of BControlLook::ComposeItemSpacing() accordingly.
* part of #7447


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42025 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f3997b74 03-Jun-2011 Stephan Aßmus <superstippi@gmx.de>

Applied patch by Pete Goodeve (with small coding style corrections)
which fixes vertical BSliders. (ticket #7548) Thanks a bunch!
+alpha


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41881 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 82ab3167 02-Sep-2010 Alex Wilson <yourpalal2@gmail.com>

Add default spacing for Layouts (#5614)
* introduce B_USE_DEFAULT_SPACING, which works somewhat like B_SIZE_UNSET and B_ALIGN_HORIZONTAL_UNSET
* introduce static float BControlLook::ComposeItemSpacing(float spacing), which checks uses be_control_look->DefaultItemSpacing().
* modify layouts to use BControlLook::ComposeItemSpacing() in SetInsets and SetSpacing methods.
* default insets are still 0, 0, 0, 0, but can be set to default spacing by passing B_USE_DEFAULT_SPACING
* I've found two regressions, patches incoming, please report others on #5614.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38512 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c4e211fe 22-Jan-2010 Stephan Aßmus <superstippi@gmx.de>

* Refactored a method to draw a label when the location is already known.
(This one takes care of setting up the correct color.)
* Added TODO about using either B_CONTROL_TEXT_COLOR, or elliminating that
constant (which I am in favor of...).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35260 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 10ddee8d 22-Jan-2010 Stephan Aßmus <superstippi@gmx.de>

Tweaked the alpha values to be more in line with the look when not blending.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35257 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 61ac1a85 22-Jan-2010 Stephan Aßmus <superstippi@gmx.de>

* Set the BLEND_FRAME flag when detecting that the parent view of the control
renders over children.
* Support the BLEND_FRAME flag also when drawing BSliders.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35256 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 20a11271 17-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Added a (to be virtual) DefaultItemSpacing() method to control look. This is
what you should use in for example BGroupLayout as spacing/inset.
* Changed the label spacing to be dependent on the font size, too (and enlarged
it a bit as well).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33621 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9f981a88 03-Aug-2009 François Revol <revol@free.fr>

Fix a warning.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32083 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a5339f65 24-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

Fix a GCC4 warning.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31733 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b3601d82 21-Jun-2009 Stephan Aßmus <superstippi@gmx.de>

* Update indentation style in TabView.h
* Added _MinTabeSize() to BTabView. It makes sure that the BTabView displays
at least two tabs. In the future it should also add the room to display some
buttons for cycling the currently displayed tabs left/right if there is more
than can fit.
* In BTabView::Min/Max/PreferredSize(), use _MinTabSize() to compute the
respective size.
* Improve Tab rendering code so there are no ugly overlaps at the right edge
if the tabs falls directly on the view edge.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31157 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1f9fd6d8 20-Jun-2009 Stephan Aßmus <superstippi@gmx.de>

* Added BSplitView drawing code to ControlLook.
* BSplitView uses ControlLook to draw itself.
* Small refactoring in SplitLayout to implement IsAboveSplitter(BPoint).
* BSplitView updates the view cursor when the mouse is above a splitter.
* Standard splitter size is now 6 pixels, which is a bit easer to hit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31137 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c44aa833 09-Apr-2009 Stephan Aßmus <superstippi@gmx.de>

Also draw the scroll corner when there is no border.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30089 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ce955579 03-Apr-2009 Stephan Aßmus <superstippi@gmx.de>

Make sure to fill the scroll corner if necessary.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29877 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4f579098 28-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Introduce the possiblity to draw certain frames with alpha blending on top of
an existing background. It's not supported by many frame types yet, but BButton
and TextControl frames work as well as the soft recessed frame which many
controls use.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29762 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 681c2e44 25-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

The button and menu field draw routines take a background color into account,
which makes the resessed frame blend better with the surroundings. This can
be seen best in Keymap, where a different color is set on some buttons, but
the resessed frame should still be the same across all those buttons.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29716 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2ce5b172 24-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Fix case label coding style violations...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29688 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 74bb70ae 23-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Moved the BScrollView frame drawing entirely into BControlLook.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29661 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 40a10e1c 21-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Added method to draw an arrow shape like that of the BScrollBar.
TODO: Adjust BScrollBar to use it.
TODO: Make it virtual like the others, but I don't want to break Vision and
other native Haiku apps just now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29630 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1a72cb41 18-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Make BMenuBar background drawing more flexible and also support an "activated"
state.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29597 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8ee9217e 24-Feb-2009 Stephan Aßmus <superstippi@gmx.de>

Improved the look of the slider triangle thumb. Still missing is the vertical
version.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29311 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 83aff015 17-Feb-2009 Philippe Houdoin <philippe.houdoin@gmail.com>

Fixed BTabs focus underline offset.
Fixed a typo in method name.

Please forgive me Stephan if I just screw your next commit...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29240 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 13cd46df 16-Feb-2009 Stephan Aßmus <superstippi@gmx.de>

* Stronger BMenuField popup indicator.
* Softer recessed frame for BMenuField to distinguish more from BButton
and make it slightly more similar to BTextControl.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29235 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 12ea5a2c 16-Feb-2009 Stephan Aßmus <superstippi@gmx.de>

* Give the inactive tabs a slight separation.
* Removed some dead WIP code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29234 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2f86ba45 15-Feb-2009 Stephan Aßmus <superstippi@gmx.de>

Implemented a new look for the Haiku interface controls. It was
overheard that they looked too ninety-ish.
TODO: The code behind this is work in progress. The basic idea
is to extract all drawing code into a new class BControlLook,
of which there is a global instance be_control_look, instantiated
in InterfaceDefs.cpp. At the moment, all the old drawing code is
still there, and the usage of be_control_look is inside if-bodies
checking the instance against NULL. In another words, by not
instanitating be_control_look, you can revert back to the old look.
BControlLook's job is to provide reusable methods for drawing
certain types of frames, backgrounds and labels, so that application
developers can make controls that re-use the same drawing code
as built-in controls and adopt to changes made there. I have added
the notion of "borders". Each of the frame drawing methods can be
made to draw certain borders only, which is supposed to help when
controls shall visually attach. This feature is not fully explored
at all ATM.
TODO: Update BColumnListView header view and BStringItem text
spacing. Update other apps where it makes sense to use BControlLook.
For the moment, only Tracker and LaunchBox are updated. More...
NOTE: The new look is not very radically different, so that existing
apps do not immediately look too ugly or out of place.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29221 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e047b40a2fd11728e4f7ac83d121299c89e9e658 25-Aug-2015 Axel Dörfler <axeld@pinc-software.de>

Interface Kit: use different spacing constants.

* While this breaks binary compatibility with earlier Haiku releases,
use values that are less likely to clash with actual use cases.
* Specifically, using a negative spacing is one way to get rid of the
border of BScrollViews, to put them into a window neatly.
* Also, BControlLook now uses a switch to resolve them.


# 8359b407ffcb4094c508f5b2dd0ad27e0af322a1 13-Mar-2015 John Scipione <jscipione@gmail.com>

CheckBox: Center the check mark again

See 46b39e83 Changed rounding behavior for StrokeLine.

This effectively undoes the change in rounding behavior from that commit.


# 22af0f18be8c9eb50e647c3c339e355ad9ee7cce 16-Mar-2015 John Scipione <jscipione@gmail.com>

RadioButton: Scale mark to font size

This way the amount of inset varies, small font get small inset,
large fonts get large inset.


# c7756ee15a1671bf23f35acf70834e6aee7cb5ee 11-Mar-2015 John Scipione <jscipione@gmail.com>

ControlLook: Use std::max() instead of max_c()

It's a little silly to cast an integer literal to an int32 but the compiler
insisted.


# 6905b4faed599cd537215cb6b7b411a361449671 11-Mar-2015 John Scipione <jscipione@gmail.com>

ControlLook: Style fixes

No {}'s for single line, compare against 0 explicitly


# ec9d05b0f2f86bcf4fd0c7735575cf2391ff135d 24-Feb-2015 John Scipione <jscipione@gmail.com>

ControlLook: Remove erroneous PopState() call.

This may have contributed to some drawing issues on the keymap app.


# 6f20778781492b124de90e5e0e5937ce6ab949e1 10-Dec-2014 Adrien Destugues <pulkomandy@gmail.com>

ControlLook: fix DrawActiveTab with subpixel rectangle

Fixes #4078.

When font hinting is disabled, the width of a string may not be an
integer number of pixels. This results in the tab position also being
non-integer, and the drawing code doesn't handle this, resulting in part
of the tab being shifted 1px to the right.

Snap the rectangle to the pixel grid so the runding error doesn't
happen.


# 539dc1bc53a60fc507d1d5b82e872030f0b06e2f 02-Dec-2014 John Scipione <jscipione@gmail.com>

A bunch of style fixes

No functional changes intended


# 37456be704f65a28baedc91e0dfd33c413191a50 06-Oct-2014 Adrien Destugues <pulkomandy@gmail.com>

Make use of the "invalid control" look flag

* Use a red border for BTextControl when the invalid flag is set.


# e439b003978b9554e034bb4cfc59e164a7215b31 07-Apr-2014 John Scipione <jscipione@gmail.com>

Fix button label position, try number 2

Create and use BLayoutUtils::AlignOnRect() to position the button label
in BControlLook::DrawLabel().

AlignOnRect(), unlike AlignInFrame(), provides the possibility to return
a rectangle with dimensions greater than the available size.

Add some comments above the methods in LayoutUtils that indicate such.

Also update copyright headers in LayoutUtils and ControlLook


# 4e8acd323230fc1520129ee22e291ae12b236f1a 07-Apr-2014 John Scipione <jscipione@gmail.com>

ControlLook::DrawLabel() tiny style changes


# c79ddce494c68eb46976b86db5c68dfce9d15660 04-Apr-2014 John Scipione <jscipione@gmail.com>

Revert "Fix button label position"

This reverts commit 1c69e1c306186ef5f58e377835ed00a51ffcc955.


# 1c69e1c306186ef5f58e377835ed00a51ffcc955 01-Apr-2014 John Scipione <jscipione@gmail.com>

Fix button label position

This reverts a portion of hrev46580 concerning placement of a label on a button.
The label was draw too low on the button in some cases, notably in Keymap.
Restoring the old code for the icon-less case fixes the problem.

There still may be a problem drawing labels on buttons with icons, but, the code
should behave the same as it did in hrev46580 for that case, which is when
buttons with icons was introduced.


# a0848a191693aac77d3301a13dc59a27114acaa7 29-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BButton: Add optional pop-up marker

* Add behavior constant B_POP_UP_BEHAVIOR which adds a pop-up marker
to the button (similar to that of BMenuField).
* Add methods [Set]PopUpMessage(). To set/get the the message that is
sent to the button's target when the pop-up marker is clicked.


# 87f392c9f03449368b8ff162293b3eea0e7320ea 29-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BControlLook::GetFrameInsets(): Fix button insets

The button frame is 3 pixels wide, but that includes one pixel that
actually belongs to the background, which is accounted for by
GetBackgroundInsets().
Removes the additional one pixel inset accidentally introduced earlier.


# a249edfbfc6a699a22052faccd3bcdf21ee9e042 28-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BButton: Add flat property

* Add methods SetFlat()/IsFlat(). A flat button doesn't draw its frame,
unless the mouse is hovering over it or it is otherwise activated.
* As a side effect this change also activates the hover glow that was
already implemented in BControlLook, but not activated in BButton.


# 6af520e2a9e2f5e5c0c92c91ac71db69c7168964 21-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BControlLook::DrawLabel(): Fix off-by-one error

* BFont::TruncateString() expects a pixel count (as opposed to a pixel
distance). That would cause a tightly fitting string to be truncated.
* Round the result of StringWidth() to avoid drawing at a non-integer
location.


# 1b848ee7f2943f00b95a8657494592e2d0f15898 21-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BControlLook: Add DrawLabel() variants with icon

A label, a bitmap, or both can be specified.


# 8719e0dc4bf8495cd70c2dc3d25a5165f7ea3d16 21-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BControlLook: Add methods for getting insets

* Update the previously unused frame_type and background_type enums.
* Add methods GetFrameInsets(), GetBackgroundInsets(), GetInsets() to
get the insets for a given frame type, background type, or both
respectively.


# df37cd4edddd82519232cf96b7fa0e4eb7e339dc 20-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BCheckBox: Add tri-state support

* Add possible control state B_CONTROL_PARTIALLY_ON and support it in
BCheckBox and BControlLook.
* BCheckBox: Add partialStateToOff property defining whether the
partial state should transition to off. Defaults to false (i.e.
partial to on).


# 5c56812d900c7777c62eab899c0bb553459ef67b 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BControlLook::ComposeSpacing(): Avoid non-integers


# d38ba8f7dd3c2a0912d641b63e9cc031d962798a 13-Aug-2013 John Scipione <jscipione@gmail.com>

ControlLook: Check IsFocus() first

Otherwise we make two unnecessary function calls for every control
in a window where only one of them is the focus control.

Thanks Stippi.


# 59655dcbc40dabc1a197275241ac7d3b9ccd92dd 12-Aug-2013 John Scipione <jscipione@gmail.com>

Update control focus flag. Fixes #9915

Parent window must be active for control to draw as focused. This
affects all controls that draw their focus ring using ControlLook
including but not limited to BButton, BCheckBox, and BRadioButton.

I won't pretend to know what is "right" but the behavior now matches
BeOS R5.


# a8b89c6b4fd3880faf656404df6f55419ececc59 04-Aug-2013 Stephan Aßmus <superstippi@gmx.de>

BControlLook: The spacing values need to be rounded...

... or they will cause all sorts of graphics glitches and layout
problems.


# e724b26f23ad0df100a47f8d913bcdb3d54267df 08-Jul-2013 John Scipione <jscipione@gmail.com>

Remove enum elaborated type specifier

...from orientation params. Elaborated type specifiers are not needed
for C++ code and removing them makes doxygen happy. Verified working
on both gcc2h and gcc4h builds.


# 8386448172477523f41b44c3ca3dc01a19b74be7 23-Apr-2013 Jérôme Duval <jerome.duval@gmail.com>

ControlLook: fixed wrong conversion to uint32


# 17c9912b9084d25d3d7a9f6b8e53e27918120ca1 07-Apr-2013 John Scipione <jscipione@gmail.com>

Another tweak, make the left diagonal arrows flush left.

This moves the left up and left down arrows 1px to the left so that they are
flush with the left side of the container they're drawn in.


# 348cd0c5dea4ee9b5a30ccc83595b8540e0733ed 07-Apr-2013 John Scipione <jscipione@gmail.com>

Tweak the diagonal arrows so they are square


# 1b41173c8a79c210f88df52ccfe63a33ba1bc4dc 06-Apr-2013 John Scipione <jscipione@gmail.com>

Add diagonal arrows to ControlLook DrawArrowShape() method


# f44a56ca9a15c0ec2f1fb8c778e30871888499a6 03-Mar-2013 Ryan Leavengood <leavengood@gmail.com>

Add back moving the pen to origin in BControlLook arrow drawing.

Removing this did not affect scrollbar arrow buttons, but made the
arrows disappear on the Deskbar.

Clearly, BControlLook cannot be changed without extensive testing.


# f9b1a47fa329a440024cfcb45a82841ff6961f42 03-Mar-2013 Ryan Leavengood <leavengood@gmail.com>

Use be_control_look for BScrollBar and FakeScrollBar.

Remove all code which checks for be_control_look being NULL.

Also fix the DrawArrowShape method in be_control_look so the arrow is aligned,
as per the previous commit. In addition the code to offset the arrow when the
scroll button is pressed was unnecessary.

There is still some room for improvement, and I am not happy with the
BControlLook behavior here, as noted in some TODOs.


# 5666b4f7a3c7cec818d229901b9664d106346591 19-Oct-2012 John Scipione <jscipione@gmail.com>

Preserve the clipping constraints of the parent view...

when drawing the following controls:
* SliderBar
* ActiveTab
* MenuField

This is a followup commit based on the change made for buttons in
hrev44708 in response to bug #8700. It is good practice to always preserve
the parent view's clipping constraints.

Stippi and Axel can you you at this commit and make sure this is kosher?

+alpha4


# 4fa767198c09b0fb3922b25ecf490b8c61fc0f93 17-Oct-2012 John Scipione <jscipione@gmail.com>

Save and restore button clipping constraints.

This fixes #8700


# d7f6b4c18c23ab908555645449f1f6cd7436a1e6 19-Aug-2012 Ryan Leavengood <leavengood@gmail.com>

ControlLook: Don't tint the selected menu item color.

Now that we use the actual selected menu item ui_color, this tinting is not
needed. In fact it makes the selected item too dark.

Thanks diver for noticing.


# 4bb5af765fc7c9e4daf911d5ad8db763403fdd21 15-Jul-2012 John Scipione <jscipione@gmail.com>

Add control mark color setting. #8054

An enhancement adding a setting to Colors under Appearance to
set the mark color of radio button and check box controls.


# 41651bb3fd80eeccaab6e46643085a7d0b2bd70c 17-Apr-2012 John Scipione <jscipione@gmail.com>

Small code simplication cleanup and add comment.


# 889692191d3374f5ad42e7b0d02a45e3dfd65294 17-Apr-2012 John Scipione <jscipione@gmail.com>

Fix Deskcalc drawing rounded corners on the desktop as a replicant, although I am not sure why I'm even bothering at this point.


# 3244c2bcf2d56c88a667a5c9263d4947b4cdd4ef 16-Apr-2012 John Scipione <jscipione@gmail.com>

Whoops, remove constraints after drawing slider bar.


# a884b43bb1c7bbd60789f35934466a970fe59d9f 19-Mar-2012 John Scipione <jscipione@gmail.com>

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.


# 418367589556790e6fb2b2a9cadf62b1408a87c9 02-Mar-2012 Rene Gollent <anevilyak@gmail.com>

Move black/white color constant definitions to header.

Previously, there were two instances of the actual variables, named in
ControlLook.cpp and Utilities.cpp. This caused clashes on gcc4 builds, leading
to various crashes during initialization. Instead we now declare them as
static constants in the header itself as is done for various other interface
color constants elsewhere. Fixes ticket #8358.


# d452ff664c6c7d1b4c429fb7b53f920f165e52f7 26-Feb-2012 Axel Dörfler <axeld@pinc-software.de>

Added some reserved fields to BControlLook.

* This makes future changes less troublesome, although we should also add
some virtual slots there (probably just dozens of it, though, that's why
I was being lazy).
* Don't pass messages by value; they are copied twice this way.
* Minor coding style corrections, automatic whitespace cleanup.


# d63b75faf848697b07bfad9b71899e6caf9ab5bc 22-Feb-2012 Philippe Saint-Pierre <stpere@gmail.com>

Outline of labels/strings drawn to desktop

* Rather than duplicating the decision taking logic involving wheter or not to draw
the outline or glow in every replicant, update be_control_look to make it more
generic.
* The Monitoring of the background preferences is now only done in Tracker (where it
was already being done).
* Add a BControlLook::B_IGNORE_OUTLINE flag to avoid this new behaviour.
* Remove that said logic from ActivityMonitor and use be_control_look.
* Use the ignore flag in DeskCalc to avoid the outline in its case.

Should fix #7716, #7291.


# d90a465e0831547f5378748680b1f68b877dc6f1 17-Jun-2011 Alex Wilson <yourpalal2@gmail.com>

Change the value of other spacing/inset constants so that B_USE_DEFAULT_SPACING has its own unique value. Also adjust BControlLook::ComposeSpacing() to reflect this.
closes #7447


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42222 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6648dd3cf1597c4fcae16fcfa76270f3acda90b6 07-Jun-2011 Alex Wilson <yourpalal2@gmail.com>

* Add new spacing/inset constants for the layout API. For now, leave B_USE_DEFAULT_SPACING, but this will go soon.
* Rename BControlLook::ComposeItemSpacing() to ComposeSpacing(), and extend it to handle the new constants.
* Adjust users of BControlLook::ComposeItemSpacing() accordingly.
* part of #7447


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42025 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f3997b74b340c97d9e8a1d80ba6a350d4cd0c910 03-Jun-2011 Stephan Aßmus <superstippi@gmx.de>

Applied patch by Pete Goodeve (with small coding style corrections)
which fixes vertical BSliders. (ticket #7548) Thanks a bunch!
+alpha


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41881 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 82ab3167232c5c8ee53e684eddc83dc7cb60f1cc 02-Sep-2010 Alex Wilson <yourpalal2@gmail.com>

Add default spacing for Layouts (#5614)
* introduce B_USE_DEFAULT_SPACING, which works somewhat like B_SIZE_UNSET and B_ALIGN_HORIZONTAL_UNSET
* introduce static float BControlLook::ComposeItemSpacing(float spacing), which checks uses be_control_look->DefaultItemSpacing().
* modify layouts to use BControlLook::ComposeItemSpacing() in SetInsets and SetSpacing methods.
* default insets are still 0, 0, 0, 0, but can be set to default spacing by passing B_USE_DEFAULT_SPACING
* I've found two regressions, patches incoming, please report others on #5614.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38512 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c4e211feb65c3656c3ad7dba1b8b60e983ca1e13 22-Jan-2010 Stephan Aßmus <superstippi@gmx.de>

* Refactored a method to draw a label when the location is already known.
(This one takes care of setting up the correct color.)
* Added TODO about using either B_CONTROL_TEXT_COLOR, or elliminating that
constant (which I am in favor of...).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35260 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 10ddee8d8e1ef5a93c3279bfef504e3651a9b00b 22-Jan-2010 Stephan Aßmus <superstippi@gmx.de>

Tweaked the alpha values to be more in line with the look when not blending.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35257 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 61ac1a850f45384e8eb9c2fbfac6a78207929fdb 22-Jan-2010 Stephan Aßmus <superstippi@gmx.de>

* Set the BLEND_FRAME flag when detecting that the parent view of the control
renders over children.
* Support the BLEND_FRAME flag also when drawing BSliders.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35256 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 20a11271d02f6e1dc373e48f62ee699d44984c35 17-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Added a (to be virtual) DefaultItemSpacing() method to control look. This is
what you should use in for example BGroupLayout as spacing/inset.
* Changed the label spacing to be dependent on the font size, too (and enlarged
it a bit as well).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33621 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9f981a889b05581615a60a19ccdd8e6402f7f413 03-Aug-2009 François Revol <revol@free.fr>

Fix a warning.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32083 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a5339f65c333a19066764028f8ea4da486a20ade 24-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

Fix a GCC4 warning.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31733 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b3601d823ca218ee6b0fed890c66568a034cdd3a 21-Jun-2009 Stephan Aßmus <superstippi@gmx.de>

* Update indentation style in TabView.h
* Added _MinTabeSize() to BTabView. It makes sure that the BTabView displays
at least two tabs. In the future it should also add the room to display some
buttons for cycling the currently displayed tabs left/right if there is more
than can fit.
* In BTabView::Min/Max/PreferredSize(), use _MinTabSize() to compute the
respective size.
* Improve Tab rendering code so there are no ugly overlaps at the right edge
if the tabs falls directly on the view edge.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31157 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1f9fd6d866bff084e6792bccc52d6eefd9470f7e 20-Jun-2009 Stephan Aßmus <superstippi@gmx.de>

* Added BSplitView drawing code to ControlLook.
* BSplitView uses ControlLook to draw itself.
* Small refactoring in SplitLayout to implement IsAboveSplitter(BPoint).
* BSplitView updates the view cursor when the mouse is above a splitter.
* Standard splitter size is now 6 pixels, which is a bit easer to hit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31137 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c44aa8336520387936e1dfb40a54482186dae0f4 09-Apr-2009 Stephan Aßmus <superstippi@gmx.de>

Also draw the scroll corner when there is no border.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30089 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ce9555798ac12db9efdae3f5b8aa979c0aa025be 03-Apr-2009 Stephan Aßmus <superstippi@gmx.de>

Make sure to fill the scroll corner if necessary.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29877 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4f57909806ea0aaa8d1f4fdd36d525b6ff0fa7b7 28-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Introduce the possiblity to draw certain frames with alpha blending on top of
an existing background. It's not supported by many frame types yet, but BButton
and TextControl frames work as well as the soft recessed frame which many
controls use.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29762 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 681c2e4425073000c01c9c97237d2615d226f401 25-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

The button and menu field draw routines take a background color into account,
which makes the resessed frame blend better with the surroundings. This can
be seen best in Keymap, where a different color is set on some buttons, but
the resessed frame should still be the same across all those buttons.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29716 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2ce5b17258316aa8d221f39dfad332dc1a2e00b4 24-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Fix case label coding style violations...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29688 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 74bb70aef90f212c8595b81189bc726e4db592c0 23-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Moved the BScrollView frame drawing entirely into BControlLook.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29661 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 40a10e1c523af82143d16163ed48cfddabe6849f 21-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Added method to draw an arrow shape like that of the BScrollBar.
TODO: Adjust BScrollBar to use it.
TODO: Make it virtual like the others, but I don't want to break Vision and
other native Haiku apps just now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29630 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1a72cb4139bb0b6ae48a09c6dacf64018ceb694f 18-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Make BMenuBar background drawing more flexible and also support an "activated"
state.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29597 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8ee9217eec79eae70ae2c62280d05e08579554ae 24-Feb-2009 Stephan Aßmus <superstippi@gmx.de>

Improved the look of the slider triangle thumb. Still missing is the vertical
version.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29311 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 83aff015eb79ec3b8c3cff465b6f5051da18d215 17-Feb-2009 Philippe Houdoin <philippe.houdoin@gmail.com>

Fixed BTabs focus underline offset.
Fixed a typo in method name.

Please forgive me Stephan if I just screw your next commit...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29240 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 13cd46dfa37ff39c2aeaf3b9fb1f49e1e5cb539e 16-Feb-2009 Stephan Aßmus <superstippi@gmx.de>

* Stronger BMenuField popup indicator.
* Softer recessed frame for BMenuField to distinguish more from BButton
and make it slightly more similar to BTextControl.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29235 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 12ea5a2cfb193a9983cbf2447c614a3a81abdb87 16-Feb-2009 Stephan Aßmus <superstippi@gmx.de>

* Give the inactive tabs a slight separation.
* Removed some dead WIP code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29234 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2f86ba45579bdc9648b232175f87edc62ab71b54 15-Feb-2009 Stephan Aßmus <superstippi@gmx.de>

Implemented a new look for the Haiku interface controls. It was
overheard that they looked too ninety-ish.
TODO: The code behind this is work in progress. The basic idea
is to extract all drawing code into a new class BControlLook,
of which there is a global instance be_control_look, instantiated
in InterfaceDefs.cpp. At the moment, all the old drawing code is
still there, and the usage of be_control_look is inside if-bodies
checking the instance against NULL. In another words, by not
instanitating be_control_look, you can revert back to the old look.
BControlLook's job is to provide reusable methods for drawing
certain types of frames, backgrounds and labels, so that application
developers can make controls that re-use the same drawing code
as built-in controls and adopt to changes made there. I have added
the notion of "borders". Each of the frame drawing methods can be
made to draw certain borders only, which is supposed to help when
controls shall visually attach. This feature is not fully explored
at all ATM.
TODO: Update BColumnListView header view and BStringItem text
spacing. Update other apps where it makes sense to use BControlLook.
For the moment, only Tracker and LaunchBox are updated. More...
NOTE: The new look is not very radically different, so that existing
apps do not immediately look too ugly or out of place.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29221 a95241bf-73f2-0310-859d-f6bbb57e9c96