Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
StdDialogs.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. 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@CONFIGVAR: qUseGTKForLedStandardDialogs
27@DESCRIPTION: <p>Generally we try to keep toolkit dependencies restricted to the Led_TOOLKIT module(s), such as Led_Gtk.
28 Thats pretty well doable where there is decent native dialog support, such as with Win32 and MacOS. But this isn't
29 very practical for X-Windows. So - I've added a Gtk-dependency to this module as well - just for implementing
30 these standard dialogs.</p>
31 <p>This flag defaults to true, iff qStroika_FeatureSupported_XWindows is true.</p>
32 */
33#ifndef qUseGTKForLedStandardDialogs
34#define qUseGTKForLedStandardDialogs qStroika_FeatureSupported_XWindows
35#endif
36
37#if qUseGTKForLedStandardDialogs
38#include <gtk/gtk.h>
39#endif
40
41// MFC must define something like this someplace, but I haven't found where....
42// Use this for now, so I can update things more easily when I find the MFC definition...
43#ifndef kLedStdDlgCommandBase
44#if qStroika_Foundation_Common_Platform_MacOS
45#define kLedStdDlgCommandBase 0x0
46#elif qStroika_Foundation_Common_Platform_Windows
47#define kLedStdDlgCommandBase 0x1000
48#endif
49#endif
50
51// NOTE - due to quirks of MSDEV .rc compiler - you CANNOT change this #. If you do - it will be out of sync with
52// kLedStdDlg_AboutBoxID etc below. You cannot make kLedStdDlg_AboutBoxID etc below be based on this - or the .rc compiler
53// will silently - but surely - generate the wrong resids. Amazing but true stories -- LGP 2000-10-16
54#define kLedStdDlgIDBase 0x1000
55
56/*
57@CONFIGVAR: qSupportLedDialogWidgets
58@DESCRIPTION: <p>Support the @'LedDialogWidget' class. This requires you link with SimpleTextStore.cpp,
59 SimpleTextImager.cpp, and SimpleTextInteractor.cpp.</p>
60 <p>This flag defaults to true, iff qStroika_Foundation_Common_Platform_Windows is true.</p>
61 */
62#ifndef qSupportLedDialogWidgets
63#define qSupportLedDialogWidgets (qStroika_Foundation_Common_Platform_Windows)
64#endif
65
66#if qSupportLedDialogWidgets && qStroika_Foundation_Common_Platform_Windows && defined(__cplusplus)
67#include "Platform/Windows.h"
68#include "SimpleTextInteractor.h"
69#include "SimpleTextStore.h"
70#endif
71
72#if defined(__cplusplus)
73namespace Stroika::Frameworks::Led {
74#endif
75
76#if defined(__cplusplus)
77 class StdColorPopupHelper {
78 public:
79 StdColorPopupHelper (bool allowNone);
80 ~StdColorPopupHelper ();
81
82 public:
83 nonvirtual bool GetSelectedColor (Color* c) const;
84 nonvirtual void SetSelectedColor (const Color& c);
85 nonvirtual void SetNoSelectedColor ();
86
87 private:
88 bool fIsSelectedColor;
89 Color fSelectedColor{Color::kBlack};
90
91 private:
92 nonvirtual size_t MapColorIdx (const Color& c) const;
93 nonvirtual Color MapColorIdx (size_t i) const;
94
95 private:
96 bool fAllowNone;
97
98#if qStroika_Foundation_Common_Platform_Windows
99 public:
100 nonvirtual void Attach (HWND popup);
101
102 private:
103 HWND fHWnd;
104#endif
105
106#if qStroika_Foundation_Common_Platform_Windows
107 public:
108 nonvirtual void OnSelChange ();
109#endif
110#if qStroika_Foundation_Common_Platform_Windows
111 private:
112 nonvirtual void DoMenuAppends ();
113 nonvirtual void AppendMenuString (const SDKString& s);
114#endif
115 };
116#endif
117
118#if qSupportLedDialogWidgets && defined(__cplusplus)
119
120 namespace LedDialogWidget_Private {
121 using LedDialogWidget_BASE = Platform::Led_Win32_SimpleWndProc_HelperWithSDKMessages<Platform::Led_Win32_Helper<SimpleTextInteractor>>;
122 }
123
124 DISABLE_COMPILER_MSC_WARNING_START (4250) // inherits via dominance warning
125 class LedDialogWidget : public LedDialogWidget_Private::LedDialogWidget_BASE {
126 private:
127 using inherited = LedDialogWidget_Private::LedDialogWidget_BASE;
128
129 public:
130 LedDialogWidget ();
131
132 protected:
133 enum TS_SET_OUTSIDE_BWA {
134 eTS_SET_OUTSIDE_BWA
135 }; /// FILL IN RIGHT LED_CONFIG BWA DEFINE FOR THIS CRAPOLA
136 LedDialogWidget (TS_SET_OUTSIDE_BWA);
137
138 public:
139 virtual ~LedDialogWidget ();
140
141 public:
142 virtual void OnBadUserInput () override;
143
144 public:
145 virtual void OnTypedNormalCharacter (Led_tChar theChar, bool /*optionPressed*/, bool /*shiftPressed*/, bool /*commandPressed*/,
146 bool controlPressed, bool /*altKeyPressed*/) override;
147
148 protected:
149 virtual CommandNumber CharToCommand (Led_tChar theChar) const;
150
151 public:
152 nonvirtual Led_tString GetText () const;
153 nonvirtual void SetText (const Led_tString& t);
154
155 public:
156 SimpleTextStore fTextStore;
157 SingleUndoCommandHandler fCommandHandler;
158 };
159 DISABLE_COMPILER_MSC_WARNING_END (4250)
160
161#endif
162
163#if qSupportLedDialogWidgets && defined(__cplusplus)
164 /*
165 @CLASS: LedComboBoxWidget
166 @DESCRIPTION: <p></p>
167 */
168 class LedComboBoxWidget
169#if qStroika_Foundation_Common_Platform_Windows
170 : public Platform::SimpleWin32WndProcHelper
171#endif
172 {
173#if qStroika_Foundation_Common_Platform_Windows
174 private:
175 using inherited = Platform::SimpleWin32WndProcHelper;
176#endif
177
178 public:
179 LedComboBoxWidget ();
180 virtual ~LedComboBoxWidget ();
181
182#if qStroika_Foundation_Common_Platform_Windows
183 public:
184 nonvirtual bool ReplaceWindow (HWND hWnd);
185#endif
186
187 public:
188 nonvirtual Led_tString GetText () const;
189 nonvirtual void SetText (const Led_tString& t);
190
191 public:
192 nonvirtual vector<Led_tString> GetPopupItems () const;
193 nonvirtual void SetPopupItems (const vector<Led_tString>& pi);
194
195 private:
196 vector<Led_tString> fPopupItems;
197
198#if qStroika_Foundation_Common_Platform_Windows
199 public:
200 virtual LRESULT WndProc (UINT message, WPARAM wParam, LPARAM lParam) override;
201
202 protected:
203 virtual LRESULT OnCreate_Msg (WPARAM wParam, LPARAM lParam);
204 virtual LRESULT OnSize_Msg (WPARAM wParam, LPARAM lParam);
205#endif
206
207#if qStroika_Foundation_Common_Platform_Windows
208 protected:
209 struct MyButton : public SimpleWin32WndProcHelper {
210 using inherited = SimpleWin32WndProcHelper;
211
212 MyButton ();
213 virtual LRESULT WndProc (UINT message, WPARAM wParam, LPARAM lParam) override;
214
215 LedComboBoxWidget* fComboBox;
216 Bitmap fDropDownArrow;
217 };
218 friend struct MyButton;
219#endif
220
221#if qStroika_Foundation_Common_Platform_Windows
222 protected:
223 struct MyComboListBoxPopup : public SimpleWin32WndProcHelper {
224 using inherited = SimpleWin32WndProcHelper;
225
226 MyComboListBoxPopup ();
227 virtual LRESULT WndProc (UINT message, WPARAM wParam, LPARAM lParam) override;
228 nonvirtual void UpdatePopupItems ();
229 nonvirtual void MadeSelection ();
230 nonvirtual void ComputePreferedHeight (DistanceType* prefHeight, size_t* nEltsShown) const;
231
232 LedComboBoxWidget* fComboBox;
233 };
234 friend struct MyComboListBoxPopup;
235#endif
236
237#if qStroika_Foundation_Common_Platform_Windows
238 protected:
239 DISABLE_COMPILER_MSC_WARNING_START (4250) // inherits via dominance warning
240 struct MyTextWidget : public LedDialogWidget {
241 using inherited = LedDialogWidget;
242
243 MyTextWidget ();
244 ~MyTextWidget ();
245 virtual LRESULT WndProc (UINT message, WPARAM wParam, LPARAM lParam) override;
246
247 LedComboBoxWidget* fComboBox;
248 };
249 DISABLE_COMPILER_MSC_WARNING_END (4250)
250 friend struct MyTextWidget;
251#endif
252
253 protected:
254 nonvirtual void ShowPopup ();
255 nonvirtual void HidePopup ();
256 nonvirtual bool PopupShown () const;
257 nonvirtual void TogglePopupShown ();
258
259 private:
260#if qStroika_Foundation_Common_Platform_Windows
261 MyButton fPopupButton;
262 MyComboListBoxPopup fComboListBoxPopup;
263 MyTextWidget fTextWidget;
264 FontObject* fUseWidgetFont;
265#endif
266 };
267#endif
268
269#if defined(__cplusplus)
270 /*
271 @CLASS: Led_StdDialogHelper
272 @DESCRIPTION: <p>A very minimalistic attempt at providing cross-platform dialog support.</p>
273 */
274 class Led_StdDialogHelper {
275 public:
276#if qStroika_Foundation_Common_Platform_Windows
277 Led_StdDialogHelper (HINSTANCE hInstance, const SDKChar* resID, HWND parentWnd);
278#elif (qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs)
279 Led_StdDialogHelper (GtkWindow* parentWindow);
280#endif
281
282 public:
283 virtual ~Led_StdDialogHelper ();
284
285 public:
286 virtual bool DoModal ();
287
288 public:
289 nonvirtual void ReplaceAllTokens (SDKString* m, const SDKString& token, const SDKString& with);
290
291 protected:
292#if (qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs)
293 virtual GtkWidget* MakeWindow ();
294#endif
295 virtual void PreDoModalHook ();
296
297 private:
298#if qStroika_Foundation_Common_Platform_Windows
299 HINSTANCE fHINSTANCE;
300 const SDKChar* fResID; // not a REAL string - fake one for MAKEINTRESOURCE - which is why we don't copy with 'string' class
301 HWND fParentWnd;
302#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
303 GtkWindow* fParentWindow;
304#endif
305
306 public:
307 virtual void OnOK ();
308 virtual void OnCancel ();
309
310 public:
311 nonvirtual bool GetWasOK () const;
312
313 private:
314 bool fWasOK;
315
316 /*
317 * Some cross-platform portability helper functions.
318 */
319 public:
320#if qStroika_Foundation_Common_Platform_Windows
321 using DialogItemID = int;
322#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
323 using DialogItemID = GtkWidget*;
324#endif
325 public:
326#if qStroika_Foundation_Common_Platform_Windows || (qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs)
327 nonvirtual SDKString GetItemText (DialogItemID itemID) const;
328 nonvirtual void SetItemText (DialogItemID itemID, const SDKString& text);
329 nonvirtual void SelectItemText (DialogItemID itemID, size_t from = 0, size_t to = static_cast<size_t> (-1));
330 nonvirtual bool GetItemChecked (DialogItemID itemID) const;
331 nonvirtual void SetItemChecked (DialogItemID itemID, bool checked);
332 nonvirtual bool GetItemEnabled (DialogItemID itemID) const;
333 nonvirtual void SetItemEnabled (DialogItemID itemID, bool enabled);
334 nonvirtual void SetFocusedItem (DialogItemID itemID);
335#endif
336
337 private:
338#if qStroika_Foundation_Common_Platform_Windows
339 bool fSetFocusItemCalled;
340#endif
341
342#if qStroika_Foundation_Common_Platform_Windows
343 public:
344 nonvirtual HWND GetHWND () const;
345 nonvirtual void SetHWND (HWND hWnd);
346
347 private:
348 HWND fHWnd;
349#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
350 public:
351 nonvirtual GtkWidget* GetWindow () const;
352 nonvirtual void SetWindow (GtkWidget* w);
353
354 private:
355 GtkWidget* fWindow;
356
357 public:
358 nonvirtual GtkWidget* GetOKButton () const;
359 nonvirtual void SetOKButton (GtkWidget* okButton);
360
361 private:
362 GtkWidget* fOKButton;
363
364 public:
365 nonvirtual GtkWidget* GetCancelButton () const;
366 nonvirtual void SetCancelButton (GtkWidget* cancelButton);
367
368 private:
369 GtkWidget* fCancelButton;
370#endif
371
372#if qStroika_Foundation_Common_Platform_Windows
373 protected:
374 virtual BOOL OnInitDialog ();
375#endif
376
377#if qStroika_Foundation_Common_Platform_Windows
378 public:
379 static BOOL CALLBACK StaticDialogProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
380
381 protected:
382 virtual BOOL DialogProc (UINT message, WPARAM wParam, LPARAM lParam);
383#endif
384
385#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
386 public:
387 static void Static_OnOKButtonClick (GtkWidget* widget, gpointer data);
388 static void Static_OnCancelButtonClick (GtkWidget* widget, gpointer data);
389 static void Static_OnWindowDeleteRequest (GtkWidget* widget);
390#endif
391 };
392#endif
393
394#ifndef qSupportStdAboutBoxDlg
395#define qSupportStdAboutBoxDlg (qStroika_Foundation_Common_Platform_Windows || qUseGTKForLedStandardDialogs)
396#endif
397
398#if qSupportStdAboutBoxDlg
399#define kLedStdDlg_AboutBoxID 0x1001
400//NB: order of these must track declared order in Mac .r file!
401#define kLedStdDlg_AboutBox_InfoLedFieldID (kLedStdDlgCommandBase + 1)
402#define kLedStdDlg_AboutBox_LedWebPageFieldID (kLedStdDlgCommandBase + 2)
403#define kLedStdDlg_AboutBox_BigPictureFieldID (kLedStdDlgCommandBase + 3)
404#define kLedStdDlg_AboutBox_VersionFieldID (kLedStdDlgCommandBase + 4)
405
406#if defined(__cplusplus)
407 /*
408 @CLASS: Led_StdDialogHelper_AboutBox
409 @DESCRIPTION: <p>You can define qSupportStdAboutBoxDlg to 0 to disable inclusion of this resource/code (for size reasons).</p>
410 */
411 class Led_StdDialogHelper_AboutBox : public Led_StdDialogHelper {
412 private:
413 using inherited = Led_StdDialogHelper;
414
415 public:
416#if qStroika_Foundation_Common_Platform_Windows
417 Led_StdDialogHelper_AboutBox (HINSTANCE hInstance, HWND parentWnd, const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_AboutBoxID));
418#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
419 Led_StdDialogHelper_AboutBox (GtkWindow* parentWindow);
420#endif
421
422#if qStroika_FeatureSupported_XWindows
423 virtual GtkWidget* MakeWindow () override;
424#endif
425
426 protected:
427#if qStroika_Foundation_Common_Platform_Windows
428 virtual BOOL DialogProc (UINT message, WPARAM wParam, LPARAM lParam) override;
429#endif
430
431 public:
432 virtual void OnClickInInfoField ();
433 virtual void OnClickInLedWebPageField ();
434 };
435#endif
436
437#endif
438
439#ifndef qSupportStdFindDlg
440#define qSupportStdFindDlg qStroika_Foundation_Common_Platform_Windows || qStroika_FeatureSupported_XWindows
441#endif
442
443#if qSupportStdFindDlg
444#define kLedStdDlg_FindBoxID 0x1002
445#define kLedStdDlg_FindBox_FindText (kLedStdDlgCommandBase + 1)
446#define kLedStdDlg_FindBox_WrapAtEndOfDoc (kLedStdDlgCommandBase + 2)
447#define kLedStdDlg_FindBox_WholeWord (kLedStdDlgCommandBase + 3)
448#define kLedStdDlg_FindBox_IgnoreCase (kLedStdDlgCommandBase + 4)
449#define kLedStdDlg_FindBox_Find (kLedStdDlgCommandBase + 5)
450#define kLedStdDlg_FindBox_Cancel (kLedStdDlgCommandBase + 6)
451
452#if defined(__cplusplus)
453 /*
454 @CLASS: Led_StdDialogHelper_FindDialog
455 @DESCRIPTION: <p>You can define qSupportStdFindDlg to 0 to disable inclusion of this resource/code (for size reasons).</p>
456 */
457 class Led_StdDialogHelper_FindDialog : public Led_StdDialogHelper {
458 private:
459 using inherited = Led_StdDialogHelper;
460
461 public:
462#if qStroika_Foundation_Common_Platform_MacOS
463 Led_StdDialogHelper_FindDialog (int resID = kLedStdDlg_FindBoxID);
464#elif qStroika_Foundation_Common_Platform_Windows
465 Led_StdDialogHelper_FindDialog (HINSTANCE hInstance, HWND parentWnd, const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_FindBoxID));
466#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
467 Led_StdDialogHelper_FindDialog (GtkWindow* parentWindow);
468#endif
469
470 protected:
471#if qStroika_Foundation_Common_Platform_MacOS
472 virtual bool HandleCommandClick (int itemNum) override;
473#elif qStroika_Foundation_Common_Platform_Windows
474 virtual BOOL DialogProc (UINT message, WPARAM wParam, LPARAM lParam) override;
475#endif
476
477 public:
478 Led_tString fFindText;
479 vector<Led_tString> fRecentFindTextStrings;
480 bool fWrapSearch;
481 bool fWholeWordSearch;
482 bool fCaseSensativeSearch;
483 bool fPressedOK;
484
485 protected:
486#if qSupportLedDialogWidgets
487 LedComboBoxWidget fFindTextWidget;
488#endif
489
490 protected:
491 virtual void PreDoModalHook () override;
492
493 public:
494 virtual void OnFindButton ();
495 virtual void OnDontFindButton ();
496
497#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
498 private:
499 GtkWidget* fLookupTextWidget;
500
501 private:
502 static void Static_OnFindButtonClick (GtkWidget* widget, gpointer data);
503 static void Static_OnDontFindButtonClick (GtkWidget* widget, gpointer data);
504#endif
505 };
506#endif
507#endif
508
509#ifndef qSupportStdReplaceDlg
510#define qSupportStdReplaceDlg qStroika_Foundation_Common_Platform_Windows || qStroika_FeatureSupported_XWindows
511#endif
512
513#if qSupportStdReplaceDlg
514#define kLedStdDlg_ReplaceBoxID 0x1003
515#define kLedStdDlg_ReplaceBox_FindText (kLedStdDlgCommandBase + 1)
516#define kLedStdDlg_ReplaceBox_ReplaceText (kLedStdDlgCommandBase + 2)
517#define kLedStdDlg_ReplaceBox_WrapAtEndOfDoc (kLedStdDlgCommandBase + 3)
518#define kLedStdDlg_ReplaceBox_WholeWord (kLedStdDlgCommandBase + 4)
519#define kLedStdDlg_ReplaceBox_IgnoreCase (kLedStdDlgCommandBase + 5)
520#define kLedStdDlg_ReplaceBox_Find (kLedStdDlgCommandBase + 6)
521#define kLedStdDlg_ReplaceBox_Cancel (kLedStdDlgCommandBase + 7)
522#define kLedStdDlg_ReplaceBox_Replace (kLedStdDlgCommandBase + 8)
523#define kLedStdDlg_ReplaceBox_ReplaceAll (kLedStdDlgCommandBase + 9)
524#define kLedStdDlg_ReplaceBox_ReplaceAllInSelection (kLedStdDlgCommandBase + 10)
525
526#if defined(__cplusplus)
527 /*
528 @CLASS: Led_StdDialogHelper_ReplaceDialog
529 @DESCRIPTION: <p>You can define qSupportStdReplaceDlg to 0 to disable inclusion of this resource/code (for size reasons).</p>
530 */
531 class Led_StdDialogHelper_ReplaceDialog : public Led_StdDialogHelper {
532 private:
533 using inherited = Led_StdDialogHelper;
534
535 public:
536#if qStroika_Foundation_Common_Platform_MacOS
537 Led_StdDialogHelper_ReplaceDialog (int resID = kLedStdDlg_ReplaceBoxID);
538#elif qStroika_Foundation_Common_Platform_Windows
539 Led_StdDialogHelper_ReplaceDialog (HINSTANCE hInstance, HWND parentWnd, const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_ReplaceBoxID));
540#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
541 Led_StdDialogHelper_ReplaceDialog (GtkWindow* parentWindow);
542#endif
543
544 protected:
545#if qStroika_Foundation_Common_Platform_MacOS
546 virtual bool HandleCommandClick (int itemNum) override;
547#elif qStroika_Foundation_Common_Platform_Windows
548 virtual BOOL DialogProc (UINT message, WPARAM wParam, LPARAM lParam) override;
549#endif
550
551 public:
552 Led_tString fFindText;
553 vector<Led_tString> fRecentFindTextStrings;
554 Led_tString fReplaceText;
555 bool fWrapSearch;
556 bool fWholeWordSearch;
557 bool fCaseSensativeSearch;
558
559 public:
560 enum ButtonPressed {
561 eCancel,
562 eFind,
563 eReplace,
564 eReplaceAll,
565 eReplaceAllInSelection
566 };
567 ButtonPressed fPressed;
568
569 protected:
570#if qSupportLedDialogWidgets
571 LedComboBoxWidget fFindTextWidget;
572 LedDialogWidget fReplaceTextWidget;
573#endif
574
575 protected:
576 virtual void PreDoModalHook () override;
577
578 public:
579 virtual void OnFindButton ();
580 virtual void OnReplaceButton ();
581 virtual void OnReplaceAllButton ();
582 virtual void OnReplaceAllInSelectionButton ();
583 virtual void OnDontFindButton ();
584
585 protected:
586 virtual void SaveItems ();
587
588#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
589 private:
590 GtkWidget* fLookupTextWidget;
591 GtkWidget* fReplaceTextWidget;
592
593 private:
594 static void Static_OnFindButtonClick (GtkWidget* widget, gpointer data);
595 static void Static_OnDontFindButtonClick (GtkWidget* widget, gpointer data);
596 static void Static_OnReplaceButtonClick (GtkWidget* widget, gpointer data);
597 static void Static_OnReplaceAllButtonClick (GtkWidget* widget, gpointer data);
598 static void Static_OnReplaceAllInSelectionButtonClick (GtkWidget* widget, gpointer data);
599#endif
600 };
601#endif
602#endif
603
604#if qUseGTKForLedStandardDialogs && qStroika_FeatureSupported_XWindows && defined(__cplusplus)
605 /*
606 @CLASS: StdFontPickBox
607 @DESCRIPTION: <p>XWindows only. You can define qUseGTKForLedStandardDialogs to 0 to disable inclusion of this resource/code (for size reasons).</p>
608 */
609 class StdFontPickBox : public Led_StdDialogHelper {
610 private:
611 using inherited = Led_StdDialogHelper;
612
613 public:
614 StdFontPickBox (GtkWindow* modalParentWindow, const FontSpecification& initialFont);
615
616 public:
617 virtual GtkWidget* MakeWindow () override;
618 virtual void PreDoModalHook () override;
619
620 public:
621 virtual void OnOK () override;
622
623 public:
624 FontSpecification fFont;
625 };
626#endif
627
628#ifndef qSupportStdColorPickBox
629#define qSupportStdColorPickBox \
630 (qStroika_Foundation_Common_Platform_Windows || (qUseGTKForLedStandardDialogs && qStroika_FeatureSupported_XWindows))
631#endif
632
633#if qSupportStdColorPickBox && defined(__cplusplus)
634 /*
635 @CLASS: StdColorPickBox
636 @DESCRIPTION: <p>Only defined if @'qSupportStdColorPickBox' defined. For XWindows, we do our own dialog box using Gtk, but
637 for MacOS, and Win32, this doesn't even use @'Led_StdDialogHelper' - but instead - uses other SDK calls to
638 display the dialog.</p>
639 <p>Either way - you still invoke it with a DoModal () call and consider that OK was pressed and
640 the fColor field filled in if DoModal returns true.
641 </p>
642 */
643 class StdColorPickBox
644#if qUseGTKForLedStandardDialogs && qStroika_FeatureSupported_XWindows
645 : public Led_StdDialogHelper
646#endif
647 {
648#if qUseGTKForLedStandardDialogs && qStroika_FeatureSupported_XWindows
649 private:
650 using inherited = Led_StdDialogHelper;
651#endif
652
653 public:
654#if qStroika_Foundation_Common_Platform_MacOS
655 StdColorPickBox (const Color& initialColor);
656#elif qStroika_Foundation_Common_Platform_Windows
657 StdColorPickBox (const Color& initialColor);
658 StdColorPickBox (HINSTANCE hInstance, HWND parentWnd, const Color& initialColor);
659#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
660 StdColorPickBox (GtkWindow* modalParentWindow, const Color& initialColor);
661#endif
662
663#if qStroika_Foundation_Common_Platform_Windows
664 private:
665 HWND fParentWnd;
666#endif
667
668#if qStroika_Foundation_Common_Platform_Windows
669 public:
670 virtual bool DoModal ();
671#endif
672
673#if qUseGTKForLedStandardDialogs && qStroika_FeatureSupported_XWindows
674 public:
675 virtual GtkWidget* MakeWindow () override;
676 virtual void PreDoModalHook () override;
677
678 public:
679 virtual void OnOK () override;
680#endif
681
682#if qStroika_Foundation_Common_Platform_Windows
683 private:
684 static UINT_PTR CALLBACK ColorPickerINITPROC (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
685#endif
686
687 public:
688 Color fColor;
689 };
690#endif
691
692#ifndef qSupportStdFileDlg
693#define qSupportStdFileDlg qStroika_FeatureSupported_XWindows
694#endif
695
696#if qSupportStdFileDlg && defined(__cplusplus)
697 /*
698 @CLASS: StdFilePickBox
699 @DESCRIPTION: <p>XWindows only.</p>
700 */
701 class StdFilePickBox : public Led_StdDialogHelper {
702 private:
703 using inherited = Led_StdDialogHelper;
704
705 public:
706 StdFilePickBox (GtkWindow* modalParentWindow, const SDKString& title, bool saveDialog, const SDKString& fileName);
707
708 public:
709 virtual GtkWidget* MakeWindow () override;
710 virtual void PreDoModalHook () override;
711
712 public:
713 virtual void OnOK () override;
714
715 public:
716 nonvirtual SDKString GetFileName () const;
717
718 protected:
719 SDKString fTitle;
720 bool fSaveDialog;
721 SDKString fFileName;
722 };
723#endif
724
725#ifndef qSupportUpdateWin32FileAssocDlg
726#define qSupportUpdateWin32FileAssocDlg qStroika_Foundation_Common_Platform_Windows
727#endif
728
729#if qSupportUpdateWin32FileAssocDlg
730#define kLedStdDlg_UpdateWin32FileAssocsDialogID 0x1004
731#define kLedStdDlg_UpdateWin32FileAssocsDialog_Msg (kLedStdDlgCommandBase + 1)
732#define kLedStdDlg_UpdateWin32FileAssocsDialog_KeepCheckingCheckboxMsg (kLedStdDlgCommandBase + 2)
733
734#if defined(__cplusplus)
735 /*
736 @CLASS: Led_StdDialogHelper_UpdateWin32FileAssocsDialog
737 @DESCRIPTION: <p>Windows only.</p>
738 */
739 class Led_StdDialogHelper_UpdateWin32FileAssocsDialog : public Led_StdDialogHelper {
740 private:
741 using inherited = Led_StdDialogHelper;
742
743 public:
744 Led_StdDialogHelper_UpdateWin32FileAssocsDialog (HINSTANCE hInstance, HWND parentWnd,
745 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_UpdateWin32FileAssocsDialogID));
746
747 public:
748 SDKString fAppName;
749 SDKString fTypeList;
750 bool fKeepChecking;
751
752 protected:
753 virtual void PreDoModalHook () override;
754
755 public:
756 virtual void OnOK () override;
757 virtual void OnCancel () override;
758 };
759#endif
760#endif
761
762#ifndef qSupportParagraphIndentsDlg
763#define qSupportParagraphIndentsDlg qStroika_Foundation_Common_Platform_Windows
764#endif
765
766#if qSupportParagraphIndentsDlg
767#define kLedStdDlg_ParagraphIndentsID 0x1005
768#define kLedStdDlg_ParagraphIndents_LeftMarginFieldID (kLedStdDlgCommandBase + 4)
769#define kLedStdDlg_ParagraphIndents_RightMarginFieldID (kLedStdDlgCommandBase + 6)
770#define kLedStdDlg_ParagraphIndents_FirstIndentFieldID (kLedStdDlgCommandBase + 8)
771
772#if defined(__cplusplus)
773 /*
774 @CLASS: Led_StdDialogHelper_ParagraphIndentsDialog
775 @DESCRIPTION: <p>You can define qSupportParagraphIndentsDlg to exlude this from your build (for size reasons)</p>
776 */
777 class Led_StdDialogHelper_ParagraphIndentsDialog : public Led_StdDialogHelper {
778 private:
779 using inherited = Led_StdDialogHelper;
780
781 public:
782#if qStroika_Foundation_Common_Platform_MacOS
783 Led_StdDialogHelper_ParagraphIndentsDialog (int resID = kLedStdDlg_ParagraphIndentsID);
784#elif qStroika_Foundation_Common_Platform_Windows
785 Led_StdDialogHelper_ParagraphIndentsDialog (HINSTANCE hInstance, HWND parentWnd,
786 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_ParagraphIndentsID));
787#endif
788
789 public:
790 virtual void InitValues (TWIPS leftMargin, bool leftMarginValid, TWIPS rightMargin, bool rightMarginValid, TWIPS firstIndent, bool firstIndentValid);
791
792 protected:
793 virtual void PreDoModalHook () override;
794
795 public:
796 virtual void OnOK () override;
797
798 public:
799 bool fLeftMargin_Valid;
800 TWIPS fLeftMargin_Orig;
801 TWIPS fLeftMargin_Result;
802 bool fRightMargin_Valid;
803 TWIPS fRightMargin_Orig;
804 TWIPS fRightMargin_Result;
805 bool fFirstIndent_Valid;
806 TWIPS fFirstIndent_Orig;
807 TWIPS fFirstIndent_Result;
808 };
809#endif
810#endif
811
812#ifndef qSupportParagraphSpacingDlg
813#define qSupportParagraphSpacingDlg qStroika_Foundation_Common_Platform_Windows
814#endif
815
816#if qSupportParagraphSpacingDlg
817#define kLedStdDlg_ParagraphSpacingID 0x1006
818#define kParagraphSpacing_Dialog_SpaceBeforeFieldID (kLedStdDlgCommandBase + 4)
819#define kParagraphSpacing_Dialog_SpaceAfterFieldID (kLedStdDlgCommandBase + 6)
820#define kParagraphSpacing_Dialog_LineSpaceModeFieldID (kLedStdDlgCommandBase + 7)
821#define kParagraphSpacing_Dialog_LineSpaceArgFieldID (kLedStdDlgCommandBase + 8)
822
823#if qStroika_Foundation_Common_Platform_MacOS
824#define kParagraphSpacing_Dialog_LineSpaceMENUID (kLedStdDlgMENUBase + 1)
825#define kParagraphSpacing_Dialog_LineSpaceCNTLID (kLedStdDlgCNTLBase + 1)
826#endif
827
828#if defined(__cplusplus)
829 /*
830 @CLASS: Led_StdDialogHelper_ParagraphSpacingDialog
831 @DESCRIPTION: <p>You can define qSupportParagraphSpacingDlg to exlude this from your build (for size reasons)</p>
832 */
833 class Led_StdDialogHelper_ParagraphSpacingDialog : public Led_StdDialogHelper {
834 private:
835 using inherited = Led_StdDialogHelper;
836
837 public:
838#if qStroika_Foundation_Common_Platform_MacOS
839 Led_StdDialogHelper_ParagraphSpacingDialog (int resID = kLedStdDlg_ParagraphSpacingID);
840#elif qStroika_Foundation_Common_Platform_Windows
841 Led_StdDialogHelper_ParagraphSpacingDialog (HINSTANCE hInstance, HWND parentWnd,
842 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_ParagraphSpacingID));
843#endif
844
845 public:
846 virtual void InitValues (TWIPS spaceBefore, bool spaceBeforeValid, TWIPS spaceAfter, bool spaceAfterValid, LineSpacing lineSpacing,
847 bool lineSpacingValid);
848
849 protected:
850 virtual void PreDoModalHook () override;
851
852 public:
853 virtual void OnOK () override;
854
855 public:
856 bool fSpaceBefore_Valid;
857 TWIPS fSpaceBefore_Orig;
858 TWIPS fSpaceBefore_Result;
859 bool fSpaceAfter_Valid;
860 TWIPS fSpaceAfter_Orig;
861 TWIPS fSpaceAfter_Result;
862 bool fLineSpacing_Valid;
863 LineSpacing fLineSpacing_Orig;
864 LineSpacing fLineSpacing_Result;
865 };
866#endif
867#endif
868
869#ifndef qSupportOtherFontSizeDlg
870#define qSupportOtherFontSizeDlg qStroika_Foundation_Common_Platform_Windows
871#endif
872
873#if qSupportOtherFontSizeDlg
874#define kLedStdDlg_OtherFontSizeID 0x1007
875#define kOtherFontSize_Dialog_FontSizeEditFieldID (kLedStdDlgCommandBase + 4)
876
877#if defined(__cplusplus)
878 /*
879 @CLASS: Led_StdDialogHelper_OtherFontSizeDialog
880 @DESCRIPTION: <p>You can define qSupportOtherFontSizeDlg to exlude this from your build (for size reasons)</p>
881 */
882 class Led_StdDialogHelper_OtherFontSizeDialog : public Led_StdDialogHelper {
883 private:
884 using inherited = Led_StdDialogHelper;
885
886 public:
887#if qStroika_Foundation_Common_Platform_MacOS
888 Led_StdDialogHelper_OtherFontSizeDialog (int resID = kLedStdDlg_OtherFontSizeID);
889#elif qStroika_Foundation_Common_Platform_Windows
890 Led_StdDialogHelper_OtherFontSizeDialog (HINSTANCE hInstance, HWND parentWnd, const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_OtherFontSizeID));
891#endif
892
893 public:
894 virtual void InitValues (DistanceType origFontSize);
895
896 protected:
897 virtual void PreDoModalHook () override;
898
899 public:
900 virtual void OnOK () override;
901
902 public:
903 DistanceType fFontSize_Orig;
904 DistanceType fFontSize_Result;
905 };
906#endif
907#endif
908
909#ifndef qSupportUnknownEmbeddingInfoDlg
910#define qSupportUnknownEmbeddingInfoDlg qStroika_Foundation_Common_Platform_Windows
911#endif
912
913#if qSupportUnknownEmbeddingInfoDlg
914#define kLedStdDlg_UnknownEmbeddingInfoBoxID 0x1008
915#define kLedStdDlg_UnknownEmbeddingInfoBox_TypeTextMsg (kLedStdDlgCommandBase + 1)
916
917#if defined(__cplusplus)
918 /*
919 @CLASS: Led_StdDialogHelper_UnknownEmbeddingInfoDialog
920 @DESCRIPTION: <p>You can define qSupportUnknownEmbeddingInfoDlg to exlude this from your build (for size reasons)</p>
921 */
922 class Led_StdDialogHelper_UnknownEmbeddingInfoDialog : public Led_StdDialogHelper {
923 private:
924 using inherited = Led_StdDialogHelper;
925
926 public:
927#if qStroika_Foundation_Common_Platform_MacOS
928 Led_StdDialogHelper_UnknownEmbeddingInfoDialog (int resID = kLedStdDlg_UnknownEmbeddingInfoBoxID);
929#elif qStroika_Foundation_Common_Platform_Windows
930 Led_StdDialogHelper_UnknownEmbeddingInfoDialog (HINSTANCE hInstance, HWND parentWnd,
931 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_UnknownEmbeddingInfoBoxID));
932#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
933 Led_StdDialogHelper_UnknownEmbeddingInfoDialog (GtkWindow* parentWindow);
934#endif
935
936 public:
937 SDKString fEmbeddingTypeName;
938
939 protected:
940 virtual void PreDoModalHook () override;
941 };
942#endif
943#endif
944
945#ifndef qSupportURLXEmbeddingInfoDlg
946#define qSupportURLXEmbeddingInfoDlg qStroika_Foundation_Common_Platform_Windows
947#endif
948
949#if qSupportURLXEmbeddingInfoDlg
950#define kLedStdDlg_URLXEmbeddingInfoBoxID 0x1009
951#define kLedStdDlg_URLXEmbeddingInfoBox_TypeTextMsg (kLedStdDlgCommandBase + 1)
952#define kLedStdDlg_URLXEmbeddingInfoBox_TitleText (kLedStdDlgCommandBase + 4)
953#define kLedStdDlg_URLXEmbeddingInfoBox_URLText (kLedStdDlgCommandBase + 6)
954
955#if defined(__cplusplus)
956 /*
957 @CLASS: Led_StdDialogHelper_URLXEmbeddingInfoDialog
958 @DESCRIPTION: <p>You can define qSupportURLXEmbeddingInfoDlg to exlude this from your build (for size reasons)</p>
959 */
960 class Led_StdDialogHelper_URLXEmbeddingInfoDialog : public Led_StdDialogHelper {
961 private:
962 using inherited = Led_StdDialogHelper;
963
964 public:
965#if qStroika_Foundation_Common_Platform_MacOS
966 Led_StdDialogHelper_URLXEmbeddingInfoDialog (int resID = kLedStdDlg_URLXEmbeddingInfoBoxID);
967#elif qStroika_Foundation_Common_Platform_Windows
968 Led_StdDialogHelper_URLXEmbeddingInfoDialog (HINSTANCE hInstance, HWND parentWnd,
969 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_URLXEmbeddingInfoBoxID));
970#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
971 Led_StdDialogHelper_URLXEmbeddingInfoDialog (GtkWindow* parentWindow);
972#endif
973
974 public:
975 SDKString fEmbeddingTypeName;
976 SDKString fTitleText;
977 SDKString fURLText;
978
979 protected:
980 virtual void PreDoModalHook () override;
981
982 public:
983 virtual void OnOK () override;
984
985#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
986 private:
987 GtkWidget* fTitleTextWidget;
988 GtkWidget* fURLTextWidget;
989#endif
990 };
991#endif
992
993#define kLedStdDlg_AddURLXEmbeddingInfoBoxID 0x100a
994#define kLedStdDlg_AddURLXEmbeddingInfoBox_TitleText (kLedStdDlgCommandBase + 4)
995#define kLedStdDlg_AddURLXEmbeddingInfoBox_URLText (kLedStdDlgCommandBase + 6)
996
997#if defined(__cplusplus)
998 /*
999 @CLASS: Led_StdDialogHelper_AddURLXEmbeddingInfoDialog
1000 @DESCRIPTION: <p>You can define qSupportURLXEmbeddingInfoDlg to exlude this from your build (for size reasons)</p>
1001 */
1002 class Led_StdDialogHelper_AddURLXEmbeddingInfoDialog : public Led_StdDialogHelper {
1003 private:
1004 using inherited = Led_StdDialogHelper;
1005
1006 public:
1007#if qStroika_Foundation_Common_Platform_MacOS
1008 Led_StdDialogHelper_AddURLXEmbeddingInfoDialog (int resID = kLedStdDlg_AddURLXEmbeddingInfoBoxID);
1009#elif qStroika_Foundation_Common_Platform_Windows
1010 Led_StdDialogHelper_AddURLXEmbeddingInfoDialog (HINSTANCE hInstance, HWND parentWnd,
1011 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_AddURLXEmbeddingInfoBoxID));
1012#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1013 Led_StdDialogHelper_AddURLXEmbeddingInfoDialog (GtkWindow* parentWindow);
1014#endif
1015
1016 public:
1017 SDKString fTitleText;
1018 SDKString fURLText;
1019
1020 protected:
1021 virtual void PreDoModalHook () override;
1022
1023 public:
1024 virtual void OnOK () override;
1025
1026#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1027 private:
1028 GtkWidget* fTitleTextWidget;
1029 GtkWidget* fURLTextWidget;
1030#endif
1031 };
1032#endif
1033#endif
1034
1035#ifndef qSupportAddNewTableDlg
1036#define qSupportAddNewTableDlg qStroika_Foundation_Common_Platform_Windows || qStroika_Foundation_Common_Platform_MacOS
1037#endif
1038
1039#if qSupportAddNewTableDlg
1040#define kLedStdDlg_AddNewTableBoxID 0x100b
1041#define kLedStdDlg_AddNewTableBox_RowCount (kLedStdDlgCommandBase + 5)
1042#define kLedStdDlg_AddNewTableBox_ColCount (kLedStdDlgCommandBase + 7)
1043
1044#if defined(__cplusplus)
1045 /*
1046 @CLASS: Led_StdDialogHelper_AddNewTableDialog
1047 @DESCRIPTION: <p>You can define qSupportAddNewTableDlg to exlude this from your build (for size reasons)</p>
1048 */
1049 class Led_StdDialogHelper_AddNewTableDialog : public Led_StdDialogHelper {
1050 private:
1051 using inherited = Led_StdDialogHelper;
1052
1053 public:
1054#if qStroika_Foundation_Common_Platform_MacOS
1055 Led_StdDialogHelper_AddNewTableDialog (int resID = kLedStdDlg_AddNewTableBoxID);
1056#elif qStroika_Foundation_Common_Platform_Windows
1057 Led_StdDialogHelper_AddNewTableDialog (HINSTANCE hInstance, HWND parentWnd, const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_AddNewTableBoxID));
1058#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1059 Led_StdDialogHelper_AddNewTableDialog (GtkWindow* parentWindow);
1060#endif
1061
1062 public:
1063 size_t fRows;
1064 size_t fColumns;
1065
1066 protected:
1067 virtual void PreDoModalHook () override;
1068
1069 public:
1070 virtual void OnOK () override;
1071 };
1072#endif
1073#endif
1074
1075#ifndef qSupportEditTablePropertiesDlg
1076#define qSupportEditTablePropertiesDlg qStroika_Foundation_Common_Platform_Windows || qStroika_Foundation_Common_Platform_MacOS
1077#endif
1078
1079#if qSupportEditTablePropertiesDlg
1080#define kLedStdDlg_EditTablePropertiesBoxID 0x100c
1081#define kLedStdDlg_EditTablePropertiesBox_CellMarginTop (kLedStdDlgCommandBase + 10)
1082#define kLedStdDlg_EditTablePropertiesBox_CellMarginLeft (kLedStdDlgCommandBase + 12)
1083#define kLedStdDlg_EditTablePropertiesBox_CellMarginBottom (kLedStdDlgCommandBase + 14)
1084#define kLedStdDlg_EditTablePropertiesBox_CellMarginRight (kLedStdDlgCommandBase + 16)
1085
1086#define kLedStdDlg_EditTablePropertiesBox_DefaultCellSpacing (kLedStdDlgCommandBase + 18)
1087
1088#define kLedStdDlg_EditTablePropertiesBox_CellBackgroundColor (kLedStdDlgCommandBase + 23)
1089
1090#define kLedStdDlg_EditTablePropertiesBox_ColumnWidth (kLedStdDlgCommandBase + 21)
1091
1092#define kLedStdDlg_EditTablePropertiesBox_BorderWidth (kLedStdDlgCommandBase + 6)
1093#define kLedStdDlg_EditTablePropertiesBox_BorderColor (kLedStdDlgCommandBase + 7)
1094
1095#if qStroika_Foundation_Common_Platform_MacOS
1096#define kLedStdDlg_EditTablePropertiesBox_BorderColorMENUID (kLedStdDlgMENUBase + 2)
1097#define kLedStdDlg_EditTablePropertiesBox_BorderColorCNTLID (kLedStdDlgCNTLBase + 2)
1098
1099#define kLedStdDlg_EditTablePropertiesBox_CellBackgroundColorMENUID (kLedStdDlgMENUBase + 3)
1100#define kLedStdDlg_EditTablePropertiesBox_CellBackgroundColorCNTLID (kLedStdDlgCNTLBase + 3)
1101#endif
1102
1103#if defined(__cplusplus)
1104 /*
1105 @CLASS: Led_StdDialogHelper_EditTablePropertiesDialog
1106 @DESCRIPTION: <p>You can define qSupportEditTablePropertiesDlg to exlude this from your build (for size reasons)</p>
1107 */
1108 class Led_StdDialogHelper_EditTablePropertiesDialog : public Led_StdDialogHelper {
1109 private:
1110 using inherited = Led_StdDialogHelper;
1111
1112 public:
1113#if qStroika_Foundation_Common_Platform_MacOS
1114 Led_StdDialogHelper_EditTablePropertiesDialog (int resID = kLedStdDlg_EditTablePropertiesBoxID);
1115#elif qStroika_Foundation_Common_Platform_Windows
1116 Led_StdDialogHelper_EditTablePropertiesDialog (HINSTANCE hInstance, HWND parentWnd,
1117 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_EditTablePropertiesBoxID));
1118#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1119 Led_StdDialogHelper_EditTablePropertiesDialog (GtkWindow* parentWindow);
1120#endif
1121
1122 public:
1123 struct Info {
1124 Info ();
1125
1126 TWIPS fTableBorderWidth;
1127 Color fTableBorderColor;
1128
1129 TWIPS_Rect fDefaultCellMargins;
1130 TWIPS fCellSpacing;
1131
1132 bool fCellWidth_Common;
1133 TWIPS fCellWidth;
1134
1135 bool fCellBackgroundColor_Common;
1136 Color fCellBackgroundColor;
1137 };
1138 Info fInfo;
1139
1140 protected:
1141 virtual void PreDoModalHook () override;
1142
1143 protected:
1144#if qStroika_Foundation_Common_Platform_Windows
1145 virtual BOOL DialogProc (UINT message, WPARAM wParam, LPARAM lParam) override;
1146#endif
1147
1148 public:
1149 virtual void OnOK () override;
1150
1151 protected:
1152 StdColorPopupHelper fBorderColorPopup;
1153 StdColorPopupHelper fCellBackgroundColorPopup;
1154
1155 public:
1156 template <typename T1, typename T2>
1157 static void cvt (T1* o, const T2& i);
1158 };
1159
1160 template <typename T1, typename T2>
1161 void Led_StdDialogHelper_EditTablePropertiesDialog::cvt (T1* o, const T2& i)
1162 {
1163 o->fTableBorderWidth = i.fTableBorderWidth;
1164 o->fTableBorderColor = i.fTableBorderColor;
1165 o->fDefaultCellMargins = i.fDefaultCellMargins;
1166 o->fCellSpacing = i.fCellSpacing;
1167 o->fCellWidth_Common = i.fCellWidth_Common;
1168 o->fCellWidth = i.fCellWidth;
1169 o->fCellBackgroundColor_Common = i.fCellBackgroundColor_Common;
1170 o->fCellBackgroundColor = i.fCellBackgroundColor;
1171 }
1172 inline Led_StdDialogHelper_EditTablePropertiesDialog::Info::Info ()
1173 : fTableBorderWidth (TWIPS{0})
1174 , fTableBorderColor (Color::kWhite)
1175 , fDefaultCellMargins ()
1176 , fCellSpacing (TWIPS{0})
1177 , fCellWidth_Common (false)
1178 , fCellWidth (TWIPS{0})
1179 , fCellBackgroundColor_Common (false)
1180 , fCellBackgroundColor (Color::kWhite)
1181 {
1182 }
1183#endif
1184#endif
1185
1186#ifndef qSupportStdSpellCheckDlg
1187#define qSupportStdSpellCheckDlg qStroika_Foundation_Common_Platform_Windows || qStroika_FeatureSupported_XWindows
1188#endif
1189
1190#if qSupportStdSpellCheckDlg
1191#define kLedStdDlg_SpellCheckBoxID 0x100d
1192#define kLedStdDlg_SpellCheckBox_UnknownWordText (kLedStdDlgCommandBase + 1)
1193#define kLedStdDlg_SpellCheckBox_ChangeText (kLedStdDlgCommandBase + 2)
1194#define kLedStdDlg_SpellCheckBox_SuggestedList (kLedStdDlgCommandBase + 3)
1195#define kLedStdDlg_SpellCheckBox_IgnoreOnce (kLedStdDlgCommandBase + 4)
1196#define kLedStdDlg_SpellCheckBox_IgnoreAll (kLedStdDlgCommandBase + 5)
1197#define kLedStdDlg_SpellCheckBox_ChangeOnce (kLedStdDlgCommandBase + 6)
1198#define kLedStdDlg_SpellCheckBox_ChangeAll (kLedStdDlgCommandBase + 7)
1199#define kLedStdDlg_SpellCheckBox_AddDictionary (kLedStdDlgCommandBase + 8)
1200#define kLedStdDlg_SpellCheckBox_LookupOnWeb (kLedStdDlgCommandBase + 9)
1201#define kLedStdDlg_SpellCheckBox_Options (kLedStdDlgCommandBase + 10)
1202#define kLedStdDlg_SpellCheckBox_Close (kLedStdDlgCommandBase + 11)
1203
1204#if qStroika_Foundation_Common_Platform_MacOS
1205#define kLedStdDlg_SpellCheckBox_SuggestionsCNTLID (kLedStdDlgCNTLBase + 4)
1206#endif
1207
1208#if defined(__cplusplus)
1209 /*
1210 @CLASS: Led_StdDialogHelper_SpellCheckDialog
1211 @DESCRIPTION: <p>You can define qSupportStdSpellCheckDlg to 0 to disable inclusion of this resource/code (for size reasons).</p>
1212 */
1213 class Led_StdDialogHelper_SpellCheckDialog : public Led_StdDialogHelper {
1214 private:
1215 using inherited = Led_StdDialogHelper;
1216
1217 public:
1218 class SpellCheckDialogCallback;
1219 struct MisspellingInfo;
1220
1221 public:
1222#if qStroika_Foundation_Common_Platform_MacOS
1223 Led_StdDialogHelper_SpellCheckDialog (SpellCheckDialogCallback& callback, int resID = kLedStdDlg_SpellCheckBoxID);
1224#elif qStroika_Foundation_Common_Platform_Windows
1225 Led_StdDialogHelper_SpellCheckDialog (SpellCheckDialogCallback& callback, HINSTANCE hInstance, HWND parentWnd,
1226 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_SpellCheckBoxID));
1227#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1228 Led_StdDialogHelper_SpellCheckDialog (SpellCheckDialogCallback& callback, GtkWindow* parentWindow);
1229#endif
1230 ~Led_StdDialogHelper_SpellCheckDialog ();
1231
1232 protected:
1233 SpellCheckDialogCallback& fCallback;
1234
1235 protected:
1236 MisspellingInfo* fCurrentMisspellInfo;
1237
1238 protected:
1239#if qStroika_Foundation_Common_Platform_MacOS
1240 virtual bool HandleCommandClick (int itemNum) override;
1241#elif qStroika_Foundation_Common_Platform_Windows
1242 virtual BOOL DialogProc (UINT message, WPARAM wParam, LPARAM lParam) override;
1243#endif
1244
1245 protected:
1246#if qSupportLedDialogWidgets
1247 LedDialogWidget fUndefinedWordWidget;
1248 LedDialogWidget fChangeTextWidget;
1249#endif
1250
1251 protected:
1252 virtual void PreDoModalHook () override;
1253
1254 public:
1255 virtual void OnIgnoreButton ();
1256 virtual void OnIgnoreAllButton ();
1257 virtual void OnChangeButton ();
1258 virtual void OnChangeAllButton ();
1259 virtual void OnAddToDictionaryButton ();
1260 virtual void OnLookupOnWebButton ();
1261 virtual void OnOptionsDialogButton ();
1262 virtual void OnCloseButton ();
1263 virtual void OnSuggestionListChangeSelection ();
1264 virtual void OnSuggestionListDoubleClick ();
1265
1266 protected:
1267 virtual void DoFindNextCall ();
1268
1269#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1270 private:
1271 GtkWidget* fLookupTextWidget;
1272 GtkWidget* fChangeTextWidget;
1273
1274 private:
1275 static void Static_OnIgnoreButtonClick (GtkWidget* widget, gpointer data);
1276 static void Static_OnIgnoreAllButtonClick (GtkWidget* widget, gpointer data);
1277 static void Static_OnChangeButtonClick (GtkWidget* widget, gpointer data);
1278 static void Static_OnChangeAllButtonClick (GtkWidget* widget, gpointer data);
1279 static void Static_OnAddToDictionaryButtonClick (GtkWidget* widget, gpointer data);
1280 static void Static_OnLookupOnWebButtonClick (GtkWidget* widget, gpointer data);
1281 static void Static_OnOptionsDialogButtonClick (GtkWidget* widget, gpointer data);
1282 static void Static_OnCloseButtonClick (GtkWidget* widget, gpointer data);
1283#endif
1284
1285 public:
1286 template <typename DEL>
1287 class CallbackDelegator;
1288 };
1289
1290 struct Led_StdDialogHelper_SpellCheckDialog::MisspellingInfo {
1291 Led_tString fUndefinedWord;
1292 vector<Led_tString> fSuggestions;
1293 };
1294
1295 /*
1296 @CLASS: Led_StdDialogHelper_SpellCheckDialog::SpellCheckDialogCallback
1297 @DESCRIPTION: <p>This interface is called by the actual spellcheck dialog implematation back to the implementer
1298 of the real spellchecking functionality.</p>
1299 */
1300 class Led_StdDialogHelper_SpellCheckDialog::SpellCheckDialogCallback {
1301 public:
1302 using MisspellingInfo = Led_StdDialogHelper_SpellCheckDialog::MisspellingInfo;
1303
1304 public:
1305 virtual MisspellingInfo* GetNextMisspelling () = 0;
1306
1307 public:
1308 virtual void DoIgnore () = 0;
1309 virtual void DoIgnoreAll () = 0;
1310 virtual void DoChange (const Led_tString& changeTo) = 0;
1311 virtual void DoChangeAll (const Led_tString& changeTo) = 0;
1312 virtual bool AddToDictionaryEnabled () const = 0;
1313 virtual void AddToDictionary (const Led_tString& newWord) = 0;
1314 virtual void LookupOnWeb (const Led_tString& word) = 0;
1315 virtual bool OptionsDialogEnabled () const = 0;
1316 virtual void OptionsDialog () = 0;
1317 };
1318
1319 template <typename DEL>
1320 class Led_StdDialogHelper_SpellCheckDialog::CallbackDelegator : public Led_StdDialogHelper_SpellCheckDialog::SpellCheckDialogCallback {
1321 private:
1322 using inherited = SpellCheckDialogCallback;
1323
1324 public:
1325 CallbackDelegator (DEL& del)
1326 : inherited ()
1327 , fDelegate (del)
1328 {
1329 }
1330
1331 public:
1332 virtual MisspellingInfo* GetNextMisspelling () override
1333 {
1334 typename DEL::MisspellingInfo* delResult = fDelegate.GetNextMisspelling ();
1335 if (delResult != NULL) {
1336 MisspellingInfo* result = new MisspellingInfo;
1337 result->fUndefinedWord = delResult->fUndefinedWord;
1338 result->fSuggestions = delResult->fSuggestions;
1339 delete delResult;
1340 return result;
1341 }
1342 return NULL;
1343 }
1344
1345 public:
1346 virtual void DoIgnore () override
1347 {
1348 fDelegate.DoIgnore ();
1349 }
1350 virtual void DoIgnoreAll () override
1351 {
1352 fDelegate.DoIgnoreAll ();
1353 }
1354 virtual void DoChange (const Led_tString& changeTo) override
1355 {
1356 fDelegate.DoChange (changeTo);
1357 }
1358 virtual void DoChangeAll (const Led_tString& changeTo) override
1359 {
1360 fDelegate.DoChangeAll (changeTo);
1361 }
1362 virtual bool AddToDictionaryEnabled () const override
1363 {
1364 return fDelegate.AddToDictionaryEnabled ();
1365 }
1366 virtual void AddToDictionary (const Led_tString& newWord) override
1367 {
1368 fDelegate.AddToDictionary (newWord);
1369 }
1370 virtual void LookupOnWeb (const Led_tString& word) override
1371 {
1372 fDelegate.LookupOnWeb (word);
1373 }
1374 virtual bool OptionsDialogEnabled () const override
1375 {
1376 return fDelegate.OptionsDialogEnabled ();
1377 }
1378 virtual void OptionsDialog () override
1379 {
1380 fDelegate.OptionsDialog ();
1381 }
1382
1383 private:
1384 DEL& fDelegate;
1385 };
1386#endif
1387#endif
1388#if defined(__cplusplus)
1389}
1390#endif
1391
1392/*
1393 ********************************************************************************
1394 ***************************** Implementation Details ***************************
1395 ********************************************************************************
1396 */
1397#include "StdDialogs.inl"
1398
1399#endif /*__Led_StdDialogs__h__*/
conditional_t< qTargetPlatformSDKUseswchar_t, wchar_t, char > SDKChar
Definition SDKChar.h:71
basic_string< SDKChar > SDKString
Definition SDKString.h:38