00001 #ifndef CSScrollbar_h 00002 #define CSScrollbar_h 00003 00004 // USES SDL_Surface 00005 00006 #ifdef WIN32 00007 #pragma warning(disable : 4786 ) 00008 #endif 00009 00010 #include <vector> 00011 #include <string> 00012 00013 #include "CSGrafikElement.h" 00014 #include "CSButton.h" 00015 #include "CSIcon.h" 00016 #include "CSMessage.h" 00017 #include "CSLog.h" 00018 00019 class CSScrollbar; 00020 class CSPanel; 00021 typedef std::vector<CSScrollbar *> CSScrollbars; 00022 00023 class CSScrollbar : public CSGrafikElement 00024 { 00025 private: 00026 CSButton *mLess; 00027 CSButton *mMore; 00028 CSDragButton *mHandle; 00029 int mKind; 00030 00031 int mStart; 00032 int mEnd; 00033 int mDisplayStart; 00034 int mDisplayEnd; 00035 int mDisplayLength; 00036 int mDragPosition; 00037 void positionChanged(); 00038 GuiMessage MESSAGE_SCROLLBAR_CHANGED; 00039 00040 protected: 00041 // virtual void setParent(CSGrafikElement *parent); 00042 virtual void layoutSetupScrollbar(); 00043 virtual void rebuildElement(); 00044 public: 00045 static const char *CLASS; 00046 virtual std::string getType() {return (std::string) CLASS;} 00047 CSScrollbar(int kind); // Button frees Icon! 00048 ~CSScrollbar() {} 00049 virtual void paint(SDL_Surface *destination, SDL_Rect *parentViewport); 00050 00051 void setStart(int start) {mStart=start;} 00052 void setEnd(int end) {mEnd=end;} 00053 void setDisplayStart(int start) {mDisplayStart=start;} 00054 void setDisplayEnd(int end) {mDisplayEnd=end;} 00055 void setDisplayLength(int length) {mDisplayLength=length;} // Anzahl der anzuzeigenden elemente 00056 void reactOnMessageScrollbar(CSMessage *message); 00057 virtual void reactOnMessage(CSMessage *message); 00058 virtual void layoutSetup() {layoutSetupScrollbar();} 00059 }; 00060 #endif // CSScrollbar_h