MyGUI  3.4.0
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 
19  EditText()
20  {
21  mIsAddCursorWidth = false;
22  }
23 
24  void SimpleText::setViewOffset(const IntPoint& _point)
25  {
26  }
27 
29  {
30  bool _update = mRenderItem->getCurrentUpdate();
31  if (_update)
32  mTextOutDate = true;
33 
34  if (nullptr == mFont)
35  return;
36  if (!mVisible || mEmptyView)
37  return;
38 
39  if (mTextOutDate)
40  updateRawData();
41 
42  const IntSize& size = mTextView.getViewSize();
43 
44  if (mTextAlign.isRight())
45  mViewOffset.left = - (mCoord.width - size.width);
46  else if (mTextAlign.isHCenter())
47  mViewOffset.left = - ((mCoord.width - size.width) / 2);
48  else
49  mViewOffset.left = 0;
50 
51  if (mTextAlign.isBottom())
52  mViewOffset.top = - (mCoord.height - size.height);
53  else if (mTextAlign.isVCenter())
54  mViewOffset.top = - ((mCoord.height - size.height) / 2);
55  else
56  mViewOffset.top = 0;
57 
59  }
60 
61 } // namespace MyGUI
MyGUI::TextView::getViewSize
const IntSize & getViewSize() const
Definition: MyGUI_TextView.cpp:373
MyGUI::Align::isHCenter
bool isHCenter() const
Definition: MyGUI_Align.h:44
MyGUI::types::TSize::height
T height
Definition: MyGUI_TSize.h:21
MyGUI::types::TPoint::top
T top
Definition: MyGUI_TPoint.h:21
MyGUI_FontManager.h
MyGUI::EditText::mRenderItem
RenderItem * mRenderItem
Definition: MyGUI_EditText.h:165
MyGUI::Align::isVCenter
bool isVCenter() const
Definition: MyGUI_Align.h:49
MyGUI::types::TPoint< int >
MyGUI_CommonStateInfo.h
MyGUI::types::TSize::width
T width
Definition: MyGUI_TSize.h:20
MyGUI_LayerNode.h
MyGUI::EditText::mTextAlign
Align mTextAlign
Definition: MyGUI_EditText.h:143
MyGUI::ISubWidget::mVisible
bool mVisible
Definition: MyGUI_ISubWidget.h:60
MyGUI_Precompiled.h
MyGUI::EditText::doRender
void doRender() override
Definition: MyGUI_EditText.cpp:521
MyGUI::ICroppedRectangle::mCoord
IntCoord mCoord
Definition: MyGUI_ICroppedRectangle.h:245
MyGUI::SimpleText::SimpleText
SimpleText()
Definition: MyGUI_SimpleText.cpp:18
MyGUI::EditText::mTextOutDate
bool mTextOutDate
Definition: MyGUI_EditText.h:142
MyGUI_SimpleText.h
MyGUI::types::TPoint::left
T left
Definition: MyGUI_TPoint.h:20
MyGUI::SimpleText::setViewOffset
void setViewOffset(const IntPoint &_point) override
Definition: MyGUI_SimpleText.cpp:24
MyGUI::EditText::mViewOffset
IntPoint mViewOffset
Definition: MyGUI_EditText.h:162
MyGUI::SimpleText::doRender
void doRender() override
Definition: MyGUI_SimpleText.cpp:28
MyGUI::EditText
Definition: MyGUI_EditText.h:27
MyGUI::types::TSize< int >
MyGUI::EditText::mFont
IFont * mFont
Definition: MyGUI_EditText.h:150
MyGUI::EditText::mTextView
TextView mTextView
Definition: MyGUI_EditText.h:174
MyGUI_RenderItem.h
MyGUI::Align::isRight
bool isRight() const
Definition: MyGUI_Align.h:64
MyGUI::EditText::updateRawData
virtual void updateRawData()
Definition: MyGUI_EditText.cpp:494
MyGUI_RenderManager.h
MyGUI::Align::isBottom
bool isBottom() const
Definition: MyGUI_Align.h:79
MyGUI::types::TCoord::width
T width
Definition: MyGUI_TCoord.h:24
MyGUI::RenderItem::getCurrentUpdate
bool getCurrentUpdate() const
Definition: MyGUI_RenderItem.cpp:225
MyGUI::EditText::mEmptyView
bool mEmptyView
Definition: MyGUI_EditText.h:135
MyGUI::types::TCoord::height
T height
Definition: MyGUI_TCoord.h:25
MyGUI
Definition: MyGUI_ActionController.h:15
MyGUI::EditText::mIsAddCursorWidth
bool mIsAddCursorWidth
Definition: MyGUI_EditText.h:167