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

« back to all changes in this revision

Viewing changes to Tools/LayoutEditor/PropertyFieldComboBox.cpp

  • 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
 
/*!
2
 
        @file
3
 
        @author         Albert Semenov
4
 
        @date           12/2010
5
 
*/
6
 
 
7
 
#include "Precompiled.h"
8
 
#include "PropertyFieldComboBox.h"
9
 
#include "Localise.h"
10
 
#include "EditorWidgets.h"
11
 
#include "WidgetTypes.h"
12
 
 
13
 
namespace tools
14
 
{
15
 
        const std::string DEFAULT_STRING = "[DEFAULT]";
16
 
 
17
 
        PropertyFieldComboBox::PropertyFieldComboBox(MyGUI::Widget* _parent) :
18
 
                BaseLayout("PropertyFieldComboBox.layout", _parent),
19
 
                mText(nullptr),
20
 
                mField(nullptr),
21
 
                mCurrentWidget(nullptr)
22
 
        {
23
 
                assignWidget(mText, "Text");
24
 
                assignWidget(mField, "Field");
25
 
 
26
 
                mField->eventComboAccept += newDelegate (this, &PropertyFieldComboBox::notifyForceApplyProperties2);
27
 
        }
28
 
 
29
 
        PropertyFieldComboBox::~PropertyFieldComboBox()
30
 
        {
31
 
        }
32
 
 
33
 
        void PropertyFieldComboBox::initialise(const std::string& _type)
34
 
        {
35
 
                mType = _type;
36
 
        }
37
 
 
38
 
        void PropertyFieldComboBox::setTarget(MyGUI::Widget* _currentWidget)
39
 
        {
40
 
                mCurrentWidget = _currentWidget;
41
 
                onFillValues();
42
 
        }
43
 
 
44
 
        void PropertyFieldComboBox::onFillValues()
45
 
        {
46
 
                WidgetStyle::VectorString values = WidgetTypes::getInstance().findPossibleValues(mType);
47
 
 
48
 
                mField->removeAllItems();
49
 
                for (WidgetStyle::VectorString::iterator iter = values.begin(); iter != values.end(); ++iter)
50
 
                        mField->addItem(*iter);
51
 
                mField->beginToItemFirst();
52
 
        }
53
 
 
54
 
        void PropertyFieldComboBox::notifyApplyProperties(MyGUI::Widget* _sender)
55
 
        {
56
 
                std::string DEFAULT_VALUE = replaceTags("ColourDefault") + DEFAULT_STRING;
57
 
                std::string value = mField->getOnlyText();
58
 
 
59
 
                if (value == DEFAULT_STRING && mField->getCaption() == DEFAULT_VALUE)
60
 
                        value = "";
61
 
 
62
 
                onAction(value, true);
63
 
        }
64
 
 
65
 
        void PropertyFieldComboBox::onAction(const std::string& _value, bool _final)
66
 
        {
67
 
                eventAction(mName, _value, _final);
68
 
        }
69
 
 
70
 
        void PropertyFieldComboBox::notifyForceApplyProperties2(MyGUI::ComboBox* _sender, size_t _index)
71
 
        {
72
 
                notifyApplyProperties(_sender);
73
 
        }
74
 
 
75
 
        MyGUI::IntSize PropertyFieldComboBox::getContentSize()
76
 
        {
77
 
                return MyGUI::IntSize(0, mMainWidget->getHeight());
78
 
        }
79
 
 
80
 
        void PropertyFieldComboBox::setCoord(const MyGUI::IntCoord& _coord)
81
 
        {
82
 
                mMainWidget->setCoord(_coord);
83
 
        }
84
 
 
85
 
        void PropertyFieldComboBox::setValue(const std::string& _value)
86
 
        {
87
 
                std::string DEFAULT_VALUE = replaceTags("ColourDefault") + DEFAULT_STRING;
88
 
 
89
 
                if (_value.empty())
90
 
                {
91
 
                        mField->setCaption(DEFAULT_VALUE);
92
 
                }
93
 
                else
94
 
                {
95
 
                        mField->setOnlyText(_value);
96
 
                }
97
 
        }
98
 
 
99
 
        void PropertyFieldComboBox::setName(const std::string& _value)
100
 
        {
101
 
                mName = _value;
102
 
                mText->setCaption(_value);
103
 
        }
104
 
 
105
 
        void PropertyFieldComboBox::setVisible(bool _value)
106
 
        {
107
 
                mMainWidget->setVisible(_value);
108
 
        }
109
 
 
110
 
        bool PropertyFieldComboBox::getVisible()
111
 
        {
112
 
                return mMainWidget->getVisible();
113
 
        }
114
 
 
115
 
} // namespace tools
 
1
/*!
 
2
        @file
 
3
        @author         Albert Semenov
 
4
        @date           12/2010
 
5
*/
 
6
 
 
7
#include "Precompiled.h"
 
8
#include "PropertyFieldComboBox.h"
 
9
#include "Localise.h"
 
10
#include "EditorWidgets.h"
 
11
#include "WidgetTypes.h"
 
12
 
 
13
namespace tools
 
14
{
 
15
 
 
16
        const std::string DEFAULT_STRING = "[DEFAULT]";
 
17
 
 
18
        PropertyFieldComboBox::PropertyFieldComboBox(MyGUI::Widget* _parent) :
 
19
                BaseLayout("PropertyFieldComboBox.layout", _parent),
 
20
                mText(nullptr),
 
21
                mField(nullptr),
 
22
                mCurrentWidget(nullptr)
 
23
        {
 
24
                assignWidget(mText, "Text");
 
25
                assignWidget(mField, "Field");
 
26
 
 
27
                mField->eventComboAccept += newDelegate (this, &PropertyFieldComboBox::notifyForceApplyProperties2);
 
28
        }
 
29
 
 
30
        PropertyFieldComboBox::~PropertyFieldComboBox()
 
31
        {
 
32
        }
 
33
 
 
34
        void PropertyFieldComboBox::initialise(const std::string& _type)
 
35
        {
 
36
                mType = _type;
 
37
        }
 
38
 
 
39
        void PropertyFieldComboBox::setTarget(MyGUI::Widget* _currentWidget)
 
40
        {
 
41
                mCurrentWidget = _currentWidget;
 
42
                onFillValues();
 
43
        }
 
44
 
 
45
        void PropertyFieldComboBox::onFillValues()
 
46
        {
 
47
                WidgetStyle::VectorString values = WidgetTypes::getInstance().findPossibleValues(mType);
 
48
 
 
49
                mField->removeAllItems();
 
50
                for (WidgetStyle::VectorString::iterator iter = values.begin(); iter != values.end(); ++iter)
 
51
                        mField->addItem(*iter);
 
52
                mField->beginToItemFirst();
 
53
        }
 
54
 
 
55
        void PropertyFieldComboBox::notifyApplyProperties(MyGUI::Widget* _sender)
 
56
        {
 
57
                std::string DEFAULT_VALUE = replaceTags("ColourDefault") + DEFAULT_STRING;
 
58
                std::string value = mField->getOnlyText();
 
59
 
 
60
                if (value == DEFAULT_STRING && mField->getCaption() == DEFAULT_VALUE)
 
61
                        value = "";
 
62
 
 
63
                onAction(value, true);
 
64
        }
 
65
 
 
66
        void PropertyFieldComboBox::onAction(const std::string& _value, bool _final)
 
67
        {
 
68
                eventAction(mName, _value, _final);
 
69
        }
 
70
 
 
71
        void PropertyFieldComboBox::notifyForceApplyProperties2(MyGUI::ComboBox* _sender, size_t _index)
 
72
        {
 
73
                notifyApplyProperties(_sender);
 
74
        }
 
75
 
 
76
        MyGUI::IntSize PropertyFieldComboBox::getContentSize()
 
77
        {
 
78
                return MyGUI::IntSize(0, mMainWidget->getHeight());
 
79
        }
 
80
 
 
81
        void PropertyFieldComboBox::setCoord(const MyGUI::IntCoord& _coord)
 
82
        {
 
83
                mMainWidget->setCoord(_coord);
 
84
        }
 
85
 
 
86
        void PropertyFieldComboBox::setValue(const std::string& _value)
 
87
        {
 
88
                std::string DEFAULT_VALUE = replaceTags("ColourDefault") + DEFAULT_STRING;
 
89
 
 
90
                if (_value.empty())
 
91
                {
 
92
                        mField->setCaption(DEFAULT_VALUE);
 
93
                }
 
94
                else
 
95
                {
 
96
                        mField->setOnlyText(_value);
 
97
                }
 
98
        }
 
99
 
 
100
        void PropertyFieldComboBox::setName(const std::string& _value)
 
101
        {
 
102
                mName = _value;
 
103
                mText->setCaption(_value);
 
104
        }
 
105
 
 
106
        void PropertyFieldComboBox::setVisible(bool _value)
 
107
        {
 
108
                mMainWidget->setVisible(_value);
 
109
        }
 
110
 
 
111
        bool PropertyFieldComboBox::getVisible()
 
112
        {
 
113
                return mMainWidget->getVisible();
 
114
        }
 
115
 
 
116
}