MyGUI  3.0.1
MyGUI_SimpleText.cpp
Go to the documentation of this file.
1 
7 /*
8  This file is part of MyGUI.
9 
10  MyGUI is free software: you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  MyGUI is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
22 */
23 #include "MyGUI_Precompiled.h"
24 #include "MyGUI_SimpleText.h"
25 #include "MyGUI_RenderItem.h"
26 #include "MyGUI_LayerNode.h"
27 #include "MyGUI_FontManager.h"
28 #include "MyGUI_CommonStateInfo.h"
29 #include "MyGUI_RenderManager.h"
30 
31 namespace MyGUI
32 {
33 
35  EditText()
36  {
37  mIsAddCursorWidth = false;
38  }
39 
41  {
42  }
43 
44  void SimpleText::setViewOffset(const IntPoint& _point)
45  {
46  }
47 
49  {
50  bool _update = mRenderItem->getCurrentUpdate();
51  if (_update) mTextOutDate = true;
52 
53  if (nullptr == mFont) return;
54  if (!mVisible || mEmptyView) return;
55 
57 
58  const IntSize& size = mTextView.getViewSize();
59 
60  if (mTextAlign.isRight())
61  mViewOffset.left = - (mCoord.width - size.width);
62  else if (mTextAlign.isHCenter())
63  mViewOffset.left = - ((mCoord.width - size.width) / 2);
64  else
65  mViewOffset.left = 0;
66 
67  if (mTextAlign.isBottom())
68  mViewOffset.top = - (mCoord.height - size.height);
69  else if (mTextAlign.isVCenter())
70  mViewOffset.top = - ((mCoord.height - size.height) / 2);
71  else
72  mViewOffset.top = 0;
73 
75  }
76 
77 } // namespace MyGUI