Commit Graph

230 Commits

Author SHA1 Message Date
Bart
633cb5bbc0 TColorDialog: implement property AlphaChannel and associated option cdShowAlphaChannel for GTK2. 2024-12-14 15:54:25 +01:00
Bart
9077ef32a2 LCL: implement TColorDialog.Options. Currently only supported for Win32/Win64 widgetset. Issue #22717.
The default value differs from Delphi (7) for backwards compatibility (CC_FULLOPEN flag was always set in Windows).
2024-12-08 13:56:30 +01:00
Juha
8583ffa716 LCL: Formatting. 2024-11-23 08:10:58 +02:00
Martin
5779cff4d2 LCL: Add wrapper functions for TTaskDialog. So it can be used like MessageDlg. 2024-03-21 14:16:04 +01:00
Maxim Ganetsky
72ea155588 LCL: fixed compilation with FPC 3.2.3 2023-11-30 19:17:17 +03:00
mattias
bcd4138db4 lcl: fixed compile with fpc 3.3.1 2023-11-02 18:24:49 +01:00
Bart
33484eab0b LCL: Start implemention TOpenOptionsEx: widget set specific options for TOpen/SaveDialog that do not fit into TOpenOptions. 2023-08-30 23:01:50 +02:00
Bart
b7d3481248 TaskDialog: TLCLTaskDialog:start implementing message TDM_UPDATE_ELEMENT_TEXT.
For now the new text must not bi higher than the old text, otherwise the text will be cut off.
2023-08-27 13:43:23 +02:00
Bart
a397741a99 TTaskDialog: Start implementing TTaskDialog.ProgressBar for emulated dialog. 2023-08-25 19:12:26 +02:00
Bart
9e2aabba9d TTaskDialog: TTaskDialog.ProgressBar:
- FMin and FMax must be in range 0.High(Word).
- Adjust FPosition when setting range.
- Define const for default min/max instead of using magic numbers.
- Simplify SetMin/SetMax.
2023-08-25 18:47:43 +02:00
Bart
f596f54321 TTaskDialog: progress on TTaskDialog.ProgressBar: setting type, range, position, range and marqueespeed, now work for native Vista+ dialog. 2023-08-24 23:41:26 +02:00
Bart
8a60ec04de TTaskDialog: partially implemented TTaskDialogProgressBar.Initialize. 2023-08-23 15:23:43 +02:00
Bart
fe0ed266ce TTaskDialog: start implementing TTaskDialogProgressBar: skeleton only, does not communicate with the dialog yet. 2023-08-23 13:10:52 +02:00
Bart
cf5777a164 TTaskDialog: implement property Handle. Makes it possible to send messages to the dialog.
This is needed to implement e.g. progressbar and can be used to update on-the-fly the contents of the dialog.
2023-08-21 22:11:25 +02:00
Bart
7bf0a50a7b TTaskDialog: remove outdated comments. 2023-08-20 15:15:10 +02:00
Bart
ab5d084ade TTaskDialog: publish properties CustomFooterIcon and CustomMainIcon. 2023-08-20 14:54:50 +02:00
Bart
d7801adb2a TTaskDialog: implement CustomMainIcon and CustomFooterIcon, needed for flags tfUseHIconMain and tfUseHIconFooter respectively.
The flags now work on Windows Vista+ native dialog.
Partly resolves issue #40449.
2023-08-20 13:48:50 +02:00
Bart
0112fc4456 TaskDialog: add comments to TTaskDialogFlag definitions. 2023-08-17 19:05:30 +02:00
Bart
91052758c8 TaskDialog: fix typo in variable/propertyname (collaps -> collapse), as pointed out by Maxim. 2023-08-09 23:00:40 +02:00
Bart
70b158940e TaskDialog: implement OnNavigated (native Windows Vista+ only) and OnHelp.
While Delphi has DoOnHelp protected method, it seems they do not have OnHelp (GOKY).
2023-08-08 18:07:06 +02:00
Bart
892cf32728 TaskDialog: implement property CollapsButtonCaption.
Delphi does not have this, but the Windows TaskDialogIndirect API has it.
It controls the text next to the Expand/Collaps button if the dialog is in expanded state.
2023-08-07 22:05:30 +02:00
Bart
396b72b21a TaskDialog: handle the paramters in DoOnExpandButtonClicked and DoOnVerificationClicked.
Rename event OnExpand to OnExpanded, as it is in Delphi.
2023-08-03 23:06:20 +02:00
Bart
a0e0744618 TaskDialog: implement OnHyperlinkClicked and associated property URL. Native Vista+ dialog only. 2023-08-01 16:54:50 +02:00
Bart
b5f0aca3ea TaskDialog: use DoOnXXX methods to call the event handlers.
Also rename some methods of LCLTaskDialog for a bit more consistency.
2023-08-01 16:39:53 +02:00
Bart
d31e76a1f6 TaskDialog: implement OnRadioButtonClicked event. 2023-08-01 15:54:34 +02:00
Bart
70a178c88e TaskDialog: add OnTimer event. 2023-08-01 11:44:25 +02:00
Bart
213b32e0c7 TaskDialog: add OnExpand event (native Windows dialog only). 2023-08-01 11:06:26 +02:00
Bart
05c9e4aa76 TaskDialog: implement some Delphi compatible events:
- OnDialogConstructed
- OnDialogCreated
- OnDialogDestroyed
- OnVerificationClicked
Part of Issue #31399.
2023-07-31 17:52:11 +02:00
Bart
fff6152dde TaskDialog: start implementing CommandLinkHint property for TTaskDialog.Buttons.
For now only functional on Windows Vista+ (native dialog).
2023-07-31 14:42:13 +02:00
Bart
e259355d76 TTaskDialog: initial support for query capability (combobox or single line edit).
The implementation differs from the one in (now deprecated) LCLTaskDialog:
- the type of query is controlled by flags only (which are mutually exclusive)
- for single line edit, you can set passwordchar
- intial value of single line query has no influence on combobox
- initial value of combobox is controlled by integer value, not by text
2023-07-27 00:05:09 +02:00
Bart
2722337e33 TTaskDialog: layout the initial infrastructure to add Query capability to TTaskDialog. 2023-07-26 16:13:50 +02:00
Bart
158f10e193 LCL: Dialogs unit: cleanup. 2023-07-24 22:27:09 +02:00
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