00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef POSITION_HPP
00026 #define POSITION_HPP
00027
00028
00030 class Box
00031 {
00032 public:
00033 virtual ~Box() {}
00034
00036 virtual int getWidth() const = 0;
00037 virtual int getHeight() const = 0;
00038 };
00039
00040
00042 class Rect: public Box
00043 {
00044 public:
00045 Rect( int left, int top, int right, int bottom );
00046
00047 virtual int getLeft() const { return m_left; }
00048 virtual int getTop() const { return m_top; }
00049 virtual int getRight() const { return m_right; }
00050 virtual int getBottom() const { return m_bottom; }
00051
00052 virtual int getWidth() const { return m_right - m_left; }
00053 virtual int getHeight() const { return m_bottom - m_top; }
00054
00055 private:
00056 int m_left;
00057 int m_top;
00058 int m_right;
00059 int m_bottom;
00060 };
00061
00062
00064 class Position
00065 {
00066 public:
00068 typedef enum
00069 {
00071 kLeftTop,
00073 kRightTop,
00075 kLeftBottom,
00077 kRightBottom
00078 } Ref_t;
00079
00081 Position( int left, int top, int right, int bottom, const Box &rBox,
00082 Ref_t refLeftTop = kLeftTop,
00083 Ref_t refRightBottom = kLeftTop );
00084
00085 ~Position() {}
00086
00088 int getLeft() const;
00089 int getTop() const;
00090 int getRight() const;
00091 int getBottom() const;
00093 int getWidth() const;
00094 int getHeight() const;
00095
00096 private:
00098 int m_left;
00099 int m_top;
00100 int m_right;
00101 int m_bottom;
00102 const Box &m_rBox;
00103 Ref_t m_refLeftTop;
00104 Ref_t m_refRighBottom;
00105 };
00106
00107
00108 #endif