00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
00033 #define __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
00034
00035 #include "../juce_Component.h"
00036
00037
00038
00050 class JUCE_API ComponentBoundsConstrainer
00051 {
00052 public:
00053
00055 ComponentBoundsConstrainer() throw();
00056
00058 virtual ~ComponentBoundsConstrainer();
00059
00060
00062 void setMinimumWidth (const int minimumWidth) throw();
00063
00065 int getMinimumWidth() const throw() { return minW; }
00066
00068 void setMaximumWidth (const int maximumWidth) throw();
00069
00071 int getMaximumWidth() const throw() { return maxW; }
00072
00074 void setMinimumHeight (const int minimumHeight) throw();
00075
00077 int getMinimumHeight() const throw() { return minH; }
00078
00080 void setMaximumHeight (const int maximumHeight) throw();
00081
00083 int getMaximumHeight() const throw() { return maxH; }
00084
00086 void setMinimumSize (const int minimumWidth,
00087 const int minimumHeight) throw();
00088
00090 void setMaximumSize (const int maximumWidth,
00091 const int maximumHeight) throw();
00092
00094 void setSizeLimits (const int minimumWidth,
00095 const int minimumHeight,
00096 const int maximumWidth,
00097 const int maximumHeight) throw();
00098
00099
00116 void setMinimumOnscreenAmounts (const int minimumWhenOffTheTop,
00117 const int minimumWhenOffTheLeft,
00118 const int minimumWhenOffTheBottom,
00119 const int minimumWhenOffTheRight) throw();
00120
00121
00129 void setFixedAspectRatio (const double widthOverHeight) throw();
00130
00135 double getFixedAspectRatio() const throw();
00136
00137
00138
00153 virtual void checkBounds (int& x, int& y, int& w, int& h,
00154 const Rectangle& previousBounds,
00155 const Rectangle& limits,
00156 const bool isStretchingTop,
00157 const bool isStretchingLeft,
00158 const bool isStretchingBottom,
00159 const bool isStretchingRight);
00160
00162 virtual void resizeStart();
00163
00165 virtual void resizeEnd();
00166
00168 void setBoundsForComponent (Component* const component,
00169 int x, int y, int w, int h,
00170 const bool isStretchingTop,
00171 const bool isStretchingLeft,
00172 const bool isStretchingBottom,
00173 const bool isStretchingRight);
00174
00181 virtual void applyBoundsToComponent (Component* component,
00182 int x, int y, int w, int h);
00183
00184
00185 juce_UseDebuggingNewOperator
00186
00187 private:
00188 int minW, maxW, minH, maxH;
00189 int minOffTop, minOffLeft, minOffBottom, minOffRight;
00190 double aspectRatio;
00191
00192 ComponentBoundsConstrainer (const ComponentBoundsConstrainer&);
00193 const ComponentBoundsConstrainer& operator= (const ComponentBoundsConstrainer&);
00194 };
00195
00196
00197 #endif // __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__