• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

MyGUI_SimpleText.cpp

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

Generated on Sun Jan 30 2011 for MyGUI by  doxygen 1.7.1