1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2003 VideoLAN
5 * $Id: position.hpp,v 1.1 2004/01/03 23:31:34 asmax Exp $
7 * Authors: Cyril Deguet <asmax@via.ecp.fr>
8 * Olivier Teulière <ipkiss@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
29 /// Interface for rectangular objects
33 /// Get the size of the box
34 virtual int getWidth() const = 0;
35 virtual int getHeight() const = 0;
39 /// Characterization of a rectangle
40 class Rect: public Box
43 Rect( int left, int top, int right, int bottom );
45 virtual int getLeft() const { return m_left; }
46 virtual int getTop() const { return m_top; }
47 virtual int getRight() const { return m_right; }
48 virtual int getBottom() const { return m_bottom; }
50 virtual int getWidth() const { return m_right - m_left; }
51 virtual int getHeight() const { return m_bottom - m_top; }
61 /// Relative position of a rectangle in a box
65 /// Type for reference edge/corner
68 /// Coordinates are relative to the upper left corner
70 /// Coordinates are relative to the upper right corner
72 /// Coordinates are relative to the lower left corner
74 /// Coordinates are relative to the lower right corner
78 /// Create a new position relative to the given box
79 Position( int left, int top, int right, int bottom, const Box &rBox,
80 Ref_t refLeftTop = kLeftTop,
81 Ref_t refRightBottom = kLeftTop );
85 /// Get the position relative to the left top corner of the box
89 int getBottom() const;
90 /// Get the size of the rectangle
92 int getHeight() const;
95 /// Position and reference edge/corner
102 Ref_t m_refRighBottom;