BToolbar: Allow the toolbar's orientation to be set by its creator.
I already made this patch in Heidi's clone of BToolbar. Adding it here allows me to drop Heidi's version altogether. I also relicensed the header file at the permission of Stephan. The .cpp file still lists him as author and copyright holder. Signed-off-by: Jessica Hamilton <[email protected]>
This commit is contained in:
committed by
Jessica Hamilton
parent
44d31dca37
commit
0a74147e1d
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2011 Stephan Aßmus <[email protected]>
|
||||
* All rights reserved. Distributed under the terms of the MIT license.
|
||||
* Copyright 2011-2014, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _TOOLBAR_H
|
||||
#define _TOOLBAR_H
|
||||
@@ -14,7 +14,8 @@ namespace BPrivate {
|
||||
|
||||
class BToolbar : public BGroupView {
|
||||
public:
|
||||
BToolbar(BRect frame);
|
||||
BToolbar(BRect frame,
|
||||
orientation ont = B_HORIZONTAL);
|
||||
virtual ~BToolbar();
|
||||
|
||||
virtual void Hide();
|
||||
@@ -41,6 +42,8 @@ private:
|
||||
void _AddView(BView* view);
|
||||
BButton* _FindButton(uint32 command) const;
|
||||
void _HideToolTips() const;
|
||||
|
||||
orientation fOrientation;
|
||||
};
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
@@ -44,9 +44,10 @@ LockableButton::MouseDown(BPoint point)
|
||||
}
|
||||
|
||||
|
||||
BToolbar::BToolbar(BRect frame)
|
||||
BToolbar::BToolbar(BRect frame, orientation ont)
|
||||
:
|
||||
BGroupView(B_HORIZONTAL)
|
||||
BGroupView(ont),
|
||||
fOrientation(ont)
|
||||
{
|
||||
float inset = ceilf(be_control_look->DefaultItemSpacing() / 2);
|
||||
GroupLayout()->SetInsets(inset, 0, inset, 0);
|
||||
@@ -105,7 +106,9 @@ BToolbar::AddAction(BMessage* message, BHandler* target,
|
||||
void
|
||||
BToolbar::AddSeparator()
|
||||
{
|
||||
_AddView(new BSeparatorView(B_VERTICAL, B_PLAIN_BORDER));
|
||||
orientation ont = (fOrientation == B_HORIZONTAL) ?
|
||||
B_VERTICAL : B_HORIZONTAL;
|
||||
_AddView(new BSeparatorView(ont, B_PLAIN_BORDER));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user