Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
WordWrappedTextInteractor.cpp
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#include "Stroika/Frameworks/StroikaPreComp.h"
5
6#include "WordWrappedTextInteractor.h"
7
8using namespace Stroika::Foundation;
9
10using namespace Stroika::Frameworks;
11using namespace Stroika::Frameworks::Led;
12
13#if qStroika_Frameworks_Led_SupportGDI
14/*
15 ********************************************************************************
16 ***************************** WordWrappedTextInteractor ************************
17 ********************************************************************************
18 */
19/*
20@METHOD: WordWrappedTextInteractor::OnTypedNormalCharacter
21@DESCRIPTION: <p>Override @'TextInteractor::OnTypedNormalCharacter' to map 'shiftPressed' + NL to a soft-line break.</p>
22*/
23void WordWrappedTextInteractor::OnTypedNormalCharacter (Led_tChar theChar, bool optionPressed, bool shiftPressed, bool commandPressed,
24 bool controlPressed, bool altKeyPressed)
25{
26 if (theChar == '\n' and shiftPressed) {
27 /*
28 * Map 'shiftPressed' + NL to a soft-line break, but shutoff controlchar checking since that would
29 * generate an exception for this character (SPR#1080).
30 */
31 bool savedSuppressFlag = GetSuppressTypedControlCharacters ();
32 SetSuppressTypedControlCharacters (false);
33 try {
34 inherited::OnTypedNormalCharacter (kSoftLineBreakChar, optionPressed, shiftPressed, commandPressed, controlPressed, altKeyPressed);
35 }
36 catch (...) {
37 SetSuppressTypedControlCharacters (savedSuppressFlag);
38 throw;
39 }
40 SetSuppressTypedControlCharacters (savedSuppressFlag);
41 }
42 else {
43 inherited::OnTypedNormalCharacter (theChar, optionPressed, shiftPressed, commandPressed, controlPressed, altKeyPressed);
44 }
45}
46
47void WordWrappedTextInteractor::SetTopRowInWindow (size_t newTopRow)
48{
49 PreScrollInfo preScrollInfo;
50 PreScrollHelper (eDefaultUpdate, &preScrollInfo);
51 WordWrappedTextImager::SetTopRowInWindow (newTopRow);
52 PostScrollHelper (preScrollInfo);
53}
54
55void WordWrappedTextInteractor::SetTopRowInWindow (RowReference row)
56{
57 PreScrollInfo preScrollInfo;
58 PreScrollHelper (eDefaultUpdate, &preScrollInfo);
59 WordWrappedTextImager::SetTopRowInWindow (row);
60 PostScrollHelper (preScrollInfo);
61}
62
63void WordWrappedTextInteractor::SetTopRowInWindowByMarkerPosition (size_t markerPos, UpdateMode updateMode)
64{
65 SetTopRowInWindow (GetRowReferenceContainingPosition (markerPos), updateMode);
66}
67
68#endif