2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-11 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
27 #define __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
29 #include "../juce_Component.h"
30 #include "juce_StretchableLayoutManager.h"
33 //==============================================================================
35 A component that acts as one of the vertical or horizontal bars you see being
36 used to resize panels in a window.
38 One of these acts with a StretchableLayoutManager to resize the other components.
40 @see StretchableLayoutManager
42 class JUCE_API StretchableLayoutResizerBar
: public Component
45 //==============================================================================
46 /** Creates a resizer bar for use on a specified layout.
48 @param layoutToUse the layout that will be affected when this bar
50 @param itemIndexInLayout the item index in the layout that corresponds to
51 this bar component. You'll need to set up the item
52 properties in a suitable way for a divider bar, e.g.
53 for an 8-pixel wide bar which, you could call
54 myLayout->setItemLayout (barIndex, 8, 8, 8)
55 @param isBarVertical true if it's an upright bar that you drag left and
56 right; false for a horizontal one that you drag up and
59 StretchableLayoutResizerBar (StretchableLayoutManager
* layoutToUse
,
60 int itemIndexInLayout
,
64 ~StretchableLayoutResizerBar();
66 //==============================================================================
67 /** This is called when the bar is dragged.
69 This method must update the positions of any components whose position is
70 determined by the StretchableLayoutManager, because they might have just
73 The default implementation calls the resized() method of this component's
74 parent component, because that's often where you're likely to apply the
75 layout, but it can be overridden for more specific needs.
77 virtual void hasBeenMoved();
79 //==============================================================================
81 void paint (Graphics
& g
);
83 void mouseDown (const MouseEvent
& e
);
85 void mouseDrag (const MouseEvent
& e
);
89 //==============================================================================
90 StretchableLayoutManager
* layout
;
91 int itemIndex
, mouseDownPos
;
94 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StretchableLayoutResizerBar
);
98 #endif // __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__