2010-03-02 Jb Evain <jbevain@novell.com>
[mcs.git] / class / System.Web / System.Web.UI.WebControls.WebParts / WebPartVerb.cs
blobae6906daeb5ceff5f5f47749813066d8c6941f49
1 //
2 // System.Web.UI.WebControls.WebParts.WebPartVerb.cs
3 //
4 // Authors:
5 // Sanjay Gupta (gsanjay@novell.com)
6 //
7 // (C) 2004 Novell, Inc (http://www.novell.com)
8 //
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
17 //
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
20 //
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 #if NET_2_0
32 using System.Web;
33 using System.Web.UI;
34 using System.ComponentModel;
35 using System;
37 namespace System.Web.UI.WebControls.WebParts
39 [TypeConverterAttribute ("System.Web.UI.WebControls.WebParts.WebPartVerbConverter, System.Web")]
40 public class WebPartVerb : IStateManager
42 string clientClickHandler;
43 WebPartEventHandler serverClickHandler;
44 StateBag stateBag;
45 bool isChecked = false;
46 string description = string.Empty;
47 bool enabled = true;
48 string imageUrl = string.Empty;
49 string text = string.Empty;
50 bool visible = true;
51 string id;
53 public string ID {
54 get { return id;}
57 public WebPartVerb (string id, string clientHandler) {
58 this.id = id;
59 this.clientClickHandler = clientHandler;
60 stateBag = new StateBag ();
61 stateBag.Add ("clientClickHandler", clientHandler);
65 public WebPartVerb (string id, WebPartEventHandler serverClickHandler) {
66 this.id = id;
67 this.serverClickHandler = serverClickHandler;
68 stateBag = new StateBag ();
69 stateBag.Add ("serverClickHandler", serverClickHandler);
72 public WebPartVerb (string id, WebPartEventHandler serverClickHandler, string clientClickHandler) {
73 this.id = id;
74 this.serverClickHandler = serverClickHandler;
75 this.clientClickHandler = clientClickHandler;
76 stateBag = new StateBag ();
77 stateBag.Add ("serverClickHandler", serverClickHandler);
78 stateBag.Add ("clientClickHandler", clientClickHandler);
81 [MonoTODO("Not implemented")]
82 protected virtual void LoadViewState (object savedState)
84 throw new NotImplementedException ();
87 [MonoTODO("Not implemented")]
88 protected virtual object SaveViewState()
90 throw new NotImplementedException ();
93 [MonoTODO("Not implemented")]
94 protected virtual void TrackViewState()
96 throw new NotImplementedException();
99 [MonoTODO("Not implemented")]
100 void IStateManager.LoadViewState (object savedState)
102 throw new NotImplementedException ();
105 [MonoTODO("Not implemented")]
106 object IStateManager.SaveViewState ()
108 throw new NotImplementedException ();
111 [MonoTODO("Not implemented")]
112 void IStateManager.TrackViewState ()
114 throw new NotImplementedException ();
117 [MonoTODO("Not implemented")]
118 bool IStateManager.IsTrackingViewState {
119 get {
120 throw new NotImplementedException ();
124 [WebSysDescriptionAttribute ("Denotes verb is checked or not."),
125 DefaultValueAttribute (false),
126 NotifyParentPropertyAttribute (true) ]
127 public virtual bool Checked {
128 get { return isChecked; }
129 set { isChecked = value; }
132 [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden),
133 BrowsableAttribute (false)]
134 public string ClientClickHandler {
135 get { return clientClickHandler; }
138 [LocalizableAttribute (true),
139 WebSysDescriptionAttribute ("Gives descriptive information about the verb"),
140 NotifyParentPropertyAttribute (true)]
141 //WebSysDefaultValueAttribute (string.Empty)]
142 public virtual string Description {
143 get { return description; }
144 set { description = value; }
147 [NotifyParentPropertyAttribute (true),
148 DefaultValueAttribute (true),
149 WebSysDescriptionAttribute ("Determines whether verb is enabled.")]
150 public virtual bool Enabled {
151 get { return enabled; }
152 set { enabled = value; }
155 [WebSysDescriptionAttribute ("Denotes URL of the image to be displayed for the verb"),
156 EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design",
157 "UITypeEditor, System.Drawing"),
158 LocalizableAttribute (true), NotifyParentPropertyAttribute (true)]
159 //UrlPropertyAttribute, DefaultValueAttribute (String.Empty)
160 public string ImageUrl {
161 get { return imageUrl; }
162 set { imageUrl = value; }
165 protected virtual bool IsTrackingViewState {
166 get { throw new NotImplementedException (); }
169 [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden),
170 BrowsableAttribute (false)]
171 public WebPartEventHandler ServerClickHandler
173 get { return serverClickHandler; }
176 [WebSysDescriptionAttribute ("Denotes text to be displayed for the verb"),
177 LocalizableAttribute (true), NotifyParentPropertyAttribute (true)]
178 //DefaultValueAttribute (String.Empty)
179 public virtual string Text
181 get { return text; }
182 set { text = value; }
185 protected StateBag ViewState {
186 get { return stateBag; }
189 [DefaultValueAttribute (true),
190 WebSysDescriptionAttribute ("Denotes whether the verb is visible"),
191 LocalizableAttribute (true), NotifyParentPropertyAttribute (true)]
192 public bool Visible
194 get { return visible; }
195 set { visible = value; }
199 #endif