History log of /haiku/src/apps/deskbar/WindowMenuItem.cpp
Revision Date Author Comments
# ac121994 13-Oct-2023 John Scipione <jscipione@gmail.com>

Deskbar: Set sub-menus to menu font

Top level "menu" still uses be_plain_font, submenus use menu font.
Window submenus use menu font, but in super-expando mode they use
the plain font since they are on top level.

Change-Id: I704e9baa1ec46d1cbf7b9401ba4e49b5e2dff27c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7041
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# fb885767 04-May-2023 John Scipione <jscipione@gmail.com>

Deskbar: Use hvif window icons & scale with font

Add vector rdefs for shown, hidden, shown switch
and hidden switch icons. Remove unused bitmap
resources. Add window switch vector icons to
artwork.

Create window icon cache in TBarApp and cache the
window icons based on font size.
Fixes memory leak in #18357.

Don't draw off-workspace lines in Switcher, use
switch icon for that instead. Fixes crash reported
in #18359. Position icon and window name better in
Switcher.

Put BarTeamInfo icon parameter last and make it
optional, the icon gets set by caching.

Enable team icon cache and window icon cache.

Fixes #14694

Deskbar: Scale Twitcher icons based on font size

Remove the point ctor parameter and deprecate the
switcherLoc setting by not using or setting it and
leaving it at its default value.

Center window on screen resolution change and
workspace change (as resolution may not match).

Fixes #17924

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


# 69bbd7ad 05-May-2023 John Scipione <jscipione@gmail.com>

Deskbar: style fixes only

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


# 27b3dee8 11-Apr-2023 John Scipione <jscipione@gmail.com>

Revert "Deskbar: Use hvif window icons & scale with font"

This reverts commit 2b65e2d808b31a146569dd270b0e3fc0673471ba.


# 2b65e2d8 26-Mar-2023 John Scipione <jscipione@gmail.com>

Deskbar: Use hvif window icons & scale with font

Add rdef vector icons for shown, hidden, shown switch and
hidden switch. Reuse resource ids for vector icons. Remove
unused bitmap resources.

Fixes #17918.

Change-Id: I2ba1b126422f679c91f3272991c78d236198a358
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6260
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# f34e3931 29-Aug-2022 Augustin Cavalier <waddlesplash@gmail.com>

Deskbar: Correct sizing and placement of icons in window menus.

Fixes #17891.


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

Deskbar: Compute more metrics instead of hardcoding them.


# 1fab5517 03-Nov-2018 Axel Dörfler <axeld@pinc-software.de>

Deskbar: Center window icons in WindowMenuItem

* They had a fixed top offset which looked bad with larger font sizes.
* The icons should be replaced with vector icons, though, and properly
resized.


# 16c10517 09-Dec-2015 looncraz <looncraz@looncraz.net>

Deskbar: Convert to using Set*UIColor.

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


# c38afcd6 19-Feb-2015 John Scipione <jscipione@gmail.com>

Deskbar: Remove Name() and fName, replace with Label()

... from TeamMenuItem and WindowMenuItem.

It was confusing having Name(), Label(), and TruncatedLabel().

Name() == Label() because Label() never changes, the displayed
Label stored in TruncatedLabel() in both TeamWindowItem and
WindowMenuItem (remember they both inherit from
TruncatableMenuItem so they get that for free). So Name() was
redundant, by getting rid of it there is just Label() and TruncatedLabel()
which is all we need!


# 6b65d934 19-Feb-2015 John Scipione <jscipione@gmail.com>

Deskbar: some more style fixes, reorg methods


# 072c2dcd 19-Feb-2015 John Scipione <jscipione@gmail.com>

Deskbar: Add some pragma statements


# c9363f78 19-Feb-2015 John Scipione <jscipione@gmail.com>

Deskbar: Truncate menu item labels refactor

* Create a new TTruncatableMenuItem class to store the truncated string
and share the label truncation code between TTeamMenuItem and
TWindowMenuItem. In the future more shared code may be added to
this class, if so, the class name may change.
* The TTeamMenuItem and TWindowMenuItem classes inherit from
TTruncatableMenuItem, which inherits from BMenuItem.
* Make sure to truncate the label before drawing it in all cases.
* Some other related refactoring.

Fixes #9507


# 5e625ead 12-Feb-2015 John Scipione <jscipione@gmail.com>

Deskbar: Label truncation code refactor & cleanup

* Increase kVPad to 2.0f in ExpandoMenuBar matching the
constant in WindowMenuItem
* Also replace a hardcoded instance of 4.0f with kVPad * 2
* Remove TTeamMenuItem::DrawContentLabel(), move code to DrawContent()
* Cleanup label truncation code in TTeamMenuItem, still needs work.
* Rename WindowMenuItem::FullTitle() to Name() matching TeamMenuItem
* Move the code to set all label related variables in SetLabel() in
TeamMenuItem
* Change WindowMenuItem::SetRequireUpdate() to take a bool parameter
* Make WindowMenuItem::Initialize() private and rename it to _Init()
* Rename WindowMenuItem::ExpandedItem() to SetExpanded()
* Truncate WindowMenuItem label like we are doing TeamMenuItem
* Rename all WindowMenuItem::Title* methods and variables to Label*


# 4ae3e542 14-Apr-2013 John Scipione <jscipione@gmail.com>

Fix a bug where the Deskbar menu was incorrectly sized in horizontal mode

Actually, the Deskbar menu was sized correctly but the separator item was not,
so, I've replaced the separator item with a new TSeparatorItem class that is derived
from BSeparatorItem but does it's own drawing. This neatly avoids the bug since
the TSeperatorItem doesn't need to be resized explicitly.

Also, there were some instances of AddSeperatorItem (with an e) that I renamed to
AddSeparatorItem (with an a). I also eliminated includes in the header which means
I added them in some cpp files where they were needed.


# 859c3781 11-Feb-2013 John Scipione <jscipione@gmail.com>

Update Deskbar to use menu text and selected menu text color prefs.

... in a couple of places where colors where being hardcoded.

Fixes #9119


# e19488b2 02-Aug-2012 Ryan Leavengood <leavengood@gmail.com>

Make Deskbar respect the menu text color settings.

Hard-coding black is bad, mmmkay?

This makes Deskbar usable on dark background with light text color schemes.


# ab4e79c3 02-Aug-2012 Ryan Leavengood <leavengood@gmail.com>

Fix Deskbar based on my recent menu change.

Thanks augiedoggie for pointing it out.


# 1cd61330 02-May-2012 John Scipione <jscipione@gmail.com>

Style fixes including reordering #include's in Deskbar

* Reorder includes according to the Style Guide.
* Whitespace changes, mostly making sure there are 2 newlines
between things and making sure there is 1 newline at the end of
each file.
* Make end of header files all in the style of
#endif\t/* _HEADER_GAURD_H_ */
* The one change that is not purely style is to #include <Path.h>
in DeskbarUtils.h instead of DeskbarUtils.cpp because it is used
to define entry_ref for the AddRefsToDeskbarMenu() prototype.


# 5e8f4256 03-Mar-2012 Adrien Destugues - PulkoMandy <pulkomandy@pulkomandy.tk>

Revert part of r43092.
* Caching of CountItems() to avoid calling it at each loop iteration
* Use of strcasecmp when comparing strings for exact equality


# 7eb3210e 05-Nov-2011 John Scipione <jscipione@gmail.com>

Sort application windows in Deskbar in 'natural' order yielding this:

window 1
window 2
window 3
window 4
window 5
window 6
window 7
window 8
window 9
window 10
window 11

Instead of this:

window 1
window 10
window 11
window 2
window 3
window 4
window 5
window 6
window 7
window 8
window 9

The natural order comparison method used in Deskbar is the same method used
to sort file names in natural order in Tracker.

Also when comparing window titles to their corresponding window menu item
labels use the FullTitle() method instead of the Label() method because the
label might get truncated.

Fixes #7774

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


# 1687edd0 06-Mar-2011 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Final set of style cleanup patches by John Scipione as part of #7052.


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


# eddec292 21-Jul-2010 Oliver Tappe <zooey@hirschkaefer.de>

* applied patch by kaliber that fixes more than 100 warnings - thanks a lot!
Closes #6349

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


# 1c7348a7 21-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Moved the window item sort logic as static method into the TWindowMenuItem
class.
* Changed ExpandoMenuBar to use that logic as well, so that your entries will
always keep the same sort order.


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


# 2a5ee870 17-Oct-2009 Stephan Aßmus <superstippi@gmx.de>

Implemented enhencement ticket #4799.


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


# 290c9039 29-Sep-2009 Jonas Sundström <jonas@kirilla.com>

Partial clean-up. Asterisks and k-prefix constants.

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


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

* Do not draw the BMenuItem content twice. (Fixes bad anti-aliasing of labels
when applications are expanded in the Deskbar.)
* Simplified setting B_OP_COPY drawing mode.
* PopState() at the end of drawing, not before.


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


# eaa9af99 12-Oct-2008 Stephan Aßmus <superstippi@gmx.de>

Never use the current menu UI color, but always the view color of any given
menu. Fixes #974.


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


# 207e1769 03-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Coding style cleanup.


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


# 7da06231 01-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Imported Deskbar from OpenTracker-current.


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


# 41281cf3 22-May-2005 Axel Dörfler <axeld@pinc-software.de>

Added Tracker and Deskbar from OpenTracker-current to the repository.
They both build fine.


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


# c38afcd62ca869cd169ed52fa171db35352bbd00 19-Feb-2015 John Scipione <jscipione@gmail.com>

Deskbar: Remove Name() and fName, replace with Label()

... from TeamMenuItem and WindowMenuItem.

It was confusing having Name(), Label(), and TruncatedLabel().

Name() == Label() because Label() never changes, the displayed
Label stored in TruncatedLabel() in both TeamWindowItem and
WindowMenuItem (remember they both inherit from
TruncatableMenuItem so they get that for free). So Name() was
redundant, by getting rid of it there is just Label() and TruncatedLabel()
which is all we need!


# 6b65d934dfcf372c2c527a6cc4c2d3536754834f 19-Feb-2015 John Scipione <jscipione@gmail.com>

Deskbar: some more style fixes, reorg methods


# 072c2dcde2955c2503b240cf7561da38ad50f536 19-Feb-2015 John Scipione <jscipione@gmail.com>

Deskbar: Add some pragma statements


# c9363f78d67001545182ce032918648ccb3d6e16 19-Feb-2015 John Scipione <jscipione@gmail.com>

Deskbar: Truncate menu item labels refactor

* Create a new TTruncatableMenuItem class to store the truncated string
and share the label truncation code between TTeamMenuItem and
TWindowMenuItem. In the future more shared code may be added to
this class, if so, the class name may change.
* The TTeamMenuItem and TWindowMenuItem classes inherit from
TTruncatableMenuItem, which inherits from BMenuItem.
* Make sure to truncate the label before drawing it in all cases.
* Some other related refactoring.

Fixes #9507


# 5e625ead65c3e04f9246a0b47ba24cea15e75428 12-Feb-2015 John Scipione <jscipione@gmail.com>

Deskbar: Label truncation code refactor & cleanup

* Increase kVPad to 2.0f in ExpandoMenuBar matching the
constant in WindowMenuItem
* Also replace a hardcoded instance of 4.0f with kVPad * 2
* Remove TTeamMenuItem::DrawContentLabel(), move code to DrawContent()
* Cleanup label truncation code in TTeamMenuItem, still needs work.
* Rename WindowMenuItem::FullTitle() to Name() matching TeamMenuItem
* Move the code to set all label related variables in SetLabel() in
TeamMenuItem
* Change WindowMenuItem::SetRequireUpdate() to take a bool parameter
* Make WindowMenuItem::Initialize() private and rename it to _Init()
* Rename WindowMenuItem::ExpandedItem() to SetExpanded()
* Truncate WindowMenuItem label like we are doing TeamMenuItem
* Rename all WindowMenuItem::Title* methods and variables to Label*


# 4ae3e5421d4009205c273ec076bdcb5e1f21f936 14-Apr-2013 John Scipione <jscipione@gmail.com>

Fix a bug where the Deskbar menu was incorrectly sized in horizontal mode

Actually, the Deskbar menu was sized correctly but the separator item was not,
so, I've replaced the separator item with a new TSeparatorItem class that is derived
from BSeparatorItem but does it's own drawing. This neatly avoids the bug since
the TSeperatorItem doesn't need to be resized explicitly.

Also, there were some instances of AddSeperatorItem (with an e) that I renamed to
AddSeparatorItem (with an a). I also eliminated includes in the header which means
I added them in some cpp files where they were needed.


# 859c378175de9013dda77d57199efc4c962215e0 11-Feb-2013 John Scipione <jscipione@gmail.com>

Update Deskbar to use menu text and selected menu text color prefs.

... in a couple of places where colors where being hardcoded.

Fixes #9119


# e19488b2ccb0bfaf518e2c77180905996111a628 02-Aug-2012 Ryan Leavengood <leavengood@gmail.com>

Make Deskbar respect the menu text color settings.

Hard-coding black is bad, mmmkay?

This makes Deskbar usable on dark background with light text color schemes.


# ab4e79c3510f97e58a988622041c5c7ecceb82e5 02-Aug-2012 Ryan Leavengood <leavengood@gmail.com>

Fix Deskbar based on my recent menu change.

Thanks augiedoggie for pointing it out.


# 1cd61330ecd8257551d58f204332d00145c855ec 02-May-2012 John Scipione <jscipione@gmail.com>

Style fixes including reordering #include's in Deskbar

* Reorder includes according to the Style Guide.
* Whitespace changes, mostly making sure there are 2 newlines
between things and making sure there is 1 newline at the end of
each file.
* Make end of header files all in the style of
#endif\t/* _HEADER_GAURD_H_ */
* The one change that is not purely style is to #include <Path.h>
in DeskbarUtils.h instead of DeskbarUtils.cpp because it is used
to define entry_ref for the AddRefsToDeskbarMenu() prototype.


# 5e8f4256fedbb33eaed7766843a5074a8b518470 03-Mar-2012 Adrien Destugues - PulkoMandy <pulkomandy@pulkomandy.tk>

Revert part of r43092.
* Caching of CountItems() to avoid calling it at each loop iteration
* Use of strcasecmp when comparing strings for exact equality


# 7eb3210e8f56c924148b23f129dbdc3f2670d828 05-Nov-2011 John Scipione <jscipione@gmail.com>

Sort application windows in Deskbar in 'natural' order yielding this:

window 1
window 2
window 3
window 4
window 5
window 6
window 7
window 8
window 9
window 10
window 11

Instead of this:

window 1
window 10
window 11
window 2
window 3
window 4
window 5
window 6
window 7
window 8
window 9

The natural order comparison method used in Deskbar is the same method used
to sort file names in natural order in Tracker.

Also when comparing window titles to their corresponding window menu item
labels use the FullTitle() method instead of the Label() method because the
label might get truncated.

Fixes #7774

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


# 1687edd0fde594cd6f7c88f58a264c4787b4327d 06-Mar-2011 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Final set of style cleanup patches by John Scipione as part of #7052.


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


# eddec292d5dd8251a00851880e16e6a5c07c1e3f 21-Jul-2010 Oliver Tappe <zooey@hirschkaefer.de>

* applied patch by kaliber that fixes more than 100 warnings - thanks a lot!
Closes #6349

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


# 1c7348a787c023de6350e33a151017b2977f9d05 21-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Moved the window item sort logic as static method into the TWindowMenuItem
class.
* Changed ExpandoMenuBar to use that logic as well, so that your entries will
always keep the same sort order.


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


# 2a5ee8702997f303f3375f521aae7723f44f9295 17-Oct-2009 Stephan Aßmus <superstippi@gmx.de>

Implemented enhencement ticket #4799.


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


# 290c903985a449fa86c501366b6fcddf7f55b46a 29-Sep-2009 Jonas Sundström <jonas@kirilla.com>

Partial clean-up. Asterisks and k-prefix constants.

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


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

* Do not draw the BMenuItem content twice. (Fixes bad anti-aliasing of labels
when applications are expanded in the Deskbar.)
* Simplified setting B_OP_COPY drawing mode.
* PopState() at the end of drawing, not before.


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


# eaa9af9937ed538a6e175852bee9f22a2c20a814 12-Oct-2008 Stephan Aßmus <superstippi@gmx.de>

Never use the current menu UI color, but always the view color of any given
menu. Fixes #974.


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


# 207e17691547b85d869c0330cb7858fd3ded5877 03-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Coding style cleanup.


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


# 7da062312a13b77ed1aac63bdd67c44c44ad5824 01-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Imported Deskbar from OpenTracker-current.


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


# 41281cf362916855e6eb9ad1d728d919863a1e81 22-May-2005 Axel Dörfler <axeld@pinc-software.de>

Added Tracker and Deskbar from OpenTracker-current to the repository.
They both build fine.


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