Commit Graph

43 Commits

Author SHA1 Message Date
Bart
97e1427811 Refactoring change deprecated message for LCLTaskDialog unit, as suggested by Maxim. 2023-07-24 20:17:55 +02:00
Bart
80dc2c89b0 Refactoring TTaskDialog: undo all temprary changes in (now deprecated) LCLTaskDialog unit. 2023-07-24 10:58:20 +02:00
Bart
92f83f8b59 Refactoring TTaskDialog:
- first attempt to get Win32 WS code working (currently littered with writeln() statements, so crashes if no console!)
- fix ModalResult in OnButtonClicked for emulated dialog.
2023-07-24 01:08:33 +02:00
Bart
4440804744 Refactoring TTaskDialog: start working on Win32 widgetset implementation. Far from functional yet. 2023-07-22 17:21:01 +02:00
Bart
4d40d3f77a Refactoring TTaskDialog:
- Deprecated unit LCLTaskDialog.
- Unit TaskDlgEmulation: work in progress.
  - Start implementing TLCLTaskDialog class. Not functional yet (but at least it should compile).
  - Code copied and adapted from the now deprecated LCLTaskDialog unit.
- Temporarily exposed a private variable of Dialogs.TTaskDialog
2023-07-17 20:48:22 +02:00
Bart
02765cb9db LCLTaskDialog: use descriptive const instead of magic numbers. 2023-07-12 15:37:31 +02:00
Bart
a802987646 TTaskDialog: remove ctypes unit from LCLTaskDialog (on Windows): it isn't used. 2023-07-12 15:18:37 +02:00
Bart
e5aa4cee57 diff --git a/lcl/dialogs.pp b/lcl/dialogs.pp
index 24f69c5ac7..b156a70d9c 100644
--- a/lcl/dialogs.pp
+++ b/lcl/dialogs.pp
@@ -543,6 +543,7 @@ type
     tfShowMarqueeProgressBar, tfCallbackTimer,
     tfPositionRelativeToWindow, tfRtlLayout,
     tfNoDefaultRadioButton, tfCanBeMinimized,
+    tfNoSetForeGround, tfSizeToContent,
     tfForceNonNative, tfEmulateClassicStyle);
   TTaskDialogFlags = set of TTaskDialogFlag;

diff --git a/lcl/include/taskdialog.inc b/lcl/include/taskdialog.inc
index 2ce5a97571..ddf2f46aaa 100644
--- a/lcl/include/taskdialog.inc
+++ b/lcl/include/taskdialog.inc
@@ -179,6 +179,10 @@ function TCustomTaskDialog.DoExecute(ParentWnd: HWND): Boolean;
       Result := Result + [tdfNoDefaultRadioButton];
     if tfCanBeMinimized in aTaskFlags then
       Result := Result + [tdfCanBeMinimized];
+    if tfNoSetForeGround in aTaskFlags then
+      Result := Result + [tdfNoSetForeGround];
+    if tfSizeToContent in aTaskFlags then
+      Result := Result + [tdfSizeToContent];
   end;

   function TF_DIALOGICON(const aIcon: TTaskDialogIcon): LCLTaskDialog.TTaskDialogIcon;
diff --git a/lcl/lcltaskdialog.pas b/lcl/lcltaskdialog.pas
index 660702261f..2c3caccd43 100644
--- a/lcl/lcltaskdialog.pas
+++ b/lcl/lcltaskdialog.pas
@@ -127,7 +127,7 @@ interface

 uses
   {$IFDEF MSWINDOWS}
-  Windows, ctypes,
+  Windows, ctypes,  CommCtrl,
   {$ENDIF}
   Classes, SysUtils,
   LazUTF8,
@@ -172,7 +172,9 @@ type
     tdfExpandFooterArea, tdfExpandByDefault, tdfVerificationFlagChecked,
     tdfShowProgressBar, tdfShowMarqueeProgressBar, tdfCallbackTimer,
     tdfPositionRelativeToWindow, tdfRtlLayout, tdfNoDefaultRadioButton,
-    tdfCanBeMinimized, tdfQuery, tdfQueryMasked, tdfQueryFieldFocused);
+    tdfCanBeMinimized, tdfNoSetForeGround {added in Windows 8}, tdfSizeToContent,
+    //custom LCL flags
+    tdfQuery, tdfQueryMasked, tdfQueryFieldFocused);

   /// set of available configuration flags for the Task Dialog
   TTaskDialogFlags = set of TTaskDialogFlag;
@@ -771,6 +773,29 @@ var
     if ModalResult=aButtonDef then
       Dialog.Form.ActiveControl := result;
   end;
+  {$IFDEF MSWINDOwS}
+  function TaskDialogFlagsToInteger(aFlags: TTaskDialogFlags): Integer;
+  const
+    //missing from CommCtrls in fpc < 3.3.1
+    TDF_NO_SET_FOREGROUND = $10000;
+    TDF_SIZE_TO_CONTENT   = $1000000;
+    FlagValues: Array[TTaskDialogFlag] of Integer = (
+      TDF_ENABLE_HYPERLINKS, TDF_USE_HICON_MAIN, TDF_USE_HICON_FOOTER,
+      TDF_ALLOW_DIALOG_CANCELLATION, TDF_USE_COMMAND_LINKS, TDF_USE_COMMAND_LINKS_NO_ICON,
+      TDF_EXPAND_FOOTER_AREA, TDF_EXPANDED_BY_DEFAULT, TDF_VERIFICATION_FLAG_CHECKED,
+      TDF_SHOW_PROGRESS_BAR, TDF_SHOW_MARQUEE_PROGRESS_BAR, TDF_CALLBACK_TIMER,
+      TDF_POSITION_RELATIVE_TO_WINDOW, TDF_RTL_LAYOUT, TDF_NO_DEFAULT_RADIO_BUTTON,
+      TDF_CAN_BE_MINIMIZED, TDF_NO_SET_FOREGROUND {added in Windows 8}, TDF_SIZE_TO_CONTENT,
+      //custom LCL flags
+      0 {tdfQuery}, 0 {tdfQueryMasked}, 0 {tdfQueryFieldFocused});
+  var
+    aFlag: TTaskDialogFlag;
+  begin
+    Result := 0;
+    for aFlag := Low(TTaskDialogFlags) to High(TTaskDialogFlags) do
+      if (aFlag in aFlags) then Result := Result or FlagValues[aFlag];
+  end;
+  {$ENDIF MSWINWOS}

 var
   ARadioOffset: integer;
@@ -821,7 +846,7 @@ begin
       include(aFlags,tdfVerificationFlagChecked);
     if (Config.cButtons=0) and (aCommonButtons=[cbOk]) then
       Include(aFlags,tdfAllowDialogCancellation); // just OK -> Esc/Alt+F4 close
-    Config.dwFlags := integer(aFlags);
+    Config.dwFlags := TaskDialogFlagsToInteger(aFlags);
     Config.hMainIcon := TD_ICONS[aDialogIcon];
     Config.hFooterIcon := TD_FOOTERICONS[aFooterIcon];
     Config.nDefaultButton := aButtonDef;
2023-07-12 15:15:34 +02:00
Bart
48b1419ec4 TTaskDialog: make the flag tfNoDefaultRadioButton actually work both. 2023-07-07 22:55:13 +02:00
Juha
6de7a578ac LCL: Fix variable type used as a pointer parameter for TaskDialogIndirect. Issue #40265, noted by Arioch The. 2023-05-16 15:08:28 +03:00
wp_xyz
a9c050a248 LCL/TaskDialog: Clean-up previous commit 2022-11-25 00:19:37 +01:00
wp_xyz
84697cbb79 LCL/TaskDialog: Improved layout of the emulated dialog when there is no MainIcon and no Title text. 2022-11-25 00:06:41 +01:00
wp_xyz
3b8b43040d LCL/TaskDialog: Fix incorrect width of native dialog. 2022-11-24 18:18:04 +01:00
wp_xyz
68e6168982 LCL/TaskDialog: Add new property Width to override the default width. 2022-11-23 23:43:18 +01:00
Ondrej Pokorny
ff3965e8bc LCL: DialogRes: remove Windows-dependent code and use the new ThemeServices.GetStockImage overload 2022-10-02 11:33:12 +02:00
Ondrej Pokorny
9c0641eca2 LCL: rename GetDialogImages.DialogIndexes to DialogGlyphs.DialogIcon 2022-09-28 22:51:28 +02:00
Ondrej Pokorny
a7d0453a6e LCL: TImage: TImageList support (properties Images, ImageIndex and ImageWidth) 2022-09-28 20:25:36 +02:00
Ondrej Pokorny
0a3a47d7ae LCL: task dialog: more image positioning fixes 2022-09-28 17:04:04 +02:00
Ondrej Pokorny
8629548a7b LCL: taskbar: always stretch images 2022-09-28 16:50:24 +02:00
Ondrej Pokorny
5114a458e5 fix linux compilation (forgotten IFDEF windows) 2022-09-28 16:43:45 +02:00
Ondrej Pokorny
49647626a5 LCL: task dialog: high-DPI support 2022-09-28 16:25:06 +02:00
wp_xyz
ca1b88b2cf LCL/TaskDialog: Scaling of TaskDialog (some issues left) 2022-09-28 12:55:24 +02:00
Martin
5882a5bfb5 LCL: TaskDialog, fix default radio-button 2022-09-27 12:16:13 +02:00
wp_xyz
f73bf85730 LCL/LCLTaskDialog: Replace hard-coded rgb colors by system colors. 2022-09-21 22:04:22 +02:00
wp_xyz
b442769bb0 LCL/TaskDialog: Fix command and radio buttons on TaskDialog being exchanged in non-Windows widget sets. 2022-09-20 23:47:19 +02:00
michl
86c8880e7c LCL: TaskDialog: Use no icon for tdiNone, not a placeholder icon, see issue #39172. Suggested by Jamie Philbrook
git-svn-id: trunk@65402 -
2021-07-08 08:02:23 +00:00
maxim
dcb4b22eef LCL: Do not convert '\n' sequence to linefeed also in Title, Inst, Verify, Info, InfoExpanded, InfoCollapse, Footer fields of LCLTaskDialog.TTaskDialog anymore (LineEnding constant should be used for this). Unbreaks output of strings like 'c:\new_folder\new.work'.
git-svn-id: trunk@64988 -
2021-04-13 21:38:57 +00:00
maxim
058e8264fa LCL: Do not convert '\n' sequence to linefeed in Content field of LCLTaskDialog.TTaskDialog anymore (LineEnding constant should be used for this), bug #38676. Unbreaks output of strings like 'Save "c:\new_folder\new.work"?'.
git-svn-id: trunk@64975 -
2021-04-11 20:03:36 +00:00
juha
d9767178be LCL: Fix compilation on Windows. "Rect" is in unit Windows and unit Classes. Issue #38427.
git-svn-id: trunk@64445 -
2021-01-30 21:07:07 +00:00
juha
a542627231 LCL: Use a faster compare method for case-insensitive StringList.
git-svn-id: trunk@64443 -
2021-01-30 18:36:54 +00:00
bart
a7be8c9c96 LCL: fix TTaskDialog.ModalResult if closebutton (in CommonButtons) is clicked. Issue #0036069.
git-svn-id: trunk@61947 -
2019-09-29 10:43:55 +00:00
zeljko
fb94a220bd LCL: LCLTaskDialog - fix for radio buttons offset with non win32 widgetsets. issue #35579
git-svn-id: trunk@61221 -
2019-05-13 13:36:30 +00:00
zeljko
5981e87a6b LCL: added new LCL capability - lcNativeTaskDialog, defaults to true, on mswindows is false for qt/qt5. issue #35577
git-svn-id: trunk@61219 -
2019-05-13 12:57:11 +00:00
zeljko
ab671436ed LCL: lcltaskdialog must use DrawText() from LCLIntf under windows, so other WS wont' crash under windows. issue #35575
git-svn-id: trunk@61216 -
2019-05-13 09:41:44 +00:00
ondrej
d3f3c58edc lcl: taskdialog: fix default font size for darwin after r54453 #20a9ecf1d5. Issue #31037
git-svn-id: trunk@54464 -
2017-03-22 09:47:23 +00:00
ondrej
4a89297c1e dialogs: TTaskDialog: fix default font. Issue #31393, patch by AlexeyT
git-svn-id: trunk@54185 -
2017-02-17 15:39:52 +00:00
mattias
425d1ffeb1 lcl: less warnings
git-svn-id: trunk@53138 -
2016-10-17 13:34:17 +00:00
ondrej
7392cc05c9 lcl: lcltaskdialog: fix non-windows compilation
git-svn-id: trunk@53014 -
2016-09-22 06:33:39 +00:00
ondrej
5dfe53f3d2 lcl: lcltaskdialog: fix non-windows compilation
git-svn-id: trunk@53013 -
2016-09-22 06:23:12 +00:00
ondrej
404644fef1 LCL: lcltaskdialog: fix font and icon bugs
git-svn-id: trunk@53011 -
2016-09-22 03:29:55 +00:00
ondrej
11d12df809 LCL: lcltaskdialog: update version info
git-svn-id: trunk@53010 -
2016-09-22 03:00:33 +00:00
ondrej
e656623d7d LCL: lcltaskdialog: lazy initialization of DefaultFont
git-svn-id: trunk@53007 -
2016-09-22 02:31:28 +00:00
ondrej
b6d0978768 LCL: include LCLTaskDialog.pas, initial commit. Issue #30625
git-svn-id: trunk@53006 -
2016-09-21 16:06:29 +00:00