Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

pgcolorselector.h

Go to the documentation of this file.
00001 #ifndef PG_COLORSELECTOR_H
00002 #define PG_COLORSELECTOR_H
00003 
00004 #include "pgthemewidget.h"
00005 #include "pgslider.h"
00006 
00007 class PG_ColorSelector : public PG_ThemeWidget {
00008 protected:
00009         
00010         class PG_ColorBox : public PG_ThemeWidget {
00011         public:
00012                 
00013                 PG_ColorBox(PG_ColorSelector* parent, const PG_Rect& r);
00014                 
00015                 inline PG_ColorSelector* GetParent() {
00016                         return static_cast<PG_ColorSelector*>(PG_ThemeWidget::GetParent());
00017                 }
00018                 
00019                 PG_Color GetBaseColor();
00020 
00021         protected:
00022                 
00023                 void eventBlit(SDL_Surface* srf, const PG_Rect& src, const PG_Rect& dst);
00024                 
00025                 bool eventMouseMotion(const SDL_MouseMotionEvent* motion);
00026                 bool eventMouseButtonDown(const SDL_MouseButtonEvent* button);
00027                 bool eventMouseButtonUp(const SDL_MouseButtonEvent* button);
00028                 
00029         private:
00030                 
00031                 bool my_btndown;
00032                 PG_Point p;
00033         };
00034         
00035 public:
00036         
00037         PG_ColorSelector(PG_Widget* parent, const PG_Rect&r, const std::string& style="colorselector");
00038         ~PG_ColorSelector();
00039 
00040         void SetColor(const PG_Color& c);
00041         
00042         inline void SetColorGradient(PG_Gradient g) {
00043                 my_colorbox->SetGradient(g);
00044         }
00045 
00046 protected:
00047         
00048         bool handle_colorslide(long data);
00049 
00050         void SetBaseColor(const PG_Color& c);
00051         
00052         PG_ColorBox* my_colorbox;
00053         PG_Slider* my_colorslider;
00054         PG_ThemeWidget* my_colorresult;
00055         
00056         PG_Color my_color;
00057         PG_Color my_basecolor;
00058         
00059         friend class PG_ColorBox;
00060 };
00061 
00062 #endif // PG_COLORSELECTOR_H

Generated on Tue Jun 24 01:27:47 2008 for Advanced Strategic Command by  doxygen 1.4.2