2
* Copyright (C) 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 WMLSelectElement_h
22
#define WMLSelectElement_h
25
#include "WMLFormControlElement.h"
26
#include "SelectElement.h"
30
class WMLSelectElement : public WMLFormControlElement, public SelectElement {
32
WMLSelectElement(const QualifiedName&, Document*);
33
virtual ~WMLSelectElement();
35
virtual const AtomicString& formControlName() const;
36
virtual const AtomicString& formControlType() const;
38
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
39
virtual bool isMouseFocusable() const;
40
virtual bool canSelectAll() const { return !m_data.usesMenuList(); }
41
virtual void selectAll();
43
virtual void recalcStyle(StyleChange);
45
virtual void dispatchFocusEvent();
46
virtual void dispatchBlurEvent();
48
virtual bool canStartSelection() const { return false; }
50
virtual int selectedIndex() const;
51
virtual void setSelectedIndex(int index, bool deselect = true);
52
virtual void setSelectedIndexByUser(int index, bool deselect = true, bool fireOnChangeNow = false);
54
virtual int size() const { return m_data.size(); }
55
virtual bool multiple() const { return m_data.multiple(); }
57
virtual bool saveFormControlState(String& value) const;
58
virtual void restoreFormControlState(const String&);
60
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
62
virtual void parseMappedAttribute(MappedAttribute*);
64
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
65
virtual bool appendFormData(FormDataList&, bool);
66
virtual int optionToListIndex(int optionIndex) const;
67
virtual int listToOptionIndex(int listIndex) const;
69
virtual const Vector<Element*>& listItems() const { return m_data.listItems(this); }
72
virtual void defaultEventHandler(Event*);
73
virtual void accessKeyAction(bool sendToAnyElement);
74
virtual void setActiveSelectionAnchorIndex(int index);
75
virtual void setActiveSelectionEndIndex(int index);
76
virtual void updateListBoxSelection(bool deselectOtherOptions);
77
virtual void listBoxOnChange();
78
virtual void menuListOnChange();
80
virtual int activeSelectionStartListIndex() const;
81
virtual int activeSelectionEndListIndex() const;
83
void accessKeySetSelectedIndex(int);
84
void setRecalcListItems();
85
void scrollToSelection();
86
void selectInitialOptions();
88
bool initialized() const { return m_initialized; }
91
virtual void insertedIntoTree(bool);
93
void calculateDefaultOptionIndices();
94
void selectDefaultOptions();
95
void initializeVariables();
96
void updateVariables();
98
Vector<unsigned> parseIndexValueString(const String&) const;
99
Vector<unsigned> valueStringToOptionIndices(const String&) const;
100
String optionIndicesToValueString() const;
101
String optionIndicesToString() const;
104
String value() const;
105
String iname() const;
106
String ivalue() const;
108
SelectElementData m_data;
110
Vector<unsigned> m_defaultOptionIndices;