mckCtrls.pas:
* some fixes * fixed crash in TKOLListView.SetupLast + TKOLListView.OnLVCustomDraw + TKOLMemo.Paint\WYSIWIGPaintImplemented add visual style for memo in designer mode mckCtrlDraw.pas: + ux visual style mode for some controls in designer mode (PaintType: ptWYSIWIG) alpha version!!! (WinXP minimum req.) git-svn-id: https://svn.code.sf.net/p/kolmck/code@137 91bb2d04-0c0c-4d2d-88a5-bbb6f4c1fa07
This commit is contained in:
386
mckCtrlDraw.pas
386
mckCtrlDraw.pas
@@ -1,214 +1,270 @@
|
|||||||
{
|
//by Roman Vorobets
|
||||||
by Roman Vorobets
|
//
|
||||||
|
// � mckCtrls y TKOLButton,TKOLLabel,TEditbox,TCheckBox � TRadioBox �y��� �������� �����
|
||||||
� mckCtrls y TKOLButton,TKOLLabel,TEditbox,TCheckBox � TRadioBox �y���
|
//
|
||||||
�������� �����
|
//TKOL#####=class(TKOLControl)
|
||||||
|
//...
|
||||||
TKOL#####=class(TKOLControl)
|
//protected
|
||||||
...
|
// procedure Paint;override;
|
||||||
protected
|
//...
|
||||||
procedure Paint;override;
|
//end;
|
||||||
...
|
//
|
||||||
end;
|
//...
|
||||||
|
//
|
||||||
...
|
//procedure TKOL#####.Paint;
|
||||||
|
//begin
|
||||||
procedure TKOL#####.Paint;
|
// Draw#####(self,canvas);
|
||||||
begin
|
//end;
|
||||||
Draw#####(self,canvas);
|
//dufa
|
||||||
end;
|
|
||||||
}
|
|
||||||
unit mckCtrlDraw;
|
unit mckCtrlDraw;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
windows, graphics, mirror, mckctrls, extctrls, classes;
|
Windows, Graphics, mirror, mckCtrls, ExtCtrls, Classes, Themes;
|
||||||
|
|
||||||
procedure DrawButton(_Button:TKOLButton; Canvas:TCanvas);
|
procedure DrawButton(Sender: TKOLButton; aCanvas: TCanvas);
|
||||||
procedure DrawLabel(_Label:TKOLLabel; Canvas:TCanvas);
|
procedure DrawEditBox(Sender: TKOLEditBox; aCanvas: TCanvas);
|
||||||
procedure DrawEditbox(_Editbox:TKOLEditbox; Canvas:TCanvas);
|
procedure DrawMemo(Sender: TKOLMemo; aCanvas: TCanvas);
|
||||||
procedure DrawCheckbox(_Checkbox:TKOLCheckbox; Canvas:TCanvas);
|
procedure DrawCheckbox(Sender: TKOLCheckbox; aCanvas: TCanvas);
|
||||||
procedure DrawRadiobox(_Radiobox:TKOLRadiobox; Canvas:TCanvas);
|
procedure DrawRadiobox(_Radiobox: TKOLRadiobox; Canvas: TCanvas);
|
||||||
procedure DrawCombobox(_Combobox:TKOLCombobox; Canvas:TCanvas);
|
procedure DrawCombobox(_Combobox: TKOLCombobox; Canvas: TCanvas);
|
||||||
|
procedure DrawLabel(_Label: TKOLLabel; Canvas: TCanvas);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
const
|
const
|
||||||
TextHFlags:array[TTextAlign] of dword=(DT_LEFT,DT_RIGHT,DT_CENTER);
|
TextHFlags: array[TTextAlign] of DWORD = (DT_LEFT, DT_RIGHT, DT_CENTER);
|
||||||
TextVFlags:array[TVerticalAlign] of dword=(DT_TOP,DT_VCENTER,DT_BOTTOM);
|
TextVFlags: array[TVerticalAlign] of DWORD = (DT_TOP, DT_VCENTER, DT_BOTTOM);
|
||||||
WordWrapFlags:array[Boolean] of dword=(DT_SINGLELINE,0);
|
WordWrapFlags: array[Boolean] of DWORD = (DT_SINGLELINE, 0);//!
|
||||||
CheckFlags:array[Boolean] of dword=(0,DFCS_CHECKED);
|
CheckFlags: array[Boolean] of DWORD = (0, DFCS_CHECKED);
|
||||||
|
|
||||||
procedure DrawButton(_Button:TKOLButton; Canvas:TCanvas);
|
procedure DrawButton(Sender: TKOLButton; aCanvas: TCanvas);
|
||||||
var
|
var
|
||||||
r:trect;
|
e: TThemedButton;
|
||||||
s:string;
|
d: TThemedElementDetails;
|
||||||
begin
|
begin
|
||||||
with _button,canvas do
|
// states
|
||||||
begin
|
if Sender.Enabled then begin
|
||||||
r:=clientrect;
|
if Sender.DefaultBtn then
|
||||||
s:=caption;
|
e := tbPushButtonDefaulted
|
||||||
drawframecontrol(handle,r,DFC_BUTTON,DFCS_BUTTONPUSH);
|
else
|
||||||
inflaterect(r,-1,-1);
|
e := tbPushButtonNormal
|
||||||
setbkmode(handle,windows.TRANSPARENT);
|
end else
|
||||||
drawtext(handle,pchar(s),length(s),r,texthflags[textalign] or
|
e := tbPushButtonDisabled;
|
||||||
textvflags[verticalalign] or DT_SINGLELINE);
|
// get element
|
||||||
end;
|
d := ThemeServices.GetElementDetails(e);
|
||||||
|
// draw element, text
|
||||||
|
ThemeServices.DrawElement(aCanvas.Handle, d, Sender.ClientRect, nil);
|
||||||
|
ThemeServices.DrawText(aCanvas.Handle, d, Sender.Caption, Sender.ClientRect,
|
||||||
|
TextHFlags[Sender.TextAlign] or TextVFlags[Sender.VerticalAlign] or DT_SINGLELINE, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DrawLabel(_Label:TKOLLabel; Canvas:TCanvas);
|
procedure DrawEditBox(Sender: TKOLEditBox; aCanvas: TCanvas);
|
||||||
var
|
var
|
||||||
r:trect;
|
e: TThemedEdit;
|
||||||
s:string;
|
d: TThemedElementDetails;
|
||||||
|
r: TRect;
|
||||||
|
DC: HDC;
|
||||||
|
dw: DWORD;
|
||||||
|
ss: AnsiString;
|
||||||
begin
|
begin
|
||||||
with _label,canvas do
|
// states
|
||||||
begin
|
if Sender.Enabled then
|
||||||
r:=clientrect;
|
e := teEditTextNormal
|
||||||
s:=caption;
|
else
|
||||||
brush.color:=clbtnshadow;
|
e := teEditTextDisabled;
|
||||||
|
// get element
|
||||||
|
d := ThemeServices.GetElementDetails(e);
|
||||||
|
// draw element
|
||||||
|
r := aCanvas.ClipRect;
|
||||||
|
DC := aCanvas.Handle;
|
||||||
|
ThemeServices.DrawElement(DC, d, r, nil);
|
||||||
|
// draw text
|
||||||
|
Inc(r.Left, 3);
|
||||||
|
Inc(r.Top, 3);
|
||||||
|
Dec(r.Right, 3);
|
||||||
|
Dec(r.Bottom, 3);
|
||||||
|
ss := Sender.Caption;
|
||||||
|
dw := Length(ss);
|
||||||
|
if (dw > 0) and (eoPassword in Sender.Options) then
|
||||||
|
FillChar(ss[1], dw, '*');
|
||||||
|
dw := TextHFlags[Sender.TextAlign] or DT_SINGLELINE;
|
||||||
|
ThemeServices.DrawText(DC, d, ss, r, dw, 0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DrawMemo(Sender: TKOLMemo; aCanvas: TCanvas);
|
||||||
|
var
|
||||||
|
e: TThemedEdit;
|
||||||
|
d: TThemedElementDetails;
|
||||||
|
r: TRect;
|
||||||
|
DC: HDC;
|
||||||
|
ws: WideString;
|
||||||
|
begin
|
||||||
|
// states
|
||||||
|
if Sender.Enabled then
|
||||||
|
e := teEditTextNormal
|
||||||
|
else
|
||||||
|
e := teEditTextDisabled;
|
||||||
|
// get element
|
||||||
|
d := ThemeServices.GetElementDetails(e);
|
||||||
|
// draw element
|
||||||
|
r := aCanvas.ClipRect;
|
||||||
|
DC := aCanvas.Handle;
|
||||||
|
ThemeServices.DrawElement(DC, d, r, nil);
|
||||||
|
// draw text
|
||||||
|
Inc(r.Left, 3);
|
||||||
|
Inc(r.Top, 3);
|
||||||
|
Dec(r.Right, 3);
|
||||||
|
Dec(r.Bottom, 3);
|
||||||
|
ws := Sender.Caption;
|
||||||
|
ThemeServices.DrawText(DC, d, ws, r, TextHFlags[Sender.TextAlign], 0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DrawLabel(_Label: TKOLLabel; Canvas: TCanvas);
|
||||||
|
var
|
||||||
|
r: trect;
|
||||||
|
s: string;
|
||||||
|
begin
|
||||||
|
with _Label, Canvas do begin
|
||||||
|
r := clientrect;
|
||||||
|
s := caption;
|
||||||
|
brush.color := clbtnshadow;
|
||||||
framerect(r);
|
framerect(r);
|
||||||
setbkmode(handle,windows.TRANSPARENT);
|
setbkmode(handle, windows.TRANSPARENT);
|
||||||
drawtext(handle,pchar(s),length(s),r,texthflags[textalign] or
|
drawtext(handle, pchar(s), length(s), r, TextHFlags[textalign] or TextVFlags[verticalalign] or WordWrapFlags[wordwrap]);
|
||||||
textvflags[verticalalign] or wordwrapflags[wordwrap]);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DrawEditbox(_Editbox:TKOLEditbox; Canvas:TCanvas);
|
procedure DrawCheckbox(Sender: TKOLCheckbox; aCanvas: TCanvas);
|
||||||
var
|
var
|
||||||
r:trect;
|
e: TThemedButton;
|
||||||
s:string;
|
d: TThemedElementDetails;
|
||||||
|
r: TRect;
|
||||||
|
rr: TRect;
|
||||||
|
DC: HDC;
|
||||||
|
ws: WideString;
|
||||||
begin
|
begin
|
||||||
with _editbox,canvas do
|
// states
|
||||||
begin
|
if Sender.Enabled then begin
|
||||||
r:=clientrect;
|
if Sender.Checked then
|
||||||
s:=caption;
|
e := tbCheckBoxCheckedNormal
|
||||||
if hasborder then
|
else
|
||||||
begin
|
e := tbCheckBoxUncheckedNormal
|
||||||
frame3d(canvas,r,clbtnshadow,clbtnhighlight,1);
|
end else begin
|
||||||
frame3d(canvas,r,clblack,cl3dlight,1);
|
if Sender.Checked then
|
||||||
end;
|
e := tbCheckBoxCheckedDisabled
|
||||||
setbkmode(handle,windows.TRANSPARENT);
|
else
|
||||||
drawtext(handle,pchar(s),length(s),r,
|
e := tbCheckBoxUncheckedDisabled
|
||||||
texthflags[textalign] or DT_SINGLELINE);
|
|
||||||
end;
|
end;
|
||||||
|
// get element
|
||||||
|
d := ThemeServices.GetElementDetails(e);
|
||||||
|
r := aCanvas.ClipRect;
|
||||||
|
DC := aCanvas.Handle;
|
||||||
|
// draw edge
|
||||||
|
aCanvas.FillRect(r);
|
||||||
|
if Sender.HasBorder then
|
||||||
|
ThemeServices.DrawEdge(DC, d, r, EDGE_RAISED, BF_RECT or BF_MIDDLE);
|
||||||
|
// draw element
|
||||||
|
rr := Bounds(-3, -3, 22, 22);
|
||||||
|
ThemeServices.DrawElement(DC, d, rr);
|
||||||
|
// draw text
|
||||||
|
Inc(r.Left, 18);
|
||||||
|
ws := Sender.Caption;
|
||||||
|
ThemeServices.DrawText(DC, d, ws, r, DT_LEFT, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DrawCheckbox(_Checkbox:TKOLCheckbox; Canvas:TCanvas);
|
procedure DrawRadiobox(_Radiobox: TKOLRadiobox; Canvas: TCanvas);
|
||||||
var
|
var
|
||||||
r,rr:trect;
|
r, rr: trect;
|
||||||
s:string;
|
s: string;
|
||||||
begin
|
begin
|
||||||
with _checkbox,canvas do
|
with _Radiobox, Canvas do begin
|
||||||
begin
|
r := clientrect;
|
||||||
r:=clientrect;
|
s := caption;
|
||||||
s:=caption;
|
|
||||||
|
|
||||||
{brush.color:=clbtnshadow;
|
{brush.color:=clbtnshadow;
|
||||||
framerect(r);}
|
framerect(r);}
|
||||||
if _Checkbox.HasBorder then
|
if _Radiobox.hasborder then
|
||||||
DrawEdge( Canvas.Handle, r, EDGE_RAISED, BF_RECT or BF_MIDDLE );
|
DrawEdge(Canvas.handle, r, EDGE_RAISED, BF_RECT or BF_MIDDLE);
|
||||||
|
|
||||||
rr:=bounds(r.left+2,(r.bottom+r.top-13) div 2,13,13);
|
rr := bounds(r.left + 2, (r.bottom + r.top - 13) div 2, 13, 13);
|
||||||
drawframecontrol(handle,rr,DFC_BUTTON,
|
drawframecontrol(handle, rr, DFC_BUTTON,
|
||||||
DFCS_BUTTONCHECK or checkflags[checked]);
|
DFCS_BUTTONRADIO or CheckFlags[checked]);
|
||||||
inc(r.left,17);
|
Inc(r.left, 17);
|
||||||
setbkmode(handle,windows.TRANSPARENT);
|
setbkmode(handle, windows.TRANSPARENT);
|
||||||
drawtext(handle,pchar(s),length(s),r,DT_VCENTER or DT_SINGLELINE);
|
drawtext(handle, pchar(s), length(s), r, DT_VCENTER or DT_SINGLELINE);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DrawRadiobox(_Radiobox:TKOLRadiobox; Canvas:TCanvas);
|
procedure DrawCombobox1(aCombobox: TKOLCombobox; aCanvas: TCanvas; r: trect);
|
||||||
var
|
var
|
||||||
r,rr:trect;
|
w: Integer;
|
||||||
s:string;
|
s: string;
|
||||||
|
dw: DWORD;
|
||||||
begin
|
begin
|
||||||
with _radiobox,canvas do
|
if (aCombobox.curindex >= 0) and (aCombobox.curindex < aCombobox.items.count) then
|
||||||
begin
|
s := aCombobox.items[aCombobox.curindex]
|
||||||
r:=clientrect;
|
else
|
||||||
s:=caption;
|
s := '';
|
||||||
|
if aCombobox.hasborder then begin
|
||||||
{brush.color:=clbtnshadow;
|
frame3d(aCanvas, r, clbtnshadow, clbtnhighlight, 1);
|
||||||
framerect(r);}
|
frame3d(aCanvas, r, clblack, cl3dlight, 1);
|
||||||
if _Radiobox.HasBorder then
|
end;
|
||||||
DrawEdge( Canvas.Handle, r, EDGE_RAISED, BF_RECT or BF_MIDDLE );
|
if not (coSimple in aCombobox.Options) then begin
|
||||||
|
w := getsystemmetrics(SM_CXVSCROLL);
|
||||||
rr:=bounds(r.left+2,(r.bottom+r.top-13) div 2,13,13);
|
dw := DFCS_SCROLLCOMBOBOX;
|
||||||
drawframecontrol(handle,rr,DFC_BUTTON,
|
if not aCombobox.Enabled then
|
||||||
DFCS_BUTTONRADIO or checkflags[checked]);
|
dw := dw or DFCS_INACTIVE;
|
||||||
inc(r.left,17);
|
DrawFrameControl(aCanvas.Handle, rect(r.right - w, r.top, r.right, r.bottom), DFC_SCROLL, dw);
|
||||||
setbkmode(handle,windows.TRANSPARENT);
|
Dec(r.right, w);
|
||||||
drawtext(handle,pchar(s),length(s),r,DT_VCENTER or DT_SINGLELINE);
|
end;
|
||||||
|
setbkmode(aCanvas.Handle, windows.TRANSPARENT);
|
||||||
|
if (s <> '') then begin
|
||||||
|
if aCombobox.Enabled then
|
||||||
|
aCanvas.Font.Color := clWindowText
|
||||||
|
else
|
||||||
|
aCanvas.Font.Color := clGrayText;
|
||||||
|
drawtext(aCanvas.Handle, pchar(s), length(s), r, DT_VCENTER or DT_SINGLELINE);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DrawCombobox1(_Combobox:TKOLCombobox; Canvas:TCanvas;
|
procedure DrawCombobox(_Combobox: TKOLCombobox; Canvas: TCanvas);
|
||||||
r: TRect);
|
|
||||||
var
|
var
|
||||||
w:integer;
|
r, R1: trect;
|
||||||
s:string;
|
Bot: Integer;
|
||||||
|
I: Integer;
|
||||||
|
s: string;
|
||||||
begin
|
begin
|
||||||
with _Combobox,canvas do
|
if coSimple in _Combobox.Options then begin
|
||||||
begin
|
r := _Combobox.clientrect;
|
||||||
if (curindex>=0) and (curindex<items.count) then s:=items[curindex] else
|
Bot := r.bottom;
|
||||||
s:='';
|
r.bottom := r.top + Canvas.TextHeight('A') + 8;
|
||||||
if hasborder then
|
DrawCombobox1(_Combobox, Canvas, r);
|
||||||
begin
|
r.top := r.bottom;
|
||||||
frame3d(canvas,r,clbtnshadow,clbtnhighlight,1);
|
r.bottom := Bot;
|
||||||
frame3d(canvas,r,clblack,cl3dlight,1);
|
frame3d(Canvas, r, clbtnshadow, clbtnhighlight, 1);
|
||||||
end;
|
frame3d(Canvas, r, clblack, cl3dlight, 1);
|
||||||
if not( coSimple in _Combobox.Options) then
|
Inc(r.left, 2);
|
||||||
begin
|
setbkmode(Canvas.handle, windows.TRANSPARENT);
|
||||||
w:=getsystemmetrics(SM_CXVSCROLL);
|
R1 := r;
|
||||||
drawframecontrol(handle,rect(r.right-w,r.top,r.right,r.bottom),DFC_SCROLL,
|
for I := 0 to _Combobox.items.count - 1 do begin
|
||||||
DFCS_SCROLLCOMBOBOX);
|
s := _Combobox.items[I];
|
||||||
dec(r.right,w);
|
R1.bottom := R1.top + Canvas.TextHeight('A') + 4;
|
||||||
end;
|
if R1.bottom > r.bottom then
|
||||||
setbkmode(handle,windows.TRANSPARENT);
|
R1.bottom := r.bottom;
|
||||||
if s<>'' then drawtext(handle,pchar(s),length(s),r,DT_VCENTER or
|
drawtext(Canvas.handle, pchar(s), length(s), R1,
|
||||||
DT_SINGLELINE);
|
{DT_VCENTER or}DT_SINGLELINE);
|
||||||
end;
|
R1.top := R1.bottom;
|
||||||
end;
|
if R1.top >= r.bottom then begin
|
||||||
|
r.left := r.right - getsystemmetrics(SM_CXVSCROLL);
|
||||||
procedure DrawCombobox(_Combobox:TKOLCombobox; Canvas:TCanvas);
|
|
||||||
var R, R1: TRect;
|
|
||||||
Bot: Integer;
|
|
||||||
I: Integer;
|
|
||||||
S: String;
|
|
||||||
begin
|
|
||||||
if coSimple in _Combobox.Options then
|
|
||||||
begin
|
|
||||||
R := _Combobox.ClientRect;
|
|
||||||
Bot := R.Bottom;
|
|
||||||
R.Bottom := R.Top + Canvas.TextHeight( 'A' ) + 8;
|
|
||||||
DrawCombobox1( _Combobox, Canvas, R );
|
|
||||||
R.Top := R.Bottom;
|
|
||||||
R.Bottom := Bot;
|
|
||||||
frame3d(Canvas,R,clbtnshadow,clbtnhighlight,1);
|
|
||||||
frame3d(Canvas,R,clblack,cl3dlight,1);
|
|
||||||
Inc( R.Left, 2 );
|
|
||||||
setbkmode(Canvas.Handle,windows.TRANSPARENT);
|
|
||||||
R1 := R;
|
|
||||||
for I := 0 to _Combobox.Items.Count-1 do
|
|
||||||
begin
|
|
||||||
S := _Combobox.Items[ I ];
|
|
||||||
R1.Bottom := R1.Top + Canvas.TextHeight( 'A' ) + 4;
|
|
||||||
if R1.Bottom > R.Bottom then
|
|
||||||
R1.Bottom := R.Bottom;
|
|
||||||
drawtext(Canvas.Handle,pchar(S),length(s),r1,
|
|
||||||
{DT_VCENTER or} DT_SINGLELINE);
|
|
||||||
R1.Top := R1.Bottom;
|
|
||||||
if R1.Top >= R.Bottom then
|
|
||||||
begin
|
|
||||||
R.Left := R.Right - getsystemmetrics( SM_CXVSCROLL );
|
|
||||||
//DrawScrollBar_Vertical( Canvas.Handle, R );
|
//DrawScrollBar_Vertical( Canvas.Handle, R );
|
||||||
break;
|
Break;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else begin
|
||||||
begin
|
DrawCombobox1(_Combobox, Canvas, _Combobox.clientrect);
|
||||||
DrawCombobox1( _Combobox, Canvas, _Combobox.ClientRect );
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
79
mckCtrls.pas
79
mckCtrls.pas
@@ -782,6 +782,9 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create( AOwner: TComponent ); override;
|
constructor Create( AOwner: TComponent ); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
//dufa
|
||||||
|
procedure Paint; override;
|
||||||
|
function WYSIWIGPaintImplemented: Boolean; override;
|
||||||
function TypeName: String; override;
|
function TypeName: String; override;
|
||||||
procedure WantTabs( Want: Boolean ); override;
|
procedure WantTabs( Want: Boolean ); override;
|
||||||
function Pcode_Generate: Boolean; override;
|
function Pcode_Generate: Boolean; override;
|
||||||
@@ -1312,6 +1315,7 @@ type
|
|||||||
//FOnDeleteLVItem: TOnDeleteLVItem;
|
//FOnDeleteLVItem: TOnDeleteLVItem;
|
||||||
FGenerateColIdxConst: Boolean;
|
FGenerateColIdxConst: Boolean;
|
||||||
FOnLVCustomDraw: TOnLVCustomDraw;
|
FOnLVCustomDraw: TOnLVCustomDraw;
|
||||||
|
FOnLVSubitemDraw: TOnLVSubitemDraw;
|
||||||
{$IFNDEF _D2}
|
{$IFNDEF _D2}
|
||||||
//FOnLVDataW: TOnLVDataW;
|
//FOnLVDataW: TOnLVDataW;
|
||||||
{$ENDIF _D2}
|
{$ENDIF _D2}
|
||||||
@@ -1331,6 +1335,7 @@ type
|
|||||||
procedure SetColumns(const Value: String);
|
procedure SetColumns(const Value: String);
|
||||||
procedure SetGenerateColIdxConst(const Value: Boolean);
|
procedure SetGenerateColIdxConst(const Value: Boolean);
|
||||||
procedure SetOnLVCustomDraw(const Value: TOnLVCustomDraw);
|
procedure SetOnLVCustomDraw(const Value: TOnLVCustomDraw);
|
||||||
|
procedure SetOnLVSubitemDraw(const Value: TOnLVSubitemDraw);
|
||||||
procedure UpdateColumns;
|
procedure UpdateColumns;
|
||||||
{$IFNDEF _D2}
|
{$IFNDEF _D2}
|
||||||
//procedure SetOnLVDataW(const Value: TOnLVDataW); {YS}
|
//procedure SetOnLVDataW(const Value: TOnLVDataW); {YS}
|
||||||
@@ -1401,6 +1406,7 @@ type
|
|||||||
property OnLVStateChange;
|
property OnLVStateChange;
|
||||||
property OnDrawItem;
|
property OnDrawItem;
|
||||||
property OnLVCustomDraw: TOnLVCustomDraw read FOnLVCustomDraw write SetOnLVCustomDraw;
|
property OnLVCustomDraw: TOnLVCustomDraw read FOnLVCustomDraw write SetOnLVCustomDraw;
|
||||||
|
property OnLVSubitemDraw: TOnLVSubitemDraw read FOnLVSubitemDraw write SetOnLVSubitemDraw;
|
||||||
property OnEnter;
|
property OnEnter;
|
||||||
property OnLeave;
|
property OnLeave;
|
||||||
property popupMenu;
|
property popupMenu;
|
||||||
@@ -2425,8 +2431,11 @@ end;
|
|||||||
|
|
||||||
procedure TKOLButton.Paint;
|
procedure TKOLButton.Paint;
|
||||||
begin
|
begin
|
||||||
if not (Assigned(FKOLCtrl) and (PaintType in [ptWYSIWIG, ptWYSIWIGFrames])) then begin
|
if not (Assigned(FKOLCtrl) and (PaintType in [ptWYSIWIG, ptWYSIWIGFrames])) then
|
||||||
|
begin
|
||||||
PrepareCanvasFontForWYSIWIGPaint( Canvas );
|
PrepareCanvasFontForWYSIWIGPaint( Canvas );
|
||||||
|
Canvas.Font.Color := clBtnText;
|
||||||
|
Canvas.Brush.Color := clBtnFace;
|
||||||
DrawButton( Self, Canvas );
|
DrawButton( Self, Canvas );
|
||||||
end;
|
end;
|
||||||
inherited;
|
inherited;
|
||||||
@@ -5627,10 +5636,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TKOLEditBox.Paint;
|
procedure TKOLEditBox.Paint;
|
||||||
var
|
{var
|
||||||
R:TRect;
|
R:TRect;
|
||||||
Flag:DWord;
|
Flag:DWord;
|
||||||
Delta: Integer;
|
Delta: Integer;}
|
||||||
begin
|
begin
|
||||||
asm
|
asm
|
||||||
jmp @@e_signature
|
jmp @@e_signature
|
||||||
@@ -5638,8 +5647,12 @@ begin
|
|||||||
DB 'TKOLEditBox.Paint', 0
|
DB 'TKOLEditBox.Paint', 0
|
||||||
@@e_signature:
|
@@e_signature:
|
||||||
end;
|
end;
|
||||||
|
//dufa
|
||||||
PrepareCanvasFontForWYSIWIGPaint( Canvas );
|
if not (Assigned(FKOLCtrl) and (PaintType in [ptWYSIWIG, ptWYSIWIGFrames])) then begin
|
||||||
|
PrepareCanvasFontForWYSIWIGPaint(Canvas);
|
||||||
|
DrawEditbox(Self, Canvas);
|
||||||
|
end;
|
||||||
|
{PrepareCanvasFontForWYSIWIGPaint( Canvas );
|
||||||
|
|
||||||
R.Left:=0;
|
R.Left:=0;
|
||||||
R.Top:=0;
|
R.Top:=0;
|
||||||
@@ -5674,7 +5687,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Canvas.Brush.Color := Color;
|
Canvas.Brush.Color := Color;
|
||||||
DrawText(Canvas.Handle,PChar(Caption),Length(Caption),R,Flag);
|
DrawText(Canvas.Handle,PChar(Caption),Length(Caption),R,Flag);}
|
||||||
|
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
@@ -6046,6 +6059,20 @@ begin
|
|||||||
Result := HasBorder;
|
Result := HasBorder;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
//dufa
|
||||||
|
function TKOLMemo.WYSIWIGPaintImplemented: Boolean;
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
procedure TKOLMemo.Paint;
|
||||||
|
begin
|
||||||
|
if not (Assigned(FKOLCtrl) and (PaintType in [ptWYSIWIG, ptWYSIWIGFrames])) then begin
|
||||||
|
PrepareCanvasFontForWYSIWIGPaint(Canvas);
|
||||||
|
DrawMemo(Self, Canvas);
|
||||||
|
end;
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
function TKOLMemo.Pcode_Generate: Boolean;
|
function TKOLMemo.Pcode_Generate: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := TRUE;
|
Result := TRUE;
|
||||||
@@ -7450,9 +7477,9 @@ end;
|
|||||||
procedure TKOLListView.AssignEvents(SL: TStringList; const AName: String);
|
procedure TKOLListView.AssignEvents(SL: TStringList; const AName: String);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
DoAssignEvents( SL, AName, [ 'OnDeleteLVItem', 'OnLVCustomDraw'
|
DoAssignEvents( SL, AName, [ 'OnDeleteLVItem', 'OnLVCustomDraw', 'OnLVSubitemDraw'
|
||||||
(*{$IFNDEF _D2}, 'OnLVDataW' {$ENDIF _D2}*) ],
|
(*{$IFNDEF _D2}, 'OnLVDataW' {$ENDIF _D2}*) ],
|
||||||
[ @ OnDeleteLVItem, @ OnLVCustomDraw
|
[ @ OnDeleteLVItem, @ OnLVCustomDraw, @ OnLVSubitemDraw
|
||||||
(*{$IFNDEF _D2}, @ OnLVDataW {$ENDIF _D2}*) ] );
|
(*{$IFNDEF _D2}, @ OnLVDataW {$ENDIF _D2}*) ] );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -7734,6 +7761,12 @@ begin
|
|||||||
Change;
|
Change;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TKOLListView.SetOnLVSubitemDraw(const Value: TOnLVSubitemDraw);
|
||||||
|
begin
|
||||||
|
FOnLVSubitemDraw := Value;
|
||||||
|
Change;
|
||||||
|
end;
|
||||||
|
|
||||||
{procedure TKOLListView.SetOnLVDelete(const Value: TOnDeleteLVItem);
|
{procedure TKOLListView.SetOnLVDelete(const Value: TOnDeleteLVItem);
|
||||||
begin
|
begin
|
||||||
FOnDeleteLVItem := Value;
|
FOnDeleteLVItem := Value;
|
||||||
@@ -7913,13 +7946,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
//+++++++++++++++++++++++++++++ 2.93
|
//+++++++++++++++++++++++++++++ 2.93
|
||||||
end;
|
end;
|
||||||
if (lvoEditLabel in Options) and not Assigned( OnEndEditLVItem ) then
|
|
||||||
begin
|
|
||||||
(SL as TFormStringList).OnAdd := nil;
|
|
||||||
//dufa SL.Add( Prefix + AName + '.OnEndEditLVItem := nil;' );
|
|
||||||
if KF <> nil then
|
|
||||||
(SL as TFormStringList).OnAdd := KF.DoFlushFormCompact;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TKOLListView.SetupLast(SL: TStringList; const AName, AParent,
|
procedure TKOLListView.SetupLast(SL: TStringList; const AName, AParent,
|
||||||
@@ -7953,6 +7979,13 @@ begin
|
|||||||
SL.Add( ' Result.' + Name + '.ImageListState := ' +
|
SL.Add( ' Result.' + Name + '.ImageListState := ' +
|
||||||
'Result.' + ImageListState.Name + ';' );
|
'Result.' + ImageListState.Name + ';' );
|
||||||
end;
|
end;
|
||||||
|
if (lvoEditLabel in Options) and (TMethod(fOnEndEditLVItem).Code = nil) then
|
||||||
|
begin
|
||||||
|
//(SL as TFormStringList).OnAdd := nil;
|
||||||
|
SL.Add( Prefix + AName + '.OnEndEditLVItem := nil;' );
|
||||||
|
//if KF <> nil then
|
||||||
|
// (SL as TFormStringList).OnAdd := KF.DoFlushFormCompact;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TKOLListView.SetupParams( const AName, AParent: TDelphiString ): TDelphiString;
|
function TKOLListView.SetupParams( const AName, AParent: TDelphiString ): TDelphiString;
|
||||||
@@ -8377,11 +8410,11 @@ begin
|
|||||||
Result := inherited P_AssignEvents( SL, AName, CheckOnly );
|
Result := inherited P_AssignEvents( SL, AName, CheckOnly );
|
||||||
if Result and CheckOnly then Exit;
|
if Result and CheckOnly then Exit;
|
||||||
Result := Result or
|
Result := Result or
|
||||||
P_DoAssignEvents( SL, AName, [ 'OnDeleteLVItem', 'OnLVCustomDraw'
|
P_DoAssignEvents( SL, AName, [ 'OnDeleteLVItem', 'OnLVCustomDraw', 'OnLVSubitemDraw'
|
||||||
(*{$IFNDEF _D2}, 'OnLVDataW' {$ENDIF _D2}*) ],
|
(*{$IFNDEF _D2}, 'OnLVDataW' {$ENDIF _D2}*) ],
|
||||||
[ @ OnDeleteLVItem, @ OnLVCustomDraw
|
[ @ OnDeleteLVItem, @ OnLVCustomDraw, @ OnLVSubitemDraw
|
||||||
(*{$IFNDEF _D2}, @ OnLVDataW {$ENDIF _D2}*) ],
|
(*{$IFNDEF _D2}, @ OnLVDataW {$ENDIF _D2}*) ],
|
||||||
[ TRUE, TRUE ], CheckOnly );
|
[ TRUE, TRUE, TRUE ], CheckOnly );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TKOLListView.GenerateTransparentInits_Compact;
|
procedure TKOLListView.GenerateTransparentInits_Compact;
|
||||||
@@ -14398,7 +14431,7 @@ end;
|
|||||||
|
|
||||||
procedure TKOLImageShow.Paint;
|
procedure TKOLImageShow.Paint;
|
||||||
var
|
var
|
||||||
R:TRect;
|
R, RDest:TRect;
|
||||||
EdgeFlag:DWord;
|
EdgeFlag:DWord;
|
||||||
//Flag:DWord;
|
//Flag:DWord;
|
||||||
Delta:DWord;
|
Delta:DWord;
|
||||||
@@ -14449,7 +14482,9 @@ begin
|
|||||||
TMP:=TBitMap.Create;
|
TMP:=TBitMap.Create;
|
||||||
TMP.Width:=ImageListNormal.ImgWidth;
|
TMP.Width:=ImageListNormal.ImgWidth;
|
||||||
TMP.Height:=ImageListNormal.ImgHeight;
|
TMP.Height:=ImageListNormal.ImgHeight;
|
||||||
TMP.Canvas.CopyRect( Rect(0,0,ImageListNormal.ImgWidth,ImageListNormal.ImgHeight),
|
RDest := Rect(0,0,ImageListNormal.ImgWidth,ImageListNormal.ImgHeight);
|
||||||
|
TMP.Canvas.FillRect(RDest);
|
||||||
|
TMP.Canvas.CopyRect( RDest,
|
||||||
ImageListNormal.Bitmap.Canvas,
|
ImageListNormal.Bitmap.Canvas,
|
||||||
Rect( ImageListNormal.ImgWidth*(CurIndex),0,
|
Rect( ImageListNormal.ImgWidth*(CurIndex),0,
|
||||||
ImageListNormal.ImgWidth*(CurIndex+1),
|
ImageListNormal.ImgWidth*(CurIndex+1),
|
||||||
@@ -14458,7 +14493,9 @@ begin
|
|||||||
TMP.Transparent:=True;
|
TMP.Transparent:=True;
|
||||||
TMP.TransparentColor:=ImageListNormal.TransparentColor;
|
TMP.TransparentColor:=ImageListNormal.TransparentColor;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Canvas.Draw(Delta,Delta,TMP);
|
Canvas.Draw((Width - ImageListNormal.ImgWidth) div 2,
|
||||||
|
(Height - ImageListNormal.ImgHeight) div 2,
|
||||||
|
TMP);
|
||||||
TMP.Free;
|
TMP.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user