MyGUI  3.4.1
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
IntPoint mViewOffset
void doRender() override
RenderItem * mRenderItem
void updateRawData() const
bool getCurrentUpdate() const
void setViewOffset(const IntPoint &_point) override
void doRender() override
const IntSize & getViewSize() const
bool isVCenter() const
Definition: MyGUI_Align.h:49
bool isRight() const
Definition: MyGUI_Align.h:64
bool isHCenter() const
Definition: MyGUI_Align.h:44
bool isBottom() const
Definition: MyGUI_Align.h:79