ElementDocument.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ROCKETCOREELEMENTDOCUMENT_H
00029 #define ROCKETCOREELEMENTDOCUMENT_H
00030
00031 #include <Rocket/Core/Element.h>
00032
00033 namespace Rocket {
00034 namespace Core {
00035
00036 class Stream;
00037
00038 }
00039 }
00040
00041 namespace Rocket {
00042 namespace Core {
00043
00044 class Context;
00045 class DocumentHeader;
00046 class ElementText;
00047 class StyleSheet;
00048
00055 class ROCKETCORE_API ElementDocument : public Element
00056 {
00057 public:
00058 ElementDocument(const String& tag);
00059 virtual ~ElementDocument();
00060
00062 void ProcessHeader(const DocumentHeader* header);
00063
00065 virtual ElementDocument* GetOwnerDocument();
00066
00069 Context* GetContext();
00070
00073 void SetTitle(String& title);
00076 const String& GetTitle() const;
00077
00080 const String& GetSourceURL() const;
00081
00084 void SetStyleSheet(StyleSheet* style_sheet);
00087 virtual StyleSheet* GetStyleSheet() const;
00088
00090 void PullToFront();
00092 void PushToBack();
00093
00097 enum FocusFlags
00098 {
00099 NONE = 0,
00100 FOCUS = (1 << 1),
00101 MODAL = (1 << 2)
00102 };
00103
00106 void Show(int focus_flags = FOCUS);
00108 void Hide();
00110 void Close();
00111
00114 Element* CreateElement(const String& name);
00117 ElementText* CreateTextNode(const String& text);
00118
00121 bool IsModal() const;
00122
00127 virtual void LoadScript(Stream* stream, const String& source_name);
00128
00130 virtual void UpdateLayout();
00132 void UpdatePosition();
00133
00134 protected:
00136 virtual void OnUpdate();
00137
00139 virtual void OnPropertyChange(const PropertyNameList& changed_properties);
00140
00142 virtual void DirtyLayout();
00143
00145 virtual void ProcessEvent(Event& event);
00146
00147 private:
00148
00149 bool FocusNextTabElement(Element* current_element, bool forward);
00151 bool SearchFocusSubtree(Element* element, bool forward);
00152
00153
00154 String title;
00155
00156
00157 String source_url;
00158
00159
00160 StyleSheet* style_sheet;
00161
00162 Context* context;
00163
00164
00165 bool modal;
00166
00167
00168 bool layout_dirty;
00169 bool lock_layout;
00170
00171 friend class Context;
00172 friend class Factory;
00173 };
00174
00175 }
00176 }
00177
00178 #endif