History log of /haiku/headers/os/interface/ListView.h
Revision Date Author Comments
# 82bfaa95 22-Dec-2023 John Scipione <jscipione@gmail.com>

BListView: Add ScrollTo(index) method, auto-scroll on drag

Multi-select lists may also auto-scroll on drag now as well.

Document ScrollTo(index). Give Scrolling its own section.

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


# 6761bf58 13-Nov-2019 John Scipione <jscipione@gmail.com>

BListView: Update selection on mouse down and mouse up

A version of this feature was originally implemented in hrev50495
that allowed you to scroll through a list of list items while the
mouse was held down updating the selection as you went.

This feature was removed when we switched to selecting on mouse up
in hrev52062 and was never reimplimented when we switched back to
selecting on mouse down in hrev52121.

In BeOS R5 as you scrolled through a single-selection list with the
mouse button held down the selected item appeared to change, but
the selection didn't actually update until you released the mouse
button. The selection never changes on mouse down, only on mouse
up. You could click on one item then move your mouse off the first
item to a second item releasing your mouse button and it would
select the second item without ever selecting the first item.

In this commit we replicate this behavior with one exception, we
always select on mouse down, but still allow the selection to
change on mouse up.

The big difference between this and the BeOS behavior is that on
BeOS you could only select exactly one item on mouse up, while with
this you can select one item on mouse down and a second item on
mouse up.

ScrollToSelection() in MouseMoved() if mouse button is down and
we are not not dragging. This performs auto-scroll.

Create private _DoSelection() method copied from MouseDown().
Remove Thread.h include that is no longer used.

Fixes #15009 (and doesn't cause regression for #9190 #14264 #14289)

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


# 61557c82 04-Apr-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

BListView: do not spawn a thread on every mouse click.

That's a bad idea. The drag and drop tracking could get confused enough
to crash app_server (possibly because of calling InitiateDrag multiple
times?)

Fixes #14983.


# 4ee47fe9 25-Dec-2016 Rene Gollent <rene@gollent.com>

BListView: Cleanup, no functional change.

- Rename _FontChanged() to _UpdateItems() to more accurately reflect its
purpose, as discussed on commits list. Adjust callers accordingly.


# 2446f53b 18-Aug-2016 John Scipione <jscipione@gmail.com>

BListView: Impliment autoscroll

BeOS had a feature where you could click on a list and while holding
down the mouse button scroll through the list items selecting them
as you went. I implemented the same feature on Haiku.

Did the work in separate thread which makes sure that the mouse
is held down the whole time even if you leave the view.

Thanks Diver for bringing this feature to my attention.


# 9dfd244e 18-Aug-2016 John Scipione <jscipione@gmail.com>

BListView: Style fixes

* Rename kDoubleClickTresh to kDoubleClickThreshold
and use floating point in rval
* Pointer (*) goes with type for property var
* Use {}'s for multi-line if conditional
* rename point to where (consistent with header and rest of IK)
* Explicitly compare with 0 for bitwise operator statements
* Rename InitiateDrag() params


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

Set*UIColor, etc.

The inseparable changes necessary to support live color updating across the
system in a sane, safe, and performant manner.

BView gains:

HasSystemColors()
HasDefaultColors()
AdoptSystemColors()
AdoptParentColors()
AdoptViewColor(BView*)
SetViewUIColor(color_which, float tint)
SetHighUIColor(...
SetLowUIColor(...
ViewUIColor(float* tint)
HighUIColor(...
LowUIColor(...
DelayedInvalidate()

BWindow gains a simple helper method:
IsOffscreenWindow()

BMessage gains:

AddColor()
FindColor()
GetColor()
HasColor() * allegedly this API is deprecated, but I implemented it anyway
ReplaceColor()
SetColor()

Previous private ColorTools methods are made public and moved into GraphicsDefs:

mix_color, blend_color, disable_color

These are fully compatible with BeOS dan0 R5.1 methods and are just code cleanup
of BeOS example code under the OpenTracker license.

In addition, four new colors are created:
B_LINK_TEXT_COLOR
B_LINK_HOVER_COLOR
B_LINK_ACTIVE_COLOR
B_LINK_VISITED_COLOR

These changes are documented in their proper user documentation files.

In addition, due to a history rewrite, B_FOLLOW_LEFT_TOP has been defined and
used in lieu of B_FOLLOW_TOP | B_FOLLOW_LEFT and is included in this commit.

On the app_server side, the following has changed:

Add DelayedMessage - a system by which messages can be sent at a scheduled time,
and can also be merged according to set rules. A single thread is used to service the
message queue and multiple recipients can be set for each message.
Desktop gains the ability to add message ports to a DelayedMessage so that
said messages can target either all applications or all windows, as needed.

Desktop maintains a BMessage which is used to queue up all pending color changes
and the delayed messaging system is used to enact these changes after a short
period of time has passed. This prevents abuse and allows the system to merge
repeated set_ui_color events into one event for client applications, improving
performance drastically.

In addition, B_COLORS_UPDATED is sent to the BApplication, which forwards the message
to each BWindow. This is done to improve performance over having the app_server
independently informing each window.

Decorator changes are live now, which required some reworking.

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


# 1f424632 11-Jun-2014 John Scipione <jscipione@gmail.com>

Style fixes to IK, focus on docs


# 429ae1b1 09-Apr-2013 John Scipione <jscipione@gmail.com>

A few more style fixes to ListView and ColorSet, thanks Axel


# 63f3755c 08-Apr-2013 John Scipione <jscipione@gmail.com>

Many style fixes to ListView


# 89208c77 27-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Finished unifying the Interface Kit headers:
* Fixed copyrights (puncuation and capitalization, removed authors from
headers)
* Updated indentation style
* Unified pointer/reference style
* Re-ordered some methods for better grouping where it could be done
(abd adopted source accordingly)
* Small coding style fixes here and there

No functional change intended.

+alphabranch


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


# 42a5968a 26-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Cannot change the ordering of the additional virtual methods, or BC is
broken.
+alphabranch (if previous commit is also applied)


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


# 0a5897b7 26-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

* Updated indentation style
* Better grouping of methods
* Fixed copyright
+alphabranch


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


# 97970c5c 17-May-2009 Axel Dörfler <axeld@pinc-software.de>

* Applied a changed patch by Romain that fixes the non-working double click in
BListView. This fixes bug #3919. Got rid of the _TryInitiateDrag() method,
and let MouseMoved() do it all.
* Style cleanup of the header, automatic whitespace cleanup.


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


# fa6cd8ad 16-Nov-2008 Stephan Aßmus <superstippi@gmx.de>

* The previous change to reorder item->Update() and _RecalcItemTops() obviously
broke everything. If the added item has no chance to calculate it's height,
_RecalcItemTops() won't work of course. Whatever this was supposed to fix,
there has to be a correct way.
* Override BView::SetFont() to update all the items. I remember wanting to
implement this, that's why I refactored a _FontChanged() method, but I
obviousy never did...
* Moved the AttachedToWindow() and FrameMoved() implementations to a more
logical position in the file.
* Implement B_PAGE_UP/DOWN key presses. Don't know if that's what the BeOS
implementation did, will check later.


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


# 43948ef6 26-Feb-2008 Rene Gollent <anevilyak@gmail.com>

- Fix an error in SwapItems where the item tops would not be swapped
if the items were the same height.
- Modified _RecalcItemTops to allow us to specify a range instead of
just a starting point. This is useful for cases like Swap, where
only the items in between those being swapped need to be
recalculated.



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


# fef39304 24-Feb-2008 Stephan Aßmus <superstippi@gmx.de>

patch by Rene Gollent:
* BListItems now store the top offset of the frame within the parent BListView.
* This allows binary searching the clicked item.
* ItemFrame() is now a cheap call.
* Fixed several bugs in the sorting code of BOutlineListView which lead to
crashes of client applications.
* Implemented previously unimplemented functions in BOutlineListView.


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


# 9eae7400 10-Jun-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Implemented layout-friendly constructors. Also added MaxSize(), though it
only invokes the BView version. Didn't know what to do with MinSize() and
PreferredSize(). ATM they return fixed, hard-coded values. It might make
sense to compute something depending on the font size, for instance.


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


# 7f721ea1 14-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Cleanup.


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


# 9ecf9d1c 26-Aug-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

Merge from layout management branch.


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


# a2a6a329 16-May-2006 Stephan Aßmus <superstippi@gmx.de>

a bunch of ListView fixes:

* removed weird stuff that seemed to have no purpose in life
* added more comments where I had to figure things out
* fWidth is now adjusted in FrameResized()
* ListView scrolls up when items are removed at the end and
there would be empty room
* fixed SwapItems(), MoveItem() and ReplaceItem() by making
DoMiscellaneous() use the private implementations instead
of calling the public ones again resulting in an endless
loop
* renamed private methods with underscore
* removed more unused/empty private methods
* some slight performance increases here and there
* more correct tracking of fFirstSelected and fLastSelected,
at least I cannot reproduce one crash in the WonderBrush
Layer list anymore

even more cleanup and testing would not hurt though...



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


# 034104bc 14-Nov-2005 Stephan Aßmus <superstippi@gmx.de>

* fix invalidation of changed items
* fix deselecting items
* fix selection with the mouse and also holding down modifiers
* fix some more stuff I have already forgotten
* applied coding style in most places
* renamed private functions to be consistent

needs more work though, some stuff can definitely be
removed, some needs to be added


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


# b2d5d0de 29-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Completely replaced the ListView.h header - the old one wasn't compatible
with Be's and in a strange style.


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


# 52a38012 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


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


# 1f424632be5dcad5b81a23080eb205ab6471cd7b 11-Jun-2014 John Scipione <jscipione@gmail.com>

Style fixes to IK, focus on docs


# 429ae1b15159a177a5354d8f83d90fea164b6ffa 09-Apr-2013 John Scipione <jscipione@gmail.com>

A few more style fixes to ListView and ColorSet, thanks Axel


# 63f3755c5f73c5a450a36fb89b284db2ce1c4794 08-Apr-2013 John Scipione <jscipione@gmail.com>

Many style fixes to ListView


# 89208c77f10235d43fda0c7b3fd6751db02cc12c 27-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Finished unifying the Interface Kit headers:
* Fixed copyrights (puncuation and capitalization, removed authors from
headers)
* Updated indentation style
* Unified pointer/reference style
* Re-ordered some methods for better grouping where it could be done
(abd adopted source accordingly)
* Small coding style fixes here and there

No functional change intended.

+alphabranch


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


# 42a5968afd96536da3cdefd7da41ff9b3194b8de 26-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Cannot change the ordering of the additional virtual methods, or BC is
broken.
+alphabranch (if previous commit is also applied)


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


# 0a5897b71f07b6189a1003280c95ed0f69295fbb 26-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

* Updated indentation style
* Better grouping of methods
* Fixed copyright
+alphabranch


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


# 97970c5c26e1592cc29440ec59a311c3d2c72411 17-May-2009 Axel Dörfler <axeld@pinc-software.de>

* Applied a changed patch by Romain that fixes the non-working double click in
BListView. This fixes bug #3919. Got rid of the _TryInitiateDrag() method,
and let MouseMoved() do it all.
* Style cleanup of the header, automatic whitespace cleanup.


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


# fa6cd8ad6a0e6d6afecc7d311c30f615b0b1a47d 16-Nov-2008 Stephan Aßmus <superstippi@gmx.de>

* The previous change to reorder item->Update() and _RecalcItemTops() obviously
broke everything. If the added item has no chance to calculate it's height,
_RecalcItemTops() won't work of course. Whatever this was supposed to fix,
there has to be a correct way.
* Override BView::SetFont() to update all the items. I remember wanting to
implement this, that's why I refactored a _FontChanged() method, but I
obviousy never did...
* Moved the AttachedToWindow() and FrameMoved() implementations to a more
logical position in the file.
* Implement B_PAGE_UP/DOWN key presses. Don't know if that's what the BeOS
implementation did, will check later.


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


# 43948ef62891a0634661940a26ca48ff2c01caf2 26-Feb-2008 Rene Gollent <anevilyak@gmail.com>

- Fix an error in SwapItems where the item tops would not be swapped
if the items were the same height.
- Modified _RecalcItemTops to allow us to specify a range instead of
just a starting point. This is useful for cases like Swap, where
only the items in between those being swapped need to be
recalculated.



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


# fef393049965c3f0a2deed78de5a565e3d8d92e5 24-Feb-2008 Stephan Aßmus <superstippi@gmx.de>

patch by Rene Gollent:
* BListItems now store the top offset of the frame within the parent BListView.
* This allows binary searching the clicked item.
* ItemFrame() is now a cheap call.
* Fixed several bugs in the sorting code of BOutlineListView which lead to
crashes of client applications.
* Implemented previously unimplemented functions in BOutlineListView.


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


# 9eae7400a46a45be822d22e95d0097ea57460828 10-Jun-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Implemented layout-friendly constructors. Also added MaxSize(), though it
only invokes the BView version. Didn't know what to do with MinSize() and
PreferredSize(). ATM they return fixed, hard-coded values. It might make
sense to compute something depending on the font size, for instance.


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


# 7f721ea14dee0cbce2561e3fcb9a1f0d2352d9b3 14-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Cleanup.


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


# 9ecf9d1c1d4888d341a6eac72112c72d1ae3a4cb 26-Aug-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

Merge from layout management branch.


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


# a2a6a329e8856567d487f1eb043ebceb6c17c330 16-May-2006 Stephan Aßmus <superstippi@gmx.de>

a bunch of ListView fixes:

* removed weird stuff that seemed to have no purpose in life
* added more comments where I had to figure things out
* fWidth is now adjusted in FrameResized()
* ListView scrolls up when items are removed at the end and
there would be empty room
* fixed SwapItems(), MoveItem() and ReplaceItem() by making
DoMiscellaneous() use the private implementations instead
of calling the public ones again resulting in an endless
loop
* renamed private methods with underscore
* removed more unused/empty private methods
* some slight performance increases here and there
* more correct tracking of fFirstSelected and fLastSelected,
at least I cannot reproduce one crash in the WonderBrush
Layer list anymore

even more cleanup and testing would not hurt though...



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


# 034104bc0f7faad354431507eadca591f0785b61 14-Nov-2005 Stephan Aßmus <superstippi@gmx.de>

* fix invalidation of changed items
* fix deselecting items
* fix selection with the mouse and also holding down modifiers
* fix some more stuff I have already forgotten
* applied coding style in most places
* renamed private functions to be consistent

needs more work though, some stuff can definitely be
removed, some needs to be added


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


# b2d5d0de15f9035b5e6a5f6e65a88ad72e3ca277 29-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Completely replaced the ListView.h header - the old one wasn't compatible
with Be's and in a strange style.


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


# 52a380120846174213ccce9c4aab0dda17c72083 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


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