Finale PDK Framework 0.77
Power Up Your Finale Music Software
Loading...
Searching...
No Matches
ff_dialogs.h
1/*
2 * File: ff_dialogs.h
3 * Author: Jari Williamsson
4 *
5 * Created on den 24 januari 2011, 10:02
6 */
7
8#ifndef FF_DIALOGS_H
9#define FF_DIALOGS_H
10
11#include <set>
12#include <map>
13
14#include "ff_basecollection.h"
15#if OPERATING_SYSTEM == MAC_OS
16#include <finaleframework_cocoa.h>
17#include <ff_cocoa_cppinterface.h>
18#endif
19#ifdef PDK_FRAMEWORK_CANVASCTRL
20#include "ff_fcctrlcanvas.h"
21#endif
22
23#ifdef PDK_FRAMEWORK_DIALOGS
24#include <variant>
25#endif
26
27#ifdef PDK_FRAMEWORK_FILEDIALOGS
28
29#if OPERATING_SYSTEM == WINDOWS
30#include <commdlg.h>
31#include <richedit.h>
32#include <vssym32.h>
33#endif
34
35/* Tech info: Since the file/folder dialogs on Windows requires the -lcomdlg32 and -lole32
36 * linker options to be set in MinGW, these classes require a
37 * dedicated #define.
38 *
39 * */
40
41
54{
55protected:
56#ifndef DOXYGEN_SHOULD_IGNORE_THIS
57 FCUI* _pUI;
58 FCStrings _filters; /* List of strings with filters, such as "*.txt" or "*.*" */
59 FCStrings _filterdescriptions; /* The number of filter description match the filters */
60 int _defaultfilterindex;
61 FCString _windowtitle;
62 FCString _filename;
63 FCString _initfolder;
64#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
65public:
68 {
69 _pUI = pUI;
70 _defaultfilterindex = 0;
71 }
72 const char* ClassName() const override { return "__FCFileDialogBase"; }
73
86 void AddFilter(FCString* pFilter, FCString* pFilterDescription)
87 {
88 if (!pFilter) return;
89 if (!pFilterDescription) return;
90 FCString* pNewString = new FCString();
91 pNewString->SetString(pFilter);
92 _filters.Add(pNewString);
93 pNewString = new FCString();
94 pNewString->SetString(pFilterDescription);
95 _filterdescriptions.Add(pNewString);
96 }
97
101 FCStrings* _GetFilters() { return &_filters; }
102
109 void SetDefaultFilter(int index)
110 {
111 if (index < 0) return;
112 if (index >= _filters.GetCount()) return;
113 _defaultfilterindex = index;
114 }
115
121 {
122 _windowtitle.SetString(pString);
123 }
124
130 void SetFileName(FCString* pString)
131 {
132 _filename.SetString(pString);
133 }
134
146 void SetInitFolder(FCString* pString)
147 {
148 _initfolder.SetString(pString);
149 }
150
157 {
158 if (!pString) return;
159 pString->SetString(&_windowtitle);
160 }
161
167 void GetFileName(FCString* pString)
168 {
169 if (!pString) return;
170 pString->SetString(&_filename);
171 }
172
177 void GetInitFolder(FCString* pString)
178 {
179 if (!pString) return;
180 pString->SetString(&_initfolder);
181 }
182
191 bool AssureFileExtension(const char* pszSuffix)
192 {
193 if (!pszSuffix) return false;
194 if (pszSuffix[0] != '.') return false;
195 FCString extension;
196 extension.SetString(&_filename);
197 extension.ExtractFileExtension();
198 if (extension.IsEmpty()) _filename.AppendCString(pszSuffix);
199 return true;
200 }
201
204 virtual bool Execute() = 0;
205};
206
214{
215 FCStrings _multifiles;
216 bool _multiselect;
217
218 bool _Execute();
219
220public:
228 {
229 _multiselect = false;
230 }
231 const char* ClassName() const override { return "FCFileOpenDialog"; }
232
237 void SetMultiSelect(bool value) { _multiselect = value; }
238
244 bool GetMultiSelect() const { return _multiselect; }
245
246
254 void GetFileNames(FCStrings* pStrings)
255 {
256 if (!pStrings) return;
257 pStrings->CopyFrom(&_multifiles);
258 }
259
261 void _SetFileNames(FCStrings* pStrings)
262 {
263 _multifiles.CopyFrom(pStrings);
264 }
265
272 bool Execute() override
273 {
274 _pUI->_NotifyModalWindowWillOpen();
275 bool rslt = _Execute();
276 _pUI->_NotifyModalWindowDidClose();
277 return rslt;
278 }
279};
280
288{
289 bool _Execute();
290
291public:
298 const char* ClassName() const override { return "FCFileSaveAsDialog"; }
299
304 bool Execute() override
305 {
306 _pUI->_NotifyModalWindowWillOpen();
307 bool rslt = _Execute();
308 _pUI->_NotifyModalWindowDidClose();
309 return rslt;
310 }
311};
312
326{
327 bool _usefinaleapi; /* Use the native Finale API on Finale 25+, defaults to ON. */
328 FCString _windowtitle;
329 FCString _folderpath; /* The folder path (in/out) */
330 FCUI* _pUI;
331
332 bool _Execute();
333
334public:
342 {
343 _pUI = pUI;
344 _usefinaleapi = true;
345 }
346 const char* ClassName() const override { return "FCFolderBrowseDialog"; }
347
356 void SetFolderPath(FCString* pString) { _folderpath.SetString(pString); }
357
364 void SetWindowTitle(FCString* pString) { _windowtitle.SetString(pString); }
365
382 void SetUseFinaleAPI(bool state) { _usefinaleapi = state; }
383
390 void GetFolderPath(FCString* pString)
391 {
392 if (!pString) return;
393 pString->SetString(&_folderpath);
394 }
395
403 {
404 if (!pString) return;
405 pString->SetString(&_windowtitle);
406 }
407
422 bool GetUseFinaleAPI() const { return _usefinaleapi; }
423
433 bool Execute()
434 {
435 _pUI->_NotifyModalWindowWillOpen();
436 bool rslt = _Execute();
437 _pUI->_NotifyModalWindowDidClose();
438 return rslt;
439 }
440};
441
442#endif /* #ifdef PDK_FRAMEWORK_FILEDIALOGS */
443
444
445#ifdef PDK_FRAMEWORK_DIALOGS
446
447/* Some forward class declarations */
448class FCControl;
449class FCCtrlDataList;
450class FCCtrlSwitcher;
451
452#ifndef DOXYGEN_SHOULD_IGNORE_THIS
453
454// _NONWINDOW_PROPERTY classes should really just be a std::optional, but
455// refactoring them turns out to be not completely trivial. This template
456// partially addresses the issue.
457
458template <typename T>
459struct _NONWINDOW_PROPERTY_BASE
460{
461 T value{};
462 bool has_been_set{};
463
464 _NONWINDOW_PROPERTY_BASE() = default;
465};
466
467template <typename T>
468struct _NONWINDOW_PROPERTY : public _NONWINDOW_PROPERTY_BASE<T>
469{
470 _NONWINDOW_PROPERTY() = default;
471 _NONWINDOW_PROPERTY(const T&& value) : _NONWINDOW_PROPERTY_BASE<T>()
472 { SetValue(value);}
473
474 void SetValue(const T& newvalue) {
475 this->value = newvalue;
476 this->has_been_set = true;
477 }
478};
479
480struct _NONWINDOW_PROPERTY_FCSTRING : public _NONWINDOW_PROPERTY<FCString>
481{
482 _NONWINDOW_PROPERTY_FCSTRING() = default;
483
484 void SetIntegerValue(int anint) {
485 value.SetInteger(anint);
486 has_been_set = true;
487 }
488
489#ifdef PDK_FRAMEWORK_PREFS
490 void SetMeasurementValue(double measurement, twobyte measurementunit) {
491 value.SetMeasurement(measurement, measurementunit);
492 has_been_set = true;
493 }
494#endif //PDK_FRAMEWORK_PREFS
495};
496
497// inherit from _NONWINDOW_PROPERTY_BASE to prevent access to SetValue, which
498// __FCCollection does not support. (I don't trust its operator=.)
499struct _NONWINDOW_PROPERTY_FCSTRINGS : public _NONWINDOW_PROPERTY_BASE<FCStrings>
500{
501 _NONWINDOW_PROPERTY_FCSTRINGS() = default;
502
503 void AppendString(FCString* pString)
504 {
505 value.AddCopy(pString);
506 has_been_set = true;
507 }
508
509 void ClearAll()
510 {
511 value.ClearAll();
512 has_been_set = true;
513 }
514};
515
516// inherit from _NONWINDOW_PROPERTY_BASE to prevent access to SetValue, which
517// __FCCollection does not support. (I don't trust its operator=.)
518struct _NONWINDOW_PROPERTY_FCNUMBERS : public _NONWINDOW_PROPERTY_BASE<FCNumbers>
519{
520 _NONWINDOW_PROPERTY_FCNUMBERS() = default;
521
522 void AppendInt(int anint)
523 {
524 value.AddInt(anint);
525 has_been_set = true;
526 }
527
528 void AppendFloat(double afloat)
529 {
530 value.AddFloat(afloat);
531 has_been_set = true;
532 }
533
534 void ClearAll()
535 {
536 value.ClearAll();
537 has_been_set = true;
538 }
539};
540
545struct __FCUserWindow_NONWINDOWSTORAGE
546{
547 _NONWINDOW_PROPERTY_FCSTRING title;
548 _NONWINDOW_PROPERTY<float> width;
549 _NONWINDOW_PROPERTY<float> height;
550 _NONWINDOW_PROPERTY<float> clientheight;
551 _NONWINDOW_PROPERTY<float> clientwidth;
552};
553#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
554
555
563{
564 /* Storage for the modifier keys held down at the last HandleCommand() event. */
565 FLAG_32 _lastcommandmodifierkeys;
566
567 bool _preventclose;
568
569#if OPERATING_SYSTEM == WINDOWS
570 HFONT _shellfont;
571 bool _is_dpi_aware;
572 double _window_dpi_x;
573 double _window_dpi_y;
574#endif
575
576protected:
577#ifndef DOXYGEN_SHOULD_IGNORE_THIS
578 /* Storage for the variables that will be available when the window handle isn't: */
579 __FCUserWindow_NONWINDOWSTORAGE nonwindow_store;
580#if OPERATING_SYSTEM == WINDOWS
581 bool _wants_dpi_awareness;
582#endif // OPERATING_SYSTEM == WINDOWS
583#endif // #ifndef DOXYGEN_SHOULD_IGNORE_THIS
584
585private:
586 twobyte _modalresult; /* The modal result ID (IDOK or IDCANCEL) */
587
588#ifndef DOXYGEN_SHOULD_IGNORE_THIS
589#if OPERATING_SYSTEM == MAC_OS
590protected:
591 _FCWindowController_cocoa* _pCocoaLink;
592#endif /* MAC_OS */
593#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
594private:
595 bool _pointsmeasurement; /* If true, measurement/positioning is in points. Otherwise, in system-native units. */
596#if OPERATING_SYSTEM == WINDOWS
597 HWND _hwnd; // The standard Windows handle.
598 HINSTANCE _hRichEditDll; // If non-NULL, the dll handle for the Rich Edit control.
599#endif
600 float _maximumresizewidth;
601 float _minimumresizewidth;
602 float _maximumresizeheight;
603 float _minimumresizeheight;
604 float _oldresizewidth;
605 float _oldresizeheight;
606
607 // Members for window position storage:
608 bool _positionstored;
609 float _storedxpos;
610 float _storedypos;
611 bool _sizestored;
612 float _storedwidth;
613 float _storedheight;
614
615 // Members for window shade handling:
616 bool _isinwindowshademode;
617 float _nonwindowshadeheight;
618
619 bool _bufferedcontrolmovement;
620#if OPERATING_SYSTEM == WINDOWS
621 bool _initwindowcalled;
622#endif
623 bool _restorepositioncalled;
624
625#if PDK_FRAMEWORK_DIAGNOSE
630 void _CheckControls();
631#endif
632
633 friend class _FCWindowController_cocoa;
634
635protected:
636#ifndef DOXYGEN_SHOULD_IGNORE_THIS
637
639 void _CreateDynamicControls();
640
647 virtual void _InitNonWindowHandleStates();
648
653 void _StoreNonWindowHandleStates();
654
655 bool _ismodal;
656
657 bool _closewindowcalled; /* To prevent multiple CloseWindow() calls
658 * which is bad on the Mac */
659#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
660
662 twobyte GetModalResult() { return _modalresult; }
663
664public:
665
666#ifndef DOXYGEN_SHOULD_IGNORE_THIS
668 FLAG_32 _GetLastCommandModifierKeys() const { return _lastcommandmodifierkeys; }
669
671 void _SetLastCommandModifierKeys(FLAG_32 value) { _lastcommandmodifierkeys = value; }
672
673#if OPERATING_SYSTEM == WINDOWS
675 void _LoadRichEditDll();
676#endif // OPERATING_SYSTEM == WINDOWS
677
678#endif // DOXYGEN_SHOULD_IGNORE_THIS
679
685 {
687 CMDMODKEY_SHIFT = 0x00000001,
688
690 CMDMODKEY_ALT = 0x00000002,
691
693 CMDMODKEY_CTRL = 0x00000004,
694
696 CMDMODKEY_COMMAND = 0x00000008,
697
699 CMDMODKEY_FUNCTION = 0x00000010
700 };
701
714
715
718 {
719 _lastcommandmodifierkeys = 0x0;
720 _preventclose = false;
721 _pointsmeasurement = false;
722#if OPERATING_SYSTEM == MAC_OS
723 _pCocoaLink = NULL;
724#else
725 _shellfont = NULL;
726 _wants_dpi_awareness = false;
727 _is_dpi_aware = false;
728 _window_dpi_x = 0;
729 _window_dpi_y = 0;
730 _hwnd = NULL;
731 _hRichEditDll = NULL;
732#endif
733 _ismodal = false;
734 _modalresult = 0;
735 _closewindowcalled = false;
736 _maximumresizewidth = _minimumresizewidth =
737 _maximumresizeheight = _minimumresizeheight =
738 _oldresizewidth = _oldresizeheight = 0;
739 _positionstored = _sizestored = false;
740 _isinwindowshademode = false;
741 _nonwindowshadeheight = 0;
742 WINCODE(_initwindowcalled = false;)
743 _restorepositioncalled = false;
744 _bufferedcontrolmovement = false;
745 }
746
748 {
749#if OPERATING_SYSTEM == WINDOWS
750 DeleteObject(_shellfont); // doesn't matter if it's already null.
751 _shellfont = NULL;
752 if (_hRichEditDll)
753 {
754 FreeLibrary(_hRichEditDll);
755 _hRichEditDll = NULL;
756 }
757#endif // OPERATING_SYSTEM == WINDOWS
758 }
759
760 const char* ClassName() const override { return "__FCUserWindow"; }
761
772#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
773 FCUI* CreateChildUI(lua_State* L) const
774#else
776#endif
777 {
778 if (!WindowExists()) return nullptr;
779 FXWND hParent = WINCODE(GetWindowHandle()) MACCODE(nullptr);
780 return new _NOLUACODE(FCUI(hParent)) _LUACODE(FCUI(hParent, L));
781 }
782
783#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
785 luabridge::RefCountedPtr<FCUI> CreateChildUI_GC(lua_State* L)
786 { return makeLuaSharedPtr(CreateChildUI(L)); }
787#endif
788
795 {
796 return _pointsmeasurement;
797 }
798
800 bool IsModal() { return _ismodal; }
801
802#ifndef DOXYGEN_SHOULD_IGNORE_THIS
804 void _WinStoreModifierKeys();
805
806 void _SetPointsMeasurement(bool use_points)
807 {
808 _pointsmeasurement = use_points;
809 }
810
812 void _SetModalResult(twobyte modalresultid) { _modalresult = modalresultid; }
813
814 bool _GetCloseWindowCalled() { return _closewindowcalled; }
815
821 void _HandleResizeChange(int newwidth, int newheight);
822
823#if OPERATING_SYSTEM == WINDOWS
829 void _SetModelessEnabledState();
830
831 void _call_FX_Dialog(
832 const twobyte nDlgID, // id for dialog template
833 FF_DialogHandlerUPP lpCallBack, // dialog handler routine
834 const FXWND hParent, // parent dialog
835 const twobyte dlgFlags, // DIALOG_TYPE_MASK
836 void* const data);
837
839 bool _GetIsDpiAware() const { return _is_dpi_aware; }
841 double _GetWindowDpiX() const { return _window_dpi_x; }
843 double _GetWindowDpiY() const { return _window_dpi_y; }
845 HFONT _GetShellFont() const { return _shellfont; }
847 void _SetWindowDpiFromSystem();
848
849 /* Conversion routines between pixels and points. These must be public, since they
850 need to be accessible for FCCustomWindow and FCControl as well. */
851
853 double _WinHorizPixelsToPoints(double value) const;
855 double _WinVertPixelsToPoints(double value) const;
857 double _WinHorizPointsToPixels(double value) const;
859 double _WinVertPointsToPixels(double value) const;
860#endif // OPERATING_SYSTEM == WINDOWS
861#endif // #ifndef DOXYGEN_SHOULD_IGNORE_THIS
862
866 void SetEnabled(bool state);
867
872 FCControl* GetItemAt(int index) const { return (FCControl*) __FCCollection::GetItemAt(index); }
873
875 void SetWidth(float newwidth);
876
878 float GetWidth();
879
884 void SetHeight(float newheight);
885
887 float GetHeight();
888
895 void SetClientWidth(float newwidth);
896
903 float GetClientWidth();
904
911 void SetClientHeight(float newheight);
912
919 float GetClientHeight();
920
931 bool IsDarkModeAppearance() const;
932
940 void SetTitle(FCString* pTitle);
941
948 void GetTitle(FCString* pTitle);
949
959 bool QueryLastCommandModifierKeys(FLAG_32 modifiers)
960 {
961 return ((_lastcommandmodifierkeys & modifiers) == modifiers);
962 }
963
968 virtual void CloseWindow() = 0;
969
976 {
977 if (!CanClose()) return false;
978 CloseWindow();
979 return true;
980 }
981
982#ifndef DOXYGEN_SHOULD_IGNORE_THIS
983#if OPERATING_SYSTEM == MAC_OS
985 _FCWindowController_cocoa* _GetCocoaLink() const
986 {
987 return _pCocoaLink;
988 }
989
990 virtual bool ModelessCancelCanEscape() const { return false; }
991
992#else
995 void _SetWindowHandle(EWND hwnd) {
996 _hwnd = hwnd;
997 }
998
999 EWND GetWindowHandle() const { return _hwnd; }
1000#endif
1001#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
1002
1007 {
1008 _maximumresizewidth = width;
1009#if OPERATING_SYSTEM == MAC_OS
1010 /* On Cocoa, use the built-in maxsize */
1011 _FCWindowController_cocoa* pCocoaLink = _GetCocoaLink();
1012 if (!pCocoaLink) return;
1013 pCocoaLink->SetMaximumResizeWidth(width);
1014#endif
1015 }
1016
1020 void SetMaximumResizeHeight(int height)
1021 {
1022 _maximumresizeheight = height;
1023#if OPERATING_SYSTEM == MAC_OS
1024 /* On Cocoa, use the built-in maxsize */
1025 _FCWindowController_cocoa* pCocoaLink = _GetCocoaLink();
1026 if (!pCocoaLink) return;
1027 pCocoaLink->SetMaximumResizeHeight(height);
1028#endif
1029 }
1030
1033 {
1034 return _minimumresizewidth;
1035 }
1036
1039 {
1040 if (_isinwindowshademode) return 0;
1041 return _minimumresizeheight;
1042 }
1043
1046 {
1047 return _maximumresizewidth;
1048 }
1049
1052 {
1053 return _maximumresizeheight;
1054 }
1055
1062 bool WindowExists() const;
1063
1065 void Hide();
1066
1068 void ShowAndActivate();
1069
1076 virtual void InitWindow();
1077
1083 virtual void WindowDestroyed() {}
1084
1089 virtual void DarkModeIsChanging([[maybe_unused]]bool isDarkMode) {}
1090
1099 virtual void OSMenuCommandExecuted([[maybe_unused]]EMENUID menuCommand, [[maybe_unused]]int menuCommandType) {}
1100
1110 virtual void CloseButtonPressed()
1111 {
1112 _SetModalResult(0);
1113 if (!_GetCloseWindowCalled()) TryToCloseWindow();
1114 }
1115
1125 virtual void OkButtonPressed()
1126 {
1127 _SetModalResult(IDOK);
1128 if (!_GetCloseWindowCalled()) TryToCloseWindow();
1129 }
1130
1140 virtual void CancelButtonPressed()
1141 {
1142 _SetModalResult(IDCANCEL);
1143 if (!_GetCloseWindowCalled()) TryToCloseWindow();
1144 }
1145
1151 virtual bool HandleCommand([[maybe_unused]]FCControl* pControl) { return false; }
1152
1157 virtual void TextSelectionChanged([[maybe_unused]]FCControl* pControl) {}
1158
1168 virtual void ScrollChanged([[maybe_unused]]FCControl* pControl) {}
1169
1193 virtual bool HandleKeyboardCommand([[maybe_unused]]FCControl* pControl, [[maybe_unused]]eUniChar16 character) { return false; }
1194
1202 virtual void HandleSwitcherSelect(FCCtrlSwitcher* pControl, int switchindex);
1203
1212 virtual void HandleUpDownPressed([[maybe_unused]]FCControl* pControl, [[maybe_unused]]int delta) {}
1213
1221 virtual void HandleDataListSelect([[maybe_unused]]FCCtrlDataList* pControl, [[maybe_unused]]int lineindex) {}
1222
1232 virtual void HandleDataListCheck([[maybe_unused]]FCCtrlDataList* pControl, [[maybe_unused]]int lineindex, [[maybe_unused]]bool checkstate) {}
1233
1238 virtual void HandleListDoubleClick([[maybe_unused]]FCControl* pControl) {}
1239
1246 virtual bool HandleListEnterKey([[maybe_unused]]FCControl* pControl) { return false; }
1247
1249 virtual void HandleTimer([[maybe_unused]]twobyte timerID) {}
1250
1252 virtual void HandleActivate([[maybe_unused]]bool activated) {}
1253
1258 virtual void HandleResize([[maybe_unused]]int newwidth, [[maybe_unused]]int newheight, [[maybe_unused]]int oldwidth, [[maybe_unused]]int oldheight) {}
1259
1264 virtual void MouseTrackingStarted([[maybe_unused]]FCControl* pControl) {}
1265
1270 virtual void MouseTrackingStopped([[maybe_unused]]FCControl* pControl) {}
1271
1276 FCControl* FindControl(int controlid);
1277
1296 void SetTimer(twobyte timerID, ufourbyte msInterval);
1297
1305 void StopTimer(twobyte timerID);
1306
1311 void Activate();
1312
1317 bool GetPreventClosing() const { return _preventclose; }
1318
1324 void SetPreventClosing(bool state) { _preventclose = state; }
1325
1330 virtual bool CanClose() { return !_preventclose; }
1331
1333 bool IsVisible();
1334
1341 void StorePosition(bool storesize);
1342
1349 bool RestorePosition();
1350
1355 void SetRestorePositionData(float x, float y, float width, float height);
1356
1361 void SetRestorePositionOnlyData(float x, float y);
1362
1367 float GetStoredX() const;
1368
1373 float GetStoredY() const;
1374
1379 float GetStoredWidth() const;
1380
1385 float GetStoredHeight() const;
1386
1388 bool IsWindowshade() { return _isinwindowshademode; }
1389
1395 void Windowshade(bool windowshade);
1396
1401 void SetWindowAlpha(twobyte alphapercent);
1402
1411
1415
1421 bool IsInBufferMode() { return _bufferedcontrolmovement; }
1422
1423#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1425 void _SetRestorePositionCalled(bool value)
1426 {
1427 _restorepositioncalled = value;
1428 }
1429
1430#if OPERATING_SYSTEM == WINDOWS
1432 void _WinSetInitWindowCalled(bool value)
1433 {
1434 _initwindowcalled = value;
1435 }
1436
1439 void _WinPostRestorePosition()
1440 {
1441 if (!_initwindowcalled) return;
1442 if (!_restorepositioncalled) return;
1444 }
1445#endif // OPERATING_SYSTEM == WINDOWS
1446#endif // DOXYGEN_SHOULD_IGNORE_THIS
1447};
1448
1449#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1450
1455struct __FCControl_NONWINDOWSTORAGE
1456{
1457 _NONWINDOW_PROPERTY_FCSTRING text;
1458 _NONWINDOW_PROPERTY<bool> enabled;
1459 _NONWINDOW_PROPERTY<bool> visible;
1460 _NONWINDOW_PROPERTY<float> left;
1461 _NONWINDOW_PROPERTY<float> top;
1462 _NONWINDOW_PROPERTY<float> width;
1463 _NONWINDOW_PROPERTY<float> height;
1464};
1465
1466class FCCtrlUpDown;
1467class FCCtrlDataList;
1468class FCCtrlTree;
1469class FCCtrlButton;
1470class FCCtrlCheckbox;
1471class FCCtrlRadioButton;
1472class FCCtrlEdit;
1473class FCCtrlTextEditor;
1474class FCCtrlStatic;
1475class FCCtrlPopup;
1476class FCCtrlComboBox;
1477class FCCtrlLine;
1479class FCCtrlVerticalLine;
1480class FCCtrlSlider;
1481class FCCtrlListBox;
1482class FCCtrlSwitcher;
1483#ifdef PDK_FRAMEWORK_IMAGECTRL
1484class FCCtrlImage;
1485#endif
1486#ifdef PDK_FRAMEWORK_CANVASCTRL
1487class FCCtrlCanvas;
1488#endif
1489
1490using __FCControlTypedPtr = std::variant<
1491#ifndef PDK_FRAMEWORK_LUAFRIENDLY
1492 FCControl *, // allow C++ code to bypass __FCControlTypedPtr feature
1493#endif
1494#ifdef PDK_FRAMEWORK_CANVASCTRL
1495 FCCtrlCanvas *,
1496#endif
1497#ifdef PDK_FRAMEWORK_IMAGECTRL
1498 FCCtrlImage *,
1499#endif
1500 FCCtrlUpDown *,
1502 FCCtrlTree *,
1503 FCCtrlButton *,
1506 FCCtrlEdit *,
1508 FCCtrlStatic *,
1509 FCCtrlPopup *,
1511 FCCtrlLine *,
1514 FCCtrlSlider *,
1515 FCCtrlListBox *,
1517 >;
1518#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
1519
1520
1535class FCControl : public __FCBase
1536{
1537#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1538 const __FCControlTypedPtr _subtypeptr; // used for calling Lua with the fully typed control
1539#endif // DOXYGEN_SHOULD_IGNORE_THIS
1540
1541protected:
1542#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1543 std::unique_ptr<FCFontInfo> _fontinfo; // used for SetFont
1544#if OPERATING_SYSTEM == WINDOWS
1545 HFONT _storednewfont; /* If the control has a custom font */
1546#endif // OPERATING_SYSTEM == WINDOWS
1547#endif // DOXYGEN_SHOULD_IGNORE_THIS
1548
1549public:
1555 ACTION_NONE = 0,
1556 ACTION_OK = 1,
1557 ACTION_CLOSE = 2,
1558 ACTION_CANCEL = 3
1559 };
1560
1561protected:
1562#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1563 /* States for when the control handle isn't available: */
1564 __FCControl_NONWINDOWSTORAGE nonwindow_store;
1565
1566#if OPERATING_SYSTEM == WINDOWS
1568 int _WinCalcFontHeightFromSize(HDC hDC, int size);
1569
1573 virtual double _CalcNonTextWidth() const { return 0.0; }
1574 double _CalcNonTextWidthFromTheme(int partID, int stateID, double additionalHardcodedValue, double fallbackHardcodedValue) const;
1575#endif // OPERATING_SYSTEM == WINDOWS
1576#endif // #ifndef DOXYGEN_SHOULD_IGNORE_THIS
1577
1578private:
1579 bool _pointsmeasurement; /* If true, all measurements and positioning is in points. If false,
1580 measurement is system native. */
1581 bool _programmaticallycreate; /* True - create the control in code. False - control is available in resource. */
1582 bool _autoresizewidth; // True - autoresize the width whenever SetText is called. Only supported on some controls.
1583 std::map<int, int> _nooverlapControls; // collection of control IDs and corresponding pad values for no-overlap controls
1584 int _alignwithID; // if non-zero, the control ID to horizontally align with
1585 bool _alignwithRight; // if true, align the control to the right.
1586 double _alignwithOffset; // if non-zero, offsets the control by this amount
1587 bool _stretchtofit; // if true, extend the width of the control to align with the furthest right control
1588
1589 bool _bufferedmove, _bufferedresize;
1590 float _bufferedx{}, _bufferedy{}, _bufferedwidth{}, _bufferedheight{};
1591 twobyte _id{};
1592 __FCUserWindow *_pParent{};
1593
1594 CONTROL_ACTIONS _controlaction;
1595
1596 void _init()
1597 {
1598 WINCODE(_storednewfont = 0;)
1599 _pointsmeasurement = false;
1600 _programmaticallycreate = false; /* Default to resource-loaded control. */
1601 _autoresizewidth = false;
1602 _alignwithID = 0;
1603 _alignwithRight = false;
1604 _alignwithOffset = 0.0;
1605 _stretchtofit = false;
1606 _controlaction = ACTION_NONE;
1607 _pParent = NULL;
1608 _ResetBufferedMovement();
1609 }
1610
1611public:
1612#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1614 enum _CONTROL_TYPE
1615 {
1616 CONTROLTYPE_UNDEFINED = 0,
1617 CONTROLTYPE_UPDOWN,
1618 CONTROLTYPE_DATALIST,
1619 CONTROLTYPE_TREE,
1620 CONTROLTYPE_BUTTON,
1621 CONTROLTYPE_CHECKBOX,
1622 CONTROLTYPE_RADIOBUTTON,
1623 CONTROLTYPE_EDIT,
1624 CONTROLTYPE_STATIC,
1625 CONTROLTYPE_POPUP,
1626 CONTROLTYPE_COMBOBOX,
1627 CONTROLTYPE_LINE,
1628 CONTROLTYPE_SLIDER,
1629 CONTROLTYPE_LISTBOX,
1630 CONTROLTYPE_SWITCHER,
1631 CONTROLTYPE_CANVAS,
1632 CONTROLTYPE_IMAGE,
1633 CONTROLTYPE_TEXTEDITOR
1634 };
1635#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
1636
1637 const char* ClassName() const override { return "FCControl"; }
1638
1639#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1645 static int FCControl_tostring(lua_State* L)
1646 {
1647 FCControl* pThis = luabridge::Stack<FCControl*>::get(L, 1) LB3(.value());
1648 std::string s = std::string(pThis->ClassName()) + ": (ID " + std::to_string(pThis->GetControlID()) + ")";
1649 luabridge::Stack<std::string>::push(L, s).throw_on_error();
1650 return 1;
1651 }
1652#endif
1653
1667 FCControl(twobyte id, const __FCControlTypedPtr &subclassPtr) : __FCBase(), _id(id), _subtypeptr(subclassPtr)
1668 { _init(); }
1669
1670#ifndef PDK_FRAMEWORK_LUAFRIENDLY
1676 FCControl(twobyte id) : __FCBase(), _id(id), _subtypeptr(this)
1677 { _init(); }
1678#endif
1679
1681 virtual ~FCControl()
1682 {
1683 WINCODE(DeleteObject(_storednewfont);)
1684 }
1685
1686#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1687#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1691 template<class F, typename... Args>
1692 luabridge::LuaResult _LuaCallEventHandler(luabridge::LuaRef luaRef, F&& errorHandler, Args... args)
1693 {
1694 assert(luaRef.isFunction());
1695 return std::visit([&](auto const &ptr)
1696 {
1697 return luaRef.callWithHandler(errorHandler, ptr, args...);
1698 }, _subtypeptr);
1699 }
1700#endif // PDK_FRAMEWORK_LUAFRIENDLY_CPP
1701#endif // DOXYGEN_SHOULD_IGNORE_THIS
1702
1707 bool GetPointsMeasurement() { return _pointsmeasurement; }
1708
1709#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1711 void _SetPointsMeasurement(bool use_points) { _pointsmeasurement = use_points; }
1712
1714 virtual _CONTROL_TYPE _GetControlType() { return CONTROLTYPE_UNDEFINED; }
1715
1720 virtual double _GetAutoCreateWidth() { return 70; }
1721
1726 virtual float _GetAutoCreateMultilineHeight() { return 150; }
1727
1731 virtual bool _TextColorSet() const { return false; }
1732
1734 bool _GetAutoResizeWidth() const { return _autoresizewidth; }
1735
1737 std::map<int, int> _GetNoOverlapControls() const { return _nooverlapControls; }
1738
1740 FCControl* _GetHorizontallyAlignWith() const
1741 {
1742 return (_pParent && _alignwithID) ? _pParent->FindControl(_alignwithID) : nullptr;
1743 }
1744
1746 bool _GetHorizontallyAlignWithRight() const { return _alignwithRight; }
1747
1749 double _GetAlignLeft() { return std::round(GetLeft() - _alignwithOffset); }
1750
1752 double _GetAlignRight() { return std::round(GetLeft() + GetWidth() - _alignwithOffset); }
1753
1755 bool _GetStretchToAlignRight() const { return _stretchtofit; }
1756
1757#if OPERATING_SYSTEM == WINDOWS
1758 /* For internal use only!
1759 *
1760 * Creates controls on Windows.
1761 */
1762 bool _WinCreateUIControl(int height_DU, LPCSTR classnameA, LPCWSTR classnameW, DWORD style, DWORD exstyle);
1763
1765 virtual COLORREF _GetWindowsColor() const { return RGB(0, 0, 0); }
1766
1767#ifdef PDK_FRAMEWORK_DPIAWARE
1769 virtual void _OnDpiChanged();
1770#endif // PDK_FRAMEWORK_DPIAWARE
1771#endif // OPERATING_SYSTEM == WINDOWS
1772
1777 bool _CreateUIControl();
1778
1785 virtual void _InitNonWindowHandleStates();
1786
1793 virtual void _StoreNonWindowHandleStates();
1794
1796 virtual void SetParent(__FCUserWindow* parentptr)
1797 {
1798 _pParent = parentptr;
1799 }
1800
1805 void _SetProgrammaticallyCreate(bool state) { _programmaticallycreate = state; }
1806
1808 bool _GetProgrammaticallyCreate() { return _programmaticallycreate; }
1809#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
1810
1812 __FCUserWindow* GetParent() const { return _pParent; }
1813
1816 bool WindowExists() const
1817 {
1818 if (!_pParent) return false;
1819#if OPERATING_SYSTEM == WINDOWS
1820 if (_GetWinControlHandle() == 0) return false;
1821#else
1822 if (!_GetCocoaLink()) return false;
1823#endif
1824 return _pParent->WindowExists();
1825 }
1826
1827#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1828#if OPERATING_SYSTEM == MAC_OS
1829 /* For internal use. Gets the parent's link to the Cocoa interface. This might be NULL. */
1830 _FCWindowController_cocoa* _GetCocoaLink() const
1831 {
1832 return _pParent ? _pParent->_GetCocoaLink() : NULL;
1833 }
1834#else
1836 HWND GetWindowHandle() const { return _pParent ? _pParent->GetWindowHandle() : 0; }
1837#endif
1838#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
1839
1840#if OPERATING_SYSTEM == WINDOWS
1844 {
1845 if (!GetWindowHandle()) return 0;
1846 return GetDlgItem(GetWindowHandle(), GetControlID());
1847 }
1848#endif
1849
1854 virtual void Repaint()
1855 {
1856#if OPERATING_SYSTEM == WINDOWS
1857 InvalidateRect(_GetWinControlHandle(), NULL, false);
1858#endif
1859 }
1860
1873 int GetControlID() const
1874 {
1875 return _id;
1876 }
1877
1883 int GetAssignedID() const { return _id; }
1884
1889 CONTROL_ACTIONS GetAction() const { return _controlaction; }
1890
1895 void SetAction(CONTROL_ACTIONS action) { _controlaction = action; }
1896
1906 virtual void SetEnable(bool state);
1907
1917 virtual bool GetEnable() const;
1918
1925 virtual void SetVisible(bool bShow);
1926
1932 virtual void SetBold(bool state);
1933
1955 virtual void SetFont(const FCFontInfo *fontInfo);
1956
1970 virtual FCFontInfo* CreateFontInfo() const;
1971
1972#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1974 luabridge::RefCountedPtr<FCFontInfo> CreateFontInfo_GC()
1975 { return makeLuaSharedPtr(CreateFontInfo()); }
1976#endif
1977
1984 virtual void SetKeyboardFocus();
1985
1986#if OPERATING_SYSTEM == MAC_OS
1988 void SetTextAndResize(FCString* pString);
1989#endif
2012 virtual bool AssureWidthForText();
2013
2028 void AssureNoHorizontalOverlap(const FCControl& control, int padding)
2029 {
2030 if (control.GetControlID())
2031 _nooverlapControls[control.GetControlID()] = padding;
2032 }
2033
2045 void HorizontallyAlignLeftWith(const FCControl* pControl, double offset = 0)
2046 {
2047 _alignwithID = pControl ? pControl->GetControlID() : 0;
2048 _alignwithRight = false;
2049 _alignwithOffset = pControl ? offset : 0;
2050 }
2051
2052#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2054 int HorizontallyAlignLeftWith_CFunc(lua_State *L)
2055 {
2056 const int numArgs = lua_gettop(L);
2057 // argument 1 is `this`
2058 const FCControl* pControl = luabridge::Stack<const FCControl*>::get(L, 2) LB3(.value());
2059 double offset = (numArgs < 3) ? 0 : luabridge::Stack<double>::get(L, 3) LB3(.value());;
2060 HorizontallyAlignLeftWith(pControl, offset);
2061 return 0;
2062 }
2063#endif
2064
2076 void HorizontallyAlignRightWith(const FCControl* pControl, double offset = 0)
2077 {
2078 _alignwithID = pControl ? pControl->GetControlID() : 0;
2079 _alignwithRight = pControl ? true : false;
2080 _alignwithOffset = pControl ? offset : 0;
2081 }
2082
2083#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2085 int HorizontallyAlignRightWith_CFunc(lua_State *L)
2086 {
2087 const int numArgs = lua_gettop(L);
2088 // argument 1 is `this`
2089 const FCControl* pControl = luabridge::Stack<const FCControl*>::get(L, 2) LB3(.value());
2090 double offset = (numArgs < 3) ? 0 : luabridge::Stack<double>::get(L, 3) LB3(.value());;
2091 HorizontallyAlignRightWith(pControl, offset);
2092 return 0;
2093 }
2094#endif
2095
2106 {
2107 _alignwithID = 0;
2108 _alignwithRight = true;
2109 _alignwithOffset = offset;
2110 }
2111
2112#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2114 static int HorizontallyAlignRightWithFurthest_CFunc(lua_State *L)
2115 {
2116 return _CFunctionOneOptionalParameter<FCControl, void, double, &FCControl::HorizontallyAlignRightWithFurthest>(L, 0);
2117 }
2118#endif
2119
2132 void DoAutoResizeWidth(std::optional<double> minimumwidth = std::nullopt)
2133 {
2134 _autoresizewidth = true;
2135 if (minimumwidth.has_value())
2136 SetWidth(minimumwidth.value());
2137 }
2138
2139#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2141 static int DoAutoResizeWidth_CFunc(lua_State *L)
2142 {
2143 return _CFunctionOneOptionalParameter<FCControl, void, std::optional<double>, &FCControl::DoAutoResizeWidth>(L, std::nullopt);
2144 }
2145#endif
2146
2153 void StretchToAlignWithRight() { _stretchtofit = true; }
2154
2162 virtual void SetText(const FCString* pString);
2163
2168 virtual void GetText(FCString* pString) const;
2169
2174 void SetLeft(float pos);
2175
2180 float GetLeft();
2181
2186 void SetTop(float pos);
2187
2192 float GetTop();
2193
2198 float GetHeight();
2199
2204 float GetWidth();
2205
2210 bool GetVisible();
2211
2216 void SetWidth(float width);
2217
2227 void SetHeight(float height);
2228
2238 void MoveRelative(float horizmove, float vertmove);
2239
2247 void MoveAbsolute(float x, float y);
2248
2260 virtual void ResizeRelative(float horizresize, float vertresize);
2261
2273 bool RedrawImmediate() const;
2274
2275#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2280 bool _HasBufferedMovement()
2281 {
2282 return (_bufferedmove || _bufferedresize);
2283 }
2284
2286 void _ResetBufferedMovement()
2287 {
2288 _bufferedmove = _bufferedresize = false;
2289 }
2290
2292 void _GetBufferedMovement(bool *pshouldmove, bool *pshouldresize,
2293 float *px, float *py, float *pwidth, float *pheight)
2294 {
2295 *pshouldmove = _bufferedmove;
2296 *pshouldresize = _bufferedresize;
2297 *px = _bufferedx;
2298 *py = _bufferedy;
2299 *pwidth = _bufferedwidth;
2300 *pheight = _bufferedheight;
2301 }
2302
2307 void _BufferMove(float x, float y)
2308 {
2309 _bufferedmove = true;
2310 _bufferedx = x;
2311 _bufferedy = y;
2312 }
2313
2318 void _BufferResize(float width, float height)
2319 {
2320 _bufferedresize = true;
2321 _bufferedwidth = width;
2322 _bufferedheight = height;
2323 }
2324
2325#ifdef PDK_FRAMEWORK_DIAGNOSE
2330 bool _ControlExists();
2331
2335 void _ControlClassCheck();
2336
2337#endif // PDK_FRAMEWORK_DIAGNOSE
2338
2345 virtual const char* _WinGetUIClassName() const = 0;
2346
2354 virtual const char* _MacGetUIClassName() const = 0;
2355
2356#endif // DOXYGEN_SHOULD_IGNORE_THIS
2357};
2358
2359class FCCtrlEdit;
2360
2369{
2370 struct __FCCtrlUpDown_NONWINDOWSTORAGE
2371 {
2372 _NONWINDOW_PROPERTY<int> steppervalue;
2373 _NONWINDOW_PROPERTY<int> min;
2374 _NONWINDOW_PROPERTY<int> max;
2375 } updown_nonwindow_store;
2376
2377 /* For internal use only! */
2378 void _InitNonWindowHandleStates() override;
2379
2380 /* For internal use only */
2381 void _StoreNonWindowHandleStates() override;
2382
2383 enum {
2384 CONNECTED_NONE,
2385 CONNECTED_INT,
2386 CONNECTED_MEASUREMENT
2387 } _connectededitmode;
2388
2389 FCCtrlEdit* _pConnectedEditControl;
2390 int _minInt;
2391 int _maxInt;
2392 double _minMeasurement;
2393 double _maxMeasurement;
2394 int _value;
2395public:
2397 FCCtrlUpDown(twobyte id) : FCControl(id, this)
2398 {
2399 _connectededitmode = CONNECTED_NONE;
2400 _pConnectedEditControl = NULL;
2401 _minInt = _maxInt = 0;
2402 _minMeasurement = _maxMeasurement = 0;
2403 _value = 0;
2404 }
2405
2406 const char* ClassName() const override { return "FCCtrlUpDown"; }
2407
2413 void SetValue(int value);
2414
2419 int GetValue();
2420
2425 void SetRange(int min, int max);
2426
2431 int GetMinimum();
2432
2437 int GetMaximum();
2438
2443 FCCtrlEdit* GetConnectedEdit() { return _pConnectedEditControl; }
2444
2445#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2446 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_UPDOWN; }
2447
2448 double _GetAutoCreateWidth() override { return WINCODE(14;) MACCODE(19;) }
2449#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
2450
2463 bool ConnectIntegerEdit(FCCtrlEdit* pControl, int min, int max)
2464 {
2465 if (!pControl) return false;
2466 if (max < min) return false;
2467 _connectededitmode = CONNECTED_INT;
2468 _pConnectedEditControl = pControl;
2469 _minInt = min;
2470 _maxInt = max;
2471#if OPERATING_SYSTEM == MAC_OS
2472 SetRange(min, max);
2473#endif
2474 return true;
2475 }
2476
2489 bool ConnectMeasurementEdit(FCCtrlEdit* pControl, double min, double max)
2490 {
2491 if (!pControl) return false;
2492 if (max < min) return false;
2493 _connectededitmode = CONNECTED_MEASUREMENT;
2494 _pConnectedEditControl = pControl;
2495 _minMeasurement = min;
2496 _maxMeasurement = max;
2497#if OPERATING_SYSTEM == MAC_OS
2498 SetRange((int) min, (int) max);
2499#endif
2500 return true;
2501 }
2502
2503#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2505 void _HandleConnectedEditEvent(int delta);
2506#endif
2507
2508#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2509 const char* _WinGetUIClassName() const override { return "msctls_updown32"; }
2510 const char* _MacGetUIClassName() const override { return "NSStepper"; }
2511#endif
2512};
2513
2523class FCCtrlLine : public FCControl
2524{
2525#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2526 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_LINE; }
2527
2528 double _GetAutoCreateWidth() override { return 150; }
2529
2530#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
2531
2532 bool _horizontal; /* Only for programmatically created controls. */
2533
2534protected:
2535
2536#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2538 FCCtrlLine(twobyte id, const __FCControlTypedPtr &subclassPtr, bool horizontal)
2539 : FCControl(id, subclassPtr), _horizontal(horizontal) {}
2540#endif
2541
2542public:
2543 const char* ClassName() const override { return "FCCtrlLine"; }
2544
2546 FCCtrlLine(twobyte id) : FCControl(id, this)
2547 {
2548 _horizontal = true;
2549 }
2550
2551#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2552 void SetEnable(bool WINCODE(state)) override
2553 {
2554#if OPERATING_SYSTEM == WINDOWS
2555 FCControl::SetEnable(state);
2556#endif
2557 }
2558
2559 bool GetEnable() const override
2560 {
2561#if OPERATING_SYSTEM == WINDOWS
2562 return FCControl::GetEnable();
2563#endif
2564 return true;
2565 }
2566#endif // DOXYGEN_SHOULD_IGNORE_THIS
2567
2572 bool GetHorizontal() { return _horizontal; }
2573
2574#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2575 const char* _WinGetUIClassName() const override { return "Static"; }
2576 const char* _MacGetUIClassName() const override { return "NSBox"; }
2577#endif
2578};
2579
2587{
2588public:
2589 const char* ClassName() const override { return "FCCtrlHorizontalLine"; }
2590
2592 FCCtrlHorizontalLine(twobyte id) : FCCtrlLine(id, this, true) {}
2593};
2594
2602{
2603public:
2604 const char* ClassName() const override { return "FCCtrlVerticalLine"; }
2605
2607 FCCtrlVerticalLine(twobyte id) : FCCtrlLine(id, this, false) {}
2608};
2609
2615{
2616#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2617 _NONWINDOW_PROPERTY<int> _textColorRed;
2618 _NONWINDOW_PROPERTY<int> _textColorGreen;
2619 _NONWINDOW_PROPERTY<int> _textColorBlue;
2620
2621 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_STATIC; }
2622
2623 double _GetAutoCreateWidth() override { return 100; }
2624
2625protected:
2626 void _InitNonWindowHandleStates() override
2627 {
2628 FCControl::_InitNonWindowHandleStates();
2629 if (_TextColorSet()) SetTextColor(_textColorRed.value, _textColorGreen.value, _textColorBlue.value);
2630 }
2631#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
2632public:
2633 const char* ClassName() const override { return "FCCtrlStatic"; }
2634
2636 FCCtrlStatic(twobyte id) : FCControl(id, this) {}
2637
2639 void Clear();
2640
2642 void SetInteger(int anint);
2643
2655 void SetTextColor(int red, int green, int blue);
2656
2657#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2661 bool _TextColorSet() const override { return _textColorRed.has_been_set; }
2662#if OPERATING_SYSTEM == WINDOWS
2663 COLORREF _GetWindowsColor() const override { return RGB(_textColorRed.value, _textColorGreen.value, _textColorBlue.value); }
2664#endif // OPERATING_SYSTEM == WINDOWS
2665#endif // DOXYGEN_SHOULD_IGNORE_THIS
2666
2667#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2668 const char* _WinGetUIClassName() const override { return "Static"; }
2669 const char* _MacGetUIClassName() const override { return "NSTextField"; }
2670#endif
2671};
2672
2679class FCCtrlEdit : public FCControl
2680{
2681#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2682 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_EDIT; }
2683
2684 double _GetAutoCreateWidth() override { return 70; }
2685
2686#if OPERATING_SYSTEM == WINDOWS
2687 double _CalcNonTextWidth() const override { return 4.0; }
2688#endif // OPERATING_SYSTEM == WINDOWS
2689
2690#endif // #ifndef DOXYGEN_SHOULD_IGNORE_THIS
2691
2692protected:
2693
2694#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2696 FCCtrlEdit(twobyte id, const __FCControlTypedPtr &subclassPtr) : FCControl(id, subclassPtr) {}
2697#endif
2698
2699public:
2700 const char* ClassName() const override { return "FCCtrlEdit"; }
2701
2703 FCCtrlEdit(twobyte id) : FCControl(id, this) {}
2704
2709 int GetInteger();
2710
2721 int GetRangeInteger(int minimum, int maximum);
2722
2723#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2724 void SetEnable(bool state) override
2725 {
2726#if OPERATING_SYSTEM == MAC_OS
2727 if (WindowExists() && !state)
2728 {
2729 // macOS does not capture edited text until you tab out of an edit field. Therefore,
2730 // in certain situations disabling the edit control causes the text to revert to its
2731 // previous contents. This fixes it. See:
2732 // https://stackoverflow.com/questions/2271908/nstextfield-setenabled
2733 FCString editText;
2734 GetText(&editText);
2735 SetText(&editText);
2736 }
2737#endif
2738 FCControl::SetEnable(state);
2739 }
2740#endif
2741
2742#ifdef PDK_FRAMEWORK_PREFS
2753 double GetMeasurement(_ENUMCODE(MEASUREMENTUNITS) _LUACODE(twobyte) measurementunit);
2754
2770 double GetRangeMeasurement(_ENUMCODE(MEASUREMENTUNITS) _LUACODE(twobyte) measurementunit, double min, double max);
2771
2783 float GetMeasurementEfix(_ENUMCODE(MEASUREMENTUNITS) _LUACODE(twobyte) measurementunit)
2784 {
2785 /* Since this method calls GetMeasurement(), it supports controls without window handles. */
2786 float f = GetMeasurement(measurementunit);
2787 f *= 64;
2788 return f;
2789 }
2790
2791
2807 float GetRangeMeasurementEfix(_ENUMCODE(MEASUREMENTUNITS) _LUACODE(twobyte) measurementunit, float min, float max)
2808 {
2809 /* Since this method ultimately calls GetMeasurement(), it supports controls without window handles. */
2810 float f = GetRangeMeasurement(measurementunit, min / 64, max / 64);
2811 f *= 64;
2812 return f;
2813 }
2814
2827 void SetMeasurement(double value, _ENUMCODE(MEASUREMENTUNITS) _LUACODE(twobyte) measurementunit);
2828
2841 void SetMeasurementEfix(float value, _ENUMCODE(MEASUREMENTUNITS) _LUACODE(twobyte) measurementunit)
2842 {
2843 value /= 64;
2844 SetMeasurement(value, measurementunit);
2845 }
2846
2858 double GetMeasurementInteger(_ENUMCODE(MEASUREMENTUNITS) _LUACODE(twobyte) measurementunit);
2859
2875 double GetRangeMeasurementInteger(_ENUMCODE(MEASUREMENTUNITS) _LUACODE(twobyte) measurementunit, int min, int max);
2876
2888 void SetMeasurementInteger(double value, _ENUMCODE(MEASUREMENTUNITS) _LUACODE(twobyte) measurementunit);
2889#endif
2890
2895 void SetInteger(int anint);
2896
2901 void SetFloat(double value);
2902
2907 double GetFloat(double min, double max);
2908
2910 void AdjustIntegerWithin(int min, int max);
2911
2918 [[deprecated]] void SetFocus() { SetKeyboardFocus(); }
2919
2920#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2921#if OPERATING_SYSTEM == WINDOWS
2922 void SetKeyboardFocus() override
2923 { FX_SetDlgFocus(GetWindowHandle(), GetControlID()); }
2924#endif
2925#endif // DOXYGEN_SHOULD_IGNORE_THIS
2926
2928 void SelectAll();
2929
2931 void SetMaxLength(twobyte maxlength);
2932
2934 void SetReadOnly(bool readonly);
2935
2937 void ScrollToBottom();
2938
2939#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2940 const char* _WinGetUIClassName() const override { return "Edit"; }
2941 const char* _MacGetUIClassName() const override { return "NSTextField;NSSearchField"; }
2942#endif
2943};
2944
2952{
2953 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_POPUP; }
2954
2955 double _GetAutoCreateWidth() override { return 100; }
2956
2957 struct __FCCtrlPopup_NONWINDOWSTORAGE
2958 {
2959 _NONWINDOW_PROPERTY<int> selecteditem;
2960 _NONWINDOW_PROPERTY_FCSTRINGS items;
2961 } popup_nonwindow_store;
2962
2963#if OPERATING_SYSTEM == WINDOWS
2964 double _CalcNonTextWidth() const override;
2965#endif // OPERATING_SYSTEM == WINDOWS
2966
2967 /* For internal use only! */
2968 void _InitNonWindowHandleStates() override;
2969
2970 /* For internal use only */
2971 void _StoreNonWindowHandleStates() override;
2972public:
2973 const char* ClassName() const override { return "FCCtrlPopup"; }
2974
2976 FCCtrlPopup(twobyte id) : FCControl(id, this) {}
2977
2979 bool AssureWidthForText() override;
2980
2985 void Clear();
2986
2991 void AddString(FCString* pString);
2992
3002 void InsertString(int index, FCString* pString);
3003
3013 void SetStrings(FCStrings* pStrings)
3014 {
3015 Clear();
3016 if (!pStrings) return;
3017 for (int i = 0; i < pStrings->GetCount(); i++)
3018 {
3019 FCString* pString = pStrings->GetItemAt(i);
3020 AddString(pString);
3021 }
3022 }
3023
3030 void DeleteItem(int index);
3031
3036 int GetCount() const;
3037
3044 int GetSelectedItem() const;
3045
3052 void SetSelectedItem(int index);
3053
3060 bool GetItemText(int index, FCString* pString);
3061
3068 void SetItemText(int index, FCString* pString);
3069
3070#ifndef DOXYGEN_SHOULD_IGNORE_THIS
3071 const char* _WinGetUIClassName() const override { return "ComboBox"; }
3072 const char* _MacGetUIClassName() const override { return "NSPopUpButton"; }
3073#endif
3074};
3075
3076
3084{
3085 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_COMBOBOX; }
3086
3087 double _GetAutoCreateWidth() override { return 100; }
3088
3089 struct __FCCtrlPopup_NONWINDOWSTORAGE
3090 {
3091 _NONWINDOW_PROPERTY<int> selecteditem;
3092 _NONWINDOW_PROPERTY_FCSTRINGS items;
3093 } cbobox_nonwindow_store;
3094
3095#if OPERATING_SYSTEM == WINDOWS
3096 double _CalcNonTextWidth() const override;
3097#endif // OPERATING_SYSTEM == WINDOWS
3098
3099 /* For internal use only! */
3100 void _InitNonWindowHandleStates() override;
3101
3102 /* For internal use only */
3103 void _StoreNonWindowHandleStates() override;
3104
3105public:
3106 const char* ClassName() const override { return "FCCtrlComboBox"; }
3107
3109 FCCtrlComboBox(twobyte id) : FCCtrlEdit(id, this) {}
3110
3112 bool AssureWidthForText() override;
3113
3118 void Clear();
3119
3122 void AddString(FCString* pString);
3123
3133 void SetStrings(FCStrings* pStrings)
3134 {
3135 Clear();
3136 if (!pStrings) return;
3137 for (int i = 0; i < pStrings->GetCount(); i++)
3138 {
3139 FCString* pString = pStrings->GetItemAt(i);
3140 AddString(pString);
3141 }
3142 }
3143
3149 int GetCount();
3150
3157 int GetSelectedItem();
3158
3165 void SetSelectedItem(int index);
3166
3167#ifndef DOXYGEN_SHOULD_IGNORE_THIS
3168 const char* _WinGetUIClassName() const override { return "ComboBox"; }
3169 const char* _MacGetUIClassName() const override { return "NSComboBox"; }
3170#endif
3171};
3172
3185{
3186 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_TEXTEDITOR; }
3187
3188 double _GetAutoCreateWidth() override { return 200; }
3189
3190 float _GetAutoCreateMultilineHeight() override { return 150; }
3191
3192 struct __FCCtrlTextEditor_NONWINDOWSTORAGE
3193 {
3194 _NONWINDOW_PROPERTY<bool> readonly;
3195 _NONWINDOW_PROPERTY<bool> wordwrap;
3196 _NONWINDOW_PROPERTY<bool> richtext;
3197 _NONWINDOW_PROPERTY<bool> autoediting;
3198 _NONWINDOW_PROPERTY<double> tabwidth;
3199#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
3200 _NONWINDOW_PROPERTY_FCSTRING enigmastring;
3201#endif
3202 _NONWINDOW_PROPERTY<int> parseextag;
3203 _NONWINDOW_PROPERTY<double> linespacing;
3204
3205 __FCCtrlTextEditor_NONWINDOWSTORAGE()
3206 : wordwrap(true), richtext(true), autoediting(true), parseextag(tx_TextBlock) {}
3207 } edittext_nonwindow_store;
3208
3209 int _tabspaces;
3210 bool _autoindent;
3211
3212 /* For internal use only! */
3213 void _InitNonWindowHandleStates() override;
3214
3215 /* For internal use only */
3216 void _StoreNonWindowHandleStates() override;
3217
3218#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
3220 bool _ReplaceTextInRangeWithEnigmaString(const FCString* pString, const FCRange* pRange = nullptr);
3221#endif
3222
3223 bool _SetColorInRange(int red, int green, int blue, bool reset, bool background, const FCRange* pRange);
3224 std::tuple<int, int, int> _GetColorAtIndex(int index, bool background) const;
3225 FCRanges* _CreateColorChanges(bool background) const;
3226
3227 std::unique_ptr<FCRange> _CreateAdjustedRange(const FCRange* pRange) const
3228 {
3229 std::unique_ptr<FCRange> adjustedRange = std::make_unique<FCRange>();
3230 GetTotalTextRange(adjustedRange.get());
3231 adjustedRange->SetStart((std::max)(adjustedRange->GetStart(), pRange->GetStart()));
3232 adjustedRange->SetLength((std::min)(adjustedRange->GetLength(), pRange->GetLength()));
3233 return adjustedRange;
3234 }
3235
3236#if OPERATING_SYSTEM == WINDOWS
3241 std::pair<bool, POINT> FCCtrlTextEditor::_SetNotifySelectionChanges(bool newStatus, const std::optional<POINT> oldScrollPos = std::nullopt) const;
3242#endif //OPERATING_SYSTEM == WINDOWS
3243
3244public:
3245 const char* ClassName() const override { return "FCCtrlTextEditor"; }
3246
3248 FCCtrlTextEditor(twobyte id) : FCControl(id, this), _tabspaces(0), _autoindent(false)
3249 {
3250 // NSTextView has no concept of enabled, so we have to mimic it with
3251 // color changes. For this reason, we also have to track whether we are
3252 // actually disabled vs just in no-edit mode.
3253 // It turns out this is handy in Windows as well.
3254 FCControl::nonwindow_store.enabled.SetValue(true);
3255 }
3256
3258 void SetParent(__FCUserWindow* parentptr) override
3259 {
3260 FCControl::SetParent(parentptr);
3261 WINCODE(parentptr->_LoadRichEditDll());
3262 }
3263
3264 // CAUTION: STRINGFINDOPTIONS are bitwise constants. Future values should be 0x04, 0x08, 0x10, etc.
3265
3271 {
3273 STRFINDOPT_IGNORECASE = 0x01,
3274
3276 STRFINDOPT_WHOLEWORDS = 0x02,
3277
3279 STRFINDOPT_REGEX = 0x04
3281
3282#ifndef DOXYGEN_SHOULD_IGNORE_THIS
3283 void SetFont(const FCFontInfo* fontInfo) override;
3284#if OPERATING_SYSTEM == WINDOWS
3285 FCFontInfo* CreateFontInfo() const override;
3286 void GetText(FCString* pText) const override;
3287#endif // OPERATING_SYSTEM == WINDOWS
3288#endif // DOXYGEN_SHOULD_IGNORE_THIS
3289
3290#ifndef DOXYGEN_SHOULD_IGNORE_THIS
3291 void SetEnable(bool state) override
3292 {
3293 FCControl::nonwindow_store.enabled.SetValue(state);
3294#if OPERATING_SYSTEM == WINDOWS
3295 if (!WindowExists()) return;
3296 HWND hCtrl = GetDlgItem(GetWindowHandle(), GetControlID());
3297 EnableWindow(hCtrl, state);
3298#else
3299 FCControl::SetEnable(state);
3300 if (state)
3301 SetReadOnly(edittext_nonwindow_store.readonly.value);
3302#endif
3303 }
3304
3305 bool GetEnable() const override
3306 {
3307#if OPERATING_SYSTEM == WINDOWS
3308 if (!WindowExists()) return nonwindow_store.enabled.value;
3309 HWND hCtrl = GetDlgItem(GetWindowHandle(), GetControlID());
3310 return IsWindowEnabled(hCtrl);
3311#else
3312 return FCControl::nonwindow_store.enabled.value;
3313#endif
3314 }
3315#endif // DOXYGEN_SHOULD_IGNORE_THIS
3316
3329 bool GetTotalTextRange(FCRange* pRange) const;
3330
3340 int GetLineForPosition(int pos) const;
3341
3349 int GetCurrentLine() const
3350 {
3351 FCRange currSel;
3352 GetSelection(&currSel);
3353 return GetLineForPosition(currSel.GetStart());
3354 }
3355
3364 bool GetLineRangeForLine(int line, FCRange* pRange) const;
3365
3376 FCRanges* CreateLineRanges(const FCRange *pRange = nullptr) const;
3377
3378#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
3380 int CreateLineRanges_GC(lua_State *L)
3381 {
3382 const int numArgs = lua_gettop(L);
3383 // argument 1 is `this`
3384 const FCRange * pRange = (numArgs < 2) ? nullptr : luabridge::Stack<const FCRange *>::get(L, 2) LB3(.value());;
3385 luabridge::Stack<luabridge::RefCountedPtr<FCRanges>>::push(L, makeLuaSharedPtr(CreateLineRanges(pRange))) LB3(.throw_on_error());
3386 return 1;
3387 }
3388#endif
3389
3400 bool GetLineRangeForPosition(int pos, FCRange* pRange) const;
3401
3413 bool GetSelection(FCRange *pRange) const;
3414
3425 bool SetSelection(const FCRange* pRange);
3426
3432 {
3433 FCRange totalRange;
3434 if (! GetTotalTextRange(&totalRange))
3435 return false;
3436 return SetSelection(&totalRange);
3437 }
3438
3454 bool GetTextInRange(FCString *pText, const FCRange* pRange) const;
3455
3466 bool ReplaceTextInRange(const FCString *pText, const FCRange* pRange);
3467
3478 bool ReplaceTextInRangeWithFormat(const FCString *pText, const FCEnigmaTextStyle* pStyle, const FCRange* pRange);
3479
3480#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
3488 bool ReplaceTextInRangeWithEnigmaString(const FCString* pString, const FCRange* pRange)
3489 {
3490 if (!pString || !pRange) return false;
3491 return _ReplaceTextInRangeWithEnigmaString(pString, pRange);
3492 }
3493#endif
3494
3504 bool GetSelectedText(FCString *pText) const
3505 {
3506 FCRange range;
3507 if (! GetSelection(&range)) return false;
3508 return GetTextInRange(pText, &range);
3509 }
3510
3521 {
3522 FCRange range;
3523 if (! GetSelection(&range)) return false;
3524 return ReplaceTextInRange(pText, &range);
3525 }
3526
3537 void InsertTextAtCursor(const FCString *pText);
3538
3545 void AppendText(const FCString *pText);
3546
3555 void AppendTextWithFormat(const FCString *pText, const FCEnigmaTextStyle* pStyle);
3556
3585 FCString* CreateRTFString() const;
3586
3587#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
3589 luabridge::RefCountedPtr<FCString> CreateRTFString_GC()
3590 { return makeLuaSharedPtr(CreateRTFString()); }
3591#endif
3592
3593#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
3594
3616 FCString* CreateEnigmaString(const FCRange* pRange = nullptr) const;
3617
3618#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
3619private:
3621 luabridge::RefCountedPtr<FCString>CreateEnigmaString_GC(const FCRange* pRange)
3622 { return makeLuaSharedPtr(CreateEnigmaString(pRange)); }
3623public:
3625 static int CreateEnigmaString_CFunc(lua_State* L)
3626 {
3627 return _CFunctionOneOptionalParameter<FCCtrlTextEditor, luabridge::RefCountedPtr<FCString>, const FCRange*, &FCCtrlTextEditor::CreateEnigmaString_GC>(L, nullptr);
3628 }
3629#endif
3630
3646 bool SetRTFString(const FCString* pString);
3647
3680 bool SetEnigmaString(const FCString* pString, int rawtexttype = 0)
3681 {
3682 edittext_nonwindow_store.parseextag.SetValue(FCRawText::_exTagFromRawTextType(static_cast<FCRawText::RAWTEXTTYPES>(rawtexttype)));
3683 return _ReplaceTextInRangeWithEnigmaString(pString);
3684 }
3685
3686#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
3688 int SetEnigmaString_CFunc(lua_State* L)
3689 {
3690 const int numArgs = lua_gettop(L);
3691 // argument 1 is `this`
3692 const FCString * pString = luabridge::Stack<const FCString *>::get(L, 2) LB3(.value());
3693 const int rawtexttype = (numArgs < 3) ? 0 : luabridge::Stack<int>::get(L, 3) LB3(.value());
3694 luabridge::Stack<bool>::push(L, SetEnigmaString(pString, rawtexttype)) LB3(.throw_on_error());
3695 return 1;
3696 }
3697#endif
3698
3699#endif // PDK_FRAMEWORK_ENIGMASTRINGS
3700
3711 FCFontInfo* CreateFontInfoAtIndex(int index) const;
3712
3713#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
3715 luabridge::RefCountedPtr<FCFontInfo> CreateFontInfoAtIndex_GC(int index)
3716 { return makeLuaSharedPtr(CreateFontInfoAtIndex(index)); }
3717#endif
3718
3727 bool SetFontInRange(const FCFontInfo* pFont, const FCRange* pRange);
3728
3736 bool SetFontForSelection(const FCFontInfo* pFont);
3737
3746 bool SetFontSizeInRange(int size, const FCRange* pRange);
3747
3755 bool SetFontSizeForSelection(int size);
3756
3765 bool SetFontBoldInRange(bool state, const FCRange* pRange);
3766
3774 bool SetFontBoldForSelection(bool state);
3775
3784 bool SetFontItalicInRange(bool state, const FCRange* pRange);
3785
3793 bool SetFontItalicForSelection(bool state);
3794
3799 void SetReadOnly(bool readonly);
3800
3805 bool GetReadOnly() const;
3806
3815 void SetWordWrap(bool wordwrap);
3816
3821 bool GetWordWrap() const { return edittext_nonwindow_store.wordwrap.value; }
3822
3830 void SetUseRichText(bool state);
3831
3845 bool GetUseRichText() const;
3846
3854 void SetAutomaticEditing(bool state);
3855
3862 bool GetAutomaticEditing() const { return edittext_nonwindow_store.autoediting.value; }
3863
3876 void SetTabstopWidth(double value);
3877
3883 int GetConvertTabsToSpaces() const { return _tabspaces; }
3884
3893 void SetConvertTabsToSpaces(int value) { _tabspaces = value; }
3894
3899 bool GetAutomaticallyIndent() const { return _autoindent; }
3900
3905 void SetAutomaticallyIndent(bool state) { _autoindent = state; }
3906
3907
3924 FCRanges* CreateRangesForString(const FCString* pSearchString, FLAG_32 options, const FCRange* pRange = nullptr) const;
3925
3926#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
3928 int CreateRangesForString_CFunc(lua_State *L) const
3929 {
3930 const int numArgs = lua_gettop(L);
3931 // argument 1 is `this`
3932 const FCString * pString = luabridge::Stack<const FCString *>::get(L, 2) LB3(.value());
3933 const FLAG_32 options = luabridge::Stack<FLAG_32>::get(L, 3) LB3(.value());
3934 const FCRange * pRange = (numArgs < 4) ? nullptr : luabridge::Stack<const FCRange *>::get(L, 4) LB3(.value());;
3935 luabridge::Stack<luabridge::RefCountedPtr<FCRanges>>::push(L, makeLuaSharedPtr(CreateRangesForString(pString, options, pRange))) LB3(.throw_on_error());
3936 return 1;
3937 }
3938#endif
3939
3947 void ResetUndoState();
3948
3964 bool SetTextColorInRange(int red, int green, int blue, const FCRange* pRange)
3965 {
3966 return _SetColorInRange(red, green, blue, false, false, pRange);
3967 }
3968
3980 bool SetBackgroundColorInRange(int red, int green, int blue, const FCRange* pRange)
3981 {
3982 return _SetColorInRange(red, green, blue, false, true, pRange);
3983 }
3984
3994 bool ResetTextColorInRange(const FCRange* pRange)
3995 {
3996 return _SetColorInRange(0, 0, 0, true, false, pRange);
3997 }
3998
4008 {
4009 return _SetColorInRange(0, 0, 0, true, true, pRange);
4010 }
4011
4019 {
4020 FCRange range;
4021 GetTotalTextRange(&range);
4022 bool retval = true;
4023 if (!ResetTextColorInRange(&range)) retval = false;
4024 if (!ResetBackgroundColorInRange(&range)) retval = false;
4025 return retval;
4026 }
4027
4040 std::tuple<int, int, int> GetTextColorAtIndex(int index) const
4041 {
4042 return _GetColorAtIndex(index, false);
4043 }
4044
4057 std::tuple<int, int, int> GetBackgroundColorAtIndex(int index) const
4058 {
4059 return _GetColorAtIndex(index, true);
4060 }
4061
4072 {
4073 return _CreateColorChanges(false);
4074 }
4075
4076#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
4078 luabridge::RefCountedPtr<FCRanges> CreateTextColorChanges_GC() const
4079 { return makeLuaSharedPtr(CreateTextColorChanges()); }
4080#endif
4081
4092 {
4093 return _CreateColorChanges(true);
4094 }
4095
4096#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
4098 luabridge::RefCountedPtr<FCRanges> CreateBackgroundColorChanges_GC() const
4099 { return makeLuaSharedPtr(CreateBackgroundColorChanges()); }
4100#endif
4101
4112 int GetNumberOfLines() const;
4113
4120 double GetVerticalScrollPosition() const;
4121
4126 void ScrollToTop();
4127
4132 void ScrollToBottom();
4133
4141 void ScrollToVerticalPosition(double vpos);
4142
4149 void ScrollLineIntoView(int line);
4150
4159 double GetLineSpacing() const;
4160
4174 void SetLineSpacing(double value);
4175
4192 FCString* CreateCharacterAtIndex(int pos) const;
4193
4194#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
4196 luabridge::RefCountedPtr<FCString> CreateCharacterAtIndex_GC(int pos)
4197 { return makeLuaSharedPtr(CreateCharacterAtIndex(pos)); }
4198#endif
4199
4212 bool TextToClipboard() const;
4213
4214#ifndef DOXYGEN_SHOULD_IGNORE_THIS
4215 const char* _WinGetUIClassName() const override { return "RICHEDIT50W"; }
4216 const char* _MacGetUIClassName() const override { return "NSTextView"; }
4217#endif
4218};
4219
4220class FCCtrlDataList;
4221
4232{
4233 bool _checked;
4234 int _connectedlineindex;
4235 FCCtrlDataList* _connectedlist;
4236public:
4237
4238#ifndef DOXYGEN_SHOULD_IGNORE_THIS
4241 void _MakeConnection(FCCtrlDataList* pCtrl, int lineindex);
4242
4245 void _SetCheckState(bool state) { _checked = state; }
4246#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
4247
4253 {
4254 _checked = false;
4255 _connectedlineindex = -1;
4256 _connectedlist = NULL;
4257 }
4258 const char* ClassName() const override { return "FCDataListRow"; }
4259
4264 void SetCheck(bool state);
4265
4270 bool GetCheck() const { return _checked; }
4271
4273 int GetConnectedLineIndex() { return _connectedlineindex; }
4274
4276 FCCtrlDataList* GetConnectedList() { return _connectedlist; }
4277};
4278
4292{
4293 bool _usecheckboxes; // Used for programmatically-created dialog boxes only.
4294 bool _showheader; // not meaningful for macOS FCCtrlListBox (which inherits from this class)
4295 bool _expandlast; // not meaningful for macOS FCCtrlListBox (which inherits from this class)
4296 bool _multiselect; // not meaningful for macOS FCCtrlListBox (which inherits from this class)
4297#if OPERATING_SYSTEM == MAC_OS
4298 int _fontsize;
4299#endif
4300
4301 class __FCDataList_NONWINDOWSELECTION
4302 {
4303 _NONWINDOW_PROPERTY<int> focusindex;
4304 std::set<int> selectedindices;
4305 public:
4306 __FCDataList_NONWINDOWSELECTION()
4307 {
4308 focusindex.value = -1; // avoid setting has_been_set
4309 }
4310 bool has_been_set() const { return focusindex.has_been_set; }
4311 int get_focus_index() const { return focusindex.value; }
4312 void select_line(int index)
4313 {
4314 if (index < 0) return;
4315 selectedindices.insert(index);
4316 focusindex.SetValue(index);
4317 }
4318 void select_line_exclusive(int index)
4319 {
4320 selectedindices.clear();
4321 select_line(index);
4322 }
4323 void unselect_line(int index)
4324 {
4325 if (index < 0) return;
4326 selectedindices.erase(index);
4327 if (!is_line_selected(get_focus_index()))
4328 {
4329 if (selectedindices.size() <= 0)
4330 focusindex.SetValue(-1);
4331 else
4332 focusindex.SetValue(*selectedindices.begin());
4333 }
4334 }
4335 void unselect_all()
4336 {
4337 selectedindices.clear();
4338 focusindex.SetValue(-1);
4339 }
4340 bool is_line_selected(int index) const
4341 {
4342 return selectedindices.find(index) != selectedindices.end();
4343 }
4344 } datalist_nonwindow_selection;
4345
4346 struct __FCDataList_NONWINDOWSTORAGE
4347 {
4348 _NONWINDOW_PROPERTY_FCSTRINGS columntexts;
4349 _NONWINDOW_PROPERTY_FCNUMBERS columnwidths;
4350 _NONWINDOW_PROPERTY<bool> usealternatingrows;
4351 } datalist_nonwindow_store;
4352
4353 __FCCollection _rows; /* The collection of pointer references to the
4354 * rows, so they can be deleted when the lines
4355 * are deleted. */
4356
4357 /* For internal use only! */
4358 void _InitNonWindowHandleStates() override;
4359
4360 /* For internal use only */
4361 void _StoreNonWindowHandleStates() override;
4362
4363 /* Builds the list */
4364 void _BuildList();
4365
4366 /* initializer called in ctors */
4367 void _init()
4368 {
4369 _usecheckboxes = false;
4370 _showheader = true;
4371 _expandlast = false;
4372 _multiselect = false;
4373#if OPERATING_SYSTEM == MAC_OS
4374 _fontsize = 12;
4375#endif
4376 }
4377
4378protected:
4379
4380#ifndef DOXYGEN_SHOULD_IGNORE_THIS
4381 // FCCtrlListBox inherits FCCtrlDataList on Mac (not on Windows), but it does not call
4382 // base class versions of _InitNonWindowHandleStates or _SaveNonWindowHandleStates.
4383 // These functions are used to process the values that need to be processed for
4384 // both this class and any subclasses it may have.
4385 void _DataListInitNonWindowHandleStates();
4386 void _DataListStoreNonWindowHandleStates();
4387#endif
4388
4389public:
4390
4391#ifndef DOXYGEN_SHOULD_IGNORE_THIS
4392 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_DATALIST; }
4393
4394 double _GetAutoCreateWidth() override { return 200; }
4395
4396 float _GetAutoCreateMultilineHeight() override { return 150; }
4397#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
4398
4399 const char* ClassName() const override { return "FCCtrlDataList"; }
4400
4402 FCCtrlDataList(twobyte id) : FCControl(id, this)
4403 { _init(); }
4404
4405#ifndef DOXYGEN_SHOULD_IGNORE_THIS
4406#if OPERATING_SYSTEM == MAC_OS
4408 FCCtrlDataList(twobyte id, const __FCControlTypedPtr &subclassPtr) : FCControl(id, subclassPtr)
4409 { _init(); }
4410#endif
4411#endif
4412
4413 virtual ~FCCtrlDataList()
4414 {
4415 //_rows.ClearAll();
4416 }
4417
4422 void SetFontSize(int fontsize)
4423 {
4424#if OPERATING_SYSTEM == MAC_OS
4425 _fontsize = fontsize;
4426#endif
4427 }
4428
4429#ifndef DOXYGEN_SHOULD_IGNORE_THIS
4430 const eUniChar16* _GetCellUnicodeText(FCDataListRow* pRow, int columnindex);
4431
4432 const char* _GetCellCText(FCDataListRow* pRow, int columnindex);
4433#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
4434
4440 void SetColumnTitle(int columnindex, FCString* pTitle);
4441
4446 bool AddColumn(FCString* pTitle, float columnwidth);
4447
4456 int AddRow(FCDataListRow* pRow);
4457
4461 bool InsertRowAt(FCDataListRow* pRow, int);
4462
4471 FCDataListRow* CreateRow();
4472
4481 bool DeleteRow(int lineindex);
4482
4487 void DeleteAll();
4488
4490 void DeleteAllColumns();
4491
4498 bool GetUseCheckboxes() const { return _usecheckboxes; }
4499
4507 void SetUseCheckboxes(bool state) { _usecheckboxes = state; }
4508
4516 bool UseLeftCheckboxColumn();
4517
4524 bool GetAllowsMultipleSelection() const { return _multiselect; }
4525
4536 void SetAllowsMultipleSelection(bool state) { _multiselect = state; }
4537
4544 bool GetShowHeader() const { return _showheader; }
4545
4553 void SetShowHeader(bool state) { _showheader = state; }
4554
4560 void UseGrid();
4561
4566 void UseFullRowSelect();
4567
4576 bool GetAlternatingBackgroundRowColors() const;
4577
4585 void SetAlternatingBackgroundRowColors(bool state);
4586
4595 [[deprecated]] void UseAlternatingBackgroundRowColors() { SetAlternatingBackgroundRowColors(true); }
4596
4601 int GetCount();
4602
4607 FCDataListRow* GetItemAt(int lineindex);
4608
4610 void Redraw();
4611
4623 bool SelectLine(int lineindex, bool ensurevisible = false);
4624
4635 bool AddSelectedLine(int lineindex, bool ensurevisible = false);
4636
4645 bool IsLineSelected(int lineindex);
4646
4654 bool UnselectLine(int lineindex);
4655
4662 bool UnselectAll();
4663
4665 void ScrollToTop();
4666
4673 bool GetExpandLastColumn() const { return _expandlast; }
4674
4682 void SetExpandLastColumn(bool state) { _expandlast = state; }
4683
4686 void ExpandLastColumn();
4687
4699 int GetSelectedLine();
4700
4712 virtual void HandleSelectChange(int lineindex);
4713
4724 virtual void HandleUnselect();
4725
4731 virtual void HandleCheckChange(int lineindex, bool state)
4732 {
4733 FCDataListRow* pRow = GetItemAt(lineindex);
4734 if (!pRow) return;
4735 pRow->_SetCheckState(state);
4736 GetParent()->HandleDataListCheck(this, lineindex, state);
4737 }
4738
4744 virtual void HandleDoubleClick() { GetParent()->HandleListDoubleClick(this); }
4745
4748 void ReconnectAll();
4749
4752 bool HasCheckboxes();
4753
4763 int GetDetailedColumnCount(bool includecheckboxcolumn);
4764
4769 int GetColumnCount() { return GetDetailedColumnCount(false); }
4770
4777 float GetColumnWidth(int columnindex);
4778
4785 bool Swap(int rowindex1, int rowindex2, bool redraw);
4786
4787#ifndef DOXYGEN_SHOULD_IGNORE_THIS
4788 const char* _WinGetUIClassName() const override { return "SysListView32"; }
4789 const char* _MacGetUIClassName() const override { return "NSTableView"; }
4790#endif
4791};
4792
4811#if OPERATING_SYSTEM == WINDOWS
4813#else
4814class FCCtrlListBox : public FCCtrlDataList
4815#endif
4816{
4817public:
4818#ifndef DOXYGEN_SHOULD_IGNORE_THIS
4819 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_LISTBOX; }
4820
4821 double _GetAutoCreateWidth() override { return 150; }
4822
4823 float _GetAutoCreateMultilineHeight() override { return 170; }
4824#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
4825private:
4826
4827 struct __FCCtrlListBox_NONWINDOWSTORAGE
4828 {
4829 _NONWINDOW_PROPERTY<int> selecteditem;
4830 _NONWINDOW_PROPERTY_FCSTRINGS items;
4831 } listbox_nonwindow_store;
4832
4833 /* For internal use only! */
4834 void _InitNonWindowHandleStates() override;
4835
4836 /* For internal use only */
4837 void _StoreNonWindowHandleStates() override;
4838
4839#if OPERATING_SYSTEM == MAC_OS
4840 void _MacSetupListboxColumn();
4841#endif
4842public:
4843 const char* ClassName() const override { return "FCCtrlListBox"; }
4844
4846 FCCtrlListBox(twobyte id);
4847
4852 void Clear();
4853
4858 void AddString(FCString* pString);
4859
4866 int GetSelectedItem();
4867
4872 int GetCount();
4873
4880 void SetSelectedItem(int index);
4881
4889 {
4890 /* Both GetCount() and SetSelectedItem() has non-window support. */
4891 int count = GetCount();
4892 if (count < 1) return false;
4893 SetSelectedItem(count - 1);
4894 return true;
4895 }
4896
4898 void ClearSelection();
4899
4908 void SetItemText(int index, FCString* pString);
4909
4918 void GetItemText(int index, FCString* pString);
4919
4924 void DeleteItem(int index);
4925
4934 void InsertItem(int index, FCString* pString);
4935
4943 void SetStrings(FCStrings* pStrings);
4944
4945#ifndef DOXYGEN_SHOULD_IGNORE_THIS
4946 const char* _WinGetUIClassName() const override { return "ListBox"; }
4947#if OPERATING_SYSTEM == WINDOWS
4948 // the mac side picks up _MacGetUIClassName from FCCtrlDataList, but
4949 // we need a definition here for Windows to satisfy the virtual pure function.
4950 const char* _MacGetUIClassName() const override { return "NSTableView"; }
4951#endif
4952#endif
4953};
4954
4955
4956class FCCtrlTree;
4957
4965{
4966
4972#if OPERATING_SYSTEM == WINDOWS
4973 /* Windows - a tree view item handle */
4974 HANDLE
4975#else
4976 /* Cocoa - a NSValue that contains a pointer to the FCTreeNode */
4977 void*
4978#endif
4979 _itemhandle;
4980
4981 bool _isselected;
4982 bool _iscontainer;
4983 bool _expanded;
4984 FCString _thetext;
4985 FCCtrlTree* _pTreeControl;
4986 FCTreeNode* _pParentNode;
4987
4989 void UpdateText();
4990 public:
4995 FCTreeNode(FCString* pText);
4996
4998 virtual ~FCTreeNode();
4999
5000 const char* ClassName() const override { return "FCTreeNode"; }
5001
5008 FCTreeNode* GetItemAt(int index) const { return (FCTreeNode*) __FCCollection::GetItemAt(index); }
5009
5018 void SetText(FCString* pText) {
5019 if (pText)
5020 _thetext.SetString(pText);
5021 else
5022 _thetext.Clear();
5023
5024 UpdateText();
5025 }
5026
5033 void GetText(FCString* pString) const
5034 {
5035 if (!pString) return;
5036 pString->SetString(&_thetext);
5037 }
5038
5041 {
5042 return &_thetext;
5043 }
5044
5045#ifndef DOXYGEN_SHOULD_IGNORE_THIS
5048 void _SetIsContainer(bool state) { _iscontainer = state; }
5049
5055 void _SetExpanded(bool state) { _expanded = state; }
5056
5062 bool _GetExpanded() { return _expanded; }
5063#endif
5064
5072 bool GetIsContainer() const { return _iscontainer; }
5073
5074#ifndef DOXYGEN_SHOULD_IGNORE_THIS
5075 void _SetTreeControl(FCCtrlTree* pTree) { _pTreeControl = pTree; }
5076
5077 FCCtrlTree* _GetTreeControl() { return _pTreeControl; }
5078
5079 void _SetParentNode(FCTreeNode* pNode) { _pParentNode = pNode; }
5080
5081 /* Only used when creating a tree view programmatically before the window displays... */
5082 void _SetSelected(bool selected) { _isselected = selected; }
5083
5084 /* Only used when creating a tree view programmatically before the window displays... */
5085 bool _GetSelected() { return _isselected; }
5086#endif
5087
5094 FCTreeNode* GetParentNode() { return _pParentNode; }
5095
5103 {
5104 if (!_pParentNode) return -1;
5105 return _pParentNode->GetIndexOf(this);
5106 }
5107
5115 {
5116 if (!_pParentNode) return 0;
5117 return _pParentNode->GetCount();
5118 }
5119
5121#if OPERATING_SYSTEM == WINDOWS
5122 /* Windows - a tree view item handle */
5123 HANDLE
5124#else
5125 /* Cocoa - a NSValue that contains a pointer to the FCTreeNode */
5126 void*
5127#endif
5128 _GetItemHandle() { return _itemhandle; }
5129
5131 void _SetItemHandle(
5132#if OPERATING_SYSTEM == WINDOWS
5133 /* Windows - a tree view item handle */
5134 HANDLE
5135#else
5136 /* Cocoa */
5137 void*
5138#endif
5139 item);
5140
5141#ifdef PDK_FRAMEWORK_DEBUG
5142 void DebugDump() override
5143 {
5144 DebugOutBool("Is Container: ", _iscontainer);
5145 FCString astring;
5146 GetText(&astring);
5147 DebugOutString("Text: ", &astring);
5148 }
5149
5150#endif
5151};
5152
5153
5174class FCCtrlTree : public FCControl
5175{
5176 /*
5177 IMPLEMENTATION INFO:
5178 Since the tree is mirrored in internal data already, there's no need to use additional storage for
5179 programmatically created controls. Instead, the existing data structure is used.
5180 */
5181
5182
5183#if OPERATING_SYSTEM == MAC_OS
5184 void _MacSetupTreeColumn();
5185 int _fontsize;
5186#endif
5187
5188 FCTreeNode* _pRootNode;
5189
5190 FCTreeNode* _MapItem(WINCODE(HANDLE) MACCODE(FCTreeNode*) htreeitem,
5191 FCTreeNode *pBaseNode = NULL);
5192
5193 void _DeleteAllSubNodes(FCTreeNode* pBaseNode);
5194 public:
5195
5197 /* Windows constructor */
5198 FCCtrlTree(twobyte id) : FCControl(id, this)
5199 {
5200#if OPERATING_SYSTEM == MAC_OS
5201 _fontsize = 12;
5202#endif
5203 _pRootNode = new FCTreeNode(NULL);
5204 }
5205
5206 virtual ~FCCtrlTree()
5207 {
5208 _DeleteAllSubNodes(_pRootNode);
5209 delete _pRootNode;
5210 }
5211 const char* ClassName() const override { return "FCCtrlTree"; }
5212
5213#ifndef DOXYGEN_SHOULD_IGNORE_THIS
5214 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_TREE; }
5215
5216 double _GetAutoCreateWidth() override { return 150; }
5217
5218 float _GetAutoCreateMultilineHeight() override { return 170; }
5219
5220 /* For internal use only! */
5221 void _InitNonWindowHandleStates() override;
5222
5223 /* For internal use only */
5224 void _StoreNonWindowHandleStates() override;
5225#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
5226
5227#ifndef DOXYGEN_SHOULD_IGNORE_THIS
5236 void _BuildTree();
5237
5242 void _MarkSelectedNode(FCTreeNode* pNode);
5243#endif
5244
5265 FCTreeNode* AddNode(FCTreeNode *pParentNode, bool isContainer, FCString* pText);
5266
5281 FCTreeNode* InsertNodeAt(FCTreeNode *pParentNode, FCString* pText, int index);
5282
5288 bool DeleteNode(FCTreeNode *pNode);
5289
5300 bool SwapNodes(FCTreeNode* pNode1, FCTreeNode* pNode2);
5301
5306 void ExpandNode(FCTreeNode *pNode);
5307
5314 void CollapseNode(FCTreeNode *pNode);
5315
5327 bool IsNodeAttached(FCTreeNode *pNode2Find, FCTreeNode *pBaseNode);
5328
5330 FCTreeNode* FindUserDataNode(void* userdata, FCTreeNode *pBaseNode);
5331
5338 FCTreeNode* GetSelectedNode();
5339
5348 int CalcRootIndex(FCTreeNode* pNode);
5349
5360 int CalcNodeIndex(FCTreeNode* pNode, FCTreeNode* pParentNode);
5361
5367 void SetFontSize(int size)
5368 {
5369#if OPERATING_SYSTEM == MAC_OS
5370 _fontsize = size;
5371#endif
5372 }
5373
5383 bool SetSelectedNode(FCTreeNode* pNode);
5384
5389 void Clear();
5390
5395 void ExpandAllContainers();
5396
5401 void CollapseAllContainers();
5402
5409 int GetRootCount() { return _pRootNode->GetCount(); }
5410
5420 {
5421 return (FCTreeNode*) _pRootNode->GetItemAt(index);
5422 }
5423
5424#ifndef DOXYGEN_SHOULD_IGNORE_THIS
5426 FCTreeNode* _GetRootNode()
5427 {
5428 return _pRootNode;
5429 }
5430#endif
5431
5441 {
5442 return _pRootNode->GetIndexOf(pNode);
5443 }
5444
5446 void Repaint() override;
5447
5448#ifndef DOXYGEN_SHOULD_IGNORE_THIS
5449 const char* _WinGetUIClassName() const override { return "SysTreeView32"; }
5450 const char* _MacGetUIClassName() const override { return "NSOutlineView"; }
5451#endif
5452};
5453
5468{
5469 __FCCollection _pagecontrolids; /* Collection of FCNumbers objects.
5470 The number of collections should be identical
5471 to the number of pages. */
5472
5473 struct __FCCtrlSwitcher_NONWINDOWSTORAGE
5474 {
5475 _NONWINDOW_PROPERTY<int> selectedindex;
5476 _NONWINDOW_PROPERTY_FCSTRINGS items;
5477 } switcher_nonwindow_store;
5478
5479#ifndef DOXYGEN_SHOULD_IGNORE_THIS
5480 double _GetAutoCreateWidth() override { return 200; }
5481
5482 /* For internal use only! */
5483 void _InitNonWindowHandleStates() override;
5484
5485 /* For internal use only */
5486 void _StoreNonWindowHandleStates() override;
5487#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
5488
5489 bool _FindControlIDReference(int theid);
5490public:
5492 FCCtrlSwitcher(twobyte id) : FCControl(id, this) {}
5493
5494 const char* ClassName() const override { return "FCCtrlSwitcher"; }
5495
5496#ifndef DOXYGEN_SHOULD_IGNORE_THIS
5497 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_SWITCHER; }
5498#endif
5499
5506 void AddPage(FCString* pString);
5507
5519 bool AttachControl(FCControl* pControl, int pageindex);
5520
5525 void HandleVisibleStates(int index);
5526
5531 int GetPageCount();
5532
5538 int GetSelectedPage();
5539
5546 void SetSelectedPage(int index);
5547
5548#ifndef DOXYGEN_SHOULD_IGNORE_THIS
5549 const char* _WinGetUIClassName() const override { return "SysTabControl32"; }
5550 const char* _MacGetUIClassName() const override { return "NSSegmentedControl"; }
5551#endif
5552};
5553
5554//---------------------------------------------------------------------------
5555
5557
5565{
5566 struct __FCCtrlRadioButton_NONWINDOWSTORAGE
5567 {
5568 _NONWINDOW_PROPERTY<bool> checkstate;
5569 } radiobutton_nonwindow_store;
5570
5571 FCCtrlRadioButtonGroup* _pButtonGroup;
5572 int _buttonindex; // -1 means this control is not part of a FCCtrlRadioButtonGroup.
5573
5575 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_RADIOBUTTON; }
5576
5577 double _GetAutoCreateWidth() override { return 100; }
5578
5579#if OPERATING_SYSTEM == WINDOWS
5580 double _CalcNonTextWidth() const override
5581 { return _CalcNonTextWidthFromTheme(BP_RADIOBUTTON, RBS_UNCHECKEDNORMAL, 3.0, 16.0); }
5582#endif // OPERATING_SYSTEM == WINDOWS
5583
5584 /* For internal use only! */
5585 void _InitNonWindowHandleStates() override;
5586
5587 /* For internal use only */
5588 void _StoreNonWindowHandleStates() override;
5589public:
5590
5597 FCCtrlRadioButton(twobyte id, FCCtrlRadioButtonGroup* pButtonGroup, int buttonIndex)
5598 : FCControl(id, this), _pButtonGroup(pButtonGroup), _buttonindex(buttonIndex)
5599 {
5600 assert(!pButtonGroup || buttonIndex >= 0);
5601 }
5602
5608 : FCControl(id, this), _pButtonGroup(nullptr), _buttonindex(-1)
5609 {}
5610
5611 const char* ClassName() const override { return "FCCtrlRadioButton"; }
5612
5613#ifndef DOXYGEN_SHOULD_IGNORE_THIS
5615 int _GetButtonIndex() const { return _buttonindex; }
5616#endif // DOXYGEN_SHOULD_IGNORE_THIS
5617
5625 void SetCheck(bool checked);
5626
5631 bool GetCheck();
5632
5639 FCCtrlRadioButtonGroup * GetRadioButtonGroup() const { return _pButtonGroup; }
5640
5641#ifndef DOXYGEN_SHOULD_IGNORE_THIS
5642 const char* _WinGetUIClassName() const override { return "Button"; }
5643 const char* _MacGetUIClassName() const override { return "NSButton"; }
5644#endif
5645};
5646
5662{
5663 __FCCollection _buttons; // can't inherit __FCCollection due to LuaBridge issues with keeping it private.
5664 int _groupid;
5665
5666public:
5668 FCCtrlRadioButtonGroup(int groupID) : __FCBase(), _buttons(), _groupid(groupID) {}
5669
5671 {
5672 // The dialog box owns the buttons, so it will delete them. We just have copies.
5673 _buttons.DetachAll();
5674 }
5675
5676 const char* ClassName() const override { return "FCCtrlRadioButtonGroup"; }
5677
5684 int GetGroupID() const { return _groupid; }
5685
5692 int GetCount() const { return _buttons.GetCount(); }
5693
5698 void Add(FCCtrlRadioButton* button) { _buttons.Add(button); }
5699
5704 FCCtrlRadioButton* GetItemAt(int index) const { return (FCCtrlRadioButton*) _buttons.GetItemAt(index); }
5705
5712 void SetText(FCStrings* pStrings);
5713
5718 void SetWidth(float width)
5719 {
5720 for (int index = 0; index < GetCount(); index++)
5721 GetItemAt(index)->SetWidth(width);
5722
5723 }
5724
5732 {
5733 for (int index = 0; index < GetCount(); index++)
5734 {
5735 FCCtrlRadioButton* pButton = GetItemAt(index);
5736 if (pButton->GetCheck()) return pButton;
5737 }
5738 return nullptr;
5739 }
5740
5748 {
5749 for (int index = 0; index < GetCount(); index++)
5750 if (GetItemAt(index)->GetCheck()) return index;
5751 return -1;
5752 }
5753
5760 void SetSelectedItem(int index)
5761 {
5762 if (index < 0 || index >= GetCount()) return;
5763 for (int next = 0; next < GetCount(); next++)
5764 GetItemAt(next)->SetCheck(next == index);
5765 }
5766
5776 void MoveAllRelative(float horizoffset, float vertoffset)
5777 {
5778 for (int index = 0; index < GetCount(); index++)
5779 GetItemAt(index)->MoveRelative(horizoffset, vertoffset);
5780 }
5781};
5782
5790{
5791 struct __FCCtrlCheckbox_NONWINDOWSTORAGE
5792 {
5793 _NONWINDOW_PROPERTY<int> checkstate;
5794 _NONWINDOW_PROPERTY<bool> threestate;
5795 } checkbox_nonwindow_store;
5796
5798 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_CHECKBOX; }
5799
5800 double _GetAutoCreateWidth() override { return 100; }
5801
5802#if OPERATING_SYSTEM == WINDOWS
5803 double _CalcNonTextWidth() const override
5804 { return _CalcNonTextWidthFromTheme(BP_CHECKBOX, CBS_UNCHECKEDNORMAL, 3.0, 16.0); }
5805#endif // OPERATING_SYSTEM == WINDOWS
5806
5807 /* For internal use only! */
5808 void _InitNonWindowHandleStates() override;
5809
5810 /* For internal use only */
5811 void _StoreNonWindowHandleStates() override;
5812public:
5814 FCCtrlCheckbox(twobyte id) : FCControl(id, this) {}
5815
5816#ifndef DOXYGEN_SHOULD_IGNORE_THIS
5818 FCCtrlCheckbox(twobyte id, const __FCControlTypedPtr &subclassPtr) : FCControl(id, subclassPtr) {}
5819#endif
5820
5821 const char* ClassName() const override { return "FCCtrlCheckbox"; }
5822
5831 virtual void SetCheck(twobyte checked);
5832
5839 virtual twobyte GetCheck();
5840
5853 void SetThreeStatesMode(bool allow3states)
5854 {
5855 checkbox_nonwindow_store.threestate.value = allow3states;
5856 }
5857
5863 {
5864 return checkbox_nonwindow_store.threestate.value;
5865 }
5866
5867#ifndef DOXYGEN_SHOULD_IGNORE_THIS
5868 const char* _WinGetUIClassName() const override { return "Button"; }
5869 const char* _MacGetUIClassName() const override { return "NSButton"; }
5870#endif
5871};
5872
5882{
5883 WINCODE(HFONT _storednewfont{};)
5884
5886 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_BUTTON; }
5887
5888 double _GetAutoCreateWidth() override { return 60; }
5889
5890#if OPERATING_SYSTEM == MAC_OS
5891 double _originalheight{};
5892#endif
5893
5894#if OPERATING_SYSTEM == WINDOWS
5895 double _CalcNonTextWidth() const override { return 24.0; }
5896#endif // OPERATING_SYSTEM == WINDOWS
5897
5898public:
5900 FCCtrlButton(twobyte id) : FCCtrlCheckbox(id, this) {}
5901
5902 /* Destructor */
5903 virtual ~FCCtrlButton();
5904
5905 const char* ClassName() const override { return "FCCtrlButton"; }
5906
5908 void ClearShortcutKey();
5909
5918 void SetFontSize(int fontsize);
5919
5920#ifndef DOXYGEN_SHOULD_IGNORE_THIS
5921#if OPERATING_SYSTEM == MAC_OS
5923 double _GetOriginalHeight() const { return _originalheight; }
5925 void _SetOriginalHeight(double value) { _originalheight = value; }
5926#endif
5927#endif
5928
5929#ifndef DOXYGEN_SHOULD_IGNORE_THIS
5930 const char* _WinGetUIClassName() const override { return "Button"; }
5931 const char* _MacGetUIClassName() const override { return "NSButton"; }
5932#endif
5933};
5934
5935
5945{
5947 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_SLIDER; }
5948
5949 double _GetAutoCreateWidth() override { return 150; }
5950
5951 struct __FCCtrlSlider_NONWINDOWSTORAGE
5952 {
5953 _NONWINDOW_PROPERTY<int> minvalue;
5954 _NONWINDOW_PROPERTY<int> maxvalue;
5955 _NONWINDOW_PROPERTY<int> thumbpos;
5956 } slider_nonwindow_store;
5957
5958#if OPERATING_SYSTEM == WINDOWS
5959 bool trackingStarted;
5960#endif
5961
5962 /* For internal use only! */
5963 void _InitNonWindowHandleStates() override;
5964
5965 /* For internal use only */
5966 void _StoreNonWindowHandleStates() override;
5967public:
5969 FCCtrlSlider(twobyte id) : FCControl(id, this)
5970 {
5971#if OPERATING_SYSTEM == WINDOWS
5972 trackingStarted = false;
5973#endif
5974 }
5975
5976 const char* ClassName() const override { return "FCCtrlSlider"; }
5977
5978#ifndef DOXYGEN_SHOULD_IGNORE_THIS
5979#if OPERATING_SYSTEM == WINDOWS
5981 bool _GetTrackingStartedWin() const { return trackingStarted; }
5983 void _SetTrackingStartedWin(bool state) { trackingStarted = state; }
5984#endif // OPERATING_SYSTEM == WINDOWS
5985#endif // DOXYGEN_SHOULD_IGNORE_THIS
5986
5991 int GetMinValue();
5992
5997 void SetMinValue(int min);
5998
6003 int GetMaxValue();
6004
6009 void SetMaxValue(int max);
6010
6015 void SetThumbPosition(int position);
6016
6023 int GetThumbPosition();
6024
6025#ifndef DOXYGEN_SHOULD_IGNORE_THIS
6026 const char* _WinGetUIClassName() const override { return "msctls_trackbar32"; }
6027 const char* _MacGetUIClassName() const override { return "NSSlider"; }
6028#endif
6029};
6030
6031#ifdef PDK_FRAMEWORK_IMAGECTRL
6056{
6057#ifndef DOXYGEN_SHOULD_IGNORE_THIS
6058#if OPERATING_SYSTEM == WINDOWS
6059 HBITMAP _image;
6060#endif
6061#if OPERATING_SYSTEM == MAC_OS
6062 void * _image; //NSImage in Objective-C
6063#endif
6064
6065 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_IMAGE; }
6066
6067 double _GetAutoCreateWidth() override { return 100; }
6068
6069 void _ReleaseImage()
6070 {
6071#if OPERATING_SYSTEM == WINDOWS
6072 DeleteObject(_image);
6073#else
6074 _cocoalink_ReleaseImage(_image);
6075#endif
6076 _image = 0;
6077 }
6078
6079#ifndef DOXYGEN_SHOULD_IGNORE_THIS
6080public:
6082 enum IMAGESOURCE
6083 {
6084 FCCTRLIMAGE_FILEPATH,
6085 FCCTRLIMAGE_BITMAP
6086 };
6087#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
6088
6089private:
6091 void _AttachAssignedImageToControl();
6092
6094 bool _SetImage(IMAGESOURCE source, const char *data, long dataLength, bool preserveControlSize);
6095
6096protected:
6097 void _InitNonWindowHandleStates() override
6098 {
6099 FCControl::_InitNonWindowHandleStates();
6100 // this must come after FCControl::_InitNonWindowHandleStates() so that GetTop, GetWidth, GetHeight work correctly.
6101 _AttachAssignedImageToControl();
6102 }
6103
6104#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
6105public:
6106 const char* ClassName() const override { return "FCCtrlImage"; }
6107
6109 FCCtrlImage(twobyte id) : FCControl(id, this), _image(0) {}
6110 ~FCCtrlImage() { _ReleaseImage(); }
6111
6112#ifndef DOXYGEN_SHOULD_IGNORE_THIS
6113#if OPERATING_SYSTEM == WINDOWS
6114#ifdef PDK_FRAMEWORK_DPIAWARE
6116 void _OnDpiChanged() override;
6117#endif // PDK_FRAMEWORK_DPIAWARE
6118#endif // OPERATING_SYSTEM == WINDOWS
6119#endif // DOXYGEN_SHOULD_IGNORE_THIS
6120
6140 bool SetImageFromFilePath(const char *path, bool preserveControlSize = false)
6141 { return _SetImage(FCCTRLIMAGE_FILEPATH, path, 0, preserveControlSize); }
6142
6157 bool SetImageFromBuffer(const onebyte *data, long dataLength, bool preserveControlSize = false)
6158 { return _SetImage(FCCTRLIMAGE_BITMAP, data, dataLength, preserveControlSize); }
6159
6160#ifndef DOXYGEN_SHOULD_IGNORE_THIS
6161 const char* _WinGetUIClassName() const override { return "Static"; }
6162 const char* _MacGetUIClassName() const override { return "NSImageView"; }
6163#endif
6164};
6165#endif // PDK_FRAMEWORK_IMAGECTRL
6166
6167#ifdef PDK_FRAMEWORK_CANVASCTRL
6174class FCCtrlCanvas : public FCControl
6175{
6176 struct __FCCtrlSlider_NONWINDOWSTORAGE
6177 {
6178 _NONWINDOW_PROPERTY<void*> instructions;
6179 } canvas_nonwindow_store;
6180
6182 _CONTROL_TYPE _GetControlType() override { return CONTROLTYPE_CANVAS; }
6183
6184 double _GetAutoCreateWidth() override { return 80; }
6185
6186 float _GetAutoCreateMultilineHeight() override { return 80; }
6187
6188 /* For internal use only! */
6189 void _InitNonWindowHandleStates() override;
6190
6191 /* For internal use only */
6192 void _StoreNonWindowHandleStates() override;
6193public:
6195 FCCtrlCanvas(twobyte id) : FCControl(id, this) {}
6196
6199 void RebuildInstructions(FCVirtualCanvasInstructions* pInstructions);
6200
6201#ifndef DOXYGEN_SHOULD_IGNORE_THIS
6202 const char* _WinGetUIClassName() const override { return "Static"; }
6203 const char* _MacGetUIClassName() const override { return "NSFCCtrlCanvas"; }
6204#endif
6205
6206};
6207#endif /* #ifdef PDK_FRAMEWORK_CANVASCTRL */
6208
6215 int _resourceid;
6216#if OPERATING_SYSTEM == WINDOWS
6217 FF_DialogHandlerUPP _handler;
6218#endif
6219 __FCUserWindow* _pParent;
6220
6221public:
6222
6229 EXECMODAL_CLOSE = 0,
6230
6232 EXECMODAL_OK = 1,
6233
6235 EXECMODAL_CANCEL = 2
6237
6243 FCResourceWindow(int resid);
6244
6246 virtual ~FCResourceWindow();
6247
6248 const char* ClassName() const override { return "FCResourceWindow"; }
6249
6251 void DestroyWindow();
6252
6254 void InitWindow() override;
6255
6259 void CloseWindow() override;
6260
6262 __FCUserWindow* GetParent() { return _pParent; }
6263
6265 void ShowModeless(EWND WINCODE(hParent));
6266
6271 void ShowModeless(__FCUserWindow* pParent);
6272
6278#ifndef PDK_FRAMEWORK_LUAFRIENDLY
6279 EXECMODAL_RETURNS
6280#else
6281 twobyte
6282#endif
6283 ExecuteModal_EWND(EWND hParent);
6284
6299#ifndef PDK_FRAMEWORK_LUAFRIENDLY
6300 EXECMODAL_RETURNS
6301#else
6302 virtual twobyte
6303#endif
6304 ExecuteModal(__FCUserWindow *pParent = nullptr);
6305
6306#ifdef PDK_FRAMEWORK_LUAFRIENDLY
6307#ifndef DOXYGEN_SHOULD_IGNORE_THIS
6308 int ExecuteModal_CFunc(lua_State *L);
6309#endif // DOXYGEN_SHOULD_IGNORE_THIS
6310#endif // PDK_FRAMEWORK_LUAFRIENDLY
6311
6312#if OPERATING_SYSTEM == WINDOWS
6314 virtual bool HandleWMNotify(WPARAM wparam, LPARAM lparam);
6315#endif
6316
6317
6319 void _SetupInternalWindowCode();
6320
6321#ifdef PDK_FRAMEWORK_DPIAWARE
6338 {
6339 return WINCODE(_wants_dpi_awareness) MACCODE(false);
6340 }
6341
6363 void SetWantsDpiAwareness(bool WINCODE(state))
6364 {
6365#if OPERATING_SYSTEM == WINDOWS
6366 if (!WindowExists()) _wants_dpi_awareness = state;
6367#endif // OPERATING_SYSTEM == WINDOWS
6368 }
6369#endif // PDK_FRAMEWORK_DPIAWARE
6370
6373 {
6374 Add(pControl); // Add must be before SetParent (for the Mac)
6375 pControl->SetParent(this);
6376 return pControl;
6377 }
6378
6380 FCCtrlLine* AddLine(twobyte id) {
6381 return (FCCtrlLine*) AddCtrl(new FCCtrlLine(id));
6382 }
6383
6386 {
6387 return (FCCtrlStatic*) AddCtrl(new FCCtrlStatic(id));
6388 }
6389
6390#ifdef PDK_FRAMEWORK_IMAGECTRL
6393 {
6394 return (FCCtrlImage*) AddCtrl(new FCCtrlImage(id));
6395 }
6396#endif
6397
6400 {
6401 return (FCCtrlComboBox*) AddCtrl(new FCCtrlComboBox(id));
6402 }
6403
6405 FCCtrlEdit* AddEdit(twobyte id) {
6406 return (FCCtrlEdit*) AddCtrl(new FCCtrlEdit(id));
6407 }
6408
6411 return (FCCtrlTextEditor*) AddCtrl(new FCCtrlTextEditor(id));
6412 }
6413
6415 FCCtrlPopup* AddPopup(twobyte id) {
6416 return (FCCtrlPopup*) AddCtrl(new FCCtrlPopup(id));
6417 }
6418
6421 return (FCCtrlListBox*) AddCtrl(new FCCtrlListBox(id));
6422 }
6423
6426 return (FCCtrlButton*) AddCtrl(new FCCtrlButton(id));
6427 }
6428
6431 return (FCCtrlSlider*)AddCtrl(new FCCtrlSlider(id));
6432 }
6433
6436 return (FCCtrlRadioButton*) AddCtrl(new FCCtrlRadioButton(id));
6437 }
6438
6441 return (FCCtrlCheckbox*) AddCtrl(new FCCtrlCheckbox(id));
6442 }
6443
6446 return (FCCtrlUpDown*) AddCtrl(new FCCtrlUpDown(id));
6447 }
6448
6451 {
6452 return (FCCtrlDataList*) AddCtrl(new FCCtrlDataList(id));
6453 }
6454
6456 FCCtrlTree* AddTree(twobyte id)
6457 {
6458 return (FCCtrlTree*) AddCtrl(new FCCtrlTree(id));
6459 }
6460};
6461
6462#ifndef DOXYGEN_SHOULD_IGNORE_THIS
6463#define __IDRESOURCE_CUSTOMWINDOW 5001
6464#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
6465
6466
6490{
6491 bool _okbuttoncanclose;
6492 bool _okbuttoninprogress;
6493
6494 std::vector<FCCtrlRadioButtonGroup*> _radioButtonGroups;
6495
6496#ifndef DOXYGEN_SHOULD_IGNORE_THIS
6497 bool CanClose() override { return (_okbuttoncanclose || !_okbuttoninprogress) && FCResourceWindow::CanClose(); }
6498#endif
6499
6504 FCControl* _AddCreatedCtrl_NoPos(FCControl* pControl)
6505 {
6506 if (!pControl) return pControl;
6507 Add(pControl); // Add must be before SetParent (for the Mac)
6508 pControl->_SetPointsMeasurement(true);
6509 pControl->SetParent(this);
6510 pControl->_SetProgrammaticallyCreate(true);
6511 return pControl;
6512 }
6513
6514
6519 void _MoveAllControls(int horizoffset, int vertoffset);
6520
6525 void _CalcControlsExtent(float *pLeftMin, float* pTopMin, float* pRightMax, float* pBottomMax);
6526
6531 void _InitNonWindowHandleStates() override;
6532public:
6537 FCCustomWindow() : FCResourceWindow(__IDRESOURCE_CUSTOMWINDOW), _okbuttoncanclose(true), _okbuttoninprogress(false)
6538 {
6539 _SetPointsMeasurement(true);
6540 }
6542 {
6543 for (FCCtrlRadioButtonGroup * group : _radioButtonGroups)
6544 delete group;
6545 _radioButtonGroups.clear();
6546 }
6547
6548 const char* ClassName() const override { return "FCCustomWindow"; }
6549
6556 {
6557 int tryid = 10001;
6558 for (int i = 0; i < GetCount(); i++)
6559 {
6560 FCControl* pControl = GetItemAt(i);
6561 int testid = pControl->GetControlID();
6562 if ((testid >= tryid) && (testid < 20000))
6563 {
6564 tryid = testid + 1;
6565 }
6566 }
6567 return tryid;
6568 }
6569
6571 FCControl* _AddCreatedCtrl(FCControl* pControl, float x, float y)
6572 {
6573 if (!pControl) return pControl;
6574 Add(pControl); // Add must be before SetParent (for the Mac)
6575 pControl->_SetPointsMeasurement(true);
6576 pControl->SetParent(this);
6577 pControl->_SetProgrammaticallyCreate(true);
6578 pControl->SetLeft(x);
6579 pControl->SetTop(y);
6580 return pControl;
6581 }
6582
6594 void SetOkButtonCanClose(bool value) {_okbuttoncanclose = value;}
6595
6600 bool GetOkButtonCanClose() const {return _okbuttoncanclose;}
6601
6604 void OkButtonPressed() override
6605 {
6606 _okbuttoninprogress = true;
6608 _okbuttoninprogress = false;
6609 }
6610
6621 FCCtrlStatic* CreateStatic(float x, float y) { return (FCCtrlStatic*) _AddCreatedCtrl(new FCCtrlStatic(_CalcAvailableCtrlID()), x, y); }
6622
6623#ifdef PDK_FRAMEWORK_IMAGECTRL
6634 FCCtrlImage* CreateImage(float x, float y)
6635 {
6636#ifdef PDK_FRAMEWORK_DPIAWARE
6637 SetWantsDpiAwareness(true);
6638#endif
6639 return (FCCtrlImage*) _AddCreatedCtrl(new FCCtrlImage(_CalcAvailableCtrlID()), x, y);
6640 }
6641#endif
6642
6653 FCCtrlEdit* CreateEdit(float x, float y) { return (FCCtrlEdit*) _AddCreatedCtrl(new FCCtrlEdit(_CalcAvailableCtrlID()), x, y); }
6654
6665 FCCtrlTextEditor* CreateTextEditor(float x, float y) { return (FCCtrlTextEditor*) _AddCreatedCtrl(new FCCtrlTextEditor(_CalcAvailableCtrlID()), x, y); }
6666
6677 FCCtrlComboBox* CreateComboBox(float x, float y) { return (FCCtrlComboBox*) _AddCreatedCtrl(new FCCtrlComboBox(_CalcAvailableCtrlID()), x, y); }
6678
6689 FCCtrlButton* CreateButton(float x, float y) { return (FCCtrlButton*) _AddCreatedCtrl(new FCCtrlButton(_CalcAvailableCtrlID()), x, y); }
6690
6701 FCCtrlCheckbox* CreateCheckbox(float x, float y) { return (FCCtrlCheckbox*) _AddCreatedCtrl(new FCCtrlCheckbox(_CalcAvailableCtrlID()), x, y); }
6702
6703
6712 FCCtrlRadioButton* CreateRadioButton(float x, float y) { return (FCCtrlRadioButton*)_AddCreatedCtrl(new FCCtrlRadioButton(_CalcAvailableCtrlID()), x, y); }
6713
6714
6725 {
6726 if (FindControl(1)) return NULL;
6727 FCCtrlButton* pOkButton = (FCCtrlButton*) _AddCreatedCtrl_NoPos(new FCCtrlButton(1));
6728 pOkButton->SetAction(FCControl::ACTION_OK);
6729 FCString oktext("OK");
6730 pOkButton->SetText(&oktext);
6731 return pOkButton;
6732 }
6733
6744 {
6745 if (FindControl(2)) return NULL;
6746 FCCtrlButton* pCancelButton = (FCCtrlButton*) _AddCreatedCtrl_NoPos(new FCCtrlButton(2));
6747 pCancelButton->SetAction(FCControl::ACTION_CANCEL);
6748 FCString canceltext("Cancel");
6749 pCancelButton->SetText(&canceltext);
6750 return pCancelButton;
6751 }
6752
6764 {
6765 FCCtrlButton* pCloseButton = (FCCtrlButton*) _AddCreatedCtrl(new FCCtrlButton(_CalcAvailableCtrlID()), x, y);
6766 pCloseButton->SetAction(FCControl::ACTION_CLOSE);
6767 FCString closetext("Close");
6768 pCloseButton->SetText(&closetext);
6769 return pCloseButton;
6770 }
6771
6782 FCCtrlPopup* CreatePopup(float x, float y) { return (FCCtrlPopup*) _AddCreatedCtrl(new FCCtrlPopup(_CalcAvailableCtrlID()), x, y); }
6783
6796 FCCtrlHorizontalLine* CreateHorizontalLine(float x, float y, float width)
6797 {
6798 FCCtrlHorizontalLine* pLine = (FCCtrlHorizontalLine*) _AddCreatedCtrl(new FCCtrlHorizontalLine(_CalcAvailableCtrlID()), x, y);
6799 pLine->SetWidth(width);
6800 return pLine;
6801 }
6802
6815 FCCtrlVerticalLine* CreateVerticalLine(float x, float y, float height)
6816 {
6817 FCCtrlVerticalLine* pLine = (FCCtrlVerticalLine*) _AddCreatedCtrl(new FCCtrlVerticalLine(_CalcAvailableCtrlID()), x, y);
6818 pLine->SetHeight(height);
6819 return pLine;
6820 }
6821
6832 FCCtrlSlider* CreateSlider(float x, float y) { return (FCCtrlSlider*) _AddCreatedCtrl(new FCCtrlSlider(_CalcAvailableCtrlID()), x, y); }
6833
6844 FCCtrlListBox* CreateListBox(float x, float y) { return (FCCtrlListBox*) _AddCreatedCtrl(new FCCtrlListBox(_CalcAvailableCtrlID()), x, y); }
6845
6856 FCCtrlUpDown* CreateUpDown(float x, float y) { return (FCCtrlUpDown*) _AddCreatedCtrl(new FCCtrlUpDown(_CalcAvailableCtrlID()), x, y); }
6857
6868 FCCtrlRadioButtonGroup* CreateRadioButtonGroup(float x, float y, int no_of_items)
6869 {
6870 if (no_of_items < 1) return NULL;
6871 if (no_of_items > 20) return NULL;
6872 const size_t index = _radioButtonGroups.size();
6873 _radioButtonGroups.emplace_back(new FCCtrlRadioButtonGroup(static_cast<int>(index)+1)); //group ids start with 1
6874 static const float kYSeparation = 16; // This default is empirically determined to be about the same on Win and macOS.
6875 for (int next = 0; next < no_of_items; next++)
6876 {
6877 FCCtrlRadioButton* button = new FCCtrlRadioButton(_CalcAvailableCtrlID(), _radioButtonGroups[index], next);
6878 _AddCreatedCtrl(button, x, y + next*kYSeparation);
6879 _radioButtonGroups[index]->Add(button);
6880 }
6881 if (_radioButtonGroups[index]->GetCount() > 0)
6882 _radioButtonGroups[index]->SetSelectedItem(0);
6883 return _radioButtonGroups[index];
6884 }
6885
6896 FCCtrlTree* CreateTree(float x, float y) { return (FCCtrlTree*) _AddCreatedCtrl(new FCCtrlTree(_CalcAvailableCtrlID()), x, y); }
6897
6908 FCCtrlSwitcher* CreateSwitcher(float x, float y) { return (FCCtrlSwitcher*) _AddCreatedCtrl(new FCCtrlSwitcher(_CalcAvailableCtrlID()), x, y); }
6909
6910#ifdef PDK_FRAMEWORK_CANVASCTRL
6911 FCCtrlCanvas* CreateCanvas(float x, float y) { return (FCCtrlCanvas*) _AddCreatedCtrl(new FCCtrlCanvas(_CalcAvailableCtrlID()), x, y); }
6912#endif
6913
6924 FCCtrlDataList* CreateDataList(float x, float y) { return (FCCtrlDataList*) _AddCreatedCtrl(new FCCtrlDataList(_CalcAvailableCtrlID()), x, y); }
6925
6956 void MoveAllControls(int horizoffset, int vertoffset)
6957 { _MoveAllControls(horizoffset, vertoffset); }
6958
6959};
6960
6961#endif /* #ifdef PDK_FRAMEWORK_DIALOGS */
6962
6963#endif /* FF_DIALOGS_H */
6964
Base class for the Finale Framework classes.
Definition ff_base.h:71
MEASUREMENTUNITS
Constants for Finale's standard measurement units.
Definition ff_base.h:243
Base class for all collection classes. A collection is a storage that can store multiple objects of s...
Definition ff_basecollection.h:26
int GetIndexOf(__FCBase *pObject) const
Returns the 0-based order index for the object within the collection.
Definition finaleframework.cpp:13775
void Add(__FCBase *pNewItem)
Adds an element to the end of the collection.
Definition finaleframework.cpp:13726
void DetachAll()
Removes all the objects from the collection, without freeing/destroying the objects.
Definition ff_basecollection.h:162
int GetCount() const
Returns the number of elements of the collection.
Definition ff_basecollection.h:102
__FCBase * GetItemAt(int index) const
Returns the object at the index position. Index is 0-based.
Definition finaleframework.cpp:13767
Base class that contains the basic functionality for the operating system's modal dialog boxes for se...
Definition ff_dialogs.h:54
void AddFilter(FCString *pFilter, FCString *pFilterDescription)
Adds a file filter with description. Multiple filters can be added.
Definition ff_dialogs.h:86
void GetWindowTitle(FCString *pString)
Copies the initialized window title to a FCString object.
Definition ff_dialogs.h:156
void GetFileName(FCString *pString)
Copies the file name to a FCString object.
Definition ff_dialogs.h:167
bool AssureFileExtension(const char *pszSuffix)
Makes sure that a file extension exists for the file name. If one is missing, the suffix is added.
Definition ff_dialogs.h:191
virtual bool Execute()=0
Virtual method that's overridden in all child methods. Executes the dialog box.
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:72
void SetDefaultFilter(int index)
Sets the 0-based default filter.
Definition ff_dialogs.h:109
FCStrings * _GetFilters()
For internal use only!
Definition ff_dialogs.h:101
void SetWindowTitle(FCString *pString)
Sets the caption of the window title.
Definition ff_dialogs.h:120
void SetInitFolder(FCString *pString)
Sets the initial starting folder for the dialog box.
Definition ff_dialogs.h:146
__FCFileDialogBase(FCUI *pUI)
The constructor.
Definition ff_dialogs.h:67
void GetInitFolder(FCString *pString)
Copies the init folder to a FCString object.
Definition ff_dialogs.h:177
void SetFileName(FCString *pString)
Sets the initial file name string. The string contains the full path to the file name.
Definition ff_dialogs.h:130
Base class for all other dialog/window classes.
Definition ff_dialogs.h:563
virtual void HandleDataListSelect(FCCtrlDataList *pControl, int lineindex)
Virtual handler method for when FCCtrlDataList selection state changes. Overwrite to provide function...
Definition ff_dialogs.h:1221
virtual void TextSelectionChanged(FCControl *pControl)
Virtual method that is called when the selected text on a FCCtrlTextEditor control changes.
Definition ff_dialogs.h:1157
virtual bool HandleCommand(FCControl *pControl)
Virtual method that is called when a user command occurs, such as a button press.
Definition ff_dialogs.h:1151
bool IsModal()
Returns true if the dialog currently is running in a modal state.
Definition ff_dialogs.h:800
void SetPreventClosing(bool state)
Sets whether the window may be closed. Note that certain situations may still close the window even w...
Definition ff_dialogs.h:1324
float GetStoredHeight() const
Returns the stored height. -1 if no height has been stored.
Definition finaleframework.cpp:26463
virtual void HandleUpDownPressed(FCControl *pControl, int delta)
Virtual handler method for up/down arrow controls when they are clicked. Overwrite to provide functio...
Definition ff_dialogs.h:1212
float GetClientHeight()
Returns the current height of the window client area, excluding the title bar.
Definition finaleframework.cpp:26322
float GetMaximumResizeHeight()
Returns the maximum resize height for resizable dialogs/windows.
Definition ff_dialogs.h:1051
virtual void HandleResize(int newwidth, int newheight, int oldwidth, int oldheight)
Handler called when user resizes the window.
Definition ff_dialogs.h:1258
void SetWidth(float newwidth)
Changes the width of the window frame.
Definition finaleframework.cpp:26141
void SetClientWidth(float newwidth)
Changes the width of the window client area.
Definition finaleframework.cpp:26237
bool IsInBufferMode()
Returns true if buffered movement has been started with StartBufferControlMovement.
Definition ff_dialogs.h:1421
void Hide()
Hides the window.
Definition finaleframework.cpp:25966
bool GetPointsMeasurement()
Returns if the measurements and positioning is in points or in a system-native unit for this window.
Definition ff_dialogs.h:794
float GetWidth()
Returns the current width of the window frame.
Definition finaleframework.cpp:26174
bool IsWindowshade()
Returns true if the window is in window shade mode.
Definition ff_dialogs.h:1388
bool WindowExists() const
Returns true if the window exists in the user interface.
Definition finaleframework.cpp:25957
void GetTitle(FCString *pTitle)
Gets the caption (title) for the window.
Definition finaleframework.cpp:26382
float GetClientWidth()
Returns the current width of the window client area.
Definition finaleframework.cpp:26268
virtual void CloseButtonPressed()
Virtual method that is called when a control with a "Close" action is pressed by the user.
Definition ff_dialogs.h:1110
FCControl * FindControl(int controlid)
Finds a control based on the control's ID.
Definition finaleframework.cpp:26056
float GetMinimumResizeWidth()
Returns the minimum resize width for resizable dialogs/windows.
Definition ff_dialogs.h:1032
bool QueryLastCommandModifierKeys(FLAG_32 modifiers)
Returns if the user held down a specific set of modifier keys at the last "command" event,...
Definition ff_dialogs.h:959
virtual void HandleDataListCheck(FCCtrlDataList *pControl, int lineindex, bool checkstate)
Virtual handler method for when FCCtrlDataList check state changes (for data list controls with check...
Definition ff_dialogs.h:1232
virtual void HandleSwitcherSelect(FCCtrlSwitcher *pControl, int switchindex)
Virtual method that is called when a switcher control is clicked. Please note that switcher selection...
Definition finaleframework.cpp:26049
float GetMinimumResizeHeight()
Returns the minimum resize height for resizable dialogs/windows.
Definition ff_dialogs.h:1038
bool RestorePosition()
Restores the window's position and size (if the size is stored).
Definition finaleframework.cpp:26493
FCControl * GetItemAt(int index) const
Overloaded implementation of GetItemAt().
Definition ff_dialogs.h:872
virtual void OkButtonPressed()
Virtual handler method that is called when a control with a "OK" action is pressed by the user.
Definition ff_dialogs.h:1125
void StopTimer(twobyte timerID)
Destroys a previously created timer (created with SetTimer).
Definition finaleframework.cpp:26088
float GetStoredX() const
Returns the stored horizonal position, for use in the restore feature.
Definition finaleframework.cpp:26445
FCUI * CreateChildUI() const
Creates and returns an instance of FCUI with this window as the parent window. This is mainly for lau...
Definition ff_dialogs.h:775
virtual void CloseWindow()=0
Closes the window. Functionality is provided by the child classes.
float GetHeight()
Returns the current height of the window frame.
Definition finaleframework.cpp:26222
float GetStoredWidth() const
Returns the stored width. -1 if no width has been stored.
Definition finaleframework.cpp:26457
virtual void ScrollChanged(FCControl *pControl)
Virtual method that is called when the scroll changes on a control with a scrollbar.
Definition ff_dialogs.h:1168
bool IsDarkModeAppearance() const
Returns the current Dark Mode state of the window. (Currently macOS only.)
Definition finaleframework.cpp:26337
virtual bool CanClose()
Virtual method that decides if the window can close or not.
Definition ff_dialogs.h:1330
void SetHeight(float newheight)
Changes the height of the window frame.
Definition finaleframework.cpp:26189
void StartBufferControlMovement()
Marks a start of buffered movement for the controls in the dialog.
Definition finaleframework.cpp:26639
virtual bool HandleListEnterKey(FCControl *pControl)
Called every time there's an enter key hit inside a data list or list box.
Definition ff_dialogs.h:1246
void SetWindowAlpha(twobyte alphapercent)
Sets the transparency for the window.
Definition finaleframework.cpp:26607
__FCUserWindow()
The constuctor.
Definition ff_dialogs.h:717
virtual void OSMenuCommandExecuted(EMENUID menuCommand, int menuCommandType)
Called after a menu command on the main menu tree is executed. This function is also called when keyb...
Definition ff_dialogs.h:1099
bool EndBufferControlMovement()
Resizes/moves all buffered control movements made since the StartBufferControlMovement call.
Definition finaleframework.cpp:26650
void SetTitle(FCString *pTitle)
Sets the caption (title) for the window.
Definition finaleframework.cpp:26364
float GetMaximumResizeWidth()
Returns the maximum resize width for resizable dialogs/windows.
Definition ff_dialogs.h:1045
MENU_COMMAND_TYPES
Constants for menu command types.
Definition ff_dialogs.h:707
@ MENUCMDTYPE_ACCELERATOR
Definition ff_dialogs.h:712
@ MENUCMDTYPE_SELECTION
Definition ff_dialogs.h:709
virtual void HandleActivate(bool activated)
Virtual method that is called when the window is activated or deactivated. Overwrite in child classes...
Definition ff_dialogs.h:1252
twobyte GetModalResult()
Returns the value that will be returned for a modal dialog.
Definition ff_dialogs.h:662
virtual void CancelButtonPressed()
Virtual handler method that is called when a control with a "Cancel" action is pressed by the user.
Definition ff_dialogs.h:1140
void SetMaximumResizeHeight(int height)
Sets the maximum resize height for resizable dialogs/windows.
Definition ff_dialogs.h:1020
void SetMaximumResizeWidth(int width)
Sets the maximum resize width for resizable dialogs/windows.
Definition ff_dialogs.h:1006
bool GetPreventClosing() const
Returns whether the window may be closed.
Definition ff_dialogs.h:1317
void ShowAndActivate()
Makes the window visible and sets it focused.
Definition finaleframework.cpp:25976
void SetClientHeight(float newheight)
Changes the height of the window client area (excluding the title bar).
Definition finaleframework.cpp:26281
virtual void HandleListDoubleClick(FCControl *pControl)
Called every time there's a double-click inside a data list or list box.
Definition ff_dialogs.h:1238
bool TryToCloseWindow()
Tries to close the window. This method calls the CanClose() virtual method before calling CloseWindow...
Definition ff_dialogs.h:975
bool IsVisible()
Returns true if the window is visible.
Definition finaleframework.cpp:26039
float GetStoredY() const
Returns the stored vertical position, for use in the restore feature.
Definition finaleframework.cpp:26451
void Windowshade(bool windowshade)
Sets the window in a "windowshade" mode (where only the title bar is visible) - or restore the window...
Definition finaleframework.cpp:26550
virtual void DarkModeIsChanging(bool isDarkMode)
Called whenever Dark Mode changes. (Currently macOS only.)
Definition ff_dialogs.h:1089
void StorePosition(bool storesize)
Stores the window position for use with RestorePosition.
Definition finaleframework.cpp:26469
virtual void MouseTrackingStarted(FCControl *pControl)
Virtual method that is called when a mouse tracking starts. Currently only supported fo FCCtrlSlider.
Definition ff_dialogs.h:1264
virtual void WindowDestroyed()
Called once just when the window/dialog has been destroyed.
Definition ff_dialogs.h:1083
void SetRestorePositionData(float x, float y, float width, float height)
Sets the restore position and size.
Definition finaleframework.cpp:26423
void SetTimer(twobyte timerID, ufourbyte msInterval)
Creates a timer with the supplied ID and the timeout/refresh interval.
Definition finaleframework.cpp:26067
void Activate()
Activates the window and sets it in user focus.
Definition finaleframework.cpp:26411
virtual void HandleTimer(twobyte timerID)
Virtual handler method that is called on timer events. Overwrite in child classes.
Definition ff_dialogs.h:1249
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:760
virtual void MouseTrackingStopped(FCControl *pControl)
Virtual method that is called when a mouse tracking stops. Currently only supported fo FCCtrlSlider.
Definition ff_dialogs.h:1270
COMMAND_MOD_KEYS
Constants for the QueryLastCommandModifierKeys() method.
Definition ff_dialogs.h:685
@ CMDMODKEY_SHIFT
Definition ff_dialogs.h:687
@ CMDMODKEY_CTRL
Definition ff_dialogs.h:693
@ CMDMODKEY_FUNCTION
Definition ff_dialogs.h:699
@ CMDMODKEY_ALT
Definition ff_dialogs.h:690
@ CMDMODKEY_COMMAND
Definition ff_dialogs.h:696
void SetEnabled(bool state)
Sets the enabled state of the window.
Definition finaleframework.cpp:26104
virtual bool HandleKeyboardCommand(FCControl *pControl, eUniChar16 character)
Virtual method that notifies when a keyboard command has been requested with the Command key (macOS) ...
Definition ff_dialogs.h:1193
void SetRestorePositionOnlyData(float x, float y)
Sets the restore position, but with no size.
Definition finaleframework.cpp:26434
virtual void InitWindow()
Called once just when the window/dialog has been created.
Definition finaleframework.cpp:26005
Base class for all UI controls in a dialog.
Definition ff_dialogs.h:1536
float GetHeight()
Returns the height of the control.
Definition finaleframework.cpp:25403
virtual FCFontInfo * CreateFontInfo() const
Creates font information from the current text font of the control.
Definition finaleframework.cpp:25254
virtual bool GetEnable() const
Returns the enable/grayed state of the control (if user input should be allowed or not).
Definition finaleframework.cpp:24922
int GetControlID() const
Returns the control ID for the control.
Definition ff_dialogs.h:1873
virtual void SetVisible(bool bShow)
Sets the visibility of the control.
Definition finaleframework.cpp:25136
void SetTop(float pos)
Sets the top position of the control.
Definition finaleframework.cpp:25372
virtual ~FCControl()
Destructor.
Definition ff_dialogs.h:1681
float GetLeft()
Returns the left position of the control.
Definition finaleframework.cpp:25350
void AssureNoHorizontalOverlap(const FCControl &control, int padding)
Shift the control right as needed to the extent necessary so that its GetLeft position will accommoda...
Definition ff_dialogs.h:2028
CONTROL_ACTIONS GetAction() const
Returns the dialog acction assigned to the control.
Definition ff_dialogs.h:1889
float GetTop()
Returns the top position of the control.
Definition finaleframework.cpp:25382
int GetAssignedID() const
Gets the connected ID regardless of platform.
Definition ff_dialogs.h:1883
bool WindowExists() const
Returns true if a valid parent window handle (and control handle) is available.
Definition ff_dialogs.h:1816
void HorizontallyAlignLeftWith(const FCControl *pControl, double offset=0)
Specifies a control with which to horizontally align left. All controls set to align with this contro...
Definition ff_dialogs.h:2045
virtual void SetEnable(bool state)
Sets the enable/grayed state of the control (if user input should be allowed or not).
Definition finaleframework.cpp:24904
void SetAction(CONTROL_ACTIONS action)
Sets the dialog acction assigned to the control.
Definition ff_dialogs.h:1895
virtual void Repaint()
Force a visual update of the control.
Definition ff_dialogs.h:1854
virtual void GetText(FCString *pString) const
Gets the text of the control.
Definition finaleframework.cpp:25098
FCControl(twobyte id, const __FCControlTypedPtr &subclassPtr)
The constructor.
Definition ff_dialogs.h:1667
void HorizontallyAlignRightWith(const FCControl *pControl, double offset=0)
Specifies a control with which to horizontally align right. All controls set to align with this contr...
Definition ff_dialogs.h:2076
void HorizontallyAlignRightWithFurthest(double offset=0)
Specifies that this control should align with the control that extends furthest to the right....
Definition ff_dialogs.h:2105
__FCUserWindow * GetParent() const
Returns the parent window object for the control.
Definition ff_dialogs.h:1812
virtual void SetText(const FCString *pString)
Sets the text for the control.
Definition finaleframework.cpp:25053
bool GetPointsMeasurement()
Returns if the measurements and positioning is in points or in a system-native unit.
Definition ff_dialogs.h:1707
float GetWidth()
Returns the width of the control.
Definition finaleframework.cpp:25420
bool GetVisible()
Returns the visibility state of a control.
Definition finaleframework.cpp:25315
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:1637
void DoAutoResizeWidth(std::optional< double > minimumwidth=std::nullopt)
Sets the autoresize width option for the control. When this value is set, the control calls AssureWid...
Definition ff_dialogs.h:2132
CONTROL_ACTIONS
Predefined actions for controls.
Definition ff_dialogs.h:1554
void MoveAbsolute(float x, float y)
Moves the control in absolute coordinates.
Definition finaleframework.cpp:25525
void SetWidth(float width)
Sets the width of the control.
Definition finaleframework.cpp:25437
virtual void SetFont(const FCFontInfo *fontInfo)
Sets the font information for the text of the control.
Definition finaleframework.cpp:25209
void SetLeft(float pos)
Sets the left position of the control.
Definition finaleframework.cpp:25340
bool RedrawImmediate() const
Redraws the control immediately. Calling this allows your program that has blocked the main thread to...
Definition finaleframework.cpp:25603
virtual bool AssureWidthForText()
Lengthens the width of the control to the extent necessary to display all the text in the control.
Definition finaleframework.cpp:25031
virtual void SetBold(bool state)
Sets the boldface appearance for the control.
Definition finaleframework.cpp:25168
virtual void ResizeRelative(float horizresize, float vertresize)
Resizes the control relatively to the current size. Top left corner will stay fixed.
Definition finaleframework.cpp:25559
void StretchToAlignWithRight()
Sets a control to stretch its width to align with the furthest right control.
Definition ff_dialogs.h:2153
HWND _GetWinControlHandle() const
For internal use only. Returns the handle for the control.
Definition ff_dialogs.h:1843
void MoveRelative(float horizmove, float vertmove)
Moves the control relatively to the current position.
Definition finaleframework.cpp:25479
void SetHeight(float height)
Sets the height of the control.
Definition finaleframework.cpp:25459
void SetTextAndResize(FCString *pString)
Cocoa only: Sets the text and resizes the view inside a NSScrollView.
Definition finaleframework.cpp:24938
virtual void SetKeyboardFocus()
Sets the keyboard focus to the control.
Definition finaleframework.cpp:25328
FCControl(twobyte id)
The constructor for external C++ subclasses.
Definition ff_dialogs.h:1676
Control class for push buttons. It inherits the FCCtrlCheckbox class, so the checked state can be set...
Definition ff_dialogs.h:5882
FCCtrlButton(twobyte id)
The constructor.
Definition ff_dialogs.h:5900
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:5905
Control class for a checkbox control.
Definition ff_dialogs.h:5790
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:5821
void SetThreeStatesMode(bool allow3states)
Enables the 3-states mode for a checkbox.
Definition ff_dialogs.h:5853
FCCtrlCheckbox(twobyte id)
The constructor.
Definition ff_dialogs.h:5814
bool GetThreeStatesMode() const
Returns the 3-states mode for the checkbox.
Definition ff_dialogs.h:5862
UI class that handles a combo box, which is a combination of a edit field and a popup list.
Definition ff_dialogs.h:3084
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:3106
FCCtrlComboBox(twobyte id)
The constructor.
Definition ff_dialogs.h:3109
void SetStrings(FCStrings *pStrings)
Sets a string collection to the popup part of the combo box.
Definition ff_dialogs.h:3133
Class that handles a contol with multiple lines of data, arranged in columns.
Definition ff_dialogs.h:4292
bool GetExpandLastColumn() const
Returns if the list should expand the last column to fill the available space.
Definition ff_dialogs.h:4673
virtual void HandleDoubleClick()
Called every time there's a double-click inside the data list.
Definition ff_dialogs.h:4744
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:4399
void SetAllowsMultipleSelection(bool state)
Sets if the list should allow multiple selections. To have any effect, this must be called before the...
Definition ff_dialogs.h:4536
bool GetShowHeader() const
Returns if the list should display its header.
Definition ff_dialogs.h:4544
virtual void HandleCheckChange(int lineindex, bool state)
Called every time there's a user check change on any of the items.
Definition ff_dialogs.h:4731
bool GetAllowsMultipleSelection() const
Returns if the list should allow multiple selections.
Definition ff_dialogs.h:4524
FCCtrlDataList(twobyte id)
The constructor.
Definition ff_dialogs.h:4402
void SetUseCheckboxes(bool state)
Sets if checkboxes should be used for the data list. To have any effect, this must be called before t...
Definition ff_dialogs.h:4507
void SetExpandLastColumn(bool state)
Sets if the list should expand the last column to fill the available space. To have any effect,...
Definition ff_dialogs.h:4682
bool GetUseCheckboxes() const
Returns if checkboxes should be used for the data list.
Definition ff_dialogs.h:4498
void SetShowHeader(bool state)
Sets if checkboxes should be used for the data list. To have any effect, this must be called before t...
Definition ff_dialogs.h:4553
void UseAlternatingBackgroundRowColors()
Set that the list view (on macOS) should use alternating row colors.
Definition ff_dialogs.h:4595
int GetColumnCount()
Returns the number of columns.
Definition ff_dialogs.h:4769
void SetFontSize(int fontsize)
Sets the font size for the data list. This affects Cocoa only.
Definition ff_dialogs.h:4422
Class that handles edit controls.
Definition ff_dialogs.h:2680
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:2700
float GetRangeMeasurementEfix(_ENUMCODE(MEASUREMENTUNITS) _LUACODE(twobyte) measurementunit, float min, float max)
Gets the measurement value in EFIXes from the edit field, within a specific range.
Definition ff_dialogs.h:2807
void SetMeasurementEfix(float value, _ENUMCODE(MEASUREMENTUNITS) _LUACODE(twobyte) measurementunit)
Sets the EFIX value to the edit field, using the indicated measurement unit.
Definition ff_dialogs.h:2841
void SetFocus()
Moves the keyboard focus to the edit control.
Definition ff_dialogs.h:2918
FCCtrlEdit(twobyte id)
The constructor.
Definition ff_dialogs.h:2703
float GetMeasurementEfix(_ENUMCODE(MEASUREMENTUNITS) _LUACODE(twobyte) measurementunit)
Gets the measurement value in EFIXes from the edit field.
Definition ff_dialogs.h:2783
UI class representing a horizontal graphical line.
Definition ff_dialogs.h:2587
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:2589
FCCtrlHorizontalLine(twobyte id)
The constructor.
Definition ff_dialogs.h:2592
UI class that handles a control with a static image.
Definition ff_dialogs.h:6056
FCCtrlImage(twobyte id)
The constructor.
Definition ff_dialogs.h:6109
bool SetImageFromFilePath(const char *path, bool preserveControlSize=false)
Set the image from a fully qualified file name and path.
Definition ff_dialogs.h:6140
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:6106
bool SetImageFromBuffer(const onebyte *data, long dataLength, bool preserveControlSize=false)
Set the image from an input memory buffer.
Definition ff_dialogs.h:6157
UI class representing a graphical line.
Definition ff_dialogs.h:2524
FCCtrlLine(twobyte id)
The constructor.
Definition ff_dialogs.h:2546
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:2543
bool GetHorizontal()
Returns the line style to horizontal or vertical. This is only used for programmatically created line...
Definition ff_dialogs.h:2572
A list box control.
Definition ff_dialogs.h:4816
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:4843
bool SetSelectedLast()
Selects the last item in the list box.
Definition ff_dialogs.h:4888
UI class that handles a popup (on the Mac) and a combo list (on Windows).
Definition ff_dialogs.h:2952
FCCtrlPopup(twobyte id)
The constructor.
Definition ff_dialogs.h:2976
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:2973
void SetStrings(FCStrings *pStrings)
Sets a string collection to the popup control.
Definition ff_dialogs.h:3013
Class for radio button groups.
Definition ff_dialogs.h:5662
int GetSelectedItem()
Returns the 0-based selected index for the radio button group or -1 if none.
Definition ff_dialogs.h:5747
void SetWidth(float width)
Sets a uniform width for all radio buttons.
Definition ff_dialogs.h:5718
void SetSelectedItem(int index)
Select the 0-based index of the radio button group. If the index is invalid, nothing happens.
Definition ff_dialogs.h:5760
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:5676
void Add(FCCtrlRadioButton *button)
Add a button to the group.
Definition ff_dialogs.h:5698
void MoveAllRelative(float horizoffset, float vertoffset)
Move all the radio buttons by a relative amount.
Definition ff_dialogs.h:5776
int GetCount() const
Returns the number of radio buttons in the group.
Definition ff_dialogs.h:5692
int GetGroupID() const
Returns the button group ID.
Definition ff_dialogs.h:5684
FCCtrlRadioButtonGroup(int groupID)
The constructor. (Not available in Lua.)
Definition ff_dialogs.h:5668
FCCtrlRadioButton * GetSelectedButton()
Returns the selected radion button or NULL if none.
Definition ff_dialogs.h:5731
FCCtrlRadioButton * GetItemAt(int index) const
Overridden version of GetItemAt method.
Definition ff_dialogs.h:5704
A UI class that handles a single radio button.
Definition ff_dialogs.h:5565
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:5611
FCCtrlRadioButtonGroup * GetRadioButtonGroup() const
Gets the associated radio button group for this radio button, if any.
Definition ff_dialogs.h:5639
bool GetCheck()
Returns the state of the radio button.
Definition finaleframework.cpp:27586
FCCtrlRadioButton(twobyte id, FCCtrlRadioButtonGroup *pButtonGroup, int buttonIndex)
The constructor for FCCtrlRadioButtonGroup.
Definition ff_dialogs.h:5597
FCCtrlRadioButton(twobyte id)
The constructor for standalone compatibility.
Definition ff_dialogs.h:5607
Control class for sliders.
Definition ff_dialogs.h:5945
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:5976
FCCtrlSlider(twobyte id)
The constructor.
Definition ff_dialogs.h:5969
UI class that handles a control with static text.
Definition ff_dialogs.h:2615
FCCtrlStatic(twobyte id)
The constructor.
Definition ff_dialogs.h:2636
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:2633
A control to switch between multiple pages.
Definition ff_dialogs.h:5468
FCCtrlSwitcher(twobyte id)
The constructor.
Definition ff_dialogs.h:5492
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:5494
UI class that handles a multiline edit control for viewing or modifying text (optionally formatted wi...
Definition ff_dialogs.h:3185
int GetConvertTabsToSpaces() const
Gets the number of spaces to which to convert tab characters. If this value is zero or negative,...
Definition ff_dialogs.h:3883
bool ResetColors()
Resets text and background colors to their default system colors for the entire control.
Definition ff_dialogs.h:4018
bool GetWordWrap() const
Gets the edit text field's setting to wrap or to have horizontal scrollers and not wrap.
Definition ff_dialogs.h:3821
bool ResetBackgroundColorInRange(const FCRange *pRange)
Resets the background color in a given range to the system default color. On macOS,...
Definition ff_dialogs.h:4007
FCCtrlTextEditor(twobyte id)
The constructor.
Definition ff_dialogs.h:3248
std::tuple< int, int, int > GetBackgroundColorAtIndex(int index) const
Gets the background color at the specified index. On macOS, the value for the default color may diffe...
Definition ff_dialogs.h:4057
bool ReplaceTextInRangeWithEnigmaString(const FCString *pString, const FCRange *pRange)
Replaces the specified range of text with the input text and formatting specified by the input enigma...
Definition ff_dialogs.h:3488
FCRanges * CreateBackgroundColorChanges() const
Returns an FCRanges collection containing the range in the text where the background color changes.
Definition ff_dialogs.h:4091
bool GetAutomaticallyIndent() const
Gets whether to automatically indent to the same tab level when hitting the Enter key.
Definition ff_dialogs.h:3899
bool GetSelectedText(FCString *pText) const
Gets the selected text on the control.
Definition ff_dialogs.h:3504
bool ReplaceSelectedText(const FCString *pText)
Replaces the currently selected text with the contents of the input string. If no selection exists,...
Definition ff_dialogs.h:3520
bool SelectAll()
Selects the entire text.
Definition ff_dialogs.h:3431
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:3245
FCRanges * CreateTextColorChanges() const
Returns an FCRanges collection containing the range in the text where the color changes.
Definition ff_dialogs.h:4071
bool SetEnigmaString(const FCString *pString, int rawtexttype=0)
Sets the contents of the control based on the input Enigma string. Any previous text in the control i...
Definition ff_dialogs.h:3680
void SetConvertTabsToSpaces(int value)
Sets the number of spaces to which to convert tab characters. If this value is zero or negative,...
Definition ff_dialogs.h:3893
int GetCurrentLine() const
Returns the current line number, starting with line 1. The current line is the line of text where the...
Definition ff_dialogs.h:3349
bool SetTextColorInRange(int red, int green, int blue, const FCRange *pRange)
Sets the text color in a given range. If the range is to the end of the control, it also sets the def...
Definition ff_dialogs.h:3964
bool SetBackgroundColorInRange(int red, int green, int blue, const FCRange *pRange)
Sets the background color in a given range. If the range is to the end of the control,...
Definition ff_dialogs.h:3980
void SetParent(__FCUserWindow *parentptr) override
For internal use only. Overriden SetParent.
Definition ff_dialogs.h:3258
void SetAutomaticallyIndent(bool state)
Sets whether to automatically indent to the same tab level when hitting the Enter key.
Definition ff_dialogs.h:3905
std::tuple< int, int, int > GetTextColorAtIndex(int index) const
Gets the text color at the specified index. On macOS, the value for the default color may differ depe...
Definition ff_dialogs.h:4040
STRINGFINDOPTIONS
Bitwise option codes for the CreateRangesForString method.
Definition ff_dialogs.h:3271
bool ResetTextColorInRange(const FCRange *pRange)
Resets the text color in a given range to the system default color. On macOS, this is a dynamic color...
Definition ff_dialogs.h:3994
bool GetAutomaticEditing() const
Sets whether the control should use automatic editing features.
Definition ff_dialogs.h:3862
A tree UI control.
Definition ff_dialogs.h:5175
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:5211
FCCtrlTree(twobyte id)
The constructor.
Definition ff_dialogs.h:5198
void SetFontSize(int size)
Sets the font size of the tree control.
Definition ff_dialogs.h:5367
FCTreeNode * GetRootItemAt(int index)
Returns the root node at the 0-based index position.
Definition ff_dialogs.h:5419
int GetRootCount()
Returns the number of container nodes in the tree.
Definition ff_dialogs.h:5409
int GetRootIndexOf(FCTreeNode *pNode)
Returns the index of a node that appears at root level.
Definition ff_dialogs.h:5440
A UI class that handles an Up/Down control. The control has 2 arrows, one pointing up and one down.
Definition ff_dialogs.h:2369
bool ConnectIntegerEdit(FCCtrlEdit *pControl, int min, int max)
Connects an integer edit field to an up/down control.
Definition ff_dialogs.h:2463
FCCtrlUpDown(twobyte id)
The constructor.
Definition ff_dialogs.h:2397
FCCtrlEdit * GetConnectedEdit()
Returns the connected edit control (if any).
Definition ff_dialogs.h:2443
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:2406
bool ConnectMeasurementEdit(FCCtrlEdit *pControl, double min, double max)
Connects a measurement edit field to an up/down control.
Definition ff_dialogs.h:2489
UI class representing a horizontal graphical line.
Definition ff_dialogs.h:2602
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:2604
FCCtrlVerticalLine(twobyte id)
The constructor.
Definition ff_dialogs.h:2607
A class that supports programmatically created controls (that are not defined in resource files).
Definition ff_dialogs.h:6490
FCCtrlButton * CreateCloseButton(float x, float y)
Creates a "Close" push button at the specified position and connects it to the window.
Definition ff_dialogs.h:6763
FCCtrlListBox * CreateListBox(float x, float y)
Creates and connects a list box control to the window.
Definition ff_dialogs.h:6844
FCControl * _AddCreatedCtrl(FCControl *pControl, float x, float y)
For internal use only.
Definition ff_dialogs.h:6571
FCCtrlSlider * CreateSlider(float x, float y)
Creates and connects a horizontal slider control to the window.
Definition ff_dialogs.h:6832
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:6548
bool GetOkButtonCanClose() const
Gets the closability state of the Ok button. See SetOkButtonCanClose for more information.
Definition ff_dialogs.h:6600
int _CalcAvailableCtrlID()
For internal use only!
Definition ff_dialogs.h:6555
FCCtrlSwitcher * CreateSwitcher(float x, float y)
Creates and connects a page switcher control to the window.
Definition ff_dialogs.h:6908
FCCtrlStatic * CreateStatic(float x, float y)
Adds a static text object to the window.
Definition ff_dialogs.h:6621
FCCtrlPopup * CreatePopup(float x, float y)
Creates and connects a popup/drop-down list control to the window.
Definition ff_dialogs.h:6782
FCCustomWindow()
The constructor.
Definition ff_dialogs.h:6537
FCCtrlHorizontalLine * CreateHorizontalLine(float x, float y, float width)
Creates and connects a horizontal line control to the window.
Definition ff_dialogs.h:6796
FCCtrlVerticalLine * CreateVerticalLine(float x, float y, float height)
Creates and connects a vertical line control to the window.
Definition ff_dialogs.h:6815
FCCtrlRadioButtonGroup * CreateRadioButtonGroup(float x, float y, int no_of_items)
Creates and connects a radio button group to the window.
Definition ff_dialogs.h:6868
FCCtrlCheckbox * CreateCheckbox(float x, float y)
Creates and connects a checkbox control to the window.
Definition ff_dialogs.h:6701
FCCtrlEdit * CreateEdit(float x, float y)
Adds an edit control object to the window.
Definition ff_dialogs.h:6653
FCCtrlDataList * CreateDataList(float x, float y)
Creates and connects a data list view control to the window.
Definition ff_dialogs.h:6924
void MoveAllControls(int horizoffset, int vertoffset)
Moves all controls on the window by the specified amount.
Definition ff_dialogs.h:6956
void OkButtonPressed() override
Override method for __FCUserWindow::OkButtonPressed.
Definition ff_dialogs.h:6604
FCCtrlImage * CreateImage(float x, float y)
Adds an image object to the window.
Definition ff_dialogs.h:6634
FCCtrlTree * CreateTree(float x, float y)
Creates and connects a tree view control to the window.
Definition ff_dialogs.h:6896
FCCtrlButton * CreateButton(float x, float y)
Creates and connects a push button to the window.
Definition ff_dialogs.h:6689
void SetOkButtonCanClose(bool value)
Sets the closability state of the window for the Ok button.
Definition ff_dialogs.h:6594
FCCtrlButton * CreateCancelButton()
Creates a "Cancel" push button, with default positioning and appearance/behaviour.
Definition ff_dialogs.h:6743
FCCtrlTextEditor * CreateTextEditor(float x, float y)
Adds an edit text control object to the window.
Definition ff_dialogs.h:6665
FCCtrlRadioButton * CreateRadioButton(float x, float y)
Creates and connects a radio button control to the window.
Definition ff_dialogs.h:6712
FCCtrlComboBox * CreateComboBox(float x, float y)
Adds a combobox control object to the window.
Definition ff_dialogs.h:6677
FCCtrlButton * CreateOkButton()
Creates an "Ok" push button, with default positioning and appearance/behaviour.
Definition ff_dialogs.h:6724
FCCtrlUpDown * CreateUpDown(float x, float y)
Creates and connects a up/down (stepper) control to the window.
Definition ff_dialogs.h:6856
A class that represents one row of data in a FCCtrlDataList UI control.
Definition ff_dialogs.h:4232
FCDataListRow()
The constructor.
Definition ff_dialogs.h:4252
FCCtrlDataList * GetConnectedList()
Returns the connected FCCtrlDataList control.
Definition ff_dialogs.h:4276
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:4258
bool GetCheck() const
Returns the check state of the row.
Definition ff_dialogs.h:4270
int GetConnectedLineIndex()
Returns the connected 0-based line index in the control.
Definition ff_dialogs.h:4273
Class that specifies Enigma text style. This includes font, size, efx, superscript,...
Definition ff_base.h:1757
Class to display the operating system's "Open File" modal dialog box.
Definition ff_dialogs.h:214
void SetMultiSelect(bool value)
Sets the dialog to allow multiple selections.
Definition ff_dialogs.h:237
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:231
bool Execute() override
Displays the dialog box to the user.
Definition ff_dialogs.h:272
bool GetMultiSelect() const
Returns the state controlling if the dialog will allow multiple selections.
Definition ff_dialogs.h:244
void _SetFileNames(FCStrings *pStrings)
For internal use only!
Definition ff_dialogs.h:261
FCFileOpenDialog(FCUI *pUI)
The constructor.
Definition ff_dialogs.h:227
void GetFileNames(FCStrings *pStrings)
Gets the string collection with all selected file names, if multiple selection has been enabled for t...
Definition ff_dialogs.h:254
Class to display the operating system's "Save File As" modal dialog box.
Definition ff_dialogs.h:288
FCFileSaveAsDialog(FCUI *pUI)
The constructor.
Definition ff_dialogs.h:295
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:298
bool Execute() override
Displays the dialog box to the user.
Definition ff_dialogs.h:304
Class to display the operating system's modal folder browser dialog box.
Definition ff_dialogs.h:326
void SetUseFinaleAPI(bool state)
Sets if the native Finale API for folder browsing should be used on Finale 25 and above.
Definition ff_dialogs.h:382
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:346
void GetFolderPath(FCString *pString)
Gets the folder path.
Definition ff_dialogs.h:390
FCFolderBrowseDialog(FCUI *pUI)
The constructor.
Definition ff_dialogs.h:341
void SetFolderPath(FCString *pString)
Sets the default folder path. This is the path that will be preselected when the dialog is displayed.
Definition ff_dialogs.h:356
void GetWindowTitle(FCString *pString)
Gets the assigned dialog title.
Definition ff_dialogs.h:402
bool Execute()
Displays the dialog box to the user.
Definition ff_dialogs.h:433
void SetWindowTitle(FCString *pString)
Sets the title for the dialog box.
Definition ff_dialogs.h:364
bool GetUseFinaleAPI() const
Returns if the native Finale API for folder browsing should be used on Finale 25 and above.
Definition ff_dialogs.h:422
Class for document-independent font information.
Definition ff_base.h:1138
Class that encapsulates a range (start, length)
Definition ff_base.h:5570
int GetStart() const
Returns the start value.
Definition ff_base.h:5616
int GetLength() const
Returns the length value.
Definition ff_base.h:5622
Simple collection class for FCRange class objects.
Definition ff_basecollection.h:1525
RAWTEXTTYPES
enumerates the possible raw text types.
Definition ff_text.h:72
Class for modeless and modal dialogs that are visually designed as a resource. This class is also a p...
Definition ff_dialogs.h:6214
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:6248
FCCtrlButton * AddButton(twobyte id)
Links a button object to the dialog resource.
Definition ff_dialogs.h:6425
FCCtrlCheckbox * AddCheckbox(twobyte id)
Links a checkbox object to the dialog resource.
Definition ff_dialogs.h:6440
FCCtrlListBox * AddListBox(twobyte id)
Links a list box object to the dialog resource.
Definition ff_dialogs.h:6420
FCCtrlImage * AddImage(twobyte id)
Links an image object to the dialog resource.
Definition ff_dialogs.h:6392
FCCtrlStatic * AddStatic(twobyte id)
Links a static text object to the dialog resource.
Definition ff_dialogs.h:6385
FCCtrlEdit * AddEdit(twobyte id)
Links an edit field object to the dialog resource.
Definition ff_dialogs.h:6405
__FCUserWindow * GetParent()
Returns the parent window object.
Definition ff_dialogs.h:6262
void SetWantsDpiAwareness(bool WINCODE(state))
Sets the HiDPI awareness state of the window.
Definition ff_dialogs.h:6363
FCCtrlPopup * AddPopup(twobyte id)
Links a popup object to the dialog resource.
Definition ff_dialogs.h:6415
FCCtrlUpDown * AddUpDown(twobyte id)
Links a up/down object to the dialog resource.
Definition ff_dialogs.h:6445
FCCtrlTextEditor * AddTextEditor(twobyte id)
Links an edit text object to the dialog resource.
Definition ff_dialogs.h:6410
FCCtrlTree * AddTree(twobyte id)
Links a data list to the dialog resource.
Definition ff_dialogs.h:6456
FCCtrlSlider * AddSlider(twobyte id)
Links a slider object to the dialog resource.
Definition ff_dialogs.h:6430
FCCtrlDataList * AddDataList(twobyte id)
Links a tree view to the dialog resource.
Definition ff_dialogs.h:6450
FCCtrlComboBox * AddComboBox(twobyte id)
Links a combo box object to the dialog resource.
Definition ff_dialogs.h:6399
FCControl * AddCtrl(FCControl *pControl)
Adds a control object to the dialog collection.
Definition ff_dialogs.h:6372
FCCtrlLine * AddLine(twobyte id)
Links a line object to the dialog resource.
Definition ff_dialogs.h:6380
EXECMODAL_RETURNS
The return codes for the ExecuteModal() method.
Definition ff_dialogs.h:6227
FCCtrlRadioButton * AddRadioButton(twobyte id)
Links a radio button object to the dialog resource.
Definition ff_dialogs.h:6435
bool GetWantsDpiAwareness() const
Gets the HiDPI awareness state of the window.
Definition ff_dialogs.h:6337
Class that provides storage for text. This is to achieve platform-transparent text handling,...
Definition ff_base.h:1877
void ExtractFileExtension()
Removes everything except the file extension part of a file name.
Definition ff_base.h:2739
void SetString(const FCString *pString)
Copies a string.
Definition finaleframework.cpp:2398
void Clear()
Creates an empty string.
Definition ff_base.h:2391
void AppendCString(const char *pOtherString)
Appends a C-style string to the string.
Definition finaleframework.cpp:1861
bool IsEmpty() const
Returns true if the string is empty.
Definition ff_base.h:3179
Collection class for FCString class objects.
Definition ff_basecollection.h:1085
FCString * GetItemAt(int index) const
Overridden GetItemAt() method.
Definition ff_basecollection.h:1118
void CopyFrom(FCStrings *pSourceStrings)
Recreates a string collection. Any existing strings in the collection are cleared....
Definition ff_basecollection.h:1309
Class representing a single node item in a FCCtrlTree control.
Definition ff_dialogs.h:4965
FCTreeNode * GetItemAt(int index) const
Overridden version of GetItemAt().
Definition ff_dialogs.h:5008
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_dialogs.h:5142
FCString * GetTextPtr()
Returns the direct pointer to the text object.
Definition ff_dialogs.h:5040
void GetText(FCString *pString) const
Gets the node's text and copies it to a FCString object.
Definition ff_dialogs.h:5033
int GetIndex()
Returns the index of the item within the parent container.
Definition ff_dialogs.h:5102
void SetText(FCString *pText)
Sets the text for the node. This method will also visually update the node.
Definition ff_dialogs.h:5018
int GetSiblingCount()
Returns the number of childen that the node's parent has.
Definition ff_dialogs.h:5114
HANDLE _GetItemHandle()
For internal use only!
Definition ff_dialogs.h:5128
FCTreeNode * GetParentNode()
Returns the tree node's owner object.
Definition ff_dialogs.h:5094
bool GetIsContainer() const
Returns true if the node is set to be a container (that can contain subnodes).
Definition ff_dialogs.h:5072
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_dialogs.h:5000
Standard class for basic user interface functionality.
Definition ff_ui.h:29