4#ifndef __Led_StdDialogs__h__
5#define __Led_StdDialogs__h__ 1
16#include "Stroika/Frameworks/StroikaPreComp.h"
18#include "Stroika/Frameworks/Led/Config.h"
20#if defined(__cplusplus)
21#include "Stroika/Frameworks/Led/GDI.h"
22#include "Stroika/Frameworks/Led/Support.h"
33#ifndef qUseGTKForLedStandardDialogs
34#define qUseGTKForLedStandardDialogs qStroika_FeatureSupported_XWindows
37#if qUseGTKForLedStandardDialogs
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
54#define kLedStdDlgIDBase 0x1000
62#ifndef qSupportLedDialogWidgets
63#define qSupportLedDialogWidgets (qStroika_Foundation_Common_Platform_Windows)
66#if qSupportLedDialogWidgets && qStroika_Foundation_Common_Platform_Windows && defined(__cplusplus)
67#include "Platform/Windows.h"
68#include "SimpleTextInteractor.h"
69#include "SimpleTextStore.h"
72#if defined(__cplusplus)
73namespace Stroika::Frameworks::Led {
76#if defined(__cplusplus)
77 class StdColorPopupHelper {
79 StdColorPopupHelper (
bool allowNone);
80 ~StdColorPopupHelper ();
83 nonvirtual
bool GetSelectedColor (Color* c)
const;
84 nonvirtual
void SetSelectedColor (
const Color& c);
85 nonvirtual
void SetNoSelectedColor ();
88 bool fIsSelectedColor;
89 Color fSelectedColor{Color::kBlack};
92 nonvirtual
size_t MapColorIdx (
const Color& c)
const;
93 nonvirtual Color MapColorIdx (
size_t i)
const;
98#if qStroika_Foundation_Common_Platform_Windows
100 nonvirtual
void Attach (HWND popup);
106#if qStroika_Foundation_Common_Platform_Windows
108 nonvirtual
void OnSelChange ();
110#if qStroika_Foundation_Common_Platform_Windows
112 nonvirtual
void DoMenuAppends ();
113 nonvirtual
void AppendMenuString (
const SDKString& s);
118#if qSupportLedDialogWidgets && defined(__cplusplus)
120 namespace LedDialogWidget_Private {
121 using LedDialogWidget_BASE = Platform::Led_Win32_SimpleWndProc_HelperWithSDKMessages<Platform::Led_Win32_Helper<SimpleTextInteractor>>;
124 DISABLE_COMPILER_MSC_WARNING_START (4250)
125 class LedDialogWidget : public LedDialogWidget_Private::LedDialogWidget_BASE {
127 using inherited = LedDialogWidget_Private::LedDialogWidget_BASE;
133 enum TS_SET_OUTSIDE_BWA {
136 LedDialogWidget (TS_SET_OUTSIDE_BWA);
139 virtual ~LedDialogWidget ();
142 virtual void OnBadUserInput ()
override;
145 virtual void OnTypedNormalCharacter (Led_tChar theChar,
bool ,
bool ,
bool ,
146 bool controlPressed,
bool )
override;
149 virtual CommandNumber CharToCommand (Led_tChar theChar)
const;
152 nonvirtual Led_tString GetText ()
const;
153 nonvirtual
void SetText (
const Led_tString& t);
156 SimpleTextStore fTextStore;
157 SingleUndoCommandHandler fCommandHandler;
159 DISABLE_COMPILER_MSC_WARNING_END (4250)
163#if qSupportLedDialogWidgets && defined(__cplusplus)
168 class LedComboBoxWidget
169#if qStroika_Foundation_Common_Platform_Windows
170 :
public Platform::SimpleWin32WndProcHelper
173#if qStroika_Foundation_Common_Platform_Windows
175 using inherited = Platform::SimpleWin32WndProcHelper;
179 LedComboBoxWidget ();
180 virtual ~LedComboBoxWidget ();
182#if qStroika_Foundation_Common_Platform_Windows
184 nonvirtual
bool ReplaceWindow (HWND hWnd);
188 nonvirtual Led_tString GetText ()
const;
189 nonvirtual
void SetText (
const Led_tString& t);
192 nonvirtual vector<Led_tString> GetPopupItems ()
const;
193 nonvirtual
void SetPopupItems (
const vector<Led_tString>& pi);
196 vector<Led_tString> fPopupItems;
198#if qStroika_Foundation_Common_Platform_Windows
200 virtual LRESULT WndProc (UINT message, WPARAM wParam, LPARAM lParam)
override;
203 virtual LRESULT OnCreate_Msg (WPARAM wParam, LPARAM lParam);
204 virtual LRESULT OnSize_Msg (WPARAM wParam, LPARAM lParam);
207#if qStroika_Foundation_Common_Platform_Windows
209 struct MyButton :
public SimpleWin32WndProcHelper {
210 using inherited = SimpleWin32WndProcHelper;
213 virtual LRESULT WndProc (UINT message, WPARAM wParam, LPARAM lParam)
override;
215 LedComboBoxWidget* fComboBox;
216 Bitmap fDropDownArrow;
218 friend struct MyButton;
221#if qStroika_Foundation_Common_Platform_Windows
223 struct MyComboListBoxPopup :
public SimpleWin32WndProcHelper {
224 using inherited = SimpleWin32WndProcHelper;
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;
232 LedComboBoxWidget* fComboBox;
234 friend struct MyComboListBoxPopup;
237#if qStroika_Foundation_Common_Platform_Windows
239 DISABLE_COMPILER_MSC_WARNING_START (4250)
240 struct MyTextWidget : public LedDialogWidget {
241 using inherited = LedDialogWidget;
245 virtual LRESULT WndProc (UINT message, WPARAM wParam, LPARAM lParam)
override;
247 LedComboBoxWidget* fComboBox;
249 DISABLE_COMPILER_MSC_WARNING_END (4250)
250 friend struct MyTextWidget;
254 nonvirtual
void ShowPopup ();
255 nonvirtual
void HidePopup ();
256 nonvirtual
bool PopupShown ()
const;
257 nonvirtual
void TogglePopupShown ();
260#if qStroika_Foundation_Common_Platform_Windows
261 MyButton fPopupButton;
262 MyComboListBoxPopup fComboListBoxPopup;
263 MyTextWidget fTextWidget;
264 FontObject* fUseWidgetFont;
269#if defined(__cplusplus)
274 class Led_StdDialogHelper {
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);
283 virtual ~Led_StdDialogHelper ();
286 virtual bool DoModal ();
289 nonvirtual
void ReplaceAllTokens (SDKString* m,
const SDKString& token,
const SDKString& with);
292#if (qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs)
293 virtual GtkWidget* MakeWindow ();
295 virtual void PreDoModalHook ();
298#if qStroika_Foundation_Common_Platform_Windows
299 HINSTANCE fHINSTANCE;
302#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
303 GtkWindow* fParentWindow;
307 virtual void OnOK ();
308 virtual void OnCancel ();
311 nonvirtual
bool GetWasOK ()
const;
320#if qStroika_Foundation_Common_Platform_Windows
321 using DialogItemID = int;
322#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
323 using DialogItemID = GtkWidget*;
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);
338#if qStroika_Foundation_Common_Platform_Windows
339 bool fSetFocusItemCalled;
342#if qStroika_Foundation_Common_Platform_Windows
344 nonvirtual HWND GetHWND ()
const;
345 nonvirtual
void SetHWND (HWND hWnd);
349#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
351 nonvirtual GtkWidget* GetWindow ()
const;
352 nonvirtual
void SetWindow (GtkWidget* w);
358 nonvirtual GtkWidget* GetOKButton ()
const;
359 nonvirtual
void SetOKButton (GtkWidget* okButton);
362 GtkWidget* fOKButton;
365 nonvirtual GtkWidget* GetCancelButton ()
const;
366 nonvirtual
void SetCancelButton (GtkWidget* cancelButton);
369 GtkWidget* fCancelButton;
372#if qStroika_Foundation_Common_Platform_Windows
374 virtual BOOL OnInitDialog ();
377#if qStroika_Foundation_Common_Platform_Windows
379 static BOOL CALLBACK StaticDialogProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
382 virtual BOOL DialogProc (UINT message, WPARAM wParam, LPARAM lParam);
385#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
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);
394#ifndef qSupportStdAboutBoxDlg
395#define qSupportStdAboutBoxDlg (qStroika_Foundation_Common_Platform_Windows || qUseGTKForLedStandardDialogs)
398#if qSupportStdAboutBoxDlg
399#define kLedStdDlg_AboutBoxID 0x1001
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)
406#if defined(__cplusplus)
411 class Led_StdDialogHelper_AboutBox :
public Led_StdDialogHelper {
413 using inherited = Led_StdDialogHelper;
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);
422#if qStroika_FeatureSupported_XWindows
423 virtual GtkWidget* MakeWindow ()
override;
427#if qStroika_Foundation_Common_Platform_Windows
428 virtual BOOL DialogProc (UINT message, WPARAM wParam, LPARAM lParam)
override;
432 virtual void OnClickInInfoField ();
433 virtual void OnClickInLedWebPageField ();
439#ifndef qSupportStdFindDlg
440#define qSupportStdFindDlg qStroika_Foundation_Common_Platform_Windows || qStroika_FeatureSupported_XWindows
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)
452#if defined(__cplusplus)
457 class Led_StdDialogHelper_FindDialog :
public Led_StdDialogHelper {
459 using inherited = Led_StdDialogHelper;
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);
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;
478 Led_tString fFindText;
479 vector<Led_tString> fRecentFindTextStrings;
481 bool fWholeWordSearch;
482 bool fCaseSensativeSearch;
486#if qSupportLedDialogWidgets
487 LedComboBoxWidget fFindTextWidget;
491 virtual void PreDoModalHook ()
override;
494 virtual void OnFindButton ();
495 virtual void OnDontFindButton ();
497#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
499 GtkWidget* fLookupTextWidget;
502 static void Static_OnFindButtonClick (GtkWidget* widget, gpointer data);
503 static void Static_OnDontFindButtonClick (GtkWidget* widget, gpointer data);
509#ifndef qSupportStdReplaceDlg
510#define qSupportStdReplaceDlg qStroika_Foundation_Common_Platform_Windows || qStroika_FeatureSupported_XWindows
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)
526#if defined(__cplusplus)
531 class Led_StdDialogHelper_ReplaceDialog :
public Led_StdDialogHelper {
533 using inherited = Led_StdDialogHelper;
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);
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;
552 Led_tString fFindText;
553 vector<Led_tString> fRecentFindTextStrings;
554 Led_tString fReplaceText;
556 bool fWholeWordSearch;
557 bool fCaseSensativeSearch;
565 eReplaceAllInSelection
567 ButtonPressed fPressed;
570#if qSupportLedDialogWidgets
571 LedComboBoxWidget fFindTextWidget;
572 LedDialogWidget fReplaceTextWidget;
576 virtual void PreDoModalHook ()
override;
579 virtual void OnFindButton ();
580 virtual void OnReplaceButton ();
581 virtual void OnReplaceAllButton ();
582 virtual void OnReplaceAllInSelectionButton ();
583 virtual void OnDontFindButton ();
586 virtual void SaveItems ();
588#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
590 GtkWidget* fLookupTextWidget;
591 GtkWidget* fReplaceTextWidget;
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);
604#if qUseGTKForLedStandardDialogs && qStroika_FeatureSupported_XWindows && defined(__cplusplus)
609 class StdFontPickBox :
public Led_StdDialogHelper {
611 using inherited = Led_StdDialogHelper;
614 StdFontPickBox (GtkWindow* modalParentWindow,
const FontSpecification& initialFont);
617 virtual GtkWidget* MakeWindow ()
override;
618 virtual void PreDoModalHook ()
override;
621 virtual void OnOK ()
override;
624 FontSpecification fFont;
628#ifndef qSupportStdColorPickBox
629#define qSupportStdColorPickBox \
630 (qStroika_Foundation_Common_Platform_Windows || (qUseGTKForLedStandardDialogs && qStroika_FeatureSupported_XWindows))
633#if qSupportStdColorPickBox && defined(__cplusplus)
643 class StdColorPickBox
644#if qUseGTKForLedStandardDialogs && qStroika_FeatureSupported_XWindows
645 :
public Led_StdDialogHelper
648#if qUseGTKForLedStandardDialogs && qStroika_FeatureSupported_XWindows
650 using inherited = Led_StdDialogHelper;
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);
663#if qStroika_Foundation_Common_Platform_Windows
668#if qStroika_Foundation_Common_Platform_Windows
670 virtual bool DoModal ();
673#if qUseGTKForLedStandardDialogs && qStroika_FeatureSupported_XWindows
675 virtual GtkWidget* MakeWindow ()
override;
676 virtual void PreDoModalHook ()
override;
679 virtual void OnOK ()
override;
682#if qStroika_Foundation_Common_Platform_Windows
684 static UINT_PTR CALLBACK ColorPickerINITPROC (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
692#ifndef qSupportStdFileDlg
693#define qSupportStdFileDlg qStroika_FeatureSupported_XWindows
696#if qSupportStdFileDlg && defined(__cplusplus)
701 class StdFilePickBox :
public Led_StdDialogHelper {
703 using inherited = Led_StdDialogHelper;
706 StdFilePickBox (GtkWindow* modalParentWindow,
const SDKString& title,
bool saveDialog,
const SDKString& fileName);
709 virtual GtkWidget* MakeWindow ()
override;
710 virtual void PreDoModalHook ()
override;
713 virtual void OnOK ()
override;
716 nonvirtual
SDKString GetFileName ()
const;
725#ifndef qSupportUpdateWin32FileAssocDlg
726#define qSupportUpdateWin32FileAssocDlg qStroika_Foundation_Common_Platform_Windows
729#if qSupportUpdateWin32FileAssocDlg
730#define kLedStdDlg_UpdateWin32FileAssocsDialogID 0x1004
731#define kLedStdDlg_UpdateWin32FileAssocsDialog_Msg (kLedStdDlgCommandBase + 1)
732#define kLedStdDlg_UpdateWin32FileAssocsDialog_KeepCheckingCheckboxMsg (kLedStdDlgCommandBase + 2)
734#if defined(__cplusplus)
739 class Led_StdDialogHelper_UpdateWin32FileAssocsDialog :
public Led_StdDialogHelper {
741 using inherited = Led_StdDialogHelper;
744 Led_StdDialogHelper_UpdateWin32FileAssocsDialog (HINSTANCE hInstance, HWND parentWnd,
745 const SDKChar* resID = MAKEINTRESOURCE (kLedStdDlg_UpdateWin32FileAssocsDialogID));
753 virtual void PreDoModalHook ()
override;
756 virtual void OnOK ()
override;
757 virtual void OnCancel ()
override;
762#ifndef qSupportParagraphIndentsDlg
763#define qSupportParagraphIndentsDlg qStroika_Foundation_Common_Platform_Windows
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)
772#if defined(__cplusplus)
777 class Led_StdDialogHelper_ParagraphIndentsDialog :
public Led_StdDialogHelper {
779 using inherited = Led_StdDialogHelper;
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));
790 virtual void InitValues (TWIPS leftMargin,
bool leftMarginValid, TWIPS rightMargin,
bool rightMarginValid, TWIPS firstIndent,
bool firstIndentValid);
793 virtual void PreDoModalHook ()
override;
796 virtual void OnOK ()
override;
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;
812#ifndef qSupportParagraphSpacingDlg
813#define qSupportParagraphSpacingDlg qStroika_Foundation_Common_Platform_Windows
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)
823#if qStroika_Foundation_Common_Platform_MacOS
824#define kParagraphSpacing_Dialog_LineSpaceMENUID (kLedStdDlgMENUBase + 1)
825#define kParagraphSpacing_Dialog_LineSpaceCNTLID (kLedStdDlgCNTLBase + 1)
828#if defined(__cplusplus)
833 class Led_StdDialogHelper_ParagraphSpacingDialog :
public Led_StdDialogHelper {
835 using inherited = Led_StdDialogHelper;
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));
846 virtual void InitValues (TWIPS spaceBefore,
bool spaceBeforeValid, TWIPS spaceAfter,
bool spaceAfterValid, LineSpacing lineSpacing,
847 bool lineSpacingValid);
850 virtual void PreDoModalHook ()
override;
853 virtual void OnOK ()
override;
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;
869#ifndef qSupportOtherFontSizeDlg
870#define qSupportOtherFontSizeDlg qStroika_Foundation_Common_Platform_Windows
873#if qSupportOtherFontSizeDlg
874#define kLedStdDlg_OtherFontSizeID 0x1007
875#define kOtherFontSize_Dialog_FontSizeEditFieldID (kLedStdDlgCommandBase + 4)
877#if defined(__cplusplus)
882 class Led_StdDialogHelper_OtherFontSizeDialog :
public Led_StdDialogHelper {
884 using inherited = Led_StdDialogHelper;
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));
894 virtual void InitValues (DistanceType origFontSize);
897 virtual void PreDoModalHook ()
override;
900 virtual void OnOK ()
override;
903 DistanceType fFontSize_Orig;
904 DistanceType fFontSize_Result;
909#ifndef qSupportUnknownEmbeddingInfoDlg
910#define qSupportUnknownEmbeddingInfoDlg qStroika_Foundation_Common_Platform_Windows
913#if qSupportUnknownEmbeddingInfoDlg
914#define kLedStdDlg_UnknownEmbeddingInfoBoxID 0x1008
915#define kLedStdDlg_UnknownEmbeddingInfoBox_TypeTextMsg (kLedStdDlgCommandBase + 1)
917#if defined(__cplusplus)
922 class Led_StdDialogHelper_UnknownEmbeddingInfoDialog :
public Led_StdDialogHelper {
924 using inherited = Led_StdDialogHelper;
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);
940 virtual void PreDoModalHook ()
override;
945#ifndef qSupportURLXEmbeddingInfoDlg
946#define qSupportURLXEmbeddingInfoDlg qStroika_Foundation_Common_Platform_Windows
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)
955#if defined(__cplusplus)
960 class Led_StdDialogHelper_URLXEmbeddingInfoDialog :
public Led_StdDialogHelper {
962 using inherited = Led_StdDialogHelper;
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);
980 virtual void PreDoModalHook ()
override;
983 virtual void OnOK ()
override;
985#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
987 GtkWidget* fTitleTextWidget;
988 GtkWidget* fURLTextWidget;
993#define kLedStdDlg_AddURLXEmbeddingInfoBoxID 0x100a
994#define kLedStdDlg_AddURLXEmbeddingInfoBox_TitleText (kLedStdDlgCommandBase + 4)
995#define kLedStdDlg_AddURLXEmbeddingInfoBox_URLText (kLedStdDlgCommandBase + 6)
997#if defined(__cplusplus)
1002 class Led_StdDialogHelper_AddURLXEmbeddingInfoDialog :
public Led_StdDialogHelper {
1004 using inherited = Led_StdDialogHelper;
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);
1021 virtual void PreDoModalHook ()
override;
1024 virtual void OnOK ()
override;
1026#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1028 GtkWidget* fTitleTextWidget;
1029 GtkWidget* fURLTextWidget;
1035#ifndef qSupportAddNewTableDlg
1036#define qSupportAddNewTableDlg qStroika_Foundation_Common_Platform_Windows || qStroika_Foundation_Common_Platform_MacOS
1039#if qSupportAddNewTableDlg
1040#define kLedStdDlg_AddNewTableBoxID 0x100b
1041#define kLedStdDlg_AddNewTableBox_RowCount (kLedStdDlgCommandBase + 5)
1042#define kLedStdDlg_AddNewTableBox_ColCount (kLedStdDlgCommandBase + 7)
1044#if defined(__cplusplus)
1049 class Led_StdDialogHelper_AddNewTableDialog :
public Led_StdDialogHelper {
1051 using inherited = Led_StdDialogHelper;
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);
1067 virtual void PreDoModalHook ()
override;
1070 virtual void OnOK ()
override;
1075#ifndef qSupportEditTablePropertiesDlg
1076#define qSupportEditTablePropertiesDlg qStroika_Foundation_Common_Platform_Windows || qStroika_Foundation_Common_Platform_MacOS
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)
1086#define kLedStdDlg_EditTablePropertiesBox_DefaultCellSpacing (kLedStdDlgCommandBase + 18)
1088#define kLedStdDlg_EditTablePropertiesBox_CellBackgroundColor (kLedStdDlgCommandBase + 23)
1090#define kLedStdDlg_EditTablePropertiesBox_ColumnWidth (kLedStdDlgCommandBase + 21)
1092#define kLedStdDlg_EditTablePropertiesBox_BorderWidth (kLedStdDlgCommandBase + 6)
1093#define kLedStdDlg_EditTablePropertiesBox_BorderColor (kLedStdDlgCommandBase + 7)
1095#if qStroika_Foundation_Common_Platform_MacOS
1096#define kLedStdDlg_EditTablePropertiesBox_BorderColorMENUID (kLedStdDlgMENUBase + 2)
1097#define kLedStdDlg_EditTablePropertiesBox_BorderColorCNTLID (kLedStdDlgCNTLBase + 2)
1099#define kLedStdDlg_EditTablePropertiesBox_CellBackgroundColorMENUID (kLedStdDlgMENUBase + 3)
1100#define kLedStdDlg_EditTablePropertiesBox_CellBackgroundColorCNTLID (kLedStdDlgCNTLBase + 3)
1103#if defined(__cplusplus)
1108 class Led_StdDialogHelper_EditTablePropertiesDialog :
public Led_StdDialogHelper {
1110 using inherited = Led_StdDialogHelper;
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);
1126 TWIPS fTableBorderWidth;
1127 Color fTableBorderColor;
1129 TWIPS_Rect fDefaultCellMargins;
1132 bool fCellWidth_Common;
1135 bool fCellBackgroundColor_Common;
1136 Color fCellBackgroundColor;
1141 virtual void PreDoModalHook ()
override;
1144#if qStroika_Foundation_Common_Platform_Windows
1145 virtual BOOL DialogProc (UINT message, WPARAM wParam, LPARAM lParam)
override;
1149 virtual void OnOK ()
override;
1152 StdColorPopupHelper fBorderColorPopup;
1153 StdColorPopupHelper fCellBackgroundColorPopup;
1156 template <
typename T1,
typename T2>
1157 static void cvt (T1* o,
const T2& i);
1160 template <
typename T1,
typename T2>
1161 void Led_StdDialogHelper_EditTablePropertiesDialog::cvt (T1* o,
const T2& i)
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;
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)
1186#ifndef qSupportStdSpellCheckDlg
1187#define qSupportStdSpellCheckDlg qStroika_Foundation_Common_Platform_Windows || qStroika_FeatureSupported_XWindows
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)
1204#if qStroika_Foundation_Common_Platform_MacOS
1205#define kLedStdDlg_SpellCheckBox_SuggestionsCNTLID (kLedStdDlgCNTLBase + 4)
1208#if defined(__cplusplus)
1213 class Led_StdDialogHelper_SpellCheckDialog :
public Led_StdDialogHelper {
1215 using inherited = Led_StdDialogHelper;
1218 class SpellCheckDialogCallback;
1219 struct MisspellingInfo;
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);
1230 ~Led_StdDialogHelper_SpellCheckDialog ();
1233 SpellCheckDialogCallback& fCallback;
1236 MisspellingInfo* fCurrentMisspellInfo;
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;
1246#if qSupportLedDialogWidgets
1247 LedDialogWidget fUndefinedWordWidget;
1248 LedDialogWidget fChangeTextWidget;
1252 virtual void PreDoModalHook ()
override;
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 ();
1267 virtual void DoFindNextCall ();
1269#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1271 GtkWidget* fLookupTextWidget;
1272 GtkWidget* fChangeTextWidget;
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);
1286 template <
typename DEL>
1287 class CallbackDelegator;
1290 struct Led_StdDialogHelper_SpellCheckDialog::MisspellingInfo {
1291 Led_tString fUndefinedWord;
1292 vector<Led_tString> fSuggestions;
1300 class Led_StdDialogHelper_SpellCheckDialog::SpellCheckDialogCallback {
1302 using MisspellingInfo = Led_StdDialogHelper_SpellCheckDialog::MisspellingInfo;
1305 virtual MisspellingInfo* GetNextMisspelling () = 0;
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;
1319 template <
typename DEL>
1320 class Led_StdDialogHelper_SpellCheckDialog::CallbackDelegator :
public Led_StdDialogHelper_SpellCheckDialog::SpellCheckDialogCallback {
1322 using inherited = SpellCheckDialogCallback;
1325 CallbackDelegator (DEL& del)
1332 virtual MisspellingInfo* GetNextMisspelling ()
override
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;
1346 virtual void DoIgnore ()
override
1348 fDelegate.DoIgnore ();
1350 virtual void DoIgnoreAll ()
override
1352 fDelegate.DoIgnoreAll ();
1354 virtual void DoChange (
const Led_tString& changeTo)
override
1356 fDelegate.DoChange (changeTo);
1358 virtual void DoChangeAll (
const Led_tString& changeTo)
override
1360 fDelegate.DoChangeAll (changeTo);
1362 virtual bool AddToDictionaryEnabled ()
const override
1364 return fDelegate.AddToDictionaryEnabled ();
1366 virtual void AddToDictionary (
const Led_tString& newWord)
override
1368 fDelegate.AddToDictionary (newWord);
1370 virtual void LookupOnWeb (
const Led_tString& word)
override
1372 fDelegate.LookupOnWeb (word);
1374 virtual bool OptionsDialogEnabled ()
const override
1376 return fDelegate.OptionsDialogEnabled ();
1378 virtual void OptionsDialog ()
override
1380 fDelegate.OptionsDialog ();
1388#if defined(__cplusplus)
1397#include "StdDialogs.inl"
conditional_t< qTargetPlatformSDKUseswchar_t, wchar_t, char > SDKChar
basic_string< SDKChar > SDKString
Ptr Attach(PlatformNativeHandle sd)