MyGUI 3.2.0

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files
- Examples

- File List
- Globals

MyGUI_SimpleText.cpp
Go to the documentation of this file.
1
6 /*
7 This file is part of MyGUI.
8
9 MyGUI is free software: you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 MyGUI 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 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #include "MyGUI_Precompiled.h"
23 #include "MyGUI_SimpleText.h"
24 #include "MyGUI_RenderItem.h"
25 #include "MyGUI_LayerNode.h"
26 #include "MyGUI_FontManager.h"
27 #include "MyGUI_CommonStateInfo.h"
28 #include "MyGUI_RenderManager.h"
29
30 namespace MyGUI
31 {
32
33 SimpleText::SimpleText() :
34 EditText()
35 {
36 mIsAddCursorWidth = false;
37 }
38
39 SimpleText::~SimpleText()
40 {
41 }
42
43 void SimpleText::setViewOffset(const IntPoint& _point)
44 {
45 }
46
47 void SimpleText::doRender()
48 {
49 bool _update = mRenderItem->getCurrentUpdate();
50 if (_update) mTextOutDate = true;
51
52 if (nullptr == mFont) return;
53 if (!mVisible || mEmptyView) return;
54
55 if (mTextOutDate) updateRawData();
56
57 const IntSize& size = mTextView.getViewSize();
58
59 if (mTextAlign.isRight())
60 mViewOffset.left = - (mCoord.width - size.width);
61 else if (mTextAlign.isHCenter())
62 mViewOffset.left = - ((mCoord.width - size.width) / 2);
63 else
64 mViewOffset.left = 0;
65
66 if (mTextAlign.isBottom())
67 mViewOffset.top = - (mCoord.height - size.height);
68 else if (mTextAlign.isVCenter())
69 mViewOffset.top = - ((mCoord.height - size.height) / 2);
70 else
71 mViewOffset.top = 0;
72
73 Base::doRender();
74 }
75
76 } // namespace MyGUI
MyGUI::EditText::mIsAddCursorWidth
bool mIsAddCursorWidth
Definition: MyGUI_EditText.h:182
MyGUI::TextView::getViewSize
const IntSize & getViewSize() const
Definition: MyGUI_TextView.cpp:388
MyGUI::types::TPoint< int >
MyGUI::SimpleText::setViewOffset
virtual void setViewOffset(const IntPoint &_point)
Definition: MyGUI_SimpleText.cpp:43
MyGUI_Precompiled.h
MyGUI::SimpleText::doRender
virtual void doRender()
Definition: MyGUI_SimpleText.cpp:47
MyGUI::Align::isBottom
bool isBottom() const
Definition: MyGUI_Align.h:94
MyGUI::types::TSize< int >
MyGUI_SimpleText.h
MyGUI::Align::isVCenter
bool isVCenter() const
Definition: MyGUI_Align.h:64
MyGUI::Align::isHCenter
bool isHCenter() const
Definition: MyGUI_Align.h:59
MyGUI::types::TPoint::top
T top
Definition: MyGUI_TPoint.h:36
MyGUI::EditText::mRenderItem
RenderItem * mRenderItem
Definition: MyGUI_EditText.h:180
MyGUI::types::TCoord::width
T width
Definition: MyGUI_TCoord.h:39
MyGUI::ICroppedRectangle::mCoord
IntCoord mCoord
Definition: MyGUI_ICroppedRectangle.h:260
MyGUI_FontManager.h
MyGUI::SimpleText::SimpleText
SimpleText()
Definition: MyGUI_SimpleText.cpp:33
MyGUI_RenderManager.h
MyGUI::EditText::mTextOutDate
bool mTextOutDate
Definition: MyGUI_EditText.h:157
MyGUI::EditText::mTextAlign
Align mTextAlign
Definition: MyGUI_EditText.h:158
MyGUI::types::TPoint::left
T left
Definition: MyGUI_TPoint.h:35
MyGUI::EditText::mFont
IFont * mFont
Definition: MyGUI_EditText.h:165
MyGUI::types::TSize::width
T width
Definition: MyGUI_TSize.h:35
MyGUI::ISubWidget::mVisible
bool mVisible
Definition: MyGUI_ISubWidget.h:76
MyGUI_CommonStateInfo.h
MyGUI_RenderItem.h
MyGUI::Align::isRight
bool isRight() const
Definition: MyGUI_Align.h:79
MyGUI::EditText::mTextView
TextView mTextView
Definition: MyGUI_EditText.h:189
MyGUI_LayerNode.h
MyGUI::EditText::updateRawData
virtual void updateRawData()
Definition: MyGUI_EditText.cpp:517
MyGUI::EditText::mViewOffset
IntPoint mViewOffset
Definition: MyGUI_EditText.h:177
MyGUI::EditText::mEmptyView
bool mEmptyView
Definition: MyGUI_EditText.h:149
MyGUI::SimpleText::~SimpleText
virtual ~SimpleText()
Definition: MyGUI_SimpleText.cpp:39
MyGUI::EditText::doRender
virtual void doRender()
Definition: MyGUI_EditText.cpp:544
MyGUI::types::TSize::height
T height
Definition: MyGUI_TSize.h:36
MyGUI::RenderItem::getCurrentUpdate
bool getCurrentUpdate() const
Definition: MyGUI_RenderItem.cpp:235
MyGUI::types::TCoord::height
T height
Definition: MyGUI_TCoord.h:40
MyGUI::EditText
Definition: MyGUI_EditText.h:40