copying the latest Sys.Web.Services from trunk.
[mono.git] / mcs / class / System.Web / System.Web.UI / PostBackOptions.cs
1 //
2 // System.Web.UI.PostBackOptions.cs
3 //
4 // Authors:
5 //      Sanjay Gupta (gsanjay@novell.com)
6 //
7 // Copyright (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.
28 //
29
30 #if NET_2_0
31 using System;
32
33 namespace System.Web.UI
34 {
35         public sealed class PostBackOptions
36         {
37                 private Control control;
38                 private string argument;
39                 private string actionUrl;
40                 private bool autoPostBack;
41                 private bool requiresJavaScriptProtocol;
42                 private bool trackFocus;
43                 private bool clientSubmit;
44                 private bool performValidation;
45                 private string validationGroup;
46                 
47                 public PostBackOptions (Control control) : this (control, null, null, false, false, false, 
48                                                                 false, false, null)
49                 {
50                 }
51
52                 public PostBackOptions (Control control, string argument) : this (control, argument, null, false, 
53                                                                                 false, false, false, false, null)
54                 {
55                 }
56
57                 public PostBackOptions (Control control, string argument, string actionUrl, bool isAutoPostBack,
58                                         bool isJavaScriptProtocolRequired, bool isTrackFocus, bool isClientSubmit,
59                                         bool isValidationPerformed, string validatingGroup)
60                 {
61                         this.control = control;
62                         this.argument = argument;
63                         this.actionUrl = actionUrl;
64                         this.autoPostBack = isAutoPostBack;
65                         this.requiresJavaScriptProtocol = isJavaScriptProtocolRequired;
66                         this.trackFocus = isTrackFocus;
67                         this.clientSubmit = isClientSubmit;
68                         this.performValidation = isValidationPerformed;
69                         this.validationGroup = validatingGroup;
70                 }
71
72                 public string ActionUrl {
73                         get { return actionUrl; }
74                         set { actionUrl = value; }
75                 }
76
77                 public string Argument {
78                         get { return  argument; }
79                         set { argument = value; }
80                 }
81
82                 [MonoTODO ("Implement support for this in Page")]
83                 public bool AutoPostBack {
84                         get { return autoPostBack; }
85                         set { autoPostBack = value; }
86                 }
87
88                 public bool ClientSubmit {
89                         get { return clientSubmit; }
90                         set { clientSubmit = value; }
91                 }
92                 
93                 public bool PerformValidation {
94                         get { return performValidation; }
95                         set { performValidation = value; }
96                 }
97
98                 public bool RequiresJavaScriptProtocol {
99                         get { return requiresJavaScriptProtocol; }
100                         set { requiresJavaScriptProtocol = value; }
101                 }
102
103                 public Control TargetControl {
104                         get { return control; }
105                         set { control = value; }
106                 }
107
108                 [MonoTODO ("Implement support for this in Page")]
109                 public bool TrackFocus {
110                         get { return trackFocus; }
111                         set { trackFocus = value; }
112                 }
113
114                 [MonoTODO ("Implement support for this in Page")]
115                 public string ValidationGroup {
116                         get { return validationGroup; }
117                         set { validationGroup = value; }
118                 }
119                 
120                 // Returns true if some of these options must be handled by
121                 // client script.
122                 internal bool RequiresSpecialPostBack {
123                         get { 
124                                 return actionUrl != null || 
125                                                 validationGroup != null || 
126                                                 trackFocus || 
127                                                 autoPostBack || 
128                                                 argument != null;
129                         }
130                 }
131         }
132 }
133
134 #endif