juce_BubbleComponent.h

Go to the documentation of this file.
00001 /*
00002   ==============================================================================
00003 
00004    This file is part of the JUCE library - "Jules' Utility Class Extensions"
00005    Copyright 2004-7 by Raw Material Software ltd.
00006 
00007   ------------------------------------------------------------------------------
00008 
00009    JUCE can be redistributed and/or modified under the terms of the
00010    GNU General Public License, as published by the Free Software Foundation;
00011    either version 2 of the License, or (at your option) any later version.
00012 
00013    JUCE is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with JUCE; if not, visit www.gnu.org/licenses or write to the
00020    Free Software Foundation, Inc., 59 Temple Place, Suite 330,
00021    Boston, MA 02111-1307 USA
00022 
00023   ------------------------------------------------------------------------------
00024 
00025    If you'd like to release a closed-source product which uses JUCE, commercial
00026    licenses are also available: visit www.rawmaterialsoftware.com/juce for
00027    more information.
00028 
00029   ==============================================================================
00030 */
00031 
00032 #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
00033 #define __JUCE_BUBBLECOMPONENT_JUCEHEADER__
00034 
00035 #include "../juce_Component.h"
00036 #include "../../graphics/effects/juce_DropShadowEffect.h"
00037 
00038 
00039 //==============================================================================
00054 class JUCE_API  BubbleComponent  : public Component
00055 {
00056 protected:
00057     //==============================================================================
00063     BubbleComponent();
00064 
00065 public:
00067     ~BubbleComponent();
00068 
00069     //==============================================================================
00075     enum BubblePlacement
00076     {
00077         above   = 1,
00078         below   = 2,
00079         left    = 4,
00080         right   = 8
00081     };
00082 
00095     void setAllowedPlacement (const int newPlacement);
00096 
00097     //==============================================================================
00107     void setPosition (Component* componentToPointTo);
00108 
00120     void setPosition (const int arrowTipX,
00121                       const int arrowTipY);
00122 
00134     void setPosition (const Rectangle& rectangleToPointTo);
00135 
00136 
00137 protected:
00138     //==============================================================================
00142     virtual void getContentSize (int& width, int& height) = 0;
00143 
00149     virtual void paintContent (Graphics& g, int width, int height) = 0;
00150 
00151 
00152 public:
00153     //==============================================================================
00155     void paint (Graphics& g);
00156 
00157     juce_UseDebuggingNewOperator
00158 
00159 private:
00160     Rectangle content;
00161     int side, allowablePlacements;
00162     float arrowTipX, arrowTipY;
00163     DropShadowEffect shadow;
00164 
00165     BubbleComponent (const BubbleComponent&);
00166     const BubbleComponent& operator= (const BubbleComponent&);
00167 };
00168 
00169 
00170 #endif   // __JUCE_BUBBLECOMPONENT_JUCEHEADER__