History log of /haiku/src/kits/interface/MenuField.cpp
Revision Date Author Comments
# 5f887442 18-Feb-2023 PulkoMandy <pulkomandy@pulkomandy.tk>

BMenuField: allow to use non-fixed size in combination with layout mode

In fixed size mode, the menu field always uses all the available width.
In non-fixed size mode, the menu field will resize itself to be as small
as possible.

With layout, usually the difference isn't noticeable, since the layout
will already try to resize the control to the smallest possible size.
But there are a few cases where it makes a difference, when the layout
is over-constrained and the menu field can't be made as small as
possible. In that case, the menu field would be forced to fill its
allocated space, where we can instead make it a little smaller.

Change-Id: I911d497218a09aab3824865968558df5d4b3cf98
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6076
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# fc2f1a32 18-Feb-2023 PulkoMandy <pulkomandy@pulkomandy.tk>

BMenuField: remove deprecated constructors

These were introduced by mistake during the addition of the layout
system. They have been private since 2011. It seems safe to assume that
nothing uses them anymore and they can now be removed safely.

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


# 015d6c13 19-Dec-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

BMenuField: use anonymous namespace for internal class.

As suggested by korli, this is indeed a better way to hide internal
classes and make them completely unreachable from outside the cpp file
they are defined in.


# f7a0ebd7 17-Dec-2020 Adrien Destugues <adrien.destugues@opensource.viveris.fr>

BMenuField: Fix private ABI leakage

Problem introduced in hrev46195. The MouseDownFilter class may be
declared deep in the middle of a cpp file, yet without precautions, it
will end up being part of the ABI.

WonderBrush has a class with the same name, and on 64bit Haiku, a mixup
of the two would happen, leading to a crash because they don't have the
same size.

Move the class into BPrivate to avoid this.

Change-Id: I60b608edf3188816281332c972c654e3c57740b4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3536
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Rene Gollent <rene@gollent.com>


# 20f2ebae 07-May-2020 Adrien Destugues <adrien.destugues@opensource.viveris.fr>

Remove MouseDownThread and its usages

This code comes from an old Be Newsletter and since then the API
received the addition of SetMouseEventMask. In several places the
MouseDownThread was misused: it would spawn a new thread on every mouse
click and not clear the previous one. This could for example lead to
BSpinner skipping values if you clicked it at the right speed.

There are functional changes in BSpinner, before it updated for the
first time 100ms after mouse down, and then as you moved the mouse
around the button, now it activates immediately on first click and then
every 200ms (which may be a bit short). In other places, no functional
changes intended.

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


# 81364c9d 18-Apr-2016 John Scipione <jscipione@gmail.com>

BColorMenuItem: add custom color menufield

http://insightfactory.tumblr.com/image/142366356207

* Make the color box a rectangle with proportions of golden ratio.
* Override GetContentSize() to make menu item area larger.
* Label should never truncate since I make sure there is enough room.
* Draw the label using BMenuItem parent class
* Carefully adjust the spacing so that there is an attractive amount of
padding between the checkmark and color box and the color box and label.

Add _AddMenu method to BMenuField that adds BColorMenuItem as its
base menu item. This shows the BColorMenuItem in the closed state.

Create BPrivate::MenuItemPrivate

Add a SetSubmenu() method to MenuItemPrivate that gives you
the ability to add a submenu after creating the object. This
method should be public

Skip disabled items

Color gets updated even if you select an item in a submenu


# 59e1b2f4 22-Mar-2016 John Scipione <jscipione@gmail.com>

BMenuField: Change label to panel text color

...instead of menu item text color when the label is unselected.

Menu item text color seems to make sense when the control is unselected
because we use selected menu item text color when the control is
selected, but, this isn't the case. We color the label background using
the menu item color because we are reproducing similar behavior of
BeOS R5. However, when the menu field is unselected the label needs to
draw so that it goes on the panel bg color.


# 3e08f216 16-Jan-2016 looncraz <looncraz@looncraz.net>

MenuField Low Color (for frame)

BMenuField's frame is drawn from the LowColor() which is adopted from its
parent. However, we should be adopting the parent's view color for our low
color, otherwise we sometimes end up with a miscolored border (most often white).

This was not noticed earlier as most views have matching view and low colors.

Fixes ticket #12603

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


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


# 8a3ae7a4 14-Oct-2015 John Scipione <jscipione@gmail.com>

Restore the BMenuField label background

Highlighting was added in hrev45983, stopped working in hrev49614, specifically
d8919236503108a2db13c454109d7c7696677514.

Add comment to explain what is happening and hopefully deter this from being
removed again in the future.

Fixes #12359


# d8919236 30-Aug-2015 Axel Dörfler <axeld@pinc-software.de>

BMenuField: use layout rect for the label.

* Instead of just laying it out as without the layout API.


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

Style fixes to IK, focus on docs


# 60370b9a 22-Apr-2014 John Scipione <jscipione@gmail.com>

BMenuField/BTextControl: Store and reuse Label()


# c79f2602 22-Apr-2014 John Scipione <jscipione@gmail.com>

BMenuField: Check if menuBar is NULL explicitly


# d055b93b 22-Apr-2014 John Scipione <jscipione@gmail.com>

BMenuField: Replace 5 with DefaultLabelSpacing()


# 58a3b207 22-Apr-2014 John Scipione <jscipione@gmail.com>

BMenuField: style fixes


# 285b7163 08-Oct-2013 John Scipione <jscipione@gmail.com>

MenuField: Filter out additional MouseDown messages.

...while mouse is down on a menufield

This makes it so that you can't open 2 menufields simultaneously
by clicking and holding the right mouse button on one menufield while
clicking a second with the the left mouse button opening it.

This matches the behavior on BeOS R5.

Should help with #6408 comment:9


# 163fc310 25-Aug-2013 John Scipione <jscipione@gmail.com>

Revert "MenuField: Make sure input is a single byte"

This reverts commit 4e075e0f4c60a600a86792d9c36eae513f1cda31.


# 8f74b989 24-Aug-2013 John Scipione <jscipione@gmail.com>

MenuField: Remove unused variables

fSelected and fTransition


# cccc4076 24-Aug-2013 John Scipione <jscipione@gmail.com>

Menu and friends: Style fixes, no functional

... changes intended.

* 80 char limit fixes
* Indentation fixes
* Braces style fixes
* Use ternary operator where appropriate
* Rename menuItem to just item and declare it once outside
the loop
* Omit 3rd param of GetMouse() because it is default
* Rename variables eg state => focused and menu => submenu
* Indent comments below line they apply to
* Reword some comments
* Add some #pragmas


# 4e075e0f 23-Aug-2013 John Scipione <jscipione@gmail.com>

MenuField: Make sure input is a single byte


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

MenuField: Open the menu bar when the label is clicked

Fixes #6894

Private DrawLabel() method renamed to _DrawLabel() and rest of drawing
code moved to new private method _DrawMenuField(). These methods both
check to make sure that they are drawing in a valid rect that intersects
updateRect.

When label or menu is selected Draw a the label background in the selected
menu color matching the behavior of BeOS R5.

_DrawLabel() calls be_control_look->DrawLabel()

Update copyright year in MenuField.h


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

Revert "don't open the menu if it's disabled."

This reverts commit ce8253d97b588366540230d11fb534c4846d0a09.


# 3de334b9 19-Aug-2013 John Scipione <jscipione@gmail.com>

MenuField: need stdio.h if TRACE enabled

* Also update authors adding myself


# f1eb4295 18-Jul-2013 John Scipione <jscipione@gmail.com>

BMenuField: Check if Frame() is valid, refactor


# 8d75f143 18-Jul-2013 John Scipione <jscipione@gmail.com>

BMenuField: Style fixes


# 1c95f722 07-Jun-2013 John Scipione <jscipione@gmail.com>

Don't set MaxContentWidth on the menu bar of a BMenuField

Fixes #9816

It is no longer necessary, or even desirable for us to set the max
content width of the menu bar of a BMenuField now that BMenuItem
truncation and BMenuField sizing are working.

The user may, however, wish to set the max content width of the menu
bar of a BMenuField themselves like so:

menuField->MenuBar()->SetMaxContentWidth(width);

and the Interface Kit will automatically deduct the left and right
margins from the width including the space used by the drop down arrow.


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

BMenuField: If fixed size always set max content width

When you resize, also set max content width.

Create a SetMaxContentWidth() method that includes the margins.


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

Move kMinMenuBarWidth to MenuField.cpp


# a1cf3ead 25-May-2013 John Scipione <jscipione@gmail.com>

Resize menu field if below minimum width in auto-size mode

... cancelling the normal item truncation behavior.
This funcationality comes from BeOS R5, we need to reproduce it for
backwards compat. KeymapSwitcher depends on it at least.

Minimum width is 20px, was set in last commit, comes from BeOS R5.


# 6031e624 25-May-2013 John Scipione <jscipione@gmail.com>

Move constants to BMCPrivate.h and refactor

We use these constants in both MenuField.cpp and BMCPrivate.cpp

Incorporate kMarginWidth into kPopUpIndicatorWidth.

A small code simplication in FrameResized() along with replacing bare numbers
with magic constants.


# 9af9f515 25-May-2013 John Scipione <jscipione@gmail.com>

Don't resize to preferred height if fixed size, BeOS didn't


# 17aed1bf 25-May-2013 John Scipione <jscipione@gmail.com>

Use roundf() as suggested by Axel


# f6d93b80 09-May-2013 John Scipione <jscipione@gmail.com>

Remove the unused bounds parameter from DrawLabel

Also refactor BMenuField::Draw()


# 869e4bdc 09-May-2013 John Scipione <jscipione@gmail.com>

Don't cast to float, use floorf


# 91810d8e 09-May-2013 John Scipione <jscipione@gmail.com>

Use better variable names in SetDivider


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

Style fixes to BMenuField

Rename resize to resizingMode, whitespace fixes, compare to 0 explicitly


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

Refactor BMenuField::DrawLabel()

also use std::max() instead of max_c()


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

Style fixes to BMenu and related classes.


# bb169747 02-May-2013 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Cleanups.
Removed code path for be_control_look == NULL.
Improve comments.


# 43ee85f6 05-Feb-2013 Axel Dörfler <axeld@pinc-software.de>

BMenuField: fixed broken view color.

* Apparently, I only tested the other case :-)
* This fixes bug #9433.


# 39b9d0f0 04-Feb-2013 Axel Dörfler <axeld@pinc-software.de>

BMenuField: use panel background color as default.

* There is no reason the BMenuField should behave differently from
any BControl here.


# 8adaa6c5 26-Feb-2012 Jerome Duval <jerome.duval@gmail.com>

interface kit: added compatibility symbols for GCC4

* InvalidateLayout method for BBox, BButton, BCheckBox, BMenuField,
BScrollView, BSlider, BStringView, BTextControl.


# f6c8d242 19-Dec-2011 Rene Gollent <anevilyak@gmail.com>

Use the correct perform invocation for these functions.


# 466f2b8f 18-Dec-2011 Rene Gollent <anevilyak@gmail.com>

Add compatibility symbols for removed LayoutChanged() calls.


# 61eb1f1d 22-Oct-2011 Alex Wilson <yourpalal2@gmail.com>

Replace remaining InvalidateLayout()'s with LayoutInvalidated(). Also do a bit of cleanup/move methods around.


# eee4243d 20-Oct-2011 Alex Wilson <yourpalal2@gmail.com>

De-virtualize BView::InvalidateLayout() and introduce LayoutInvalidated() hook, like BLayout.


# 4296233f 06-May-2011 Axel Dörfler <axeld@pinc-software.de>

* Made the messed up BMessage* constructors private - since it only affects the
layout API, we probably can just phase it out after a while.
* Introduced new constructors, and added missing flags to one of them to make
it more convenient to use.


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


# 7a37b89b 27-Jul-2010 Alex Wilson <yourpalal2@gmail.com>

Updated BMenuField and its custom BLayoutItems for layout-safe archiving. Added an _InitMenu(const BMessage*) method that inits the menu during unarchival.


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


# c944d11f 13-Apr-2010 Stephan Aßmus <superstippi@gmx.de>

bonefish+stippi:
All views which cache layout information need to call ResetLayoutInvalidation()
when they have updated the cached information. Otherwise calling
InvalidateLayout() once they are already attached to a layout may not have any
effect.


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


# 12194e33 07-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Added missing default initializer for the message.
* Changed BMenuField::MenuBarLayoutItem::BasePreferredSize() to return the
min size as well, instead of a fixed 100 pixels for the width...
* More minor cleanup.


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


# 50f8cd14 07-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Cleanup, no functional change.
* Remove superfluous operator=() implementations.


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


# 84b7e122 16-Apr-2009 Stephan Aßmus <superstippi@gmx.de>

Both BTextControl and BMenuField layout the inner control at divider
+ frame width. BTextControl was even calculating it like this everywhere,
but then layouted like BMenuField. Now it's consistent and much easier to
align other controls with the text view or menu bar layout item.


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


# 681c2e44 25-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

The button and menu field draw routines take a background color into account,
which makes the resessed frame blend better with the surroundings. This can
be seen best in Keymap, where a different color is set on some buttons, but
the resessed frame should still be the same across all those buttons.


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


# 94e66d17 25-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Fixed recently introduced regressions with layouted BMenuFields. When passing
fixedSize=true to the private BMenuBar class, it would set the follow mode
in AttachedToWindow() such that BMenu would calculate the minimum width
differently. Also fixes ticket #3606.


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


# 47e745c6 22-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

* Fixed the unified menu bar width calculations. SetDivider() got it wrong.
* _InitMenuBar() had the meaning of fixedSize reversed. The layout-mode
constructors pass fixedSize = true accordingly.


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


# cda78e4f 23-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Fixed more inconsistencies in layouting the menu bar. These would mostly
result in the BMenuField not always drawing all of the frame around the
menu bar correctly, for example cutting off at left for divider = 0.


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


# 31852cb1 22-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Various fixes to BMenuField behavior:
* In layout mode, using a BMenuField directly will make it behave like using
a fixed size BMenuField in non-layout mode. This is open for debate, but
not a change to the previous behavior. When using the Label and MenuBar-
LayoutItems though, the behavior is now changed to be more what one would
expect, ie the BMenuBar part is layouted across the full available width
just like it happens with BTextControls.
* Fixed invalidation of the BMenuBar when it auto-resizes according to picking
another item, and when it is resized due to layout changes.
* Fixed the problem with growing BMenuFields in file panels after changing
folders the first time. The fix is not so nice, but the purpose of setting
the menu item margins is to make sure it renders at the same vertical
offset as the BMenuField label. The better fix would be to change the
calculation of the content location or required margins in the BMenuItem
code... however the BMCPrivate code needs to account for the popup indicator
in the margins so I just kept the fix for the offset there as well.


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


# ce8253d9 09-Mar-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

don't open the menu if it's disabled.

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


# 13cd46df 16-Feb-2009 Stephan Aßmus <superstippi@gmx.de>

* Stronger BMenuField popup indicator.
* Softer recessed frame for BMenuField to distinguish more from BButton
and make it slightly more similar to BTextControl.


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


# 39fbf550 15-Oct-2008 Oliver Tappe <zooey@hirschkaefer.de>

bonefish + zooey:
* Fixed a general problem with respect to overriding of the reserved
virtual function slots: instead of statically invoking the method
that corresponds to the reserved slot on the class that contains the
slot, we now invoke the virtual Perform() method. Perform() then dispatches
the method invocation to the "proper" class, i.e. the highest class in the
hierarchy that actually implements the requested method.
This fixes a crash in apps that use liblayout's MSlider class and
should fix one or other spurious bug with old apps or libraries, too.
* added new header folder 'binary_compatibility' that contains files that
define the method codes and data structures required by Perform()
* looked for and implemented all used reserved virtual slot functions to
invoke Perform() where necessary or to pass on the method call statically
(for slots that were already maintained by Be)


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


# 08edea66 16-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

* Don't set an explicit max size, instead calculate a proper max size in
MaxSize(). This makes sure that MaxSize() returns a proper size when the
user "unsets" the explicite max size.
* minimum label height is 0 if there is no label.


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


# ff168f4e 14-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Use the dedicated BView constructor for using layout management.


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


# 14f63456 14-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Several fixes to BMenuField layout calculations.
* The most important fix is that in BMenuField::_ValidateLayoutData(),
divider was calculated, but then never used. If the menu field was not
using the layout management, it should take the existing fDivider into
account, but never did. This caused #2728.
* Added some tracing that helped me debug this.
* Fixed a bunch of layouting inconsistencies. It will also improve some
unnecessary resizing of the menu bar.

Will test all of this some more. But in the test app I do have, the BMenuField
works more like in BeOS now.


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


# 54badb1f 19-Jul-2008 Stephan Aßmus <superstippi@gmx.de>

mmlr + stippi:
Fixed more controls to handle a B_TRANSPARENT_COLOR as view coloe of the
parent view. Some controls would not initialize their LowColor() at all
if they were the only control in a window.


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


# 5975ad0c 27-Apr-2008 Jérôme Duval <korli@users.berlios.de>

if no menubar is found in the archive, recreate one to avoid crashing


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


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

Draw the label right at origin in B_ALIGN_LEFT mode. Should improve alignment
with other controls. (BTextControl patch with the same change is upcomming, but
it includes many other changes I didn't want to mix in.)


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


# 44cd9847 18-Feb-2008 Stefano Ceccherini <stefano.ceccherini@gmail.com>

pass -1 as first parameter of StartMenuBar(), otherwise it will hide the
cursor (used for keyboard navigation). Fixes bug #1807


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


# ee70f30e 19-Nov-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

cleanups


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


# c831635f 13-Sep-2007 Stephan Aßmus <superstippi@gmx.de>

* make sure that the menu bar is still aligned with the right
side if in fixed size mode in ResizeToPreferred, this fixes
the menu bars going out of view bounds in a lot of apps using
fixed size fields, like Screen



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


# 3a38a485 30-Aug-2007 Stephan Aßmus <superstippi@gmx.de>

* fixed size layout of BMenuBar on BMenuField in fixed size mode
(needs to account for the parts that the BMenuField draws, ie the shadow
on the right)
* fixed follow mode of BMenuBar in fixed size mode (B_FOLLOW_LEFT_RIGHT)
* don't resize the BMenuField in fixed size mode (endless loop), this should
be more robust anyways, since this endless loop would be triggered if an
application tried to manually resize menuField->MenuBar() in auto resizing
mode
* fixed calculation of the parts that need to be redrawn on resize


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


# ff39fef2 22-Jun-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* ceilf() both font ascent and descent individually before adding them up to
compute the vertical space requirement of the label.
* Use a better algorithm for vertically aligning the label. The menu bar (or
item) seems to use another algorithm. So, ATM the label is not necessarily
aligned with the menu bar text.


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


# cf76d671 21-Jun-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

I *think* I've fixed the problem of menu fields not being opened when
the user clicks on the part which has been resized...


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


# b321303c 19-Jun-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Implemented Min/Max/PreferredSize().
* Reworked the internal layout. _ValidateLayoutData() computes and caches the
layout related data and all other methods just use those values. Now, in
layout-aware mode the class should properly work not only when using the
layout items. And when using layout items, the class does actually do
internal layout; it was basically good luck that it worked in the tests,
before. Vertical resizing is supported, too.
* We do a few mean tricks to get the probably mostly preferred layout behavior:
By default our own explicit max width and that of the menu bar layout item is
set to unlimited and the horizontal menu bar alignment to left aligned. This
allows to horizontally resize a BMenuField beyond its preferred size,
although both label and menu bar have a limited max width. The user can, of
course, override those explicit sizes/alignments to get a different behavior,
if desired.
* Fixed invalidation in SetDivider(). When having the focus, the left and top
border of the blue frame were not invalidated.
* The label is no longer drawn at vertical position font ascent + descent
+ leading + 2 (not sure how this calculation was supposed to work), but
vertically centers the label around the ascent. With big fonts the label is
shown a bit too far to the bottom. Not sure how to fix this in a generic way.


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


# ebd1a3a1 16-Jan-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

some more work on menus... fixed bug #953 and some more stuff


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


# 633d2d3d 28-Sep-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

don't hide the cursor when the menu pops up

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


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

Merge from layout management branch.


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


# 056abb9e 07-Jul-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

partially reverted to an old version, should fix strange problems with menufields

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


# cd39decc 28-May-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added a filter to MenuField, so that mousedown messages caught by the inner menubar are redirected to the BMenuField's MouseDown() like happens on beos. That way we can track and invalidate correctly. Implemented Show/HidePopUpMarker

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


# 02c491fd 05-Apr-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

small cleanup

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


# e3d07155 14-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Enlarged a bit the BMCMenuBar's frame, so that it's drawn more nicely

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


# f282009d 16-Feb-2006 Stephan Aßmus <superstippi@gmx.de>

* _BMCItem_ is no longer used, but I didn't remove it
yet, just commented it out in BMenuField. As was expected,
nothing changed in any obvious way
* made the _BMCMenuBar_ draw the popup marked. I changed it
a bit, inspired from some mockup I saw, sorry I don't
remember where. I hope you like it (it is easily changed
back if you don't).


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


# c72e7319 16-Feb-2006 Stephan Aßmus <superstippi@gmx.de>

* have the MenuBar resize to preferred in
ResizeToPreferred()
* fix and sanitize GetPreferredSize()... people,
think "simple"


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


# f9f970d9 11-Jan-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Yesterday's commit triggered some other visual bugs: hopefully fixed them all. A disabled menufield now doesn't open its associated menu anymore.

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


# 8643b098 23-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

All controls/views now accept NULL arguments for "width" and "height" in GetPreferredSize().


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


# 789f68f0 09-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Cleanup.


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


# 5e3af71d 09-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

More or less correctly implemented GetPreferredSize().
The menu bar is now resized to a proper size.


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


# 2e6a5805 05-Jul-2005 Stephan Aßmus <superstippi@gmx.de>

MenuField layouts the menu bar better with respect to fDivider, it aligns better with other controls. fDivider in TextControl is an integer number now, small fix and small cleanup in Menu, Window::InitData takes an optional BBitmap token to construct an offscreen window, fixed PrivateScreen IndexForColor, View prevents being located at fractional coordinates as in R5, BBitmap unlocks its offscreen window since it is never Show()n and needs manual unlocking, fixed Slider offscreen window mode and improved triange thumb drawing, ScrollView would not crash when passing a NULL target just for kicks, the private MenuBar class now implements Draw to draw itself a little differently inside the BMenuField (dark right and bottom side) - though how it currently sets the clipping region prevents the text controls to draw in Playground, needs fixing

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


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

Fixed warnings.


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


# a91e36bf 04-Sep-2003 haydentech <haydentech@nowhere.fake>

Fix null statement and remove an unused variable


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


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

BMenuField


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


# d8919236503108a2db13c454109d7c7696677514 30-Aug-2015 Axel Dörfler <axeld@pinc-software.de>

BMenuField: use layout rect for the label.

* Instead of just laying it out as without the layout API.


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

Style fixes to IK, focus on docs


# 60370b9a6c8456c5970455f6bf170a383e56c621 22-Apr-2014 John Scipione <jscipione@gmail.com>

BMenuField/BTextControl: Store and reuse Label()


# c79f2602761f226941852caa2305d5f2dcf8036b 22-Apr-2014 John Scipione <jscipione@gmail.com>

BMenuField: Check if menuBar is NULL explicitly


# d055b93b25ba69743749309ac615cef8cc443e02 22-Apr-2014 John Scipione <jscipione@gmail.com>

BMenuField: Replace 5 with DefaultLabelSpacing()


# 58a3b20760f388db630dbda0986c67e9e87ca38c 22-Apr-2014 John Scipione <jscipione@gmail.com>

BMenuField: style fixes


# 285b7163ad41e00841d0dc28b48fe10902a350bc 08-Oct-2013 John Scipione <jscipione@gmail.com>

MenuField: Filter out additional MouseDown messages.

...while mouse is down on a menufield

This makes it so that you can't open 2 menufields simultaneously
by clicking and holding the right mouse button on one menufield while
clicking a second with the the left mouse button opening it.

This matches the behavior on BeOS R5.

Should help with #6408 comment:9


# 163fc310f785936bb29c89f069b909109d1b07f3 25-Aug-2013 John Scipione <jscipione@gmail.com>

Revert "MenuField: Make sure input is a single byte"

This reverts commit 4e075e0f4c60a600a86792d9c36eae513f1cda31.


# 8f74b989054238080c7ca7a515290b8eeecaccc5 24-Aug-2013 John Scipione <jscipione@gmail.com>

MenuField: Remove unused variables

fSelected and fTransition


# cccc4076dbd857be016741e5dd75c61858aabe2a 24-Aug-2013 John Scipione <jscipione@gmail.com>

Menu and friends: Style fixes, no functional

... changes intended.

* 80 char limit fixes
* Indentation fixes
* Braces style fixes
* Use ternary operator where appropriate
* Rename menuItem to just item and declare it once outside
the loop
* Omit 3rd param of GetMouse() because it is default
* Rename variables eg state => focused and menu => submenu
* Indent comments below line they apply to
* Reword some comments
* Add some #pragmas


# 4e075e0f4c60a600a86792d9c36eae513f1cda31 23-Aug-2013 John Scipione <jscipione@gmail.com>

MenuField: Make sure input is a single byte


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

MenuField: Open the menu bar when the label is clicked

Fixes #6894

Private DrawLabel() method renamed to _DrawLabel() and rest of drawing
code moved to new private method _DrawMenuField(). These methods both
check to make sure that they are drawing in a valid rect that intersects
updateRect.

When label or menu is selected Draw a the label background in the selected
menu color matching the behavior of BeOS R5.

_DrawLabel() calls be_control_look->DrawLabel()

Update copyright year in MenuField.h


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

Revert "don't open the menu if it's disabled."

This reverts commit ce8253d97b588366540230d11fb534c4846d0a09.


# 3de334b9f4050d1cd9c6973b850ed50fac7e16ff 19-Aug-2013 John Scipione <jscipione@gmail.com>

MenuField: need stdio.h if TRACE enabled

* Also update authors adding myself


# f1eb42958fcb9daf687ca270a94531691f8c0551 18-Jul-2013 John Scipione <jscipione@gmail.com>

BMenuField: Check if Frame() is valid, refactor


# 8d75f14355c1df1c490ff30524a6894c8c2548da 18-Jul-2013 John Scipione <jscipione@gmail.com>

BMenuField: Style fixes


# 1c95f72222f766079af3183ab490e42506f5feca 07-Jun-2013 John Scipione <jscipione@gmail.com>

Don't set MaxContentWidth on the menu bar of a BMenuField

Fixes #9816

It is no longer necessary, or even desirable for us to set the max
content width of the menu bar of a BMenuField now that BMenuItem
truncation and BMenuField sizing are working.

The user may, however, wish to set the max content width of the menu
bar of a BMenuField themselves like so:

menuField->MenuBar()->SetMaxContentWidth(width);

and the Interface Kit will automatically deduct the left and right
margins from the width including the space used by the drop down arrow.


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

BMenuField: If fixed size always set max content width

When you resize, also set max content width.

Create a SetMaxContentWidth() method that includes the margins.


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

Move kMinMenuBarWidth to MenuField.cpp


# a1cf3ead5f5e9b2857b9622bef5bc1742fd21151 25-May-2013 John Scipione <jscipione@gmail.com>

Resize menu field if below minimum width in auto-size mode

... cancelling the normal item truncation behavior.
This funcationality comes from BeOS R5, we need to reproduce it for
backwards compat. KeymapSwitcher depends on it at least.

Minimum width is 20px, was set in last commit, comes from BeOS R5.


# 6031e62420fec7cc6c360bb210ca860a4a60e0f0 25-May-2013 John Scipione <jscipione@gmail.com>

Move constants to BMCPrivate.h and refactor

We use these constants in both MenuField.cpp and BMCPrivate.cpp

Incorporate kMarginWidth into kPopUpIndicatorWidth.

A small code simplication in FrameResized() along with replacing bare numbers
with magic constants.


# 9af9f5150d46915ebc10aa8c5f93afcf747c5e71 25-May-2013 John Scipione <jscipione@gmail.com>

Don't resize to preferred height if fixed size, BeOS didn't


# 17aed1bfc8f4bc1c76f5aa86923f3b0a9c5fbf17 25-May-2013 John Scipione <jscipione@gmail.com>

Use roundf() as suggested by Axel


# f6d93b80f34f14a2dc2b329e1e65cc5ca2c3de96 09-May-2013 John Scipione <jscipione@gmail.com>

Remove the unused bounds parameter from DrawLabel

Also refactor BMenuField::Draw()


# 869e4bdca3701ec27feebab9ccf4be8c847a4ed7 09-May-2013 John Scipione <jscipione@gmail.com>

Don't cast to float, use floorf


# 91810d8efdaa9542d10d48976255cdde3b392bf5 09-May-2013 John Scipione <jscipione@gmail.com>

Use better variable names in SetDivider


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

Style fixes to BMenuField

Rename resize to resizingMode, whitespace fixes, compare to 0 explicitly


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

Refactor BMenuField::DrawLabel()

also use std::max() instead of max_c()


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

Style fixes to BMenu and related classes.


# bb169747582db8345d31662a62ec05ecda64835b 02-May-2013 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Cleanups.
Removed code path for be_control_look == NULL.
Improve comments.


# 43ee85f69ca063460212f6e357a86d32623056e4 05-Feb-2013 Axel Dörfler <axeld@pinc-software.de>

BMenuField: fixed broken view color.

* Apparently, I only tested the other case :-)
* This fixes bug #9433.


# 39b9d0f07f3ff33e18aacfa074732c7e4b2b209a 04-Feb-2013 Axel Dörfler <axeld@pinc-software.de>

BMenuField: use panel background color as default.

* There is no reason the BMenuField should behave differently from
any BControl here.


# 8adaa6c54487cab1d200592bb2d5aca44ba2039b 26-Feb-2012 Jerome Duval <jerome.duval@gmail.com>

interface kit: added compatibility symbols for GCC4

* InvalidateLayout method for BBox, BButton, BCheckBox, BMenuField,
BScrollView, BSlider, BStringView, BTextControl.


# f6c8d242946d814ca47bca8eb49219979f009686 19-Dec-2011 Rene Gollent <anevilyak@gmail.com>

Use the correct perform invocation for these functions.


# 466f2b8f997acaecf0397f9f1c8b36a2b1fc5a4e 18-Dec-2011 Rene Gollent <anevilyak@gmail.com>

Add compatibility symbols for removed LayoutChanged() calls.


# 61eb1f1d19eed26b6138b0701612e8eb31bb1d86 22-Oct-2011 Alex Wilson <yourpalal2@gmail.com>

Replace remaining InvalidateLayout()'s with LayoutInvalidated(). Also do a bit of cleanup/move methods around.


# eee4243d35225a35d0964ebebe94490eaca14261 20-Oct-2011 Alex Wilson <yourpalal2@gmail.com>

De-virtualize BView::InvalidateLayout() and introduce LayoutInvalidated() hook, like BLayout.


# 4296233f0e47fd8f99f86fde3aba51d7b9cdd8c3 06-May-2011 Axel Dörfler <axeld@pinc-software.de>

* Made the messed up BMessage* constructors private - since it only affects the
layout API, we probably can just phase it out after a while.
* Introduced new constructors, and added missing flags to one of them to make
it more convenient to use.


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


# 7a37b89be9f81088d05ea085a099816ec16e7095 27-Jul-2010 Alex Wilson <yourpalal2@gmail.com>

Updated BMenuField and its custom BLayoutItems for layout-safe archiving. Added an _InitMenu(const BMessage*) method that inits the menu during unarchival.


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


# c944d11f7e0a6775ab04ced50dd929e539c7d10f 13-Apr-2010 Stephan Aßmus <superstippi@gmx.de>

bonefish+stippi:
All views which cache layout information need to call ResetLayoutInvalidation()
when they have updated the cached information. Otherwise calling
InvalidateLayout() once they are already attached to a layout may not have any
effect.


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


# 12194e33b720dd4785c9ca34e06b807d91c36566 07-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Added missing default initializer for the message.
* Changed BMenuField::MenuBarLayoutItem::BasePreferredSize() to return the
min size as well, instead of a fixed 100 pixels for the width...
* More minor cleanup.


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


# 50f8cd14bb40895f9167f44752525386af219513 07-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Cleanup, no functional change.
* Remove superfluous operator=() implementations.


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


# 84b7e122328acc208f32698d1f29ed0737e6d4df 16-Apr-2009 Stephan Aßmus <superstippi@gmx.de>

Both BTextControl and BMenuField layout the inner control at divider
+ frame width. BTextControl was even calculating it like this everywhere,
but then layouted like BMenuField. Now it's consistent and much easier to
align other controls with the text view or menu bar layout item.


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


# 681c2e4425073000c01c9c97237d2615d226f401 25-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

The button and menu field draw routines take a background color into account,
which makes the resessed frame blend better with the surroundings. This can
be seen best in Keymap, where a different color is set on some buttons, but
the resessed frame should still be the same across all those buttons.


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


# 94e66d170f3c9e07a94dc1cd3f07e4038240c3bb 25-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Fixed recently introduced regressions with layouted BMenuFields. When passing
fixedSize=true to the private BMenuBar class, it would set the follow mode
in AttachedToWindow() such that BMenu would calculate the minimum width
differently. Also fixes ticket #3606.


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


# 47e745c6db828c73ebfca60c7cd353fcf2ed7a99 22-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

* Fixed the unified menu bar width calculations. SetDivider() got it wrong.
* _InitMenuBar() had the meaning of fixedSize reversed. The layout-mode
constructors pass fixedSize = true accordingly.


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


# cda78e4f8e852651f5cc079016b3fd5513769e92 23-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Fixed more inconsistencies in layouting the menu bar. These would mostly
result in the BMenuField not always drawing all of the frame around the
menu bar correctly, for example cutting off at left for divider = 0.


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


# 31852cb13e991ab5e9537fd5b6dad29647f16d4e 22-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Various fixes to BMenuField behavior:
* In layout mode, using a BMenuField directly will make it behave like using
a fixed size BMenuField in non-layout mode. This is open for debate, but
not a change to the previous behavior. When using the Label and MenuBar-
LayoutItems though, the behavior is now changed to be more what one would
expect, ie the BMenuBar part is layouted across the full available width
just like it happens with BTextControls.
* Fixed invalidation of the BMenuBar when it auto-resizes according to picking
another item, and when it is resized due to layout changes.
* Fixed the problem with growing BMenuFields in file panels after changing
folders the first time. The fix is not so nice, but the purpose of setting
the menu item margins is to make sure it renders at the same vertical
offset as the BMenuField label. The better fix would be to change the
calculation of the content location or required margins in the BMenuItem
code... however the BMCPrivate code needs to account for the popup indicator
in the margins so I just kept the fix for the offset there as well.


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


# ce8253d97b588366540230d11fb534c4846d0a09 09-Mar-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

don't open the menu if it's disabled.

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


# 13cd46dfa37ff39c2aeaf3b9fb1f49e1e5cb539e 16-Feb-2009 Stephan Aßmus <superstippi@gmx.de>

* Stronger BMenuField popup indicator.
* Softer recessed frame for BMenuField to distinguish more from BButton
and make it slightly more similar to BTextControl.


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


# 39fbf5509b8740d9883b61649027478dc8a3ead8 15-Oct-2008 Oliver Tappe <zooey@hirschkaefer.de>

bonefish + zooey:
* Fixed a general problem with respect to overriding of the reserved
virtual function slots: instead of statically invoking the method
that corresponds to the reserved slot on the class that contains the
slot, we now invoke the virtual Perform() method. Perform() then dispatches
the method invocation to the "proper" class, i.e. the highest class in the
hierarchy that actually implements the requested method.
This fixes a crash in apps that use liblayout's MSlider class and
should fix one or other spurious bug with old apps or libraries, too.
* added new header folder 'binary_compatibility' that contains files that
define the method codes and data structures required by Perform()
* looked for and implemented all used reserved virtual slot functions to
invoke Perform() where necessary or to pass on the method call statically
(for slots that were already maintained by Be)


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


# 08edea662badba1b3ef30ad22414e53de28beca8 16-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

* Don't set an explicit max size, instead calculate a proper max size in
MaxSize(). This makes sure that MaxSize() returns a proper size when the
user "unsets" the explicite max size.
* minimum label height is 0 if there is no label.


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


# ff168f4e777e64564685f04eb0413d7cb564d319 14-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Use the dedicated BView constructor for using layout management.


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


# 14f6345690030316dbb45d1f4f51ade879bc86ab 14-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Several fixes to BMenuField layout calculations.
* The most important fix is that in BMenuField::_ValidateLayoutData(),
divider was calculated, but then never used. If the menu field was not
using the layout management, it should take the existing fDivider into
account, but never did. This caused #2728.
* Added some tracing that helped me debug this.
* Fixed a bunch of layouting inconsistencies. It will also improve some
unnecessary resizing of the menu bar.

Will test all of this some more. But in the test app I do have, the BMenuField
works more like in BeOS now.


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


# 54badb1f367a83d2cb7a031375fca78fad510187 19-Jul-2008 Stephan Aßmus <superstippi@gmx.de>

mmlr + stippi:
Fixed more controls to handle a B_TRANSPARENT_COLOR as view coloe of the
parent view. Some controls would not initialize their LowColor() at all
if they were the only control in a window.


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


# 5975ad0cfc27f43289a006b877c6768fb6e44388 27-Apr-2008 Jérôme Duval <korli@users.berlios.de>

if no menubar is found in the archive, recreate one to avoid crashing


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


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

Draw the label right at origin in B_ALIGN_LEFT mode. Should improve alignment
with other controls. (BTextControl patch with the same change is upcomming, but
it includes many other changes I didn't want to mix in.)


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


# 44cd9847e91ea326d8dc7cc77a154ecbc966993a 18-Feb-2008 Stefano Ceccherini <stefano.ceccherini@gmail.com>

pass -1 as first parameter of StartMenuBar(), otherwise it will hide the
cursor (used for keyboard navigation). Fixes bug #1807


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


# ee70f30ea0f1ff2fb6c47b41ae87227c9c46c89e 19-Nov-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

cleanups


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


# c831635f1e42963f1a00a3a644e3cd7f43232dc8 13-Sep-2007 Stephan Aßmus <superstippi@gmx.de>

* make sure that the menu bar is still aligned with the right
side if in fixed size mode in ResizeToPreferred, this fixes
the menu bars going out of view bounds in a lot of apps using
fixed size fields, like Screen



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


# 3a38a48561809f630ed89ee09acf16b79c307073 30-Aug-2007 Stephan Aßmus <superstippi@gmx.de>

* fixed size layout of BMenuBar on BMenuField in fixed size mode
(needs to account for the parts that the BMenuField draws, ie the shadow
on the right)
* fixed follow mode of BMenuBar in fixed size mode (B_FOLLOW_LEFT_RIGHT)
* don't resize the BMenuField in fixed size mode (endless loop), this should
be more robust anyways, since this endless loop would be triggered if an
application tried to manually resize menuField->MenuBar() in auto resizing
mode
* fixed calculation of the parts that need to be redrawn on resize


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


# ff39fef2a41d56cebbbcc0666cbc4a9d1736a33c 22-Jun-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* ceilf() both font ascent and descent individually before adding them up to
compute the vertical space requirement of the label.
* Use a better algorithm for vertically aligning the label. The menu bar (or
item) seems to use another algorithm. So, ATM the label is not necessarily
aligned with the menu bar text.


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


# cf76d671df6220394f091bb42f8b0faf170fe451 21-Jun-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

I *think* I've fixed the problem of menu fields not being opened when
the user clicks on the part which has been resized...


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


# b321303cf9862de9ef3f5526d78c5c317cfc45e4 19-Jun-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Implemented Min/Max/PreferredSize().
* Reworked the internal layout. _ValidateLayoutData() computes and caches the
layout related data and all other methods just use those values. Now, in
layout-aware mode the class should properly work not only when using the
layout items. And when using layout items, the class does actually do
internal layout; it was basically good luck that it worked in the tests,
before. Vertical resizing is supported, too.
* We do a few mean tricks to get the probably mostly preferred layout behavior:
By default our own explicit max width and that of the menu bar layout item is
set to unlimited and the horizontal menu bar alignment to left aligned. This
allows to horizontally resize a BMenuField beyond its preferred size,
although both label and menu bar have a limited max width. The user can, of
course, override those explicit sizes/alignments to get a different behavior,
if desired.
* Fixed invalidation in SetDivider(). When having the focus, the left and top
border of the blue frame were not invalidated.
* The label is no longer drawn at vertical position font ascent + descent
+ leading + 2 (not sure how this calculation was supposed to work), but
vertically centers the label around the ascent. With big fonts the label is
shown a bit too far to the bottom. Not sure how to fix this in a generic way.


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


# ebd1a3a1309a2088fac4a5f068a5fb38b3600124 16-Jan-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

some more work on menus... fixed bug #953 and some more stuff


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


# 633d2d3d4ecc98bb855a9d026b9cc26a227bc0e8 28-Sep-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

don't hide the cursor when the menu pops up

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


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

Merge from layout management branch.


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


# 056abb9e934df37aecaeb27cf27661181a76b6d8 07-Jul-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

partially reverted to an old version, should fix strange problems with menufields

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


# cd39decc4481f8bee34c1514366c6468919369e8 28-May-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added a filter to MenuField, so that mousedown messages caught by the inner menubar are redirected to the BMenuField's MouseDown() like happens on beos. That way we can track and invalidate correctly. Implemented Show/HidePopUpMarker

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


# 02c491fd7e021ce410090c7805544e7739baf35b 05-Apr-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

small cleanup

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


# e3d0715523c6d2b7a93dfd158339fad13162d3ea 14-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Enlarged a bit the BMCMenuBar's frame, so that it's drawn more nicely

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


# f282009d152d44be5245b51b95922b627b7ec828 16-Feb-2006 Stephan Aßmus <superstippi@gmx.de>

* _BMCItem_ is no longer used, but I didn't remove it
yet, just commented it out in BMenuField. As was expected,
nothing changed in any obvious way
* made the _BMCMenuBar_ draw the popup marked. I changed it
a bit, inspired from some mockup I saw, sorry I don't
remember where. I hope you like it (it is easily changed
back if you don't).


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


# c72e7319b2347e77b462bd15e2b59fe373e20806 16-Feb-2006 Stephan Aßmus <superstippi@gmx.de>

* have the MenuBar resize to preferred in
ResizeToPreferred()
* fix and sanitize GetPreferredSize()... people,
think "simple"


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


# f9f970d98c9d5c3dfb544bdedf0561f83f76f1e8 11-Jan-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Yesterday's commit triggered some other visual bugs: hopefully fixed them all. A disabled menufield now doesn't open its associated menu anymore.

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


# 8643b0987c2d6aca25b53fb6d8fa0a126b2b3f1f 23-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

All controls/views now accept NULL arguments for "width" and "height" in GetPreferredSize().


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


# 789f68f07a05eef4503d9420b70aeff3b74eec5d 09-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Cleanup.


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


# 5e3af71d64eb325f78fcdafadd8a81d3b15f8ca8 09-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

More or less correctly implemented GetPreferredSize().
The menu bar is now resized to a proper size.


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


# 2e6a5805ba8db3b072d81257cc44f966def5fd37 05-Jul-2005 Stephan Aßmus <superstippi@gmx.de>

MenuField layouts the menu bar better with respect to fDivider, it aligns better with other controls. fDivider in TextControl is an integer number now, small fix and small cleanup in Menu, Window::InitData takes an optional BBitmap token to construct an offscreen window, fixed PrivateScreen IndexForColor, View prevents being located at fractional coordinates as in R5, BBitmap unlocks its offscreen window since it is never Show()n and needs manual unlocking, fixed Slider offscreen window mode and improved triange thumb drawing, ScrollView would not crash when passing a NULL target just for kicks, the private MenuBar class now implements Draw to draw itself a little differently inside the BMenuField (dark right and bottom side) - though how it currently sets the clipping region prevents the text controls to draw in Playground, needs fixing

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


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

Fixed warnings.


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


# a91e36bf1b202c13d016cb25c3e49820b6d41498 04-Sep-2003 haydentech <haydentech@nowhere.fake>

Fix null statement and remove an unused variable


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


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

BMenuField


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