00001 #ifndef CAWIDGET_H 00002 #define CAWIDGET_H 00003 00004 #include <ClanLib/core.h> 00005 #include <ClanLib/display.h> 00006 00010 class CAWidget { 00011 public: 00012 enum Alignment { Left, Right, Center }; 00013 00014 CAWidget( Alignment alignment=Left ); 00015 virtual ~CAWidget(); 00016 00017 void move( int x, int y ); 00018 void resize( int width, int height ); 00019 00020 virtual void display( bool active=true ) = 0; 00021 virtual void handleKey( const CL_Key &key ) {} 00022 00024 00025 int getLeft() { 00026 return left; 00027 } 00029 int getTop() { 00030 return top; 00031 } 00033 int getRight() { 00034 return right; 00035 } 00037 int getBottom() { 00038 return bottom; 00039 } 00040 00042 int getHCenter() { 00043 return (left+right)/2; 00044 } 00046 int getVCenter() { 00047 return (top+bottom)/2; 00048 } 00049 00051 int getWidth() { 00052 return width; 00053 } 00055 int getHeight() { 00056 return height; 00057 } 00058 00059 protected: 00061 00062 int left; 00064 int right; 00066 int top; 00068 int bottom; 00070 int width; 00072 int height; 00073 00074 // Widget Alignment (Left, Center, Right) 00075 Alignment alignment; 00076 }; 00077 00078 #endif
1.5.0