Batch #1893 by Yommy: 0 byte-identical, 4 confirmed by peer review. - fn_10749 UIEditCtrl::SetCursor: logic confirmed by peer review - fn_16982 ParseColorCode: logic confirmed by peer review - fn_13882 ExtractTextTags: logic confirmed by peer review - fn_13875 BuildTextTagRegistry: logic confirmed by peer review Reviewed-by: ragnarok-clanker Adds to the build: Source/UI/TextTagRegistry.cpp, Source/UI/TextTagExtraction.cpp
141 lines
4.2 KiB
C++
141 lines
4.2 KiB
C++
#ifndef RAGNAROK_SOURCE_UI_EDIT_UIEDITCTRL_H
|
|
#define RAGNAROK_SOURCE_UI_EDIT_UIEDITCTRL_H
|
|
|
|
#include "UI/Window/UIWindow.h"
|
|
|
|
#include <string>
|
|
|
|
struct InputFocus;
|
|
struct TextInputBuffer;
|
|
struct InputCharset;
|
|
struct UIButtonContext;
|
|
struct BitmapImage;
|
|
class WindowManagerWindows;
|
|
class NavigationDestination;
|
|
class UINaviLinkButton;
|
|
|
|
struct UIEditContext {
|
|
InputFocus& focus;
|
|
TextInputBuffer& input;
|
|
unsigned char& password;
|
|
const InputCharset& charset;
|
|
UIButtonContext& buttons;
|
|
WindowManagerWindows& windows;
|
|
NavigationDestination& navigation;
|
|
const BitmapImage& colorChip;
|
|
const int& candidateCursor;
|
|
UIWindow* const& candidateWindow;
|
|
UIWindow* const& readingWindow;
|
|
UIWindow* const& otherChatInput;
|
|
const bool& linkInputRestricted;
|
|
UIWindow* const& permittedLinkInput;
|
|
const int& screenWidth;
|
|
const int& screenHeight;
|
|
};
|
|
|
|
class UIEditCtrl : public UIWindow {
|
|
public:
|
|
UIEditCtrl(UIWindowContext& windows, UIEditContext& edit);
|
|
~UIEditCtrl() override;
|
|
bool Slot05() override;
|
|
void Paint() override;
|
|
void Slot23() override;
|
|
void Slot24(int retained) override;
|
|
void Slot25(int x, int y) override;
|
|
void Slot28(int x, int y) override;
|
|
int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override;
|
|
int Slot46() override;
|
|
virtual void SetText(const char* value);
|
|
virtual void SelectAll();
|
|
virtual void PaintText();
|
|
virtual void Synchronize();
|
|
virtual void Trim();
|
|
int Length() const;
|
|
|
|
const char* Text();
|
|
void Background(int red, int green, int blue);
|
|
void TextColor(std::uint32_t primary, std::uint32_t secondary);
|
|
void UpdateLinks();
|
|
void SetCursor(std::size_t position);
|
|
void DrawSelectionAt(int x, int y, int width);
|
|
void DrawSelection(int x, int width);
|
|
void MoveCandidateWindow(int x);
|
|
void MoveReadingWindow(int x);
|
|
|
|
/* 007C */ int anchor;
|
|
/* 0080 */ int cursor;
|
|
/* 0084 */ int mask;
|
|
/* 0088 */ int maximum;
|
|
/* 008C */ int flat;
|
|
/* 0090 */ int red;
|
|
/* 0094 */ int green;
|
|
/* 0098 */ int blue;
|
|
/* 009C */ int borderRed;
|
|
/* 00A0 */ int borderGreen;
|
|
/* 00A4 */ int borderBlue;
|
|
/* 00A8 */ std::uint32_t textColor;
|
|
/* 00AC */ std::uint32_t secondColor;
|
|
/* 00B0 */ int firstVisible;
|
|
/* 00B4 */ int textY;
|
|
/* 00B8 */ int invalidatesParent;
|
|
/* 00BC */ std::string tooltip;
|
|
/* 00D4 */ unsigned char disabled;
|
|
/* 00D8 */ std::string text;
|
|
/* 00F0 */ int unknown_00F0;
|
|
/* 00F4 */ int topPadding;
|
|
/* 00F8 */ unsigned char preserveInput;
|
|
/* 00FC */ std::list<UIWindow*> links;
|
|
/* 0104 */ std::string linkedText;
|
|
|
|
protected:
|
|
UIEditContext* m_edit;
|
|
void PaintTextWithPolicy(bool alternate, const std::string* placeholder, std::uint32_t placeholderColor, bool placeholderEnabled);
|
|
|
|
private:
|
|
bool RemoveInvalidLink(std::list<UIWindow*>::iterator& entry);
|
|
void SnapLinkSelection(std::size_t prefix, std::size_t bytes);
|
|
void InsertLink(const char* value);
|
|
};
|
|
|
|
class UIEditCtrlWheel : public UIEditCtrl {
|
|
public:
|
|
UIEditCtrlWheel(UIWindowContext& windows, UIEditContext& edit);
|
|
~UIEditCtrlWheel() override;
|
|
void Slot35(int value) override;
|
|
};
|
|
|
|
class UIEditCtrl2 : public UIEditCtrl {
|
|
public:
|
|
UIEditCtrl2(UIWindowContext& windows, UIEditContext& edit);
|
|
~UIEditCtrl2() override;
|
|
int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override;
|
|
};
|
|
|
|
class UIEditCtrl4 : public UIEditCtrl {
|
|
public:
|
|
UIEditCtrl4(UIWindowContext& windows, UIEditContext& edit);
|
|
~UIEditCtrl4() override;
|
|
void Slot23() override;
|
|
void PaintText() override;
|
|
|
|
/* 011C */ std::uint32_t placeholderColor;
|
|
/* 0120 */ std::string placeholder;
|
|
/* 0138 */ unsigned char placeholderEnabled;
|
|
};
|
|
|
|
class UIEditCtrl5 : public UIEditCtrl4 {
|
|
public:
|
|
UIEditCtrl5(UIWindowContext& windows, UIEditContext& edit);
|
|
~UIEditCtrl5() override;
|
|
int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override;
|
|
};
|
|
|
|
#if defined(_WIN32) && !defined(_WIN64)
|
|
static_assert(sizeof(UIEditCtrl) == 292);
|
|
static_assert(sizeof(UIEditCtrlWheel) == 292);
|
|
static_assert(sizeof(UIEditCtrl2) == 292);
|
|
static_assert(sizeof(UIEditCtrl4) == 324);
|
|
static_assert(sizeof(UIEditCtrl5) == 324);
|
|
#endif
|
|
|
|
#endif
|