MyGUI 3.2.2

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

- File List
- Globals

MyGUI_SimpleText.cpp
Go to the documentation of this file.
1 /*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7 #include "MyGUI_Precompiled.h"
8 #include "MyGUI_SimpleText.h"
9 #include "MyGUI_RenderItem.h"
10 #include "MyGUI_LayerNode.h"
11 #include "MyGUI_FontManager.h"
12 #include "MyGUI_CommonStateInfo.h"
13 #include "MyGUI_RenderManager.h"
14
15 namespace MyGUI
16 {
17
18 SimpleText::SimpleText() :
19 EditText()
20 {
21 mIsAddCursorWidth = false;
22 }
23
24 SimpleText::~SimpleText()
25 {
26 }
27
28 void SimpleText::setViewOffset(const IntPoint& _point)
29 {
30 }
31
32 void SimpleText::doRender()
33 {
34 bool _update = mRenderItem->getCurrentUpdate();
35 if (_update)
36 mTextOutDate = true;
37
38 if (nullptr == mFont)
39 return;
40 if (!mVisible || mEmptyView)
41 return;
42
43 if (mTextOutDate)
44 updateRawData();
45
46 const IntSize& size = mTextView.getViewSize();
47
48 if (mTextAlign.isRight())
49 mViewOffset.left = - (mCoord.width - size.width);
50 else if (mTextAlign.isHCenter())
51 mViewOffset.left = - ((mCoord.width - size.width) / 2);
52 else
53 mViewOffset.left = 0;
54
55 if (mTextAlign.isBottom())
56 mViewOffset.top = - (mCoord.height - size.height);
57 else if (mTextAlign.isVCenter())
58 mViewOffset.top = - ((mCoord.height - size.height) / 2);
59 else
60 mViewOffset.top = 0;
61
62 Base::doRender();
63 }
64
65 } // namespace MyGUI
MyGUI::EditText::mIsAddCursorWidth
bool mIsAddCursorWidth
Definition: MyGUI_EditText.h:169
MyGUI::TextView::getViewSize
const IntSize & getViewSize() const
Definition: MyGUI_TextView.cpp:373
MyGUI::types::TPoint< int >
MyGUI::SimpleText::setViewOffset
virtual void setViewOffset(const IntPoint &_point)
Definition: MyGUI_SimpleText.cpp:28
MyGUI_Precompiled.h
MyGUI::SimpleText::doRender
virtual void doRender()
Definition: MyGUI_SimpleText.cpp:32
MyGUI::Align::isBottom
bool isBottom() const
Definition: MyGUI_Align.h:79
MyGUI::types::TSize< int >
MyGUI_SimpleText.h
MyGUI::Align::isVCenter
bool isVCenter() const
Definition: MyGUI_Align.h:49
MyGUI::Align::isHCenter
bool isHCenter() const
Definition: MyGUI_Align.h:44
MyGUI::types::TPoint::top
T top
Definition: MyGUI_TPoint.h:21
MyGUI::EditText::mRenderItem
RenderItem * mRenderItem
Definition: MyGUI_EditText.h:167
MyGUI::types::TCoord::width
T width
Definition: MyGUI_TCoord.h:24
MyGUI::ICroppedRectangle::mCoord
IntCoord mCoord
Definition: MyGUI_ICroppedRectangle.h:245
MyGUI_FontManager.h
MyGUI::SimpleText::SimpleText
SimpleText()
Definition: MyGUI_SimpleText.cpp:18
MyGUI_RenderManager.h
MyGUI::EditText::mTextOutDate
bool mTextOutDate
Definition: MyGUI_EditText.h:144
MyGUI
Definition: MyGUI_ActionController.h:14
MyGUI::EditText::mTextAlign
Align mTextAlign
Definition: MyGUI_EditText.h:145
MyGUI::types::TPoint::left
T left
Definition: MyGUI_TPoint.h:20
MyGUI::EditText::mFont
IFont * mFont
Definition: MyGUI_EditText.h:152
MyGUI::types::TSize::width
T width
Definition: MyGUI_TSize.h:20
MyGUI::ISubWidget::mVisible
bool mVisible
Definition: MyGUI_ISubWidget.h:61
MyGUI_CommonStateInfo.h
MyGUI_RenderItem.h
MyGUI::Align::isRight
bool isRight() const
Definition: MyGUI_Align.h:64
MyGUI::EditText::mTextView
TextView mTextView
Definition: MyGUI_EditText.h:176
MyGUI_LayerNode.h
MyGUI::EditText::updateRawData
virtual void updateRawData()
Definition: MyGUI_EditText.cpp:508
MyGUI::EditText::mViewOffset
IntPoint mViewOffset
Definition: MyGUI_EditText.h:164
MyGUI::EditText::mEmptyView
bool mEmptyView
Definition: MyGUI_EditText.h:136
MyGUI::SimpleText::~SimpleText
virtual ~SimpleText()
Definition: MyGUI_SimpleText.cpp:24
MyGUI::EditText::doRender
virtual void doRender()
Definition: MyGUI_EditText.cpp:535
MyGUI::types::TSize::height
T height
Definition: MyGUI_TSize.h:21
MyGUI::RenderItem::getCurrentUpdate
bool getCurrentUpdate() const
Definition: MyGUI_RenderItem.cpp:225
MyGUI::types::TCoord::height
T height
Definition: MyGUI_TCoord.h:25
MyGUI::EditText
Definition: MyGUI_EditText.h:25