libRocket
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Include
Rocket
Core
ElementDocument.h
Go to the documentation of this file.
1
/*
2
* This source file is part of libRocket, the HTML/CSS Interface Middleware
3
*
4
* For the latest information, see http://www.librocket.com
5
*
6
* Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
7
*
8
* Permission is hereby granted, free of charge, to any person obtaining a copy
9
* of this software and associated documentation files (the "Software"), to deal
10
* in the Software without restriction, including without limitation the rights
11
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
* copies of the Software, and to permit persons to whom the Software is
13
* furnished to do so, subject to the following conditions:
14
*
15
* The above copyright notice and this permission notice shall be included in
16
* all copies or substantial portions of the Software.
17
*
18
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
* THE SOFTWARE.
25
*
26
*/
27
28
#ifndef ROCKETCOREELEMENTDOCUMENT_H
29
#define ROCKETCOREELEMENTDOCUMENT_H
30
31
#include "
Element.h
"
32
33
namespace
Rocket
{
34
namespace
Core {
35
36
class
Stream;
37
38
}
39
}
40
41
namespace
Rocket
{
42
namespace
Core {
43
44
class
Context;
45
class
DocumentHeader;
46
class
ElementText;
47
class
StyleSheet;
48
55
class
ROCKETCORE_API
ElementDocument
:
public
Element
56
{
57
public
:
58
ElementDocument
(
const
String
& tag);
59
virtual
~
ElementDocument
();
60
62
void
ProcessHeader(
const
DocumentHeader* header);
63
65
virtual
ElementDocument
* GetOwnerDocument();
66
69
Context
*
GetContext
();
70
73
void
SetTitle(
const
String
& title);
76
const
String
& GetTitle()
const
;
77
80
const
String
& GetSourceURL()
const
;
81
84
void
SetStyleSheet(
StyleSheet
* style_sheet);
87
virtual
StyleSheet
* GetStyleSheet()
const
;
88
90
void
PullToFront();
92
void
PushToBack();
93
97
enum
FocusFlags
98
{
99
NONE = 0,
100
FOCUS = (1 << 1),
101
MODAL = (1 << 2)
102
};
103
106
void
Show(
int
focus_flags = FOCUS);
108
void
Hide();
110
void
Close();
111
114
Element
* CreateElement(
const
String
& name);
117
ElementText
* CreateTextNode(
const
String
& text);
118
121
bool
IsModal()
const
;
122
127
virtual
void
LoadScript(
Stream
* stream,
const
String
& source_name);
128
130
inline
void
UpdateLayout
() {
if
(layout_dirty && lock_layout == 0) _UpdateLayout(); }
132
void
UpdatePosition();
133
135
void
LockLayout(
bool
lock);
136
137
protected
:
139
virtual
void
OnUpdate();
140
142
virtual
void
OnPropertyChange(
const
PropertyNameList
& changed_properties);
143
145
virtual
void
DirtyLayout();
146
148
virtual
bool
IsLayoutDirty();
149
151
virtual
void
ProcessEvent(
Event
& event);
152
153
private
:
154
// Find the next element to focus, starting at the current element
155
bool
FocusNextTabElement(
Element
* current_element,
bool
forward);
157
bool
SearchFocusSubtree(
Element
* element,
bool
forward);
158
159
// Title of the document
160
String
title;
161
162
// The original path this document came from
163
String
source_url;
164
165
// The document's style sheet.
166
StyleSheet
* style_sheet;
167
168
Context
* context;
169
170
// Is the current display modal
171
bool
modal;
172
173
// Is the layout dirty?
174
bool
layout_dirty;
175
int
lock_layout;
176
177
friend
class
Context
;
178
friend
class
Factory
;
179
180
void
_UpdateLayout();
181
};
182
183
}
184
}
185
186
#endif
ROCKETCORE_API
#define ROCKETCORE_API
Definition:
Header.h:73
Rocket::Core::ElementDocument
Definition:
ElementDocument.h:55
Rocket::Core::Event
Definition:
Event.h:48
Rocket::Core::ElementDocument::UpdateLayout
void UpdateLayout()
Updates the layout if necessary.
Definition:
ElementDocument.h:130
Rocket
Definition:
Clipboard.h:33
Rocket::Core::StyleSheet
Definition:
StyleSheet.h:50
Element.h
Rocket::Core::Context
Definition:
Context.h:62
Rocket::Core::PropertyNameList
std::set< String > PropertyNameList
Definition:
Types.h:92
Rocket::Core::GetContext
ROCKETCORE_API Context * GetContext(const String &name)
Rocket::Core::StringBase< char >
Rocket::Core::Stream
Definition:
Stream.h:47
Rocket::Core::ElementText
Definition:
ElementText.h:44
Rocket::Core::ElementDocument::FocusFlags
FocusFlags
Definition:
ElementDocument.h:97
Rocket::Core::Element
Definition:
Element.h:71
Rocket::Core::Factory
Definition:
Factory.h:63
Generated on Sat Sep 13 2014 04:42:37 for libRocket by
1.8.8