History log of /haiku/src/apps/deskbar/TeamMenuItem.h
Revision Date Author Comments
# 4f97a431 07-Apr-2023 John Scipione <jscipione@gmail.com>

Deskbar: Make Vulcan Death Grip work in mini-mode

Refactor so that ExpandoMenuBar and TeamMenu both call the menu item
TeamMenuItem::HandleMouseDown() method to do the actual work and then
send a message to cleanup.

Fixes #17761

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


# 15eb397e 19-Jul-2018 John Scipione <jscipione@gmail.com>

Deskbar: Adjust team menu items with font size.

The Deskbar team menu should look the same at 12pt but much better
at larger (and smaller) font sizes.

Determine team menu item height in TBarView instead of
TTeamMenuItem::GetContentSize() because it is needed earlier in the
process, and also call method in GetContentSize().

The clock is centered horizontally in the first replicant row and the
width can grow to push the replicant icons better at larger font sizes.

The replicant tray and clock go to the bottom in horizontal bottom mode
and go to the top in horizontal top mode for Fitt's Law convinience and
go in the center of the first row in vertical mode.

Grow horizontal team item widths with font size, and shrink them
down to 1/2 of full width to fit more, or 1/2 padding for icon-only.

In horizontal mode the menu item size increases so that you can fit
approximate the same amount of label text based on icon and font size.
hit the width limit the items shrink and the label gets truncated
(like before.)

Scale team menu with font size. Reduce to half width for hide labels.

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


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


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

Deskbar: Rename _InitData() to just _Init()

in TeamMenuItem. For consistency.


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

Deskbar: fixup Deskbar: Truncate menu item labels refactor

c9363f78d67001545182ce032918648ccb3d6e16


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

Deskbar: ExpandoMenuBar & TeamMenuItem no longer friends


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

Deskbar: some more style fixes, reorg methods


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


# c9d2a320 06-Jan-2014 John Scipione <jscipione@gmail.com>

Deskbar: TTeamMenuItem changes

* Add Icon() and SetIcon() methods.
* Remove HasLabel() and SetHasLabel() methods, ExpandoMenuBar now gets
this information from the settings file directly, rather than storing
and syncing this information with the TTeamMenuItem class.
* Move SetOverrideWidth(), SetOverrideHeight(), and
SetArrowDirection() implementations to header.


# 18bcf77a 06-Jan-2014 John Scipione <jscipione@gmail.com>

Deskbar: Don’t save fHasLabel and fVertical

in the TTeamMenuItem, get it from the parent or settings instead.


# 9f339a00 06-Jan-2014 John Scipione <jscipione@gmail.com>

Deskbar: Style fixes only


# 1dccb7aa 07-Apr-2013 John Scipione <jscipione@gmail.com>

Don't call DrawExpanderArrow() directly, set a variable and Invalidate()


# 5b0fd10d 07-Apr-2013 John Scipione <jscipione@gmail.com>

Animate the expander arrow

On MouseDown draw a diagonal arrow, on MouseUp complete the animation and
expand. If you hold down the button it will stay diagonal until you MouseUp
and either return to normal or animate and expand if over the arrow.

Reformatted ExpandoMenuBar.h and TeamMenuItem.h
Renamed fLastClickItem to fLastClickedItem
Added a DrawExpanderArrow() method
Renamed private InitData() method to _InitData() and moved it to the bottom


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

Refactor Tooltip's in Deskbar.

Only update the tooltip if the mouse goes over a new menu item making
sure to exit if the item is NULL, there is a visible label, or it is the
same item. If the mouse moves outside the view reset the last item to
NULL.

* Rename DrawLabel() and SetDrawLabel() to HasLabel() and SetHasLabel()
to make it clear what these methods are setting a getting and setting
a bool and not doing the actual work for drawing the label.


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


# 1f0c9f18 23-Apr-2012 John Scipione <jscipione@gmail.com>

Set a tooltip with the application name if hidden.

If Deskbar is set to hide application names show the application
name as a tooltip when you hover your mouse over the item.

* Style fixes.
* Save CountItems() into a variable outside the loop so that it only
gets called once (micro-optimization/best-practice).
* Convert a for loop to a while loop that wasn't really being used
used as a for loop anyway, the variables are declared and used
outside the loop.


# 2ce9bab8 27-Jun-2011 John Scipione <jscipione@gmail.com>

Fisher Price Deskbar icon support

Implements the feature described in #7132
Also fixes #2387 (menu items too big in horizontal mode when font size > 12)

Adds a slider to Deskbar preferences which allows you to resize your Deskbar
team icons from 16x16 to 96x96. The default is 16x16. This works both in vertical
and horizontal mode.

In vertical mode when icon sizes are greater than 32x32 the label moves
underneath the icon where there is more room. In horizontal mode the width of
the menu item increases to make room for the icon while keeping room for the
label the same. As many applications are added the labels are truncated as usual.

This patch also adds a checkbox to the Deskbar preferences to hide application
names to make more room for icons if you wish. It doesn't make a lot of sense
at 16x16 but does >32x32.

If the kResizeTeamIcons message gets dropped, don't resize to current value,
just do nothing. This fixes a bug where sometimes the slider wouldn't trigger
a resize. Fix a spelling error in a comment. Take out a redundant paren pair.


# 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


# 71bd3ba5 30-Sep-2009 Jonas Sundström <jonas@kirilla.com>

Removing ifdefs and code for non-Haiku build targets. Partial clean-up. Enforcing the 80-char limit, renaming constants, newline at end of file.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33377 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


# 249a4a18 13-Oct-2008 Stephan Aßmus <superstippi@gmx.de>

zooey + stippi:
Reimplemented the drag message over the team entries dragging. The previous
implementation used the menu bar tracking by faking a B_MOUSE_DOWN event. The
problem was that in Haiku menus are always sticky and therefor the tracking
thread was not exited when the user released the mouse (which was supposed to
trigger the drop event in the Deskbar). The new implementation follows the
drag in the asynchronous mouse hooks and uses it's own selection state in
TTeamMenuItem to highlight the eventual drop targets.
Fixes #2771.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28063 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!


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

Deskbar: Rename _InitData() to just _Init()

in TeamMenuItem. For consistency.


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

Deskbar: fixup Deskbar: Truncate menu item labels refactor

c9363f78d67001545182ce032918648ccb3d6e16


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

Deskbar: ExpandoMenuBar & TeamMenuItem no longer friends


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

Deskbar: some more style fixes, reorg methods


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


# c9d2a320a332f0a218d9da0a60f1782b63f97585 06-Jan-2014 John Scipione <jscipione@gmail.com>

Deskbar: TTeamMenuItem changes

* Add Icon() and SetIcon() methods.
* Remove HasLabel() and SetHasLabel() methods, ExpandoMenuBar now gets
this information from the settings file directly, rather than storing
and syncing this information with the TTeamMenuItem class.
* Move SetOverrideWidth(), SetOverrideHeight(), and
SetArrowDirection() implementations to header.


# 18bcf77ab08a66f3820fa608a124b199742a0070 06-Jan-2014 John Scipione <jscipione@gmail.com>

Deskbar: Don’t save fHasLabel and fVertical

in the TTeamMenuItem, get it from the parent or settings instead.


# 9f339a005bd0f5ffd8d6f49ae26cc498417e36fa 06-Jan-2014 John Scipione <jscipione@gmail.com>

Deskbar: Style fixes only


# 1dccb7aaaf95547c40b23225da0d9bde9e8d9a49 07-Apr-2013 John Scipione <jscipione@gmail.com>

Don't call DrawExpanderArrow() directly, set a variable and Invalidate()


# 5b0fd10d23d2c57ab32c256784daafa2b97860fa 07-Apr-2013 John Scipione <jscipione@gmail.com>

Animate the expander arrow

On MouseDown draw a diagonal arrow, on MouseUp complete the animation and
expand. If you hold down the button it will stay diagonal until you MouseUp
and either return to normal or animate and expand if over the arrow.

Reformatted ExpandoMenuBar.h and TeamMenuItem.h
Renamed fLastClickItem to fLastClickedItem
Added a DrawExpanderArrow() method
Renamed private InitData() method to _InitData() and moved it to the bottom


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

Refactor Tooltip's in Deskbar.

Only update the tooltip if the mouse goes over a new menu item making
sure to exit if the item is NULL, there is a visible label, or it is the
same item. If the mouse moves outside the view reset the last item to
NULL.

* Rename DrawLabel() and SetDrawLabel() to HasLabel() and SetHasLabel()
to make it clear what these methods are setting a getting and setting
a bool and not doing the actual work for drawing the label.


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


# 1f0c9f183e3bd12f6056ca2251438ffada696d58 23-Apr-2012 John Scipione <jscipione@gmail.com>

Set a tooltip with the application name if hidden.

If Deskbar is set to hide application names show the application
name as a tooltip when you hover your mouse over the item.

* Style fixes.
* Save CountItems() into a variable outside the loop so that it only
gets called once (micro-optimization/best-practice).
* Convert a for loop to a while loop that wasn't really being used
used as a for loop anyway, the variables are declared and used
outside the loop.


# 2ce9bab873e024bb515a95faf384df62b88bbb8c 27-Jun-2011 John Scipione <jscipione@gmail.com>

Fisher Price Deskbar icon support

Implements the feature described in #7132
Also fixes #2387 (menu items too big in horizontal mode when font size > 12)

Adds a slider to Deskbar preferences which allows you to resize your Deskbar
team icons from 16x16 to 96x96. The default is 16x16. This works both in vertical
and horizontal mode.

In vertical mode when icon sizes are greater than 32x32 the label moves
underneath the icon where there is more room. In horizontal mode the width of
the menu item increases to make room for the icon while keeping room for the
label the same. As many applications are added the labels are truncated as usual.

This patch also adds a checkbox to the Deskbar preferences to hide application
names to make more room for icons if you wish. It doesn't make a lot of sense
at 16x16 but does >32x32.

If the kResizeTeamIcons message gets dropped, don't resize to current value,
just do nothing. This fixes a bug where sometimes the slider wouldn't trigger
a resize. Fix a spelling error in a comment. Take out a redundant paren pair.


# 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


# 71bd3ba59c06b130115c3ddd44457d8f9dd78997 30-Sep-2009 Jonas Sundström <jonas@kirilla.com>

Removing ifdefs and code for non-Haiku build targets. Partial clean-up. Enforcing the 80-char limit, renaming constants, newline at end of file.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33377 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


# 249a4a187ee9e9e24aa41146e071ad1c01e27283 13-Oct-2008 Stephan Aßmus <superstippi@gmx.de>

zooey + stippi:
Reimplemented the drag message over the team entries dragging. The previous
implementation used the menu bar tracking by faking a B_MOUSE_DOWN event. The
problem was that in Haiku menus are always sticky and therefor the tracking
thread was not exited when the user released the mouse (which was supposed to
trigger the drop event in the Deskbar). The new implementation follows the
drag in the asynchronous mouse hooks and uses it's own selection state in
TTeamMenuItem to highlight the eventual drop targets.
Fixes #2771.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28063 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