- Main Page
- Classes
- Files
- Directories
- Related Pages

# box.h

    00001 /*--License:
    00002         Kyra Sprite Engine
    00003         Copyright Lee Thomason (Grinning Lizard Software) 2001-2005
    00004         www.grinninglizard.com/kyra
    00005         www.sourceforge.net/projects/kyra
    00006
    00007         Kyra is provided under the LGPL.
    00008
    00009         I kindly request you display a splash screen (provided in the HTML documentation)
    00010         to promote Kyra and acknowledge the software and everyone who has contributed to it,
    00011         but it is not required by the license.
    00012
    00013 --- LGPL License --
    00014
    00015     This library is free software; you can redistribute it and/or
    00016     modify it under the terms of the GNU Lesser General Public
    00017     License as published by the Free Software Foundation; either
    00018     version 2.1 of the License, or (at your option) any later version.
    00019
    00020     This library is distributed in the hope that it will be useful,
    00021     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00022     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00023     Lesser General Public License for more details.
    00024
    00025     You should have received a copy of the GNU Lesser General Public
    00026     License along with this library; if not, write to the Free Software
    00027     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00028
    00029         The full text of the license can be found in lgpl.txt
    00030 */
    00031
    00032 #ifndef KYRA_BOX_INCLUDED
    00033 #define KYRA_BOX_INCLUDED
    00034
    00035 #include "image.h"
    00036 #include "boxresource.h"
    00037
    00038
    00039 struct KrPaintInfo;
    00040 class  KrBoxResource;
    00041 union  KrRGBA;
    00042
    00043
    00058 class KrBox : public KrImage
    00059 {
    00060   public:
    00061
    00063         KrBox( KrBoxResource* resource );
    00064         KrBox( int width, int height, KrRGBA color, int boxtype );
    00065
    00066         virtual ~KrBox();
    00067
    00068         virtual KrBox*    ToBox()               { return this; }
    00069
    00070         virtual void Draw(      KrPaintInfo* paintInfo,
    00071                                                 const grinliz::Rectangle2I& clip,
    00072                                                 int window );
    00073
    00074         int Width()                     { return resource->Width(); }
    00075         int Height()            { return resource->Height(); }
    00076
    00077
    00079         void SetSize( int w, int h );
    00081         void SetBoxColor( KrRGBA color );
    00083         void SetType( int boxtype );
    00084
    00085         virtual KrImNode* Clone();
    00086
    00087         virtual bool HitTest( int x, int y, int flags, std::vector<KrImage*>* results, int win );
    00088         virtual void CalcTransform( int window );
    00089         virtual void QueryBoundingBox( grinliz::Rectangle2I* boundingBox, int window = 0 );
    00090         virtual KrResource* Resource()                  { return resource; }
    00091
    00092   protected:
    00093
    00094   private:
    00095         KrBoxResource* resource;
    00096         bool owned;                                     // Do we own the resource?
    00097 };
    00098
    00099
    00100 #endif