mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-02 00:32:45 +03:00
feat(ui): implement CSimpleButton_SetHighlightFontObject
This commit is contained in:
parent
c7b9629f41
commit
54b2cdb678
@ -159,7 +159,28 @@ int32_t CSimpleButton_GetDisabledFontObject(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleButton_SetHighlightFontObject(lua_State* L) {
|
int32_t CSimpleButton_SetHighlightFontObject(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
auto type = CSimpleButton::GetObjectType();
|
||||||
|
auto button = static_cast<CSimpleButton*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
|
CSimpleFont* font = nullptr;
|
||||||
|
|
||||||
|
if (lua_type(L, 2) == LUA_TSTRING) {
|
||||||
|
auto fontName = lua_tostring(L, 2);
|
||||||
|
font = CSimpleFont::GetFont(fontName, 0);
|
||||||
|
} else if (lua_type(L, 2) == LUA_TTABLE) {
|
||||||
|
lua_rawgeti(L, 2, 0);
|
||||||
|
font = static_cast<CSimpleFont*>(lua_touserdata(L, -1));
|
||||||
|
lua_settop(L, -2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!button || !font || !font->IsA(CSimpleFont::GetObjectType())) {
|
||||||
|
return luaL_error(L, "Usage: %s:SetHighlightFontObject(\"fontname\")", button->GetDisplayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
button->m_highlightFont = font;
|
||||||
|
button->UpdateTextState(button->m_state);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleButton_GetHighlightFontObject(lua_State* L) {
|
int32_t CSimpleButton_GetHighlightFontObject(lua_State* L) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user