Stroika Library 3.0d25
 
Loading...
Searching...
No Matches
SimpleLed.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2026. All rights reserved
3 */
4#ifndef _Stroika_Frameworks_Led_SimpleLed_h_
5#define _Stroika_Frameworks_Led_SimpleLed_h_ 1
6
7/*
8@MODULE: SimpleLed
9@DESCRIPTION:
10 <p>Simple wrappers on the word processing classes and line editing classes to make it a bit easier to
11 instantiate a Led editor. Using these has some costs - however - as it removes some opportunities to customize exactly
12 what you build into your Led-based editor. Still - its a very helpful way to get started using Led.</p>
13 */
14
15#if !defined(_MFC_VER) && !defined(_WIN32)
16#error "This file provides a simple to use wrapper on one of the above class libraries"
17#error "But you don't seem to be using any of them. Be sure to set the proper defines"
18#error "if you ARE in fact using one of the supported class libraries."
19#endif
20
21#include "Stroika/Frameworks/StroikaPreComp.h"
22
23#include "Stroika/Frameworks/Led/ChunkedArrayTextStore.h"
24#include "Stroika/Frameworks/Led/Command.h"
25#include "Stroika/Frameworks/Led/SimpleTextInteractor.h"
26#include "Stroika/Frameworks/Led/WordProcessor.h"
27
28#if defined(_MFC_VER)
29#include "Stroika/Frameworks/Led/Platform/MFC.h"
30#include "Stroika/Frameworks/Led/Platform/MFC_WordProcessor.h"
31#elif defined(_WIN32)
32#include "Stroika/Frameworks/Led/Platform/Windows.h"
33#endif
34
35namespace Stroika::Frameworks::Led {
36
37 DISABLE_COMPILER_MSC_WARNING_START (4250) // inherits via dominance warning
38 /*
39 @CLASS: SimpleLedWordProcessor
40 @BASES: @'Led_MFC', @'WordProcessor'
41 @DESCRIPTION: <p>Led is a concrete editor class. You can directly instantiate and use this one.
42 Or mix and match various component classes to make your own editor with the features
43 you need. This is really only intended for use as a 'quick start' to using Led. You will probably
44 want to directly use the base classes of Led, or various other components directly, once you get
45 the hang of using Led.</p>
46 */
47 class SimpleLedWordProcessor
48#if defined(_MFC_VER)
49 : public Led_MFC_X<WordProcessor>
50#elif defined(_WIN32)
51 : public Platform::Led_Win32_SimpleWndProc_Helper<Platform::Led_Win32_Helper<WordProcessor>>
52#endif
53 {
54 private:
55#if defined(_MFC_VER)
56 using inherited = Led_MFC_X<WordProcessor>;
57#elif defined(_WIN32)
58 using inherited = Platform::Led_Win32_SimpleWndProc_Helper<Platform::Led_Win32_Helper<WordProcessor>>;
59#endif
60 public:
61 SimpleLedWordProcessor ();
62 ~SimpleLedWordProcessor ();
63
64 private:
65 enum {
66 kMaxUndoLevels = 5
67 };
68 ChunkedArrayTextStore fTextStore;
69 MultiLevelUndoCommandHandler fCommandHandler;
70
71#if defined(_MFC_VER)
72 protected:
73 DECLARE_MESSAGE_MAP ()
74 DECLARE_DYNCREATE (SimpleLedWordProcessor)
75#endif
76 };
77
78 DISABLE_COMPILER_MSC_WARNING_END (4250)
79
80 DISABLE_COMPILER_MSC_WARNING_START (4250) // inherits via dominance warning
81 /*
82 @CLASS: SimpleLedLineEditor
83 @BASES: @'Led_MFC', @'SimpleTextInteractor'
84 @DESCRIPTION: <p>Led is a concrete editor class. You can directly instantiate and use this one.
85 Or mix and match various component classes to make your own editor with the features
86 you need. This is really only intended for use as a 'quick start' to using Led. You will probably
87 want to directly use the base classes of Led, or various other components directly, once you get
88 the hang of using Led.</p>
89 */
90 class SimpleLedLineEditor
91#if defined(_MFC_VER)
92 : public Led_MFC_X<SimpleTextInteractor>
93#elif defined(_WIN32)
94 : public Platform::Led_Win32_SimpleWndProc_Helper<Platform::Led_Win32_Helper<SimpleTextInteractor>>
95#endif
96 {
97 private:
98#if defined(_MFC_VER)
99 using inherited = Led_MFC_X<SimpleTextInteractor>;
100#elif defined(_WIN32)
101 using inherited = Platform::Led_Win32_SimpleWndProc_Helper<Platform::Led_Win32_Helper<SimpleTextInteractor>>;
102#endif
103 public:
104 SimpleLedLineEditor ();
105 ~SimpleLedLineEditor ();
106
107 private:
108 enum {
109 kMaxUndoLevels = 5
110 };
111 ChunkedArrayTextStore fTextStore;
112 MultiLevelUndoCommandHandler fCommandHandler;
113
114#if defined(_MFC_VER)
115 protected:
116 DECLARE_MESSAGE_MAP ()
117 DECLARE_DYNCREATE (SimpleLedLineEditor)
118#endif
119 };
120 DISABLE_COMPILER_MSC_WARNING_END (4250)
121
122 DISABLE_COMPILER_MSC_WARNING_START (4250) // inherits via dominance warning
123 /*
124 @CLASS: LedDialogText
125 @BASES: @'SimpleLedWordProcessor'
126 @DESCRIPTION: <p>Very similar to class @'Led'. But with a few class-library-specific twists to make it easier
127 to embed the Led view into a dialog. Not really needed. But if you are having trouble getting your Led-based
128 view working in a dialog, you may want to try, or at least look at this code.</p>
129 <p>PROBABLY SHOULD RE-IMPLEMENT THIS to be more like a textedit box. Make WordWrap optional. For MFC - use
130 CWND instead of CView. Actually TEST it and make clear where/why its useful (UNICODE for one thing).
131 </p>
132 */
133 class LedDialogText : public SimpleLedWordProcessor {
134 private:
135 using inherited = SimpleLedWordProcessor;
136
137 public:
138 LedDialogText ();
139
140#if qStroika_Platform_Windows && defined(_MFC_VER)
141 public:
142 virtual void PostNcDestroy () override;
143 virtual int OnMouseActivate (CWnd* pDesktopWnd, UINT nHitTest, UINT message) override;
144#endif
145
146#if qStroika_Platform_Windows && defined(_MFC_VER)
147 protected:
148 DECLARE_MESSAGE_MAP ()
149 DECLARE_DYNCREATE (LedDialogText)
150#endif
151 };
152 DISABLE_COMPILER_MSC_WARNING_END (4250)
153
154}
155
156/*
157 ********************************************************************************
158 ***************************** Implementation Details ***************************
159 ********************************************************************************
160 */
161#include "SimpleLed.inl"
162
163#endif /*_Stroika_Frameworks_Led_SimpleLed_h_*/