Stroika Library 3.0d25
 
Loading...
Searching...
No Matches
StdDialogs.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2026. All rights reserved
3 */
4#ifndef __Led_StdDialogs__h__
5#define __Led_StdDialogs__h__ 1
6
7/*
8@MODULE: LedStdDialogs
9@DESCRIPTION:
10 <p>Pre-canned (though subclassable) dialogs which tend to come in handy in Led-based applications.
11 These are not always available for all platforms. Also - some minimal effort is made to make it a bit
12 easier to do somewhat platoform-independent dialog code (very minimal support for this as of Led 3.0).
13 </p>
14 */
15
16#include "Stroika/Frameworks/StroikaPreComp.h"
17
18#include "Stroika/Frameworks/Led/Config.h"
19
20#if defined(__cplusplus)
21#include "Stroika/Frameworks/Led/GDI.h"
22#include "Stroika/Frameworks/Led/Support.h"
23#endif
24
25/*
26 * The Windows resource compiler (rc.exe) also reads this header (for the dialog templates in StdDialogs.inc.r), and it
27 * truncates identifiers to 31 characters - so the #if tests here use the qStroika_Platform_ names, which are short
28 * enough for it (see Design-Overview.md "Macro names").
29 */
30
31// MFC must define something like this someplace, but I haven't found where....
32// Use this for now, so I can update things more easily when I find the MFC definition...
33#ifndef kLedStdDlgCommandBase
34#if qStroika_Platform_Windows
35#define kLedStdDlgCommandBase 0x1000
36#endif
37#endif
38
39// NOTE - due to quirks of MSDEV .rc compiler - you CANNOT change this #. If you do - it will be out of sync with
40// kLedStdDlg_AboutBoxID etc below. You cannot make kLedStdDlg_AboutBoxID etc below be based on this - or the .rc compiler
41// will silently - but surely - generate the wrong resids. Amazing but true stories -- LGP 2000-10-16
42#define kLedStdDlgIDBase 0x1000
43
44#if qStroika_Platform_Windows && defined(__cplusplus)
45#include "Stroika/Frameworks/Led/Platform/Windows.h"
46#include "Stroika/Frameworks/Led/SimpleTextInteractor.h"
47#include "Stroika/Frameworks/Led/SimpleTextStore.h"
48#endif
49
50#if defined(__cplusplus)
51namespace Stroika::Frameworks::Led {
52#endif
53
54#if defined(__cplusplus)
55 class StdColorPopupHelper {
56 public:
57 StdColorPopupHelper (bool allowNone);
58 ~StdColorPopupHelper ();
59
60 public:
61 nonvirtual bool GetSelectedColor (Color* c) const;
62 nonvirtual void SetSelectedColor (const Color& c);
63 nonvirtual void SetNoSelectedColor ();
64
65 private:
66 bool fIsSelectedColor;
67 Color fSelectedColor{Color::kBlack};
68
69 private:
70 nonvirtual size_t MapColorIdx (const Color& c) const;
71 nonvirtual Color MapColorIdx (size_t i) const;
72
73 private:
74 bool fAllowNone;
75
76#if qStroika_Platform_Windows
77 public:
78 nonvirtual void Attach (HWND popup);
79
80 private:
81 HWND fHWnd;
82#endif
83
84#if qStroika_Platform_Windows
85 public:
86 nonvirtual void OnSelChange ();
87#endif
88#if qStroika_Platform_Windows
89 private:
90 nonvirtual void DoMenuAppends ();
91 nonvirtual void AppendMenuString (const SDKString& s);
92#endif
93 };
94#endif
95
96#if qStroika_Platform_Windows && defined(__cplusplus)
97
98 namespace LedDialogWidget_Private {
99 using LedDialogWidget_BASE = Platform::Led_Win32_SimpleWndProc_HelperWithSDKMessages<Platform::Led_Win32_Helper<SimpleTextInteractor>>;
100 }
101
102 DISABLE_COMPILER_MSC_WARNING_START (4250) // inherits via dominance warning
103 class LedDialogWidget : public LedDialogWidget_Private::LedDialogWidget_BASE {
104 private:
105 using inherited = LedDialogWidget_Private::LedDialogWidget_BASE;
106
107 public:
108 LedDialogWidget ();
109
110 protected:
111 /**
112 * Like the default CTOR, but does not SpecifyTextStore (&fTextStore) - for a subclass that specifies its own.
113 */
114 enum DerivedClassSpecifiesTextStore {
115 eDerivedClassSpecifiesTextStore
116 };
117 LedDialogWidget (DerivedClassSpecifiesTextStore);
118
119 public:
120 virtual ~LedDialogWidget ();
121
122 public:
123 virtual void OnBadUserInput () override;
124
125 public:
126 virtual void OnTypedNormalCharacter (Led_tChar theChar, bool /*optionPressed*/, bool /*shiftPressed*/, bool /*commandPressed*/,
127 bool controlPressed, bool /*altKeyPressed*/) override;
128
129 protected:
130 virtual CommandNumber CharToCommand (Led_tChar theChar) const;
131
132 public:
133 nonvirtual Led_tString GetText () const;
134 nonvirtual void SetText (const Led_tString& t);
135
136 public:
137 SimpleTextStore fTextStore;
138 SingleUndoCommandHandler fCommandHandler;
139 };
140 DISABLE_COMPILER_MSC_WARNING_END (4250)
141
142#endif
143
144#if qStroika_Platform_Windows && defined(__cplusplus)
145 /*
146 @CLASS: LedComboBoxWidget
147 @DESCRIPTION: <p></p>
148 */
149 class LedComboBoxWidget
150#if qStroika_Platform_Windows
151 : public Platform::SimpleWin32WndProcHelper
152#endif
153 {
154#if qStroika_Platform_Windows
155 private:
156 using inherited = Platform::SimpleWin32WndProcHelper;
157#endif
158
159 public:
160 LedComboBoxWidget ();
161 virtual ~LedComboBoxWidget ();
162
163#if qStroika_Platform_Windows
164 public:
165 nonvirtual bool ReplaceWindow (HWND hWnd);
166#endif
167
168 public:
169 nonvirtual Led_tString GetText () const;
170 nonvirtual void SetText (const Led_tString& t);
171
172 public:
173 nonvirtual vector<Led_tString> GetPopupItems () const;
174 nonvirtual void SetPopupItems (const vector<Led_tString>& pi);
175
176 private:
177 vector<Led_tString> fPopupItems;
178
179#if qStroika_Platform_Windows
180 public:
181 virtual LRESULT WndProc (UINT message, WPARAM wParam, LPARAM lParam) override;
182
183 protected:
184 virtual LRESULT OnCreate_Msg (WPARAM wParam, LPARAM lParam);
185 virtual LRESULT OnSize_Msg (WPARAM wParam, LPARAM lParam);
186#endif
187
188#if qStroika_Platform_Windows
189 protected:
190 struct MyButton : public SimpleWin32WndProcHelper {
191 using inherited = SimpleWin32WndProcHelper;
192
193 MyButton ();
194 virtual LRESULT WndProc (UINT message, WPARAM wParam, LPARAM lParam) override;
195
196 LedComboBoxWidget* fComboBox;
197 Bitmap fDropDownArrow;
198 };
199 friend struct MyButton;
200#endif
201
202#if qStroika_Platform_Windows
203 protected:
204 struct MyComboListBoxPopup : public SimpleWin32WndProcHelper {
205 using inherited = SimpleWin32WndProcHelper;
206
207 MyComboListBoxPopup ();
208 virtual LRESULT WndProc (UINT message, WPARAM wParam, LPARAM lParam) override;
209 nonvirtual void UpdatePopupItems ();
210 nonvirtual void MadeSelection ();
211 nonvirtual void ComputePreferedHeight (DistanceType* prefHeight, size_t* nEltsShown) const;
212
213 LedComboBoxWidget* fComboBox;
214 };
215 friend struct MyComboListBoxPopup;
216#endif
217
218#if qStroika_Platform_Windows
219 protected:
220 DISABLE_COMPILER_MSC_WARNING_START (4250) // inherits via dominance warning
221 struct MyTextWidget : public LedDialogWidget {
222 using inherited = LedDialogWidget;
223
224 MyTextWidget ();
225 ~MyTextWidget ();
226 virtual LRESULT WndProc (UINT message, WPARAM wParam, LPARAM lParam) override;
227
228 LedComboBoxWidget* fComboBox;
229 };
230 DISABLE_COMPILER_MSC_WARNING_END (4250)
231 friend struct MyTextWidget;
232#endif
233
234 protected:
235 nonvirtual void ShowPopup ();
236 nonvirtual void HidePopup ();
237 nonvirtual bool PopupShown () const;
238 nonvirtual void TogglePopupShown ();
239
240 private:
241#if qStroika_Platform_Windows
242 MyButton fPopupButton;
243 MyComboListBoxPopup fComboListBoxPopup;
244 MyTextWidget fTextWidget;
245 FontObject* fUseWidgetFont;
246#endif
247 };
248#endif
249
250#if defined(__cplusplus)
251 /*
252 @CLASS: Led_StdDialogHelper
253 @DESCRIPTION: <p>A very minimalistic attempt at providing cross-platform dialog support.</p>
254 */
255 class Led_StdDialogHelper {
256 public:
257#if qStroika_Platform_Windows
258 Led_StdDialogHelper (HINSTANCE hInstance, const SDKChar* resID, HWND parentWnd);
259#endif
260
261 public:
262 virtual ~Led_StdDialogHelper ();
263
264 public:
265 virtual bool DoModal ();
266
267 public:
268 nonvirtual void ReplaceAllTokens (SDKString* m, const SDKString& token, const SDKString& with);
269
270 protected:
271 virtual void PreDoModalHook ();
272
273 private:
274#if qStroika_Platform_Windows
275 HINSTANCE fHINSTANCE;
276 const SDKChar* fResID; // not a REAL string - fake one for MAKEINTRESOURCE - which is why we don't copy with 'string' class
277 HWND fParentWnd;
278#endif
279
280 public:
281 virtual void OnOK ();
282 virtual void OnCancel ();
283
284 public:
285 nonvirtual bool GetWasOK () const;
286
287 private:
288 bool fWasOK;
289
290 /*
291 * Some cross-platform portability helper functions.
292 */
293 public:
294#if qStroika_Platform_Windows
295 using DialogItemID = int;
296#endif
297 public:
298#if qStroika_Platform_Windows
299 nonvirtual SDKString GetItemText (DialogItemID itemID) const;
300 nonvirtual void SetItemText (DialogItemID itemID, const SDKString& text);
301 nonvirtual void SelectItemText (DialogItemID itemID, size_t from = 0, size_t to = static_cast<size_t> (-1));
302 nonvirtual bool GetItemChecked (DialogItemID itemID) const;
303 nonvirtual void SetItemChecked (DialogItemID itemID, bool checked);
304 nonvirtual bool GetItemEnabled (DialogItemID itemID) const;
305 nonvirtual void SetItemEnabled (DialogItemID itemID, bool enabled);
306 nonvirtual void SetFocusedItem (DialogItemID itemID);
307#endif
308
309 private:
310#if qStroika_Platform_Windows
311 bool fSetFocusItemCalled;
312#endif
313
314#if qStroika_Platform_Windows
315 public:
316 nonvirtual HWND GetHWND () const;
317 nonvirtual void SetHWND (HWND hWnd);
318
319 private:
320 HWND fHWnd;
321#endif
322
323#if qStroika_Platform_Windows
324 protected:
325 virtual BOOL OnInitDialog ();
326#endif
327
328#if qStroika_Platform_Windows
329 public:
330 static BOOL CALLBACK StaticDialogProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
331
332 protected:
333 virtual BOOL DialogProc (UINT message, WPARAM wParam, LPARAM lParam);
334#endif
335 };
336#endif
337
338#if qStroika_Platform_Windows
339#define kLedStdDlg_AboutBoxID 0x1001
340#define kLedStdDlg_AboutBox_InfoLedFieldID (kLedStdDlgCommandBase + 1)
341#define kLedStdDlg_AboutBox_LedWebPageFieldID (kLedStdDlgCommandBase + 2)
342#define kLedStdDlg_AboutBox_BigPictureFieldID (kLedStdDlgCommandBase + 3)
343#define kLedStdDlg_AboutBox_VersionFieldID (kLedStdDlgCommandBase + 4)
344
345#if defined(__cplusplus)
346 class Led_StdDialogHelper_AboutBox : public Led_StdDialogHelper {
347 private:
348 using inherited = Led_StdDialogHelper;
349
350 public:
351#if qStroika_Platform_Windows
352 Led_StdDialogHelper_AboutBox (HINSTANCE hInstance, HWND parentWnd, const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_AboutBoxID));
353#endif
354
355 protected:
356#if qStroika_Platform_Windows
357 virtual BOOL DialogProc (UINT message, WPARAM wParam, LPARAM lParam) override;
358#endif
359
360 public:
361 virtual void OnClickInInfoField ();
362 virtual void OnClickInLedWebPageField ();
363 };
364#endif
365
366#endif
367
368#if qStroika_Platform_Windows
369#define kLedStdDlg_FindBoxID 0x1002
370#define kLedStdDlg_FindBox_FindText (kLedStdDlgCommandBase + 1)
371#define kLedStdDlg_FindBox_WrapAtEndOfDoc (kLedStdDlgCommandBase + 2)
372#define kLedStdDlg_FindBox_WholeWord (kLedStdDlgCommandBase + 3)
373#define kLedStdDlg_FindBox_IgnoreCase (kLedStdDlgCommandBase + 4)
374#define kLedStdDlg_FindBox_Find (kLedStdDlgCommandBase + 5)
375#define kLedStdDlg_FindBox_Cancel (kLedStdDlgCommandBase + 6)
376
377#if defined(__cplusplus)
378 class Led_StdDialogHelper_FindDialog : public Led_StdDialogHelper {
379 private:
380 using inherited = Led_StdDialogHelper;
381
382 public:
383#if qStroika_Platform_Windows
384 Led_StdDialogHelper_FindDialog (HINSTANCE hInstance, HWND parentWnd, const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_FindBoxID));
385#endif
386
387 protected:
388#if qStroika_Platform_Windows
389 virtual BOOL DialogProc (UINT message, WPARAM wParam, LPARAM lParam) override;
390#endif
391
392 public:
393 Led_tString fFindText;
394 vector<Led_tString> fRecentFindTextStrings;
395 bool fWrapSearch;
396 bool fWholeWordSearch;
397 bool fCaseSensativeSearch;
398 bool fPressedOK;
399
400 protected:
401#if qStroika_Platform_Windows
402 LedComboBoxWidget fFindTextWidget;
403#endif
404
405 protected:
406 virtual void PreDoModalHook () override;
407
408 public:
409 virtual void OnFindButton ();
410 virtual void OnDontFindButton ();
411 };
412#endif
413#endif
414
415#if qStroika_Platform_Windows
416#define kLedStdDlg_ReplaceBoxID 0x1003
417#define kLedStdDlg_ReplaceBox_FindText (kLedStdDlgCommandBase + 1)
418#define kLedStdDlg_ReplaceBox_ReplaceText (kLedStdDlgCommandBase + 2)
419#define kLedStdDlg_ReplaceBox_WrapAtEndOfDoc (kLedStdDlgCommandBase + 3)
420#define kLedStdDlg_ReplaceBox_WholeWord (kLedStdDlgCommandBase + 4)
421#define kLedStdDlg_ReplaceBox_IgnoreCase (kLedStdDlgCommandBase + 5)
422#define kLedStdDlg_ReplaceBox_Find (kLedStdDlgCommandBase + 6)
423#define kLedStdDlg_ReplaceBox_Cancel (kLedStdDlgCommandBase + 7)
424#define kLedStdDlg_ReplaceBox_Replace (kLedStdDlgCommandBase + 8)
425#define kLedStdDlg_ReplaceBox_ReplaceAll (kLedStdDlgCommandBase + 9)
426#define kLedStdDlg_ReplaceBox_ReplaceAllInSelection (kLedStdDlgCommandBase + 10)
427
428#if defined(__cplusplus)
429 class Led_StdDialogHelper_ReplaceDialog : public Led_StdDialogHelper {
430 private:
431 using inherited = Led_StdDialogHelper;
432
433 public:
434#if qStroika_Platform_Windows
435 Led_StdDialogHelper_ReplaceDialog (HINSTANCE hInstance, HWND parentWnd, const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_ReplaceBoxID));
436#endif
437
438 protected:
439#if qStroika_Platform_Windows
440 virtual BOOL DialogProc (UINT message, WPARAM wParam, LPARAM lParam) override;
441#endif
442
443 public:
444 Led_tString fFindText;
445 vector<Led_tString> fRecentFindTextStrings;
446 Led_tString fReplaceText;
447 bool fWrapSearch;
448 bool fWholeWordSearch;
449 bool fCaseSensativeSearch;
450
451 public:
452 enum ButtonPressed {
453 eCancel,
454 eFind,
455 eReplace,
456 eReplaceAll,
457 eReplaceAllInSelection
458 };
459 ButtonPressed fPressed;
460
461 protected:
462#if qStroika_Platform_Windows
463 LedComboBoxWidget fFindTextWidget;
464 LedDialogWidget fReplaceTextWidget;
465#endif
466
467 protected:
468 virtual void PreDoModalHook () override;
469
470 public:
471 virtual void OnFindButton ();
472 virtual void OnReplaceButton ();
473 virtual void OnReplaceAllButton ();
474 virtual void OnReplaceAllInSelectionButton ();
475 virtual void OnDontFindButton ();
476
477 protected:
478 virtual void SaveItems ();
479 };
480#endif
481#endif
482
483#if qStroika_Platform_Windows && defined(__cplusplus)
484 /*
485 @CLASS: StdColorPickBox
486 @DESCRIPTION: <p>This doesn't even use @'Led_StdDialogHelper' - but
487 instead - uses other SDK calls to display the dialog.</p>
488 <p>You still invoke it with a DoModal () call and consider that OK was pressed and
489 the fColor field filled in if DoModal returns true.
490 </p>
491 */
492 class StdColorPickBox {
493 public:
494#if qStroika_Platform_Windows
495 StdColorPickBox (const Color& initialColor);
496 StdColorPickBox (HINSTANCE hInstance, HWND parentWnd, const Color& initialColor);
497#endif
498
499#if qStroika_Platform_Windows
500 private:
501 HWND fParentWnd;
502#endif
503
504#if qStroika_Platform_Windows
505 public:
506 virtual bool DoModal ();
507#endif
508
509#if qStroika_Platform_Windows
510 private:
511 static UINT_PTR CALLBACK ColorPickerINITPROC (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
512#endif
513
514 public:
515 Color fColor;
516 };
517#endif
518
519#if qStroika_Platform_Windows
520#define kLedStdDlg_UpdateWin32FileAssocsDialogID 0x1004
521#define kLedStdDlg_UpdateWin32FileAssocsDialog_Msg (kLedStdDlgCommandBase + 1)
522#define kLedStdDlg_UpdateWin32FileAssocsDialog_KeepCheckingCheckboxMsg (kLedStdDlgCommandBase + 2)
523
524#if defined(__cplusplus)
525 /*
526 @CLASS: Led_StdDialogHelper_UpdateWin32FileAssocsDialog
527 @DESCRIPTION: <p>Windows only.</p>
528 */
529 class Led_StdDialogHelper_UpdateWin32FileAssocsDialog : public Led_StdDialogHelper {
530 private:
531 using inherited = Led_StdDialogHelper;
532
533 public:
534 Led_StdDialogHelper_UpdateWin32FileAssocsDialog (HINSTANCE hInstance, HWND parentWnd,
535 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_UpdateWin32FileAssocsDialogID));
536
537 public:
538 SDKString fAppName;
539 SDKString fTypeList;
540 bool fKeepChecking;
541
542 protected:
543 virtual void PreDoModalHook () override;
544
545 public:
546 virtual void OnOK () override;
547 virtual void OnCancel () override;
548 };
549#endif
550#endif
551
552#if qStroika_Platform_Windows
553#define kLedStdDlg_ParagraphIndentsID 0x1005
554#define kLedStdDlg_ParagraphIndents_LeftMarginFieldID (kLedStdDlgCommandBase + 4)
555#define kLedStdDlg_ParagraphIndents_RightMarginFieldID (kLedStdDlgCommandBase + 6)
556#define kLedStdDlg_ParagraphIndents_FirstIndentFieldID (kLedStdDlgCommandBase + 8)
557
558#if defined(__cplusplus)
559 class Led_StdDialogHelper_ParagraphIndentsDialog : public Led_StdDialogHelper {
560 private:
561 using inherited = Led_StdDialogHelper;
562
563 public:
564#if qStroika_Platform_Windows
565 Led_StdDialogHelper_ParagraphIndentsDialog (HINSTANCE hInstance, HWND parentWnd,
566 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_ParagraphIndentsID));
567#endif
568
569 public:
570 virtual void InitValues (TWIPS leftMargin, bool leftMarginValid, TWIPS rightMargin, bool rightMarginValid, TWIPS firstIndent, bool firstIndentValid);
571
572 protected:
573 virtual void PreDoModalHook () override;
574
575 public:
576 virtual void OnOK () override;
577
578 public:
579 bool fLeftMargin_Valid;
580 TWIPS fLeftMargin_Orig;
581 TWIPS fLeftMargin_Result;
582 bool fRightMargin_Valid;
583 TWIPS fRightMargin_Orig;
584 TWIPS fRightMargin_Result;
585 bool fFirstIndent_Valid;
586 TWIPS fFirstIndent_Orig;
587 TWIPS fFirstIndent_Result;
588 };
589#endif
590#endif
591
592#if qStroika_Platform_Windows
593#define kLedStdDlg_ParagraphSpacingID 0x1006
594#define kParagraphSpacing_Dialog_SpaceBeforeFieldID (kLedStdDlgCommandBase + 4)
595#define kParagraphSpacing_Dialog_SpaceAfterFieldID (kLedStdDlgCommandBase + 6)
596#define kParagraphSpacing_Dialog_LineSpaceModeFieldID (kLedStdDlgCommandBase + 7)
597#define kParagraphSpacing_Dialog_LineSpaceArgFieldID (kLedStdDlgCommandBase + 8)
598
599#if defined(__cplusplus)
600 class Led_StdDialogHelper_ParagraphSpacingDialog : public Led_StdDialogHelper {
601 private:
602 using inherited = Led_StdDialogHelper;
603
604 public:
605#if qStroika_Platform_Windows
606 Led_StdDialogHelper_ParagraphSpacingDialog (HINSTANCE hInstance, HWND parentWnd,
607 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_ParagraphSpacingID));
608#endif
609
610 public:
611 virtual void InitValues (TWIPS spaceBefore, bool spaceBeforeValid, TWIPS spaceAfter, bool spaceAfterValid, LineSpacing lineSpacing,
612 bool lineSpacingValid);
613
614 protected:
615 virtual void PreDoModalHook () override;
616
617 public:
618 virtual void OnOK () override;
619
620 public:
621 bool fSpaceBefore_Valid;
622 TWIPS fSpaceBefore_Orig;
623 TWIPS fSpaceBefore_Result;
624 bool fSpaceAfter_Valid;
625 TWIPS fSpaceAfter_Orig;
626 TWIPS fSpaceAfter_Result;
627 bool fLineSpacing_Valid;
628 LineSpacing fLineSpacing_Orig;
629 LineSpacing fLineSpacing_Result;
630 };
631#endif
632#endif
633
634#if qStroika_Platform_Windows
635#define kLedStdDlg_OtherFontSizeID 0x1007
636#define kOtherFontSize_Dialog_FontSizeEditFieldID (kLedStdDlgCommandBase + 4)
637
638#if defined(__cplusplus)
639 class Led_StdDialogHelper_OtherFontSizeDialog : public Led_StdDialogHelper {
640 private:
641 using inherited = Led_StdDialogHelper;
642
643 public:
644#if qStroika_Platform_Windows
645 Led_StdDialogHelper_OtherFontSizeDialog (HINSTANCE hInstance, HWND parentWnd, const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_OtherFontSizeID));
646#endif
647
648 public:
649 virtual void InitValues (DistanceType origFontSize);
650
651 protected:
652 virtual void PreDoModalHook () override;
653
654 public:
655 virtual void OnOK () override;
656
657 public:
658 DistanceType fFontSize_Orig;
659 DistanceType fFontSize_Result;
660 };
661#endif
662#endif
663
664#if qStroika_Platform_Windows
665#define kLedStdDlg_UnknownEmbeddingInfoBoxID 0x1008
666#define kLedStdDlg_UnknownEmbeddingInfoBox_TypeTextMsg (kLedStdDlgCommandBase + 1)
667
668#if defined(__cplusplus)
669 class Led_StdDialogHelper_UnknownEmbeddingInfoDialog : public Led_StdDialogHelper {
670 private:
671 using inherited = Led_StdDialogHelper;
672
673 public:
674#if qStroika_Platform_Windows
675 Led_StdDialogHelper_UnknownEmbeddingInfoDialog (HINSTANCE hInstance, HWND parentWnd,
676 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_UnknownEmbeddingInfoBoxID));
677#endif
678
679 public:
680 SDKString fEmbeddingTypeName;
681
682 protected:
683 virtual void PreDoModalHook () override;
684 };
685#endif
686#endif
687
688#if qStroika_Platform_Windows
689#define kLedStdDlg_URLXEmbeddingInfoBoxID 0x1009
690#define kLedStdDlg_URLXEmbeddingInfoBox_TypeTextMsg (kLedStdDlgCommandBase + 1)
691#define kLedStdDlg_URLXEmbeddingInfoBox_TitleText (kLedStdDlgCommandBase + 4)
692#define kLedStdDlg_URLXEmbeddingInfoBox_URLText (kLedStdDlgCommandBase + 6)
693
694#if defined(__cplusplus)
695 class Led_StdDialogHelper_URLXEmbeddingInfoDialog : public Led_StdDialogHelper {
696 private:
697 using inherited = Led_StdDialogHelper;
698
699 public:
700#if qStroika_Platform_Windows
701 Led_StdDialogHelper_URLXEmbeddingInfoDialog (HINSTANCE hInstance, HWND parentWnd,
702 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_URLXEmbeddingInfoBoxID));
703#endif
704
705 public:
706 SDKString fEmbeddingTypeName;
707 SDKString fTitleText;
708 SDKString fURLText;
709
710 protected:
711 virtual void PreDoModalHook () override;
712
713 public:
714 virtual void OnOK () override;
715 };
716#endif
717
718#define kLedStdDlg_AddURLXEmbeddingInfoBoxID 0x100a
719#define kLedStdDlg_AddURLXEmbeddingInfoBox_TitleText (kLedStdDlgCommandBase + 4)
720#define kLedStdDlg_AddURLXEmbeddingInfoBox_URLText (kLedStdDlgCommandBase + 6)
721
722#if defined(__cplusplus)
723 class Led_StdDialogHelper_AddURLXEmbeddingInfoDialog : public Led_StdDialogHelper {
724 private:
725 using inherited = Led_StdDialogHelper;
726
727 public:
728#if qStroika_Platform_Windows
729 Led_StdDialogHelper_AddURLXEmbeddingInfoDialog (HINSTANCE hInstance, HWND parentWnd,
730 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_AddURLXEmbeddingInfoBoxID));
731#endif
732
733 public:
734 SDKString fTitleText;
735 SDKString fURLText;
736
737 protected:
738 virtual void PreDoModalHook () override;
739
740 public:
741 virtual void OnOK () override;
742 };
743#endif
744#endif
745
746#if qStroika_Platform_Windows
747#define kLedStdDlg_AddNewTableBoxID 0x100b
748#define kLedStdDlg_AddNewTableBox_RowCount (kLedStdDlgCommandBase + 5)
749#define kLedStdDlg_AddNewTableBox_ColCount (kLedStdDlgCommandBase + 7)
750
751#if defined(__cplusplus)
752 class Led_StdDialogHelper_AddNewTableDialog : public Led_StdDialogHelper {
753 private:
754 using inherited = Led_StdDialogHelper;
755
756 public:
757#if qStroika_Platform_Windows
758 Led_StdDialogHelper_AddNewTableDialog (HINSTANCE hInstance, HWND parentWnd, const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_AddNewTableBoxID));
759#endif
760
761 public:
762 size_t fRows;
763 size_t fColumns;
764
765 protected:
766 virtual void PreDoModalHook () override;
767
768 public:
769 virtual void OnOK () override;
770 };
771#endif
772#endif
773
774#if qStroika_Platform_Windows
775#define kLedStdDlg_EditTablePropertiesBoxID 0x100c
776#define kLedStdDlg_EditTablePropertiesBox_CellMarginTop (kLedStdDlgCommandBase + 10)
777#define kLedStdDlg_EditTablePropertiesBox_CellMarginLeft (kLedStdDlgCommandBase + 12)
778#define kLedStdDlg_EditTablePropertiesBox_CellMarginBottom (kLedStdDlgCommandBase + 14)
779#define kLedStdDlg_EditTablePropertiesBox_CellMarginRight (kLedStdDlgCommandBase + 16)
780
781#define kLedStdDlg_EditTablePropertiesBox_DefaultCellSpacing (kLedStdDlgCommandBase + 18)
782
783#define kLedStdDlg_EditTablePropertiesBox_CellBackgroundColor (kLedStdDlgCommandBase + 23)
784
785#define kLedStdDlg_EditTablePropertiesBox_ColumnWidth (kLedStdDlgCommandBase + 21)
786
787#define kLedStdDlg_EditTablePropertiesBox_BorderWidth (kLedStdDlgCommandBase + 6)
788#define kLedStdDlg_EditTablePropertiesBox_BorderColor (kLedStdDlgCommandBase + 7)
789
790#if defined(__cplusplus)
791 class Led_StdDialogHelper_EditTablePropertiesDialog : public Led_StdDialogHelper {
792 private:
793 using inherited = Led_StdDialogHelper;
794
795 public:
796#if qStroika_Platform_Windows
797 Led_StdDialogHelper_EditTablePropertiesDialog (HINSTANCE hInstance, HWND parentWnd,
798 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_EditTablePropertiesBoxID));
799#endif
800
801 public:
802 struct Info {
803 Info ();
804
805 TWIPS fTableBorderWidth;
806 Color fTableBorderColor;
807
808 TWIPS_Rect fDefaultCellMargins;
809 TWIPS fCellSpacing;
810
811 bool fCellWidth_Common;
812 TWIPS fCellWidth;
813
814 bool fCellBackgroundColor_Common;
815 Color fCellBackgroundColor;
816 };
817 Info fInfo;
818
819 protected:
820 virtual void PreDoModalHook () override;
821
822 protected:
823#if qStroika_Platform_Windows
824 virtual BOOL DialogProc (UINT message, WPARAM wParam, LPARAM lParam) override;
825#endif
826
827 public:
828 virtual void OnOK () override;
829
830 protected:
831 StdColorPopupHelper fBorderColorPopup;
832 StdColorPopupHelper fCellBackgroundColorPopup;
833
834 public:
835 template <typename T1, typename T2>
836 static void cvt (T1* o, const T2& i);
837 };
838
839 template <typename T1, typename T2>
840 void Led_StdDialogHelper_EditTablePropertiesDialog::cvt (T1* o, const T2& i)
841 {
842 o->fTableBorderWidth = i.fTableBorderWidth;
843 o->fTableBorderColor = i.fTableBorderColor;
844 o->fDefaultCellMargins = i.fDefaultCellMargins;
845 o->fCellSpacing = i.fCellSpacing;
846 o->fCellWidth_Common = i.fCellWidth_Common;
847 o->fCellWidth = i.fCellWidth;
848 o->fCellBackgroundColor_Common = i.fCellBackgroundColor_Common;
849 o->fCellBackgroundColor = i.fCellBackgroundColor;
850 }
851 inline Led_StdDialogHelper_EditTablePropertiesDialog::Info::Info ()
852 : fTableBorderWidth (TWIPS{0})
853 , fTableBorderColor (Color::kWhite)
854 , fDefaultCellMargins ()
855 , fCellSpacing (TWIPS{0})
856 , fCellWidth_Common (false)
857 , fCellWidth (TWIPS{0})
858 , fCellBackgroundColor_Common (false)
859 , fCellBackgroundColor (Color::kWhite)
860 {
861 }
862#endif
863#endif
864
865#if qStroika_Platform_Windows
866#define kLedStdDlg_SpellCheckBoxID 0x100d
867#define kLedStdDlg_SpellCheckBox_UnknownWordText (kLedStdDlgCommandBase + 1)
868#define kLedStdDlg_SpellCheckBox_ChangeText (kLedStdDlgCommandBase + 2)
869#define kLedStdDlg_SpellCheckBox_SuggestedList (kLedStdDlgCommandBase + 3)
870#define kLedStdDlg_SpellCheckBox_IgnoreOnce (kLedStdDlgCommandBase + 4)
871#define kLedStdDlg_SpellCheckBox_IgnoreAll (kLedStdDlgCommandBase + 5)
872#define kLedStdDlg_SpellCheckBox_ChangeOnce (kLedStdDlgCommandBase + 6)
873#define kLedStdDlg_SpellCheckBox_ChangeAll (kLedStdDlgCommandBase + 7)
874#define kLedStdDlg_SpellCheckBox_AddDictionary (kLedStdDlgCommandBase + 8)
875#define kLedStdDlg_SpellCheckBox_LookupOnWeb (kLedStdDlgCommandBase + 9)
876#define kLedStdDlg_SpellCheckBox_Options (kLedStdDlgCommandBase + 10)
877#define kLedStdDlg_SpellCheckBox_Close (kLedStdDlgCommandBase + 11)
878
879#if defined(__cplusplus)
880 class Led_StdDialogHelper_SpellCheckDialog : public Led_StdDialogHelper {
881 private:
882 using inherited = Led_StdDialogHelper;
883
884 public:
885 class SpellCheckDialogCallback;
886 struct MisspellingInfo;
887
888 public:
889#if qStroika_Platform_Windows
890 Led_StdDialogHelper_SpellCheckDialog (SpellCheckDialogCallback& callback, HINSTANCE hInstance, HWND parentWnd,
891 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_SpellCheckBoxID));
892#endif
893 ~Led_StdDialogHelper_SpellCheckDialog ();
894
895 protected:
896 SpellCheckDialogCallback& fCallback;
897
898 protected:
899 MisspellingInfo* fCurrentMisspellInfo;
900
901 protected:
902#if qStroika_Platform_Windows
903 virtual BOOL DialogProc (UINT message, WPARAM wParam, LPARAM lParam) override;
904#endif
905
906 protected:
907#if qStroika_Platform_Windows
908 LedDialogWidget fUndefinedWordWidget;
909 LedDialogWidget fChangeTextWidget;
910#endif
911
912 protected:
913 virtual void PreDoModalHook () override;
914
915 public:
916 virtual void OnIgnoreButton ();
917 virtual void OnIgnoreAllButton ();
918 virtual void OnChangeButton ();
919 virtual void OnChangeAllButton ();
920 virtual void OnAddToDictionaryButton ();
921 virtual void OnLookupOnWebButton ();
922 virtual void OnOptionsDialogButton ();
923 virtual void OnCloseButton ();
924 virtual void OnSuggestionListChangeSelection ();
925 virtual void OnSuggestionListDoubleClick ();
926
927 protected:
928 virtual void DoFindNextCall ();
929
930 public:
931 template <typename DEL>
932 class CallbackDelegator;
933 };
934
935 struct Led_StdDialogHelper_SpellCheckDialog::MisspellingInfo {
936 Led_tString fUndefinedWord;
937 vector<Led_tString> fSuggestions;
938 };
939
940 /*
941 @CLASS: Led_StdDialogHelper_SpellCheckDialog::SpellCheckDialogCallback
942 @DESCRIPTION: <p>This interface is called by the actual spellcheck dialog implematation back to the implementer
943 of the real spellchecking functionality.</p>
944 */
945 class Led_StdDialogHelper_SpellCheckDialog::SpellCheckDialogCallback {
946 public:
947 using MisspellingInfo = Led_StdDialogHelper_SpellCheckDialog::MisspellingInfo;
948
949 public:
950 virtual MisspellingInfo* GetNextMisspelling () = 0;
951
952 public:
953 virtual void DoIgnore () = 0;
954 virtual void DoIgnoreAll () = 0;
955 virtual void DoChange (const Led_tString& changeTo) = 0;
956 virtual void DoChangeAll (const Led_tString& changeTo) = 0;
957 virtual bool AddToDictionaryEnabled () const = 0;
958 virtual void AddToDictionary (const Led_tString& newWord) = 0;
959 virtual void LookupOnWeb (const Led_tString& word) = 0;
960 virtual bool OptionsDialogEnabled () const = 0;
961 virtual void OptionsDialog () = 0;
962 };
963
964 template <typename DEL>
965 class Led_StdDialogHelper_SpellCheckDialog::CallbackDelegator : public Led_StdDialogHelper_SpellCheckDialog::SpellCheckDialogCallback {
966 private:
967 using inherited = SpellCheckDialogCallback;
968
969 public:
970 CallbackDelegator (DEL& del)
971 : inherited ()
972 , fDelegate (del)
973 {
974 }
975
976 public:
977 virtual MisspellingInfo* GetNextMisspelling () override
978 {
979 typename DEL::MisspellingInfo* delResult = fDelegate.GetNextMisspelling ();
980 if (delResult != NULL) {
981 MisspellingInfo* result = new MisspellingInfo;
982 result->fUndefinedWord = delResult->fUndefinedWord;
983 result->fSuggestions = delResult->fSuggestions;
984 delete delResult;
985 return result;
986 }
987 return NULL;
988 }
989
990 public:
991 virtual void DoIgnore () override
992 {
993 fDelegate.DoIgnore ();
994 }
995 virtual void DoIgnoreAll () override
996 {
997 fDelegate.DoIgnoreAll ();
998 }
999 virtual void DoChange (const Led_tString& changeTo) override
1000 {
1001 fDelegate.DoChange (changeTo);
1002 }
1003 virtual void DoChangeAll (const Led_tString& changeTo) override
1004 {
1005 fDelegate.DoChangeAll (changeTo);
1006 }
1007 virtual bool AddToDictionaryEnabled () const override
1008 {
1009 return fDelegate.AddToDictionaryEnabled ();
1010 }
1011 virtual void AddToDictionary (const Led_tString& newWord) override
1012 {
1013 fDelegate.AddToDictionary (newWord);
1014 }
1015 virtual void LookupOnWeb (const Led_tString& word) override
1016 {
1017 fDelegate.LookupOnWeb (word);
1018 }
1019 virtual bool OptionsDialogEnabled () const override
1020 {
1021 return fDelegate.OptionsDialogEnabled ();
1022 }
1023 virtual void OptionsDialog () override
1024 {
1025 fDelegate.OptionsDialog ();
1026 }
1027
1028 private:
1029 DEL& fDelegate;
1030 };
1031#endif
1032#endif
1033#if defined(__cplusplus)
1034}
1035#endif
1036
1037/*
1038 ********************************************************************************
1039 ***************************** Implementation Details ***************************
1040 ********************************************************************************
1041 */
1042#include "StdDialogs.inl"
1043
1044#endif /*__Led_StdDialogs__h__*/
basic_string< SDKChar > SDKString
Definition SDKString.h:38
conditional_t< qStroika_Foundation_Characters_SDKUseswchar_t, wchar_t, char > SDKChar
Definition SDKChar.h:77