CtrlLib: WhenLeftUp event added to DocEdit/LineEdit/RichEdit (#216)

* CtrlLib: WhenLeftUp event added to DocEdit/LineEdit/RichEdit

* RichEdit: WhenLeftUp made public.
This commit is contained in:
İsmail Yılmaz 2025-01-29 10:33:53 +03:00 committed by GitHub
parent 938f0d9754
commit c8a9959bdf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 16 additions and 0 deletions

View file

@ -281,6 +281,7 @@ void DocEdit::LeftDown(Point p, dword flags) {
void DocEdit::LeftUp(Point p, dword flags)
{
WhenLeftUp();
if(!HasCapture() && selclick) {
int c = GetMousePos(p);
PlaceCaret(c, flags & K_SHIFT);

View file

@ -1031,6 +1031,7 @@ void LineEdit::LeftDown(Point p, dword flags) {
void LineEdit::LeftUp(Point p, dword flags)
{
WhenLeftUp();
if(!HasCapture() && selclick && !IsDragAndDropSource()) {
mpos = GetMousePos(p);
PlaceCaret(mpos, flags & K_SHIFT);

View file

@ -392,6 +392,7 @@ protected:
public:
Event<> WhenScroll;
Event<> WhenLeftUp;
Size GetFontSize() const;
int64 GetGPos(int ln, int cl) const;
@ -571,6 +572,8 @@ protected:
int GetMousePos(Point p);
public:
Event<> WhenLeftUp;
DocEdit& After(int a) { after = a; RefreshStyle(); return *this; }
DocEdit& SetFont(Font f) { font = f; RefreshStyle(); return *this; }
DocEdit& SetFilter(int (*f)(int c)) { filter = f; return *this; }

View file

@ -33,6 +33,10 @@ ont]_[*@3 f])&]
[s2; Sets the font to be used by widget to [%-*@3 f].&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:DocEdit`:`:WhenLeftUp:%- Event<> [* WhenLeftUp]&]
[s2; Invoked when left mouse button is released..&]
[s3;%- &]
[s4;%- &]
[s5;:DocEdit`:`:After`(int`):%- [_^DocEdit^ DocEdit][@(0.0.255) `&]_[* After]([@(0.0.255) int
]_[*@3 a])&]
[s2; The height of empty block after the paragraph in pixels. Default

View file

@ -47,6 +47,10 @@ is empty.&]
[s2;%% Invoked when scrollbar gets new position.&]
[s3; &]
[s4; &]
[s5;:Upp`:`:LineEdit`:`:WhenLeftUp: Event<> [* WhenLeftUp]&]
[s2;%% Invoked when left mouse button is released.&]
[s3; &]
[s4; &]
[s5;:LineEdit`:`:GetFontSize`(`)const: [_^Size^ Size]_[* GetFontSize]()_[@(0.0.255) const]&]
[s2;%% Returns the size of font character cell (LineEdit expects
monospace glyphs `- the width of character is constant).&]

View file

@ -144,6 +144,7 @@ void RichEdit::LeftDown(Point p, dword flags)
void RichEdit::LeftUp(Point p, dword flags)
{
WhenLeftUp();
useraction = true;
NextUndo();
int c = GetMousePos(p);

View file

@ -877,6 +877,8 @@ public:
void SetFooter(const String& s) { footer = s; }
void PrintNoLinks(bool b = true) { nolinks = b; }
Event<> WhenLeftUp;
typedef RichEdit CLASSNAME;
RichEdit();