openshot-audio  0.1.4
juce_StretchableLayoutManager.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_STRETCHABLELAYOUTMANAGER_H_INCLUDED
26 #define JUCE_STRETCHABLELAYOUTMANAGER_H_INCLUDED
27 
28 
29 //==============================================================================
81 {
82 public:
83  //==============================================================================
90 
93 
94  //==============================================================================
109  void setItemLayout (int itemIndex,
110  double minimumSize,
111  double maximumSize,
112  double preferredSize);
113 
129  bool getItemLayout (int itemIndex,
130  double& minimumSize,
131  double& maximumSize,
132  double& preferredSize) const;
133 
137  void clearAllItems();
138 
139  //==============================================================================
170  void layOutComponents (Component** components,
171  int numComponents,
172  int x, int y, int width, int height,
173  bool vertically,
174  bool resizeOtherDimension);
175 
176  //==============================================================================
190  int getItemCurrentPosition (int itemIndex) const;
191 
201  int getItemCurrentAbsoluteSize (int itemIndex) const;
202 
213  double getItemCurrentRelativeSize (int itemIndex) const;
214 
215  //==============================================================================
231  void setItemPosition (int itemIndex,
232  int newPosition);
233 
234 
235 private:
236  //==============================================================================
237  struct ItemLayoutProperties
238  {
239  int itemIndex;
240  int currentSize;
241  double minSize, maxSize, preferredSize;
242  };
243 
245  int totalSize;
246 
247  //==============================================================================
248  static int sizeToRealSize (double size, int totalSpace);
249  ItemLayoutProperties* getInfoFor (int itemIndex) const;
250  void setTotalSize (int newTotalSize);
251  int fitComponentsIntoSpace (int startIndex, int endIndex, int availableSpace, int startPos);
252  int getMinimumSizeOfItems (int startIndex, int endIndex) const;
253  int getMaximumSizeOfItems (int startIndex, int endIndex) const;
254  void updatePrefSizesToMatchCurrentPositions();
255 
257 };
258 
259 
260 #endif // JUCE_STRETCHABLELAYOUTMANAGER_H_INCLUDED
Definition: juce_StretchableLayoutManager.h:80
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_Component.h:33
Definition: juce_OwnedArray.h:55
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198