mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-05 15:42:17 +03:00
feat(ui): add CSimpleStatusBar::GetScriptByName
This commit is contained in:
parent
6a4a2110f4
commit
bc2dabeea9
@ -26,6 +26,24 @@ CSimpleStatusBar::CSimpleStatusBar(CSimpleFrame* parent) : CSimpleFrame(parent)
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FrameScript_Object::ScriptIx* CSimpleStatusBar::GetScriptByName(const char* name, ScriptData& data) {
|
||||||
|
auto script = this->CSimpleFrame::GetScriptByName(name, data);
|
||||||
|
|
||||||
|
if (script) {
|
||||||
|
return script;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(name, "OnValueChanged")) {
|
||||||
|
script = &this->m_onValueChanged;
|
||||||
|
data.wrapper = "return function(self,value) %s end";
|
||||||
|
} else if (!SStrCmpI(name, "OnMinMaxChanged")) {
|
||||||
|
script = &this->m_onMinMaxChanged;
|
||||||
|
data.wrapper = "return function(self,min,max) %s end";
|
||||||
|
}
|
||||||
|
|
||||||
|
return script;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t CSimpleStatusBar::GetScriptMetaTable() {
|
int32_t CSimpleStatusBar::GetScriptMetaTable() {
|
||||||
return CSimpleStatusBar::s_metatable;
|
return CSimpleStatusBar::s_metatable;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,23 +5,34 @@
|
|||||||
|
|
||||||
class CSimpleStatusBar : public CSimpleFrame {
|
class CSimpleStatusBar : public CSimpleFrame {
|
||||||
public:
|
public:
|
||||||
// Static variables
|
// Public static variables
|
||||||
static int32_t s_metatable;
|
static int32_t s_metatable;
|
||||||
static int32_t s_objectType;
|
static int32_t s_objectType;
|
||||||
|
|
||||||
// Static functions
|
// Public static functions
|
||||||
static void CreateScriptMetaTable();
|
static void CreateScriptMetaTable();
|
||||||
static int32_t GetObjectType();
|
static int32_t GetObjectType();
|
||||||
static void RegisterScriptMethods(lua_State* L);
|
static void RegisterScriptMethods(lua_State* L);
|
||||||
|
|
||||||
// Member variables
|
// Public virtual member functions
|
||||||
// TODO
|
|
||||||
|
|
||||||
// Virtual member functions
|
|
||||||
virtual int32_t GetScriptMetaTable();
|
virtual int32_t GetScriptMetaTable();
|
||||||
|
virtual ScriptIx* GetScriptByName(const char* name, ScriptData& data);
|
||||||
|
|
||||||
// Member functions
|
// Public member functions
|
||||||
CSimpleStatusBar(CSimpleFrame* parent);
|
CSimpleStatusBar(CSimpleFrame* parent);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Protected member variables
|
||||||
|
uint32_t m_changed : 1;
|
||||||
|
uint32_t m_rangeSet : 1;
|
||||||
|
uint32_t m_valueSet : 1;
|
||||||
|
float m_minValue = 0.0f;
|
||||||
|
float m_maxValue = 0.0f;
|
||||||
|
float m_value = 0.0f;
|
||||||
|
CSimpleTexture* m_barTexture = nullptr;
|
||||||
|
ORIENTATION m_orientation = ORIENTATION_HORIZONTAL;
|
||||||
|
ScriptIx m_onValueChanged;
|
||||||
|
ScriptIx m_onMinMaxChanged;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user