openshot-audio  0.1.7
juce_ComponentBoundsConstrainer.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_COMPONENTBOUNDSCONSTRAINER_H_INCLUDED
26 #define JUCE_COMPONENTBOUNDSCONSTRAINER_H_INCLUDED
27 
28 
29 //==============================================================================
42 {
43 public:
44  //==============================================================================
47 
49  virtual ~ComponentBoundsConstrainer();
50 
51  //==============================================================================
53  void setMinimumWidth (int minimumWidth) noexcept;
54 
56  int getMinimumWidth() const noexcept { return minW; }
57 
59  void setMaximumWidth (int maximumWidth) noexcept;
60 
62  int getMaximumWidth() const noexcept { return maxW; }
63 
65  void setMinimumHeight (int minimumHeight) noexcept;
66 
68  int getMinimumHeight() const noexcept { return minH; }
69 
71  void setMaximumHeight (int maximumHeight) noexcept;
72 
74  int getMaximumHeight() const noexcept { return maxH; }
75 
77  void setMinimumSize (int minimumWidth,
78  int minimumHeight) noexcept;
79 
81  void setMaximumSize (int maximumWidth,
82  int maximumHeight) noexcept;
83 
85  void setSizeLimits (int minimumWidth,
86  int minimumHeight,
87  int maximumWidth,
88  int maximumHeight) noexcept;
89 
90  //==============================================================================
107  void setMinimumOnscreenAmounts (int minimumWhenOffTheTop,
108  int minimumWhenOffTheLeft,
109  int minimumWhenOffTheBottom,
110  int minimumWhenOffTheRight) noexcept;
111 
112 
114  int getMinimumWhenOffTheTop() const noexcept { return minOffTop; }
116  int getMinimumWhenOffTheLeft() const noexcept { return minOffLeft; }
118  int getMinimumWhenOffTheBottom() const noexcept { return minOffBottom; }
120  int getMinimumWhenOffTheRight() const noexcept { return minOffRight; }
121 
122  //==============================================================================
130  void setFixedAspectRatio (double widthOverHeight) noexcept;
131 
136  double getFixedAspectRatio() const noexcept;
137 
138 
139  //==============================================================================
151  virtual void checkBounds (Rectangle<int>& bounds,
152  const Rectangle<int>& previousBounds,
153  const Rectangle<int>& limits,
154  bool isStretchingTop,
155  bool isStretchingLeft,
156  bool isStretchingBottom,
157  bool isStretchingRight);
158 
160  virtual void resizeStart();
161 
163  virtual void resizeEnd();
164 
166  void setBoundsForComponent (Component* component,
167  const Rectangle<int>& bounds,
168  bool isStretchingTop,
169  bool isStretchingLeft,
170  bool isStretchingBottom,
171  bool isStretchingRight);
172 
176  void checkComponentBounds (Component* component);
177 
184  virtual void applyBoundsToComponent (Component* component,
185  const Rectangle<int>& bounds);
186 
187 private:
188  //==============================================================================
189  int minW, maxW, minH, maxH;
190  int minOffTop, minOffLeft, minOffBottom, minOffRight;
191  double aspectRatio;
192 
194 };
195 
196 
197 #endif // JUCE_COMPONENTBOUNDSCONSTRAINER_H_INCLUDED
#define noexcept
Definition: juce_CompilerSupport.h:141
int getMinimumWhenOffTheBottom() const noexcept
Definition: juce_ComponentBoundsConstrainer.h:118
int getMinimumWhenOffTheLeft() const noexcept
Definition: juce_ComponentBoundsConstrainer.h:116
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_Rectangle.h:36
int getMaximumWidth() const noexcept
Definition: juce_ComponentBoundsConstrainer.h:62
int getMinimumWidth() const noexcept
Definition: juce_ComponentBoundsConstrainer.h:56
Definition: juce_Component.h:33
int getMinimumWhenOffTheRight() const noexcept
Definition: juce_ComponentBoundsConstrainer.h:120
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
int getMinimumWhenOffTheTop() const noexcept
Definition: juce_ComponentBoundsConstrainer.h:114
int getMaximumHeight() const noexcept
Definition: juce_ComponentBoundsConstrainer.h:74
Definition: juce_ComponentBoundsConstrainer.h:41
int getMinimumHeight() const noexcept
Definition: juce_ComponentBoundsConstrainer.h:68