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: 8704 $
19 * $Id: wxscontainer.h 8704 2012-12-23 20:32:03Z mortenmacfly $
20 * $HeadURL: svn://svn.code.sf.net/p/codeblocks/code/branches/release-20.xx/src/plugins/contrib/wxSmith/wxwidgets/wxscontainer.h $
21 */
22 
23 #ifndef WXSCONTAINER_H
24 #define WXSCONTAINER_H
25 
26 #include "wxsparent.h"
27 #include "wxsstyle.h"
28 #include "wxsbaseproperties.h"
29 #include "wxsflags.h"
30 
31 #include <prep.h>
32 
33 using namespace wxsFlags;
34 
35 /** \brief Container is a class which represents widget that can
36  *         have child items or one of root items
37  */
38 class wxsContainer: public wxsParent
39 {
40     public:
41 
42         /** \brief Ctor
43          *  \param Data data management object handling this item
44          *  \param Info pointer to static widget info
45          *  \param EventArray pointer to static set of events
46          *  \param StyleSet set of used styles, if 0, this widget won't
47          *         provide styles by default
48          *  \param PropertiesFlags flags filtering set base properties
49          *         (see wxsBaseProperties for details)
50          */
51         wxsContainer(
52             wxsItemResData* Data,
53             const wxsItemInfo* Info,
54             const wxsEventDesc* EventArray = 0,
55             const wxsStyleSet* StyleSet=0,
56             long PropertiesFlags=flContainer);
57 
58     protected:
59 
60         /** \brief Function enumerating properties for this container only
61          *
62          * This function should enumerate all extra properties
63          * required by item (extra means not enumerated in base properties,
64          * not id or variable name).
65          * These properties will be placed at the beginning, right after
66          * there will be Variable name and identifier and at the end, all
67          * required base properties.
68          */
69         virtual void OnEnumContainerProperties(long Flags) = 0;
70 
71         /** \brief Function which adds new items to QPP
72          *
73          * This function may be used to add special quick properties for
74          * this item.
75          *
76          * All QPPChild panels will be added before additional panels
77          * added by widget.
78          */
OnAddContainerQPP(cb_unused wxsAdvQPP * QPP)79         virtual void OnAddContainerQPP(cb_unused wxsAdvQPP* QPP) { }
80 
81         /** \brief Checking if can add child item
82          *
83          * This function is by default implemented inside wxsContainer.
84          * In case of some limitations made for children (like inside
85          * wxSplitterWindow), this function should be overridden
86          * to avoid invalidating item.
87          *
88          * Default implementation matches few rules:
89          *  - spacer item can be added into sizers only
90          *  - sizer can be added into other sizers or into empty container
91          *    (cannot put sizer when there's other one inside container
92          *     or when there's any item added)
93          *  - if non-sizer container already has sizer, nothing else can be
94          *    added into it
95          */
96         virtual bool OnCanAddChild(wxsItem* Item,bool ShowMessage);
97 
98         /** \brief Function adding children items into preview window */
99         void AddChildrenPreview(wxWindow* This,long Flags);
100 
101         /** \brief Function adding code generating child items */
102         void AddChildrenCode();
103 
104     private:
105 
106         /** \brief Function enumerating properties with default ones
107          *
108          * Function enumerating item properties. The implementation
109          * does call EnumContainerProperties() and adds all default properties.
110          */
111         virtual void OnEnumItemProperties(long Flags);
112 
113         /** \brief Function Adding QPPChild panels for base properties of this
114          *         container.
115          *
116          * This function calls internally AddContainerQPP to add any additional
117          * QPPChild panels.
118          */
119         virtual void OnAddItemQPP(wxsAdvQPP* QPP);
120 };
121 
122 #endif
123