Ticket #11394: 0002-BToolbar-Allow-the-toolbar-s-orientation-to-be-set-b.patch

File 0002-BToolbar-Allow-the-toolbar-s-orientation-to-be-set-b.patch, 2.4 KB (added by waddlesplash, 9 years ago)
  • headers/private/shared/Toolbar.h

    From 9563d722ea57b648f64264ce43e8d4ce83e141c3 Mon Sep 17 00:00:00 2001
    From: Augustin Cavalier <waddlesplash@gmail.com>
    Date: Fri, 7 Nov 2014 22:53:18 -0500
    Subject: [PATCH] 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.
    ---
     headers/private/shared/Toolbar.h | 9 ++++++---
     src/kits/shared/Toolbar.cpp      | 9 ++++++---
     2 files changed, 12 insertions(+), 6 deletions(-)
    
    diff --git a/headers/private/shared/Toolbar.h b/headers/private/shared/Toolbar.h
    index d14eaec..130a6bf 100644
    a b  
    11/*
    2  * Copyright 2011 Stephan Aßmus <superstippi@gmx.de>
    3  * All rights reserved. Distributed under the terms of the MIT license.
     2 * Copyright 2011-2014, Haiku, Inc. All rights reserved.
     3 * Distributed under the terms of the MIT License.
    44 */
    55#ifndef _TOOLBAR_H
    66#define _TOOLBAR_H
    namespace BPrivate {  
    1414
    1515class BToolbar : public BGroupView {
    1616public:
    17                                 BToolbar(BRect frame);
     17                                BToolbar(BRect frame,
     18                                    orientation ont = B_HORIZONTAL);
    1819    virtual                     ~BToolbar();
    1920
    2021    virtual void                Hide();
    private:  
    4142            void                _AddView(BView* view);
    4243            BButton*            _FindButton(uint32 command) const;
    4344            void                _HideToolTips() const;
     45           
     46            orientation         fOrientation;
    4447};
    4548
    4649} // namespace BPrivate
  • src/kits/shared/Toolbar.cpp

    diff --git a/src/kits/shared/Toolbar.cpp b/src/kits/shared/Toolbar.cpp
    index 4c9fbf5..0d6b791 100644
    a b LockableButton::MouseDown(BPoint point)  
    4444}
    4545
    4646
    47 BToolbar::BToolbar(BRect frame)
     47BToolbar::BToolbar(BRect frame, orientation ont)
    4848    :
    49     BGroupView(B_HORIZONTAL)
     49    BGroupView(ont),
     50    fOrientation(ont)
    5051{
    5152    float inset = ceilf(be_control_look->DefaultItemSpacing() / 2);
    5253    GroupLayout()->SetInsets(inset, 0, inset, 0);
    BToolbar::AddAction(BMessage* message, BHandler* target,  
    105106void
    106107BToolbar::AddSeparator()
    107108{
    108     _AddView(new BSeparatorView(B_VERTICAL, B_PLAIN_BORDER));
     109    orientation ont = (fOrientation == B_HORIZONTAL) ?
     110        B_VERTICAL : B_HORIZONTAL;
     111    _AddView(new BSeparatorView(ont, B_PLAIN_BORDER));
    109112}
    110113
    111114