MyGUI
3.2.1
|
00001 /* 00002 * This source file is part of MyGUI. For the latest info, see http://mygui.info/ 00003 * Distributed under the MIT License 00004 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT) 00005 */ 00006 00007 #include "MyGUI_Precompiled.h" 00008 #include "MyGUI_SimpleText.h" 00009 #include "MyGUI_RenderItem.h" 00010 #include "MyGUI_LayerNode.h" 00011 #include "MyGUI_FontManager.h" 00012 #include "MyGUI_CommonStateInfo.h" 00013 #include "MyGUI_RenderManager.h" 00014 00015 namespace MyGUI 00016 { 00017 00018 SimpleText::SimpleText() : 00019 EditText() 00020 { 00021 mIsAddCursorWidth = false; 00022 } 00023 00024 SimpleText::~SimpleText() 00025 { 00026 } 00027 00028 void SimpleText::setViewOffset(const IntPoint& _point) 00029 { 00030 } 00031 00032 void SimpleText::doRender() 00033 { 00034 bool _update = mRenderItem->getCurrentUpdate(); 00035 if (_update) 00036 mTextOutDate = true; 00037 00038 if (nullptr == mFont) 00039 return; 00040 if (!mVisible || mEmptyView) 00041 return; 00042 00043 if (mTextOutDate) 00044 updateRawData(); 00045 00046 const IntSize& size = mTextView.getViewSize(); 00047 00048 if (mTextAlign.isRight()) 00049 mViewOffset.left = - (mCoord.width - size.width); 00050 else if (mTextAlign.isHCenter()) 00051 mViewOffset.left = - ((mCoord.width - size.width) / 2); 00052 else 00053 mViewOffset.left = 0; 00054 00055 if (mTextAlign.isBottom()) 00056 mViewOffset.top = - (mCoord.height - size.height); 00057 else if (mTextAlign.isVCenter()) 00058 mViewOffset.top = - ((mCoord.height - size.height) / 2); 00059 else 00060 mViewOffset.top = 0; 00061 00062 Base::doRender(); 00063 } 00064 00065 } // namespace MyGUI