GUIFramework 1.1.0
Framework for desktop GUI applications in C++.
Loading...
Searching...
No Matches
BaseRichEdit.h
Go to the documentation of this file.
1#pragma once
2
4
8
9namespace gui_framework
10{
13 public BaseComponent,
16 {
17 public:
18 enum class urlDetectEvent
19 {
20 mouseMove = WM_MOUSEMOVE,
21 leftButtonDown,
22 leftButtonUp,
23 leftButtonDoubleClick,
24 rightButtonDown,
25 rightButtonUp,
26 rightButtonDoubleClick,
27 setCursor = WM_SETCURSOR
28 };
29
30 static constexpr uint8_t urlDetectEventSize = 8;
31
32 protected:
33 std::array<std::function<void(const std::wstring&)>, urlDetectEventSize> callbacks;
34 std::array<std::pair<std::string, std::string>, urlDetectEventSize> callbacksFunctionNamesAndModules; // function name - module name
37
38 private:
39 void addCallback(urlDetectEvent event, const std::function<void(const std::wstring&)>& callback, const std::string& functionName, const std::string& moduleName);
40
41 protected:
42 virtual LRESULT windowMessagesHandle(HWND handle, UINT message, WPARAM wparam, LPARAM lparam, bool& isUsed) override;
43
44 public:
45 BaseRichEdit(const std::wstring& richEditName, const utility::ComponentSettings& settings, BaseComposite* parent, bool isMultiLine = false);
46
47 virtual void addUrlDetectEvent(urlDetectEvent event, const std::function<void(const std::wstring&)>& eventCallback) final;
48
49 virtual void addUrlDetectEvent(urlDetectEvent event, const std::string& functionName, const std::string& moduleName) final;
50
51 virtual void removeUrlDetectEvent(urlDetectEvent event) final;
52
53 virtual LRESULT findSubstring(const std::wstring& subStringToFind, bool isMatchCase = true) final;
54
55 virtual LRESULT findString(const std::wstring& stringToFind, bool isMatchCase = true) final;
56
57 virtual void setAutoURLDetect(bool autoURLDetect) final;
58
59 virtual void setLimitText(uint64_t count) final;
60
61 virtual bool getAutoURLDetect() const final;
62
63 virtual std::wstring getSelectedText() const final;
64
65 virtual const std::function<void(const std::wstring&)>& getCallback(urlDetectEvent event) const final;
66
67 virtual bool getIsMultiLine() const final;
68
69 virtual void setBackgroundColor(uint8_t red, uint8_t green, uint8_t blue) final override;
70
71 virtual void setTextColor(uint8_t red, uint8_t green, uint8_t blue) final override;
72
75 virtual size_t getHash() const override = 0;
76
77 virtual json::JSONBuilder getStructure() const override;
78
79 virtual ~BaseRichEdit() = default;
80
81 using interfaces::ITextOperations::setText;
82 };
83
85 using richEditCallbackSignature = void(*)(const std::wstring&);
86}
#define GUI_FRAMEWORK_API
Base class for all windows, controls, etc.
Base class for all windows that has children windows.
Base class for all rich edit controls.
std::array< std::pair< std::string, std::string >, urlDetectEventSize > callbacksFunctionNamesAndModules
virtual void addUrlDetectEvent(urlDetectEvent event, const std::string &functionName, const std::string &moduleName) final
std::array< std::function< void(const std::wstring &)>, urlDetectEventSize > callbacks
virtual void addUrlDetectEvent(urlDetectEvent event, const std::function< void(const std::wstring &)> &eventCallback) final
Provides resize, setBlockResize, getBlockResize methods.
Provides setText and getText methods.
void(*)(const std::wstring &) richEditCallbackSignature
Used in rich edit auto url detect events.