mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
toolbox
This commit is contained in:
parent
22037bf94f
commit
b75d5b70c6
2 changed files with 19 additions and 34 deletions
|
|
@ -43,10 +43,6 @@ ConsoleDocClass( GuiToolboxButtonCtrl,
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
GuiToolboxButtonCtrl::GuiToolboxButtonCtrl()
|
GuiToolboxButtonCtrl::GuiToolboxButtonCtrl()
|
||||||
{
|
{
|
||||||
INIT_ASSET(NormalBitmap);
|
|
||||||
INIT_ASSET(LoweredBitmap);
|
|
||||||
INIT_ASSET(HoverBitmap);
|
|
||||||
|
|
||||||
setMinExtent(Point2I(16,16));
|
setMinExtent(Point2I(16,16));
|
||||||
setExtent(48, 48);
|
setExtent(48, 48);
|
||||||
mButtonType = ButtonTypeRadio;
|
mButtonType = ButtonTypeRadio;
|
||||||
|
|
@ -59,9 +55,9 @@ GuiToolboxButtonCtrl::GuiToolboxButtonCtrl()
|
||||||
void GuiToolboxButtonCtrl::initPersistFields()
|
void GuiToolboxButtonCtrl::initPersistFields()
|
||||||
{
|
{
|
||||||
docsURL;
|
docsURL;
|
||||||
INITPERSISTFIELD_IMAGEASSET(NormalBitmap, GuiToolboxButtonCtrl, "");
|
INITPERSISTFIELD_IMAGEASSET_REFACTOR(NormalBitmap, GuiToolboxButtonCtrl, "");
|
||||||
INITPERSISTFIELD_IMAGEASSET(LoweredBitmap, GuiToolboxButtonCtrl, "");
|
INITPERSISTFIELD_IMAGEASSET_REFACTOR(LoweredBitmap, GuiToolboxButtonCtrl, "");
|
||||||
INITPERSISTFIELD_IMAGEASSET(HoverBitmap, GuiToolboxButtonCtrl, "");
|
INITPERSISTFIELD_IMAGEASSET_REFACTOR(HoverBitmap, GuiToolboxButtonCtrl, "");
|
||||||
|
|
||||||
Parent::initPersistFields();
|
Parent::initPersistFields();
|
||||||
}
|
}
|
||||||
|
|
@ -75,10 +71,6 @@ bool GuiToolboxButtonCtrl::onWake()
|
||||||
|
|
||||||
setActive( true );
|
setActive( true );
|
||||||
|
|
||||||
setNormalBitmap( getNormalBitmap() );
|
|
||||||
setLoweredBitmap( getLoweredBitmap() );
|
|
||||||
setHoverBitmap( getHoverBitmap() );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,9 +88,9 @@ void GuiToolboxButtonCtrl::inspectPostApply()
|
||||||
// set it's extent to be exactly the size of the normal bitmap (if present)
|
// set it's extent to be exactly the size of the normal bitmap (if present)
|
||||||
Parent::inspectPostApply();
|
Parent::inspectPostApply();
|
||||||
|
|
||||||
if ((getWidth() == 0) && (getHeight() == 0) && mNormalBitmap)
|
if ((getWidth() == 0) && (getHeight() == 0) && mNormalBitmapAsset.notNull())
|
||||||
{
|
{
|
||||||
setExtent(mNormalBitmap->getWidth(), mNormalBitmap->getHeight());
|
setExtent(getNormalBitmap()->getWidth(), getNormalBitmap()->getHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,15 +136,15 @@ void GuiToolboxButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
|
||||||
{
|
{
|
||||||
RectI r(offset, getExtent());
|
RectI r(offset, getExtent());
|
||||||
if ( mDepressed || mStateOn )
|
if ( mDepressed || mStateOn )
|
||||||
renderStateRect( mLoweredBitmap , r );
|
renderStateRect( getLoweredBitmap(), r);
|
||||||
else if ( mHighlighted )
|
else if ( mHighlighted )
|
||||||
renderStateRect( mHoverBitmap , r );
|
renderStateRect( getHoverBitmap(), r);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now render the image
|
// Now render the image
|
||||||
if( mNormalBitmap )
|
if( mNormalBitmapAsset.notNull() )
|
||||||
{
|
{
|
||||||
renderButton(mNormalBitmap, offset, updateRect );
|
renderButton(getNormalBitmap(), offset, updateRect );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -168,7 +160,7 @@ void GuiToolboxButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiToolboxButtonCtrl::renderStateRect( GFXTexHandle &texture, const RectI& rect )
|
void GuiToolboxButtonCtrl::renderStateRect( GFXTexHandle texture, const RectI& rect )
|
||||||
{
|
{
|
||||||
if (texture)
|
if (texture)
|
||||||
{
|
{
|
||||||
|
|
@ -179,7 +171,7 @@ void GuiToolboxButtonCtrl::renderStateRect( GFXTexHandle &texture, const RectI&
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
void GuiToolboxButtonCtrl::renderButton(GFXTexHandle &texture, Point2I &offset, const RectI& updateRect)
|
void GuiToolboxButtonCtrl::renderButton(GFXTexHandle texture, Point2I &offset, const RectI& updateRect)
|
||||||
{
|
{
|
||||||
if (texture)
|
if (texture)
|
||||||
{
|
{
|
||||||
|
|
@ -194,6 +186,6 @@ void GuiToolboxButtonCtrl::renderButton(GFXTexHandle &texture, Point2I &offset,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEF_ASSET_BINDS(GuiToolboxButtonCtrl, NormalBitmap);
|
DEF_ASSET_BINDS_REFACTOR(GuiToolboxButtonCtrl, NormalBitmap)
|
||||||
DEF_ASSET_BINDS(GuiToolboxButtonCtrl, LoweredBitmap);
|
DEF_ASSET_BINDS_REFACTOR(GuiToolboxButtonCtrl, LoweredBitmap)
|
||||||
DEF_ASSET_BINDS(GuiToolboxButtonCtrl, HoverBitmap);
|
DEF_ASSET_BINDS_REFACTOR(GuiToolboxButtonCtrl, HoverBitmap)
|
||||||
|
|
|
||||||
|
|
@ -39,19 +39,12 @@ private:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, NormalBitmap, onNormalImageChanged, GFXDefaultGUIProfile);
|
DECLARE_IMAGEASSET_REFACTOR(GuiToolboxButtonCtrl, NormalBitmap, GFXDefaultGUIProfile)
|
||||||
DECLARE_ASSET_SETGET(GuiToolboxButtonCtrl, NormalBitmap);
|
DECLARE_IMAGEASSET_REFACTOR(GuiToolboxButtonCtrl, LoweredBitmap, GFXDefaultGUIProfile)
|
||||||
DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, LoweredBitmap, onLoweredImageChanged, GFXDefaultGUIProfile);
|
DECLARE_IMAGEASSET_REFACTOR(GuiToolboxButtonCtrl, HoverBitmap, GFXDefaultGUIProfile)
|
||||||
DECLARE_ASSET_SETGET(GuiToolboxButtonCtrl, LoweredBitmap);
|
|
||||||
DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, HoverBitmap, onHoverImageChanged, GFXDefaultGUIProfile);
|
|
||||||
DECLARE_ASSET_SETGET(GuiToolboxButtonCtrl, HoverBitmap);
|
|
||||||
|
|
||||||
void renderButton(GFXTexHandle &texture, Point2I &offset, const RectI& updateRect);
|
void renderButton(GFXTexHandle texture, Point2I &offset, const RectI& updateRect);
|
||||||
void renderStateRect( GFXTexHandle &texture, const RectI& rect );
|
void renderStateRect( GFXTexHandle texture, const RectI& rect );
|
||||||
|
|
||||||
void onNormalImageChanged() {}
|
|
||||||
void onLoweredImageChanged() {}
|
|
||||||
void onHoverImageChanged() {}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DECLARE_CONOBJECT(GuiToolboxButtonCtrl);
|
DECLARE_CONOBJECT(GuiToolboxButtonCtrl);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue