⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guicheckboxctrl.cc

📁 五行MMORPG引擎系统V1.0
💻 CC
字号:
//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------

#include "console/console.h"
#include "dgl/dgl.h"
#include "gui/core/guiCanvas.h"
#include "gui/controls/guiCheckBoxCtrl.h"
#include "console/consoleTypes.h"

IMPLEMENT_CONOBJECT(GuiCheckBoxCtrl);

//---------------------------------------------------------------------------
GuiCheckBoxCtrl::GuiCheckBoxCtrl()
{
   mBounds.extent.set(140, 30);
	mStateOn = false;
   mIndent = 0;
   mButtonType = ButtonTypeCheck;
}

//---------------------------------------------------------------------------

bool GuiCheckBoxCtrl::onWake()
{
   if(!Parent::onWake())
      return false;

   // make sure there is a bitmap array for this control type
   // if it is declared as such in the control
	/// TGE_Theme
   //mProfile->constructBitmapArray();

   return true;
}

void GuiCheckBoxCtrl::onSleep()
{
   Parent::onSleep();

}


//---------------------------------------------------------------------------
void GuiCheckBoxCtrl::onRender(Point2I offset, const RectI &updateRect)
{
	/// TGE_Theme
   mProfile->constructBitmapArray();

   ColorI backColor = mActive ? mProfile->mFillColor : mProfile->mFillColorNA;
   ColorI fontColor = mMouseOver ? mProfile->mFontColorHL : mProfile->mFontColor;
	ColorI insideBorderColor = isFirstResponder() ? mProfile->mBorderColorHL : mProfile->mBorderColor;

   // just draw the check box and the text:
   S32 xOffset = 0;
	dglClearBitmapModulation();
   if(mProfile->mBitmapArrayRects.size() >= 4)
   {
      S32 index = mStateOn;
      if(!mActive)
         index = 2;
      else if(mDepressed)
         index += 2;
      xOffset = mProfile->mBitmapArrayRects[0].extent.x + 2 + mIndent;
      S32 y = (mBounds.extent.y - mProfile->mBitmapArrayRects[0].extent.y) / 2;
      dglDrawBitmapSR(mProfile->mTextureHandle, offset + Point2I(mIndent, y), mProfile->mBitmapArrayRects[index]);
   }
   
	if(mButtonText[0] != NULL)
	{
	   dglSetBitmapModulation( fontColor );
      renderJustifiedText(Point2I(offset.x + xOffset, offset.y),
                          Point2I(mBounds.extent.x - mBounds.extent.y, mBounds.extent.y),
                          mButtonText);
  	}
   //render the children
   renderChildControls(offset, updateRect);
}

//---------------------------------------------------------------------------
// EOF //


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -