2000-07-25 14:47:21 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Purpose: XML resources editor
|
|
|
|
// Author: Vaclav Slavik
|
|
|
|
// Created: 2000/05/05
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 2000 Vaclav Slavik
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "nodehnd.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _NODEHND_H_
|
|
|
|
#define _NODEHND_H_
|
|
|
|
|
|
|
|
|
2000-07-27 05:35:16 -04:00
|
|
|
class WXDLLEXPORT wxXmlNode;
|
|
|
|
class WXDLLEXPORT wxList;
|
|
|
|
class WXDLLEXPORT wxListCtrl;
|
2000-07-25 14:47:21 -04:00
|
|
|
|
|
|
|
class EditorFrame;
|
|
|
|
|
|
|
|
#include "wx/treectrl.h"
|
|
|
|
#include "wx/xml/xml.h"
|
2000-11-04 18:34:33 -05:00
|
|
|
#include "nodesdb.h"
|
2000-07-25 14:47:21 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class NodeHandler : public wxObject
|
|
|
|
{
|
|
|
|
public:
|
2000-11-04 18:34:33 -05:00
|
|
|
static NodeHandler *Find(wxXmlNode *node);
|
2000-07-25 14:47:21 -04:00
|
|
|
|
2000-11-04 18:34:33 -05:00
|
|
|
NodeHandler(NodeInfo *ni);
|
2000-07-25 14:47:21 -04:00
|
|
|
virtual ~NodeHandler();
|
|
|
|
|
|
|
|
virtual bool CanHandle(wxXmlNode *node);
|
|
|
|
virtual wxTreeItemId CreateTreeNode(wxTreeCtrl *treectrl, wxTreeItemId parent,
|
|
|
|
wxXmlNode *node);
|
2000-11-04 18:34:33 -05:00
|
|
|
virtual PropertyInfoArray& GetPropsList(wxXmlNode *node);
|
2000-07-25 14:47:21 -04:00
|
|
|
virtual int GetTreeIcon(wxXmlNode * WXUNUSED(node)) {return m_NodeInfo->Icon;}
|
|
|
|
virtual wxString GetTreeString(wxXmlNode *node);
|
|
|
|
wxArrayString& GetChildTypes();
|
|
|
|
virtual void InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNode *insert_before = NULL);
|
|
|
|
virtual wxXmlNode *GetRealNode(wxXmlNode *node) { return node; }
|
|
|
|
|
|
|
|
protected:
|
2000-11-04 18:34:33 -05:00
|
|
|
|
2000-07-25 14:47:21 -04:00
|
|
|
NodeInfo *m_NodeInfo;
|
|
|
|
wxArrayString m_ChildTypes;
|
|
|
|
|
2000-11-04 18:34:33 -05:00
|
|
|
static wxList ms_Handlers;
|
|
|
|
static bool ms_HandlersLoaded;
|
2000-07-25 14:47:21 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// wxPanel handler
|
|
|
|
class NodeHandlerPanel : public NodeHandler
|
|
|
|
{
|
|
|
|
public:
|
2000-11-04 18:34:33 -05:00
|
|
|
NodeHandlerPanel(NodeInfo *ni) : NodeHandler(ni) {}
|
2000-07-25 14:47:21 -04:00
|
|
|
|
|
|
|
virtual wxTreeItemId CreateTreeNode(wxTreeCtrl *treectrl, wxTreeItemId parent,
|
|
|
|
wxXmlNode *node);
|
|
|
|
virtual void InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNode *insert_before = NULL);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// wxSizers handler
|
|
|
|
class NodeHandlerSizer : public NodeHandlerPanel
|
|
|
|
{
|
|
|
|
public:
|
2000-11-04 18:34:33 -05:00
|
|
|
NodeHandlerSizer(NodeInfo *ni) : NodeHandlerPanel(ni) {}
|
2000-07-25 14:47:21 -04:00
|
|
|
|
|
|
|
virtual void InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNode *insert_before = NULL);
|
|
|
|
virtual int GetTreeIcon(wxXmlNode *node);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// item of wxSizer handler
|
|
|
|
class NodeHandlerSizerItem : public NodeHandler
|
|
|
|
{
|
|
|
|
public:
|
2000-11-04 18:34:33 -05:00
|
|
|
NodeHandlerSizerItem(NodeInfo *ni) : NodeHandler(ni) {}
|
2000-07-25 14:47:21 -04:00
|
|
|
|
|
|
|
virtual wxTreeItemId CreateTreeNode(wxTreeCtrl *treectrl, wxTreeItemId parent,
|
|
|
|
wxXmlNode *node);
|
2000-11-04 18:34:33 -05:00
|
|
|
virtual PropertyInfoArray& GetPropsList(wxXmlNode *node);
|
2000-07-25 14:47:21 -04:00
|
|
|
virtual wxString GetTreeString(wxXmlNode *node);
|
|
|
|
virtual int GetTreeIcon(wxXmlNode *node);
|
|
|
|
virtual wxXmlNode *GetRealNode(wxXmlNode *node);
|
2000-11-04 18:34:33 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
PropertyInfoArray m_dummy;
|
2000-07-25 14:47:21 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-07-27 14:52:12 -04:00
|
|
|
// wxNotebook handler
|
|
|
|
class NodeHandlerNotebook : public NodeHandlerPanel
|
|
|
|
{
|
|
|
|
public:
|
2000-11-04 18:34:33 -05:00
|
|
|
NodeHandlerNotebook(NodeInfo *ni) : NodeHandlerPanel(ni) {}
|
2000-07-27 14:52:12 -04:00
|
|
|
|
|
|
|
virtual void InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNode *insert_before = NULL);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// notebook page handler
|
|
|
|
class NodeHandlerNotebookPage : public NodeHandlerSizerItem
|
|
|
|
{
|
|
|
|
public:
|
2000-11-04 18:34:33 -05:00
|
|
|
NodeHandlerNotebookPage(NodeInfo *ni) :
|
|
|
|
NodeHandlerSizerItem(ni) {}
|
2000-07-27 14:52:12 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-07-25 14:47:21 -04:00
|
|
|
// Generic handler which handles everything
|
|
|
|
class NodeHandlerUnknown : public NodeHandler
|
|
|
|
{
|
|
|
|
public:
|
2000-11-04 18:34:33 -05:00
|
|
|
NodeHandlerUnknown() : NodeHandler(new NodeInfo) {}
|
2000-07-25 14:47:21 -04:00
|
|
|
|
|
|
|
virtual bool CanHandle(wxXmlNode *node) { return TRUE; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|