Commit Graph

198 Commits

Author SHA1 Message Date
Bart
e1d2db658f Refactoring TTaskDialog: remove hack of exposing TCustomTaskDialog.FWidth. It was unneccessary to begin with... 2023-07-24 11:12:55 +02:00
Bart
b9634c255d Refactoring TTaskDialog: switch over to the new code, remove dependency on deprecated unit LCLTaskDialog. 2023-07-24 10:31:34 +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
4442949a29 Refactoring TTaskDialog: remove property ParentWindow (added in 61fefaa7), it's not longer needed. 2023-07-22 16:03:50 +02:00
Bart
85c1fff32d Refactoring TTaskDialog: move (and rename) constants for first radio/button index to Dialogs unit and use them there as well. 2023-07-22 15:55:17 +02:00
Bart
61fefaa794 Refactoring TTaskDialog:
- expose Dialogs.TTaskDialog.ParentWindow as reado only property (needed in TLCLTaskDialog.Execute)
- furhter implement adding controls at runtime to TLCLTaskDialog
- it compiles, but still not functional.
2023-07-19 12:07:21 +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
fc6bbcc936 TCustomTaskDialog: inherit form TLCLComponent and register the widgetset class. 2023-07-17 13:52:40 +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
Maxim Ganetsky
0f522e8d81 Removed unit UITypes from LazUtils. Use System.UITypes instead. Try 2. 2023-07-12 01:41:51 +03:00
Juha
5a19e7b529 Revert "Remove unit UITypes from LazUtils. Use System.UITypes."
This reverts commit f55ce5c939.
2023-07-08 16:16:56 +03:00
Juha
f55ce5c939 Remove unit UITypes from LazUtils. Use System.UITypes. 2023-07-08 14:07:52 +03:00
Juha
211d95da17 LCL: Use TLCLHandle instead of a redefined LCLType.THandle or TLCLIntfHandle. Deprecate them. 2023-07-03 11:17:01 +03:00
Juha
74446557f6 Remove old deprecated functions and units. 2023-06-15 02:35:52 +03:00
Ondrej Pokorny
57c8514e04 TTaskDialog: add tfEmulateClassicStyle to flags 2023-02-28 08:29:50 +01:00
wp_xyz
68e6168982 LCL/TaskDialog: Add new property Width to override the default width. 2022-11-23 23:43:18 +01:00
wp_xyz
58f237f04c LazControls: Fix LCLScaling of TColorButton.ButtonColorSize and .BorderWidth. 2022-11-07 22:25:58 +01:00
Ondrej Pokorny
62cb85cb4b LCL: task dialog: add tfForceNonNative Flag 2022-10-02 11:40:37 +02:00
Ondrej Pokorny
9c0641eca2 LCL: rename GetDialogImages.DialogIndexes to DialogGlyphs.DialogIcon 2022-09-28 22:51:28 +02:00
Ondrej Pokorny
f69cfeee39 LCL: new unit DialogRes for dialog icon resources 2022-09-28 16:20:14 +02:00
Bart
09584a03b9 LCL: implement PromptForFileName in a Delphi compatible way (even though the function is badly designed IMHO). Issue #39740. 2022-05-18 22:51:52 +02:00
Sergey Larin
b85417a330 The TCommonDialog.Title property is flagged as nodefault.
Without this change, Title property equal to '' is not saved to .lfm file.
2022-02-20 13:40:35 +03:00
wp_xyz
285ed6ea0d LCL/TColorButton: Add missing Notification method to prevent crash when assigned ColorDialog is deleted. 2021-12-16 00:37:28 +01:00
Ondrej Pokorny
fdd5721318 LCL: fix case of Integer/Boolean/string types 2021-12-13 10:23:37 +01:00
wp_xyz
5438db7700 LCL: Give access to dialog icon idDialogShield 2021-11-19 23:34:09 +01:00
juha
9219ea531d Move unit GraphMath from LCL to LazUtils. It has no dependencies to GUI.
git-svn-id: trunk@64303 -
2020-12-29 22:56:40 +00:00
dmitry
8bcb4c3d6f lcl: moving RegisterPropertyToSkip from unit initialization to WSRegisterClass methods
git-svn-id: trunk@62581 -
2020-01-23 15:28:39 +00:00
jesus
f8e9e6474b Printers: Support for Cocoa printing, updated examples.
git-svn-id: trunk@59492 -
2018-11-08 21:54:32 +00:00
bart
ca05451b8c TCommondialog: do not publish Widht/Height properties. Issue #0033480. Patch by AlexeyT.
git-svn-id: trunk@59032 -
2018-09-16 13:06:31 +00:00
juha
41dc46374f LazUtils: Move string manipulation functions from LazUtilities to LazStringUtils.
git-svn-id: trunk@58634 -
2018-07-25 23:44:54 +00:00
juha
ce916d287c LazUtils: Rename unit ModalResultDef to a Delphi compatible UITypes. Add Message dialog related stuff.
git-svn-id: trunk@58227 -
2018-06-11 10:51:11 +00:00
juha
5f57884ed1 LCL,LazUtils: Move ModalResult and the mr... consts to a new unit in LazUtils. They are used in non-GUI programs, too.
git-svn-id: trunk@58205 -
2018-06-09 14:39:49 +00:00
bart
9801fd24ee Dialogs: overload CreateMessageDlg function with parameter to set dialog caption.
git-svn-id: trunk@57360 -
2018-02-24 16:01:21 +00:00
mattias
d94945ef38 lcl: TOpenDialog: deprecated DereferenceLinks, added ResolveLinks, added ofNoResolveLinks, docs, ofNoDereferenceLinks now behaves Delphi compatible
git-svn-id: trunk@56289 -
2017-11-05 23:51:00 +00:00
ondrej
dc573dbaa0 dialogs: TTaskDialog: rename OnButtonClicked params. Issue #31404
git-svn-id: trunk@54169 -
2017-02-16 17:22:45 +00:00
ondrej
9d6acea295 dialogs: TTaskDialog: change string properties to TTranslateString. Issue #31390
git-svn-id: trunk@54162 -
2017-02-15 11:12:22 +00:00
ondrej
445c92af0c dialogs: TTaskDialog: change TTaskDialogIcon from integer to enumeration.
Reason: LCLTaskDialog doesn't support icons beyond this range and it's better to have a combobox in the OI.
Issue #31389

git-svn-id: trunk@54157 -
2017-02-15 08:46:29 +00:00
juha
a714a91311 LCL: Move TLCLPlatform and related non-GUI code to a new unit to be used without GUI.
Organize uses-sections by package so that dependencies can be easier seen.

git-svn-id: trunk@53711 -
2016-12-17 22:58:08 +00:00
juha
a8646f33f5 LCL: Remove a useless test in function DefaultMessageBox.
git-svn-id: trunk@53635 -
2016-12-11 15:18:31 +00:00
ondrej
b934d7aa02 lcl: lcltaskdialog: fix execution parameters
git-svn-id: trunk@53015 -
2016-09-22 07:00:38 +00:00
ondrej
a35cab7fa4 LCL: register TTaskDialog
git-svn-id: trunk@53009 -
2016-09-22 02:51:31 +00:00
ondrej
924a4b4033 LCL: dialogs: add TTaskDialog
git-svn-id: trunk@53008 -
2016-09-22 02:34:30 +00:00
mattias
da0f71ea43 lcl: dialogs: added InputCombo, from Michael Van Canneyt
git-svn-id: trunk@52973 -
2016-09-15 07:04:01 +00:00
bart
4213e0848c Dialogs:
- implement a mechanisme to query the widgetset how and when to handle DoShow, DoCanClose and DoClose.
- implement QueryWSEventCapabilities for Win32 widgetset

git-svn-id: trunk@52850 -
2016-08-21 11:45:58 +00:00
bart
57c09522ef FindDialog: fix wrong Sender in OnShow event. Part of Issue #0030449.
git-svn-id: trunk@52816 -
2016-08-17 11:56:10 +00:00
bart
cc041a51b2 Dialogs: fix several issues with OnShow/OnCanClose/OnClose events.
- fixes showing OnShow twice
- fixes not firing TSelectDirectoryDialog.OnClose on WinXP
- fixes wrong Sender in TFindDialog.OnShow
- fixes firing TFontDialog.OnShow after fom closes (Windows)
- fixes not firing OnShow and OnClose of TCalculatorDialog
- fixes wrong Sender in TCalendarDialog.OnShow and OnCanClose
- call DoXXX instead of OnXXX wherever possible
- more conditioal debug output
Resolves issue #0023065.
Partly resolves issue #0021163.

git-svn-id: trunk@52801 -
2016-08-13 18:05:25 +00:00
bart
8a444a31ef Dialogs: don't call TOpenDialog.OnCanClose if ofOldStyleDialog in Options (Delphi compatibility). Part of Issue #0021147.
git-svn-id: trunk@52788 -
2016-08-07 23:21:07 +00:00
bart
6e5cf2da5a Dialogs:
1. Only call TFileDialog.OnCanClose if user did not cancel the dialog.
2. Fix dialog and application behaviour of setting CanClose to False in TFileDialog.OnCanClose.
Mostly resolves issue #0021147.

git-svn-id: trunk@52787 -
2016-08-07 18:39:35 +00:00
ondrej
f6175a256f LCL: dialogs: create a generic solution for dialog copy to clipboard.
git-svn-id: trunk@52308 -
2016-05-15 09:33:19 +00:00
ondrej
f7158c1393 lcl: disable windows on system dialog execute
win32: fix parent window handle for system dialogs
Issue #28631

git-svn-id: trunk@51798 -
2016-03-02 05:45:52 +00:00