|
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.Text; |
|
19 using System.Collections.Generic; |
|
20 using System.Drawing; |
|
21 |
|
22 namespace CrashItemLib.Crash.Base.DataBinding |
|
23 { |
|
24 [AttributeUsage( AttributeTargets.Method | AttributeTargets.Property )] |
|
25 public class CIDBAttributeCell : Attribute |
|
26 { |
|
27 #region Enumerations |
|
28 public enum TOptions |
|
29 { |
|
30 ENone = 0, |
|
31 EAutoExpand |
|
32 } |
|
33 #endregion |
|
34 |
|
35 #region Constructors |
|
36 public CIDBAttributeCell( TOptions aOptions ) |
|
37 { |
|
38 if ( aOptions == TOptions.ENone ) |
|
39 { |
|
40 throw new ArgumentException( "Options cannot be \'none\'" ); |
|
41 } |
|
42 |
|
43 iOptions = aOptions; |
|
44 } |
|
45 |
|
46 public CIDBAttributeCell( string aCaption, int aOrder ) |
|
47 : this( aCaption, aOrder, string.Empty ) |
|
48 { |
|
49 } |
|
50 |
|
51 public CIDBAttributeCell( string aCaption, int aOrder, object aDefaultValue ) |
|
52 : this( aCaption, aOrder, string.Empty, aDefaultValue ) |
|
53 { |
|
54 } |
|
55 |
|
56 public CIDBAttributeCell( string aCaption, int aOrder, string aFormat ) |
|
57 : this( aCaption, aOrder, aFormat, null ) |
|
58 { |
|
59 } |
|
60 |
|
61 public CIDBAttributeCell( string aCaption, int aOrder, string aFormat, object aDefaultValue ) |
|
62 { |
|
63 iCaption = aCaption; |
|
64 iOrder = aOrder; |
|
65 iFormat = aFormat; |
|
66 iDefaultValue = aDefaultValue; |
|
67 } |
|
68 |
|
69 public CIDBAttributeCell( string aCaption, int aOrder, Color aForeColor ) |
|
70 : this( aCaption, aOrder ) |
|
71 { |
|
72 iForeColor = aForeColor; |
|
73 } |
|
74 |
|
75 public CIDBAttributeCell( string aCaption, int aOrder, Color aForeColor, Color aBackColor ) |
|
76 : this( aCaption, aOrder, aForeColor ) |
|
77 { |
|
78 iBackColor = aBackColor; |
|
79 } |
|
80 #endregion |
|
81 |
|
82 #region API |
|
83 #endregion |
|
84 |
|
85 #region Properties |
|
86 public string Caption |
|
87 { |
|
88 get { return iCaption; } |
|
89 } |
|
90 |
|
91 public string Format |
|
92 { |
|
93 get { return iFormat; } |
|
94 } |
|
95 |
|
96 public int Order |
|
97 { |
|
98 get { return iOrder; } |
|
99 } |
|
100 |
|
101 public Color ForeColor |
|
102 { |
|
103 get { return iForeColor; } |
|
104 } |
|
105 |
|
106 public Color BackColor |
|
107 { |
|
108 get { return iBackColor; } |
|
109 } |
|
110 |
|
111 public object DefaultValue |
|
112 { |
|
113 get { return iDefaultValue; } |
|
114 } |
|
115 |
|
116 public TOptions Options |
|
117 { |
|
118 get { return iOptions; } |
|
119 } |
|
120 #endregion |
|
121 |
|
122 #region Data members |
|
123 private TOptions iOptions = TOptions.ENone; |
|
124 private readonly string iCaption; |
|
125 private readonly int iOrder; |
|
126 private readonly Color iForeColor; |
|
127 private readonly Color iBackColor; |
|
128 private readonly string iFormat; |
|
129 private readonly object iDefaultValue = null; |
|
130 #endregion |
|
131 } |
|
132 |
|
133 [AttributeUsage( AttributeTargets.Class, AllowMultiple=true ) ] |
|
134 public class CIDBAttributeColumn : Attribute |
|
135 { |
|
136 #region Constructors |
|
137 public CIDBAttributeColumn( string aCaption, int aOrder ) |
|
138 { |
|
139 iCaption = aCaption; |
|
140 iOrder = aOrder; |
|
141 } |
|
142 |
|
143 public CIDBAttributeColumn( string aCaption, int aOrder, int aWidth ) |
|
144 : this( aCaption, aOrder ) |
|
145 { |
|
146 iWidth = aWidth; |
|
147 |
|
148 // Apply width information |
|
149 iWidthSet = true; |
|
150 } |
|
151 |
|
152 public CIDBAttributeColumn( string aCaption, int aOrder, bool aTakesUpSlack ) |
|
153 : this( aCaption, aOrder, CIDBColumn.KDefaultWidth ) |
|
154 { |
|
155 iTakesUpSlack = aTakesUpSlack; |
|
156 |
|
157 // Don't apply width information |
|
158 iWidthSet = false; |
|
159 } |
|
160 #endregion |
|
161 |
|
162 #region API |
|
163 #endregion |
|
164 |
|
165 #region Properties |
|
166 public string Caption |
|
167 { |
|
168 get { return iCaption; } |
|
169 } |
|
170 |
|
171 public int Order |
|
172 { |
|
173 get { return iOrder; } |
|
174 } |
|
175 |
|
176 public bool WidthSet |
|
177 { |
|
178 get |
|
179 { |
|
180 return iWidthSet; |
|
181 } |
|
182 } |
|
183 |
|
184 public int Width |
|
185 { |
|
186 get { return iWidth; } |
|
187 } |
|
188 |
|
189 public bool TakesUpSlack |
|
190 { |
|
191 get { return iTakesUpSlack; } |
|
192 } |
|
193 #endregion |
|
194 |
|
195 #region Data members |
|
196 private readonly string iCaption; |
|
197 private readonly int iOrder; |
|
198 private readonly int iWidth; |
|
199 private readonly bool iWidthSet; |
|
200 private readonly bool iTakesUpSlack; |
|
201 #endregion |
|
202 } |
|
203 } |