4#include "Stroika/Frameworks/StroikaPreComp.h"
8#if qStroika_Foundation_Common_Platform_Windows
16#include "Stroika/Foundation/Characters/LineEndings.h"
17#include "Stroika/Frameworks/Led/GDI.h"
19#include "StdDialogs.h"
22using namespace Stroika::Frameworks;
23using namespace Stroika::Frameworks::Led;
30 return Characters::CString::Format (Led_SDK_TCHAROF (
"%d"), t);
32 bool ParseStringToINT (
const SDKString& s,
int* t)
38 *t = Characters::CString::String2Int<int> (s);
42#if qTargetPlatformSDKUseswchar_t
43 if (::swscanf (s.c_str (), L
"%d", &l) < 1) {
51 if (::sscanf (s.c_str (),
"%d", &l) < 1) {
64 return FormatINTAsString (t);
66 bool ParseStringToTWIPS (
const SDKString& s, TWIPS* t)
69 bool r = ParseStringToINT (s, &i);
82StdColorPopupHelper::StdColorPopupHelper (
bool allowNone)
83 : fIsSelectedColor{allowNone}
84 , fAllowNone{allowNone}
85#if qStroika_Foundation_Common_Platform_Windows
90 [[maybe_unused]]
size_t offset = fAllowNone ? 1 : 0;
91 for (
size_t i = 0; i < 16; ++i) {
92 Assert (MapColorIdx (MapColorIdx (i + offset)) == i + offset);
96StdColorPopupHelper::~StdColorPopupHelper ()
100bool StdColorPopupHelper::GetSelectedColor (
Color* c)
const
102 if (fIsSelectedColor and c != NULL) {
105 return fIsSelectedColor;
108void StdColorPopupHelper::SetSelectedColor (
const Color& c)
111 fIsSelectedColor =
true;
112#if qStroika_Foundation_Common_Platform_Windows
114 Verify (::SendMessage (fHWnd, CB_SETCURSEL, MapColorIdx (c), 0) != CB_ERR);
119void StdColorPopupHelper::SetNoSelectedColor ()
121 Require (fAllowNone);
122 fIsSelectedColor =
false;
123#if qStroika_Foundation_Common_Platform_Windows
125 Verify (::SendMessage (fHWnd, CB_SETCURSEL, 0, 0) != CB_ERR);
130size_t StdColorPopupHelper::MapColorIdx (
const Color& c)
const
132 size_t offset = fAllowNone ? 1 : 0;
133 if (c == Color::kBlack) {
136 if (c == Color::kMaroon) {
139 if (c == Color::kGreen) {
142 if (c == Color::kOlive) {
145 if (c == Color::kNavyBlue) {
148 if (c == Color::kPurple) {
151 if (c == Color::kTeal) {
154 if (c == Color::kGray) {
157 if (c == Color::kSilver) {
160 if (c == Color::kRed) {
163 if (c == Color::kLimeGreen) {
166 if (c == Color::kYellow) {
169 if (c == Color::kBlue) {
172 if (c == Color::kFuchsia) {
175 if (c == Color::kAqua) {
178 if (c == Color::kWhite) {
184Color StdColorPopupHelper::MapColorIdx (
size_t i)
const
186 size_t offset = fAllowNone ? 1 : 0;
187 switch (i - offset) {
189 return Color::kBlack;
191 return Color::kMaroon;
193 return Color::kGreen;
195 return Color::kOlive;
197 return Color::kNavyBlue;
199 return Color::kPurple;
205 return Color::kSilver;
209 return Color::kLimeGreen;
211 return Color::kYellow;
215 return Color::kFuchsia;
219 return Color::kWhite;
222 return Color::kBlack;
226#if qStroika_Foundation_Common_Platform_Windows
227void StdColorPopupHelper::Attach (HWND popup)
229 Require (fHWnd == NULL);
231 Require (::IsWindow (popup));
233 (void)::SendMessage (popup, CB_RESETCONTENT, 0, 0);
238#if qStroika_Foundation_Common_Platform_Windows
239void StdColorPopupHelper::OnSelChange ()
241#if qStroika_Foundation_Common_Platform_Windows
242 Require (::IsWindow (fHWnd));
243 int r =
static_cast<int> (::SendMessage (fHWnd, CB_GETCURSEL, 0, 0));
246 int otherIdx = fAllowNone ? 17 : 16;
247 if (fAllowNone and r == 0) {
248 SetNoSelectedColor ();
250 else if (r == otherIdx) {
251 StdColorPickBox colorPicker (fSelectedColor);
252 if (colorPicker.DoModal ()) {
253 SetSelectedColor (colorPicker.fColor);
257 Color c = MapColorIdx (r);
258 SetSelectedColor (c);
263#if qStroika_Foundation_Common_Platform_Windows
264void StdColorPopupHelper::DoMenuAppends ()
267 AppendMenuString (Led_SDK_TCHAROF (
""));
269 AppendMenuString (Led_SDK_TCHAROF (
"Black"));
270 AppendMenuString (Led_SDK_TCHAROF (
"Maroon"));
271 AppendMenuString (Led_SDK_TCHAROF (
"Green"));
272 AppendMenuString (Led_SDK_TCHAROF (
"Olive"));
273 AppendMenuString (Led_SDK_TCHAROF (
"Navy"));
274 AppendMenuString (Led_SDK_TCHAROF (
"Purple"));
275 AppendMenuString (Led_SDK_TCHAROF (
"Teal"));
276 AppendMenuString (Led_SDK_TCHAROF (
"Gray"));
277 AppendMenuString (Led_SDK_TCHAROF (
"Silver"));
278 AppendMenuString (Led_SDK_TCHAROF (
"Red"));
279 AppendMenuString (Led_SDK_TCHAROF (
"Lime"));
280 AppendMenuString (Led_SDK_TCHAROF (
"Yellow"));
281 AppendMenuString (Led_SDK_TCHAROF (
"Blue"));
282 AppendMenuString (Led_SDK_TCHAROF (
"Fuchsia"));
283 AppendMenuString (Led_SDK_TCHAROF (
"Aqua"));
284 AppendMenuString (Led_SDK_TCHAROF (
"White"));
285 AppendMenuString (Led_SDK_TCHAROF (
"Other..."));
289#if qStroika_Foundation_Common_Platform_Windows
290void StdColorPopupHelper::AppendMenuString (
const SDKString& s)
292#if qStroika_Foundation_Common_Platform_Windows
293 Require (::IsWindow (fHWnd));
294 Verify (::SendMessage (fHWnd, CB_ADDSTRING, 0,
reinterpret_cast<LPARAM
> (s.c_str ())) != CB_ERR);
299#if qSupportLedDialogWidgets
305LedDialogWidget::LedDialogWidget ()
309 SetDefaultWindowMargins (TWIPS_Rect (TWIPS::kPoint, TWIPS::kPoint, TWIPS::kPoint, TWIPS::kPoint));
310 SpecifyTextStore (&fTextStore);
311 SetCommandHandler (&fCommandHandler);
314LedDialogWidget::LedDialogWidget (TS_SET_OUTSIDE_BWA)
318 SetDefaultWindowMargins (TWIPS_Rect (TWIPS::kPoint, TWIPS::kPoint, TWIPS::kPoint, TWIPS::kPoint));
319 SetCommandHandler (&fCommandHandler);
322LedDialogWidget::~LedDialogWidget ()
324 SetCommandHandler (NULL);
325 SpecifyTextStore (NULL);
332void LedDialogWidget::OnBadUserInput ()
337void LedDialogWidget::OnTypedNormalCharacter (Led_tChar theChar,
bool optionPressed,
bool shiftPressed,
bool commandPressed,
338 bool controlPressed,
bool altKeyPressed)
340 CommandNumber c = CharToCommand (theChar);
342 inherited::OnTypedNormalCharacter (theChar, optionPressed, shiftPressed, commandPressed, controlPressed, altKeyPressed);
345 OnPerformCommand (c);
349LedDialogWidget::CommandNumber LedDialogWidget::CharToCommand (Led_tChar theChar)
const
351#define CNTRL(x) (x - 'a' + 1)
354 return kSelectAll_CmdID;
369Led_tString LedDialogWidget::GetText ()
const
371 size_t len = GetLength ();
372 StackBuffer<Led_tChar> buf{Memory::eUninitialized, len + 1};
373 CopyOut (0, len, buf.data ());
375 size_t len2 = 2 * len + 1;
376 StackBuffer<Led_tChar> buf2{Memory::eUninitialized, len2};
377 len2 = Characters::NLToNative<Led_tChar> (buf.data (), len, buf2.data (), len2);
379 return Led_tString{buf2.data ()};
382void LedDialogWidget::SetText (
const Led_tString& t)
384 size_t len = t.length ();
385 StackBuffer<Led_tChar> buf{Memory::eUninitialized, len};
386 len = Characters::NormalizeTextToNL<Led_tChar> (t.c_str (), len, buf.data (), len);
387 Replace (0, GetEnd (), buf.data (), len);
391#if qSupportLedDialogWidgets
397LedComboBoxWidget::MyButton::MyButton ()
401#if qStroika_Foundation_Common_Platform_Windows
404#define OBM_COMBO 32738
406 fDropDownArrow.LoadBitmap (NULL, MAKEINTRESOURCE (OBM_COMBO));
410#if qStroika_Foundation_Common_Platform_Windows
411LRESULT LedComboBoxWidget::MyButton::WndProc (UINT message, WPARAM wParam, LPARAM lParam)
416 ::SetFocus (fComboBox->fTextWidget.GetHWND ());
419 case WM_LBUTTONDOWN: {
420 SendMessage (BM_SETSTYLE, BS_BITMAP,
true);
424 fComboBox->TogglePopupShown ();
427 return inherited::WndProc (message, wParam, lParam);
434#if qSupportLedDialogWidgets
441LedComboBoxWidget::MyComboListBoxPopup::MyComboListBoxPopup ()
446#if qStroika_Foundation_Common_Platform_Windows
447LRESULT LedComboBoxWidget::MyComboListBoxPopup::WndProc (UINT message, WPARAM wParam, LPARAM lParam)
451 if (wParam ==
'\t') {
452 SendMessage (WM_NEXTDLGCTL, !!(::GetKeyState (VK_SHIFT) & 0x8000),
false);
455 else if (wParam == VK_RETURN) {
460 return inherited::WndProc (message, wParam, lParam);
467 LRESULT dw = SendMessage (LB_ITEMFROMPOINT, 0, lParam);
468 if (not HIWORD (dw)) {
469 int pos = LOWORD (dw);
470 Verify (SendMessage (LB_SETCURSEL, pos, 0) != LB_ERR);
474 case WM_LBUTTONDOWN: {
481 ::GetClientRect (GetHWND (), &cr);
482 clientRect = AsLedRect (cr);
486#define GET_X_LPARAM(lParam) ((int)(short)LOWORD (lParam))
489#define GET_Y_LPARAM(lParam) ((int)(short)HIWORD (lParam))
491 if (clientRect.Contains (Led_Point (GET_Y_LPARAM (lParam), GET_X_LPARAM (lParam)))) {
495 fComboBox->HidePopup ();
499 LRESULT lr = inherited::WndProc (message, wParam, lParam);
501 fComboBox->HidePopup ();
505 return inherited::WndProc (message, wParam, lParam);
510void LedComboBoxWidget::MyComboListBoxPopup::UpdatePopupItems ()
513 if (IsWindowRealized ()) {
514 SendMessage (LB_RESETCONTENT, 0, 0);
515 bool usingUNICODEWnd = IsWindowUNICODE ();
516 for (
auto i = fComboBox->fPopupItems.begin (); i != fComboBox->fPopupItems.end (); ++i) {
517 if (usingUNICODEWnd) {
518 SendMessage (LB_ADDSTRING, 0,
reinterpret_cast<LPARAM
> (Led_tString2WideString (*i).c_str ()));
521 SendMessage (LB_ADDSTRING, 0,
reinterpret_cast<LPARAM
> (Led_tString2SDKString (*i).c_str ()));
527void LedComboBoxWidget::MyComboListBoxPopup::MadeSelection ()
530 LRESULT curSelRel = SendMessage (LB_GETCURSEL, 0, 0);
531 if (curSelRel != LB_ERR) {
532 size_t curSel =
static_cast<size_t> (curSelRel);
533 if (curSel < fComboBox->fPopupItems.size ()) {
534 fComboBox->fTextWidget.SetText (fComboBox->fPopupItems[curSel]);
535 fComboBox->SendMessage (EM_SETSEL, 0, -1);
538 fComboBox->HidePopup ();
541void LedComboBoxWidget::MyComboListBoxPopup::ComputePreferedHeight (DistanceType* prefHeight,
size_t* nEltsShown)
const
546 const size_t kMaxElts = 10;
548 size_t nElts = fComboBox->fPopupItems.size ();
552 if (nElts >= kMaxElts) {
555 DistanceType singleEltHeight =
static_cast<DistanceType
> (::SendMessage (GetHWND (), LB_GETITEMHEIGHT, 0, 0));
556 constexpr DistanceType kEmpiricalKludge = 2;
557 *prefHeight =
static_cast<DistanceType
> (nElts * singleEltHeight + kEmpiricalKludge);
562#if qSupportLedDialogWidgets
568LedComboBoxWidget::MyTextWidget::MyTextWidget ()
569 : inherited (eTS_SET_OUTSIDE_BWA)
572 SpecifyTextStore (&fTextStore);
575LedComboBoxWidget::MyTextWidget::~MyTextWidget ()
577 SpecifyTextStore (NULL);
580#if qStroika_Foundation_Common_Platform_Windows
581LRESULT LedComboBoxWidget::MyTextWidget::WndProc (UINT message, WPARAM wParam, LPARAM lParam)
586 if (wParam == VK_UP or wParam == VK_DOWN) {
587 fComboBox->ShowPopup ();
588 return fComboBox->fComboListBoxPopup.SendMessage (message, wParam, lParam);
590 return inherited::WndProc (message, wParam, lParam);
596 if (wParam == VK_ESCAPE) {
597 fComboBox->HidePopup ();
600 return inherited::WndProc (message, wParam, lParam);
603 return inherited::WndProc (message, wParam, lParam);
609#if qSupportLedDialogWidgets
615LedComboBoxWidget::LedComboBoxWidget ()
617 , fComboListBoxPopup ()
619 , fUseWidgetFont (NULL)
621 fPopupButton.fComboBox =
this;
622 fComboListBoxPopup.fComboBox =
this;
623 fTextWidget.fComboBox =
this;
626LedComboBoxWidget::~LedComboBoxWidget ()
628 delete fUseWidgetFont;
631#if qStroika_Foundation_Common_Platform_Windows
632bool LedComboBoxWidget::ReplaceWindow (HWND hWnd)
634 Require (GetHWND () == NULL);
636 Require (::IsWindow (hWnd));
638 HWND parent = ::GetParent (hWnd);
639 int id = ::GetWindowLong (hWnd, GWL_ID);
640 Assert (hWnd == ::GetDlgItem (parent,
id));
642 DWORD dwStyle = ::GetWindowLong (hWnd, GWL_STYLE);
643 DWORD exStyle = ::GetWindowLong (hWnd, GWL_EXSTYLE);
647 (void)::memset (&wp, 0,
sizeof (wp));
648 wp.length =
sizeof (wp);
649 Verify (::GetWindowPlacement (hWnd, &wp));
653 bool useNonSysFont =
false;
654 FontObject nonSysFont;
657 if ((hFont = (HFONT)::SendMessage (hWnd, WM_GETFONT, 0, 0L)) != NULL) {
659 if (::GetObject (hFont,
sizeof (LOGFONT), &useFont) != 0) {
660 Verify (nonSysFont.CreateFontIndirect (&useFont));
661 useNonSysFont =
true;
667 ::DestroyWindow (hWnd);
669 DISABLE_COMPILER_MSC_WARNING_START (4312)
670 Create (exStyle, NULL, NULL, dwStyle | WS_TABSTOP | WS_CHILD, wp.rcNormalPosition.left, wp.rcNormalPosition.top,
671 wp.rcNormalPosition.right - wp.rcNormalPosition.left, wp.rcNormalPosition.bottom - wp.rcNormalPosition.top, parent, (HMENU)
id, NULL);
672 DISABLE_COMPILER_MSC_WARNING_END (4312)
677 (
void)SendMessage (WM_SETFONT, useNonSysFont ? reinterpret_cast<WPARAM> (static_cast<HFONT> (nonSysFont)) : NULL, false);
682Led_tString LedComboBoxWidget::GetText ()
const
684 return fTextWidget.GetText ();
687void LedComboBoxWidget::SetText (
const Led_tString& t)
689 fTextWidget.SetText (t);
692void LedComboBoxWidget::SetPopupItems (
const vector<Led_tString>& pi)
695 fComboListBoxPopup.UpdatePopupItems ();
698#if qStroika_Foundation_Common_Platform_Windows
699LRESULT LedComboBoxWidget::WndProc (UINT message, WPARAM wParam, LPARAM lParam)
703 (void)::SetFocus (fTextWidget.GetHWND ());
707 return fUseWidgetFont == NULL ? NULL :
reinterpret_cast<LRESULT
> (
static_cast<HFONT
> (*fUseWidgetFont));
710 delete fUseWidgetFont;
711 fUseWidgetFont = NULL;
713 HFONT copyFont =
reinterpret_cast<HFONT
> (wParam);
714 if (copyFont != NULL) {
716 if (::GetObject (copyFont,
sizeof (LOGFONT), &useFont) != 0) {
717 Assert (fUseWidgetFont == NULL);
718 fUseWidgetFont =
new FontObject ();
719 Verify (fUseWidgetFont->CreateFontIndirect (&useFont));
723 HFONT fontToPassDown = fUseWidgetFont == NULL ? NULL :
static_cast<HFONT
> (*fUseWidgetFont);
724 (void)fPopupButton.SendMessage (WM_SETFONT,
reinterpret_cast<WPARAM
> (fontToPassDown), lParam);
725 (void)::SendMessage (fTextWidget.GetHWND (), WM_SETFONT,
reinterpret_cast<WPARAM
> (fontToPassDown), lParam);
726 (void)fComboListBoxPopup.SendMessage (WM_SETFONT,
reinterpret_cast<WPARAM
> (fontToPassDown), lParam);
730 return OnCreate_Msg (wParam, lParam);
733 return OnSize_Msg (wParam, lParam);
741 case WM_GETTEXTLENGTH: {
742 return ::SendMessage (fTextWidget.GetHWND (), message, wParam, lParam);
746 LRESULT lr = inherited::WndProc (message, wParam, lParam);
747 (void)fPopupButton.SendMessage (message, wParam, lParam);
748 (void)::SendMessage (fTextWidget.GetHWND (), message, wParam, lParam);
749 (void)fComboListBoxPopup.SendMessage (message, wParam, lParam);
753 return inherited::WndProc (message, wParam, lParam);
757LRESULT LedComboBoxWidget::OnCreate_Msg (WPARAM wParam, LPARAM lParam)
759 LRESULT lr = inherited::WndProc (WM_CREATE, wParam, lParam);
761 int id = ::GetWindowLong (GetHWND (), GWL_ID);
762 DWORD dwStyle = ::GetWindowLong (GetHWND (), GWL_STYLE);
765 DISABLE_COMPILER_MSC_WARNING_START (4312)
766 fTextWidget.Create (0, NULL, NULL, dwStyle | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 0, 0, GetHWND (), (HMENU)
id, NULL);
767 DISABLE_COMPILER_MSC_WARNING_END (4312)
770 fPopupButton.SubclassWindow (
771 ::CreateWindowEx (0, _T("BUTTON"), _T (""), WS_CHILD | WS_VISIBLE | BS_BITMAP, 0, 0, 0, 0, GetHWND (), NULL, NULL, NULL));
772 fPopupButton.SendMessage (BM_SETIMAGE, static_cast<WPARAM> (IMAGE_BITMAP),
773 reinterpret_cast<LPARAM> (static_cast<HBITMAP> (fPopupButton.fDropDownArrow)));
777#if !qTargetPlatformSDKUseswchar_t
781 HWND uniWnd = ::CreateWindowExW (WS_EX_TOPMOST, L
"ListBox", NULL, WS_POPUP | LBS_NOTIFY | WS_BORDER | WS_TABSTOP, 0, 0, 0, 0,
782 GetHWND (), NULL, NULL, NULL);
783 if (uniWnd != NULL) {
784 fComboListBoxPopup.SubclassWindow (uniWnd);
788 fComboListBoxPopup.SubclassWindow (::CreateWindowEx (WS_EX_TOPMOST, _T(
"ListBox"), NULL, WS_POPUP | LBS_NOTIFY | WS_BORDER | WS_TABSTOP,
789 0, 0, 0, 0, GetHWND (), NULL, NULL, NULL));
790#if !qTargetPlatformSDKUseswchar_t
794 fComboListBoxPopup.UpdatePopupItems ();
799LRESULT LedComboBoxWidget::OnSize_Msg (WPARAM wParam, LPARAM lParam)
801 const DistanceType kPopupIconWidth = fPopupButton.fDropDownArrow.GetImageSize ().h + 4;
806 ::GetClientRect (GetHWND (), &cr);
807 clientRect = AsLedRect (cr);
811 Verify (::MoveWindow (fTextWidget.GetHWND (), clientRect.left, clientRect.top, clientRect.GetWidth () - kPopupIconWidth,
812 clientRect.GetHeight (),
true));
814 Verify (::MoveWindow (fPopupButton.GetHWND (), clientRect.right - kPopupIconWidth, clientRect.top, kPopupIconWidth, clientRect.GetHeight (),
true));
815 return inherited::WndProc (WM_SIZE, wParam, lParam);
819void LedComboBoxWidget::ShowPopup ()
821 if (not PopupShown ()) {
823 vector<Led_tString>::const_iterator i = find (fPopupItems.begin (), fPopupItems.end (), GetText ());
824 if (i == fPopupItems.end ()) {
825 fComboListBoxPopup.SendMessage (LB_SETCURSEL,
static_cast<WPARAM
> (-1), 0);
828 fComboListBoxPopup.SendMessage (LB_SETCURSEL,
static_cast<WPARAM
> (i - fPopupItems.begin ()), 0);
836 (void)::memset (&zero, 0,
sizeof (zero));
837 Verify (::ClientToScreen (::GetParent (GetHWND ()), &zero));
841 ::GetClientRect (GetHWND (), &cr);
842 clientRect = AsLedRect (cr);
844 DistanceType prefHeight = 0;
845 size_t nEltsShown = 0;
846 fComboListBoxPopup.ComputePreferedHeight (&prefHeight, &nEltsShown);
848 if (nEltsShown >= fPopupItems.size ()) {
849 ::SetWindowLong (fComboListBoxPopup.GetHWND (), GWL_STYLE, ::GetWindowLong (fComboListBoxPopup.GetHWND (), GWL_STYLE) & ~WS_VSCROLL);
852 ::SetWindowLong (fComboListBoxPopup.GetHWND (), GWL_STYLE, ::GetWindowLong (fComboListBoxPopup.GetHWND (), GWL_STYLE) | WS_VSCROLL);
856 (void)::memset (&wp, 0,
sizeof (wp));
857 wp.length =
sizeof (wp);
858 Verify (::GetWindowPlacement (GetHWND (), &wp));
859 Verify (::MoveWindow (fComboListBoxPopup.GetHWND (), wp.rcNormalPosition.left + zero.x, wp.rcNormalPosition.bottom + zero.y,
860 clientRect.GetWidth (), prefHeight,
false));
872 (void)::ShowWindow (fComboListBoxPopup.GetHWND (), SW_SHOWNOACTIVATE);
873 (void)::SetCapture (fComboListBoxPopup.GetHWND ());
876void LedComboBoxWidget::HidePopup ()
878 if (::GetCapture () == fComboListBoxPopup.GetHWND ()) {
879 Verify (::ReleaseCapture ());
881 fComboListBoxPopup.SetWindowVisible (
false);
884bool LedComboBoxWidget::PopupShown ()
const
886 return fComboListBoxPopup.IsWindowShown ();
889void LedComboBoxWidget::TogglePopupShown ()
905#if qStroika_Foundation_Common_Platform_Windows
906Led_StdDialogHelper::Led_StdDialogHelper (HINSTANCE hInstance,
const Characters::SDKChar* resID, HWND parentWnd)
907 : fSetFocusItemCalled{false}
910 fHINSTANCE = hInstance;
912 fParentWnd = parentWnd;
915#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
916Led_StdDialogHelper::Led_StdDialogHelper (GtkWindow* parentWindow)
918 , fParentWindow{parentWindow}
920 , fCancelButton{NULL}
926Led_StdDialogHelper::~Led_StdDialogHelper ()
928#if qStroika_Foundation_Common_Platform_Windows
929 if (GetHWND () != NULL) {
931 ::DestroyWindow (GetHWND ());
936bool Led_StdDialogHelper::GetWasOK ()
const
941bool Led_StdDialogHelper::DoModal ()
943#if qStroika_Foundation_Common_Platform_Windows
944 HWND oldFocusWnd = ::GetFocus ();
945#if qNO_INT_PTR_DefinedCompilerBug
948 [[maybe_unused]] INT_PTR x =
949 ::DialogBoxParam (fHINSTANCE, fResID, fParentWnd,
reinterpret_cast<DLGPROC
> (StaticDialogProc),
reinterpret_cast<LPARAM
> (
this));
950 if (oldFocusWnd != NULL) {
951 ::SetFocus (oldFocusWnd);
953#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
956 GtkWidget* window = MakeWindow ();
960 gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (fParentWindow));
961 gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER_ALWAYS);
962 gtk_window_set_modal (GTK_WINDOW (window),
true);
963 gtk_widget_show (window);
965 gtk_signal_connect_after (GTK_OBJECT (window),
"delete_event", GTK_SIGNAL_FUNC (Static_OnWindowDeleteRequest), (gpointer)
this);
967 if (fOKButton != NULL) {
968 gtk_signal_connect (GTK_OBJECT (fOKButton),
"clicked", GTK_SIGNAL_FUNC (Static_OnOKButtonClick), (gpointer)
this);
969 gtk_widget_show (fOKButton);
971 if (fCancelButton != NULL) {
972 gtk_signal_connect (GTK_OBJECT (fCancelButton),
"clicked", GTK_SIGNAL_FUNC (Static_OnCancelButtonClick), (gpointer)
this);
973 gtk_widget_show (fCancelButton);
976 gtk_widget_destroy (window);
981void Led_StdDialogHelper::ReplaceAllTokens (SDKString* m,
const SDKString& token,
const SDKString& with)
985 *m = String::FromSDKString (*m).ReplaceAll (String::FromSDKString (token), String::FromSDKString (with)).AsSDKString ();
988void Led_StdDialogHelper::PreDoModalHook ()
992#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
993GtkWidget* Led_StdDialogHelper::MakeWindow ()
996 return gtk_dialog_new ();
1000#if qStroika_Foundation_Common_Platform_Windows
1001BOOL Led_StdDialogHelper::OnInitDialog ()
1003 Led_CenterWindowInParent (GetHWND ());
1005 return fSetFocusItemCalled ? false :
true;
1009#if qStroika_Foundation_Common_Platform_Windows
1010BOOL CALLBACK Led_StdDialogHelper::StaticDialogProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
1012 if (message == WM_INITDIALOG) {
1013 [[maybe_unused]] LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
1015 Led_StdDialogHelper* pThis =
reinterpret_cast<Led_StdDialogHelper*
> (lParam);
1016 Assert (pThis->GetHWND () == NULL);
1017 pThis->SetHWND (hWnd);
1019 return pThis->OnInitDialog ();
1022 Led_StdDialogHelper* pThis =
reinterpret_cast<Led_StdDialogHelper*
> (::GetWindowLongPtr (hWnd, GWLP_USERDATA));
1024 if (pThis == NULL) {
1028 if (message == WM_DESTROY) {
1029 pThis->SetHWND (NULL);
1033 Assert (pThis != NULL);
1034 Assert (pThis->GetHWND () == hWnd);
1035 return pThis->DialogProc (message, wParam, lParam);
1038BOOL Led_StdDialogHelper::DialogProc (UINT message, [[maybe_unused]] WPARAM wParam, [[maybe_unused]] LPARAM lParam)
1058#if qStroika_Foundation_Common_Platform_Windows || (qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs)
1059SDKString Led_StdDialogHelper::GetItemText (DialogItemID itemID)
const
1061#if qStroika_Foundation_Common_Platform_Windows
1063 (void)::GetDlgItemText (GetHWND (), itemID, widgetText,
static_cast<UINT
> (Memory::NEltsOf (widgetText)));
1065#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1066 return (
char*)gtk_entry_get_text (GTK_ENTRY (itemID));
1070void Led_StdDialogHelper::SetItemText (DialogItemID itemID,
const SDKString& text)
1072#if qStroika_Foundation_Common_Platform_Windows
1073 (void)::SetDlgItemText (GetHWND (), itemID, text.c_str ());
1074#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1075 gtk_entry_set_text (GTK_ENTRY (itemID), text.c_str ());
1079void Led_StdDialogHelper::SelectItemText (DialogItemID itemID,
size_t from,
size_t to)
1081#if qStroika_Foundation_Common_Platform_Windows
1082 ::SendDlgItemMessage (GetHWND (), itemID, EM_SETSEL, from, to);
1083#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1084 gtk_entry_select_region (GTK_ENTRY (itemID), from, to);
1088bool Led_StdDialogHelper::GetItemChecked (DialogItemID itemID)
const
1090#if qStroika_Foundation_Common_Platform_Windows
1091 return !!::IsDlgButtonChecked (GetHWND (), itemID);
1092#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1098void Led_StdDialogHelper::SetItemChecked (DialogItemID itemID,
bool checked)
1100#if qStroika_Foundation_Common_Platform_Windows
1101 ::CheckDlgButton (GetHWND (), itemID, checked);
1102#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1108bool Led_StdDialogHelper::GetItemEnabled (DialogItemID itemID)
const
1110#if qStroika_Foundation_Common_Platform_Windows
1111 return !!::IsWindowEnabled (GetDlgItem (GetHWND (), itemID));
1112#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs && 0
1121void Led_StdDialogHelper::SetItemEnabled (DialogItemID itemID,
bool enabled)
1123#if qStroika_Foundation_Common_Platform_Windows
1124 ::EnableWindow (GetDlgItem (GetHWND (), itemID), enabled);
1125#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1131void Led_StdDialogHelper::SetFocusedItem (DialogItemID itemID)
1133#if qStroika_Foundation_Common_Platform_Windows
1134 HWND dlgItem = ::GetDlgItem (GetHWND (), itemID);
1135 Assert (dlgItem != NULL);
1136 ::SetFocus (dlgItem);
1137 fSetFocusItemCalled =
true;
1138#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1139 gtk_widget_grab_focus (itemID);
1144#if qStroika_Foundation_Common_Platform_Windows
1145void Led_StdDialogHelper::SetHWND (HWND hWnd)
1147 if (fHWnd != NULL) {
1148 ::SetWindowLongPtr (fHWnd, GWLP_USERDATA, 0);
1151 if (fHWnd != NULL) {
1152 ::SetWindowLongPtr (fHWnd, GWLP_USERDATA,
reinterpret_cast<DWORD_PTR
> (
this));
1156HWND Led_StdDialogHelper::GetHWND ()
const
1160#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1161GtkWidget* Led_StdDialogHelper::GetWindow ()
const
1166void Led_StdDialogHelper::SetWindow (GtkWidget* w)
1169 if (fWindow != NULL) {
1170 gtk_object_set_user_data (GTK_OBJECT (fWindow), NULL);
1173 if (fWindow != NULL) {
1174 gtk_object_set_user_data (GTK_OBJECT (fWindow),
this);
1178GtkWidget* Led_StdDialogHelper::GetOKButton ()
const
1182void Led_StdDialogHelper::SetOKButton (GtkWidget* okButton)
1184 fOKButton = okButton;
1187GtkWidget* Led_StdDialogHelper::GetCancelButton ()
const
1191void Led_StdDialogHelper::SetCancelButton (GtkWidget* cancelButton)
1193 fCancelButton = cancelButton;
1197void Led_StdDialogHelper::OnOK ()
1200#if qStroika_Foundation_Common_Platform_Windows
1201 ::EndDialog (GetHWND (), IDOK);
1202#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1207void Led_StdDialogHelper::OnCancel ()
1209#if qStroika_Foundation_Common_Platform_Windows
1210 ::EndDialog (GetHWND (), IDCANCEL);
1211#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1216#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1217void Led_StdDialogHelper::Static_OnOKButtonClick (GtkWidget* widget, gpointer data)
1219 Led_StdDialogHelper* dlg =
reinterpret_cast<Led_StdDialogHelper*
> (data);
1223void Led_StdDialogHelper::Static_OnCancelButtonClick (GtkWidget* widget, gpointer data)
1225 Led_StdDialogHelper* dlg =
reinterpret_cast<Led_StdDialogHelper*
> (data);
1229void Led_StdDialogHelper::Static_OnWindowDeleteRequest (GtkWidget* widget)
1231 Led_StdDialogHelper* dlg =
reinterpret_cast<Led_StdDialogHelper*
> (gtk_object_get_user_data (GTK_OBJECT (widget)));
1232 Assert (dlg->fWindow == widget);
1242#if qStroika_Foundation_Common_Platform_Windows
1243Led_StdDialogHelper_AboutBox::Led_StdDialogHelper_AboutBox (HINSTANCE hInstance, HWND parentWnd,
const Characters::SDKChar* resID)
1244 : inherited (hInstance, resID, parentWnd)
1247#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1248Led_StdDialogHelper_AboutBox::Led_StdDialogHelper_AboutBox (GtkWindow* parentWindow)
1249 : inherited (parentWindow)
1254#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1255GtkWidget* Led_StdDialogHelper_AboutBox::MakeWindow ()
1257 return gtk_window_new (GTK_WINDOW_TOPLEVEL);
1261#if qStroika_Foundation_Common_Platform_Windows
1262BOOL Led_StdDialogHelper_AboutBox::DialogProc (UINT message, WPARAM wParam, LPARAM lParam)
1267 case kLedStdDlg_AboutBox_InfoLedFieldID:
1268 OnClickInInfoField ();
1270 case kLedStdDlg_AboutBox_LedWebPageFieldID:
1271 OnClickInLedWebPageField ();
1276 return inherited::DialogProc (message, wParam, lParam);
1280#if qSupportStdAboutBoxDlg
1281void Led_StdDialogHelper_AboutBox::OnClickInInfoField ()
1286void Led_StdDialogHelper_AboutBox::OnClickInLedWebPageField ()
1292#if qSupportStdFindDlg
1299#if qStroika_Foundation_Common_Platform_Windows
1300Led_StdDialogHelper_FindDialog::Led_StdDialogHelper_FindDialog (HINSTANCE hInstance, HWND parentWnd,
const Characters::SDKChar* resID)
1301 : inherited (hInstance, resID, parentWnd)
1303 , fRecentFindTextStrings ()
1304 , fWrapSearch (false)
1305 , fWholeWordSearch (false)
1306 , fCaseSensativeSearch (false)
1307 , fPressedOK (false)
1308#if qSupportLedDialogWidgets
1309 , fFindTextWidget ()
1313#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1314Led_StdDialogHelper_FindDialog::Led_StdDialogHelper_FindDialog (GtkWindow* parentWindow)
1315 : inherited (parentWindow)
1317 , fRecentFindTextStrings ()
1318 , fWrapSearch (false)
1319 , fWholeWordSearch (false)
1320 , fCaseSensativeSearch (false)
1321 , fPressedOK (false)
1322 , fLookupTextWidget (NULL)
1327#if qStroika_Foundation_Common_Platform_Windows
1328BOOL Led_StdDialogHelper_FindDialog::DialogProc (UINT message, WPARAM wParam, LPARAM lParam)
1333 case kLedStdDlg_FindBox_Find:
1336 case kLedStdDlg_FindBox_Cancel:
1337 OnDontFindButton ();
1342 return inherited::DialogProc (message, wParam, lParam);
1346void Led_StdDialogHelper_FindDialog::PreDoModalHook ()
1348#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1349 GtkWidget* actionArea = GTK_DIALOG (GetWindow ())->action_area;
1351 fLookupTextWidget = gtk_entry_new ();
1352 gtk_container_add (GTK_CONTAINER (actionArea), fLookupTextWidget);
1353 gtk_widget_show (fLookupTextWidget);
1359 GtkWidget* button = gtk_button_new_with_label (
"Find");
1360 gtk_container_add (GTK_CONTAINER (actionArea), button);
1361 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
1362 gtk_widget_show (button);
1363 gtk_signal_connect (GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (Static_OnFindButtonClick), (gpointer)
this);
1366 GtkWidget* button = gtk_button_new_with_label (
"Close");
1367 gtk_container_add (GTK_CONTAINER (actionArea), button);
1368 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
1369 gtk_widget_show (button);
1370 gtk_signal_connect (GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (Static_OnDontFindButtonClick), (gpointer)
this);
1374#if qStroika_Foundation_Common_Platform_Windows && qSupportLedDialogWidgets
1379 fFindTextWidget.ReplaceWindow (::GetDlgItem (GetHWND (), kLedStdDlg_FindBox_FindText));
1382#if qStroika_Foundation_Common_Platform_Windows
1383 DialogItemID findText = kLedStdDlg_FindBox_FindText;
1384#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1385 DialogItemID findText = fLookupTextWidget;
1388#if qSupportLedDialogWidgets
1389 fFindTextWidget.SetText (fFindText);
1390 fFindTextWidget.SetPopupItems (fRecentFindTextStrings);
1392 SetItemText (findText, Led_tString2SDKString (fFindText));
1394 SelectItemText (findText);
1395 SetFocusedItem (findText);
1397#if qStroika_Foundation_Common_Platform_Windows
1398 SetItemChecked (kLedStdDlg_FindBox_WrapAtEndOfDoc, fWrapSearch);
1399 SetItemChecked (kLedStdDlg_FindBox_WholeWord, fWholeWordSearch);
1400 SetItemChecked (kLedStdDlg_FindBox_IgnoreCase, not fCaseSensativeSearch);
1402 inherited::PreDoModalHook ();
1405void Led_StdDialogHelper_FindDialog::OnFindButton ()
1407 Led_StdDialogHelper_FindDialog::OnDontFindButton ();
1411void Led_StdDialogHelper_FindDialog::OnDontFindButton ()
1413#if qSupportLedDialogWidgets
1414 fFindText = fFindTextWidget.GetText ();
1415#elif qStroika_Foundation_Common_Platform_Windows
1416 fFindText = Led_SDKString2tString (GetItemText (kLedStdDlg_FindBox_FindText));
1417#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1418 fFindText = Led_SDKString2tString (GetItemText (fLookupTextWidget));
1421#if qStroika_Foundation_Common_Platform_Windows
1422 fWrapSearch = GetItemChecked (kLedStdDlg_FindBox_WrapAtEndOfDoc);
1423 fWholeWordSearch = GetItemChecked (kLedStdDlg_FindBox_WholeWord);
1424 fCaseSensativeSearch = not GetItemChecked (kLedStdDlg_FindBox_IgnoreCase);
1429#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1430void Led_StdDialogHelper_FindDialog::Static_OnFindButtonClick (GtkWidget* widget, gpointer data)
1432 Led_StdDialogHelper_FindDialog* dlg =
reinterpret_cast<Led_StdDialogHelper_FindDialog*
> (data);
1433 dlg->OnFindButton ();
1436void Led_StdDialogHelper_FindDialog::Static_OnDontFindButtonClick (GtkWidget* widget, gpointer data)
1438 Led_StdDialogHelper_FindDialog* dlg =
reinterpret_cast<Led_StdDialogHelper_FindDialog*
> (data);
1439 dlg->OnDontFindButton ();
1445#if qSupportStdReplaceDlg
1451#if qStroika_Foundation_Common_Platform_Windows
1452Led_StdDialogHelper_ReplaceDialog::Led_StdDialogHelper_ReplaceDialog (HINSTANCE hInstance, HWND parentWnd,
const Characters::SDKChar* resID)
1453 : inherited (hInstance, resID, parentWnd)
1455 , fRecentFindTextStrings ()
1457 , fWrapSearch (false)
1458 , fWholeWordSearch (false)
1459 , fCaseSensativeSearch (false)
1460 , fPressed (eCancel)
1461#if qSupportLedDialogWidgets
1462 , fFindTextWidget ()
1463 , fReplaceTextWidget ()
1467#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1468Led_StdDialogHelper_ReplaceDialog::Led_StdDialogHelper_ReplaceDialog (GtkWindow* parentWindow)
1469 : inherited (parentWindow)
1471 , fRecentFindTextStrings ()
1473 , fWrapSearch (false)
1474 , fWholeWordSearch (false)
1475 , fCaseSensativeSearch (false)
1476 , fPressed (eCancel)
1477 , fLookupTextWidget (NULL)
1478 , fReplaceTextWidget (NULL)
1483#if qStroika_Foundation_Common_Platform_Windows
1484BOOL Led_StdDialogHelper_ReplaceDialog::DialogProc (UINT message, WPARAM wParam, LPARAM lParam)
1489 case kLedStdDlg_ReplaceBox_Find:
1492 case kLedStdDlg_ReplaceBox_Replace:
1495 case kLedStdDlg_ReplaceBox_ReplaceAll:
1496 OnReplaceAllButton ();
1498 case kLedStdDlg_ReplaceBox_ReplaceAllInSelection:
1499 OnReplaceAllInSelectionButton ();
1501 case kLedStdDlg_ReplaceBox_Cancel:
1502 OnDontFindButton ();
1507 return inherited::DialogProc (message, wParam, lParam);
1511void Led_StdDialogHelper_ReplaceDialog::PreDoModalHook ()
1513#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1514 GtkWidget* actionArea = GTK_DIALOG (GetWindow ())->action_area;
1516 fLookupTextWidget = gtk_entry_new ();
1517 gtk_container_add (GTK_CONTAINER (actionArea), fLookupTextWidget);
1518 gtk_widget_show (fLookupTextWidget);
1519 fReplaceTextWidget = gtk_entry_new ();
1520 gtk_container_add (GTK_CONTAINER (actionArea), fReplaceTextWidget);
1521 gtk_widget_show (fReplaceTextWidget);
1527 GtkWidget* button = gtk_button_new_with_label (
"Find");
1528 gtk_container_add (GTK_CONTAINER (actionArea), button);
1529 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
1530 gtk_widget_show (button);
1531 gtk_signal_connect (GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (Static_OnFindButtonClick), (gpointer)
this);
1534 GtkWidget* button = gtk_button_new_with_label (
"Close");
1535 gtk_container_add (GTK_CONTAINER (actionArea), button);
1536 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
1537 gtk_widget_show (button);
1538 gtk_signal_connect (GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (Static_OnDontFindButtonClick), (gpointer)
this);
1541 GtkWidget* button = gtk_button_new_with_label (
"Replace");
1542 gtk_container_add (GTK_CONTAINER (actionArea), button);
1543 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
1544 gtk_widget_show (button);
1545 gtk_signal_connect (GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (Static_OnReplaceButtonClick), (gpointer)
this);
1548 GtkWidget* button = gtk_button_new_with_label (
"Replace All");
1549 gtk_container_add (GTK_CONTAINER (actionArea), button);
1550 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
1551 gtk_widget_show (button);
1552 gtk_signal_connect (GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (Static_OnReplaceAllButtonClick), (gpointer)
this);
1555 GtkWidget* button = gtk_button_new_with_label (
"Replace All in Selection");
1556 gtk_container_add (GTK_CONTAINER (actionArea), button);
1557 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
1558 gtk_widget_show (button);
1559 gtk_signal_connect (GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (Static_OnReplaceAllInSelectionButtonClick), (gpointer)
this);
1563#if qStroika_Foundation_Common_Platform_Windows && qSupportLedDialogWidgets
1568 fFindTextWidget.ReplaceWindow (::GetDlgItem (GetHWND (), kLedStdDlg_ReplaceBox_FindText));
1569 fReplaceTextWidget.ReplaceWindow (::GetDlgItem (GetHWND (), kLedStdDlg_ReplaceBox_ReplaceText));
1572#if qStroika_Foundation_Common_Platform_Windows
1573 DialogItemID findText = kLedStdDlg_ReplaceBox_FindText;
1574 DialogItemID replaceText = kLedStdDlg_ReplaceBox_ReplaceText;
1575#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1576 DialogItemID findText = fLookupTextWidget;
1577 DialogItemID replaceText = fReplaceTextWidget;
1580#if qSupportLedDialogWidgets
1581 fFindTextWidget.SetText (fFindText);
1582 fFindTextWidget.SetPopupItems (fRecentFindTextStrings);
1583 fReplaceTextWidget.SetText (fReplaceText);
1585 SetItemText (findText, Led_tString2SDKString (fFindText));
1586 SetItemText (replaceText, Led_tString2SDKString (fReplaceText));
1588 SelectItemText (findText);
1589 SelectItemText (replaceText);
1590 SetFocusedItem (findText);
1592#if qStroika_Foundation_Common_Platform_Windows
1593 SetItemChecked (kLedStdDlg_ReplaceBox_WrapAtEndOfDoc, fWrapSearch);
1594 SetItemChecked (kLedStdDlg_ReplaceBox_WholeWord, fWholeWordSearch);
1595 SetItemChecked (kLedStdDlg_ReplaceBox_IgnoreCase, not fCaseSensativeSearch);
1597 inherited::PreDoModalHook ();
1600void Led_StdDialogHelper_ReplaceDialog::OnFindButton ()
1607void Led_StdDialogHelper_ReplaceDialog::OnReplaceButton ()
1611 fPressed = eReplace;
1614void Led_StdDialogHelper_ReplaceDialog::OnReplaceAllButton ()
1618 fPressed = eReplaceAll;
1621void Led_StdDialogHelper_ReplaceDialog::OnReplaceAllInSelectionButton ()
1625 fPressed = eReplaceAllInSelection;
1628void Led_StdDialogHelper_ReplaceDialog::OnDontFindButton ()
1634void Led_StdDialogHelper_ReplaceDialog::SaveItems ()
1636#if qSupportLedDialogWidgets
1637 fFindText = fFindTextWidget.GetText ();
1638 fReplaceText = fReplaceTextWidget.GetText ();
1639#elif qStroika_Foundation_Common_Platform_Windows
1640 fFindText = Led_SDKString2tString (GetItemText (kLedStdDlg_ReplaceBox_FindText));
1641 fReplaceText = Led_SDKString2tString (GetItemText (kLedStdDlg_ReplaceBox_ReplaceText));
1642#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1643 fFindText = Led_SDKString2tString (GetItemText (fLookupTextWidget));
1644 fReplaceText = Led_SDKString2tString (GetItemText (fReplaceTextWidget));
1647#if qStroika_Foundation_Common_Platform_Windows
1648 fWrapSearch = GetItemChecked (kLedStdDlg_ReplaceBox_WrapAtEndOfDoc);
1649 fWholeWordSearch = GetItemChecked (kLedStdDlg_ReplaceBox_WholeWord);
1650 fCaseSensativeSearch = not GetItemChecked (kLedStdDlg_ReplaceBox_IgnoreCase);
1654#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1655void Led_StdDialogHelper_ReplaceDialog::Static_OnFindButtonClick (GtkWidget* widget, gpointer data)
1657 Led_StdDialogHelper_ReplaceDialog* dlg =
reinterpret_cast<Led_StdDialogHelper_ReplaceDialog*
> (data);
1658 dlg->OnFindButton ();
1661void Led_StdDialogHelper_ReplaceDialog::Static_OnDontFindButtonClick (GtkWidget* widget, gpointer data)
1663 Led_StdDialogHelper_ReplaceDialog* dlg =
reinterpret_cast<Led_StdDialogHelper_ReplaceDialog*
> (data);
1664 dlg->OnDontFindButton ();
1667void Led_StdDialogHelper_ReplaceDialog::Static_OnReplaceButtonClick (GtkWidget* widget, gpointer data)
1669 Led_StdDialogHelper_ReplaceDialog* dlg =
reinterpret_cast<Led_StdDialogHelper_ReplaceDialog*
> (data);
1670 dlg->OnReplaceButton ();
1673void Led_StdDialogHelper_ReplaceDialog::Static_OnReplaceAllButtonClick (GtkWidget* widget, gpointer data)
1675 Led_StdDialogHelper_ReplaceDialog* dlg =
reinterpret_cast<Led_StdDialogHelper_ReplaceDialog*
> (data);
1676 dlg->OnReplaceAllButton ();
1679void Led_StdDialogHelper_ReplaceDialog::Static_OnReplaceAllInSelectionButtonClick (GtkWidget* widget, gpointer data)
1681 Led_StdDialogHelper_ReplaceDialog* dlg =
reinterpret_cast<Led_StdDialogHelper_ReplaceDialog*
> (data);
1682 dlg->OnReplaceAllInSelectionButton ();
1688#if qUseGTKForLedStandardDialogs && qStroika_FeatureSupported_XWindows
1694StdFontPickBox::StdFontPickBox (GtkWindow* modalParentWindow,
const FontSpecification& initialFont)
1695 : inherited (modalParentWindow)
1696 , fFont (initialFont)
1700GtkWidget* StdFontPickBox::MakeWindow ()
1702 return gtk_font_selection_dialog_new (
"Select font");
1705void StdFontPickBox::PreDoModalHook ()
1707 inherited::PreDoModalHook ();
1708 SetOKButton (GTK_FONT_SELECTION_DIALOG (GetWindow ())->ok_button);
1709 SetCancelButton (GTK_FONT_SELECTION_DIALOG (GetWindow ())->cancel_button);
1710 Verify (gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG (GetWindow ()), fFont.GetOSRep ().c_str ()));
1713void StdFontPickBox::OnOK ()
1716 gchar* newFontOSName = gtk_font_selection_dialog_get_font_name (GTK_FONT_SELECTION_DIALOG (GetWindow ()));
1717 if (newFontOSName != NULL) {
1718 fFont.SetFromOSRep (newFontOSName);
1719 g_free (newFontOSName);
1724#if qSupportStdColorPickBox
1730#if qStroika_Foundation_Common_Platform_Windows
1731StdColorPickBox::StdColorPickBox (
const Color& initialColor)
1732 : fColor (initialColor)
1733 , fParentWnd (::GetActiveWindow ())
1737StdColorPickBox::StdColorPickBox ([[maybe_unused]] HINSTANCE hInstance, HWND parentWnd,
const Color& initialColor)
1738 : fColor (initialColor)
1739 , fParentWnd (parentWnd)
1742#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
1743StdColorPickBox::StdColorPickBox (GtkWindow* modalParentWindow,
const Color& initialColor)
1744 : inherited (modalParentWindow)
1745 , fColor (initialColor)
1750#if qStroika_Foundation_Common_Platform_Windows
1751bool StdColorPickBox::DoModal ()
1753#if qStroika_Foundation_Common_Platform_Windows
1755 memset (&cc, 0,
sizeof (cc));
1756 cc.lStructSize =
sizeof (cc);
1757 cc.Flags |= CC_ANYCOLOR;
1758 cc.rgbResult = fColor.GetOSRep ();
1759 cc.Flags |= CC_RGBINIT;
1760 cc.Flags |= CC_FULLOPEN;
1762 cc.Flags |= CC_ENABLEHOOK;
1763 cc.lpfnHook = ColorPickerINITPROC;
1765 static COLORREF sCustomColors[16];
1766 cc.lpCustColors = sCustomColors;
1768 cc.hwndOwner = fParentWnd;
1770 if (::ChooseColor (&cc)) {
1771 fColor =
Color (cc.rgbResult);
1779#if qStroika_Foundation_Common_Platform_Windows
1780UINT_PTR CALLBACK StdColorPickBox::ColorPickerINITPROC (HWND hWnd, UINT message, [[maybe_unused]] WPARAM wParam, [[maybe_unused]] LPARAM lParam)
1782 if (hWnd != NULL and message == WM_INITDIALOG) {
1783 Led_CenterWindowInParent (hWnd);
1789#if qUseGTKForLedStandardDialogs && qStroika_FeatureSupported_XWindows
1790GtkWidget* StdColorPickBox::MakeWindow ()
1792 return gtk_color_selection_dialog_new (
"Select color");
1795void StdColorPickBox::PreDoModalHook ()
1797 inherited::PreDoModalHook ();
1798 SetOKButton (GTK_COLOR_SELECTION_DIALOG (GetWindow ())->ok_button);
1799 SetCancelButton (GTK_COLOR_SELECTION_DIALOG (GetWindow ())->cancel_button);
1801 colors[0] =
static_cast<double> (fColor.GetRed ()) / Color::kColorValueMax;
1802 colors[1] =
static_cast<double> (fColor.GetGreen ()) / Color::kColorValueMax;
1803 colors[2] =
static_cast<double> (fColor.GetBlue ()) / Color::kColorValueMax;
1805 gtk_color_selection_set_color (GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (GetWindow ())->colorsel), colors);
1808void StdColorPickBox::OnOK ()
1812 gtk_color_selection_get_color (GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (GetWindow ())->colorsel), colors);
1813 using CV = Color::ColorValue;
1814 fColor =
Color (
static_cast<CV
> (colors[0] * Color::kColorValueMax),
static_cast<CV
> (colors[1] * Color::kColorValueMax),
1815 static_cast<CV
> (colors[2] * Color::kColorValueMax));
1820#if qSupportStdFileDlg && defined(__cplusplus)
1826StdFilePickBox::StdFilePickBox (GtkWindow* modalParentWindow,
const SDKString& title,
bool saveDialog,
const SDKString& fileName)
1827 : inherited (modalParentWindow)
1829 , fSaveDialog (saveDialog)
1830 , fFileName (fileName)
1834GtkWidget* StdFilePickBox::MakeWindow ()
1836 return gtk_file_selection_new (fTitle.c_str ());
1839void StdFilePickBox::PreDoModalHook ()
1841 inherited::PreDoModalHook ();
1843 SetOKButton (GTK_FILE_SELECTION (GetWindow ())->ok_button);
1844 SetCancelButton (GTK_FILE_SELECTION (GetWindow ())->cancel_button);
1846 gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (GetWindow ()));
1848 gtk_file_selection_set_filename (GTK_FILE_SELECTION (GetWindow ()), fFileName.empty () ? Led_SDK_TCHAROF (
"untitled") : fFileName.c_str ());
1852void StdFilePickBox::OnOK ()
1856 SDKString fileName = gtk_file_selection_get_filename (GTK_FILE_SELECTION (GetWindow ()));
1858 if (fileName.empty ()) {
1861 fFileName = fileName;
1868SDKString StdFilePickBox::GetFileName ()
const
1874#if qSupportUpdateWin32FileAssocDlg
1881Led_StdDialogHelper_UpdateWin32FileAssocsDialog::Led_StdDialogHelper_UpdateWin32FileAssocsDialog (HINSTANCE hInstance, HWND parentWnd,
1883 : inherited (hInstance, resID, parentWnd)
1886 , fKeepChecking (false)
1890void Led_StdDialogHelper_UpdateWin32FileAssocsDialog::PreDoModalHook ()
1892#if qStroika_Foundation_Common_Platform_Windows
1893 ::SetForegroundWindow (GetHWND ());
1895 (void)::GetDlgItemText (GetHWND (), kLedStdDlg_UpdateWin32FileAssocsDialog_Msg, messageText,
static_cast<int> (Memory::NEltsOf (messageText)));
1897 ReplaceAllTokens (&m, Led_SDK_TCHAROF (
"%0"), fAppName);
1898 ReplaceAllTokens (&m, Led_SDK_TCHAROF (
"%1"), fTypeList);
1899 (void)::SetDlgItemText (GetHWND (), kLedStdDlg_UpdateWin32FileAssocsDialog_Msg, m.c_str ());
1901 (void)::GetDlgItemText (GetHWND (), kLedStdDlg_UpdateWin32FileAssocsDialog_KeepCheckingCheckboxMsg, messageText,
1902 static_cast<int> (Memory::NEltsOf (messageText)));
1904 ReplaceAllTokens (&m, Led_SDK_TCHAROF (
"%0"), fAppName);
1905 ReplaceAllTokens (&m, Led_SDK_TCHAROF (
"%1"), fTypeList);
1906 (void)::SetDlgItemText (GetHWND (), kLedStdDlg_UpdateWin32FileAssocsDialog_KeepCheckingCheckboxMsg, m.c_str ());
1908 ::CheckDlgButton (GetHWND (), kLedStdDlg_UpdateWin32FileAssocsDialog_KeepCheckingCheckboxMsg, fKeepChecking);
1910 inherited::PreDoModalHook ();
1913void Led_StdDialogHelper_UpdateWin32FileAssocsDialog::OnOK ()
1915 fKeepChecking = !!::IsDlgButtonChecked (GetHWND (), kLedStdDlg_UpdateWin32FileAssocsDialog_KeepCheckingCheckboxMsg);
1919void Led_StdDialogHelper_UpdateWin32FileAssocsDialog::OnCancel ()
1921 fKeepChecking = !!::IsDlgButtonChecked (GetHWND (), kLedStdDlg_UpdateWin32FileAssocsDialog_KeepCheckingCheckboxMsg);
1922 inherited::OnCancel ();
1926#if qSupportParagraphIndentsDlg
1932#if qStroika_Foundation_Common_Platform_Windows
1933Led_StdDialogHelper_ParagraphIndentsDialog::Led_StdDialogHelper_ParagraphIndentsDialog (HINSTANCE hInstance, HWND parentWnd,
1935 : inherited (hInstance, resID, parentWnd)
1936 , fLeftMargin_Valid (false)
1937 , fLeftMargin_Orig (TWIPS{0})
1938 , fLeftMargin_Result (TWIPS{0})
1939 , fRightMargin_Valid (false)
1940 , fRightMargin_Orig (TWIPS{0})
1941 , fRightMargin_Result (TWIPS{0})
1942 , fFirstIndent_Valid (false)
1943 , fFirstIndent_Orig (TWIPS{0})
1944 , fFirstIndent_Result (TWIPS{0})
1949void Led_StdDialogHelper_ParagraphIndentsDialog::InitValues (TWIPS leftMargin,
bool leftMarginValid, TWIPS rightMargin,
1950 bool rightMarginValid, TWIPS firstIndent,
bool firstIndentValid)
1952 fLeftMargin_Valid = leftMarginValid;
1953 fLeftMargin_Orig = leftMargin;
1954 fLeftMargin_Result = leftMargin;
1955 fRightMargin_Valid = rightMarginValid;
1956 fRightMargin_Orig = rightMargin;
1957 fRightMargin_Result = rightMargin;
1958 fFirstIndent_Valid = firstIndentValid;
1959 fFirstIndent_Orig = firstIndent;
1960 fFirstIndent_Result = firstIndent;
1963void Led_StdDialogHelper_ParagraphIndentsDialog::PreDoModalHook ()
1965 if (fLeftMargin_Valid) {
1966 SetItemText (kLedStdDlg_ParagraphIndents_LeftMarginFieldID, FormatTWIPSAsString (fLeftMargin_Orig));
1968 if (fRightMargin_Valid) {
1969 SetItemText (kLedStdDlg_ParagraphIndents_RightMarginFieldID, FormatTWIPSAsString (fRightMargin_Orig));
1971 if (fFirstIndent_Valid) {
1972 SetItemText (kLedStdDlg_ParagraphIndents_FirstIndentFieldID, FormatTWIPSAsString (fFirstIndent_Orig));
1974 SetFocusedItem (kLedStdDlg_ParagraphIndents_LeftMarginFieldID);
1975 SelectItemText (kLedStdDlg_ParagraphIndents_LeftMarginFieldID);
1976 inherited::PreDoModalHook ();
1979DISABLE_COMPILER_MSC_WARNING_START (4706)
1980void Led_StdDialogHelper_ParagraphIndentsDialog::OnOK ()
1982 SDKString leftMargin = GetItemText (kLedStdDlg_ParagraphIndents_LeftMarginFieldID);
1983 if (not(fLeftMargin_Valid = ParseStringToTWIPS (leftMargin, &fLeftMargin_Result))) {
1984 fLeftMargin_Result = fLeftMargin_Orig;
1987 SDKString rightMargin = GetItemText (kLedStdDlg_ParagraphIndents_RightMarginFieldID);
1988 if (not(fRightMargin_Valid = ParseStringToTWIPS (rightMargin, &fRightMargin_Result))) {
1989 fRightMargin_Result = fRightMargin_Orig;
1992 SDKString firstIndent = GetItemText (kLedStdDlg_ParagraphIndents_FirstIndentFieldID);
1993 if (not(fLeftMargin_Valid = ParseStringToTWIPS (firstIndent, &fFirstIndent_Result))) {
1994 fFirstIndent_Result = fFirstIndent_Orig;
1998DISABLE_COMPILER_MSC_WARNING_END (4706)
2001#if qSupportParagraphSpacingDlg
2007#if qStroika_Foundation_Common_Platform_Windows
2008Led_StdDialogHelper_ParagraphSpacingDialog::Led_StdDialogHelper_ParagraphSpacingDialog (HINSTANCE hInstance, HWND parentWnd,
2010 : inherited (hInstance, resID, parentWnd)
2011 , fSpaceBefore_Valid (false)
2012 , fSpaceBefore_Orig (TWIPS{0})
2013 , fSpaceBefore_Result (TWIPS{0})
2014 , fSpaceAfter_Valid (false)
2015 , fSpaceAfter_Orig (TWIPS{0})
2016 , fSpaceAfter_Result (TWIPS{0})
2017 , fLineSpacing_Valid (false)
2018 , fLineSpacing_Orig ()
2019 , fLineSpacing_Result ()
2024void Led_StdDialogHelper_ParagraphSpacingDialog::InitValues (TWIPS spaceBefore,
bool spaceBeforeValid, TWIPS spaceAfter,
2025 bool spaceAfterValid, LineSpacing lineSpacing,
bool lineSpacingValid)
2027 fSpaceBefore_Valid = spaceBeforeValid;
2028 fSpaceBefore_Orig = spaceBefore;
2029 fSpaceBefore_Result = spaceBefore;
2030 fSpaceAfter_Valid = spaceAfterValid;
2031 fSpaceAfter_Orig = spaceAfter;
2032 fSpaceAfter_Result = spaceAfter;
2033 fLineSpacing_Valid = lineSpacingValid;
2034 fLineSpacing_Orig = lineSpacing;
2035 fLineSpacing_Result = lineSpacing;
2038void Led_StdDialogHelper_ParagraphSpacingDialog::PreDoModalHook ()
2040#if qStroika_Foundation_Common_Platform_Windows
2041 HWND popup = ::GetDlgItem (GetHWND (), kParagraphSpacing_Dialog_LineSpaceModeFieldID);
2043 Assert (::IsWindow (popup));
2044 (void)::SendMessage (popup, CB_RESETCONTENT, 0, 0);
2045 Verify (::SendMessage (popup, CB_ADDSTRING, 0,
reinterpret_cast<LPARAM
> (_T (
"Single"))) != CB_ERR);
2046 Verify (::SendMessage (popup, CB_ADDSTRING, 0,
reinterpret_cast<LPARAM
> (_T (
"1.5 lines"))) != CB_ERR);
2047 Verify (::SendMessage (popup, CB_ADDSTRING, 0,
reinterpret_cast<LPARAM
> (_T (
"Double"))) != CB_ERR);
2048 Verify (::SendMessage (popup, CB_ADDSTRING, 0,
reinterpret_cast<LPARAM
> (_T (
"At Least (TWIPS)"))) != CB_ERR);
2049 Verify (::SendMessage (popup, CB_ADDSTRING, 0,
reinterpret_cast<LPARAM
> (_T (
"Exact (TWIPS)"))) != CB_ERR);
2050 Verify (::SendMessage (popup, CB_ADDSTRING, 0,
reinterpret_cast<LPARAM
> (_T (
"Exact (1/20 lines)"))) != CB_ERR);
2053 if (fSpaceBefore_Valid) {
2054 SetItemText (kParagraphSpacing_Dialog_SpaceBeforeFieldID, FormatTWIPSAsString (fSpaceBefore_Orig));
2056 if (fSpaceAfter_Valid) {
2057 SetItemText (kParagraphSpacing_Dialog_SpaceAfterFieldID, FormatTWIPSAsString (fSpaceAfter_Orig));
2059 if (fLineSpacing_Valid) {
2060#if qStroika_Foundation_Common_Platform_Windows
2061 Verify (::SendMessage (popup, CB_SETCURSEL, fLineSpacing_Orig.fRule, 0) != CB_ERR);
2063 if (fLineSpacing_Orig.fRule == LineSpacing::eAtLeastTWIPSSpacing or fLineSpacing_Orig.fRule == LineSpacing::eExactTWIPSSpacing or
2064 fLineSpacing_Orig.fRule == LineSpacing::eExactLinesSpacing) {
2065 SetItemText (kParagraphSpacing_Dialog_LineSpaceArgFieldID, FormatTWIPSAsString (TWIPS (fLineSpacing_Orig.fArg)));
2068 SetFocusedItem (kParagraphSpacing_Dialog_SpaceBeforeFieldID);
2069 SelectItemText (kParagraphSpacing_Dialog_SpaceBeforeFieldID);
2070 inherited::PreDoModalHook ();
2073DISABLE_COMPILER_MSC_WARNING_START (4706)
2074void Led_StdDialogHelper_ParagraphSpacingDialog::OnOK ()
2076 SDKString spaceBefore = GetItemText (kParagraphSpacing_Dialog_SpaceBeforeFieldID);
2077 if (not(fSpaceBefore_Valid = ParseStringToTWIPS (spaceBefore, &fSpaceBefore_Result))) {
2078 fSpaceBefore_Result = fSpaceBefore_Orig;
2081 SDKString spaceAfter = GetItemText (kParagraphSpacing_Dialog_SpaceAfterFieldID);
2082 if (not(fSpaceAfter_Valid = ParseStringToTWIPS (spaceAfter, &fSpaceAfter_Result))) {
2083 fSpaceAfter_Result = fSpaceAfter_Orig;
2086#if qStroika_Foundation_Common_Platform_Windows
2087 HWND popup = ::GetDlgItem (GetHWND (), kParagraphSpacing_Dialog_LineSpaceModeFieldID);
2089 Assert (::IsWindow (popup));
2090 int r =
static_cast<int> (::SendMessage (popup, CB_GETCURSEL, 0, 0));
2092 if (r >= 0 and r <= 5) {
2093 fLineSpacing_Valid =
true;
2094 if (r == LineSpacing::eAtLeastTWIPSSpacing or r == LineSpacing::eExactTWIPSSpacing) {
2095 SDKString arg = GetItemText (kParagraphSpacing_Dialog_SpaceAfterFieldID);
2096 TWIPS argT = TWIPS{0};
2097 if (ParseStringToTWIPS (arg, &argT)) {
2098 fLineSpacing_Result = LineSpacing (LineSpacing::Rule (r), argT);
2101 fLineSpacing_Valid =
false;
2104 else if (r == LineSpacing::eExactLinesSpacing) {
2105 SDKString arg = GetItemText (kParagraphSpacing_Dialog_LineSpaceArgFieldID);
2107 if (ParseStringToINT (arg, &argI)) {
2108 fLineSpacing_Result = LineSpacing (LineSpacing::Rule (r), argI);
2111 fLineSpacing_Valid =
false;
2115 fLineSpacing_Result = LineSpacing::Rule (r);
2121DISABLE_COMPILER_MSC_WARNING_END (4706)
2124#if qSupportOtherFontSizeDlg
2130#if qStroika_Foundation_Common_Platform_Windows
2131Led_StdDialogHelper_OtherFontSizeDialog::Led_StdDialogHelper_OtherFontSizeDialog (HINSTANCE hInstance, HWND parentWnd,
const Characters::SDKChar* resID)
2132 : inherited (hInstance, resID, parentWnd)
2133 , fFontSize_Orig (0)
2134 , fFontSize_Result (0)
2139void Led_StdDialogHelper_OtherFontSizeDialog::InitValues (DistanceType origFontSize)
2141 fFontSize_Orig = origFontSize;
2142 fFontSize_Result = origFontSize;
2145void Led_StdDialogHelper_OtherFontSizeDialog::PreDoModalHook ()
2147 SetItemText (kOtherFontSize_Dialog_FontSizeEditFieldID, FormatINTAsString (fFontSize_Orig));
2148 SetFocusedItem (kOtherFontSize_Dialog_FontSizeEditFieldID);
2149 SelectItemText (kOtherFontSize_Dialog_FontSizeEditFieldID);
2150 inherited::PreDoModalHook ();
2153void Led_StdDialogHelper_OtherFontSizeDialog::OnOK ()
2156 if (ParseStringToINT (GetItemText (kOtherFontSize_Dialog_FontSizeEditFieldID), &r)) {
2157 fFontSize_Result = r;
2163#if qSupportUnknownEmbeddingInfoDlg
2169#if qStroika_Foundation_Common_Platform_Windows
2170Led_StdDialogHelper_UnknownEmbeddingInfoDialog::Led_StdDialogHelper_UnknownEmbeddingInfoDialog (HINSTANCE hInstance, HWND parentWnd,
2172 : inherited (hInstance, resID, parentWnd)
2173 , fEmbeddingTypeName ()
2176#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2177Led_StdDialogHelper_UnknownEmbeddingInfoDialog::Led_StdDialogHelper_UnknownEmbeddingInfoDialog (GtkWindow* parentWindow)
2178 : inherited (parentWindow)
2179 , fEmbeddingTypeName ()
2184void Led_StdDialogHelper_UnknownEmbeddingInfoDialog::PreDoModalHook ()
2186#if qStroika_Foundation_Common_Platform_Windows
2188 (void)::GetDlgItemText (GetHWND (), kLedStdDlg_UnknownEmbeddingInfoBox_TypeTextMsg, messageText,
static_cast<int> (Memory::NEltsOf (messageText)));
2191 ReplaceAllTokens (&m, Led_SDK_TCHAROF (
"%0"), fEmbeddingTypeName);
2192 (void)::SetDlgItemText (GetHWND (), kLedStdDlg_UnknownEmbeddingInfoBox_TypeTextMsg, m.c_str ());
2193#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2194 GtkWidget* window = GetWindow ();
2195 gtk_container_set_border_width (GTK_CONTAINER (window), 10);
2197 string message =
"Selected object is of type '" + fEmbeddingTypeName +
"'.";
2198 GtkWidget* label = gtk_label_new (message.c_str ());
2200 gtk_widget_show (label);
2203 GtkWidget* button = gtk_button_new_with_label (
"OK");
2204 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
2205 gtk_widget_show (button);
2206 SetOKButton (button);
2208 inherited::PreDoModalHook ();
2212#if qSupportURLXEmbeddingInfoDlg
2218#if qStroika_Foundation_Common_Platform_Windows
2219Led_StdDialogHelper_URLXEmbeddingInfoDialog::Led_StdDialogHelper_URLXEmbeddingInfoDialog (HINSTANCE hInstance, HWND parentWnd,
2221 : inherited (hInstance, resID, parentWnd)
2222 , fEmbeddingTypeName ()
2227#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2228Led_StdDialogHelper_URLXEmbeddingInfoDialog::Led_StdDialogHelper_URLXEmbeddingInfoDialog (GtkWindow* parentWindow)
2229 : inherited (parentWindow)
2230 , fTitleTextWidget (NULL)
2231 , fURLTextWidget (NULL)
2232 , fEmbeddingTypeName ()
2239void Led_StdDialogHelper_URLXEmbeddingInfoDialog::PreDoModalHook ()
2241#if qStroika_Foundation_Common_Platform_Windows
2243 (void)::GetDlgItemText (GetHWND (), kLedStdDlg_URLXEmbeddingInfoBox_TypeTextMsg, messageText,
static_cast<int> (Memory::NEltsOf (messageText)));
2246 ReplaceAllTokens (&m, Led_SDK_TCHAROF (
"%0"), fEmbeddingTypeName);
2247 (void)::SetDlgItemText (GetHWND (), kLedStdDlg_URLXEmbeddingInfoBox_TypeTextMsg, m.c_str ());
2249 (void)::SetDlgItemText (GetHWND (), kLedStdDlg_URLXEmbeddingInfoBox_TitleText, fTitleText.c_str ());
2250 (void)::SetDlgItemText (GetHWND (), kLedStdDlg_URLXEmbeddingInfoBox_URLText, fURLText.c_str ());
2251#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2254 GtkWidget* window = GetWindow ();
2255 gtk_container_set_border_width (GTK_CONTAINER (window), 10);
2257 string message =
"Selected object is of type '" + fEmbeddingTypeName +
"'.";
2258 GtkWidget* label = gtk_label_new (message.c_str ());
2260 gtk_widget_show (label);
2263 GtkWidget* button = gtk_button_new_with_label (
"OK");
2264 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
2265 gtk_widget_show (button);
2266 SetOKButton (button);
2268#if qStroika_Foundation_Common_Platform_Windows
2269 SelectItemText (kLedStdDlg_URLXEmbeddingInfoBox_TitleText);
2271 inherited::PreDoModalHook ();
2274void Led_StdDialogHelper_URLXEmbeddingInfoDialog::OnOK ()
2276#if qStroika_Foundation_Common_Platform_Windows
2278 (void)::GetDlgItemText (GetHWND (), kLedStdDlg_URLXEmbeddingInfoBox_TitleText, bufText,
static_cast<int> (Memory::NEltsOf (bufText)));
2279 fTitleText = bufText;
2280 (void)::GetDlgItemText (GetHWND (), kLedStdDlg_URLXEmbeddingInfoBox_URLText, bufText,
static_cast<int> (Memory::NEltsOf (bufText)));
2283#if qStroika_Foundation_Common_Platform_Windows
2284 SelectItemText (kLedStdDlg_URLXEmbeddingInfoBox_TitleText);
2290#if qSupportURLXEmbeddingInfoDlg
2296#if qStroika_Foundation_Common_Platform_Windows
2297Led_StdDialogHelper_AddURLXEmbeddingInfoDialog::Led_StdDialogHelper_AddURLXEmbeddingInfoDialog (HINSTANCE hInstance, HWND parentWnd,
2299 : inherited (hInstance, resID, parentWnd)
2304#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2305Led_StdDialogHelper_AddURLXEmbeddingInfoDialog::Led_StdDialogHelper_AddURLXEmbeddingInfoDialog (GtkWindow* parentWindow)
2306 : inherited (parentWindow)
2307 , fTitleTextWidget (NULL)
2308 , fURLTextWidget (NULL)
2315void Led_StdDialogHelper_AddURLXEmbeddingInfoDialog::PreDoModalHook ()
2317#if qStroika_Foundation_Common_Platform_Windows
2318 (void)::SetDlgItemText (GetHWND (), kLedStdDlg_AddURLXEmbeddingInfoBox_TitleText, fTitleText.c_str ());
2319 (void)::SetDlgItemText (GetHWND (), kLedStdDlg_AddURLXEmbeddingInfoBox_URLText, fURLText.c_str ());
2320#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2323 GtkWidget* window = GetWindow ();
2324 gtk_container_set_border_width (GTK_CONTAINER (window), 10);
2326 string message =
"ADD URL.";
2327 GtkWidget* label = gtk_label_new (message.c_str ());
2329 gtk_widget_show (label);
2332 GtkWidget* button = gtk_button_new_with_label (
"OK");
2333 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
2334 gtk_widget_show (button);
2335 SetOKButton (button);
2337 inherited::PreDoModalHook ();
2340void Led_StdDialogHelper_AddURLXEmbeddingInfoDialog::OnOK ()
2342#if qStroika_Foundation_Common_Platform_Windows
2344 (void)::GetDlgItemText (GetHWND (), kLedStdDlg_AddURLXEmbeddingInfoBox_TitleText, bufText,
static_cast<int> (Memory::NEltsOf (bufText)));
2345 fTitleText = bufText;
2346 (void)::GetDlgItemText (GetHWND (), kLedStdDlg_AddURLXEmbeddingInfoBox_URLText, bufText,
static_cast<int> (Memory::NEltsOf (bufText)));
2353#if qSupportAddNewTableDlg
2359#if qStroika_Foundation_Common_Platform_Windows
2360Led_StdDialogHelper_AddNewTableDialog::Led_StdDialogHelper_AddNewTableDialog (HINSTANCE hInstance, HWND parentWnd,
const Characters::SDKChar* resID)
2361 : inherited (hInstance, resID, parentWnd)
2366#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2367Led_StdDialogHelper_AddNewTableDialog::Led_StdDialogHelper_AddNewTableDialog (GtkWindow* parentWindow)
2368 : inherited (parentWindow)
2375void Led_StdDialogHelper_AddNewTableDialog::PreDoModalHook ()
2377#if qStroika_Foundation_Common_Platform_Windows
2378#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2380#if qStroika_Foundation_Common_Platform_Windows
2381 SetItemText (kLedStdDlg_AddNewTableBox_RowCount, FormatINTAsString (
static_cast<int> (fRows)));
2382 SetItemText (kLedStdDlg_AddNewTableBox_ColCount, FormatINTAsString (
static_cast<int> (fColumns)));
2383 SetFocusedItem (kLedStdDlg_AddNewTableBox_RowCount);
2384 SelectItemText (kLedStdDlg_AddNewTableBox_RowCount);
2387 inherited::PreDoModalHook ();
2390void Led_StdDialogHelper_AddNewTableDialog::OnOK ()
2392#if qStroika_Foundation_Common_Platform_Windows
2395 if (ParseStringToINT (GetItemText (kLedStdDlg_AddNewTableBox_RowCount), &r) and
2396 ParseStringToINT (GetItemText (kLedStdDlg_AddNewTableBox_ColCount), &c) and r > 0 and c > 0 and r <= 100 and c <= 25) {
2408#if qSupportEditTablePropertiesDlg
2414#if qStroika_Foundation_Common_Platform_Windows
2415Led_StdDialogHelper_EditTablePropertiesDialog::Led_StdDialogHelper_EditTablePropertiesDialog (HINSTANCE hInstance, HWND parentWnd,
2417 : inherited (hInstance, resID, parentWnd)
2419 , fBorderColorPopup (false)
2420 , fCellBackgroundColorPopup (true)
2423#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2424Led_StdDialogHelper_EditTablePropertiesDialog::Led_StdDialogHelper_EditTablePropertiesDialog (GtkWindow* parentWindow)
2425 : inherited (parentWindow)
2427 , fBorderColorPopup (false)
2428 , fCellBackgroundColorPopup (true)
2433void Led_StdDialogHelper_EditTablePropertiesDialog::PreDoModalHook ()
2435#if qStroika_Foundation_Common_Platform_Windows
2436 fBorderColorPopup.Attach (::GetDlgItem (GetHWND (), kLedStdDlg_EditTablePropertiesBox_BorderColor));
2437 fCellBackgroundColorPopup.Attach (::GetDlgItem (GetHWND (), kLedStdDlg_EditTablePropertiesBox_CellBackgroundColor));
2440 fBorderColorPopup.SetSelectedColor (fInfo.fTableBorderColor);
2441 if (fInfo.fCellBackgroundColor_Common) {
2442 fCellBackgroundColorPopup.SetSelectedColor (fInfo.fCellBackgroundColor);
2445 fCellBackgroundColorPopup.SetNoSelectedColor ();
2448#if qStroika_Foundation_Common_Platform_Windows
2449 SetItemText (kLedStdDlg_EditTablePropertiesBox_BorderWidth, FormatINTAsString (fInfo.fTableBorderWidth));
2451 SetItemText (kLedStdDlg_EditTablePropertiesBox_CellMarginTop, FormatINTAsString (fInfo.fDefaultCellMargins.top));
2452 SetItemText (kLedStdDlg_EditTablePropertiesBox_CellMarginLeft, FormatINTAsString (fInfo.fDefaultCellMargins.left));
2453 SetItemText (kLedStdDlg_EditTablePropertiesBox_CellMarginBottom, FormatINTAsString (fInfo.fDefaultCellMargins.bottom));
2454 SetItemText (kLedStdDlg_EditTablePropertiesBox_CellMarginRight, FormatINTAsString (fInfo.fDefaultCellMargins.right));
2456 SetItemText (kLedStdDlg_EditTablePropertiesBox_DefaultCellSpacing, FormatINTAsString (fInfo.fCellSpacing));
2458 if (fInfo.fCellWidth_Common) {
2459 SetItemText (kLedStdDlg_EditTablePropertiesBox_ColumnWidth, FormatINTAsString (fInfo.fCellWidth));
2461#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2463#if qStroika_Foundation_Common_Platform_Windows
2464 SetFocusedItem (kLedStdDlg_EditTablePropertiesBox_BorderWidth);
2465 SelectItemText (kLedStdDlg_EditTablePropertiesBox_BorderWidth);
2467 inherited::PreDoModalHook ();
2470#if qStroika_Foundation_Common_Platform_Windows
2471BOOL Led_StdDialogHelper_EditTablePropertiesDialog::DialogProc (UINT message, WPARAM wParam, LPARAM lParam)
2475 if (HIWORD (wParam) == CBN_SELCHANGE) {
2476 int controlID = LOWORD (wParam);
2477 switch (controlID) {
2478 case kLedStdDlg_EditTablePropertiesBox_BorderColor:
2479 fBorderColorPopup.OnSelChange ();
2481 case kLedStdDlg_EditTablePropertiesBox_CellBackgroundColor:
2482 fCellBackgroundColorPopup.OnSelChange ();
2488 return inherited::DialogProc (message, wParam, lParam);
2492void Led_StdDialogHelper_EditTablePropertiesDialog::OnOK ()
2494#if qStroika_Foundation_Common_Platform_Windows
2495 Info result = fInfo;
2496 bool dataValid =
true;
2498 dataValid = dataValid and ParseStringToTWIPS (GetItemText (kLedStdDlg_EditTablePropertiesBox_BorderWidth), &result.fTableBorderWidth) and
2499 result.fTableBorderWidth >= 0 and result.fTableBorderWidth <= 1440;
2501 dataValid = dataValid and ParseStringToTWIPS (GetItemText (kLedStdDlg_EditTablePropertiesBox_CellMarginTop), &result.fDefaultCellMargins.top) and
2502 result.fDefaultCellMargins.top >= 0 and result.fDefaultCellMargins.top <= 2 * 1440;
2503 dataValid = dataValid and
2504 ParseStringToTWIPS (GetItemText (kLedStdDlg_EditTablePropertiesBox_CellMarginLeft), &result.fDefaultCellMargins.left) and
2505 result.fDefaultCellMargins.left >= 0 and result.fDefaultCellMargins.left <= 2 * 1440;
2506 dataValid = dataValid and
2507 ParseStringToTWIPS (GetItemText (kLedStdDlg_EditTablePropertiesBox_CellMarginBottom), &result.fDefaultCellMargins.bottom) and
2508 result.fDefaultCellMargins.bottom >= 0 and result.fDefaultCellMargins.bottom <= 2 * 1440;
2509 dataValid = dataValid and
2510 ParseStringToTWIPS (GetItemText (kLedStdDlg_EditTablePropertiesBox_CellMarginRight), &result.fDefaultCellMargins.right) and
2511 result.fDefaultCellMargins.right >= 0 and result.fDefaultCellMargins.right <= 2 * 1440;
2513 dataValid = dataValid and ParseStringToTWIPS (GetItemText (kLedStdDlg_EditTablePropertiesBox_DefaultCellSpacing), &result.fCellSpacing) and
2514 result.fCellSpacing >= 0 and result.fCellSpacing <= 2 * 1440;
2516 result.fCellWidth_Common = ParseStringToTWIPS (GetItemText (kLedStdDlg_EditTablePropertiesBox_ColumnWidth), &result.fCellWidth) and
2517 result.fCellWidth >= 50 and result.fCellWidth <= 8 * 1440;
2519 result.fCellBackgroundColor_Common = fCellBackgroundColorPopup.GetSelectedColor (&result.fCellBackgroundColor);
2520 (
void)fBorderColorPopup.GetSelectedColor (&result.fTableBorderColor);
2533#if qSupportStdSpellCheckDlg
2539#if qStroika_Foundation_Common_Platform_Windows
2540Led_StdDialogHelper_SpellCheckDialog::Led_StdDialogHelper_SpellCheckDialog (SpellCheckDialogCallback& callback, HINSTANCE hInstance,
2542 : inherited (hInstance, resID, parentWnd)
2543 , fCallback (callback)
2544 , fCurrentMisspellInfo (NULL)
2545#if qSupportLedDialogWidgets
2546 , fUndefinedWordWidget ()
2547 , fChangeTextWidget ()
2551#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2552Led_StdDialogHelper_SpellCheckDialog::Led_StdDialogHelper_SpellCheckDialog (SpellCheckDialogCallback& callback, GtkWindow* parentWindow)
2553 : inherited (parentWindow)
2554 , fCallback (callback)
2555 , fCurrentMisspellInfo (NULL)
2556 , fLookupTextWidget (NULL)
2557 , fChangeTextWidget (NULL)
2562Led_StdDialogHelper_SpellCheckDialog::~Led_StdDialogHelper_SpellCheckDialog ()
2564 delete fCurrentMisspellInfo;
2567#if qStroika_Foundation_Common_Platform_Windows
2568BOOL Led_StdDialogHelper_SpellCheckDialog::DialogProc (UINT message, WPARAM wParam, LPARAM lParam)
2572 WORD notificationCode = HIWORD (wParam);
2573 WORD itemID = LOWORD (wParam);
2575 case kLedStdDlg_SpellCheckBox_IgnoreOnce:
2578 case kLedStdDlg_SpellCheckBox_IgnoreAll:
2579 OnIgnoreAllButton ();
2581 case kLedStdDlg_SpellCheckBox_ChangeOnce:
2584 case kLedStdDlg_SpellCheckBox_ChangeAll:
2585 OnChangeAllButton ();
2587 case kLedStdDlg_SpellCheckBox_AddDictionary:
2588 OnAddToDictionaryButton ();
2590 case kLedStdDlg_SpellCheckBox_LookupOnWeb:
2591 OnLookupOnWebButton ();
2593 case kLedStdDlg_SpellCheckBox_Options:
2594 OnOptionsDialogButton ();
2596 case kLedStdDlg_SpellCheckBox_Close:
2599 case kLedStdDlg_SpellCheckBox_SuggestedList: {
2600 switch (notificationCode) {
2602 OnSuggestionListDoubleClick ();
2605 OnSuggestionListChangeSelection ();
2613 return inherited::DialogProc (message, wParam, lParam);
2617void Led_StdDialogHelper_SpellCheckDialog::PreDoModalHook ()
2619#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2620 GtkWidget* actionArea = GTK_DIALOG (GetWindow ())->action_area;
2622 fLookupTextWidget = gtk_entry_new ();
2623 gtk_container_add (GTK_CONTAINER (actionArea), fLookupTextWidget);
2624 gtk_widget_show (fLookupTextWidget);
2625 fChangeTextWidget = gtk_entry_new ();
2626 gtk_container_add (GTK_CONTAINER (actionArea), fChangeTextWidget);
2627 gtk_widget_show (fChangeTextWidget);
2633 GtkWidget* button = gtk_button_new_with_label (
"Ignore");
2634 gtk_container_add (GTK_CONTAINER (actionArea), button);
2635 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
2636 gtk_widget_show (button);
2637 gtk_signal_connect (GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (Static_OnIgnoreButtonClick), (gpointer)
this);
2640 GtkWidget* button = gtk_button_new_with_label (
"Ignore All");
2641 gtk_container_add (GTK_CONTAINER (actionArea), button);
2642 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
2643 gtk_widget_show (button);
2644 gtk_signal_connect (GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (Static_OnIgnoreAllButtonClick), (gpointer)
this);
2647 GtkWidget* button = gtk_button_new_with_label (
"Change");
2648 gtk_container_add (GTK_CONTAINER (actionArea), button);
2649 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
2650 gtk_widget_show (button);
2651 gtk_signal_connect (GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (Static_OnChangeButtonClick), (gpointer)
this);
2654 GtkWidget* button = gtk_button_new_with_label (
"Change All");
2655 gtk_container_add (GTK_CONTAINER (actionArea), button);
2656 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
2657 gtk_widget_show (button);
2658 gtk_signal_connect (GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (Static_OnChangeAllButtonClick), (gpointer)
this);
2661 GtkWidget* button = gtk_button_new_with_label (
"Add to Dictionary");
2662 gtk_container_add (GTK_CONTAINER (actionArea), button);
2663 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
2664 gtk_widget_show (button);
2665 gtk_signal_connect (GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (Static_OnAddToDictionaryButtonClick), (gpointer)
this);
2668 GtkWidget* button = gtk_button_new_with_label (
"Lookup on Web");
2669 gtk_container_add (GTK_CONTAINER (actionArea), button);
2670 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
2671 gtk_widget_show (button);
2672 gtk_signal_connect (GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (Static_OnLookupOnWebButtonClick), (gpointer)
this);
2675 GtkWidget* button = gtk_button_new_with_label (
"Options...");
2676 gtk_container_add (GTK_CONTAINER (actionArea), button);
2677 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
2678 gtk_widget_show (button);
2679 gtk_signal_connect (GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (Static_OnOptionsDialogButtonClick), (gpointer)
this);
2682 GtkWidget* button = gtk_button_new_with_label (
"Close");
2683 gtk_container_add (GTK_CONTAINER (actionArea), button);
2684 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
2685 gtk_widget_show (button);
2686 gtk_signal_connect (GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (Static_OnCloseButtonClick), (gpointer)
this);
2690#if qStroika_Foundation_Common_Platform_Windows && qSupportLedDialogWidgets
2695 fUndefinedWordWidget.ReplaceWindow (::GetDlgItem (GetHWND (), kLedStdDlg_SpellCheckBox_UnknownWordText));
2696 fChangeTextWidget.ReplaceWindow (::GetDlgItem (GetHWND (), kLedStdDlg_SpellCheckBox_ChangeText));
2699#if qStroika_Foundation_Common_Platform_Windows
2700 SetItemEnabled (kLedStdDlg_SpellCheckBox_Options, fCallback.OptionsDialogEnabled ());
2705 inherited::PreDoModalHook ();
2708void Led_StdDialogHelper_SpellCheckDialog::OnIgnoreButton ()
2710 fCallback.DoIgnore ();
2714void Led_StdDialogHelper_SpellCheckDialog::OnIgnoreAllButton ()
2716 fCallback.DoIgnoreAll ();
2720void Led_StdDialogHelper_SpellCheckDialog::OnChangeButton ()
2722#if qSupportLedDialogWidgets
2723 Led_tString changeText = fChangeTextWidget.GetText ();
2724#elif qStroika_Foundation_Common_Platform_Windows
2725 Led_tString changeText = Led_SDKString2tString (GetItemText (kLedStdDlg_SpellCheckBox_ChangeText));
2726#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2727 Led_tString changeText = Led_SDKString2tString (GetItemText (fChangeTextWidget));
2729 fCallback.DoChange (changeText);
2733void Led_StdDialogHelper_SpellCheckDialog::OnChangeAllButton ()
2735#if qSupportLedDialogWidgets
2736 Led_tString changeText = fChangeTextWidget.GetText ();
2737#elif qStroika_Foundation_Common_Platform_Windows
2738 Led_tString changeText = Led_SDKString2tString (GetItemText (kLedStdDlg_SpellCheckBox_ChangeText));
2739#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2740 Led_tString changeText = Led_SDKString2tString (GetItemText (fChangeTextWidget));
2742 fCallback.DoChangeAll (changeText);
2746void Led_StdDialogHelper_SpellCheckDialog::OnAddToDictionaryButton ()
2748#if qSupportLedDialogWidgets
2749 Led_tString undefinedWordText = fUndefinedWordWidget.GetText ();
2750#elif qStroika_Foundation_Common_Platform_Windows
2751 Led_tString undefinedWordText = Led_SDKString2tString (GetItemText (kLedStdDlg_SpellCheckBox_UnknownWordText));
2752#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2753 Led_tString undefinedWordText = Led_SDKString2tString (GetItemText (fLookupTextWidget));
2755 fCallback.AddToDictionary (undefinedWordText);
2759void Led_StdDialogHelper_SpellCheckDialog::OnLookupOnWebButton ()
2761#if qSupportLedDialogWidgets
2762 Led_tString undefinedWordText = fUndefinedWordWidget.GetText ();
2763#elif qStroika_Foundation_Common_Platform_Windows
2764 Led_tString undefinedWordText = Led_SDKString2tString (GetItemText (kLedStdDlg_SpellCheckBox_UnknownWordText));
2765#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2766 Led_tString undefinedWordText = Led_SDKString2tString (GetItemText (fLookupTextWidget));
2768 fCallback.LookupOnWeb (undefinedWordText);
2771void Led_StdDialogHelper_SpellCheckDialog::OnOptionsDialogButton ()
2773 fCallback.OptionsDialog ();
2776void Led_StdDialogHelper_SpellCheckDialog::OnCloseButton ()
2781void Led_StdDialogHelper_SpellCheckDialog::OnSuggestionListChangeSelection ()
2783 if (fCurrentMisspellInfo != NULL) {
2784#if qStroika_Foundation_Common_Platform_Windows
2785 DialogItemID changeTextItem = kLedStdDlg_SpellCheckBox_ChangeText;
2786#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2787 DialogItemID changeTextItem = fChangeTextWidget;
2790#if qStroika_Foundation_Common_Platform_Windows
2791 LRESULT itemSelResult = ::SendMessage (GetDlgItem (GetHWND (), kLedStdDlg_SpellCheckBox_SuggestedList), LB_GETCURSEL, 0, 0);
2794 int itemSelResult = 0;
2796 if (itemSelResult >= 0 and
static_cast<size_t> (itemSelResult) < fCurrentMisspellInfo->fSuggestions.size ()) {
2797 Led_tString changeText = fCurrentMisspellInfo->fSuggestions[itemSelResult];
2798#if qSupportLedDialogWidgets
2799 fChangeTextWidget.SetText (changeText);
2801 SetItemText (changeTextItem, Led_tString2SDKString (changeText));
2803 SelectItemText (changeTextItem);
2808void Led_StdDialogHelper_SpellCheckDialog::OnSuggestionListDoubleClick ()
2813void Led_StdDialogHelper_SpellCheckDialog::DoFindNextCall ()
2815 delete fCurrentMisspellInfo;
2816 fCurrentMisspellInfo = NULL;
2817 fCurrentMisspellInfo = fCallback.GetNextMisspelling ();
2819#if qStroika_Foundation_Common_Platform_Windows
2820 DialogItemID undefinedTextItem = kLedStdDlg_SpellCheckBox_UnknownWordText;
2821 DialogItemID changeTextItem = kLedStdDlg_SpellCheckBox_ChangeText;
2822#elif qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2823 DialogItemID undefinedTextItem = fLookupTextWidget;
2824 DialogItemID changeTextItem = fChangeTextWidget;
2827#if qStroika_Foundation_Common_Platform_Windows
2828 ::SendMessage (GetDlgItem (GetHWND (), kLedStdDlg_SpellCheckBox_SuggestedList), LB_RESETCONTENT, 0, 0);
2831 Led_tString undefinedWordText;
2832 Led_tString changeText;
2833 if (fCurrentMisspellInfo != NULL) {
2834 undefinedWordText = fCurrentMisspellInfo->fUndefinedWord;
2835 if (not fCurrentMisspellInfo->fSuggestions.empty ()) {
2836 changeText = fCurrentMisspellInfo->fSuggestions[0];
2837#if qStroika_Foundation_Common_Platform_Windows
2838 for (
auto i = fCurrentMisspellInfo->fSuggestions.begin (); i != fCurrentMisspellInfo->fSuggestions.end (); ++i) {
2839 ::SendMessage (GetDlgItem (GetHWND (), kLedStdDlg_SpellCheckBox_SuggestedList), LB_ADDSTRING, 0,
2840 reinterpret_cast<LPARAM
> (Led_tString2SDKString (*i).c_str ()));
2846#if qSupportLedDialogWidgets
2847 fUndefinedWordWidget.SetText (undefinedWordText);
2848 fChangeTextWidget.SetText (changeText);
2850 SetItemText (undefinedTextItem, Led_tString2SDKString (undefinedWordText));
2851 SetItemText (changeTextItem, Led_tString2SDKString (changeText));
2854#if qStroika_Foundation_Common_Platform_Windows
2855 SetItemEnabled (kLedStdDlg_SpellCheckBox_IgnoreOnce, fCurrentMisspellInfo != NULL);
2856 SetItemEnabled (kLedStdDlg_SpellCheckBox_IgnoreAll, fCurrentMisspellInfo != NULL);
2857 SetItemEnabled (kLedStdDlg_SpellCheckBox_ChangeOnce, fCurrentMisspellInfo != NULL);
2858 SetItemEnabled (kLedStdDlg_SpellCheckBox_ChangeAll, fCurrentMisspellInfo != NULL);
2859 SetItemEnabled (kLedStdDlg_SpellCheckBox_AddDictionary, fCurrentMisspellInfo != NULL and fCallback.AddToDictionaryEnabled ());
2862 SelectItemText (undefinedTextItem);
2863 SelectItemText (changeTextItem);
2864 SetFocusedItem (changeTextItem);
2867#if qStroika_FeatureSupported_XWindows && qUseGTKForLedStandardDialogs
2868void Led_StdDialogHelper_SpellCheckDialog::Static_OnIgnoreButtonClick (GtkWidget* widget, gpointer data)
2870 Led_StdDialogHelper_SpellCheckDialog* dlg =
reinterpret_cast<Led_StdDialogHelper_SpellCheckDialog*
> (data);
2871 dlg->OnIgnoreButton ();
2874void Led_StdDialogHelper_SpellCheckDialog::Static_OnIgnoreAllButtonClick (GtkWidget* widget, gpointer data)
2876 Led_StdDialogHelper_SpellCheckDialog* dlg =
reinterpret_cast<Led_StdDialogHelper_SpellCheckDialog*
> (data);
2877 dlg->OnIgnoreAllButton ();
2880void Led_StdDialogHelper_SpellCheckDialog::Static_OnChangeButtonClick (GtkWidget* widget, gpointer data)
2882 Led_StdDialogHelper_SpellCheckDialog* dlg =
reinterpret_cast<Led_StdDialogHelper_SpellCheckDialog*
> (data);
2883 dlg->OnChangeButton ();
2886void Led_StdDialogHelper_SpellCheckDialog::Static_OnChangeAllButtonClick (GtkWidget* widget, gpointer data)
2888 Led_StdDialogHelper_SpellCheckDialog* dlg =
reinterpret_cast<Led_StdDialogHelper_SpellCheckDialog*
> (data);
2889 dlg->OnChangeAllButton ();
2892void Led_StdDialogHelper_SpellCheckDialog::Static_OnAddToDictionaryButtonClick (GtkWidget* widget, gpointer data)
2894 Led_StdDialogHelper_SpellCheckDialog* dlg =
reinterpret_cast<Led_StdDialogHelper_SpellCheckDialog*
> (data);
2895 dlg->OnAddToDictionaryButton ();
2898void Led_StdDialogHelper_SpellCheckDialog::Static_OnLookupOnWebButtonClick (GtkWidget* widget, gpointer data)
2900 Led_StdDialogHelper_SpellCheckDialog* dlg =
reinterpret_cast<Led_StdDialogHelper_SpellCheckDialog*
> (data);
2901 dlg->OnLookupOnWebButton ();
2904void Led_StdDialogHelper_SpellCheckDialog::Static_OnOptionsDialogButtonClick (GtkWidget* widget, gpointer data)
2906 Led_StdDialogHelper_SpellCheckDialog* dlg =
reinterpret_cast<Led_StdDialogHelper_SpellCheckDialog*
> (data);
2907 dlg->OnOptionsDialogButton ();
2910void Led_StdDialogHelper_SpellCheckDialog::Static_OnCloseButtonClick (GtkWidget* widget, gpointer data)
2912 Led_StdDialogHelper_SpellCheckDialog* dlg =
reinterpret_cast<Led_StdDialogHelper_SpellCheckDialog*
> (data);
2913 dlg->OnCloseButton ();
#define qStroika_Foundation_Debug_AssertionsChecked
The qStroika_Foundation_Debug_AssertionsChecked flag determines if assertions are checked and validat...
#define RequireNotNull(p)
String is like std::u32string, except it is much easier to use, often much more space efficient,...
Logically halfway between std::array and std::vector; Smart 'direct memory array' - which when needed...
conditional_t< qTargetPlatformSDKUseswchar_t, wchar_t, char > SDKChar
basic_string< SDKChar > SDKString