Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 : #ifndef nsIForm_h___
7 : #define nsIForm_h___
8 :
9 : #include "nsISupports.h"
10 : #include "nsAString.h"
11 :
12 : class nsIFormControl;
13 :
14 : #define NS_FORM_METHOD_GET 0
15 : #define NS_FORM_METHOD_POST 1
16 : #define NS_FORM_ENCTYPE_URLENCODED 0
17 : #define NS_FORM_ENCTYPE_MULTIPART 1
18 : #define NS_FORM_ENCTYPE_TEXTPLAIN 2
19 :
20 : // IID for the nsIForm interface
21 : #define NS_IFORM_IID \
22 : { 0x5e8464c8, 0x015d, 0x4cf9, \
23 : { 0x92, 0xc9, 0xa6, 0xb3, 0x30, 0x8f, 0x60, 0x9d } }
24 :
25 : /**
26 : * This interface provides some methods that can be used to access the
27 : * guts of a form. It's being slowly phased out.
28 : */
29 :
30 0 : class nsIForm : public nsISupports
31 : {
32 : public:
33 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFORM_IID)
34 :
35 : /**
36 : * Get the element at a specified index position in form.elements
37 : *
38 : * @param aIndex the index
39 : * @param aElement the element at that index
40 : * @return NS_OK if there was an element at that position, -1 otherwise
41 : */
42 : NS_IMETHOD_(nsIFormControl*) GetElementAt(int32_t aIndex) const = 0;
43 :
44 : /**
45 : * Get the number of elements in form.elements
46 : *
47 : * @param aCount the number of elements
48 : * @return NS_OK if there was an element at that position, -1 otherwise
49 : */
50 : NS_IMETHOD_(uint32_t) GetElementCount() const = 0;
51 :
52 : /**
53 : * Get the index of the given control within form.elements.
54 : * @param aControl the control to find the index of
55 : * @param aIndex the index [OUT]
56 : */
57 : NS_IMETHOD_(int32_t) IndexOfControl(nsIFormControl* aControl) = 0;
58 :
59 : /**
60 : * Get the default submit element. If there's no default submit element,
61 : * return null.
62 : */
63 : NS_IMETHOD_(nsIFormControl*) GetDefaultSubmitElement() const = 0;
64 : };
65 :
66 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIForm, NS_IFORM_IID)
67 :
68 : #endif /* nsIForm_h___ */
|