Changes for BaseUI Update

This commit is contained in:
JeffR 2022-02-17 18:04:31 -06:00
parent 90951b3cc8
commit ed36cf2c5c
20 changed files with 156 additions and 45 deletions

View file

@ -137,7 +137,7 @@ class GuiBitmapButtonCtrl : public GuiButtonCtrl
if( mActive )
{
if( mDepressed || mStateOn ) return DEPRESSED;
if( mMouseOver ) return HILIGHT;
if( mHighlighted ) return HILIGHT;
return NORMAL;
}
else

View file

@ -79,7 +79,7 @@ void GuiBorderButtonCtrl::onRender(Point2I offset, const RectI &updateRect)
}
}
if ( mMouseOver )
if ( mHighlighted )
{
RectI bounds( offset, getExtent() );
for ( S32 i=0; i < mProfile->mBorderThickness; i++ )

View file

@ -98,7 +98,7 @@ EndImplementEnumType;
GuiButtonBaseCtrl::GuiButtonBaseCtrl()
{
mDepressed = false;
mMouseOver = false;
mHighlighted = false;
mActive = true;
static StringTableEntry sButton = StringTable->insert( "Button" );
mButtonText = sButton;
@ -288,14 +288,14 @@ void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent &event)
if(isMouseLocked())
{
mDepressed = true;
mMouseOver = true;
mHighlighted = true;
}
else
{
if ( mActive && mProfile->mSoundButtonOver )
SFX->playOnce(mProfile->mSoundButtonOver);
mMouseOver = true;
mHighlighted = true;
}
}
@ -309,7 +309,7 @@ void GuiButtonBaseCtrl::onMouseLeave(const GuiEvent &)
onMouseLeave_callback();
if( isMouseLocked() )
mDepressed = false;
mMouseOver = false;
mHighlighted = false;
}
//-----------------------------------------------------------------------------
@ -542,3 +542,17 @@ DefineEngineMethod( GuiButtonBaseCtrl, resetState, void, (),,
{
object->resetState();
}
DefineEngineMethod(GuiButtonBaseCtrl, setHighlighted, void, (bool highlighted), (false),
"Reset the mousing state of the button.\n\n"
"This method should not generally be called.")
{
object->setHighlighted(highlighted);
}
DefineEngineMethod(GuiButtonBaseCtrl, isHighlighted, bool, (),,
"Reset the mousing state of the button.\n\n"
"This method should not generally be called.")
{
return object->isHighlighted();
}

View file

@ -49,7 +49,7 @@ class GuiButtonBaseCtrl : public GuiControl
StringTableEntry mButtonText;
StringTableEntry mButtonTextID;
bool mDepressed;
bool mMouseOver;
bool mHighlighted;
bool mStateOn;
S32 mButtonType;
S32 mRadioGroup;
@ -95,7 +95,10 @@ class GuiButtonBaseCtrl : public GuiControl
bool getStateOn() const { return mStateOn; }
void setDepressed( bool depressed ) { mDepressed = depressed; }
void resetState() {mDepressed = false; mMouseOver = false;}
void resetState() {mDepressed = false; mHighlighted = false;}
void setHighlighted(bool highlighted) { mHighlighted = highlighted; }
bool isHighlighted() { return mHighlighted; }
void acceleratorKeyPress(U32 index);
void acceleratorKeyRelease(U32 index);

View file

@ -83,7 +83,7 @@ bool GuiButtonCtrl::onWake()
void GuiButtonCtrl::onRender(Point2I offset,
const RectI& updateRect)
{
bool highlight = mMouseOver;
bool highlight = mHighlighted;
bool depressed = mDepressed;
ColorI fontColor = mActive ? ( highlight ? mProfile->mFontColorHL : mProfile->mFontColor ) : mProfile->mFontColorNA;
@ -107,7 +107,7 @@ void GuiButtonCtrl::onRender(Point2I offset,
indexMultiplier = 4;
else if ( mDepressed || mStateOn )
indexMultiplier = 2;
else if ( mMouseOver )
else if ( mHighlighted )
indexMultiplier = 3;
renderSizableBitmapBordersFilled( boundsRect, indexMultiplier, mProfile );
@ -123,3 +123,4 @@ void GuiButtonCtrl::onRender(Point2I offset,
//render the children
renderChildControls( offset, updateRect);
}

View file

@ -106,7 +106,7 @@ void GuiCheckBoxCtrl::onRender(Point2I offset, const RectI &updateRect)
}
ColorI backColor = mActive ? mProfile->mFillColor : mProfile->mFillColorNA;
ColorI fontColor = mActive ? (mMouseOver ? mProfile->mFontColorHL : mProfile->mFontColor) : mProfile->mFontColorNA;
ColorI fontColor = mActive ? (mHighlighted ? mProfile->mFontColorHL : mProfile->mFontColor) : mProfile->mFontColorNA;
ColorI insideBorderColor = isFirstResponder() ? mProfile->mBorderColorHL : mProfile->mBorderColor;
// just draw the check box and the text:

View file

@ -218,7 +218,7 @@ void GuiIconButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
{
bool highlight = mMouseOver;
bool highlight = mHighlighted;
bool depressed = mDepressed;
ColorI fontColor = mActive ? (highlight ? mProfile->mFontColorHL : mProfile->mFontColor) : mProfile->mFontColorNA;
@ -236,7 +236,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
else
renderSlightlyLoweredBox(boundsRect, mProfile);
}
else if(mMouseOver && mActive)
else if(mHighlighted && mActive)
{
// If there is a bitmap array then render using it.
// Otherwise use a standard fill.

View file

@ -90,7 +90,7 @@ bool GuiSwatchButtonCtrl::onWake()
void GuiSwatchButtonCtrl::onRender( Point2I offset, const RectI &updateRect )
{
bool highlight = mMouseOver;
bool highlight = mHighlighted;
ColorI borderColor = mActive ? ( highlight ? mProfile->mBorderColorHL : mProfile->mBorderColor ) : mProfile->mBorderColorNA;

View file

@ -66,7 +66,7 @@ void GuiToggleButtonCtrl::onPreRender()
void GuiToggleButtonCtrl::onRender(Point2I offset,
const RectI& updateRect)
{
bool highlight = mMouseOver;
bool highlight = mHighlighted;
bool depressed = mDepressed;
ColorI fontColor = mActive ? ( highlight ? mProfile->mFontColorHL : mProfile->mFontColor ) : mProfile->mFontColorNA;
@ -89,7 +89,7 @@ void GuiToggleButtonCtrl::onRender(Point2I offset,
indexMultiplier = 4;
else if ( mDepressed || mStateOn )
indexMultiplier = 2;
else if ( mMouseOver )
else if ( mHighlighted )
indexMultiplier = 3;

View file

@ -144,7 +144,7 @@ void GuiToolboxButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
RectI r(offset, getExtent());
if ( mDepressed || mStateOn )
renderStateRect( mLoweredBitmap , r );
else if ( mMouseOver )
else if ( mHighlighted )
renderStateRect( mHoverBitmap , r );
}