diff --git a/components/jvcllaz/examples/JvXPBar/MainFrm.lfm b/components/jvcllaz/examples/JvXPBar/MainFrm.lfm index a218d6bf6..bda047e83 100644 --- a/components/jvcllaz/examples/JvXPBar/MainFrm.lfm +++ b/components/jvcllaz/examples/JvXPBar/MainFrm.lfm @@ -21,52 +21,48 @@ object frmMain: TfrmMain Top = 0 Width = 4 end - object cntWinXPBar: TGroupBox + object cntWinXPBar: TJvXPContainer Left = 0 Height = 441 Top = 0 Width = 206 - Align = alLeft + BoundLines = [blLeft, blTop, blRight, blBottom] Caption = 'cntWinXPBar' - ClientHeight = 421 - ClientWidth = 202 Color = 14985086 ParentColor = False - TabOrder = 1 + Align = alLeft object sbxWinXPBar: TScrollBox - Left = 0 - Height = 421 - Top = 0 - Width = 202 + Left = 1 + Height = 439 + Top = 1 + Width = 204 HorzScrollBar.Increment = 13 - HorzScrollBar.Page = 133 + HorzScrollBar.Page = 137 HorzScrollBar.Smooth = True HorzScrollBar.Tracking = True - VertScrollBar.Increment = 26 - VertScrollBar.Page = 263 + VertScrollBar.Increment = 25 + VertScrollBar.Page = 251 VertScrollBar.Smooth = True VertScrollBar.Tracking = True Align = alClient BorderStyle = bsNone - ClientHeight = 421 - ClientWidth = 202 + ClientHeight = 439 + ClientWidth = 204 TabOrder = 0 - object JvXPContainer1: TGroupBox + object JvXPContainer1: TJvXPContainer Left = 0 - Height = 263 + Height = 251 Top = 0 - Width = 202 - Align = alTop + Width = 204 AutoSize = True + BorderWidth = 4 Caption = 'JvXPContainer1' - ClientHeight = 243 - ClientWidth = 198 - TabOrder = 0 + Align = alTop object dxWinXPBar4: TJvXPBar - Left = 0 + Left = 4 Height = 35 - Top = 208 - Width = 198 + Top = 212 + Width = 196 Caption = 'Structure' Collapsed = True Colors.BorderColor = 9845 @@ -113,7 +109,7 @@ object frmMain: TfrmMain Left = 4 Height = 0 Top = 33 - Width = 190 + Width = 188 Align = alClient BorderStyle = bsNone ExpandSignSize = 16 @@ -123,11 +119,11 @@ object frmMain: TfrmMain end end object JvXPBar1: TJvXPBar - Left = 0 + Left = 4 Height = 35 Hint = 'This bar doesn''t use actions' - Top = 138 - Width = 198 + Top = 142 + Width = 196 Caption = 'Synchronize' Collapsed = True Colors.BorderColor = clMaroon @@ -159,11 +155,11 @@ object frmMain: TfrmMain ParentFont = False end object dxWinXPBar3: TJvXPBar - Left = 0 + Left = 4 Height = 35 Hint = 'This is a hint' - Top = 173 - Width = 198 + Top = 177 + Width = 196 Caption = 'Information' Collapsed = True Colors.BorderColor = clGray @@ -197,10 +193,10 @@ object frmMain: TfrmMain ParentFont = False end object dxWinXPBar2: TJvXPBar - Left = 0 + Left = 4 Height = 35 - Top = 103 - Width = 198 + Top = 107 + Width = 196 Caption = 'Settings' Collapsed = True Colors.BorderColor = clBtnShadow @@ -229,11 +225,11 @@ object frmMain: TfrmMain ParentFont = False end object dxWinXPBar1: TJvXPBar - Left = 0 + Left = 4 Height = 103 Hint = 'Click to see connection options' - Top = 0 - Width = 198 + Top = 4 + Width = 196 Caption = 'Connect' Colors.GradientTo = 16244694 Items = < @@ -267,18 +263,16 @@ object frmMain: TfrmMain end end end - object cntDetails: TGroupBox + object cntDetails: TJvXPContainer Left = 210 Height = 441 Top = 0 Width = 290 - Align = alClient + BoundLines = [blLeft, blTop, blRight, blBottom] Caption = 'cntDetails' - ClientHeight = 421 - ClientWidth = 286 Color = clInfoBk ParentColor = False - TabOrder = 2 + Align = alClient object lbWelcome: TLabel Left = 8 Height = 15 diff --git a/components/jvcllaz/examples/JvXPBar/MainFrm.pas b/components/jvcllaz/examples/JvXPBar/MainFrm.pas index def94682b..d283ecc7d 100644 --- a/components/jvcllaz/examples/JvXPBar/MainFrm.pas +++ b/components/jvcllaz/examples/JvXPBar/MainFrm.pas @@ -5,9 +5,8 @@ unit MainFrm; interface uses - //Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, - Dialogs, JvXPCore, JvXPBar, {JvXPContainer, }ImgList, ActnList, ExtCtrls, + Dialogs, JvXPCore, JvXPBar, JvXPContainer, ImgList, ActnList, ExtCtrls, StdCtrls, ComCtrls, JvExControls, JvComponent {, JvXPCheckCtrls, JvXPButtons} ; @@ -30,8 +29,8 @@ type acSynchronizeWeb: TAction; btnCollapseAll: TButton; // was: TJvXPButton; btnExpandAll: TButton; // was: TJvXPButton; - cntDetails: TGroupbox; // was: JvXPContainer; - cntWinXPBar: TGroupbox; // was: TJvXPContainer; + cntDetails: TJvXPContainer; + cntWinXPBar: TJvXPContainer; imlWinXPBar: TImageList; lbWelcome: TLabel; sbxWinXPBar: TScrollBox; @@ -47,7 +46,7 @@ type acHelp: TAction; acHowDoI: TAction; acCommonQuestions: TAction; - JvXPContainer1: TGroupbox; // was. TJvXPContainer; + JvXPContainer1: TJvXPContainer; dxWinXPBar4: TJvXPBar; JvXPBar1: TJvXPBar; dxWinXPBar3: TJvXPBar; diff --git a/components/jvcllaz/packages/JvXPBarLaz.lpk b/components/jvcllaz/packages/JvXPBarLaz.lpk index adcc76ce9..7e5327502 100644 --- a/components/jvcllaz/packages/JvXPBarLaz.lpk +++ b/components/jvcllaz/packages/JvXPBarLaz.lpk @@ -24,7 +24,7 @@ "/> - + @@ -42,6 +42,10 @@ + + + + diff --git a/components/jvcllaz/packages/JvXPBarLaz.pas b/components/jvcllaz/packages/JvXPBarLaz.pas index ed3918bf0..f1721aa03 100644 --- a/components/jvcllaz/packages/JvXPBarLaz.pas +++ b/components/jvcllaz/packages/JvXPBarLaz.pas @@ -8,7 +8,8 @@ unit JvXPBarLaz; interface uses - JvXPCoreUtils, JvXPBar, JvXPCore, JvXPBarReg, LazarusPackageIntf; + JvXPCoreUtils, JvXPBar, JvXPCore, JvXPBarReg, JvXPContainer, + LazarusPackageIntf; implementation diff --git a/components/jvcllaz/packages/JvXPBarReg.pp b/components/jvcllaz/packages/JvXPBarReg.pp index 6b9df86b0..b7071b144 100644 --- a/components/jvcllaz/packages/JvXPBarReg.pp +++ b/components/jvcllaz/packages/JvXPBarReg.pp @@ -10,11 +10,13 @@ uses procedure Register; implementation -uses JvXPBar; + +uses + JvXPBar, JvXPContainer; procedure Register; begin - RegisterComponents('JvXP',[TJvXPBar]); + RegisterComponents('JvXP',[TJvXPBar, TJvXPContainer]); end; initialization diff --git a/components/jvcllaz/resource/JvXPBarLaz.lrs b/components/jvcllaz/resource/JvXPBarLaz.lrs index 5bb5082e8..298aaf2ba 100644 --- a/components/jvcllaz/resource/JvXPBarLaz.lrs +++ b/components/jvcllaz/resource/JvXPBarLaz.lrs @@ -1,4 +1,4 @@ -LazarusResources.Add('TJVXPBAR','BMP',[ +LazarusResources.Add('TJvXPBar','BMP',[ 'BM'#246#6#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#24#0#0#0#24#0#0#0#1#0#24#0#0#0#0#0 +#192#6#0#0#18#11#0#0#18#11#0#0#0#0#0#0#0#0#0#0#192#0#224#0#224#192#0#224#192 +#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224 @@ -77,3 +77,78 @@ LazarusResources.Add('TJVXPBAR','BMP',[ +#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0 +#224#224#0#224#224#0#224#224#0#224#224#0#224#192#0#224#192#0#224#192 ]); +LazarusResources.Add('TJvXPContainer','BMP',[ + 'BM'#246#6#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#24#0#0#0#24#0#0#0#1#0#24#0#0#0#0#0 + +#192#6#0#0#18#11#0#0#18#11#0#0#0#0#0#0#0#0#0#0#192#0#224#0#224#192#0#224#192 + +#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224 + +#192#0#224#192#0#224#192#0#224#160#0#224#160#0#224#160#255#255#0#255#0#0#255 + +#0#0#255#0#0#255#0#0#255#0#0#255#0#0#255#0#0#0#224#192#0#0#0#0#0#0#0#0#0#0#0 + +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#224#192#0#0#0#0#0#0#0#0#0#0#224#192#0#224#160#0 + +#0#0#255#255#0#255#0#0#255#0#0#0#255#255#0#255#255#255#0#0#255#0#0#255#0#0#0 + +#224#192#192#192#192#192#192#192#192#192#192#192#192#192#192#192#192#192#192 + +#192#192#192#192#192#192#192#0#224#192#0#0#0#0#224#192#0#224#192#0#0#0#0#224 + +#192#0#224#160#255#255#0#255#0#0#0#255#255#255#0#0#255#0#0#0#255#255#255#0#0 + +#255#0#0#0#224#224#128#128#128#128#128#128#128#128#128#128#128#128#128#128 + +#128#128#128#128#128#128#128#128#128#128#0#224#192#0#0#0#0#224#192#0#224#192 + +#0#0#0#0#224#192#0#224#192#255#255#0#255#0#0#0#255#255#255#0#0#255#0#0#0#255 + +#255#255#0#0#255#0#0#0#224#224#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0 + +#0#0#224#192#0#0#0#0#0#0#0#0#0#0#224#192#0#224#192#0#0#0#255#255#0#255#0#0 + +#255#0#0#255#0#0#255#0#0#0#255#255#255#0#0#255#0#0#0#224#224#0#224#224#0#224 + +#224#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0 + +#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#255#255#0#255#0#0 + +#255#0#0#255#0#0#255#0#0#0#255#255#255#0#0#255#0#0#0#224#224#0#224#224#0#224 + +#224#0#224#224#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0 + +#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#255#255#0#255#0#0 + +#255#0#0#255#0#0#255#0#0#0#255#255#255#0#0#255#0#0#0#224#224#0#0#0#0#0#0#0 + +#224#224#0#0#0#0#224#192#0#0#0#0#224#192#0#0#0#0#224#192#0#0#0#0#224#192#0#0 + +#0#0#224#192#0#0#0#0#224#192#255#255#0#255#0#0#255#0#0#255#0#0#255#0#0#255#0 + +#0#255#0#0#255#0#0#0#224#224#0#0#0#0#224#224#0#224#224#0#224#224#0#224#224#0 + +#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224 + +#192#0#224#192#0#224#192#255#255#0#255#255#0#255#255#0#255#255#0#255#255#0 + +#255#255#0#255#255#0#255#255#0#0#224#224#0#224#224#0#224#224#0#224#224#0#224 + +#224#0#224#224#0#0#0#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224 + +#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0 + +#224#192#0#224#160#0#0#0#0#224#160#0#224#224#0#0#0#0#224#224#0#224#224#0#224 + +#224#0#224#224#0#224#224#0#224#224#0#224#192#0#224#192#0#224#192#0#224#192#0 + +#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224 + +#192#0#224#192#0#224#192#0#224#160#0#224#160#0#224#224#0#224#224#0#224#224#0 + +#224#224#0#224#224#0#224#224#0#0#0#0#224#224#0#224#224#0#224#192#0#224#192#0 + +#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224 + +#192#0#224#192#0#224#192#0#224#192#0#0#0#0#224#160#0#224#224#0#0#0#0#224#224 + +#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224 + +#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0 + +#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#224#0#224 + +#224#0#224#224#0#224#224#0#224#224#0#224#224#0#0#0#0#224#224#0#224#224#0#224 + +#224#0#224#224#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0 + +#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#0#0#0#224#192#0#224#224#0 + +#0#0#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0 + +#224#224#0#224#224#0#224#224#0#224#192#0#224#192#0#224#192#0#224#192#0#224 + +#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0 + +#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#0#0#0#224#224#0 + +#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#192#0#224#192#0#224 + +#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#0#0#0#224 + +#192#0#224#224#0#0#0#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224 + +#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#192#0 + +#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224 + +#192#0#224#192#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0 + +#0#0#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0 + +#224#224#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0#224 + +#192#0#0#0#0#224#192#0#224#224#0#0#0#0#224#224#0#224#224#0#224#224#0#224#224 + +#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224 + +#224#0#224#224#0#224#224#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0 + +#224#192#0#224#192#0#224#192#0#224#224#0#224#224#0#0#0#0#224#224#0#0#0#0#224 + +#224#0#0#0#0#224#224#0#0#0#0#224#224#0#0#0#0#224#224#0#0#0#0#224#224#0#0#0#0 + +#224#224#0#0#0#0#224#192#0#0#0#0#224#192#0#0#0#0#224#192#0#0#0#0#224#192#0 + +#224#224#0#0#0#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0 + +#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224 + +#224#0#224#224#0#224#224#0#224#192#0#224#192#0#224#192#0#224#192#0#224#192#0 + ,#224#192#0#192#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#0#0#0 + +#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224 + +#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#192#0#224#192#0#224#192#0 + +#0#0#0#224#192#0#192#224#0#0#0#0#224#224#0#0#0#0#224#224#0#0#0#0#224#224#0#0 + +#0#0#224#224#0#0#0#0#224#224#0#0#0#0#224#224#0#0#0#0#224#224#0#0#0#0#224#224 + +#0#0#0#0#224#224#0#0#0#0#224#192#0#0#0#0#0#0#0#224#192#0#192#224#0#192#224#0 + +#192#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224 + +#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0#224#224#0 + +#224#224#0#224#224#0#224#224#0#224#224#0#224#192#0#224#192#0#224#192 +]); diff --git a/components/jvcllaz/run/JvXPContainer.pas b/components/jvcllaz/run/JvXPContainer.pas new file mode 100644 index 000000000..44f5af5dc --- /dev/null +++ b/components/jvcllaz/run/JvXPContainer.pas @@ -0,0 +1,457 @@ +{----------------------------------------------------------------------------- +The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/MPL-1.1.html + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for +the specific language governing rights and limitations under the License. + +The Original Code is: JvXPContainer.PAS, released on 2004-01-01. + +The Initial Developer of the Original Code is Marc Hoffman. +Portions created by Marc Hoffman are Copyright (C) 2002 APRIORI business solutions AG. +Portions created by APRIORI business solutions AG are Copyright (C) 2002 APRIORI business solutions AG +All Rights Reserved. + +Contributor(s): + +You may retrieve the latest version of this file at the Project JEDI's JVCL home page, +located at http://jvcl.sourceforge.net + +Known Issues: +-----------------------------------------------------------------------------} +// $Id: JvXPContainer.pas 11400 2007-06-28 21:24:06Z ahuser $ + +{ Ported to Lazarus by W.Pamler (2016-11-30) } + +{$mode objfpc}{$H+} + +unit JvXPContainer; + +interface + +uses + TypInfo, Classes, LCLIntf, LCLProc, LCLType, Controls, Graphics, StdCtrls, ExtCtrls, + JvXPCore, JvXPCoreUtils; + +type + TJvXPPaintEvent = procedure(Sender: TObject; Rect: TRect; ACanvas: TCanvas; + AFont: TFont) of object; + + TJvXPEnabledMode = (emAffectChilds, emNormal); + + TJvXPCustomContainer = class(TJvXPCustomControl) + private + FAlignment: TAlignment; + FBorderWidth: TBorderWidth; + FBoundColor: TColor; + FBoundLines: TJvXPBoundLines; + FEnabledMode: TJvXPEnabledMode; + FFocusable: Boolean; + FGlyph: TBitmap; + FGlyphLayout: TJvXPGlyphLayout; + FLayout: TTextLayout; + FShowBoundLines: Boolean; + FShowCaption: Boolean; + FSpacing: Byte; + FWordWrap: Boolean; + FOnEnabledChanged: TNotifyEvent; + FOnPaint: TJvXPPaintEvent; + procedure SetAlignment(Value: TAlignment); + procedure SetBorderWidth(Value: TBorderWidth); + procedure SetBoundColor(Value: TColor); + procedure SetBoundLines(Value: TJvXPBoundLines); + procedure SetEnabledMode(Value: TJvXPEnabledMode); + procedure SetGlyph(Value: TBitmap); + procedure SetGlyphLayout(Value: TJvXPGlyphLayout); + procedure SetLayout(Value: TTextLayout); + procedure SetShowBoundLines(Value: Boolean); + procedure SetShowCaption(Value: Boolean); + procedure SetSpacing(Value: Byte); + procedure SetWordWrap(Value: Boolean); + protected + procedure CreateParams(var Params: TCreateParams); override; + procedure AdjustClientRect(var Rect: TRect); override; + procedure HookEnabledChanged; override; + procedure HookMouseDown; override; + procedure HookPosChanged; override; + procedure Paint; override; + property Alignment: TAlignment read FAlignment write SetAlignment default taCenter; + property BorderWidth: TBorderWidth read FBorderWidth write SetBorderWidth default 0; + property BoundColor: TColor read FBoundColor write SetBoundColor default clGray; + property BoundLines: TJvXPBoundLines read FBoundLines write SetBoundLines default []; + property EnabledMode: TJvXPEnabledMode read FEnabledMode write SetEnabledMode default emNormal; + property Focusable: Boolean read FFocusable write FFocusable default False; + property Glyph: TBitmap read FGlyph write SetGlyph; + property GlyphLayout: TJvXPGlyphLayout read FGlyphLayout write SetGlyphLayout + default glCenter; + property Layout: TTextLayout read FLayout write SetLayout default tlCenter; + property Height default 41; + property ShowBoundLines: Boolean read FShowBoundLines write SetShowBoundLines + default True; + property ShowCaption: Boolean read FShowCaption write SetShowCaption + default False; + property Spacing: Byte read FSpacing write SetSpacing default 5; + property Width default 185; + property WordWrap: Boolean read FWordWrap write SetWordWrap default False; + property OnEnabledChanged: TNotifyEvent read FOnEnabledChanged write FOnEnabledChanged; + property OnPaint: TJvXPPaintEvent read FOnPaint write FOnPaint; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + end; + + TJvXPContainer = class(TJvXPCustomContainer) + published + property Alignment; + property AutoSize; + property BorderWidth; + property BoundColor; + property BoundLines; + property Caption; + property Color; + property Enabled; + property EnabledMode; + property Focusable; + property Glyph; + property GlyphLayout; + property Layout; + property ParentColor; + property ShowBoundLines; + property ShowCaption; + property Spacing; + property WordWrap; + property OnEnabledChanged; + property OnDblClick; + property OnPaint; + property OnResize; + + //property BevelInner; + //property BevelOuter; + //property BevelWidth; + //property BiDiMode; + //property Ctl3D; + //property DockSite; + //property ParentBiDiMode; + //property ParentCtl3D; + //property TabOrder; + //property TabStop; + //property UseDockManager default True; + property Align; + property Anchors; + //property AutoSize; + property Constraints; + property DragCursor; + property DragKind; +// property OnCanResize; -- wp + property DragMode; + //property Enabled; + property Font; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ShowHint; + property Visible; + //property OnDockDrop; + //property OnDockOver; + //property OnEndDock; + //property OnGetSiteInfo; + //property OnStartDock; + //property OnUnDock; + property OnClick; + property OnConstrainedResize; + property OnContextPopup; + property OnDragDrop; + property OnDragOver; + property OnEndDrag; + property OnEnter; + property OnExit; + property OnKeyDown; + property OnKeyPress; + property OnKeyUp; + property OnMouseDown; + property OnMouseEnter; + property OnMouseLeave; + property OnMouseMove; + property OnMouseUp; + property OnStartDrag; + end; + + +implementation + +//=== { TJvXPCustomContainer } =============================================== + +constructor TJvXPCustomContainer.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + ControlStyle := ControlStyle + [csAcceptsControls]; + Height := 41; + Width := 185; + FAlignment := taCenter; + FBoundColor := clGray; + FBoundLines := []; + FEnabledMode := emNormal; + FFocusable := False; + FGlyph := TBitmap.Create; + FGlyph.Assign(nil); + FGlyphLayout := glCenter; + FLayout := tlCenter; + FShowBoundLines := True; + FShowCaption := False; + FSpacing := 5; + FWordWrap := False; +end; + +destructor TJvXPCustomContainer.Destroy; +begin + FGlyph.Free; + inherited Destroy; +end; + + +procedure TJvXPCustomContainer.CreateParams(var Params: TCreateParams); +begin + inherited CreateParams(Params); + with Params do + WindowClass.Style := WindowClass.Style and not (CS_HREDRAW or CS_VREDRAW); +end; + + +procedure TJvXPCustomContainer.HookEnabledChanged; +var + I: Integer; +begin + inherited HookEnabledChanged; + if FEnabledMode = emAffectChilds then + for I := 0 to ControlCount - 1 do + Controls[I].Enabled := Enabled; + if Assigned(FOnEnabledChanged) then + FOnEnabledChanged(Self); +end; + +procedure TJvXPCustomContainer.HookMouseDown; +begin + if FFocusable then + inherited HookMouseDown + else + begin + DrawState := DrawState + [dsClicked]; + InternalRedraw; + end; +end; + +procedure TJvXPCustomContainer.HookPosChanged; +begin + inherited HookPosChanged; + InternalRedraw; +end; + +procedure TJvXPCustomContainer.AdjustClientRect(var Rect: TRect); +begin + inherited AdjustClientRect(Rect); + JvXPAdjustBoundRect(BorderWidth, FShowBoundLines, FBoundLines, Rect); + if not FGlyph.Empty then + Inc(Rect.Left, FGlyph.Width); +end; + +procedure TJvXPCustomContainer.SetAlignment(Value: TAlignment); +begin + if Value <> FAlignment then + begin + FAlignment := Value; + InternalRedraw; + end; +end; + +procedure TJvXPCustomContainer.SetBoundColor(Value: TColor); +begin + if Value <> FBoundColor then + begin + FBoundColor := Value; + InternalRedraw; + end; +end; + +procedure TJvXPCustomContainer.SetBoundLines(Value: TJvXPBoundLines); +begin + if Value <> FBoundLines then + begin + FBoundLines := Value; + Realign; + InternalRedraw; + end; +end; + +procedure TJvXPCustomContainer.SetBorderWidth(Value: TBorderWidth); +begin + if Value <> FBorderWidth then + begin + FBorderWidth := Value; + Realign; + InternalRedraw; + end; +end; + +procedure TJvXPCustomContainer.SetEnabledMode(Value: TJvXPEnabledMode); +begin + if Value <> FEnabledMode then + begin + FEnabledMode := Value; + HookEnabledChanged; + end; +end; + +procedure TJvXPCustomContainer.SetGlyph(Value: TBitmap); +begin + if Value <> FGlyph then + begin + FGlyph.Assign(Value); + Realign; + InternalRedraw; + end; +end; + +procedure TJvXPCustomContainer.SetGlyphLayout(Value: TJvXPGlyphLayout); +begin + if FGlyphLayout <> Value then + begin + FGlyphLayout := Value; + InternalRedraw; + end; +end; + +procedure TJvXPCustomContainer.SetLayout(Value: TTextLayout); +begin + if FLayout <> Value then + begin + FLayout := Value; + InternalRedraw; + end; +end; + +procedure TJvXPCustomContainer.SetShowBoundLines(Value: Boolean); +begin + if Value <> FShowBoundLines then + begin + FShowBoundLines := Value; + Realign; + InternalRedraw; + end; +end; + +procedure TJvXPCustomContainer.SetShowCaption(Value: Boolean); +begin + if Value <> FShowCaption then + begin + FShowCaption := Value; + InternalRedraw; + end; +end; + +procedure TJvXPCustomContainer.SetSpacing(Value: Byte); +begin + if Value <> FSpacing then + begin + FSpacing := Value; + InternalRedraw; + end; +end; + +procedure TJvXPCustomContainer.SetWordWrap(Value: Boolean); +begin + if Value <> FWordWrap then + begin + FWordWrap := Value; + InternalRedraw; + end; +end; + +procedure DxDrawText(AParent: TJvXPCustomControl; ACaption: TCaption; AFont: TFont; + AAlignment: TAlignment; ALayout: TTextLayout; AWordWrap: Boolean; var ARect: TRect); +const + Alignments: array [TAlignment] of Word = (DT_LEFT, DT_RIGHT, DT_CENTER); + WordWraps: array [Boolean] of Word = (0, DT_WORDBREAK); +var + DrawStyle: Longint; + CalcRect: TRect; + + procedure DoDrawText(ACanvas: TCanvas; const ACaption: TCaption; var ARect: TRect; + AFlags: Integer); + begin + // (rom) Kludge! This will probably not work for CLX + DrawText(ACanvas.Handle, PChar(ACaption), -1, ARect, AFlags); + end; + +begin + with AParent, Canvas do + begin + DrawStyle := Alignments[AAlignment]; + if (DrawStyle <> DT_LEFT) and (ARect.Right - ARect.Left < TextWidth(ACaption)) then + DrawStyle := DT_LEFT; + DrawStyle := DrawStyle or DT_EXPANDTABS or WordWraps[AWordWrap] or DT_END_ELLIPSIS; + if ALayout <> tlTop then + begin + CalcRect := ARect; + DoDrawText(Canvas, ACaption, CalcRect, DrawStyle or DT_CALCRECT); + if ALayout = tlBottom then + OffsetRect(ARect, 0, ARect.Bottom - CalcRect.Bottom) + else + OffsetRect(ARect, 0, (ARect.Bottom - CalcRect.Bottom) div 2); + end; + DoDrawText(Canvas, ACaption, ARect, DrawStyle); + end; +end; + +procedure TJvXPCustomContainer.Paint; +var + Rect: TRect; +begin + with Canvas do + begin + Rect := GetClientRect; + Brush.Color := Self.Color; + FillRect(Rect); + if csDesigning in ComponentState then + DrawFocusRect(Rect); + Brush.Style := bsClear; + if (FShowBoundLines) and (FBoundLines <> []) then + JvXPDrawBoundLines(Self.Canvas, FBoundLines, FBoundColor, Rect); + JvXPAdjustBoundRect(BorderWidth, FShowBoundLines, FBoundLines, Rect); + if Assigned(FOnPaint) then + FOnPaint(Self, Rect, Self.Canvas, Font); + if not FGlyph.Empty then + begin + FGlyph.Transparent := True; + if FGlyphLayout = glBottom then + Draw(Rect.Left, Rect.Bottom - FGlyph.Height, FGlyph); + if FGlyphLayout = glCenter then + Draw(Rect.Left, ((Rect.Bottom - Rect.Top) - FGlyph.Height) div 2 + 1, FGlyph); + if FGlyphLayout = glTop then + Draw(Rect.Left, Rect.Top, FGlyph); + Inc(Rect.Left, FGlyph.Width); + end; + if FShowCaption then + begin + Font.Assign(Self.Font); + InflateRect(Rect, -FSpacing, -1); + if csDesigning in ComponentState then + begin + Pen.Color := clGray; + Pen.Style := psSolid; + MoveTo(Rect.Left, Rect.Top); + LineTo(Rect.Left, Rect.Bottom); + MoveTo(Rect.Right, Rect.Top); + LineTo(Rect.Right, Rect.Bottom); + end; + DxDrawText(Self, Caption, Font, FAlignment, FLayout, FWordWrap, Rect); + //JvXPPlaceText(Self, Canvas, Caption, Font, Enabled, False, FAlignment, + // FWordWrap, Rect); + end; + end; +end; + + +end. diff --git a/components/jvcllaz/run/JvXPCore.pas b/components/jvcllaz/run/JvXPCore.pas index e12aa6ec7..5e6ae0efd 100644 --- a/components/jvcllaz/run/JvXPCore.pas +++ b/components/jvcllaz/run/JvXPCore.pas @@ -74,7 +74,9 @@ const type TJvXPCustomStyleControl = class; + ******************** NOT CONVERTED *) +type TJvXPBoundLines = set of ( blLeft, // left line @@ -82,9 +84,7 @@ type blRight, // right line blBottom // bottom line ); -******************** NOT CONVERTED *) -type TJvXPControlStyle = set of ( csRedrawCaptionChanged, // (default) @@ -111,7 +111,6 @@ type dsFocused // focused ); -(******************** NOT CONVERTED TJvXPGlyphLayout = ( glBottom, // bottom glyph @@ -119,6 +118,7 @@ type glTop // top glyph ); + (******************** NOT CONVERTED TJvXPTheme = ( WindowsXP, // WindowsXP theme diff --git a/components/jvcllaz/run/JvXPCoreUtils.pas b/components/jvcllaz/run/JvXPCoreUtils.pas index 7aed02eb3..7f86684d7 100644 --- a/components/jvcllaz/run/JvXPCoreUtils.pas +++ b/components/jvcllaz/run/JvXPCoreUtils.pas @@ -40,15 +40,16 @@ uses function JvXPMethodsEqual(const Method1, Method2: TMethod): Boolean; procedure JvXPDrawLine(const ACanvas: TCanvas; const X1, Y1, X2, Y2: Integer); -(******************** NOT CONVERTED - NOT USED -procedure JvXPCreateGradientRect(const AWidth, AHeight: Integer; const StartColor, - EndColor: TColor; const AColors: TJvXPGradientColors; const Style: TJvXPGradientStyle; - const Dithered: Boolean; var Bitmap: TBitmap); procedure JvXPAdjustBoundRect(const BorderWidth: Byte; const ShowBoundLines: Boolean; const BoundLines: TJvXPBoundLines; var Rect: TRect); procedure JvXPDrawBoundLines(const ACanvas: TCanvas; const BoundLines: TJvXPBoundLines; const AColor: TColor; const Rect: TRect); +(******************** NOT CONVERTED - NOT USED +procedure JvXPCreateGradientRect(const AWidth, AHeight: Integer; const StartColor, + EndColor: TColor; const AColors: TJvXPGradientColors; const Style: TJvXPGradientStyle; + const Dithered: Boolean; var Bitmap: TBitmap); + // // attic! // @@ -233,7 +234,6 @@ begin end; end; -(******************** NOT CONVERTED - NOT USED procedure JvXPAdjustBoundRect(const BorderWidth: Byte; const ShowBoundLines: Boolean; const BoundLines: TJvXPBoundLines; var Rect: TRect); @@ -269,6 +269,7 @@ begin end; end; +(******************** NOT CONVERTED - NOT USED // // attic //