Commit Graph

22878 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
e1d2db658f Refactoring TTaskDialog: remove hack of exposing TCustomTaskDialog.FWidth. It was unneccessary to begin with... 2023-07-24 11:12:55 +02:00
Bart
b7cc27d3a5 Refactoring TTaskDialog:
- TWSTaskDialog.Execute: Don't cast ADlg to TTaskDialog.
- Adapt signature of function ExecuteLCLTaskDialog accordingly.
- Less debug output
2023-07-24 11:06:22 +02:00
Bart
c343cfe0d3 Refactoring TTaskDialog: remove some comments from TaskDialogEmulation unit. 2023-07-24 11:00:52 +02:00
Bart
80dc2c89b0 Refactoring TTaskDialog: undo all temprary changes in (now deprecated) LCLTaskDialog unit. 2023-07-24 10:58:20 +02:00
Bart
cc10035843 Refactoring TTaskDialog:
- Win32 WS: fix not returning ButtonID.
- Win32 WS: initialize RadioRes return value.
2023-07-24 10:52:11 +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
ca1e231417 Refactoring TTaskDialog:
- move procedure PrepareTaskDialogConfig to Execute, since it refrences variables on the stack
- move function DialogBaseUnits
- in callbackfunction only test if dwRefData is correct if a button is clicked, and only if assertions are enabled
- rename some nested procedures and variables
- less debug output
- TWin32WSTaskDialog.Execute now properly returns the result of TaskDialogIndirect
- use CommCtrl.TaskDialogIndirect, change the mechanisme of detecting wether this is supported.
2023-07-24 10:20:00 +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
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
b3995a78df Refactoring TTaskDialog: TLCLTaskDialog: rename 2 methods. No functional changes. 2023-07-22 15:43:38 +02:00
Bart
30ed531405 Refactoring TTaskDialog: TLCLTaskDialog: factor out AddLabel. 2023-07-22 15:39:34 +02:00
Bart
17fee115bf Refactoring TTaskDialog: TLCLTaskDialog: factor out AddFooter. 2023-07-22 10:48:11 +02:00
Bart
d9861e8170 Refactoring TTaskDialog: some refactoring and cleanup of TLCLTaskDialog. 2023-07-21 23:36:15 +02:00
Bart
677a73c38c Refactoring TTaskDialog: fix compilation of Dialogs unit on non-windows platforms. 2023-07-20 20:17:40 +02:00
Bart
9a3e5c120d Refactoring TTaskDialog:
- Change signature of TWSTaskDialog.Execute and related functions/methods so we can set ParentWnd and retrieve RadioRes.
The TLCLTaskDialog now should act the same as the old emulated version (unit LCLTaskDialog).
2023-07-20 20:09:38 +02:00
Bart
1420ce0a69 Refactoring TTaskDialog:
- Use meaningfull names for private vars of TLCLTaskDialog
- Factor out SetupPanel
- Consistent capitalization of "Result" ,"True" and "False"
- Remove property VerifyChecked, set appropriate flag instead
- More debugln statements
- Add some comments
The emulated dialog is now more or less functional (we don't return RadioResult yet).
2023-07-20 19:54:20 +02:00
Bart
0b9130a2a3 Refactoring TTaskDialog: refactor TaskDlgEmulation.TLCLTaskDialog.SetupControls. 2023-07-20 12:16:39 +02:00
Bart
c3c73c48fc Refactoring TTaskDialog:
- TWSTaskDialog.Execute: return integer (modal result of the dialog) instead of boolean
- Idem for related functions and methods
2023-07-20 10:55:48 +02:00
Bart
e1dd886c07 Refactoring TTaskDialog: initialize TaskDialogIndirect in Win32 widgetset.
Still not functional.
2023-07-19 19:54:19 +02:00
Bart
b163a35cb3 Refactoring TTaskDialog:
- Fix not displaying common buttons in TLCLTaskDialog.SetupControls
- Assign TLCLDialog.FDlg in the CreateNew() constructor.
- Free LDefaultFont
- Start comparing the new form vs the old form
Still not functional.
2023-07-19 19:43:35 +02:00
Bart
916196dede Refactoring TTaskDialog: prevent possible crash in TLCLTaskDialog. 2023-07-19 18:53:23 +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
32824af5fe TCustomTaskDialog: add a comment. 2023-07-17 14:01:35 +02:00
Bart
fc6bbcc936 TCustomTaskDialog: inherit form TLCLComponent and register the widgetset class. 2023-07-17 13:52:40 +02:00
Bart
6fb319fae8 WSDialogs: basic implementation of TWSTaskDialog.Execute. 2023-07-17 12:53:27 +02:00
Bart
9289be8936 Unit TaskDlgEmulation: cosmetic (no functional changes). 2023-07-17 12:49:49 +02:00
Bart
df338fd867 LCL: add TaskDlgEmulation unit (skeleton). 2023-07-17 12:48:02 +02:00
Bart
57e13c67d3 TWSTaskDialog: change signature of Execute method. Reason: TTaskDialog is not related to TCommonDialog.
Eventually we need to cast the parameter to TCustomTaskDialog in the Win32 implementation.
Because of the (Delhi compatible) signature of TTaskDialog.DoExcute, it seems that TCustomTaskDialog cannot
inherit from TCommonDialog, since this method (TCustomTaskDialog.DoExecute) must be dynamic, so it cannot
also be "override" as well.
2023-07-17 12:43:04 +02:00
Bart
cfbb089e1f TaskDialog: Start refactoring TTaskDialog: layout the basic infrastructure for a TWSTaskDialog class. 2023-07-17 11:05:33 +02:00
rich2014
b184a37dbe Cocoa: fix the issue that Modal Form may disappear when switching back from other apps
the issue fixed:
1. run your app, open Modal Form
2. switch to other apps
3. in the dock, right click your app ico and select "Show All Window", and select a window
4. the Modal Form is disappear (actually ordered behind the selected Form)
2023-07-16 23:00:29 +08:00
Juha
e4494cf4cd LCL-GTK2: Allow right-to-left selection of long text in TEdit with mouse. Issue #40379, patch by wavebvg. 2023-07-16 00:04:14 +03:00
rich2014
ebd0bf4135 Cocoa: Async call InputClientInsertText() for non-editable LCL CustomControl
in TCocoaCustomControl, such as Form, Grid, ListView, after inputting text, another control may be focused.
in insertText_replacementRange(), Cocoa/InputContext doesn't like it, so calling InputClientInsertText() asynchronously.
2023-07-16 00:02:06 +08:00
Juha
dca4378fae LCL-QT4: Clean and optimize function TQtWidgetSet.EnumDisplayMonitors(). By lagprogramming. 2023-07-15 13:08:51 +03:00
rich2014
185e72ea31 Cocoa: better handling of TCocoaWindow.makeFirstResponder() reentrancy 2023-07-14 21:05:41 +08:00
Maxim Ganetsky
255bdd2bb0 Revert "LCL: Add an option to NOT call TCheckbox OnChange handler when clicked. Issue #39870, patch by Arioch The."
This reverts commit 9f577dc548.

Reasons:
1. The logic of VCL_OnClick_Emulation flag (or its name) is wrong: when it is true, OnChange event gets called LCL-style (note that VCL does not have OnChange event).
2. Having such flag is unsafe: e.g. some used unit can disable it and checkboxes in the whole program will _silently_ change their behavior.
3. The code claimed as a reason for introducing this change does not work in Delphi too.

Such Delphi compatibility issues should be handled another way.
2023-07-14 03:00:19 +03:00
Juha
be92e362e8 LCL-QT[56]: Clean and optimise function TQtWidgetSet.EnumDisplayMonitors(). By lagprogramming. 2023-07-13 12:06:03 +03: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
mattias
c6200e29c8 lcl: TWinControl class completed 2023-07-12 11:35:47 +02:00
mattias
2dc7c77293 lcl: clean hostdocksite 2023-07-12 11:35:47 +02:00
Maxim Ganetsky
0f522e8d81 Removed unit UITypes from LazUtils. Use System.UITypes instead. Try 2. 2023-07-12 01:41:51 +03:00
mattias
c423a794b5 lazutils: added TPointArray to graphtype, added EllipsePolygon to GraphMath 2023-07-10 23:19:21 +02:00
mattias
626a74fd13 lcl: TGtk2WidgetSet.CreateEllipticRgn: fixed vertical radius 2023-07-10 16:11:32 +02:00
mattias
79cff8a8f3 lcl: TGtk2WidgetSet.CreateEllipticRgn: using symmetrical coords with less edges for a smoother ellipsis 2023-07-10 15:42:13 +02:00
Maxim Ganetsky
1a61c0469e Translations: Spanish translation update by Alonso Cárdenas, issue #40370 2023-07-09 16:12:41 +03:00