Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

position.hpp

00001 /*****************************************************************************
00002  * position.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: position.hpp 11699 2005-07-11 08:52:14Z sam $
00006  *
00007  * Authors: Cyril Deguet     <[email protected]>
00008  *          Olivier Teulière <[email protected]>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
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

Generated on Tue Dec 20 10:14:43 2005 for vlc-0.8.4a by  doxygen 1.4.2