History log of /haiku/src/kits/interface/HaikuControlLook.cpp
Revision Date Author Comments
# 9c274ccd 28-Feb-2024 Pascal Abresch <nep-git@packageloss.eu>

Document new rgb_color apis, apply their usage.

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


# 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>


# 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>


# 6021345a 09-Sep-2022 Augustin Cavalier <waddlesplash@gmail.com>

HaikuControlLook: Correct drawing of border in menu fields.

Fixes #17903.


# da9dee37 26-Aug-2022 Augustin Cavalier <waddlesplash@gmail.com>

HaikuControlLook: Scale the width of the popup dropdown region.

Instead of hardcoding it.
TODO: Other ControlLooks in the tree should also be fixed for this.


# 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>


# e3927d6a 10-Jan-2021 Adrien Destugues <adrien.destugues@opensource.viveris.fr>

Haiku control look: bring back the tab seams

They were accidentally removed in hrev54634 in an attempt to clean up
the code.

Reintroduce the old logic with some cleanup and improvements:
- There was a mixup of "tab side" vs "border". The constant values for
the two are the same, so it still worked as designed, but it made the
code harder to follow since it deals with both borders and tab sides.
- Define an isVertical boolean to decide if the tab view is vertical,
avoiding repeated tests for specific tabview sides.

Fixes #16640.


# ff21b4c3 22-Nov-2020 Pascal Abresch <nep@packageloss.eu>

HaikuControlLook: don't modify menu color before applying it

Change-Id: I31838d4c17d4616c2c166197596a93bf51785677
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3410
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 7c095f47 01-Jun-2020 John Scipione <jscipione@gmail.com>

BeControlLook: Fix app integration drawing issues

Update BTab::DrawTab() to pass the current index, the index of the
selected tab, and the index of the first and last tabs into
BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab().
This allows you to draw tabs differently in your BTab or BControlLook
subclass in many different circumstances.

Modify BControlLook API to add indexes to DrawActiveTab() and
DrawInactiveTab() like so:

void DrawActiveTab(..., int32 index = 0, int32 selected = -1,
int32 first = 0, int32 last = 0);
void DrawInactiveTab(..., int32 index = 0, int32 selected = -1,
int32 first = 0, int32 last = 0);

These extra indexes are not used by HaikuControlLook which relies only
on if the tab is active or inactive to draw.

Add IndexOf(BTab* tab) method to BTabView and document it to get the
index of the current tab in BTab::DrawTab(). Also add a warning in the
BTabView::DrawTab() method not to use the position and full parameters
anymore, use BTabView::IndexOf(), BTabView::Selection(), and
BTabView::TabCount() to get the info you need.

Using a dynamic_cast to a BTabView in BeControlLook to determine if the
view is derived from a BTabView didn't work in the case of WebPositive.
Furthermore, WebPositive does custom tab drawing which needed to be
updated for alternative control look. These index parameters passed from
BTab to BeControlLook allow us to draw the tab like BeOS without relying
on a dynamic_cast to BTabView to get the info.

Reproduce the functionality described above for BTab in WebPositive's
custom tabs. Eliminate no longer needed code in favor of using indexes.
Update WebPositive custom tabs to use BControlLook::DrawTabFrame()
instead of BControlLook::DrawInactiveTab() matching the update made in
BTabView.

In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive
doesn't draw any tab background, so it expects this work to be done for
it.

Eliminate hasFrames variable from WebPositive.

Rename TabSelected(index) to UpdateSelection(index) in WebPositive to
better reflect its purpose.

Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more
selectively. Only draw border if left border is set for top and bottom tabs
or top border is set for left and right tabs. Undo no longer needed frame
manipulation border drawing workaround in HaikuControlLook::DrawTabFrame().

Draw scroll bar triangle without using DrawArrowShape().

Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in
BOutlineListView and menus distinctly from how it draws arrows in scroll
bars. Draw our distinct arrows in DrawSrollBarButtons() instead.

This fixes overflow of time edit up-down arrows in Clock prefs and the
collapse-expand arrow in Deskbar not being vertically centered.

In DrawBorders() only inset if we actually draw the border.

Fix alignment issues with DrawSliderThumb dots for example in
MediaPlayer volume knobs.

Draw using line arrays calling AddLine instead of StrokeLine in
several places.

DrawMenuBar() extends to draw final pixel which eliminates an extra
lines at the end of menu bars.

Truncate button labels better fixing a few issues for example keymap
keyboard layout button labels. Button insets has been updated a bit
to fix drawing issues with buttons missing a border.

Using a dynamic_cast to a BButton to determine if a view is a button
in BeControlLook didn't work in the case of the keymap label. Look for
B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel()
to draw the label inverted on click. Pass the B_FLAT flag from Keymap
keys when drawing using BControlLook so that the label is inverted.

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


# 2d68cd06 04-Jul-2020 Augustin Cavalier <waddlesplash@gmail.com>

HaikuControlLook: Scale frame insets.

This is a pretty simple change, but has a noticeable effect
on insets throughout the system under HiDPI.


# 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>


# aabebc30 27-Aug-2019 Mikael Konradsson <mikael.konradsson@outlook.com>

Interface Kit: Fix some hard-coded colors.

* Fix hardcoded black color in SeparatorView that caused invisible or
hard to read labels if you had a dark panel color. E.g MediaPrefs
* DrawBorder in HaikuControl didn't care about dark mode. Added check
for light/dark and changed the Tinting accordingly. We should probably
do the same for FancyBorder style as well.

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


# fe66a314 22-Jul-2018 waddlesplash <waddlesplash@gmail.com>

Revert "BScrollBar: Add lines and dots knob styles to scroll bar"

This reverts commit ec1b18c58ae632444200f7e1f952ddd2e31048fa.

This was not well enough reviewed, and it seems that at least some
consumers of the old API (e.g. WebPositive) need more than the new one provides.

Change-Id: Ie7ad1fc70dab889922424298661504b00f66d31d


# ec1b18c5 14-Jul-2018 John Scipione <jscipione@gmail.com>

BScrollBar: Add lines and dots knob styles to scroll bar

Fixes #9137

Move scroll bar drawing into HaikuControlLook

Added B_SCROLLABLE flag to BControlLook

Update FakeScrollBar in Appearance to also draw using HaikuControlLook.

Focus works on scroll bars again, used by FakeScrollBar... and probably
nowhere else.

Added private _ScrollingEnabled() convenience method to BScrollBar and
use it in a few places making.

Create ScrollBarPrivate.h header to share a couple of scroll bar related
enums with HaikuControlLook that come from BeOS Scroll Bar prefs.

Stuff arrow_direction enum into BScrollBar::Private as it has been
succeeded by a similar enum already present in BControlLook and is only
around now for BScrollBar::Private::DrawScrollBarButton.

Change-Id: Idc31ee41de091ba45ded2f0315a004af00143803


# 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.