~ubuntu-branches/ubuntu/vivid/mygui/vivid

« back to all changes in this revision

Viewing changes to Tools/LayoutEditor/Common.h

  • Committer: Package Import Robot
  • Author(s): Scott Howard, Bret Curtis, Scott Howard
  • Date: 2014-09-18 17:57:48 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140918175748-dd8va78mvpw1jbes
Tags: 3.2.1-1
[ Bret Curtis ]
* Updated license for majority of files from LGPL to Expat (MIT)

[ Scott Howard ]
* New upstream release
* Updated patch to add build option for system GLEW libraries
* All patches accepted upstream except shared_libraries.patch
* Bumped SONAME due to dropped symbols, updated *.symbols and package
  names
* Updated license of debian/* to Expat with permission of all authors
* Don't install Doxygen autogenerated md5 and map files (thanks
  lintian)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef __COMMON_H__
2
 
#define __COMMON_H__
3
 
 
4
 
#include <MyGUI.h>
5
 
 
6
 
namespace tools
7
 
{
8
 
        namespace utility
9
 
        {
10
 
                // это можно в методы гуи занести
11
 
                inline MyGUI::IntCoord convertCoordToParentCoord(const MyGUI::IntCoord& _coord, MyGUI::Widget* _widget)
12
 
                {
13
 
                        MyGUI::IntCoord coord = _coord;
14
 
                        MyGUI::Widget* parent = _widget->getParent();
15
 
                        while (nullptr != parent)
16
 
                        {
17
 
                                coord = coord - parent->getPosition();
18
 
                                // а может у нас и дедушка есть? а может и прадед...
19
 
                                parent = parent->getParent();
20
 
                        }
21
 
                        return coord;
22
 
                }
23
 
 
24
 
                inline void mapSet(MyGUI::VectorStringPairs& _map, const std::string& _key, const std::string& _value)
25
 
                {
26
 
                        for (MyGUI::VectorStringPairs::iterator iter = _map.begin(); iter != _map.end(); ++iter)
27
 
                        {
28
 
                                if (iter->first == _key)
29
 
                                {
30
 
                                        iter->second = _value;
31
 
                                        return;
32
 
                                }
33
 
                        }
34
 
                        _map.push_back(MyGUI::PairString(_key, _value));
35
 
                }
36
 
 
37
 
                inline MyGUI::VectorStringPairs::iterator mapFind(MyGUI::VectorStringPairs& _map, const std::string& _key)
38
 
                {
39
 
                        for (MyGUI::VectorStringPairs::iterator iter = _map.begin(); iter != _map.end(); ++iter)
40
 
                        {
41
 
                                if (iter->first == _key)
42
 
                                        return iter;
43
 
                        }
44
 
                        return _map.end();
45
 
                }
46
 
 
47
 
                inline void mapErase(MyGUI::VectorStringPairs& _map, const std::string& _key)
48
 
                {
49
 
                        for (MyGUI::VectorStringPairs::iterator iter = _map.begin(); iter != _map.end(); ++iter)
50
 
                        {
51
 
                                if (iter->first == _key)
52
 
                                {
53
 
                                        _map.erase(iter);
54
 
                                        return;
55
 
                                }
56
 
                        }
57
 
                }
58
 
        } // namespace utility
59
 
} // namespace tools
60
 
 
61
 
#endif // __COMMON_H__
 
1
#ifndef _d90c3428_278f_44c7_9400_f8b7e1bff0bd_
 
2
#define _d90c3428_278f_44c7_9400_f8b7e1bff0bd_
 
3
 
 
4
#include <MyGUI.h>
 
5
 
 
6
namespace tools
 
7
{
 
8
        namespace utility
 
9
        {
 
10
 
 
11
                // это можно в методы гуи занести
 
12
                inline MyGUI::IntCoord convertCoordToParentCoord(const MyGUI::IntCoord& _coord, MyGUI::Widget* _widget)
 
13
                {
 
14
                        MyGUI::IntCoord coord = _coord;
 
15
                        MyGUI::Widget* parent = _widget->getParent();
 
16
                        while (nullptr != parent)
 
17
                        {
 
18
                                coord = coord - parent->getPosition();
 
19
                                // а может у нас и дедушка есть? а может и прадед...
 
20
                                parent = parent->getParent();
 
21
                        }
 
22
                        return coord;
 
23
                }
 
24
 
 
25
                inline void mapSet(MyGUI::VectorStringPairs& _map, const std::string& _key, const std::string& _value)
 
26
                {
 
27
                        for (MyGUI::VectorStringPairs::iterator iter = _map.begin(); iter != _map.end(); ++iter)
 
28
                        {
 
29
                                if (iter->first == _key)
 
30
                                {
 
31
                                        iter->second = _value;
 
32
                                        return;
 
33
                                }
 
34
                        }
 
35
                        _map.push_back(MyGUI::PairString(_key, _value));
 
36
                }
 
37
 
 
38
                inline MyGUI::VectorStringPairs::iterator mapFind(MyGUI::VectorStringPairs& _map, const std::string& _key)
 
39
                {
 
40
                        for (MyGUI::VectorStringPairs::iterator iter = _map.begin(); iter != _map.end(); ++iter)
 
41
                        {
 
42
                                if (iter->first == _key)
 
43
                                        return iter;
 
44
                        }
 
45
                        return _map.end();
 
46
                }
 
47
 
 
48
                inline void mapErase(MyGUI::VectorStringPairs& _map, const std::string& _key)
 
49
                {
 
50
                        for (MyGUI::VectorStringPairs::iterator iter = _map.begin(); iter != _map.end(); ++iter)
 
51
                        {
 
52
                                if (iter->first == _key)
 
53
                                {
 
54
                                        _map.erase(iter);
 
55
                                        return;
 
56
                                }
 
57
                        }
 
58
                }
 
59
 
 
60
        }
 
61
}
 
62
 
 
63
#endif