mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
gui image asset refactor
bitmap button popup ctrl ex
This commit is contained in:
parent
f519cff6ff
commit
4d893f51cf
6 changed files with 95 additions and 75 deletions
|
|
@ -860,11 +860,7 @@ void GuiInspectorTypeImageAssetPtr::updatePreviewImage()
|
||||||
{
|
{
|
||||||
if (AssetDatabase.isDeclaredAsset(previewImage))
|
if (AssetDatabase.isDeclaredAsset(previewImage))
|
||||||
{
|
{
|
||||||
ImageAsset* imgAsset = AssetDatabase.acquireAsset<ImageAsset>(previewImage);
|
mPreviewImage->_setBitmap(previewImage);
|
||||||
if (imgAsset && imgAsset->isAssetValid())
|
|
||||||
{
|
|
||||||
mPreviewImage->_setBitmap(imgAsset->getAssetId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -892,11 +888,7 @@ void GuiInspectorTypeImageAssetPtr::setPreviewImage(StringTableEntry assetId)
|
||||||
{
|
{
|
||||||
if (AssetDatabase.isDeclaredAsset(assetId))
|
if (AssetDatabase.isDeclaredAsset(assetId))
|
||||||
{
|
{
|
||||||
ImageAsset* imgAsset = AssetDatabase.acquireAsset<ImageAsset>(assetId);
|
mPreviewImage->_setBitmap(assetId);
|
||||||
if (imgAsset && imgAsset->isAssetValid())
|
|
||||||
{
|
|
||||||
mPreviewImage->_setBitmap(imgAsset->getAssetId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -652,4 +652,39 @@ public:
|
||||||
#define INITPERSISTFIELD_IMAGEASSET_REFACTOR(name, consoleClass, docs) \
|
#define INITPERSISTFIELD_IMAGEASSET_REFACTOR(name, consoleClass, docs) \
|
||||||
addProtectedField(assetText(name, Asset), TypeImageAssetPtrRefactor, Offset(m##name##Asset, consoleClass), _set##name##Data, &defaultProtectedGetFn, assetDoc(name, asset docs.));
|
addProtectedField(assetText(name, Asset), TypeImageAssetPtrRefactor, Offset(m##name##Asset, consoleClass), _set##name##Data, &defaultProtectedGetFn, assetDoc(name, asset docs.));
|
||||||
|
|
||||||
|
|
||||||
|
#define DECLARE_IMAGEASSET_ARRAY_REFACTOR(className, name, profile, max) \
|
||||||
|
private: \
|
||||||
|
AssetPtr<ImageAsset> m##name##Asset[max]; \
|
||||||
|
public: \
|
||||||
|
void _set##name(StringTableEntry _in, const U32& index){ \
|
||||||
|
if(m##name##Asset[index].getAssetId() == _in) \
|
||||||
|
return; \
|
||||||
|
\
|
||||||
|
if(!AssetDatabase.isDeclaredAsset(_in)) \
|
||||||
|
{ \
|
||||||
|
StringTableEntry imageAssetId = ImageAsset::smNoImageAssetFallback; \
|
||||||
|
AssetQuery query; \
|
||||||
|
S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, _in); \
|
||||||
|
if (foundAssetcount != 0) \
|
||||||
|
{ \
|
||||||
|
imageAssetId = query.mAssetList[0]; \
|
||||||
|
} \
|
||||||
|
m##name##Asset[index] = imageAssetId; \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
m##name##Asset[index] = _in; \
|
||||||
|
} \
|
||||||
|
}; \
|
||||||
|
\
|
||||||
|
inline StringTableEntry _get##name(const U32& index) const { return m##name##Asset[index].getAssetId(); } \
|
||||||
|
GFXTexHandle get##name(const U32& index) { return m##name##Asset[index].notNull() ? m##name##Asset[index]->getTexture(&profile) : NULL; } \
|
||||||
|
AssetPtr<ImageAsset> get##name##Asset(const U32& index) { return m##name##Asset[index]; } \
|
||||||
|
static bool _set##name##Data(void* obj, const char* index, const char* data) { static_cast<className*>(obj)->_set##name(_getStringTable()->insert(data), dAtoi(index)); return false;}
|
||||||
|
|
||||||
|
#define INITPERSISTFIELD_IMAGEASSET_ARRAY_REFACTOR(name, arraySize, consoleClass, docs) \
|
||||||
|
addProtectedField(assetText(name, Asset), TypeImageAssetPtrRefactor, Offset(m##name##Asset, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, asset docs.));
|
||||||
|
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,9 @@ GuiBitmapButtonCtrl::GuiBitmapButtonCtrl()
|
||||||
setExtent( 140, 30 );
|
setExtent( 140, 30 );
|
||||||
mMasked = false;
|
mMasked = false;
|
||||||
mColor = ColorI::WHITE;
|
mColor = ColorI::WHITE;
|
||||||
INIT_ASSET(Bitmap);
|
mBitmapName = StringTable->EmptyString();
|
||||||
|
mBitmap = NULL;
|
||||||
|
mBitmapAsset.registerRefreshNotify(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -139,14 +141,10 @@ void GuiBitmapButtonCtrl::initPersistFields()
|
||||||
docsURL;
|
docsURL;
|
||||||
addGroup( "Bitmap" );
|
addGroup( "Bitmap" );
|
||||||
|
|
||||||
addProtectedField("Bitmap", TypeImageFilename, Offset(mBitmapName, GuiBitmapButtonCtrl), _setBitmapFieldData, &defaultProtectedGetFn, "Texture file to display on this button.\n"
|
INITPERSISTFIELD_IMAGEASSET_REFACTOR(Bitmap, GuiBitmapButtonCtrl,"Texture file to display on this button.\n"
|
||||||
"If useStates is false, this will be the file that renders on the control. Otherwise, this will "
|
"If useStates is false, this will be the file that renders on the control. Otherwise, this will "
|
||||||
"specify the default texture name to which the various state and modifier suffixes are appended "
|
"specify the default texture name to which the various state and modifier suffixes are appended "
|
||||||
"to find the per-state and per-modifier (if enabled) textures.", AbstractClassRep::FIELD_HideInInspectors); \
|
"to find the per-state and per-modifier (if enabled) textures.")
|
||||||
addProtectedField("BitmapAsset", TypeImageAssetId, Offset(mBitmapAssetId, GuiBitmapButtonCtrl), _setBitmapFieldData, &defaultProtectedGetFn, "Texture file to display on this button.\n"
|
|
||||||
"If useStates is false, this will be the file that renders on the control. Otherwise, this will "
|
|
||||||
"specify the default texture name to which the various state and modifier suffixes are appended "
|
|
||||||
"to find the per-state and per-modifier (if enabled) textures.");
|
|
||||||
|
|
||||||
addField("color", TypeColorI, Offset(mColor, GuiBitmapButtonCtrl), "color mul");
|
addField("color", TypeColorI, Offset(mColor, GuiBitmapButtonCtrl), "color mul");
|
||||||
|
|
||||||
|
|
@ -184,7 +182,7 @@ bool GuiBitmapButtonCtrl::onWake()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
setActive( true );
|
setActive( true );
|
||||||
setBitmap( getBitmap() );
|
setBitmap( mBitmapName );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -242,7 +240,7 @@ void GuiBitmapButtonCtrl::inspectPostApply()
|
||||||
{
|
{
|
||||||
Parent::inspectPostApply();
|
Parent::inspectPostApply();
|
||||||
|
|
||||||
setBitmap(getBitmap());
|
setBitmap(mBitmapName);
|
||||||
|
|
||||||
// if the extent is set to (0,0) in the gui editor and appy hit, this control will
|
// if the extent is set to (0,0) in the gui editor and appy hit, this control will
|
||||||
// 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)
|
||||||
|
|
@ -274,7 +272,7 @@ void GuiBitmapButtonCtrl::setBitmap( StringTableEntry name )
|
||||||
|
|
||||||
if( mBitmapAsset.notNull())
|
if( mBitmapAsset.notNull())
|
||||||
{
|
{
|
||||||
if( dStricmp( getBitmap(), "texhandle" ) != 0 )
|
if( dStricmp( mBitmapName, "texhandle" ) != 0 )
|
||||||
{
|
{
|
||||||
const U32 count = mUseModifiers ? NumModifiers : 1;
|
const U32 count = mUseModifiers ? NumModifiers : 1;
|
||||||
for( U32 i = 0; i < count; ++ i )
|
for( U32 i = 0; i < count; ++ i )
|
||||||
|
|
@ -292,7 +290,7 @@ void GuiBitmapButtonCtrl::setBitmap( StringTableEntry name )
|
||||||
static String s_h[2] = { "_h", "_h_image" };
|
static String s_h[2] = { "_h", "_h_image" };
|
||||||
static String s_i[2] = { "_i", "_i_image" };
|
static String s_i[2] = { "_i", "_i_image" };
|
||||||
|
|
||||||
String baseName = mBitmapAssetId;
|
String baseName = mBitmapAsset.getAssetId();
|
||||||
|
|
||||||
//strip any pre-assigned suffix, just in case
|
//strip any pre-assigned suffix, just in case
|
||||||
baseName = baseName.replace("_n_image", "");
|
baseName = baseName.replace("_n_image", "");
|
||||||
|
|
@ -301,7 +299,7 @@ void GuiBitmapButtonCtrl::setBitmap( StringTableEntry name )
|
||||||
if( mUseModifiers )
|
if( mUseModifiers )
|
||||||
baseName += modifiers[ i ];
|
baseName += modifiers[ i ];
|
||||||
|
|
||||||
mTextures[ i ].mTextureNormal = GFXTexHandle( mBitmapAsset->getImageFile(), &GFXDefaultGUIProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__));
|
mTextures[i].mTextureNormal = getBitmap();
|
||||||
|
|
||||||
if( mUseStates )
|
if( mUseStates )
|
||||||
{
|
{
|
||||||
|
|
@ -323,7 +321,7 @@ void GuiBitmapButtonCtrl::setBitmap( StringTableEntry name )
|
||||||
mTextures[i].mTextureNormalAsset->load();
|
mTextures[i].mTextureNormalAsset->load();
|
||||||
if (mTextures[i].mTextureNormalAsset->getStatus() == AssetBase::Ok)
|
if (mTextures[i].mTextureNormalAsset->getStatus() == AssetBase::Ok)
|
||||||
{
|
{
|
||||||
mTextures[i].mTextureNormal = GFXTexHandle(mTextures[i].mTextureNormalAsset->getImageFile(), &GFXDefaultGUIProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__));
|
mTextures[i].mTextureNormal = mTextures[i].mTextureNormalAsset->getTexture(&GFXDefaultGUIProfile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -345,7 +343,7 @@ void GuiBitmapButtonCtrl::setBitmap( StringTableEntry name )
|
||||||
mTextures[i].mTextureHilightAsset->load();
|
mTextures[i].mTextureHilightAsset->load();
|
||||||
if (mTextures[i].mTextureHilightAsset->getStatus() == AssetBase::Ok)
|
if (mTextures[i].mTextureHilightAsset->getStatus() == AssetBase::Ok)
|
||||||
{
|
{
|
||||||
mTextures[i].mTextureHilight = GFXTexHandle(mTextures[i].mTextureHilightAsset->getImageFile(), &GFXDefaultGUIProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__));
|
mTextures[i].mTextureHilight = mTextures[i].mTextureHilightAsset->getTexture(&GFXDefaultGUIProfile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -369,7 +367,7 @@ void GuiBitmapButtonCtrl::setBitmap( StringTableEntry name )
|
||||||
mTextures[i].mTextureDepressedAsset->load();
|
mTextures[i].mTextureDepressedAsset->load();
|
||||||
if (mTextures[i].mTextureDepressedAsset->getStatus() == AssetBase::Ok)
|
if (mTextures[i].mTextureDepressedAsset->getStatus() == AssetBase::Ok)
|
||||||
{
|
{
|
||||||
mTextures[i].mTextureDepressed = GFXTexHandle(mTextures[i].mTextureDepressedAsset->getImageFile(), &GFXDefaultGUIProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__));
|
mTextures[i].mTextureDepressed = mTextures[i].mTextureDepressedAsset->getTexture(&GFXDefaultGUIProfile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -393,7 +391,7 @@ void GuiBitmapButtonCtrl::setBitmap( StringTableEntry name )
|
||||||
mTextures[i].mTextureInactiveAsset->load();
|
mTextures[i].mTextureInactiveAsset->load();
|
||||||
if (mTextures[i].mTextureInactiveAsset->getStatus() == AssetBase::Ok)
|
if (mTextures[i].mTextureInactiveAsset->getStatus() == AssetBase::Ok)
|
||||||
{
|
{
|
||||||
mTextures[i].mTextureInactive = GFXTexHandle(mTextures[i].mTextureInactiveAsset->getImageFile(), &GFXDefaultGUIProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__));
|
mTextures[i].mTextureInactive = mTextures[i].mTextureInactiveAsset->getTexture(&GFXDefaultGUIProfile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -670,4 +668,4 @@ bool GuiBitmapButtonCtrl::pointInControl(const Point2I& parentCoordPoint)
|
||||||
return Parent::pointInControl(parentCoordPoint);
|
return Parent::pointInControl(parentCoordPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEF_ASSET_BINDS(GuiBitmapButtonCtrl, Bitmap);
|
DEF_ASSET_BINDS_REFACTOR(GuiBitmapButtonCtrl, Bitmap)
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
/// To implement different handlers for the modifier states, use the "onDefaultClick",
|
/// To implement different handlers for the modifier states, use the "onDefaultClick",
|
||||||
/// "onCtrlClick", "onAltClick", and "onShiftClick" methods.
|
/// "onCtrlClick", "onAltClick", and "onShiftClick" methods.
|
||||||
///
|
///
|
||||||
class GuiBitmapButtonCtrl : public GuiButtonCtrl
|
class GuiBitmapButtonCtrl : public GuiButtonCtrl, protected AssetPtrCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
@ -118,9 +118,35 @@ class GuiBitmapButtonCtrl : public GuiButtonCtrl
|
||||||
///
|
///
|
||||||
BitmapMode mBitmapMode;
|
BitmapMode mBitmapMode;
|
||||||
|
|
||||||
DECLARE_IMAGEASSET(GuiBitmapButtonCtrl, Bitmap, onBitmapChange, GFXDefaultGUIProfile);
|
private: AssetPtr<ImageAsset> mBitmapAsset; public: void _setBitmap(StringTableEntry _in) {
|
||||||
DECLARE_ASSET_SETGET(GuiBitmapButtonCtrl, Bitmap);
|
if (mBitmapAsset.getAssetId() == _in) return; if (!AssetDatabase.isDeclaredAsset(_in)) {
|
||||||
|
StringTableEntry imageAssetId = ImageAsset::smNoImageAssetFallback; AssetQuery query; S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, _in); if (foundAssetcount != 0) {
|
||||||
|
imageAssetId = query.mAssetList[0];
|
||||||
|
} mBitmapAsset = imageAssetId;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mBitmapAsset = _in;
|
||||||
|
mBitmapName = _in;
|
||||||
|
mBitmap = getBitmap();
|
||||||
|
}
|
||||||
|
}; inline StringTableEntry _getBitmap(void) const {
|
||||||
|
return mBitmapAsset.getAssetId();
|
||||||
|
} GFXTexHandle getBitmap() {
|
||||||
|
return mBitmapAsset.notNull() ? mBitmapAsset->getTexture(&GFXDefaultGUIProfile) : 0;
|
||||||
|
} AssetPtr<ImageAsset> getBitmapAsset(void) {
|
||||||
|
return mBitmapAsset;
|
||||||
|
} static bool _setBitmapData(void* obj, const char* index, const char* data) {
|
||||||
|
static_cast<GuiBitmapButtonCtrl*>(obj)->_setBitmap(_getStringTable()->insert(data)); return false;
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void onAssetRefreshed(AssetPtrBase* pAssetPtrBase) override
|
||||||
|
{
|
||||||
|
setBitmap(mBitmapName);
|
||||||
|
}
|
||||||
|
|
||||||
|
GFXTexHandle mBitmap;
|
||||||
|
StringTableEntry mBitmapName;
|
||||||
/// alpha masking
|
/// alpha masking
|
||||||
bool mMasked;
|
bool mMasked;
|
||||||
|
|
||||||
|
|
@ -158,11 +184,6 @@ class GuiBitmapButtonCtrl : public GuiButtonCtrl
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
void onBitmapChange()
|
|
||||||
{
|
|
||||||
setBitmap(getBitmap());
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
GuiBitmapButtonCtrl();
|
GuiBitmapButtonCtrl();
|
||||||
|
|
@ -185,14 +206,6 @@ class GuiBitmapButtonCtrl : public GuiButtonCtrl
|
||||||
DECLARE_CONOBJECT(GuiBitmapButtonCtrl);
|
DECLARE_CONOBJECT(GuiBitmapButtonCtrl);
|
||||||
DECLARE_DESCRIPTION( "A button control rendered entirely from bitmaps.\n"
|
DECLARE_DESCRIPTION( "A button control rendered entirely from bitmaps.\n"
|
||||||
"The individual button states are represented with separate bitmaps." );
|
"The individual button states are represented with separate bitmaps." );
|
||||||
|
|
||||||
//Basically a wrapper function to do our special state handling setup when the fields change
|
|
||||||
static bool _setBitmapFieldData(void* obj, const char* index, const char* data)
|
|
||||||
{
|
|
||||||
GuiBitmapButtonCtrl* object = static_cast<GuiBitmapButtonCtrl*>(obj);
|
|
||||||
object->setBitmap(StringTable->insert(data));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef GuiBitmapButtonCtrl::BitmapMode GuiBitmapMode;
|
typedef GuiBitmapButtonCtrl::BitmapMode GuiBitmapMode;
|
||||||
|
|
|
||||||
|
|
@ -329,9 +329,6 @@ GuiPopUpMenuCtrlEx::GuiPopUpMenuCtrlEx(void)
|
||||||
mBackgroundCancel = false; // Added
|
mBackgroundCancel = false; // Added
|
||||||
mReverseTextList = false; // Added - Don't reverse text list if displaying up
|
mReverseTextList = false; // Added - Don't reverse text list if displaying up
|
||||||
|
|
||||||
INIT_IMAGEASSET_ARRAY(Bitmap, GFXDefaultGUIProfile, Normal);
|
|
||||||
INIT_IMAGEASSET_ARRAY(Bitmap, GFXDefaultGUIProfile, Depressed);
|
|
||||||
|
|
||||||
mBitmapBounds.set(16, 16); // Added
|
mBitmapBounds.set(16, 16); // Added
|
||||||
mHotTrackItems = false;
|
mHotTrackItems = false;
|
||||||
mIdMax = -1;
|
mIdMax = -1;
|
||||||
|
|
@ -356,8 +353,7 @@ void GuiPopUpMenuCtrlEx::initPersistFields(void)
|
||||||
addField("sbUsesNAColor", TypeBool, Offset(mRenderScrollInNA, GuiPopUpMenuCtrlEx), "Deprecated" "@internal");
|
addField("sbUsesNAColor", TypeBool, Offset(mRenderScrollInNA, GuiPopUpMenuCtrlEx), "Deprecated" "@internal");
|
||||||
addField("reverseTextList", TypeBool, Offset(mReverseTextList, GuiPopUpMenuCtrlEx), "Reverses text list if popup extends up, instead of down");
|
addField("reverseTextList", TypeBool, Offset(mReverseTextList, GuiPopUpMenuCtrlEx), "Reverses text list if popup extends up, instead of down");
|
||||||
|
|
||||||
addProtectedField("bitmap", TypeImageFilename, Offset(mBitmapName, GuiPopUpMenuCtrlEx), _setBitmaps, &defaultProtectedGetFn, "File name of bitmap to use");
|
INITPERSISTFIELD_IMAGEASSET_ARRAY_REFACTOR(Bitmap, NumBitmapModes, GuiPopUpMenuCtrlEx, "Name of bitmap asset to use")
|
||||||
addProtectedField("bitmapAsset", TypeImageAssetId, Offset(mBitmapAssetId, GuiPopUpMenuCtrlEx), _setBitmaps, &defaultProtectedGetFn, "Name of bitmap asset to use");
|
|
||||||
|
|
||||||
addField("bitmapBounds", TypePoint2I, Offset(mBitmapBounds, GuiPopUpMenuCtrlEx), "Boundaries of bitmap displayed");
|
addField("bitmapBounds", TypePoint2I, Offset(mBitmapBounds, GuiPopUpMenuCtrlEx), "Boundaries of bitmap displayed");
|
||||||
addField("hotTrackCallback", TypeBool, Offset(mHotTrackItems, GuiPopUpMenuCtrlEx),
|
addField("hotTrackCallback", TypeBool, Offset(mHotTrackItems, GuiPopUpMenuCtrlEx),
|
||||||
|
|
@ -368,14 +364,6 @@ void GuiPopUpMenuCtrlEx::initPersistFields(void)
|
||||||
Parent::initPersistFields();
|
Parent::initPersistFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GuiPopUpMenuCtrlEx::_setBitmaps(void* obj, const char* index, const char* data)
|
|
||||||
{
|
|
||||||
GuiPopUpMenuCtrlEx* object = static_cast<GuiPopUpMenuCtrlEx*>(obj);
|
|
||||||
|
|
||||||
object->setBitmap(data);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
ConsoleDocFragment _GuiPopUpMenuCtrlExAdd(
|
ConsoleDocFragment _GuiPopUpMenuCtrlExAdd(
|
||||||
"@brief Adds an entry to the list\n\n"
|
"@brief Adds an entry to the list\n\n"
|
||||||
|
|
@ -690,9 +678,6 @@ bool GuiPopUpMenuCtrlEx::onWake()
|
||||||
if ( !Parent::onWake() )
|
if ( !Parent::onWake() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Set the bitmap for the popup.
|
|
||||||
setBitmap(getBitmap(Normal));
|
|
||||||
|
|
||||||
// Now update the Form Control's bitmap array, and possibly the child's too
|
// Now update the Form Control's bitmap array, and possibly the child's too
|
||||||
mProfile->constructBitmapArray();
|
mProfile->constructBitmapArray();
|
||||||
|
|
||||||
|
|
@ -818,8 +803,8 @@ void GuiPopUpMenuCtrlEx::setBitmap(const char *name)
|
||||||
dStrcpy(p, "_d", pLen);
|
dStrcpy(p, "_d", pLen);
|
||||||
_setBitmap((StringTableEntry)buffer, Depressed);
|
_setBitmap((StringTableEntry)buffer, Depressed);
|
||||||
|
|
||||||
if (!mBitmap[Depressed])
|
if (mBitmapAsset[Depressed].isNull())
|
||||||
mBitmap[Depressed] = mBitmap[Normal];
|
mBitmapAsset[Depressed] = mBitmapAsset[Normal];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1096,17 +1081,17 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a bitmap over the background?
|
// Draw a bitmap over the background?
|
||||||
if ( mBitmap[Depressed] )
|
if ( mBitmapAsset[Depressed].notNull() )
|
||||||
{
|
{
|
||||||
RectI rect(offset, mBitmapBounds);
|
RectI rect(offset, mBitmapBounds);
|
||||||
drawUtil->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
drawUtil->drawBitmapStretch(mBitmap[Depressed], rect );
|
drawUtil->drawBitmapStretch(getBitmap(Depressed), rect );
|
||||||
}
|
}
|
||||||
else if (mBitmap[Normal])
|
else if (mBitmapAsset[Normal].notNull())
|
||||||
{
|
{
|
||||||
RectI rect(offset, mBitmapBounds);
|
RectI rect(offset, mBitmapBounds);
|
||||||
drawUtil->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
drawUtil->drawBitmapStretch(mBitmap[Normal], rect );
|
drawUtil->drawBitmapStretch(getBitmap(Normal), rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we render a bitmap border or lines?
|
// Do we render a bitmap border or lines?
|
||||||
|
|
@ -1140,11 +1125,11 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a bitmap over the background?
|
// Draw a bitmap over the background?
|
||||||
if (mBitmap[Normal])
|
if (mBitmapAsset[Normal].notNull())
|
||||||
{
|
{
|
||||||
RectI rect( offset, mBitmapBounds );
|
RectI rect( offset, mBitmapBounds );
|
||||||
drawUtil->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
drawUtil->drawBitmapStretch(mBitmap[Normal], rect );
|
drawUtil->drawBitmapStretch(getBitmap(Normal), rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we render a bitmap border or lines?
|
// Do we render a bitmap border or lines?
|
||||||
|
|
@ -1170,11 +1155,11 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a bitmap over the background?
|
// Draw a bitmap over the background?
|
||||||
if (mBitmap[Normal])
|
if (mBitmapAsset[Normal].notNull())
|
||||||
{
|
{
|
||||||
RectI rect(offset, mBitmapBounds);
|
RectI rect(offset, mBitmapBounds);
|
||||||
drawUtil->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
drawUtil->drawBitmapStretch(mBitmap[Normal], rect );
|
drawUtil->drawBitmapStretch(getBitmap(Normal), rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we render a bitmap border or lines?
|
// Do we render a bitmap border or lines?
|
||||||
|
|
|
||||||
|
|
@ -131,9 +131,8 @@ class GuiPopUpMenuCtrlEx : public GuiTextCtrl
|
||||||
NumBitmapModes = 2
|
NumBitmapModes = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrlEx, Bitmap, NumBitmapModes, onBitmapChanged);
|
DECLARE_IMAGEASSET_ARRAY_REFACTOR(GuiPopUpMenuCtrlEx, Bitmap, GFXDefaultGUIProfile, NumBitmapModes)
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(GuiPopUpMenuCtrlEx, Bitmap);
|
|
||||||
void onBitmapChanged() {}
|
|
||||||
Point2I mBitmapBounds; // Added
|
Point2I mBitmapBounds; // Added
|
||||||
|
|
||||||
S32 mIdMax;
|
S32 mIdMax;
|
||||||
|
|
@ -144,8 +143,6 @@ class GuiPopUpMenuCtrlEx : public GuiTextCtrl
|
||||||
virtual void removeChildren();
|
virtual void removeChildren();
|
||||||
virtual void repositionPopup();
|
virtual void repositionPopup();
|
||||||
|
|
||||||
static bool _setBitmaps(void* obj, const char* index, const char* data);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GuiPopUpMenuCtrlEx(void);
|
GuiPopUpMenuCtrlEx(void);
|
||||||
~GuiPopUpMenuCtrlEx();
|
~GuiPopUpMenuCtrlEx();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue