~ubuntu-branches/debian/sid/ember/sid

« back to all changes in this revision

Viewing changes to src/components/ogre/widgets/adapters/atlas/MapAdapter.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2009-07-23 07:46:40 UTC
  • Revision ID: james.westby@ubuntu.com-20090723074640-wh0ukzis0kda36qv
Tags: upstream-0.5.6
ImportĀ upstreamĀ versionĀ 0.5.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// C++ Interface: MapAdapter
 
3
//
 
4
// Description: 
 
5
//
 
6
//
 
7
// Author: Erik Hjortsberg <erik.hjortsberg@gmail.com>, (C) 2007
 
8
//
 
9
// This program is free software; you can redistribute it and/or modify
 
10
// it under the terms of the GNU General Public License as published by
 
11
// the Free Software Foundation; either version 2 of the License, or
 
12
// (at your option) any later version.
 
13
// 
 
14
// This program is distributed in the hope that it will be useful,
 
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
// GNU General Public License for more details.
 
18
// 
 
19
// You should have received a copy of the GNU General Public License
 
20
// along with this program; if not, write to the Free Software
 
21
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.//
 
22
//
 
23
#ifndef EMBEROGRE_GUI_ADAPTERS_ATLASMAPADAPTER_H
 
24
#define EMBEROGRE_GUI_ADAPTERS_ATLASMAPADAPTER_H
 
25
 
 
26
#include "AdapterBase.h"
 
27
#include "components/ogre/widgets/StackableContainer.h"
 
28
 
 
29
 
 
30
namespace CEGUI {
 
31
        class Window;
 
32
}
 
33
 
 
34
namespace EmberOgre {
 
35
 
 
36
namespace Gui {
 
37
 
 
38
namespace Adapters {
 
39
 
 
40
namespace Atlas {
 
41
 
 
42
 
 
43
 
 
44
 
 
45
/**
 
46
        @author Erik Hjortsberg <erik.hjortsberg@gmail.com>
 
47
*/
 
48
class MapAdapter : public AdapterBase
 
49
{
 
50
public:
 
51
    
 
52
    MapAdapter(const ::Atlas::Message::Element& element, CEGUI::Window* childContainer);
 
53
 
 
54
    virtual ~MapAdapter();
 
55
 
 
56
    std::vector<std::string> getAttributeNames();
 
57
 
 
58
        const ::Atlas::Message::Element& valueOfAttr(const std::string& attr) const;
 
59
        bool hasAttr(const std::string& attr) const;
 
60
 
 
61
        /**
 
62
        Updates the gui with new values.
 
63
        */
 
64
        virtual void updateGui(const ::Atlas::Message::Element& element);
 
65
 
 
66
    void addAttributeAdapter(const std::string& attributeName, Adapters::Atlas::AdapterBase* adapter, CEGUI::Window* containerWindow);
 
67
    void removeAdapters();
 
68
    
 
69
        ::Atlas::Message::Element getSelectedChangedElements();
 
70
        
 
71
        /**
 
72
         * @brief Returns true if the map adapter already contains an adapter with the specified name.
 
73
         * This works very much like hasAttr(), with the exception that this also will take into considerations those adapters that have been added but not yet applied to the underlying element.
 
74
         * @param attr The name of the attribute to look for an adapter for.
 
75
         * @return True if an adapter for the named attribute exists.
 
76
         */
 
77
        bool hasAdapter(const std::string& attr) const;
 
78
 
 
79
protected:
 
80
        typedef std::map<std::string, AdapterWrapper> AdapterStore;
 
81
        
 
82
        CEGUI::Window* mChildContainer;
 
83
//      StackableContainer mStackableContainer;
 
84
        const ::Atlas::Message::MapType& mAttributes;
 
85
        
 
86
        AdapterStore mAdapters;
 
87
        
 
88
        virtual void fillElementFromGui();
 
89
        virtual bool _hasChanges();
 
90
        virtual ::Atlas::Message::Element _getChangedElement();
 
91
 
 
92
};
 
93
 
 
94
}
 
95
 
 
96
}
 
97
 
 
98
}
 
99
 
 
100
}
 
101
 
 
102
#endif