- Added ActiveMdiChild method
[mono.git] / mcs / class / System.Windows.Forms / Gtk / DataGridCell.cs
1 //
2 // System.Windows.Forms.DataGridCell.cs
3 //
4 // Author:
5 //   Dennis Hayes (dennish@raytek.com)
6 //
7 // (C) 2002 Ximian, Inc.  http://www.ximian.com
8 //
9
10 using System;
11
12 namespace System.Windows.Forms {
13         
14         public struct DataGridCell { 
15
16                 private int rownumber;
17                 private int columnnumber;
18
19                 // -----------------------
20                 // Public Constructor
21                 // -----------------------
22
23                 /// <summary>
24                 /// 
25                 /// </summary>
26                 ///
27                 /// <remarks>
28                 ///
29                 /// </remarks>
30                 
31                 public DataGridCell (int r, int c)
32                 {
33                         rownumber = r;
34                         columnnumber = c;
35                 }
36
37                 // -----------------------
38                 // Public Shared Members
39                 // -----------------------
40
41                 /// <remarks>
42                 ///     Compares two DataGridCell objects. The return value is
43                 ///     based on the equivalence of the RowNumber and ColumnNumber properties of the two objects.
44                 /// </remarks>
45
46                 public static bool operator == (DataGridCell dgc_a, 
47                         DataGridCell dgc_b) {
48
49                         return ((dgc_a.rownumber == dgc_b.rownumber) &&
50                                 (dgc_a.columnnumber == dgc_b.columnnumber));
51                 }
52                 
53                 /// <summary>
54                 ///     Inequality Operator
55                 /// </summary>
56                 ///
57                 /// <remarks>
58                 ///     Compares two DataGridCell objects. The return value is
59                 ///     based on the equivalence of the RowNumber and ColumnNumber properties of the two objects.
60                 /// </remarks>
61                 public static bool operator != (DataGridCell dgc_a, 
62                         DataGridCell dgc_b) {
63                         return ((dgc_a.rownumber != dgc_b.rownumber) ||
64                                 (dgc_a.columnnumber != dgc_b.columnnumber));
65                 }
66                 
67                 // -----------------------
68                 // Public Instance Members
69                 // -----------------------
70
71
72                 public int RowNumber {
73                         get{
74                                 return rownumber;
75                         }
76                         set{
77                                 rownumber = value;
78                         }
79                 }
80
81                 public int ColumeNumber {
82                         get{
83                                 return columnnumber;
84                         }
85                         set{
86                                 columnnumber = value;
87                         }
88                 }
89
90                 /// <summary>
91                 ///     Equals Method
92                 /// </summary>
93                 ///
94                 /// <remarks>
95                 ///     Checks equivalence of this DataGridCell and another object.
96                 /// </remarks>
97                 
98                 public override bool Equals (object obj)
99                 {
100                         if (!(obj is DataGridCell))
101                                 return false;
102
103                         return (this == (DataGridCell) obj);
104                 }
105
106                 /// <summary>
107                 ///     GetHashCode Method
108                 /// </summary>
109                 ///
110                 /// <remarks>
111                 ///     Calculates a hashing value.
112                 /// </remarks>
113                 
114                 public override int GetHashCode ()
115                 {
116                         return (int)( rownumber ^ columnnumber);
117                 }
118
119                 /// <summary>
120                 ///     ToString Method
121                 /// </summary>
122                 ///
123                 /// <remarks>
124                 ///     Formats the DataGridCell as a string.
125                 /// </remarks>
126                 
127                 public override string ToString ()
128                 {
129                         return String.Format ("[{0},{1}]", rownumber, columnnumber );
130                 }
131         }
132 }