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
|
#ifndef header_document
#define header_document
#ifdef WIN32
#pragma warning(disable : 4786)
#endif
#include <list>
#include <string>
#include <ClanLib/signals.h>
#include <ClanLib/GUI/gui_file_parser.h>
class ComponentNode;
class Document
{
//!Construction:
public:
//: Construct empty document.
Document();
//: Destructor.
~Document();
//!Attributes:
public:
// List of component nodes in document.
std::list<ComponentNode *> nodes;
//!Operations:
public:
//: New document. Clears the entire document for elements.
void clear();
//: Load document tree from a .gui definition file.
void load(const std::string &gui_file);
//: Save document tree to a .gui definition file.
void save(const std::string &gui_file);
//: Add component to document.
ComponentNode *add_node(const std::string &type);
//: Remove component from document.
void remove_node(ComponentNode *node);
//!Signals:
public:
//: Signal emitted when a node was added to the document.
CL_Signal_v1<ComponentNode *> sig_node_added;
//: Signal emitted when a node was removed from the document.
CL_Signal_v1<ComponentNode *> sig_node_removed;
//: Signal emitted when a node's component options was changed.
CL_Signal_v1<ComponentNode *> sig_node_options_changed;
//: Signal emitted when a node's type was changed.
CL_Signal_v1<ComponentNode *> sig_node_type_changed;
//!Implementation:
private:
void add_node_child(ComponentNode *parent, CL_GUIFileParser::ComponentInfo *info);
};
#endif
|