PageRenderTime 102ms CodeModel.GetById 60ms app.highlight 4ms RepoModel.GetById 36ms app.codeStats 0ms

/IZWebFileManager/CustomToolbarButtonCollection.cs

http://izwebfilemanager.googlecode.com/
C# | 77 lines | 48 code | 14 blank | 15 comment | 2 complexity | 968d27b039575ce8f15069b608db4587 MD5 | raw file
 1// Copyright (C) 2008 Igor Zelmanovich <izwebfilemanager@gmail.com>
 2//
 3// This program is free software; you can redistribute it and/or modify
 4// it under the terms of the GNU General Public License as published by
 5// the Free Software Foundation; either version 2 of the License, or
 6// (at your option) any later version.
 7//
 8// This program is distributed in the hope that it will be useful,
 9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
17using System;
18using System.Collections.Generic;
19using System.Text;
20using System.Web.UI;
21using System.Collections;
22
23namespace IZ.WebFileManager
24{
25	public sealed class CustomToolbarButtonCollection : StateManagedCollection
26	{
27		private static readonly Type [] _knownTypes = new Type [] { typeof (CustomToolbarButton) };
28
29		public CustomToolbarButton this [int i] {
30			get { return (CustomToolbarButton) ((IList) this) [i]; }
31			set { ((IList) this) [i] = value; }
32		}
33
34		public int Add (CustomToolbarButton button) {
35			return ((IList) this).Add (button);
36		}
37
38		public bool Contains (CustomToolbarButton button) {
39			return ((IList) this).Contains (button);
40		}
41
42		public void CopyTo (CustomToolbarButton [] buttonArray, int index) {
43			base.CopyTo (buttonArray, index);
44		}
45
46		public int IndexOf (CustomToolbarButton button) {
47			return ((IList) this).IndexOf (button);
48		}
49
50		public void Insert (int index, CustomToolbarButton button) {
51			((IList) this).Insert (index, button);
52		}
53
54		public void Remove (CustomToolbarButton button) {
55			((IList) this).Remove (button);
56		}
57
58		public void RemoveAt (int index) {
59			((IList) this).RemoveAt (index);
60		}
61
62		protected override object CreateKnownType (int index) {
63			if (index != 0)
64				throw new ArgumentOutOfRangeException ("Unknown Type");
65
66			return new CustomToolbarButton ();
67		}
68
69		protected override Type [] GetKnownTypes () {
70			return _knownTypes;
71		}
72
73		protected override void SetDirtyObject (object o) {
74			((CustomToolbarButton) o).SetDirty ();
75		}
76	}
77}