summaryrefslogtreecommitdiffstats
path: root/ksvg/dom/SVGWindow.h
blob: 2389286f9d2dfa9ff4abeba318ceb9f8526a0354 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
    Copyright (C) 2001-2003 KSVG Team
    This file is part of the KDE project

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#ifndef SVGWindow_H
#define SVGWindow_H

#include <dom/dom_string.h>
#include <dom/dom_node.h>
#include <dom/dom2_events.h>

namespace KSVG
{

class SVGDocument;
class SVGWindowImpl;

class SVGWindow 
{ 
public:
	SVGWindow();
	SVGWindow(const SVGWindow &other);
	SVGWindow &operator=(const SVGWindow &other);
	SVGWindow(SVGWindowImpl *other);
	virtual ~SVGWindow();

	//StyleSheet defaultStyleSheet() const;
	SVGDocument document() const;
	DOM::Event evt() const;

	/**
	 * @return Viewport height in pixels.
	 */
	long innerHeight() const;

	/**
	 * @return Viewport width in pixels.
	 */
	long innerWidth() const;

	void setSrc(const DOM::DOMString &src);

	/**
	 * @return The URI of the current document.
	 */
	DOM::DOMString src() const;

	void clearInterval(long interval);
	void clearTimeout(long timeout);

	/**
	 * Get data from the given URL using the HTTP GET method. Notify the callback when done.
	 *
	 * @param uri The URI reference for the data to be loaded.
	 * @param callback The method to be invoked when the data is available.
	 */
	void getURL(const DOM::DOMString &uri, const DOM::EventListener &callback);
	//DOM::DocumentFragment parseXML(const DOM::DOMString &source, const DOM::Document &document);
	void postURL(const DOM::DOMString &uri, const DOM::DOMString &data, const DOM::EventListener &callback, const DOM::DOMString &mimeType, const DOM::DOMString &contentEncoding);

	/**
	 * Converts a Node into a DOMString. The string is an XML representation of the Node.
	 *
	 * @param node The Node to be converted.
	 * @return Converts a Node into a DOMString. The string is an XML representation of the Node.
	 */
	DOM::DOMString printNode(const DOM::Node &node);
	long setInterval(const DOM::DOMString &code, const long &delay);
	long setTimeout(const DOM::DOMString &code, const long &delay);

	/**
	 * Displays a modal synchronous message to the user if possible in the current user environment.
	 * Commonly, this message takes the form of a pop-up window with a single dispose button.
	 *
	 * @param message The message to be displayed.
	 */
	void alert(const DOM::DOMString &message);

	/**
	 * Displays a modal synchronous message to the user if possible in the current user environment.
	 * The user is able to accept or reject the message. Commonly, this message takes the form of
	 * a pop-up window with either a Yes/No or OK/Cancel button pair.
	 *
	 * @param message The message to be displayed.
	 * @return A boolean indicating the user's response. True for accept, False for reject.
	 */
	bool confirm(const DOM::DOMString &message);

	/**
	 * Displays a modal synchronous message to the user if possible in the current user environment.
	 * The user is able to enter a response to the message. Commonly, this message takes the form of
	 * a pop-up window with a single text entry field.
	 *
	 * @param message The message to be displayed.
	 * @param _default The default response to suggest to the user. This can be displayed in the text field and be modified by the user.
	 * @return A boolean indicating the user's response. True for accept, False for reject.
	 */
	DOM::DOMString prompt(const DOM::DOMString &message, const DOM::DOMString &_default);

	// Internal! - NOT PART OF THE SVG SPECIFICATION
	SVGWindowImpl *handle() const { return impl; }

private:
	SVGWindowImpl *impl;
};

}

#endif

// vim:ts=4:noet