PageRenderTime 62ms CodeModel.GetById 41ms app.highlight 4ms RepoModel.GetById 16ms app.codeStats 0ms

/IZWebFileManager/CustomToolbarButton.cs

http://izwebfilemanager.googlecode.com/
C# | 95 lines | 64 code | 16 blank | 15 comment | 0 complexity | 815285f2279d2079631ea0438b0a7cbf 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.Diagnostics.CodeAnalysis;
22using System.ComponentModel;
23using System.Drawing.Design;
24
25namespace IZ.WebFileManager
26{
27	public sealed class CustomToolbarButton : IStateManager
28	{
29		readonly StateBag _bag = new StateBag ();
30
31		[SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
32		[Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
33		[DefaultValue ("")]
34		[UrlProperty]
35		public string ImageUrl {
36			get { return (string) (_bag ["ImageUrl"] ?? String.Empty); }
37			set { _bag ["ImageUrl"] = value; }
38		}
39
40		[DefaultValue ("")]
41		public string Text {
42			get { return (string) (_bag ["Text"] ?? String.Empty); }
43			set { _bag ["Text"] = value; }
44		}
45
46		[DefaultValue ("")]
47		public string CommandName {
48			get { return (string) (_bag ["CommandName"] ?? String.Empty); }
49			set { _bag ["CommandName"] = value; }
50		}
51
52		[DefaultValue ("")]
53		public string CommandArgument {
54			get { return (string) (_bag ["CommandArgument"] ?? String.Empty); }
55			set { _bag ["CommandArgument"] = value; }
56		}
57
58		[DefaultValue ("")]
59		public string OnClientClick {
60			get { return (string) (_bag ["OnClientClick"] ?? String.Empty); }
61			set { _bag ["OnClientClick"] = value; }
62		}
63
64		[DefaultValue (true)]
65		public bool PerformPostBack {
66			get { return (bool) (_bag ["PerformPostBack"] ?? true); }
67			set { _bag ["PerformPostBack"] = value; }
68		}
69
70		#region IStateManager Members
71
72		bool IStateManager.IsTrackingViewState {
73			get { return ((IStateManager) _bag).IsTrackingViewState; }
74		}
75
76		void IStateManager.LoadViewState (object state) {
77			((IStateManager) _bag).LoadViewState (state);
78		}
79
80		object IStateManager.SaveViewState () {
81			return ((IStateManager) _bag).SaveViewState ();
82		}
83
84		void IStateManager.TrackViewState () {
85			((IStateManager) _bag).TrackViewState ();
86		}
87
88		#endregion
89
90		internal void SetDirty () {
91			_bag.SetDirty (true);
92		}
93
94	}
95}