51 lines
1.6 KiB
C++
51 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <XCEditor/Fields/UIEditorNumberField.h>
|
|
|
|
#include <XCEngine/UI/Text/UITextInputController.h>
|
|
#include <XCEngine/UI/Types.h>
|
|
#include <XCEngine/UI/Widgets/UIPropertyEditModel.h>
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace XCEngine::UI::Editor {
|
|
|
|
struct UIEditorNumberFieldInteractionState {
|
|
Widgets::UIEditorNumberFieldState numberFieldState = {};
|
|
::XCEngine::UI::Text::UITextInputState textInputState = {};
|
|
::XCEngine::UI::Widgets::UIPropertyEditModel editModel = {};
|
|
::XCEngine::UI::UIPoint pointerPosition = {};
|
|
bool hasPointerPosition = false;
|
|
};
|
|
|
|
struct UIEditorNumberFieldInteractionResult {
|
|
bool consumed = false;
|
|
bool focusChanged = false;
|
|
bool valueChanged = false;
|
|
bool stepApplied = false;
|
|
bool editStarted = false;
|
|
bool editCommitted = false;
|
|
bool editCommitRejected = false;
|
|
bool editCanceled = false;
|
|
Widgets::UIEditorNumberFieldHitTarget hitTarget = {};
|
|
double valueBefore = 0.0;
|
|
double valueAfter = 0.0;
|
|
double stepDelta = 0.0;
|
|
std::string committedText = {};
|
|
};
|
|
|
|
struct UIEditorNumberFieldInteractionFrame {
|
|
Widgets::UIEditorNumberFieldLayout layout = {};
|
|
UIEditorNumberFieldInteractionResult result = {};
|
|
};
|
|
|
|
UIEditorNumberFieldInteractionFrame UpdateUIEditorNumberFieldInteraction(
|
|
UIEditorNumberFieldInteractionState& state,
|
|
Widgets::UIEditorNumberFieldSpec& spec,
|
|
const ::XCEngine::UI::UIRect& bounds,
|
|
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
|
|
const Widgets::UIEditorNumberFieldMetrics& metrics = {});
|
|
|
|
} // namespace XCEngine::UI::Editor
|