mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(ui): implement CSimpleCheckbox_GetChecked
This commit is contained in:
parent
b2297d96d9
commit
1cd1bb5672
@ -34,3 +34,7 @@ bool CSimpleCheckbox::IsA(int32_t type) {
|
||||
|| type == CScriptRegion::s_objectType
|
||||
|| type == CScriptObject::s_objectType;
|
||||
}
|
||||
|
||||
int32_t CSimpleCheckbox::GetChecked() {
|
||||
return this->m_checked;
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ class CSimpleCheckbox : public CSimpleButton {
|
||||
// Member functions
|
||||
CSimpleCheckbox(CSimpleFrame* parent)
|
||||
: CSimpleButton(parent) {};
|
||||
int32_t GetChecked();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
#include "ui/CSimpleCheckboxScript.hpp"
|
||||
#include "ui/CSimpleCheckbox.hpp"
|
||||
#include "util/Lua.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
@ -7,7 +9,16 @@ int32_t CSimpleCheckbox_SetChecked(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t CSimpleCheckbox_GetChecked(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
auto type = CSimpleCheckbox::GetObjectType();
|
||||
auto checkbox = static_cast<CSimpleCheckbox*>(FrameScript_GetObjectThis(L, type));
|
||||
|
||||
if (checkbox->GetChecked()) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t CSimpleCheckbox_GetCheckedTexture(lua_State* L) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user