~ubuntu-branches/ubuntu/hardy/codeblocks/hardy-backports

« back to all changes in this revision

Viewing changes to src/plugins/contrib/wxSmith/wxwidgets/wxsitemresdataobject.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Casadevall
  • Date: 2008-07-17 04:39:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080717043923-gmsy5cwkdjswghkm
Tags: upstream-8.02
ImportĀ upstreamĀ versionĀ 8.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* This file is part of wxSmith plugin for Code::Blocks Studio
 
3
* Copyright (C) 2006-2007  Bartlomiej Swiecki
 
4
*
 
5
* wxSmith is free software; you can redistribute it and/or modify
 
6
* it under the terms of the GNU General Public License as published by
 
7
* the Free Software Foundation; either version 3 of the License, or
 
8
* (at your option) any later version.
 
9
*
 
10
* wxSmith is distributed in the hope that it will be useful,
 
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
13
* GNU General Public License for more details.
 
14
*
 
15
* You should have received a copy of the GNU General Public License
 
16
* along with wxSmith. If not, see <http://www.gnu.org/licenses/>.
 
17
*
 
18
* $Revision: 4850 $
 
19
* $Id: wxsitemresdataobject.h 4850 2008-01-29 21:45:49Z byo $
 
20
* $HeadURL: svn://svn.berlios.de/codeblocks/tags/8.02/src/plugins/contrib/wxSmith/wxwidgets/wxsitemresdataobject.h $
 
21
*/
 
22
 
 
23
#ifndef WXSITEMRESDATAOBJECT_H
 
24
#define WXSITEMRESDATAOBJECT_H
 
25
 
 
26
#include <wx/dataobj.h>
 
27
#include <tinyxml/tinyxml.h>
 
28
 
 
29
#define wxsDF_WIDGET   _T("wxSmith XML")
 
30
 
 
31
class wxsItem;
 
32
class wxsItemResData;
 
33
 
 
34
/** \brief Class representing one or more items with resource structure using wxDataObject class */
 
35
class wxsItemResDataObject : public wxDataObject
 
36
{
 
37
        public:
 
38
 
 
39
        /** \brief Ctor */
 
40
                wxsItemResDataObject();
 
41
 
 
42
                /** \brief Dctor */
 
43
                virtual ~wxsItemResDataObject();
 
44
 
 
45
        //=====================================
 
46
        // Opertating on data
 
47
        //=====================================
 
48
 
 
49
        /** \brief Clering all data */
 
50
        void Clear();
 
51
 
 
52
                /** \brief Adding widget into this data object */
 
53
                bool AddItem(wxsItem* Item);
 
54
 
 
55
                /** \brief Getting number of handled widgets inside this object */
 
56
                int GetItemCount() const;
 
57
 
 
58
                /** \brief Building wxsItem class from this data object
 
59
                 *  \param Resource - resource owning item
 
60
                 *  \param Index - id of item (in range 0..GetWidgetCount()-1)
 
61
                 *  \return created item or 0 on error
 
62
                 */
 
63
                wxsItem* BuildItem(wxsItemResData* Data,int Index = 0) const;
 
64
 
 
65
                /** \brief Setting Xml string describing widget */
 
66
                bool SetXmlData(const wxString& Data);
 
67
 
 
68
                /** \brief Getting Xml strting desecribing widget */
 
69
                wxString GetXmlData() const;
 
70
 
 
71
        //=====================================
 
72
        // Members of wxDataObject class
 
73
        //=====================================
 
74
 
 
75
                /** \brief Enumerating all data formats.
 
76
                 *
 
77
                 * Formats available for reading and writing:
 
78
         * - wxDF_TEXT
 
79
         * - internal type ("wxSmith XML")
 
80
         */
 
81
                virtual void GetAllFormats(wxDataFormat *formats,Direction dir) const;
 
82
 
 
83
                /** \brief Copying data to raw buffer */
 
84
                virtual bool GetDataHere(const wxDataFormat& format,void *buf) const;
 
85
 
 
86
                /** \brief Returns number of data bytes */
 
87
                virtual size_t GetDataSize(const wxDataFormat& format) const;
 
88
 
 
89
                /** \brief Returns number of suported formats (in both cases - 2) */
 
90
                virtual size_t GetFormatCount(Direction dir) const;
 
91
 
 
92
                /** \brief Returning best format - "wxSmith XML" */
 
93
                virtual wxDataFormat GetPreferredFormat(Direction dir) const;
 
94
 
 
95
                /** \brief Setting data - will load Xml data */
 
96
                virtual bool SetData(const wxDataFormat& format,size_t len,const void *buf);
 
97
 
 
98
    private:
 
99
 
 
100
        TiXmlDocument m_XmlDoc;
 
101
        TiXmlElement* m_XmlElem;
 
102
        int m_ItemCount;
 
103
};
 
104
 
 
105
#endif