MMCLRBTN.INT 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. {========================================================================}
  2. {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
  3. {========================================================================}
  4. {= All Rights Reserved =}
  5. {========================================================================}
  6. {= D 01099 Dresden = Tel.: +0351-8012255 =}
  7. {= Loewenstr.7a = info@swiftsoft.de =}
  8. {========================================================================}
  9. {= Actual versions on http://www.swiftsoft.de/mmtools.html =}
  10. {========================================================================}
  11. {= This code is for reference purposes only and may not be copied or =}
  12. {= distributed in any format electronic or otherwise except one copy =}
  13. {= for backup purposes. =}
  14. {= =}
  15. {= No Delphi Component Kit or Component individually or in a collection=}
  16. {= subclassed or otherwise from the code in this unit, or associated =}
  17. {= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
  18. {= without express permission from SwiftSoft. =}
  19. {= =}
  20. {= For more licence informations please refer to the associated =}
  21. {= HelpFile. =}
  22. {========================================================================}
  23. {= $Date: 20.01.1998 - 18:00:00 $ =}
  24. {========================================================================}
  25. unit MMClrBtn;
  26. {$I COMPILER.INC}
  27. interface
  28. uses
  29. {$IFDEF WIN32}
  30. Windows,
  31. {$ELSE}
  32. WinTypes,
  33. WinProcs,
  34. {$ENDIF}
  35. Graphics,
  36. Messages,
  37. StdCtrls,
  38. Classes,
  39. Controls,
  40. Dialogs,
  41. MMButton,
  42. MMObj,
  43. MMString;
  44. const
  45. GridRows = 5;
  46. GridCols = 4;
  47. GridCells = GridRows*GridCols;
  48. GridCellSize = 18;
  49. GridMargin = 3;
  50. GridWidth = GridCols * GridCellSize;
  51. PopupWidth = GridWidth + 2*GridMargin;
  52. GridHeight = GridRows * GridCellSize;
  53. CustomLeft = GridWidth-GridCellSize;
  54. DelimTop = GridHeight + GridMargin div 2;
  55. CustomTop = DelimTop + GridMargin div 2 + GridMargin;
  56. PopupHeight = CustomTop + GridCellSize + 2*GridMargin;
  57. MM_DROPCOLORDLG = WM_USER + 1;
  58. type
  59. {-- TMMColorSpeedButton --------------------------------------------------}
  60. TMMCustomColorButton= class;
  61. TMMColorSpeedButton = class(TMMSpeedButton)
  62. private
  63. function GetColorButton: TMMCustomColorButton;
  64. protected
  65. procedure Paint; override;
  66. procedure FocusLine(X1, Y1, X2, Y2: integer);
  67. procedure DrawColor(Canvas: TCanvas; const Rect: TRect);
  68. procedure DrawDelimiter(Canvas: TCanvas; Left, Top, Bottom: Integer);
  69. public
  70. property ColorButton: TMMCustomColorButton read GetColorButton;
  71. end;
  72. {-- TMMColorPopup --------------------------------------------------------}
  73. TMMColorPopUp = class(TMMCustomControl)
  74. public
  75. constructor Create(AOwner: TComponent); override;
  76. property ButtonCaption: string read GetButtonCaption write SetButtonCaption;
  77. end;
  78. {-- TMMCustomColorButton -------------------------------------------------}
  79. TMMCustomColorButton = class(TMMCustomControl)
  80. public
  81. constructor Create(AOwner: TComponent); override;
  82. destructor Destroy; override;
  83. protected
  84. property Width default 43;
  85. property Height default 21;
  86. property TabStop default True;
  87. property FocusColor: TColor read FFocusColor write SetFocusColor default clBlack;
  88. property Glyph: TBitmap read GetGlyph write SetGlyph;
  89. property NumGlyphs: Integer read GetNumGlyphs write SetNumGlyphs default 1;
  90. property Value: TColor read FValue write SetValue default clBlack;
  91. property CustomColors: TStrings read GetCustomColors write SetCustomColors;
  92. property ButtonCaption: string read FButtonCaption write SetButtonCaption;
  93. property ShowCurrent: Boolean read FShowCurrent write FShowCurrent default False;
  94. property OnChange: TNotifyEvent read FOnChange write FOnChange;
  95. end;
  96. {-- TMMColorButton -------------------------------------------------------}
  97. TMMColorButton = class(TMMCustomColorButton)
  98. published
  99. property Width;
  100. property Height;
  101. property TabStop;
  102. property TabOrder;
  103. property FocusColor;
  104. property Glyph;
  105. property NumGlyphs;
  106. property Value;
  107. property CustomColors;
  108. property ButtonCaption;
  109. property ShowCurrent;
  110. property OnChange;
  111. property Enabled;
  112. property Visible;
  113. end;
  114. implementation