1 """
2 * Copyright 2007 Google Inc.
3 # Copyright (C) 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http:#www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 """
17
18
19
20
21 from FocusWidget import FocusWidget
22 from RichTextAreaImplStandard import RichTextAreaImplStandard
23
24
25 """*
26 * Font size enumeration. Represents the seven basic HTML font sizes, as
27 * defined in CSS.
28 """
30
31
34
35
36 """*
37 * Gets the HTML font number associated with this font size.
38 *
39 * @return an integer from 1 to 7 inclusive
40 """
43
45 return str(self.number)
46
47
48 """*
49 * Represents an XX-Small font.
50 """
51 XX_SMALL = FontSize(1)
52
53 """*
54 * Represents an X-Small font.
55 """
56 X_SMALL = FontSize(2)
57
58 """*
59 * Represents a Small font.
60 """
61 SMALL = FontSize(3)
62
63 """*
64 * Represents a Medium font.
65 """
66 MEDIUM = FontSize(4)
67
68 """*
69 * Represents a Large font.
70 """
71 LARGE = FontSize(5)
72
73 """*
74 * Represents an X-Large font.
75 """
76 X_LARGE = FontSize(6)
77
78 """*
79 * Represents an XX-Large font.
80 """
81 XX_LARGE = FontSize(7)
82
83 """*
84 * Justification enumeration. The three values are <code>left</code>,
85 * <code>right</code>, <code>center</code>.
86 """
88
91
93 return "Justify " + self.tag
94
95 """*
96 * Center justification.
97 """
98 CENTER = Justification("Center")
99
100 """*
101 * Left justification.
102 """
103 LEFT = Justification("Left")
104
105 """*
106 * Right justification.
107 """
108 RIGHT = Justification("Right")
109
110
111
112 """*
113 * A rich text editor that allows complex styling and formatting.
114 *
115 * Because some browsers do not support rich text editing, and others support
116 * only a limited subset of functionality, there are two formatter interfaces,
117 * accessed via {@link #getBasicFormatter()} and {@link #getExtendedFormatter()}.
118 * A browser that does not support rich text editing at all will return
119 * <code>None</code> for both of these, while one that supports only the basic
120 * functionality will return <code>None</code> for the latter.
121 *
122 * <p>
123 * <img class='gallery' src='RichTextArea.png'/>
124 * </p>
125 *
126 * <h3>CSS Style Rules</h3>
127 * <ul class="css">
128 * <li>.gwt-RichTextArea { }</li>
129 * </ul>
130 """
131 -class RichTextArea (FocusWidget) :
132
133
134 """*
135 * Creates a new, blank {@link RichTextArea} object with no stylesheet.
136 """
137 - def __init__(self, **kwargs):
138 if not kwargs.has_key('StyleName'): kwargs['StyleName']="gwt-RichTextArea"
139 self.impl = RichTextAreaImplStandard()
140 FocusWidget.__init__(self, self.impl.getElement(), **kwargs)
141
142
143
144 """*
145 * Gets the basic rich text formatting interface.
146 *
147 * @return <code>None</code> if basic formatting is not supported
148 """
154
155
156 """*
157 * Gets the full rich text formatting interface.
158 *
159 * @return <code>None</code> if full formatting is not supported
160 """
166
167
169 return self.impl.getHTML()
170
171
173 return self.impl.getText()
174
175
176 - def setFocus(self, focused):
177
178
179 if self.isAttached():
180 self.impl.setFocus(focused)
181
182
183
184 - def setHTML(self, html):
185 self.impl.setHTML(html)
186
187
188 - def setText(self, text):
189 self.impl.setText(text)
190
191
192 - def onAttach(self):
195
196
197 - def onDetach(self):
200
201
202
203
204