Copied remotely
[mono.git] / mcs / class / System.Design / System.Web.UI.Design.WebControls / RegexEditorDialog.cs
1
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining
4 // a copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to
8 // permit persons to whom the Software is furnished to do so, subject to
9 // the following conditions:
10 // 
11 // The above copyright notice and this permission notice shall be
12 // included in all copies or substantial portions of the Software.
13 // 
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22 /**
23  * Namespace:   System.Web.UI.Design.WebControls
24  * Class:       RegexEditorDialog
25  *
26  * Author:      Gaurav Vaish
27  * Maintainer:  mastergaurav AT users DOT sf DOT net
28  *
29  * (C) Gaurav Vaish (2002)
30  */
31
32 using System;
33 using System.Drawing;
34 using System.ComponentModel;
35 using System.Windows.Forms;
36 using System.Windows.Forms.Design;
37
38 namespace System.Web.UI.Design.WebControls
39 {
40         public class RegexEditorDialog : Form
41         {
42                 private ISite     site;
43                 private Container components;
44                 private bool      isActivated;
45                 private bool      sVal;
46                 private string regularExpression = String.Empty;
47
48                 private Button   helpBtn;
49                 private Button   testValBtn;
50                 private Button   okBtn;
51                 private Button   cancelBtn;
52
53                 private Label    inputLabel;
54                 private Label    testResultsLabel;
55                 private Label    stdExprLabel;
56                 private Label    exprLabel;
57
58                 private ListBox  stdExprsList;
59
60                 private TextBox  exprText;
61                 private TextBox  sampleText;
62
63                 private GroupBox exprGrp;
64
65                 public RegexEditorDialog(ISite site) : base()
66                 {
67                         this.site        = site;
68                         this.isActivated = false;
69                         this.sVal        = false;
70
71                         InitializeComponents();
72                 }
73
74                 [MonoTODO]
75                 private void InitializeComponents()
76                 {
77                         components = new Container();
78
79                         helpBtn    = new Button();
80                         testValBtn = new Button();
81                         okBtn      = new Button();
82                         cancelBtn  = new Button();
83
84                         inputLabel       = new Label();
85                         testResultsLabel = new Label();
86                         stdExprLabel     = new Label();
87                         exprLabel        = new Label();
88
89                         stdExprsList = new ListBox();
90
91                         exprText   = new TextBox();
92                         sampleText = new TextBox();
93
94                         exprGrp = new GroupBox();
95
96                         System.Drawing.Font cFont = System.Windows.Forms.Control.DefaultFont;
97                         IUIService service = (IUIService)site.GetService(typeof(IUIService));
98                         if(service != null)
99                         {
100                                 cFont = (Font)(service.Styles["DialogFont"]);
101                         }
102                         throw new NotImplementedException();
103                 }
104
105                 public string RegularExpression
106                 {
107                         get
108                         {
109                                 return regularExpression;
110                         }
111                         set
112                         {
113                                 regularExpression = value;
114                         }
115                 }
116
117                 protected override void Dispose(bool disposing)
118                 {
119                         if(disposing)
120                         {
121                                 components.Dispose();
122                         }
123                         base.Dispose(disposing);
124                 }
125
126                 [MonoTODO]
127                 private object[] CannedExpressions
128                 {
129                         get
130                         {
131                                 throw new NotImplementedException();
132                         }
133                 }
134
135                 private class CannedExpression
136                 {
137                         public string Description;
138                         public string Expression;
139
140                         public CannedExpression(string description, string expression)
141                         {
142                                 Description = description;
143                                 Expression  = expression;
144                         }
145
146                         public override string ToString()
147                         {
148                                 return Description;
149                         }
150                 }
151         }
152 }