CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

csbackgr.h

Go to the documentation of this file.
00001 /*
00002     Crystal Space Windowing System: background class
00003     Copyright (C) 2000 by Andrew Zabolotny <bit@eltech.ru>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 #ifndef __CS_CSBACKGR_H__
00021 #define __CS_CSBACKGR_H__
00022 
00031 #include "csgfx/rgbpixel.h"
00032 
00033 struct iTextureHandle;
00034 class csApp;
00035 class csComponent;
00036 
00038 enum csBackgroundType
00039 {
00041   csbgNone = 0,
00043   csbgColor,
00045   csbgGradient,
00047   csbgTextured
00048 };
00049 
00054 class csBackground
00055 {
00057   csBackgroundType type;
00059   iTextureHandle *tex;
00061   csRGBcolor colors [4];
00063   int color;
00064 
00065 public:
00067   csBackground ();
00068 
00070   ~csBackground ();
00071 
00073   void Free ()
00074   { SetTexture (NULL); }
00075 
00077   void SetTexture (iTextureHandle *iTex);
00078 
00080   iTextureHandle *GetTexture ()
00081   { return tex; }
00082 
00084   void SetColor (int iIndex, csRGBcolor &iColor)
00085   { colors [iIndex] = iColor; type = csbgGradient; }
00086 
00088   csRGBcolor &GetColor (int iIndex)
00089   { return colors [iIndex]; }
00090 
00092   void SetColor (int iColor)
00093   { color = iColor; type = csbgColor; }
00094 
00096   int GetColor ()
00097   { return color; }
00098 
00100   void SetType (csBackgroundType iType)
00101   { type = iType; }
00102 
00104   csBackgroundType GetType ()
00105   { return type; }
00106 
00108   void Draw (csComponent &This, int x, int y, int w, int h,
00109     int xorg, int yorg, uint8 iAlpha);
00110 };
00111 
00114 #endif // __CS_CSBACKGR_H__

Generated for Crystal Space by doxygen 1.2.14