~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/xwt/Xwt/Xwt/IListDataSource.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// 
 
2
// IListViewSource.cs
 
3
//  
 
4
// Author:
 
5
//       Lluis Sanchez <lluis@xamarin.com>
 
6
//       Eric Maupin <ermau@xamarin.com>
 
7
// 
 
8
// Copyright (c) 2011-2012 Xamarin, Inc.
 
9
// 
 
10
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
11
// of this software and associated documentation files (the "Software"), to deal
 
12
// in the Software without restriction, including without limitation the rights
 
13
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
14
// copies of the Software, and to permit persons to whom the Software is
 
15
// furnished to do so, subject to the following conditions:
 
16
// 
 
17
// The above copyright notice and this permission notice shall be included in
 
18
// all copies or substantial portions of the Software.
 
19
// 
 
20
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
21
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
22
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
23
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
24
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
25
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
26
// THE SOFTWARE.
 
27
 
 
28
using System;
 
29
 
 
30
namespace Xwt
 
31
{
 
32
        public interface IListDataSource
 
33
        {
 
34
                /// <summary>
 
35
                /// Gets the number of rows in the data source.
 
36
                /// </summary>
 
37
                int RowCount { get; }
 
38
 
 
39
                /// <summary>
 
40
                /// Gets the value at the specified <paramref name="row"/> and <paramref name="column"/>.
 
41
                /// </summary>
 
42
                /// <param name="row">The row to retrieve the value from.</param>
 
43
                /// <param name="column">The column to retrieve the value from.</param>
 
44
                /// <returns>A reference to the value.</returns>
 
45
                /// <exception cref="ArgumentOutOfRangeException">
 
46
                /// <para><paramref name="row"/> is &gt;= <see cref="RowCount"/></para>
 
47
                /// <para>-- or --</para>
 
48
                /// <para><paramref name="column"/> is &gt;= the number of columns (<see cref="ColumnTypes"/>).</para>
 
49
                /// </exception>
 
50
                /// <seealso cref="SetValue"/>
 
51
                object GetValue (int row, int column);
 
52
 
 
53
                /// <summary>
 
54
                /// Sets the value at the specified <paramref name="row"/> and <paramref name="column"/>.
 
55
                /// </summary>
 
56
                /// <param name="row">The row to set the value at.</param>
 
57
                /// <param name="column">The column to set the value at.</param>
 
58
                /// <param name="value">The value to set at the given <paramref name="row"/> and <paramref name="column"/>.</param>
 
59
                /// <exception cref="ArgumentOutOfRangeException">
 
60
                /// <para><paramref name="row"/> is &gt;= <see cref="RowCount"/></para>
 
61
                /// <para>-- or --</para>
 
62
                /// <para><paramref name="column"/> is &gt;= the number of columns (<see cref="ColumnTypes"/>).</para>
 
63
                /// </exception>
 
64
                void SetValue (int row, int column, object value);
 
65
 
 
66
                /// <summary>
 
67
                /// Gets the column types of this data source.
 
68
                /// </summary>
 
69
                Type[] ColumnTypes { get; }
 
70
                
 
71
                /// <summary>
 
72
                /// Raised when a row is inserted into the data source.
 
73
                /// </summary>
 
74
                event EventHandler<ListRowEventArgs> RowInserted;
 
75
 
 
76
                /// <summary>
 
77
                /// Raised when a row is deleted from the data source.
 
78
                /// </summary>
 
79
                event EventHandler<ListRowEventArgs> RowDeleted;
 
80
 
 
81
                /// <summary>
 
82
                /// Raised when a column value of a row is changed in the data source.
 
83
                /// </summary>
 
84
                event EventHandler<ListRowEventArgs> RowChanged;
 
85
 
 
86
                /// <summary>
 
87
                /// Raised when rows in the data source is reordered.
 
88
                /// </summary>
 
89
                event EventHandler<ListRowOrderEventArgs> RowsReordered;
 
90
        }
 
91
        
 
92
        public class ListRowEventArgs: EventArgs
 
93
        {
 
94
                public ListRowEventArgs (int row)
 
95
                {
 
96
                        Row = row;
 
97
                }
 
98
                
 
99
                public int Row {
 
100
                        get;
 
101
                        private set;
 
102
                }
 
103
        }
 
104
        
 
105
        public class ListRowOrderEventArgs: ListRowEventArgs
 
106
        {
 
107
                public ListRowOrderEventArgs (int parentRow, int[] rows): base (parentRow)
 
108
                {
 
109
                        ChildrenOrder = rows;
 
110
                }
 
111
                
 
112
                public int[] ChildrenOrder {
 
113
                        get;
 
114
                        private set;
 
115
                }
 
116
        }
 
117
}
 
118