X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e776786754b4a54f90873b0f1801ba50f79c2d90..e0aeebed0a3003f455e2bd7e962143faa1dde4c8:/utils/configtool/src/configtooldoc.h?ds=sidebyside diff --git a/utils/configtool/src/configtooldoc.h b/utils/configtool/src/configtooldoc.h index 4d069533b4..9a24ff694a 100644 --- a/utils/configtool/src/configtooldoc.h +++ b/utils/configtool/src/configtooldoc.h @@ -12,7 +12,7 @@ #ifndef _CT_CONFIGTOOLDOC_H_ #define _CT_CONFIGTOOLDOC_H_ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma interface "configtooldoc.cpp" #endif @@ -22,6 +22,7 @@ #include "configitem.h" class wxSimpleHtmlTag; +class ctConfiguration; /*! * ctConfigToolDoc @@ -38,9 +39,9 @@ public: virtual bool OnCreate(const wxString& path, long flags); virtual bool OnOpenDocument(const wxString& filename); virtual bool OnSaveDocument(const wxString& filename); - virtual bool OnNewDocument() { return TRUE; } + virtual bool OnNewDocument() { return true; } virtual bool OnCloseDocument() ; - virtual bool Save(); // Overridden only to correct bug in wxWindows, docview.cpp + virtual bool Save(); // Overridden only to correct bug in wxWidgets, docview.cpp //// Accessors @@ -112,6 +113,135 @@ protected: ctConfigItem* m_clipboardItem; }; +/*! + * ctConfiguration is a configuration or a place-holder node within the + * hierarchy of configurations. + */ + +class ctConfiguration: public wxObject +{ +public: + /// Ctor and dtor + ctConfiguration(ctConfiguration* parent, const wxString& name); + ctConfiguration(); + ~ctConfiguration(); + + /// Copy constructor. + ctConfiguration(const ctConfiguration& configuration) + { + (*this) = configuration; + } + +/// Operations + + /// Assignment operator. + void operator= (const ctConfiguration& configuration); + + /// Create a clone + ctConfiguration* Clone() + { + ctConfiguration* configuration = new ctConfiguration; + *configuration = *this; + return configuration; + } + + /// Create a clone of this and children + ctConfiguration* DeepClone(); + + /// Clear children + void Clear(); + + /// Add a child + void AddChild(ctConfiguration* config); + + /// Remove (but don't delete) a child + void RemoveChild(ctConfiguration* config); + + /// Find an item in this hierarchy + ctConfiguration* FindConfiguration(const wxString& name); + + /// Find the next sibling + ctConfiguration* FindNextSibling(); + + /// Find the previous sibling + ctConfiguration* FindPreviousSibling(); + + /// Detach: remove from parent, and remove tree items + void Detach(); + + /// Attach: insert before the given position + void Attach(ctConfiguration* parent, ctConfiguration* insertbefore); + + void DetachFromTree(); + +/// Accessors + + /// Returns the top-level item. + ctConfigItem* GetTopItem() const { return m_topItem; } + + /// Sets the top-level item. + void SetTopItem(ctConfigItem* item) { m_topItem = item; } + + /// Returns the name. + wxString GetName() const { return m_name; } + + /// Sets the name. + void SetName(const wxString& name ) { m_name = name; } + + /// Get description. + wxString GetDescription() const { return m_description; } + + /// Set description. + void SetDescription(const wxString& descr) { m_description = descr; } + + /// Set the tree item id + void SetTreeItem(wxTreeItemId id) { m_treeItemId = id; } + + // Get the type + wxTreeItemId GetTreeItemId() const { return m_treeItemId ; } + + /// Get the list of children + wxList& GetChildren() { return m_children; } + + /// Get the nth child + ctConfiguration* GetChild(int n) const; + + /// Get the child count + int GetChildCount() const; + + /// Get the parent + ctConfiguration* GetParent() const { return m_parent; } + + /// Set the parent + void SetParent(ctConfiguration* parent) { m_parent = parent; } + + /// Get the associated document (currently, assumes + /// there's only ever one document active) + ctConfigToolDoc* GetDocument() ; + +protected: + + /// The corresponding tree item + wxTreeItemId m_treeItemId; + + /// The list of children. + wxList m_children; + + /// The parent config item + ctConfiguration* m_parent; + + /// The name + wxString m_name; + + /// The description + wxString m_description; + + /// The top-level item of this description, if any + ctConfigItem* m_topItem; + +DECLARE_CLASS(ctConfiguration) +}; + /*! * Implements a document editing command. @@ -130,10 +260,10 @@ public: ctConfigCommand(const wxString& name, int cmdId, ctConfigItem* activeState, ctConfigItem* savedState, ctConfigItem* parent = NULL, ctConfigItem* insertBefore = NULL, - bool ignoreFirstTime = FALSE); + bool ignoreFirstTime = false); ctConfigCommand(const wxString& name, int cmdId, ctConfigItem* activeState, ctProperties* properties, - bool ignoreFirstTime = FALSE); + bool ignoreFirstTime = false); ~ctConfigCommand(); bool Do();