MyGUI  3.2.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 
25  {
26  }
27 
28  void SimpleText::setViewOffset(const IntPoint& _point)
29  {
30  }
31 
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 
63  }
64 
65 } // namespace MyGUI