]> git.saurik.com Git - iphone-api.git/blob - WebCore/HTMLTextAreaElement.h
Add support for new WinterBoard Settings features.
[iphone-api.git] / WebCore / HTMLTextAreaElement.h
1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 *
22 */
23
24 #ifndef HTMLTextAreaElement_h
25 #define HTMLTextAreaElement_h
26
27 #include "HTMLFormControlElement.h"
28
29 namespace WebCore {
30
31 class Selection;
32
33 class HTMLTextAreaElement : public HTMLFormControlElementWithState {
34 public:
35 HTMLTextAreaElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
36
37 virtual bool checkDTD(const Node* newChild) { return newChild->isTextNode(); }
38
39 int cols() const { return m_cols; }
40 int rows() const { return m_rows; }
41
42 bool shouldWrapText() const { return m_wrap != NoWrap; }
43
44 virtual bool isEnumeratable() const { return true; }
45
46 virtual const AtomicString& type() const;
47
48 virtual bool saveState(String& value) const;
49 virtual void restoreState(const String&);
50
51 bool readOnly() const { return isReadOnlyControl(); }
52
53 virtual bool isTextControl() const { return true; }
54
55 int selectionStart();
56 int selectionEnd();
57
58 void setSelectionStart(int);
59 void setSelectionEnd(int);
60
61 void select();
62 void setSelectionRange(int, int);
63
64 virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
65 virtual void parseMappedAttribute(MappedAttribute*);
66 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
67 virtual bool appendFormData(FormDataList&, bool);
68 virtual void reset();
69 virtual void defaultEventHandler(Event*);
70 virtual bool isMouseFocusable() const;
71 virtual bool isKeyboardFocusable(KeyboardEvent*) const;
72 virtual void updateFocusAppearance(bool restorePreviousSelection);
73
74 String value() const;
75 void setValue(const String&);
76 String defaultValue() const;
77 void setDefaultValue(const String&);
78
79 void rendererWillBeDestroyed();
80
81 virtual void accessKeyAction(bool sendToAnyElement);
82
83 const AtomicString& accessKey() const;
84 void setAccessKey(const String&);
85
86 void setCols(int);
87 void setRows(int);
88
89 void cacheSelection(int s, int e) { m_cachedSelectionStart = s; m_cachedSelectionEnd = e; };
90 Selection selection() const;
91
92 virtual bool willRespondToMouseClickEvents();
93
94 virtual bool shouldUseInputMethod() const;
95
96 private:
97 enum WrapMethod { NoWrap, SoftWrap, HardWrap };
98
99 void updateValue() const;
100
101 int m_rows;
102 int m_cols;
103 WrapMethod m_wrap;
104 mutable String m_value;
105 int m_cachedSelectionStart;
106 int m_cachedSelectionEnd;
107 };
108
109 } //namespace
110
111 #endif