2
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Library General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Library General Public License for more details.
14
* You should have received a copy of the GNU Library General Public License
15
* along with this library; see the file COPYING.LIB. If not, write to
16
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
* Boston, MA 02110-1301, USA.
21
#ifndef WMLInputElement_h
22
#define WMLInputElement_h
25
#include "WMLFormControlElement.h"
26
#include "InputElement.h"
32
class WMLInputElement : public WMLFormControlElement, public InputElement {
34
WMLInputElement(const QualifiedName& tagName, Document*);
35
virtual ~WMLInputElement();
37
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
38
virtual bool isMouseFocusable() const;
39
virtual void dispatchFocusEvent();
40
virtual void dispatchBlurEvent();
41
virtual void updateFocusAppearance(bool restorePreviousSelection);
42
virtual void aboutToUnload();
44
virtual bool shouldUseInputMethod() const { return !m_isPasswordField; }
45
virtual bool isChecked() const { return false; }
46
virtual bool isAutofilled() const { return false; }
47
virtual bool isIndeterminate() const { return false; }
48
virtual bool isTextFormControl() const { return true; }
49
virtual bool isRadioButton() const { return false; }
50
virtual bool isTextField() const { return true; }
51
virtual bool isSearchField() const { return false; }
52
virtual bool isInputTypeHidden() const { return false; }
53
virtual bool isPasswordField() const { return m_isPasswordField; }
54
virtual bool searchEventsShouldBeDispatched() const { return false; }
56
virtual int size() const;
57
virtual const AtomicString& formControlType() const;
58
virtual const AtomicString& formControlName() const;
59
virtual String value() const;
60
virtual void setValue(const String&);
61
virtual void setValueFromRenderer(const String&);
63
virtual bool saveFormControlState(String& value) const;
64
virtual void restoreFormControlState(const String&);
66
virtual void select();
67
virtual void accessKeyAction(bool sendToAnyElement);
68
virtual void parseMappedAttribute(MappedAttribute*);
70
virtual void copyNonAttributeProperties(const Element* source);
72
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
73
virtual void detach();
74
virtual bool appendFormData(FormDataList&, bool);
77
virtual void defaultEventHandler(Event*);
78
virtual void cacheSelection(int start, int end);
80
virtual String sanitizeValue(const String& proposedValue) const { return constrainValue(proposedValue); }
82
virtual void documentDidBecomeActive();
84
virtual void willMoveToNewOwnerDocument();
85
virtual void didMoveToNewOwnerDocument();
87
bool isConformedToInputMask(const String&);
88
bool isConformedToInputMask(UChar, unsigned, bool isUserInput = true);
91
friend class WMLCardElement;
94
String validateInputMask(const String&);
95
unsigned cursorPositionToMaskIndex(unsigned);
96
String constrainValue(const String&) const;
98
InputElementData m_data;
99
bool m_isPasswordField;
102
unsigned m_numOfCharsAllowedByMask;