1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2003 the VideoLAN team
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 *****************************************************************************/
28 #include "variable.hpp"
29 #include "observer.hpp"
32 /// Interface for rectangular objects
38 /// Get the size of the box
39 virtual int getWidth() const = 0;
40 virtual int getHeight() const = 0;
44 /// Characterization of a rectangle
45 class Rect: public Box
48 Rect( int left, int top, int right, int bottom );
50 virtual int getLeft() const { return m_left; }
51 virtual int getTop() const { return m_top; }
52 virtual int getRight() const { return m_right; }
53 virtual int getBottom() const { return m_bottom; }
55 virtual int getWidth() const { return m_right - m_left; }
56 virtual int getHeight() const { return m_bottom - m_top; }
66 /// Relative position of a rectangle in a box
70 /// Type for reference edge/corner
73 /// Coordinates are relative to the upper left corner
75 /// Coordinates are relative to the upper right corner
77 /// Coordinates are relative to the lower left corner
79 /// Coordinates are relative to the lower right corner
83 /// Create a new position relative to the given box
84 Position( int left, int top, int right, int bottom, const Box &rBox,
85 Ref_t refLeftTop = kLeftTop,
86 Ref_t refRightBottom = kLeftTop );
90 /// Get the position relative to the left top corner of the box
94 int getBottom() const;
95 /// Get the size of the rectangle
97 int getHeight() const;
100 /// Position and reference edge/corner
107 Ref_t m_refRighBottom;
111 /// Variable implementing the Box interface
112 class VarBox: public Variable, public Box, public Subject<VarBox>
115 VarBox( intf_thread_t *pIntf, int width = 0, int height = 0 );
119 /// Get the variable type
120 virtual const string &getType() const { return m_type; }
122 /// Get the size of the box
123 virtual int getWidth() const;
124 virtual int getHeight() const;
126 /// Change the size of the box
127 void setSize( int width, int height );
131 static const string m_type;
133 int m_width, m_height;