~efargaspro/+junk/codeblocks-16.01-release

« back to all changes in this revision

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

  • Committer: damienlmoore at gmail
  • Date: 2016-02-02 02:43:22 UTC
  • Revision ID: damienlmoore@gmail.com-20160202024322-yql5qmtbwdyamdwd
Code::BlocksĀ 16.01

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: 8335 $
 
19
* $Id: wxsitemres.h 8335 2012-09-03 07:43:04Z ollydbg $
 
20
* $HeadURL: http://svn.code.sf.net/p/codeblocks/code/branches/release-16.xx/src/plugins/contrib/wxSmith/wxwidgets/wxsitemres.h $
 
21
*/
 
22
 
 
23
#ifndef WXSITEMRES_H
 
24
#define WXSITEMRES_H
 
25
 
 
26
#include "wxwidgetsres.h"
 
27
 
 
28
class wxsItemEditor;
 
29
class wxsItemResData;
 
30
 
 
31
/** \brief Some abstract interface allowing wxsItemResData to access some resource-specific functions easily */
 
32
class wxsItemResFunctions
 
33
{
 
34
    public:
 
35
 
 
36
        /** \brief Ctor */
 
37
        wxsItemResFunctions() {};
 
38
 
 
39
        /** \brief Dctor */
 
40
        virtual ~wxsItemResFunctions() {};
 
41
 
 
42
        /** \brief Generating exact preview used in editor after pressing preview button */
 
43
        virtual wxWindow* OnBuildExactPreview(wxWindow* Parent,wxsItemResData* Data) = 0;
 
44
};
 
45
 
 
46
/** \brief Base class for resources using item as root element
 
47
 *
 
48
 * This class implements most of functions in wxsResource and wxWidgetsRes,
 
49
 * only need to write this function: \code virtual wxString OnGetAppBuildingCode() \endcode
 
50
 */
 
51
class wxsItemRes: public wxWidgetsRes, public wxsItemResFunctions
 
52
{
 
53
    DECLARE_CLASS(wxsItemRes)
 
54
    public:
 
55
 
 
56
        /** \brief Available edit modes for item resources */
 
57
        enum EditMode { File, Source, Mixed };
 
58
 
 
59
        /** \brief Structure containing all arguments required when creating new resource */
 
60
        struct NewResourceParams
 
61
        {
 
62
            enum Scope
 
63
            {
 
64
                Public,
 
65
                Protected,
 
66
                Private
 
67
            };
 
68
 
 
69
            wxString Class;
 
70
            wxString Src;
 
71
            wxString Hdr;
 
72
            wxString Xrc;
 
73
            wxString Pch;
 
74
            wxString Wxs;
 
75
            wxString InitFunc;
 
76
            wxString BaseClass;
 
77
            wxString CustomCtorArgs;
 
78
            wxString PchGuard;
 
79
            bool GenSrc;
 
80
            bool GenHdr;
 
81
            bool GenXrc;
 
82
            bool UsePch;
 
83
            bool UseInitFunc;
 
84
            bool CtorParent;
 
85
            bool CtorParentDef;
 
86
            bool CtorId;
 
87
            bool CtorIdDef;
 
88
            bool CtorPos;
 
89
            bool CtorPosDef;
 
90
            bool CtorSize;
 
91
            bool CtorSizeDef;
 
92
            bool UseFwdDecl;
 
93
            bool UseI18n;
 
94
            Scope ScopeIds;
 
95
            Scope ScopeMembers;
 
96
            Scope ScopeHandlers;
 
97
 
 
98
            NewResourceParams():
 
99
                GenSrc(false), GenHdr(false), GenXrc(false), UsePch(false),
 
100
                UseInitFunc(false), CtorParent(false), CtorParentDef(false),
 
101
                CtorId(false), CtorIdDef(false), CtorPos(false), CtorPosDef(false),
 
102
                CtorSize(false), CtorSizeDef(false), UseFwdDecl(false), UseI18n(true),
 
103
                ScopeIds(Protected), ScopeMembers(Public), ScopeHandlers(Private)
 
104
            {}
 
105
        };
 
106
 
 
107
        /** \brief Ctor */
 
108
        wxsItemRes(wxsProject* Owner,const wxString& ResourceType,bool CanBeMain);
 
109
 
 
110
        /** \brief Ctor for external resource
 
111
         *  \param FileName name of XRC file
 
112
         *  \param Object Xml node with XRC resource
 
113
         */
 
114
        wxsItemRes(const wxString& FileName,const TiXmlElement* XrcElem,const wxString& ResourceType);
 
115
 
 
116
        /** \brief Dctor */
 
117
        virtual ~wxsItemRes();
 
118
 
 
119
        /** \brief Creating new resource and building files if necessarry */
 
120
        virtual bool CreateNewResource(NewResourceParams& Params);
 
121
 
 
122
        inline const wxString& GetWxsFileName() { return m_WxsFileName; }
 
123
        inline const wxString& GetSrcFileName() { return m_SrcFileName; }
 
124
        inline const wxString& GetHdrFileName() { return m_HdrFileName; }
 
125
        inline const wxString& GetXrcFileName() { return m_XrcFileName; }
 
126
 
 
127
        /** \brief Getting current edit mode */
 
128
        EditMode GetEditMode();
 
129
 
 
130
        /** \brief Building data object for this resource */
 
131
        wxsItemResData* BuildResData(wxsItemEditor* Editor);
 
132
 
 
133
    protected:
 
134
 
 
135
        virtual wxsEditor* OnCreateEditor(wxWindow* Parent);
 
136
        virtual bool OnReadConfig(const TiXmlElement* Node);
 
137
        virtual bool OnWriteConfig(TiXmlElement* Node);
 
138
        virtual bool OnCanHandleFile(const wxString& FileName);
 
139
        virtual wxString OnGetDeclarationFile();
 
140
        virtual bool OnGetUsingXRC();
 
141
        virtual bool OnGetCanBeMain();
 
142
        virtual void OnFillPopupMenu(wxMenu* Menu);
 
143
        virtual bool OnPopupMenu(long Id);
 
144
        virtual bool OnDeleteCleanup(bool ShowDialog);
 
145
 
 
146
    private:
 
147
 
 
148
        virtual int OnGetTreeIcon();
 
149
 
 
150
        wxString m_WxsFileName;
 
151
        wxString m_SrcFileName;
 
152
        wxString m_HdrFileName;
 
153
        wxString m_XrcFileName;
 
154
        bool     m_UseForwardDeclarations;
 
155
        bool     m_UseI18n;
 
156
        bool     m_CanBeMain;
 
157
};
 
158
 
 
159
#endif