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.
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.
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.
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.
24 #ifndef HTMLTextAreaElement_h
25 #define HTMLTextAreaElement_h
27 #include "HTMLFormControlElement.h"
33 class HTMLTextAreaElement
: public HTMLFormControlElementWithState
{
35 HTMLTextAreaElement(const QualifiedName
&, Document
*, HTMLFormElement
* = 0);
37 virtual bool checkDTD(const Node
* newChild
) { return newChild
->isTextNode(); }
39 int cols() const { return m_cols
; }
40 int rows() const { return m_rows
; }
42 bool shouldWrapText() const { return m_wrap
!= NoWrap
; }
44 virtual bool isEnumeratable() const { return true; }
46 virtual const AtomicString
& type() const;
48 virtual bool saveState(String
& value
) const;
49 virtual void restoreState(const String
&);
51 bool readOnly() const { return isReadOnlyControl(); }
53 virtual bool isTextControl() const { return true; }
58 void setSelectionStart(int);
59 void setSelectionEnd(int);
62 void setSelectionRange(int, int);
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);
69 virtual void defaultEventHandler(Event
*);
70 virtual bool isMouseFocusable() const;
71 virtual bool isKeyboardFocusable(KeyboardEvent
*) const;
72 virtual void updateFocusAppearance(bool restorePreviousSelection
);
75 void setValue(const String
&);
76 String
defaultValue() const;
77 void setDefaultValue(const String
&);
79 void rendererWillBeDestroyed();
81 virtual void accessKeyAction(bool sendToAnyElement
);
83 const AtomicString
& accessKey() const;
84 void setAccessKey(const String
&);
89 void cacheSelection(int s
, int e
) { m_cachedSelectionStart
= s
; m_cachedSelectionEnd
= e
; };
90 Selection
selection() const;
92 virtual bool willRespondToMouseClickEvents();
94 virtual bool shouldUseInputMethod() const;
97 enum WrapMethod
{ NoWrap
, SoftWrap
, HardWrap
};
99 void updateValue() const;
104 mutable String m_value
;
105 int m_cachedSelectionStart
;
106 int m_cachedSelectionEnd
;