View | Details | Raw Unified | Return to bug 455950
Collapse All | Expand All

(-)ToolBar.cs (+51 lines)
Lines 1110-1115 Link Here
1110
			private bool redraw;    // Flag if needs to redraw after add/remove operations
1110
			private bool redraw;    // Flag if needs to redraw after add/remove operations
1111
			#endregion
1111
			#endregion
1112
1112
1113
			#region UIA Framework Events
1114
#if NET_2_0
1115
			static object UIACollectionChangedEvent = new object ();
1116
			
1117
			internal event CollectionChangeEventHandler UIACollectionChanged {
1118
				add { owner.Events.AddHandler (UIACollectionChangedEvent, value); }
1119
				remove { owner.Events.RemoveHandler (UIACollectionChangedEvent, value); }
1120
			}
1121
1122
			internal void OnUIACollectionChanged (CollectionChangeEventArgs e)
1123
			{
1124
				CollectionChangeEventHandler eh
1125
					= (CollectionChangeEventHandler) owner.Events [UIACollectionChangedEvent];
1126
				if (eh != null)
1127
					eh (owner, e);
1128
			}
1129
#endif
1130
			#endregion
1131
1113
			#region constructors
1132
			#region constructors
1114
			public ToolBarButtonCollection (ToolBar owner)
1133
			public ToolBarButtonCollection (ToolBar owner)
1115
			{
1134
			{
Lines 1132-1140 Link Here
1132
			public virtual ToolBarButton this [int index] {
1151
			public virtual ToolBarButton this [int index] {
1133
				get { return (ToolBarButton) list [index]; }
1152
				get { return (ToolBarButton) list [index]; }
1134
				set {
1153
				set {
1154
#if NET_2_0
1155
					// UIA Framework Event: Button Removed
1156
					OnUIACollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Remove, index));
1157
#endif
1158
1135
					value.SetParent (owner);
1159
					value.SetParent (owner);
1136
					list [index] = value;
1160
					list [index] = value;
1137
					owner.Redraw (true);
1161
					owner.Redraw (true);
1162
1163
#if NET_2_0
1164
1165
				// UIA Framework Event: Button Added
1166
				OnUIACollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Add, index));
1167
#endif
1138
				}
1168
				}
1139
			}
1169
			}
1140
1170
Lines 1189-1194 Link Here
1189
				result = list.Add (button);
1219
				result = list.Add (button);
1190
				if (redraw)
1220
				if (redraw)
1191
					owner.Redraw (true);
1221
					owner.Redraw (true);
1222
1223
#if NET_2_0
1224
				// UIA Framework Event: Button Added
1225
				OnUIACollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Add, result));
1226
#endif
1227
1192
				return result;
1228
				return result;
1193
			}
1229
			}
1194
1230
Lines 1209-1214 Link Here
1209
			{
1245
			{
1210
				list.Clear ();
1246
				list.Clear ();
1211
				owner.Redraw (false);
1247
				owner.Redraw (false);
1248
1249
#if NET_2_0
1250
				// UIA Framework Event: Button Cleared
1251
				OnUIACollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Refresh, -1));
1252
#endif
1212
			}
1253
			}
1213
1254
1214
			public bool Contains (ToolBarButton button)
1255
			public bool Contains (ToolBarButton button)
Lines 1294-1299 Link Here
1294
			{
1335
			{
1295
				list.Insert (index, button);
1336
				list.Insert (index, button);
1296
				owner.Redraw (true);
1337
				owner.Redraw (true);
1338
1339
#if NET_2_0
1340
				// UIA Framework Event: Button Added
1341
				OnUIACollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Add, index));
1342
#endif
1297
			}
1343
			}
1298
1344
1299
			public void Remove (ToolBarButton button)
1345
			public void Remove (ToolBarButton button)
Lines 1306-1311 Link Here
1306
			{
1352
			{
1307
				list.RemoveAt (index);
1353
				list.RemoveAt (index);
1308
				owner.Redraw (true);
1354
				owner.Redraw (true);
1355
1356
#if NET_2_0
1357
				// UIA Framework Event: Button Removed
1358
				OnUIACollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Remove, index));
1359
#endif
1309
			}
1360
			}
1310
1361
1311
#if NET_2_0
1362
#if NET_2_0

Return to bug 455950