1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is Mozilla Communicator client code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Netscape Communications Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 1998
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Mats Palmgren <mats.palmgren@bredband.net>
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either of the GNU General Public License Version 2 or later (the "GPL"),
27 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 : #ifndef nsHTMLLegendElement_h___
39 : #define nsHTMLLegendElement_h___
40 :
41 : #include "nsIDOMHTMLLegendElement.h"
42 : #include "nsGenericHTMLElement.h"
43 :
44 : class nsHTMLLegendElement : public nsGenericHTMLElement,
45 : public nsIDOMHTMLLegendElement
46 : {
47 : public:
48 : nsHTMLLegendElement(already_AddRefed<nsINodeInfo> aNodeInfo);
49 : virtual ~nsHTMLLegendElement();
50 :
51 8233 : static nsHTMLLegendElement* FromContent(nsIContent *aContent)
52 : {
53 8233 : if (aContent->IsHTML(nsGkAtoms::legend)) {
54 0 : return static_cast<nsHTMLLegendElement*>(aContent);
55 : }
56 8233 : return nsnull;
57 : }
58 :
59 : // nsISupports
60 : NS_DECL_ISUPPORTS_INHERITED
61 :
62 : // nsIDOMNode
63 0 : NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
64 :
65 : // nsIDOMElement
66 0 : NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
67 :
68 : // nsIDOMHTMLLegendElement
69 : NS_DECL_NSIDOMHTMLLEGENDELEMENT
70 :
71 : // nsIDOMHTMLElement
72 0 : NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
73 0 : NS_SCRIPTABLE NS_IMETHOD Click() {
74 0 : return nsGenericHTMLElement::Click();
75 : }
76 0 : NS_SCRIPTABLE NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) {
77 0 : return nsGenericHTMLElement::GetTabIndex(aTabIndex);
78 : }
79 0 : NS_SCRIPTABLE NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) {
80 0 : return nsGenericHTMLElement::SetTabIndex(aTabIndex);
81 : }
82 : NS_SCRIPTABLE NS_IMETHOD Focus();
83 0 : NS_SCRIPTABLE NS_IMETHOD GetDraggable(bool* aDraggable) {
84 0 : return nsGenericHTMLElement::GetDraggable(aDraggable);
85 : }
86 0 : NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
87 0 : return nsGenericHTMLElement::GetInnerHTML(aInnerHTML);
88 : }
89 0 : NS_SCRIPTABLE NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
90 0 : return nsGenericHTMLElement::SetInnerHTML(aInnerHTML);
91 : }
92 :
93 : virtual void PerformAccesskey(bool aKeyCausesActivation,
94 : bool aIsTrustedEvent);
95 :
96 : // nsIContent
97 : virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
98 : nsIContent* aBindingParent,
99 : bool aCompileEventHandlers);
100 : virtual void UnbindFromTree(bool aDeep = true,
101 : bool aNullParent = true);
102 : virtual bool ParseAttribute(PRInt32 aNamespaceID,
103 : nsIAtom* aAttribute,
104 : const nsAString& aValue,
105 : nsAttrValue& aResult);
106 : virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
107 : PRInt32 aModType) const;
108 : nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
109 : const nsAString& aValue, bool aNotify)
110 : {
111 : return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify);
112 : }
113 : virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
114 : nsIAtom* aPrefix, const nsAString& aValue,
115 : bool aNotify);
116 : virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
117 : bool aNotify);
118 :
119 : virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
120 :
121 0 : mozilla::dom::Element *GetFormElement()
122 : {
123 0 : nsCOMPtr<nsIFormControl> fieldsetControl = do_QueryInterface(GetFieldSet());
124 :
125 0 : return fieldsetControl ? fieldsetControl->GetFormElement() : nsnull;
126 : }
127 :
128 : virtual nsXPCClassInfo* GetClassInfo();
129 : protected:
130 : /**
131 : * Get the fieldset content element that contains this legend.
132 : * Returns null if there is no fieldset containing this legend.
133 : */
134 : nsIContent* GetFieldSet();
135 : };
136 :
137 : #endif /* nsHTMLLegendElement_h___ */
|