History log of /haiku/src/kits/interface/MenuItem.cpp
Revision Date Author Comments
# 5f603da0 17-Jul-2018 Adrien Destugues <pulkomandy@pulkomandy.tk>

Better shape for submenu arrow

Just use BControLook where appropriate. It already provides a nice arrow
drawing function (also used in DeskBar expander and in scrollbar
buttons).

Fix second part of #8900

Changes by John Scipione:

Update menu mark and submenu arrow color with menu text color

Use text color for checkmark and submenu arrow colors, tint less black.
This means that colored bg/white text menu item will also draw a white
checkmark and submenu arrow.

Break out BMenuItem::Draw functionality into private methods _IsActive,
_LowColor() and _HighColor() methods and use them to set the mark colors.

Scale submenu arrow and checkmark with item height (which scales with
font size.)

does not align shortcuts with submenu arrows... but if you were to do
that you'd add item->Bounds().Height() / 2.

Signed-off-by: John Scipione <jscipione@gmail.com>

Change-Id: I8299094ef88bf227510b116eb1b84c261dc94723
Reviewed-on: https://review.haiku-os.org/c/341
Reviewed-by: Stefano Ceccherini <stefano.ceccherini@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# df4074fb 24-Nov-2018 Augustin Cavalier <waddlesplash@gmail.com>

Remove a lot of unused constants.

Spotted by Clang. No functional change intended.


# c3ac0a72 11-Sep-2018 Augustin Cavalier <waddlesplash@gmail.com>

BMenuItem: Remove ourselves from the super menu on destruct.

This fixes the (intermittently) crashing test added in the previous commit,
and should also fix #12024 and #14348.

Note that this is a slight behavioral departure from BeOS, though since
BeOS crashed when this was done previously, it shouldn't cause any
other problems.

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


# bd4ea656 11-Jul-2016 John Scipione <jscipione@gmail.com>

BMenuItem: Style fixes

* explict NULL check
* explicit boolean comparison and pointer style fixes


# 61dfdec4 19-Apr-2016 John Scipione <jscipione@gmail.com>

BMenu and friends: style fixes

BMenuBar: style fix: msg => message

MenuPrivate: style fixes

MenuItem: 80 char limit style fix

MenuBar: tiny style fix

Menu: tiny style fix, indentation

Menu: Small refactor

Implement _SetIgnoreHidden() in header
Change on to ignoreHidden
Change on in _SetStickyMode to sticky

_BMCItem_: tiny whitespace style fix

Menu: style fixes, rename msgr => messenger

BMenu: style fix, pointer != NULL

BMenu::Archive rename ret to status

Also check pointer against NULL explicitly

BMenuItem style fixes: rename abbreviation, pointer style


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


# ac9ec47d 09-Sep-2015 Axel Dörfler <axeld@pinc-software.de>

BMenu: made left side padding font size relative.

* Also changed BMenuItem to make better use of that size.


# 379ede58 04-Mar-2014 John Scipione <jscipione@gmail.com>

Style fixes to BMenuItem::GetContentSize and update docs

Rename width and height to _width and _height matching the header.

Update the documentation for this method as well.


# fa412b5f 28-Feb-2014 John Scipione <jscipione@gmail.com>

BMenuItem: Style fixes related to documentation.


# db85cbe0 20-Aug-2013 John Scipione <jscipione@gmail.com>

MenuItem: Set and restore the low color too

A small revision on my last published commit, set and restore the
low color in addition to the high color when drawing the menu item
because DrawString() will produce nicer looking results if the low
color of the view matches the color it draws on due to anti-aliasing.


# dec0a352 20-Aug-2013 John Scipione <jscipione@gmail.com>

MenuItem: Fix disabled sub-menu item color

See #6610 comment:15 for details.

Firstly, don't save and restore the super menu's low color
since it never changes, instead, save and restore the super
menu's high color which does get altered here.

Secondly, set the high color to
B_MENU_SELECTED_ITEM_TEXT_COLOR only if the menu item
is activated and enabled, otherwise set the high color by tinting the
background color which might be
B_MENU_SELECTED_BACKGROUND_COLOR or
B_MENU_BACKGROUND_COLOR depending on whether
the item is selected or not.

Thirdly, complete the TODO by using a lighten tint if the menu
has a dark background and vice-versa.

This third item is actually a good candidate for a BControlLook
function because the disabled tint should depend on whether the
background color of the thing you're disabling is light or dark.


# d926be8a 29-May-2013 John Scipione <jscipione@gmail.com>

BMenuItem: Check MaxContentWidth for truncation


# a61d468c 08-May-2013 John Scipione <jscipione@gmail.com>

BMenuItem: Round to prevent unneeded truncation

The case I fear is if frameWidth is 99.999999 and labelWidth is 100.0
it will attempt to perform a truncation unnecessarily.


# c1a7e89f 06-May-2013 John Scipione <jscipione@gmail.com>

Put the label truncation code back in BMenuItem.

Just a few commits ago I moved the label truncation code out of
BMenuItem and into BMCMenuBar because the truncation had to happen
outside of BMenuItem. Turns out, that wasn't true so I'm moving the
label truncation back into BMenuItem and removing the _DrawItems()
method from BMCMenuBar.

Note that the code is not a copy of what was there before, but, the
updated version I created for BMCMenuBar. The main difference is that
I use menuPrivate.Padding() instead of GetItemMargins() and I always
use the width of the parent menu frame instead of using fBounds even
if the state is not MENU_STATE_CLOSED. These are changes needed for
BMCMenuBar but should work just as well for a regular BMenu.


# c3339662 06-May-2013 John Scipione <jscipione@gmail.com>

Draw truncated menu label in BMCPrivate, fixes #9735

...instead of in BMenuItem and remove the truncation code from BMenuItem.

The label truncation code cannot work in BMenuItem because the super
menu helpfully resizes itself to fit the menu item. So, instead we do the label
truncation in BMCPrivate making sure that BMenuItem there can't expand the
BMCMenuBar because we set the width to fMenuField->_MenuBarWidth()
explicity.

Note that this only truncates the label in BMCMenuField, i.e. the label inside
the menufield, it does nothing to the labels of the menu items in the attached
BMenu or BPopUpMenu which is exactly what we want.


# 6c145207 06-May-2013 John Scipione <jscipione@gmail.com>

Remove pre-ControlLook drawing code in menu classes


# d5c51ba6 06-May-2013 John Scipione <jscipione@gmail.com>

Update header comments


# d97b4340 06-May-2013 John Scipione <jscipione@gmail.com>

Style fixes to BMenu and related classes.


# ddd60371 05-May-2013 John Scipione <jscipione@gmail.com>

Some style fixes in MenuItem


# bab4f5ad 03-Aug-2012 Ryan Leavengood <leavengood@gmail.com>

Use the parent menu's font when truncating labels.

Fixes the other bug uncovered by #8829, but my other fix was valid too.


# 4ffc27fc 03-Aug-2012 Ryan Leavengood <leavengood@gmail.com>

Fix incorrectly truncated menu labels.

An off-by-one error (> instead of >= really) was causing truncation when it
wasn't needed. But for some reason this only showed up when the main font size
was increased. I may or may not look into that, but this fixes the issue.

Maybe one of the faster bug logged to bug fixed times in Haiku history? ;)


# 6a03786c 28-Jul-2012 Ryan Leavengood <leavengood@gmail.com>

Draw menus using the user chosen colors.


# 43775be6 11-May-2010 Ithamar R. Adema <ithamar.adema@team-embedded.nl>

* Revert r36316 as there are too many apps broken (Vision, Chart, Tracker Find, etc) in different unexpected ways. I'm sorry for the
trouble :( I'll revisit the change and post a patch with a hopefully better solution soon....


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


# b513501f 08-May-2010 Ithamar R. Adema <ithamar.adema@team-embedded.nl>

* When a BMenuItem contains a submenu, and that menu IsLabelFromMarked(), use its preferred width as the content width in GetContentSize().

This fixes problems with the Min/PreferredSize() calculations for BMenuField, with a Menu that IsLabelFromMarked().


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


# 1da48c41 15-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

Simplify the SetTrigger() code. The trigger is a single byte char anyway, so no
need to convert the looked up label position to a char code. Also actually make
sure that the trigger is lower case by doing an explicit tolower() instead of
assuming that it already is.


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


# bae33cda 15-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

Automatic whitespace cleanup, no functional change.


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


# 2bcccf5a 03-Mar-2010 Stephan Aßmus <superstippi@gmx.de>

Patch in part by "yourpalal":
* Set the MENU_STATE_CLOSED state upon BMenu initialization.
* When drawing the label, use the parent bounds, including
item margins to truncate the label, when the parent menu is
closed.

Thanks a lot for the patch!

Changes by myself:
* Cache the MenuPrivate instance in BMenuItem::DrawContent().
* Use Window()->UpdateIfNeeded() to animate the flashing invoked menu item,
which makes a lot more sense, the comment about it working in BeOS is
probably due to item->Select() probably drawing outside of an update cycle.
* The trigger invokation in keyboard handling didn't break out of the loop
after invoking an item. Probably didn't matter since triggers are hopefully
not assigned to more than one menu item. :-)
* Use the same trick as BMenuBar to avoid interfering with keyboard navigation
in the BMenu::_Track() hook.


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


# d6629c31 05-Aug-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

fixed copy/paste error which caused bug #4186. Sorry

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


# 7a8567e6 30-Jul-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Moved MenuPrivate implementation to its own file. Made MenuPrivate.h
self-contained. Adjusted other files accordingly.


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


# c3d7cee2 30-Jul-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Instead of creating the Modifiers bitmaps on demand, for every DrawItem invocation,
for every BMenuItem, have them created in _init_interface_kit(), and keep
them cached. This required some reorganisation of the code in Menu and MenuItem.
Also has the side effect that BMenuItem doesn't have to know about the
alt/ctrl/command keys stuff.
Added a comment in BMenu::AttachedToWindow().


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


# a48d16a0 07-May-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

BMenuItem didn't draw the modifier indicator for B_OPTION_KEY. Fixes ticket #3887

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


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

Always use B_OP_OVER for rendering the text in BMenuItem, not just when using
BControlLook.


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


# 6eb09230 01-Feb-2009 Michael Lotz <mmlr@mlotz.ch>

* Resolve further warnings on GCC4.
* Enable -Werror on GCC4 builds as well (limited to the same selected targets).


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


# 04780702 31-Oct-2008 François Revol <revol@free.fr>

- use a lookup table for control char to drawable UTF-8 strings
- added a glyph for B_HOME


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


# 10f4d067 11-Apr-2008 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added a class MenuPrivate to handle access to private BMenu methods.
BMenuItem and BWindow are no longer friends of BMenu, but use this class
instead.


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


# afd60167 07-Nov-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Reverted r21395. Many people didn't like the change, and after all I too
think it wasn't a really good idea. The alignment of shortcut
charachters and submenu symbols could use some more work, though.


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


# f1be4682 07-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

fTriggerIndex was still a byte index in BMenuItem::SetTrigger() - this one
fixes bug #1506 once and for all :-)


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


# 083de48a 30-Sep-2007 Axel Dörfler <axeld@pinc-software.de>

* Rewrote the trigger selection mechanism: it now searches for uppercase
characters first, and then falls back to take everything. fTrigger is now
uint32 and works with all unicode characters; unlike in BeOS, the
MenuTriggerTest application now works correctly in Haiku.
* fTriggerIndex is now a character position, not a byte position of the label;
this allows BMenuItem::DrawContent() to draw the trigger at the correct
position, even if there are multi-byte UTF-8 characters.
* The above fixed bug #1506; triggers are still not working, though.
* Rewrote Menu.h header.
* Renamed all private methods (that are not called by BWindow) to have the
underscore prefix.
* Removed unused methods.
* Some minor cleanup.


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


# 5b06c4ae 29-Sep-2007 Stephan Aßmus <superstippi@gmx.de>

* improvement to checkmark and submenu indicator layout and drawing (layout
takes menu margins into account, drawing is now fully scalable)


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


# 79d6486d 22-Aug-2007 Stephan Aßmus <superstippi@gmx.de>

* use a darker text color for disabled yet selected looking menu items


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


# bd57c145 15-Aug-2007 Stephan Aßmus <superstippi@gmx.de>

* setting a different menu color with the menu preflet gives now visually
agreeable results (I hope)


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


# cca1217c 12-Jun-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

fixed the colors of the shift modifier bitmap to be consistent with the others. Actually, though, I'm not sure which one is better

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


# 20e85f1c 12-Jun-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Use BBitmap::ImportBits() to get rid of the padded bitmaps

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


# af035272 12-Jun-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Changed the loop to compute the column layout: Now the space for
modifiers is added after we've calculated the maximum width. This way we
don't get overlapping between the menu content and the modifiers bitmaps
themselves. TBR.


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


# 37ddfd14 11-Jun-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Shortcut characters are aligned even if there's a submenu, like
discussed in the thread in haiku-development. I added a fSubmenus member
to BMenu, to be able to tell from BMenuItem if there are other items
with a submenu (maintained in BMenuItem::SetSuper()). If you don't like
this solution, let's just revert.


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


# fbe2f227 12-Jun-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Some work on menu layouts:
- Menus are generally a bit wider (BeIDE ones didn't look nice)
- The modifiers bitmap are drawn more centered vertically
- Splitted BMenu::ComputeLayout() into three methods
- Various minor changes.
The menuitems still don't look nice with bigger font sizes, but we'll
try to fix this...


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


# 9fcdf0e9 07-Jul-2006 Jérôme Duval <korli@users.berlios.de>

MenuItem::Archive uses BArchivable::Archive
inverted the enable state when initing the BMenu


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


# 9b224ec8 07-Jul-2006 Jérôme Duval <korli@users.berlios.de>

add item frames to BMenu archive
add class names to BMenuItem archives


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


# 7a04ba9b 29-May-2006 Axel Dörfler <axeld@pinc-software.de>

Fixed B_MENU_SELECTED_BACKGROUND_COLOR to fit to our B_MENU_BACKGROUND_COLOR,
and changed BMenuItem to actually use it.
This fixes bug #640.


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


# 4fdedfbd 21-Apr-2006 Jérôme Duval <korli@users.berlios.de>

fixed some Archive() following stippi's path


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


# a445243c 20-Apr-2006 Jérôme Duval <korli@users.berlios.de>

B_COLOR_8_BIT is deprecated


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


# cb2998af 04-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

BMenuItem::SetTrigger() and SetAutomaticTrigger() now also update fTriggerIndex.


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


# 0f11085c 04-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* Rewrote MenuItem.h (we're no longer using Be's header).
* Renamed private SetSysTrigger() to SetAutomaticTrigger().
* Added the '_' prefix to private methods that aren't called by anything outside
BMenuItem (ie. no friend classes either).


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


# 40b478ba 04-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* Found better enter symbol, the Konatu font has it all (really, you must have
seen that collection of arrows ;-))
* A test under R5 made it clear that our fonts (not Konatu) indeed doesn't have
arrows, like many other fonts have. We should think about adding font overlays
like it's done in Dano - does anyone know a good free font for symbols that
isn't as thorough as the Konatu font?


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


# bd780d99 04-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

Implemented _DrawControlChar() - for some reason, though, they get still not
drawn (glyph cache returns character 0 for them), even though FontInspector
under Dano shows those arrows in the fonts used... need to check under R5
as well. This fixes the BMenuItem part of bug #158.


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


# 76b895fb 29-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Vertical alignment of bitmaps and shortcut char is calculated more correctly (hopefully). Should fix bug 352

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


# 793fde40 29-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

This should fix some problems I experienced later. At least, I can't reproduce them anymore

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


# 306e9208 27-Mar-2006 Stephan Aßmus <superstippi@gmx.de>

* small cleanup of Draw (less usage of ui_color() which currently
takes a trip to the server!)
* changed look of mark and submenu symbol to better fit the rest
of the already changed controls
* the actual background color is passed to DrawMarkSymbol() and
DrawSubmenuSymbol()


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


# 65b4fb8a 20-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Check if alt is the command key on BMenu::AttachedToWindow instead of doing it for every BMenuItem::Draw()

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


# 698e0e3f 16-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

draw shortcut char and bitmaps one pixel higher

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


# deab92e7 13-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Minor changes, fixed a possible leak in Uninstall()

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


# bf8dbdb4 10-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Draw the shortcut character a bit more to the right, in line with the menu symbol

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


# 2c11ec31 03-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

BMenuItem also draws ctrl bitmap if needed, BTextView::AutoResize implemented more correctly

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


# db937cbe 27-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

Fix for shortcut drawing in the test environment.


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


# 8152e712 25-Feb-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

BMenuItem draws the various elements in a more correct position, i.e. it doesn't draw the shortcut char over the submenu arrow. Fixes bug 206

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


# da13f34e 21-Feb-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Shortcut chars and bitmaps were drawn too left

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


# d2350b28 20-Feb-2006 Jérôme Duval <korli@users.berlios.de>

hmm fixed these bits, padded to multiple of 4


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


# 5f71cfd4 19-Feb-2006 Jérôme Duval <korli@users.berlios.de>

draws CTL/ALT and SHFT bitmaps, not clean yet (green pixels)


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


# c86c09dd 16-Feb-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added a TODO for bug 158. I can't do anything at the moment because I can't test how the bitmaps look like in beos

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


# 9e8d2dd2 17-Jan-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Removed PicturePlayer, it only contains code duplicated from TPicture. Some cleanups for BPicture. This commit also completes previous commit for BMenu

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


# b5cd88a5 13-Jan-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Small changes, nothing important

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


# 797d1a66 10-Jan-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

menufields should default to B_ITEMS_IN_COLUMN. This fixes the workspaces menu (in Screen) opened at the wrong position. As a consequence of this, I had to change the drawing code a bit

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


# 7dc436d8 07-Jul-2005 Stephan Aßmus <superstippi@gmx.de>

usability improvements to scrollbar, sorry had no time to include all of Stefanos drawing code yet, other visual improvements

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


# 3b3a60ad 27-Jun-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Small change

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


# ba69a379 23-Jun-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Fixed a possible buffer overflow (thanks Axel). Removed a todo item

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


# cab8c090 23-Jun-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Implemented and used TruncateLabel(), courthesy of Olivier Milla. Note that its use is never triggered at the moment, because our menu frame just adapt to any content size, even if it goes out of the screen (!)

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


# 0c14fc6d 19-Jan-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Changes to make BMenu behave correctly. Implemented SetTrackingHook(). AddItem() calls the debugger in some cases, as it should. Cleanups.


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


# 2cdfcae4 18-Jan-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

The LowColor() had to be resetted after having drawn the shortcut symbol. Corrected a weird typo.


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


# 6c857bb9 18-Jan-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

BMenuItem now also draws the trigger at the right position. There was a small visual glitch because the menu's lowcolor was not resetted: fixed. BMenuItem::Draw() needs a cleanup.


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


# 4e876d12 03-Jan-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

implemented B_ITEMS_IN_MATRIX layout correctly. Small cleanups all around.


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


# c38a7df2 31-Dec-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Accidentally commented the DrawContent call. I promise, this is the last commit for this year.


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


# 92aa9dcf 31-Dec-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

some more cleanups. The AddItem() variation which accepts a BRect parameter now calls the debugger if called when the layout is not B_ITEMS_IN_MATRIX.


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


# 36d4f059 30-Dec-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Style changes, some checks for NULL values


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


# 1b925bd5 30-Dec-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Moved BSeparatorItem`s implementation to its own file. Will split headers later.


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


# a7d7e9c8 27-Feb-2004 Axel Dörfler <axeld@pinc-software.de>

Added ToDo items to some code I looked at.


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


# 40564fea 09-Jul-2003 DarkWyrm <darkwyrm@gmail.com>

Added license and header


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


# b7fdea42 16-Jun-2003 Marc Flerackers <mflerackers@nowhere.fake>

*** empty log message ***


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


# 93c891b0 11-Jun-2003 haydentech <haydentech@nowhere.fake>

Removed infinite loop in BSeparatorItem


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


# 30fd5147 14-May-2003 haydentech <haydentech@nowhere.fake>

Minor header-related changes


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


# b42c3c8f 14-Nov-2002 Marc Flerackers <mflerackers@nowhere.fake>

Initial Checkin


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


# ac9ec47d2763393d02aebd1460ba52f9c4fa9a05 09-Sep-2015 Axel Dörfler <axeld@pinc-software.de>

BMenu: made left side padding font size relative.

* Also changed BMenuItem to make better use of that size.


# 379ede58af15012f17e87673b0266235762a1230 04-Mar-2014 John Scipione <jscipione@gmail.com>

Style fixes to BMenuItem::GetContentSize and update docs

Rename width and height to _width and _height matching the header.

Update the documentation for this method as well.


# fa412b5fd9117bd00abac82d663b13b1d1063148 28-Feb-2014 John Scipione <jscipione@gmail.com>

BMenuItem: Style fixes related to documentation.


# db85cbe0b53f9377a0310e0740306c35a3df36f1 20-Aug-2013 John Scipione <jscipione@gmail.com>

MenuItem: Set and restore the low color too

A small revision on my last published commit, set and restore the
low color in addition to the high color when drawing the menu item
because DrawString() will produce nicer looking results if the low
color of the view matches the color it draws on due to anti-aliasing.


# dec0a3523dbf3ef8c8e642bbd308f9d1df4866cd 20-Aug-2013 John Scipione <jscipione@gmail.com>

MenuItem: Fix disabled sub-menu item color

See #6610 comment:15 for details.

Firstly, don't save and restore the super menu's low color
since it never changes, instead, save and restore the super
menu's high color which does get altered here.

Secondly, set the high color to
B_MENU_SELECTED_ITEM_TEXT_COLOR only if the menu item
is activated and enabled, otherwise set the high color by tinting the
background color which might be
B_MENU_SELECTED_BACKGROUND_COLOR or
B_MENU_BACKGROUND_COLOR depending on whether
the item is selected or not.

Thirdly, complete the TODO by using a lighten tint if the menu
has a dark background and vice-versa.

This third item is actually a good candidate for a BControlLook
function because the disabled tint should depend on whether the
background color of the thing you're disabling is light or dark.


# d926be8ab3ebf6c55999544b4d836e69f1c89203 29-May-2013 John Scipione <jscipione@gmail.com>

BMenuItem: Check MaxContentWidth for truncation


# a61d468cf92c71160a57130ca96522d24cab962c 08-May-2013 John Scipione <jscipione@gmail.com>

BMenuItem: Round to prevent unneeded truncation

The case I fear is if frameWidth is 99.999999 and labelWidth is 100.0
it will attempt to perform a truncation unnecessarily.


# c1a7e89fc235363e91d79eb547e92e9e16efd5e5 06-May-2013 John Scipione <jscipione@gmail.com>

Put the label truncation code back in BMenuItem.

Just a few commits ago I moved the label truncation code out of
BMenuItem and into BMCMenuBar because the truncation had to happen
outside of BMenuItem. Turns out, that wasn't true so I'm moving the
label truncation back into BMenuItem and removing the _DrawItems()
method from BMCMenuBar.

Note that the code is not a copy of what was there before, but, the
updated version I created for BMCMenuBar. The main difference is that
I use menuPrivate.Padding() instead of GetItemMargins() and I always
use the width of the parent menu frame instead of using fBounds even
if the state is not MENU_STATE_CLOSED. These are changes needed for
BMCMenuBar but should work just as well for a regular BMenu.


# c33396629144d09d2efb678e0d7f97290e69b1ac 06-May-2013 John Scipione <jscipione@gmail.com>

Draw truncated menu label in BMCPrivate, fixes #9735

...instead of in BMenuItem and remove the truncation code from BMenuItem.

The label truncation code cannot work in BMenuItem because the super
menu helpfully resizes itself to fit the menu item. So, instead we do the label
truncation in BMCPrivate making sure that BMenuItem there can't expand the
BMCMenuBar because we set the width to fMenuField->_MenuBarWidth()
explicity.

Note that this only truncates the label in BMCMenuField, i.e. the label inside
the menufield, it does nothing to the labels of the menu items in the attached
BMenu or BPopUpMenu which is exactly what we want.


# 6c1452071c4b2220dcf554213c3cd1787f93f8e4 06-May-2013 John Scipione <jscipione@gmail.com>

Remove pre-ControlLook drawing code in menu classes


# d5c51ba6768d7ffd5bb983af9ab97b6372eae134 06-May-2013 John Scipione <jscipione@gmail.com>

Update header comments


# d97b43406038a6398e097939b71908ff490c64ff 06-May-2013 John Scipione <jscipione@gmail.com>

Style fixes to BMenu and related classes.


# ddd60371132d5b7007b8c3378b586f8a1d913f6d 05-May-2013 John Scipione <jscipione@gmail.com>

Some style fixes in MenuItem


# bab4f5ad7d6900b38b37950a88895988acacc98d 03-Aug-2012 Ryan Leavengood <leavengood@gmail.com>

Use the parent menu's font when truncating labels.

Fixes the other bug uncovered by #8829, but my other fix was valid too.


# 4ffc27fcc1acaca0d1ff69be54c048920d2e902e 03-Aug-2012 Ryan Leavengood <leavengood@gmail.com>

Fix incorrectly truncated menu labels.

An off-by-one error (> instead of >= really) was causing truncation when it
wasn't needed. But for some reason this only showed up when the main font size
was increased. I may or may not look into that, but this fixes the issue.

Maybe one of the faster bug logged to bug fixed times in Haiku history? ;)


# 6a03786cc9918b43c7695cc2349e77eb3193e922 28-Jul-2012 Ryan Leavengood <leavengood@gmail.com>

Draw menus using the user chosen colors.


# 43775be67869de53e6cba7bc3694305dcc63f294 11-May-2010 Ithamar R. Adema <ithamar.adema@team-embedded.nl>

* Revert r36316 as there are too many apps broken (Vision, Chart, Tracker Find, etc) in different unexpected ways. I'm sorry for the
trouble :( I'll revisit the change and post a patch with a hopefully better solution soon....


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


# b513501fe408be19815677a70de3df31a573763a 08-May-2010 Ithamar R. Adema <ithamar.adema@team-embedded.nl>

* When a BMenuItem contains a submenu, and that menu IsLabelFromMarked(), use its preferred width as the content width in GetContentSize().

This fixes problems with the Min/PreferredSize() calculations for BMenuField, with a Menu that IsLabelFromMarked().


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


# 1da48c414962fd59a1b0fd7828295b3468ad0e0a 15-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

Simplify the SetTrigger() code. The trigger is a single byte char anyway, so no
need to convert the looked up label position to a char code. Also actually make
sure that the trigger is lower case by doing an explicit tolower() instead of
assuming that it already is.


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


# bae33cdad549aeca338eeb6cb40f78299bf41c97 15-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

Automatic whitespace cleanup, no functional change.


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


# 2bcccf5a74b943b5cbff81d6481ee26bff244eec 03-Mar-2010 Stephan Aßmus <superstippi@gmx.de>

Patch in part by "yourpalal":
* Set the MENU_STATE_CLOSED state upon BMenu initialization.
* When drawing the label, use the parent bounds, including
item margins to truncate the label, when the parent menu is
closed.

Thanks a lot for the patch!

Changes by myself:
* Cache the MenuPrivate instance in BMenuItem::DrawContent().
* Use Window()->UpdateIfNeeded() to animate the flashing invoked menu item,
which makes a lot more sense, the comment about it working in BeOS is
probably due to item->Select() probably drawing outside of an update cycle.
* The trigger invokation in keyboard handling didn't break out of the loop
after invoking an item. Probably didn't matter since triggers are hopefully
not assigned to more than one menu item. :-)
* Use the same trick as BMenuBar to avoid interfering with keyboard navigation
in the BMenu::_Track() hook.


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


# d6629c31028742fce3f63b542d4808e8abcba42d 05-Aug-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

fixed copy/paste error which caused bug #4186. Sorry

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


# 7a8567e61d42a4c1aa3ecae991ad8dd3b098db44 30-Jul-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Moved MenuPrivate implementation to its own file. Made MenuPrivate.h
self-contained. Adjusted other files accordingly.


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


# c3d7cee2d9b1ed21cb64db3def908434e9e32c9b 30-Jul-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Instead of creating the Modifiers bitmaps on demand, for every DrawItem invocation,
for every BMenuItem, have them created in _init_interface_kit(), and keep
them cached. This required some reorganisation of the code in Menu and MenuItem.
Also has the side effect that BMenuItem doesn't have to know about the
alt/ctrl/command keys stuff.
Added a comment in BMenu::AttachedToWindow().


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


# a48d16a0269a7e7273b362fd509d85c27c6259e6 07-May-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

BMenuItem didn't draw the modifier indicator for B_OPTION_KEY. Fixes ticket #3887

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


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

Always use B_OP_OVER for rendering the text in BMenuItem, not just when using
BControlLook.


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


# 6eb09230bae52bcdf045e1f1920b67205c29adc8 01-Feb-2009 Michael Lotz <mmlr@mlotz.ch>

* Resolve further warnings on GCC4.
* Enable -Werror on GCC4 builds as well (limited to the same selected targets).


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


# 0478070254c39f61a36af288b0b224cadbeecf90 31-Oct-2008 François Revol <revol@free.fr>

- use a lookup table for control char to drawable UTF-8 strings
- added a glyph for B_HOME


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


# 10f4d0679a8df9f72c2a295b2f2ac80ea776538b 11-Apr-2008 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added a class MenuPrivate to handle access to private BMenu methods.
BMenuItem and BWindow are no longer friends of BMenu, but use this class
instead.


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


# afd60167e36d877d194f82b91069763ec2e0a7b8 07-Nov-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Reverted r21395. Many people didn't like the change, and after all I too
think it wasn't a really good idea. The alignment of shortcut
charachters and submenu symbols could use some more work, though.


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


# f1be468272dd699c144038dfe5113b458a70303d 07-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

fTriggerIndex was still a byte index in BMenuItem::SetTrigger() - this one
fixes bug #1506 once and for all :-)


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


# 083de48a4bf9a88273bc1aae47da41a97fed22d2 30-Sep-2007 Axel Dörfler <axeld@pinc-software.de>

* Rewrote the trigger selection mechanism: it now searches for uppercase
characters first, and then falls back to take everything. fTrigger is now
uint32 and works with all unicode characters; unlike in BeOS, the
MenuTriggerTest application now works correctly in Haiku.
* fTriggerIndex is now a character position, not a byte position of the label;
this allows BMenuItem::DrawContent() to draw the trigger at the correct
position, even if there are multi-byte UTF-8 characters.
* The above fixed bug #1506; triggers are still not working, though.
* Rewrote Menu.h header.
* Renamed all private methods (that are not called by BWindow) to have the
underscore prefix.
* Removed unused methods.
* Some minor cleanup.


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


# 5b06c4ae51c3aa08a9d846a3d00ecc2f5e615b10 29-Sep-2007 Stephan Aßmus <superstippi@gmx.de>

* improvement to checkmark and submenu indicator layout and drawing (layout
takes menu margins into account, drawing is now fully scalable)


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


# 79d6486d1d0b4523fd9ebc854673a08ffb50d1b6 22-Aug-2007 Stephan Aßmus <superstippi@gmx.de>

* use a darker text color for disabled yet selected looking menu items


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


# bd57c145be88c15d40eb869978523956a01895a6 15-Aug-2007 Stephan Aßmus <superstippi@gmx.de>

* setting a different menu color with the menu preflet gives now visually
agreeable results (I hope)


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


# cca1217c5bced7d130ffd92f3ce8c8c438b82c99 12-Jun-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

fixed the colors of the shift modifier bitmap to be consistent with the others. Actually, though, I'm not sure which one is better

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


# 20e85f1c09527e6be323ecc6816f7f8761c62465 12-Jun-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Use BBitmap::ImportBits() to get rid of the padded bitmaps

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


# af03527240a5060e79933c9db7d41dbe91bdcbbf 12-Jun-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Changed the loop to compute the column layout: Now the space for
modifiers is added after we've calculated the maximum width. This way we
don't get overlapping between the menu content and the modifiers bitmaps
themselves. TBR.


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


# 37ddfd14aba3fe42b0d034759c9ae53d8f984ce6 11-Jun-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Shortcut characters are aligned even if there's a submenu, like
discussed in the thread in haiku-development. I added a fSubmenus member
to BMenu, to be able to tell from BMenuItem if there are other items
with a submenu (maintained in BMenuItem::SetSuper()). If you don't like
this solution, let's just revert.


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


# fbe2f227cab65d4a1d972fd0bc2ed08681985bc2 12-Jun-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Some work on menu layouts:
- Menus are generally a bit wider (BeIDE ones didn't look nice)
- The modifiers bitmap are drawn more centered vertically
- Splitted BMenu::ComputeLayout() into three methods
- Various minor changes.
The menuitems still don't look nice with bigger font sizes, but we'll
try to fix this...


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


# 9fcdf0e92c0881017effddc8c6dafa0ca6d02fbb 07-Jul-2006 Jérôme Duval <korli@users.berlios.de>

MenuItem::Archive uses BArchivable::Archive
inverted the enable state when initing the BMenu


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


# 9b224ec82e0d967df0d7d531566b998f7f2100f7 07-Jul-2006 Jérôme Duval <korli@users.berlios.de>

add item frames to BMenu archive
add class names to BMenuItem archives


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


# 7a04ba9b1d2e6c730baea5da0733d6c99c1c4c09 29-May-2006 Axel Dörfler <axeld@pinc-software.de>

Fixed B_MENU_SELECTED_BACKGROUND_COLOR to fit to our B_MENU_BACKGROUND_COLOR,
and changed BMenuItem to actually use it.
This fixes bug #640.


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


# 4fdedfbde40258f52c2778d1ca87131b6635fb5d 21-Apr-2006 Jérôme Duval <korli@users.berlios.de>

fixed some Archive() following stippi's path


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


# a445243cff2ff082b1b92bfaa5f9f59c88c91da4 20-Apr-2006 Jérôme Duval <korli@users.berlios.de>

B_COLOR_8_BIT is deprecated


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


# cb2998af29922e3bdccf6c8c26dd20e947e32598 04-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

BMenuItem::SetTrigger() and SetAutomaticTrigger() now also update fTriggerIndex.


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


# 0f11085c6cb253405a96edd783bd77f668c05c8c 04-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* Rewrote MenuItem.h (we're no longer using Be's header).
* Renamed private SetSysTrigger() to SetAutomaticTrigger().
* Added the '_' prefix to private methods that aren't called by anything outside
BMenuItem (ie. no friend classes either).


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


# 40b478baec10e19a8d398773047f85e45c5bbe37 04-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* Found better enter symbol, the Konatu font has it all (really, you must have
seen that collection of arrows ;-))
* A test under R5 made it clear that our fonts (not Konatu) indeed doesn't have
arrows, like many other fonts have. We should think about adding font overlays
like it's done in Dano - does anyone know a good free font for symbols that
isn't as thorough as the Konatu font?


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


# bd780d99357b568d6b1cf48db58508f3ee1b6450 04-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

Implemented _DrawControlChar() - for some reason, though, they get still not
drawn (glyph cache returns character 0 for them), even though FontInspector
under Dano shows those arrows in the fonts used... need to check under R5
as well. This fixes the BMenuItem part of bug #158.


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


# 76b895fb5c392c73d86e5a0401b48921629e0842 29-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Vertical alignment of bitmaps and shortcut char is calculated more correctly (hopefully). Should fix bug 352

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


# 793fde40eb9b021368e69584549fe8f241704f8d 29-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

This should fix some problems I experienced later. At least, I can't reproduce them anymore

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


# 306e92084c48f5c5dd79a4d16735f07ca2f6276e 27-Mar-2006 Stephan Aßmus <superstippi@gmx.de>

* small cleanup of Draw (less usage of ui_color() which currently
takes a trip to the server!)
* changed look of mark and submenu symbol to better fit the rest
of the already changed controls
* the actual background color is passed to DrawMarkSymbol() and
DrawSubmenuSymbol()


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


# 65b4fb8ab1cc75ce5fee62cb5f6963fdd8c4c7d4 20-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Check if alt is the command key on BMenu::AttachedToWindow instead of doing it for every BMenuItem::Draw()

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


# 698e0e3fa76791cb74510ac87fbd165900e56278 16-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

draw shortcut char and bitmaps one pixel higher

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


# deab92e7edbd508ea6068c3fee28343d1b7cdbd0 13-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Minor changes, fixed a possible leak in Uninstall()

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


# bf8dbdb413880d9b715f11f83a0de729fa601e52 10-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Draw the shortcut character a bit more to the right, in line with the menu symbol

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


# 2c11ec31c876f2b77e3d03c9776dbf99119bbce7 03-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

BMenuItem also draws ctrl bitmap if needed, BTextView::AutoResize implemented more correctly

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


# db937cbed939ba65e8378f269c4bad644377dbfb 27-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

Fix for shortcut drawing in the test environment.


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


# 8152e71214f5110f6fdcee855f026c2008188d9a 25-Feb-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

BMenuItem draws the various elements in a more correct position, i.e. it doesn't draw the shortcut char over the submenu arrow. Fixes bug 206

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


# da13f34ea913e5289887c5622e2e4aa4bccce16c 21-Feb-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Shortcut chars and bitmaps were drawn too left

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


# d2350b2881bfe080e62fc69b8b5c4dfd83b4da4c 20-Feb-2006 Jérôme Duval <korli@users.berlios.de>

hmm fixed these bits, padded to multiple of 4


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


# 5f71cfd4bc9bcead3430cf9370e527f5d7c4b167 19-Feb-2006 Jérôme Duval <korli@users.berlios.de>

draws CTL/ALT and SHFT bitmaps, not clean yet (green pixels)


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


# c86c09ddfe9a44801c3ba33abb77222b9d379997 16-Feb-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added a TODO for bug 158. I can't do anything at the moment because I can't test how the bitmaps look like in beos

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


# 9e8d2dd28b59ce0fa8b221c116dce41425abf4cf 17-Jan-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Removed PicturePlayer, it only contains code duplicated from TPicture. Some cleanups for BPicture. This commit also completes previous commit for BMenu

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


# b5cd88a5c7aefd98694982f25b4381b7d2417db1 13-Jan-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Small changes, nothing important

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


# 797d1a66fa05bd68a2bb475b4786af13038e9b16 10-Jan-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

menufields should default to B_ITEMS_IN_COLUMN. This fixes the workspaces menu (in Screen) opened at the wrong position. As a consequence of this, I had to change the drawing code a bit

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


# 7dc436d8ddced8bde596634efe25ae5ceb11b704 07-Jul-2005 Stephan Aßmus <superstippi@gmx.de>

usability improvements to scrollbar, sorry had no time to include all of Stefanos drawing code yet, other visual improvements

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


# 3b3a60ad5ad36d44a8525933833d354db3710082 27-Jun-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Small change

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


# ba69a3795be79b65636d9bd8a62742d3eaef765a 23-Jun-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Fixed a possible buffer overflow (thanks Axel). Removed a todo item

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


# cab8c0900ca993c33b8faf9d69cd9d42217c663c 23-Jun-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Implemented and used TruncateLabel(), courthesy of Olivier Milla. Note that its use is never triggered at the moment, because our menu frame just adapt to any content size, even if it goes out of the screen (!)

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


# 0c14fc6dfd02183cabee248c9768c3b8b02fc69d 19-Jan-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Changes to make BMenu behave correctly. Implemented SetTrackingHook(). AddItem() calls the debugger in some cases, as it should. Cleanups.


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


# 2cdfcae44bbd86a30cd8278c1b9672b5924d495f 18-Jan-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

The LowColor() had to be resetted after having drawn the shortcut symbol. Corrected a weird typo.


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


# 6c857bb9fee0d0a5b7c1bb8bec72d7db531b5038 18-Jan-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

BMenuItem now also draws the trigger at the right position. There was a small visual glitch because the menu's lowcolor was not resetted: fixed. BMenuItem::Draw() needs a cleanup.


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


# 4e876d126e7ab87ec51562b1e7f75358448ad5f6 03-Jan-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

implemented B_ITEMS_IN_MATRIX layout correctly. Small cleanups all around.


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


# c38a7df2a89b4d0c94aa360e05bec9e4ab46cbdd 31-Dec-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Accidentally commented the DrawContent call. I promise, this is the last commit for this year.


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


# 92aa9dcf8579e6bb7d506d7443a77eb150396cb8 31-Dec-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

some more cleanups. The AddItem() variation which accepts a BRect parameter now calls the debugger if called when the layout is not B_ITEMS_IN_MATRIX.


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


# 36d4f05908b7b9d044b641e834a02171391d470d 30-Dec-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Style changes, some checks for NULL values


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


# 1b925bd5ae865af5243c4e054f0923699f079253 30-Dec-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Moved BSeparatorItem`s implementation to its own file. Will split headers later.


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


# a7d7e9c80faf8f7e3ec3c5d22049f617df294241 27-Feb-2004 Axel Dörfler <axeld@pinc-software.de>

Added ToDo items to some code I looked at.


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


# 40564fead11bc909d729fd4afb7ccc1764778381 09-Jul-2003 DarkWyrm <darkwyrm@gmail.com>

Added license and header


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


# b7fdea42f4e4e65422e5dda2954577c963b1a97b 16-Jun-2003 Marc Flerackers <mflerackers@nowhere.fake>

*** empty log message ***


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


# 93c891b0e6c3bfd1bd1d0101d692862b8d42448b 11-Jun-2003 haydentech <haydentech@nowhere.fake>

Removed infinite loop in BSeparatorItem


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


# 30fd51473f390b92d40b3a3c83b25e2d4a042f08 14-May-2003 haydentech <haydentech@nowhere.fake>

Minor header-related changes


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


# b42c3c8f2eaebd797fff9075c5d75a3950f910de 14-Nov-2002 Marc Flerackers <mflerackers@nowhere.fake>

Initial Checkin


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