MyGUI
3.2.0
|
00001 00006 /* 00007 This file is part of MyGUI. 00008 00009 MyGUI is free software: you can redistribute it and/or modify 00010 it under the terms of the GNU Lesser General Public License as published by 00011 the Free Software Foundation, either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 MyGUI is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License 00020 along with MyGUI. If not, see <http://www.gnu.org/licenses/>. 00021 */ 00022 #include "MyGUI_Precompiled.h" 00023 #include "MyGUI_SimpleText.h" 00024 #include "MyGUI_RenderItem.h" 00025 #include "MyGUI_LayerNode.h" 00026 #include "MyGUI_FontManager.h" 00027 #include "MyGUI_CommonStateInfo.h" 00028 #include "MyGUI_RenderManager.h" 00029 00030 namespace MyGUI 00031 { 00032 00033 SimpleText::SimpleText() : 00034 EditText() 00035 { 00036 mIsAddCursorWidth = false; 00037 } 00038 00039 SimpleText::~SimpleText() 00040 { 00041 } 00042 00043 void SimpleText::setViewOffset(const IntPoint& _point) 00044 { 00045 } 00046 00047 void SimpleText::doRender() 00048 { 00049 bool _update = mRenderItem->getCurrentUpdate(); 00050 if (_update) mTextOutDate = true; 00051 00052 if (nullptr == mFont) return; 00053 if (!mVisible || mEmptyView) return; 00054 00055 if (mTextOutDate) updateRawData(); 00056 00057 const IntSize& size = mTextView.getViewSize(); 00058 00059 if (mTextAlign.isRight()) 00060 mViewOffset.left = - (mCoord.width - size.width); 00061 else if (mTextAlign.isHCenter()) 00062 mViewOffset.left = - ((mCoord.width - size.width) / 2); 00063 else 00064 mViewOffset.left = 0; 00065 00066 if (mTextAlign.isBottom()) 00067 mViewOffset.top = - (mCoord.height - size.height); 00068 else if (mTextAlign.isVCenter()) 00069 mViewOffset.top = - ((mCoord.height - size.height) / 2); 00070 else 00071 mViewOffset.top = 0; 00072 00073 Base::doRender(); 00074 } 00075 00076 } // namespace MyGUI