mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 08:12:44 +03:00
feat(ui): stub CSimpleEditBox::DispatchAction
This commit is contained in:
parent
66ffd99696
commit
a7a221af38
8
src/ui/CObserver.hpp
Normal file
8
src/ui/CObserver.hpp
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef UI_C_OBSERVER_HPP
|
||||
#define UI_C_OBSERVER_HPP
|
||||
|
||||
class CObserver {
|
||||
// TODO
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -135,8 +135,9 @@ CSimpleEditBox::CSimpleEditBox(CSimpleFrame* parent) : CSimpleFrame(parent) {
|
||||
CImVector cursorColor = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
this->m_cursor->SetTexture(cursorColor);
|
||||
|
||||
// TODO
|
||||
// - initialize actions
|
||||
for (auto& action : this->m_actions) {
|
||||
action.obj = nullptr;
|
||||
}
|
||||
|
||||
this->EnableEvent(SIMPLE_EVENT_CHAR, -1);
|
||||
this->EnableEvent(SIMPLE_EVENT_KEY, -1);
|
||||
@ -301,6 +302,10 @@ LABEL_12:
|
||||
}
|
||||
}
|
||||
|
||||
void CSimpleEditBox::DispatchAction(int32_t action) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CSimpleEditBox::FontUpdated(CSimpleFontedFrameFont* font, int32_t a3) {
|
||||
// TODO
|
||||
}
|
||||
@ -766,12 +771,12 @@ void CSimpleEditBox::OnEnterPressed() {
|
||||
|
||||
void CSimpleEditBox::OnEscapePressed() {
|
||||
this->RunOnEscapePressedScript();
|
||||
// TODO this->DispatchAction(EVENT_ESCAPE);
|
||||
this->DispatchAction(EVENT_ESCAPE);
|
||||
}
|
||||
|
||||
void CSimpleEditBox::OnTabPressed() {
|
||||
this->RunOnTabPressedScript();
|
||||
// TODO this->DispatchAction(EVENT_TAB);
|
||||
this->DispatchAction(EVENT_TAB);
|
||||
}
|
||||
|
||||
void CSimpleEditBox::OnFrameSizeChanged(float width, float height) {
|
||||
|
||||
@ -4,11 +4,23 @@
|
||||
#include "ui/CSimpleFrame.hpp"
|
||||
#include "ui/CSimpleFontedFrame.hpp"
|
||||
|
||||
class CObserver;
|
||||
class CSimpleFontString;
|
||||
class CSimpleTexture;
|
||||
|
||||
class CSimpleEditBox : public CSimpleFrame, CSimpleFontedFrame {
|
||||
public:
|
||||
// Enums
|
||||
enum {
|
||||
EVENT_ENTER = 0,
|
||||
EVENT_ESCAPE = 1,
|
||||
EVENT_SPACE = 2,
|
||||
EVENT_TAB = 3,
|
||||
EVENT_CHANGED = 4,
|
||||
EVENT_SET = 5,
|
||||
NUM_EDITBOX_ACTIONS,
|
||||
};
|
||||
|
||||
// Static variables
|
||||
static CSimpleEditBox* s_currentFocus;
|
||||
static int32_t s_metatable;
|
||||
@ -48,6 +60,10 @@ class CSimpleEditBox : public CSimpleFrame, CSimpleFontedFrame {
|
||||
float m_cursorBlinkSpeed = 0.5f;
|
||||
float m_blinkElapsedTime = 0.0f;
|
||||
TSGrowableArray<uint32_t> m_visibleLines;
|
||||
struct {
|
||||
uint32_t id;
|
||||
CObserver* obj;
|
||||
} m_actions[NUM_EDITBOX_ACTIONS];
|
||||
int32_t m_imeInputMode = 0;
|
||||
CRect m_editTextInset = {};
|
||||
ScriptIx m_onEnterPressed;
|
||||
@ -83,6 +99,7 @@ class CSimpleEditBox : public CSimpleFrame, CSimpleFontedFrame {
|
||||
void DeleteForward(int32_t a2);
|
||||
void DeleteHighlight(int32_t a2);
|
||||
void DeleteSubstring(int32_t left, int32_t right, int32_t a4);
|
||||
void DispatchAction(int32_t action);
|
||||
int32_t GetNumToLen(int32_t offset, int32_t amount, bool a4);
|
||||
void GrowText(int32_t size);
|
||||
void Insert(uint32_t chr);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user