root/cafu/trunk/CaWE/DialogInsp-EntityProps.hpp

Revision 457, 4.7 KB (checked in by Carsten, 4 months ago)

Using UltraEdit's multi-line search-and-replace-in-files feature, replaced


^#ifndef _(CAFU|CF|CFS|CA)_(.*)_$
^#define _\1_\2_$

with

#ifndef CAFU_\2_INCLUDED
#define CAFU_\2_INCLUDED

and


^#ifndef _(.*)_HPP_$
^#define _\1_HPP_$

with

#ifndef CAFU_\1_HPP_INCLUDED
#define CAFU_\1_HPP_INCLUDED

Closes #91.

Line 
1/*
2=================================================================================
3This file is part of Cafu, the open-source game engine and graphics engine
4for multiplayer, cross-platform, real-time 3D action.
5Copyright (C) 2002-2012 Carsten Fuchs Software.
6
7Cafu is free software: you can redistribute it and/or modify it under the terms
8of the GNU General Public License as published by the Free Software Foundation,
9either version 3 of the License, or (at your option) any later version.
10
11Cafu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13PURPOSE. See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with Cafu. If not, see <http://www.gnu.org/licenses/>.
17
18For support and more information about Cafu, visit us at <http://www.cafu.de>.
19=================================================================================
20*/
21
22#ifndef CAFU_DIALOG_INSP_ENTITY_PROPS_HPP_INCLUDED
23#define CAFU_DIALOG_INSP_ENTITY_PROPS_HPP_INCLUDED
24
25#include "ObserverPattern.hpp"
26#include "wx/panel.h"
27
28#include <map>
29
30
31class wxPropertyGridManager;
32class wxPropertyGridEvent;
33class wxPropertyCategory;
34class wxPGProperty;
35class wxStaticText;
36class MapDocumentT;
37class MapEntityBaseT;
38struct PropInfoT;
39
40
41/// This class displays the properties of all currently selected entities.
42/// It is implemented as an observer of the map document, and therefore acts just like the 2D and 3D views as another "view" of the "model".
43/// As the user can also change the values of the properties (and thus modify the document), this class also acts as a "controller".
44/// While the presentation of the properties of exactly one entity is straightforward, presenting the properties of multiple entities
45/// all at the same time in a manner that is clear both for the user as well as in the implementation is not.
46/// This has been solved by cleverly "overlaying" properties that occur in multiple entities.
47/// (See the notes in the implementation for more details.)
48class InspDlgEntityPropsT : public wxPanel, public ObserverT
49{
50    public:
51
52    InspDlgEntityPropsT(wxWindow* Parent_, MapDocumentT* MapDoc_);
53    ~InspDlgEntityPropsT();
54
55    // Implementation of the ObserverT interface.
56    void NotifySubjectChanged_Selection(SubjectT* Subject, const ArrayT<MapElementT*>& OldSelection, const ArrayT<MapElementT*>& NewSelection);
57    void NotifySubjectChanged_Deleted(SubjectT* Subject, const ArrayT<MapElementT*>& MapElements);
58    void NotifySubjectChanged_Modified(SubjectT* Subject, const ArrayT<MapElementT*>& MapElements, MapElemModDetailE Detail, const wxString& Key);
59    void NotifySubjectChanged_Modified(SubjectT* Subject, const ArrayT<MapElementT*>& MapElements, MapElemModDetailE Detail);
60    void NotifySubjectDies(SubjectT* dyingSubject);
61
62
63    private:
64
65    wxSizer* InspectorEntityPropsInit(wxWindow* parent, bool call_fit=true, bool set_sizer=true);
66
67    // Helper.
68    void UpdatePropertyGrid();
69
70    // Event handler methods.
71    void OnPropertyGridChanged(wxPropertyGridEvent& event);
72    void OnPropertyGridItemRightClick(wxPropertyGridEvent& event);
73    void OnContextMenuItemAdd(wxCommandEvent& event);
74    void OnContextMenuItemDelete(wxCommandEvent& event);
75
76    MapDocumentT*          MapDoc;
77    wxPropertyGridManager* PropMan;
78    wxPropertyCategory*    ClassKeys;       ///< PropertyGrid category for keys of an entity class.
79    wxPropertyCategory*    MixedKeys;       ///< PropertyGrid category for keys that belong to more than one entity class.
80    wxPropertyCategory*    UnDefKeys;       ///< PropertyGrid category for keys that are not defined by any entity class.
81    wxMenu*                PopUpMenu;       ///< Context menu used to add or delete properties.
82    wxStaticText*          SelectionText;   ///< Text that is displayed above the property grid. It shows the number of selected entities.
83
84    std::map<wxString, PropInfoT> CombinedPropInfos;        ///< The property infos of all selected entities combined.
85    wxPGProperty*                 LastRightClickedProperty; ///< The last property on which the user made a right click. Needed to process context menu events to the right property.
86    ArrayT<MapEntityBaseT*>       SelectedEntities;         ///< All currently selected entities in the map.
87
88    bool IsRecursiveSelfNotify;
89
90
91    // IDs for the controls whose events we are interested in.
92    enum
93    {
94        ID_PROPERTY_GRID_MAN=wxID_HIGHEST+1,
95        ID_MENU_CONTEXT_ADD,
96        ID_MENU_CONTEXT_DELETE
97    };
98
99    DECLARE_EVENT_TABLE()
100};
101
102#endif
Note: See TracBrowser for help on using the browser.