|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 using System; |
|
18 using System.Drawing; |
|
19 |
|
20 namespace SymbianUtils.Graphics |
|
21 { |
|
22 public class SymRect |
|
23 { |
|
24 #region Constructors |
|
25 public SymRect() |
|
26 { |
|
27 } |
|
28 |
|
29 public SymRect( Rectangle aRect ) |
|
30 { |
|
31 iRectangle = aRect; |
|
32 } |
|
33 |
|
34 public SymRect( Point aTopleft, Size aSize ) |
|
35 { |
|
36 iRectangle = new Rectangle( aTopleft, aSize ); |
|
37 } |
|
38 #endregion |
|
39 |
|
40 #region API |
|
41 public void Inflate( int aDx, int aDy ) |
|
42 { |
|
43 iRectangle.Inflate( aDx, aDy ); |
|
44 } |
|
45 |
|
46 public void Offset( int aDx, int aDy ) |
|
47 { |
|
48 iRectangle.Offset( aDx, aDy ); |
|
49 } |
|
50 |
|
51 public void Offset( Size aSize ) |
|
52 { |
|
53 iRectangle.Offset( aSize.Width, aSize.Height ); |
|
54 } |
|
55 |
|
56 public void Offset( Point aPosition ) |
|
57 { |
|
58 iRectangle.Offset( aPosition.X, aPosition.Y ); |
|
59 } |
|
60 |
|
61 public void HalfOffset( Size aSize ) |
|
62 { |
|
63 Offset( aSize.Width / 2, aSize.Height / 2 ); |
|
64 } |
|
65 |
|
66 public void HalfOffset( Point aPosition ) |
|
67 { |
|
68 Offset( aPosition.X / 2, aPosition.Y / 2 ); |
|
69 } |
|
70 #endregion |
|
71 |
|
72 #region Properties |
|
73 public Rectangle Rectangle |
|
74 { |
|
75 get { return iRectangle; } |
|
76 set { iRectangle = value; } |
|
77 } |
|
78 |
|
79 public Size Size |
|
80 { |
|
81 get { return iRectangle.Size; } |
|
82 set { iRectangle.Size = value; } |
|
83 } |
|
84 |
|
85 public Point Location |
|
86 { |
|
87 get { return iRectangle.Location; } |
|
88 set { iRectangle.Location = value; } |
|
89 } |
|
90 |
|
91 public Point TopLeft |
|
92 { |
|
93 get { return iRectangle.Location; } |
|
94 } |
|
95 |
|
96 public Point TopRight |
|
97 { |
|
98 get { return new Point( iRectangle.Right, iRectangle.Top ); } |
|
99 } |
|
100 |
|
101 public Point BottomLeft |
|
102 { |
|
103 get { return new Point( iRectangle.Left, iRectangle.Bottom ); } |
|
104 } |
|
105 |
|
106 public Point BottomRight |
|
107 { |
|
108 get { return new Point( iRectangle.Right, iRectangle.Bottom ); } |
|
109 } |
|
110 |
|
111 public int Width |
|
112 { |
|
113 get { return iRectangle.Width; } |
|
114 } |
|
115 |
|
116 public int Height |
|
117 { |
|
118 get { return iRectangle.Height; } |
|
119 } |
|
120 |
|
121 public int Top |
|
122 { |
|
123 get { return iRectangle.Top; } |
|
124 } |
|
125 |
|
126 public int Bottom |
|
127 { |
|
128 get { return iRectangle.Bottom; } |
|
129 } |
|
130 |
|
131 public int Left |
|
132 { |
|
133 get { return iRectangle.Left; } |
|
134 } |
|
135 |
|
136 public int Right |
|
137 { |
|
138 get { return iRectangle.Right; } |
|
139 } |
|
140 #endregion |
|
141 |
|
142 #region Operators |
|
143 public static implicit operator Rectangle( SymRect aRect ) |
|
144 { |
|
145 return aRect.Rectangle; |
|
146 } |
|
147 |
|
148 public static implicit operator SymRect( Rectangle aRect ) |
|
149 { |
|
150 return new SymRect( aRect ); |
|
151 } |
|
152 #endregion |
|
153 |
|
154 #region Data members |
|
155 private Rectangle iRectangle = new Rectangle(); |
|
156 #endregion |
|
157 } |
|
158 } |