Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

CSWindow.h

Go to the documentation of this file.
00001 #ifndef CSWINDOW_h
00002 #define CSWINDOW_h
00003 
00004 // USES SDL_Surface
00005 // USES SDL_Rect 
00006 
00007 #ifdef WIN32
00008 #pragma warning(disable : 4786 )
00009 #endif
00010 
00011 #include <vector>
00012 #include <string>
00013 
00014 #include "CSPicture.h"
00015 #include "CSMessage.h"
00016 #include "CSButton.h"
00017 #include "CSGrafikElement.h"
00018 #include "CSDesktop.h"
00019 #include "CSLabel.h"
00020 #include "CSLog.h"
00021 #include "CSBar.h"
00022 
00023 #include "CSIcon.h"
00024 
00025 class CSPanel;
00026 class CSWindow;
00027 typedef std::vector<CSWindow *> CSWindows;
00028 
00029 class CSWindow : public CSGrafikElement
00030 {
00031     private:
00032         CSBar *mTitleBar;
00033         CSIcons mLeftIcons;
00034         CSTextIcon *mTitleIcon;
00035         std::string mTitle;
00036         CSPicture *mPicture;
00037 
00038         int mDragStartX;
00039         int mDragStartY;
00040         int mSizingOffset;
00041         bool mCloseable;
00042         bool mCursorChange;
00043         bool mSizing;
00044         bool mIsSizeable;
00045         bool mActive;
00046         bool mDragging;
00047         bool mHasTitle;
00048         CSPanel *mNorth;
00049         CSPanel *mWest;
00050         CSPanel *mSouth;
00051         CSPanel *mEast;
00052         CSPanel *mCenter;
00053 
00054         CSScrollbar *mVerticalScrollbar;
00055         CSScrollbar *mHorizontalScrollbar;
00056         int mVerticalDisplayStart;      
00057         int mVerticalDisplayEnd;        
00058         int mVerticalDisplayLength;     
00059         int mHorizontalDisplayStart;
00060         int mHorizontalDisplayEnd;
00061         int mHorizontalDisplayLength;
00062         void getCenterMinSize(int &minWidth, int &minHeight);
00063         int mMinHeightInPixel;
00064         int mMinWidthInPixel;
00065         bool mHorizontalDisplaySet;
00066         bool mVerticalDisplaySet;
00067 
00068         bool initVerticalScrollbar();
00069         bool initHorizontalScrollbar();
00070 
00071     protected:
00072         virtual void layoutSetupWindow();
00073         virtual void rebuildElementWindow();
00074         virtual void rebuildElement() {rebuildElementWindow();}
00075 
00076         GuiMessage MESSAGE_WINDOW_CLOSE;
00077         CSButton *mCloseButton;
00078     public:
00079         CSWindow(int height, int width, bool hasTitle = true);
00080         CSWindow(CSPicture *picture);
00081         virtual ~CSWindow();
00082         static const char *CLASS;
00083         virtual std::string getType() {return (std::string) CLASS;}
00084 
00085         void initWindow();
00086         virtual void paint(SDL_Surface *destination, SDL_Rect *parentViewport);
00087         bool isActive() {return mActive;}
00088         void reactOnMessageWindow(CSMessage *message);
00089         virtual void reactOnMessage(CSMessage *message);
00090         bool isPictureWindow(void) {return mPicture != 0;}
00091         virtual bool isTransparent(int x, int y, SDL_Rect *parentViewport);
00092         void setTitle(std::string s) 
00093         {
00094             if (s.compare(mTitle) == 0)
00095             {
00096                 return;
00097             }
00098             mTitle = s;
00099             if (mTitleIcon)
00100             {
00101                 mTitleIcon->setText(mTitle);
00102             }
00103             layoutChanged();
00104         }
00105         std::string getTitle(void) {return mTitle;}
00106         void addLeftIcon(CSIcon *icon);
00107         void addElementNorth(CSGrafikElement *element);
00108         void addElementSouth(CSGrafikElement *element);
00109         void addElementEast(CSGrafikElement *element);
00110         void addElementWest(CSGrafikElement *element);
00111         bool isClosable() {return mCloseable;}
00112         void setClosable(bool b) 
00113         {
00114             mCloseable = b;
00115             if (mCloseButton)
00116             {
00117                 mCloseButton->setVisible(mCloseable);
00118             }
00119         }
00120         void setSizeable(bool s) {mIsSizeable = s;}
00121         bool isSizeable() {return mIsSizeable;}
00122         virtual void layoutSetup() {layoutSetupWindow();}
00123         void setVerticalDisplayStart(int y);
00124         void setHorizontalDisplayStart(int x);
00125         int getVerticalDisplayStart() {return mVerticalDisplayStart;}
00126         int getHorizontalDisplayStart() {return mHorizontalDisplayStart;}
00127 };
00128 
00129 #endif // CSWINDOW_h

Generated on Wed Jul 14 00:43:43 2004 for CSLib by doxygen 1.3.6