Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
TextInteractorMixins.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Frameworks_Led_TextInteractorMixins_h_
5#define _Stroika_Frameworks_Led_TextInteractorMixins_h_ 1
6
7#include "Stroika/Frameworks/StroikaPreComp.h"
8
9/*
10@MODULE: TextInteractorMixins
11@DESCRIPTION:
12 <p>TextInteractorMixins are some templates that help deal with some of the drugery of C++ mixins.</p>
13
14 */
15
16#include "Stroika/Frameworks/Led/TextInteractor.h"
17
18namespace Stroika::Frameworks::Led {
19
20#if qStroika_Frameworks_Led_SupportGDI
21 DISABLE_COMPILER_MSC_WARNING_START (4250) // inherits via dominance warning
22
23 /*
24 @CLASS: InteractorImagerMixinHelper<IMAGER>
25 @BASES: virtual @'TextInteractor', IMAGER
26 @DESCRIPTION: <p>A utility class to facilitate mixing together Interactors with particular
27 chosen TextImager subclasses.</p>
28 <p>This class is mostly an implementation detail, and shouldn't be of interest to Led users, unless
29 they are creating a new TextImager subclass (which isn't also already a subclass of TextInteractor;
30 this should be rare).</p>
31 */
32 template <typename IMAGER>
33 class InteractorImagerMixinHelper : public virtual TextInteractor, public IMAGER {
34 private:
35 using inherited = void*; // prevent accidental references to this name in subclasses to base class name
36
37 protected:
38 InteractorImagerMixinHelper () = default;
39
40 /*
41 * Must combine behaviors of different mixins.
42 */
43 public:
44 virtual void Draw (const Led_Rect& subsetToDraw, bool printing) override;
45 virtual void AboutToUpdateText (const MarkerOwner::UpdateInfo& updateInfo) override;
46 virtual void DidUpdateText (const UpdateInfo& updateInfo) noexcept override;
47
48 protected:
49 virtual void HookLosingTextStore () override;
50 virtual void HookGainedNewTextStore () override;
51
52 /*
53 * Disambiguate overloads than can happen down both base class chains.
54 */
55 public:
56#if qUsingDirectiveSometimesCausesInternalCompilerErrorBug
57 nonvirtual void SetWindowRect (const Led_Rect& windowRect, TextInteractor::UpdateMode updateMode = TextInteractor::eDefaultUpdate)
58 {
59 TextInteractor::SetWindowRect (windowRect, updateMode);
60 }
61 nonvirtual void ScrollByIfRoom (ptrdiff_t downByRows, UpdateMode updateMode = eDefaultUpdate)
62 {
63 TextInteractor::ScrollByIfRoom (downByRows, updateMode);
64 }
65 nonvirtual void ScrollSoShowing (size_t markerPos, size_t andTryToShowMarkerPos = 0, UpdateMode updateMode = eDefaultUpdate)
66 {
67 TextInteractor::ScrollSoShowing (markerPos, andTryToShowMarkerPos, updateMode);
68 }
69#else
70 using TextInteractor::ScrollByIfRoom;
71 using TextInteractor::ScrollSoShowing;
72 using TextInteractor::SetWindowRect;
73#endif
74 };
75
76 /*
77 @CLASS: InteractorInteractorMixinHelper<INTERACTOR1,INTERACTOR2>
78 @BASES: INTERACTOR1, INTERACTOR2
79 @DESCRIPTION: <p>A utility class to facilitate mixing together two Interactors.</p>
80 <p>This class is mostly an implementation detail, and shouldn't be of interest to Led users, unless
81 they are creating a new direct TextImagerInteractor subclass (which should be rare).</p>
82 */
83 template <typename INTERACTOR1, typename INTERACTOR2>
84 class InteractorInteractorMixinHelper : public INTERACTOR1, public INTERACTOR2 {
85 private:
86 using inherited = void*; // prevent accidental references to this name in subclasses to base class name
87
88 protected:
89 InteractorInteractorMixinHelper ();
90
91 protected:
92 virtual void HookLosingTextStore () override;
93 virtual void HookGainedNewTextStore () override;
94
95 public:
96#if qUsingDirectiveSometimesCausesInternalCompilerErrorBug
97 nonvirtual void SetWindowRect (const Led_Rect& windowRect, TextInteractor::UpdateMode updateMode = TextInteractor::eDefaultUpdate)
98 {
99 TextInteractor::SetWindowRect (windowRect, updateMode);
100 }
101#else
102 using INTERACTOR1::SetWindowRect; // Should both be the same - but arbitrarily pick one
103#endif
104
105 nonvirtual void Invariant ()
106 {
107 INTERACTOR1::Invariant ();
108 INTERACTOR2::Invariant ();
109 }
110
111 public:
112 virtual void DidUpdateText (const MarkerOwner::UpdateInfo& updateInfo) noexcept override;
113 };
114 DISABLE_COMPILER_MSC_WARNING_END (4250) // inherits via dominance warning
115#endif
116
117}
118
119/*
120 ********************************************************************************
121 ***************************** Implementation Details ***************************
122 ********************************************************************************
123 */
124#include "TextInteractorMixIns.inl"
125
126#endif /*_Stroika_Frameworks_Led_TextInteractorMixins_h_*/