mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 05:31:07 +03:00
feat(ui): implement CSimpleFrame_EnableMouse
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
This commit is contained in:
parent
b9f2c60966
commit
c4077daa3f
@ -100,6 +100,18 @@ void CSimpleFrame::DisableDrawLayer(uint32_t drawlayer) {
|
||||
this->NotifyDrawLayerChanged(drawlayer);
|
||||
}
|
||||
|
||||
void CSimpleFrame::DisableEvent(CSimpleEventType eventType) {
|
||||
if (!(this->m_eventmask & (1 << eventType))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->m_visible) {
|
||||
this->m_top->UnregisterForEvent(this, eventType, 0);
|
||||
}
|
||||
|
||||
this->m_eventmask &= ~(1 << eventType);
|
||||
}
|
||||
|
||||
void CSimpleFrame::EnableDrawLayer(uint32_t drawlayer) {
|
||||
this->m_drawenabled[drawlayer] = 1;
|
||||
this->NotifyDrawLayerChanged(drawlayer);
|
||||
|
||||
@ -123,6 +123,7 @@ class CSimpleFrame : public CScriptRegion {
|
||||
CSimpleFrame(CSimpleFrame* parent);
|
||||
void AddFrameRegion(CSimpleRegion* region, uint32_t drawlayer);
|
||||
void DisableDrawLayer(uint32_t drawlayer);
|
||||
void DisableEvent(CSimpleEventType eventType);
|
||||
void EnableDrawLayer(uint32_t drawlayer);
|
||||
void EnableEvent(CSimpleEventType eventType, int32_t priority);
|
||||
int32_t GetHitRect(CRect& rect);
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include "ui/FrameScript.hpp"
|
||||
#include "ui/simple/CSimpleFrame.hpp"
|
||||
#include "util/Lua.hpp"
|
||||
#include "util/StringTo.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
@ -459,7 +460,22 @@ int32_t CSimpleFrame_IsKeyboardEnabled(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t CSimpleFrame_EnableMouse(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
auto type = CSimpleFrame::GetObjectType();
|
||||
auto frame = static_cast<CSimpleFrame*>(FrameScript_GetObjectThis(L, type));
|
||||
|
||||
if (!frame->ProtectedFunctionsAllowed()) {
|
||||
// TODO disallowed logic
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (StringToBOOL(L, 2, 1)) {
|
||||
frame->EnableEvent(SIMPLE_EVENT_MOUSE, -1);
|
||||
} else {
|
||||
frame->DisableEvent(SIMPLE_EVENT_MOUSE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t CSimpleFrame_IsMouseEnabled(lua_State* L) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user