BidiCtrls.pas 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. unit BidiCtrls;
  2. {
  3. Inno Setup
  4. Copyright (C) 1997-2025 Jordan Russell
  5. Portions by Martijn Laan
  6. For conditions of distribution and use, see LICENSE.TXT.
  7. Previously this unit had RTL-capable versions of standard controls
  8. But now standard controls are RTL-capable already, and there's not much code left here
  9. }
  10. interface
  11. uses
  12. Windows, SysUtils, Messages, Classes, Graphics, Controls, Forms, Dialogs,
  13. StdCtrls, ExtCtrls;
  14. type
  15. TNewEdit = class(TEdit);
  16. TNewMemo = class(TMemo);
  17. TNewComboBox = class(TComboBox);
  18. TNewListBox = class(TListBox);
  19. TNewButton = class(TButton)
  20. public
  21. function AdjustHeight: Integer;
  22. end;
  23. TNewCheckBox = class(TCheckBox);
  24. TNewRadioButton = class(TRadioButton);
  25. TNewLinkLabel = class(TLinkLabel)
  26. public
  27. function AdjustHeight: Integer;
  28. end;
  29. procedure Register;
  30. implementation
  31. uses
  32. CommCtrl;
  33. procedure Register;
  34. begin
  35. RegisterComponents('JR', [TNewEdit, TNewMemo, TNewComboBox, TNewListBox,
  36. TNewButton, TNewCheckBox, TNewRadioButton]);
  37. end;
  38. { TNewButton }
  39. function TNewButton.AdjustHeight: Integer;
  40. begin
  41. var OldHeight := Height;
  42. var IdealSize: TSize;
  43. IdealSize.cx := Width;
  44. IdealSize.cy := 0; { Not needed according to docs and tests, but clearing anyway }
  45. if SendMessage(Handle, BCM_GETIDEALSIZE, 0, LPARAM(@IdealSize)) <> 0 then begin
  46. Height := IdealSize.cy;
  47. Result := Height - OldHeight;
  48. end else
  49. Result := 0;
  50. end;
  51. { TNewLinkLabel }
  52. function TNewLinkLabel.AdjustHeight: Integer;
  53. begin
  54. var OldHeight := Height;
  55. var IdealSize: TSize;
  56. SendMessage(Handle, LM_GETIDEALSIZE, Width, LPARAM(@IdealSize));
  57. Height := IdealSize.cy;
  58. Result := Height - OldHeight;
  59. end;
  60. end.