* updates\fixes UXVisualStyle for designer mode
* KOL.pas: fix WStrRScan function * KOL.pas: fix ClipboardHasText function * KOL.pas: fix TBitmap.CopyToClipboard method + KOL.pas: +TBitmap.CopyToClipboardAsDIB git-svn-id: https://svn.code.sf.net/p/kolmck/code@151 91bb2d04-0c0c-4d2d-88a5-bbb6f4c1fa07
This commit is contained in:
63
KOL.pas
63
KOL.pas
@@ -1,8 +1,4 @@
|
||||
//[START OF KOL.pas]
|
||||
|
||||
// This is an unofficial version compatible with fpc 2.6.4 and 2.7.1 i386 and x64 compilers
|
||||
// Dmitri K dmiko@mail333.com principal work
|
||||
// Thaddy de Koning thaddy@thaddy.com (merge 3.22)
|
||||
{****************************************************************
|
||||
|
||||
KKKKK KKKKK OOOOOOOOO LLLLL
|
||||
@@ -18,7 +14,7 @@
|
||||
Key Objects Library (C) 2000 by Vladimir Kladov.
|
||||
|
||||
****************************************************************
|
||||
* VERSION 3.22.svn
|
||||
* VERSION 3.23.svn
|
||||
****************************************************************
|
||||
|
||||
K.O.L. - is a set of objects and functions to create small programs
|
||||
@@ -38,6 +34,9 @@
|
||||
See also Mirror Classes Kit (M.C.K.) which allows
|
||||
to create KOL programs visually.
|
||||
|
||||
Compatible with fpc 2.6.4, 2.7.1 i386 and x64 compilers:
|
||||
Dmitri K - dmiko@mail333.com (principal work)
|
||||
Thaddy de Koning - thaddy@thaddy.com (merge 3.22)
|
||||
****************************************************************}
|
||||
|
||||
{$I KOLDEF.inc}
|
||||
@@ -3464,8 +3463,10 @@ type
|
||||
{* It is possible to use Canvas.CopyRect for such purpose, but if You
|
||||
do not want use TCanvas, it is possible to copy rectangle from one
|
||||
bitmap to another using this function. }
|
||||
function CopyToClipboardAsDIB: Boolean;
|
||||
{* Copies bitmap to clipboard, converting it to DIB format first. }
|
||||
function CopyToClipboard: Boolean;
|
||||
{* Copies bitmap to clipboard. }
|
||||
{* Copies bitmap to clipboard. When Handle = 0, CLIPBOARD is emptied!!! }
|
||||
function PasteFromClipboard: Boolean;
|
||||
{* Takes CF_DIB format bitmap from clipboard and assigns it to the
|
||||
TBitmap object. }
|
||||
@@ -4192,16 +4193,16 @@ type
|
||||
|
||||
TCreateWndParams = {packed} Record
|
||||
ExStyle: DWORD;
|
||||
WinClassName: PKOLChar;
|
||||
Caption: PKOLChar;
|
||||
WinClassName: PKOLChar;
|
||||
Caption: PKOLChar;
|
||||
Style: DWORD;
|
||||
X, Y, Width, Height: Integer;
|
||||
WndParent: HWnd;
|
||||
Menu: HMenu;
|
||||
Inst: HINST;
|
||||
Param: Pointer;
|
||||
WinClsNamBuf: array[ 0..63 ] of KOLChar;
|
||||
WindowClass: TWndClass;
|
||||
WinClsNamBuf: array[ 0..63 ] of KOLChar;
|
||||
WindowClass: TWndClass;
|
||||
end;
|
||||
|
||||
PCommandActions = ^TCommandActions;
|
||||
@@ -11706,7 +11707,7 @@ function _WStrLComp(S1, S2: PWideChar; Len: Integer): Integer;
|
||||
function WStrScan(Str: PWideChar; Chr: WideChar): PWideChar;
|
||||
{* Fast search of given character in a string. Pointer to found character
|
||||
(or nil) is returned. }
|
||||
function WStrRScan(const Str: PWideChar; Chr: WideChar): PWideChar;
|
||||
function WStrRScan(Str: PWideChar; Chr: WideChar): PWideChar;
|
||||
{* StrRScan returns a pointer to the last occurrence of Chr in Str. If Chr
|
||||
does not occur in Str, StrRScan returns NIL. The null terminator is
|
||||
considered to be part of the string. }
|
||||
@@ -21760,14 +21761,17 @@ begin
|
||||
Result := Str;
|
||||
end;
|
||||
|
||||
function WStrRScan(const Str: PWideChar; Chr: WideChar): PWideChar;
|
||||
function WStrRScan(Str: PWideChar; Chr: WideChar): PWideChar;
|
||||
begin
|
||||
Result := Str;
|
||||
while Result^ <> #0 do inc( Result );
|
||||
while (PtrUInt( Result ) >= PtrUInt( Str )) and
|
||||
(Result^ <> Chr) do dec( Result );
|
||||
if (PtrUInt( Result ) < PtrUInt( Str )) then
|
||||
Result := nil;
|
||||
while Str^ <> #0 do
|
||||
begin
|
||||
if Str^ = Chr then
|
||||
Result := Str;
|
||||
inc(Str);
|
||||
end;
|
||||
if Result = nil then
|
||||
Result := Str;
|
||||
end;
|
||||
{$ENDIF WIN}
|
||||
{$ENDIF _FPC}
|
||||
@@ -53112,13 +53116,10 @@ begin
|
||||
end;
|
||||
{$ENDIF PAS_VERSION}
|
||||
|
||||
function TBitmap.CopyToClipboard: Boolean;
|
||||
function TBitmap.CopyToClipboardAsDIB: Boolean;
|
||||
var DibMem: PAnsiChar;
|
||||
HdrSize: Integer;
|
||||
Gbl: HGlobal;
|
||||
//Mem: PStream;
|
||||
//Sz: Integer;
|
||||
//Pt: Pointer;
|
||||
Restore_Compression: Integer;
|
||||
begin
|
||||
Result := FALSE;
|
||||
@@ -53170,6 +53171,18 @@ begin
|
||||
CloseClipboard;
|
||||
end;
|
||||
|
||||
function TBitmap.CopyToClipboard: Boolean;
|
||||
begin
|
||||
Result := FALSE;
|
||||
if Applet = nil then Exit; {>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
|
||||
if not OpenClipboard( Applet.GetWindowHandle ) then Exit; {>>>>>>>>>>>>>>>>>>}
|
||||
if EmptyClipboard then
|
||||
if Handle <> 0 then // When Handle = 0, CLIPBOARD is emptied!!!
|
||||
Result := 0 <> SetClipboardData( CF_BITMAP,
|
||||
CopyImage(Handle, IMAGE_BITMAP, 0, 0, 0) );
|
||||
CloseClipboard;
|
||||
end;
|
||||
|
||||
function TBitmap.PasteFromClipboard: Boolean;
|
||||
var Gbl: HGlobal;
|
||||
Size {, HdrSize}: Integer;
|
||||
@@ -57110,13 +57123,7 @@ end;
|
||||
|
||||
function ClipboardHasText: Boolean;
|
||||
begin
|
||||
Result := false;
|
||||
if OpenClipboard( 0 ) then
|
||||
begin
|
||||
if IsClipboardFormatAvailable( CF_TEXT ) then
|
||||
Result := TRUE;
|
||||
CloseClipboard;
|
||||
end;
|
||||
Result := IsClipboardFormatAvailable( CF_TEXT );
|
||||
end;
|
||||
|
||||
function Clipboard2Text: AnsiString;
|
||||
|
221
mckCtrlDraw.pas
221
mckCtrlDraw.pas
@@ -6,6 +6,9 @@ interface
|
||||
uses
|
||||
Windows, Types, KOL, Themes;
|
||||
|
||||
type
|
||||
TScrollStyle = (ssNone, ssHorz, ssVert, ssBoth);
|
||||
|
||||
const
|
||||
TextHFlags: array[TTextAlign] of DWORD = (DT_LEFT, DT_RIGHT, DT_CENTER);
|
||||
TextVFlags: array[TVerticalAlign] of DWORD = (DT_TOP, DT_VCENTER, DT_BOTTOM);
|
||||
@@ -14,7 +17,7 @@ const
|
||||
|
||||
procedure DrawButton(aUX: Boolean; DC: HDC; R: TRect; aEnabled, aDefBtn: Boolean; dwTextFlags: DWORD; aText: WideString);
|
||||
procedure DrawEditBox(aUX: Boolean; DC: HDC; R: TRect; aEnabled, aIsPwd: Boolean; dwTextFlags: DWORD; aText: WideString);
|
||||
procedure DrawMemo(aUX: Boolean; DC: HDC; R: TRect; aEnabled, aScrollH, aScrollV: Boolean; dwTextFlags: DWORD; aText: WideString);
|
||||
procedure DrawMemo(aUX: Boolean; DC: HDC; R: TRect; aColor: Integer; aEnabled: Boolean; aScrollStyle: TScrollStyle; dwTextFlags: DWORD; aText: WideString);
|
||||
procedure DrawCombobox(DC: HDC; R: TRect; aEnabled: Boolean; aText: WideString);
|
||||
procedure DrawLabel(DC: HDC; R: TRect; dwTextFlags: DWORD; aText: WideString);
|
||||
procedure DrawCheckbox(DC: HDC; R: TRect; aEnabled, aChecked, aHasBorder: Boolean; aText: WideString);
|
||||
@@ -25,12 +28,70 @@ procedure DrawListView(aUX: Boolean; DC: HDC; R: TRect; aEnabled: Boolean; aColu
|
||||
procedure DrawProgressBar(DC: HDC; R: TRect; aVertical: Boolean; aProgress, aMaxProgress: Integer);
|
||||
procedure DrawTrackBar(DC: HDC; R: TRect; aVertical: Boolean; aProgress, aMaxProgress: Integer);
|
||||
procedure DrawGroupBox(aUX: Boolean; DC: HDC; R: TRect; aText: WideString);
|
||||
procedure DrawScrollBar(aUX: Boolean; DC: HDC; R: TRect; aEnabled, aVertical: Boolean; aPos, aMin, aMax: Integer);
|
||||
procedure DrawScrollBox(aUX: Boolean; DC: HDC; R: TRect; aScrollStyle: TScrollStyle);
|
||||
// not yet
|
||||
procedure DrawToolbar(aUX: Boolean; DC: HDC; R: TRect; aEnabled: Boolean; aText: WideString);
|
||||
|
||||
implementation
|
||||
|
||||
const
|
||||
arrThemedEdit: array[Boolean] of TThemedEdit = (teEditTextDisabled, teEditTextNormal);
|
||||
|
||||
function pos2pix(aPos, aMin, aMax, aPixelMax, aPixelX: Integer): Integer;
|
||||
begin
|
||||
Result := aPixelX + Round((aPos + Abs(aMin)) / (aMax + Abs(aMin)) * (aPixelMax - aPixelX * 3));
|
||||
end;
|
||||
|
||||
procedure DrawScrollBar(aUX: Boolean; DC: HDC; R: TRect; aEnabled, aVertical: Boolean; aPos, aMin, aMax: Integer);
|
||||
const //enb btn
|
||||
arrThemedSBLU: array[Boolean, Boolean] of TThemedScrollBar = (
|
||||
(tsArrowBtnLeftDisabled, tsArrowBtnUpDisabled), (tsArrowBtnLeftNormal, tsArrowBtnUpNormal));
|
||||
arrThemedSBRD: array[Boolean, Boolean] of TThemedScrollBar = (
|
||||
(tsArrowBtnRightDisabled, tsArrowBtnDownDisabled), (tsArrowBtnRightNormal, tsArrowBtnDownNormal));
|
||||
arrThemedSBTH: array[Boolean] of TThemedScrollBar = (tsThumbBtnHorzNormal, tsThumbBtnVertNormal);
|
||||
arrSBLU: array[Boolean, Boolean] of DWORD = (
|
||||
(DFCS_SCROLLLEFT or DFCS_INACTIVE,DFCS_SCROLLUP or DFCS_INACTIVE), (DFCS_SCROLLLEFT, DFCS_SCROLLUP));
|
||||
arrSBRD: array[Boolean, Boolean] of DWORD = (
|
||||
(DFCS_SCROLLRIGHT or DFCS_INACTIVE, DFCS_SCROLLDOWN or DFCS_INACTIVE), (DFCS_SCROLLRIGHT, DFCS_SCROLLDOWN));
|
||||
|
||||
var
|
||||
w: Integer;
|
||||
h: Integer;
|
||||
rr: TRect;
|
||||
begin
|
||||
// get btn size
|
||||
w := GetSystemMetrics(SM_CXVSCROLL);
|
||||
h := GetSystemMetrics(SM_CYVSCROLL);
|
||||
// pos2pix
|
||||
if aVertical then
|
||||
rr := Bounds(R.Left, pos2pix(aPos, aMin, aMax, R.Bottom, h), R.Right - R.Left, GetSystemMetrics(SM_CYVTHUMB))
|
||||
else
|
||||
rr := Bounds(pos2pix(aPos, aMin, aMax, R.Right, w), R.Top, GetSystemMetrics(SM_CXHTHUMB), R.Bottom - R.Top);
|
||||
// ux
|
||||
if ThemeServices.ThemesAvailable and aUX then begin
|
||||
// draw track
|
||||
ThemeServices.DrawElement(DC, ThemeServices.GetElementDetails(tsLowerTrackVertNormal), R, nil);
|
||||
// draw btn-left/up
|
||||
ThemeServices.DrawElement(DC, ThemeServices.GetElementDetails(arrThemedSBLU[aEnabled, aVertical]), Bounds(R.Left, R.Top, w, h), nil);
|
||||
// draw btn-right/down
|
||||
ThemeServices.DrawElement(DC, ThemeServices.GetElementDetails(arrThemedSBRD[aEnabled, aVertical]), Rect(R.Right - w, R.Bottom - h, R.Right, R.Bottom), nil);
|
||||
// draw thumb
|
||||
if aEnabled then
|
||||
ThemeServices.DrawElement(DC, ThemeServices.GetElementDetails(arrThemedSBTH[aVertical]), rr, nil);
|
||||
end else begin
|
||||
// draw track
|
||||
FillRect(DC, R, GetSysColorBrush(COLOR_SCROLLBAR));
|
||||
// draw btn-left/up
|
||||
DrawFrameControl(DC, Bounds(R.Left, R.Top, w, h), DFC_SCROLL, arrSBLU[aEnabled, aVertical]);
|
||||
// draw btn-right/down
|
||||
DrawFrameControl(DC, Rect(R.Right - w, R.Bottom - h, R.Right, R.Bottom), DFC_SCROLL, arrSBRD[aEnabled, aVertical]);
|
||||
// draw thumb
|
||||
if aEnabled then
|
||||
DrawFrameControl(DC, rr, DFC_BUTTON, DFCS_BUTTONPUSH);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure DrawButton(aUX: Boolean; DC: HDC; R: TRect; aEnabled, aDefBtn: Boolean; dwTextFlags: DWORD; aText: WideString);
|
||||
const //enb defbtn
|
||||
arrThemedButton: array[Boolean, Boolean] of TThemedButton =
|
||||
@@ -87,78 +148,57 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure DrawMemo(aUX: Boolean; DC: HDC; R: TRect; aEnabled, aScrollH, aScrollV: Boolean; dwTextFlags: DWORD; aText: WideString);
|
||||
procedure DrawMemo(aUX: Boolean; DC: HDC; R: TRect; aColor: Integer; aEnabled: Boolean; aScrollStyle: TScrollStyle; dwTextFlags: DWORD; aText: WideString);
|
||||
var
|
||||
d: TThemedElementDetails;
|
||||
w: Integer;
|
||||
h: Integer;
|
||||
b: HBRUSH;
|
||||
begin
|
||||
// get btn size
|
||||
w := GetSystemMetrics(SM_CXVSCROLL);
|
||||
h := GetSystemMetrics(SM_CYVSCROLL);
|
||||
if ThemeServices.ThemesAvailable and aUX then begin
|
||||
// draw element
|
||||
ThemeServices.DrawElement(DC, ThemeServices.GetElementDetails(arrThemedEdit[True]), r, nil);
|
||||
// v
|
||||
if aScrollV then begin
|
||||
// get element v-track
|
||||
d := ThemeServices.GetElementDetails(tsLowerTrackVertDisabled);
|
||||
// draw element
|
||||
ThemeServices.DrawElement(DC, d, Rect(r.Right - 20, 1, r.Right - 1, r.Bottom - 1), nil);
|
||||
// get element btn-up
|
||||
d := ThemeServices.GetElementDetails(tsArrowBtnUpDisabled);
|
||||
// draw element
|
||||
ThemeServices.DrawElement(DC, d, Rect(r.Right - 20, 1, r.Right - 1, 20), nil);
|
||||
// get element btn-dn
|
||||
d := ThemeServices.GetElementDetails(tsArrowBtnDownDisabled);
|
||||
// draw element
|
||||
ThemeServices.DrawElement(DC, d, Rect(r.Right - 20, r.Bottom - 40, r.Right - 1, r.Bottom - 20), nil);
|
||||
end;
|
||||
// h
|
||||
if aScrollH then begin
|
||||
// get element h-track
|
||||
d := ThemeServices.GetElementDetails(tsLowerTrackHorzDisabled);
|
||||
// draw element
|
||||
ThemeServices.DrawElement(DC, d, Rect(1, r.Bottom - 20, r.Right - 20, r.Bottom - 1), nil);
|
||||
// get element btn-left
|
||||
d := ThemeServices.GetElementDetails(tsArrowBtnLeftDisabled);
|
||||
// draw element
|
||||
ThemeServices.DrawElement(DC, d, Rect(1, r.Bottom - 20, 20, r.Bottom - 1), nil);
|
||||
// get element btn-right
|
||||
d := ThemeServices.GetElementDetails(tsArrowBtnRightDisabled);
|
||||
// draw element
|
||||
ThemeServices.DrawElement(DC, d, Rect(r.Right - 40, r.Bottom - 20, r.Right - 20, r.Bottom - 1), nil);
|
||||
// draw border
|
||||
ThemeServices.DrawElement(DC, ThemeServices.GetElementDetails(arrThemedEdit[True]), R, nil);
|
||||
InflateRect(R, -1, -1);
|
||||
// draw back
|
||||
b := CreateSolidBrush(Color2RGB(aColor));
|
||||
FillRect(DC, R, b);
|
||||
DeleteObject(b);
|
||||
InflateRect(R, -1, -1);
|
||||
// draw scrolls
|
||||
case aScrollStyle of
|
||||
ssHorz: DrawScrollBar(aUX, DC, Rect(R.Left, R.Bottom - h, R.Right, R.Bottom), False, False, 2, 0, 100);
|
||||
ssVert: DrawScrollBar(aUX, DC, Rect(R.Right - w, R.Top, R.Right, R.Bottom), False, True, 2, 0, 100);
|
||||
ssBoth:
|
||||
begin
|
||||
ThemeServices.DrawElement(DC, ThemeServices.GetElementDetails(tsLowerTrackVertNormal), Rect(R.Left, R.Bottom - h, R.Right, R.Bottom), nil);
|
||||
DrawScrollBar(aUX, DC, Rect(R.Left, R.Bottom - h, R.Right - w, R.Bottom), False, False, 2, 0, 100);
|
||||
DrawScrollBar(aUX, DC, Rect(R.Right - w, R.Top, R.Right, R.Bottom - h), False, True, 2, 0, 100);
|
||||
end;
|
||||
end;
|
||||
// draw text
|
||||
Inc(r.Left, 6);
|
||||
Inc(r.Top, 3);
|
||||
Dec(r.Right, 23);
|
||||
Dec(r.Bottom, 23);
|
||||
ThemeServices.DrawText(DC, ThemeServices.GetElementDetails(arrThemedEdit[aEnabled]), aText, r, dwTextFlags, 0);
|
||||
Inc(R.Left, 4);
|
||||
Inc(R.Top, 1);
|
||||
Dec(R.Right, 21);
|
||||
Dec(R.Bottom, 21);
|
||||
ThemeServices.DrawText(DC, ThemeServices.GetElementDetails(arrThemedEdit[aEnabled]), aText, R, dwTextFlags, 0);
|
||||
end else begin
|
||||
// draw back
|
||||
FillRect(DC, R, GetSysColorBrush(COLOR_WINDOW));
|
||||
b := CreateSolidBrush(Color2RGB(aColor));
|
||||
FillRect(DC, R, b);
|
||||
DrawEdge(DC, R, EDGE_SUNKEN, BF_RECT or BF_ADJUST);
|
||||
// v
|
||||
if aScrollV then begin
|
||||
// get btn size
|
||||
w := GetSystemMetrics(SM_CXVSCROLL);
|
||||
h := GetSystemMetrics(SM_CYVSCROLL);
|
||||
// draw element v-track
|
||||
FillRect(DC, Rect(R.Right - w, R.Top, R.Right, R.Bottom), GetSysColorBrush(COLOR_SCROLLBAR));
|
||||
// draw element btn-up
|
||||
DrawFrameControl(DC, Bounds(R.Right - w, R.Top, w, h), DFC_SCROLL, DFCS_SCROLLUP or DFCS_INACTIVE);
|
||||
// get element btn-dn
|
||||
DrawFrameControl(DC, Bounds(R.Right - w, R.Bottom - h * 2, w, h), DFC_SCROLL, DFCS_SCROLLDOWN or DFCS_INACTIVE);
|
||||
end;
|
||||
// h
|
||||
if aScrollH then begin
|
||||
// get btn size
|
||||
w := GetSystemMetrics(SM_CXHSCROLL);
|
||||
h := GetSystemMetrics(SM_CYHSCROLL);
|
||||
// draw element v-track
|
||||
FillRect(DC, Rect(R.Left, R.Bottom - h, R.Right - w, R.Bottom), GetSysColorBrush(COLOR_SCROLLBAR));
|
||||
// draw element btn-left
|
||||
DrawFrameControl(DC, Bounds(R.Left, R.Bottom - h, w, h), DFC_SCROLL, DFCS_SCROLLLEFT or DFCS_INACTIVE);
|
||||
// get element btn-right
|
||||
DrawFrameControl(DC, Bounds(R.Right - w * 2, R.Bottom - h, w, h), DFC_SCROLL, DFCS_SCROLLRIGHT or DFCS_INACTIVE);
|
||||
DeleteObject(b);
|
||||
// draw scrolls
|
||||
case aScrollStyle of
|
||||
ssHorz: DrawScrollBar(aUX, DC, Rect(R.Left, R.Bottom - h, R.Right, R.Bottom), False, False, 2, 0, 100);
|
||||
ssVert: DrawScrollBar(aUX, DC, Rect(R.Right - w, R.Top, R.Right, R.Bottom), False, True, 2, 0, 100);
|
||||
ssBoth:
|
||||
begin
|
||||
FillRect(DC, Rect(R.Left, R.Bottom - h, R.Right, R.Bottom), GetSysColorBrush(COLOR_BTNFACE));
|
||||
DrawScrollBar(aUX, DC, Rect(R.Left, R.Bottom - h, R.Right - w, R.Bottom), False, False, 2, 0, 100);
|
||||
DrawScrollBar(aUX, DC, Rect(R.Right - w, R.Top, R.Right, R.Bottom - h), False, True, 2, 0, 100);
|
||||
end;
|
||||
end;
|
||||
// draw text
|
||||
InflateRect(R, -4, -1);
|
||||
@@ -338,14 +378,19 @@ begin
|
||||
end;
|
||||
|
||||
procedure DrawTrackBar(DC: HDC; R: TRect; aVertical: Boolean; aProgress, aMaxProgress: Integer);
|
||||
var
|
||||
a: TRect;
|
||||
x: Integer;
|
||||
begin
|
||||
// draw root
|
||||
ThemeServices.DrawElement(DC, ThemeServices.GetElementDetails(ttbTrackBarRoot), R, nil);
|
||||
// draw bar
|
||||
ThemeServices.DrawElement(DC, ThemeServices.GetElementDetails(ttbTrack), Bounds(8, 14, R.Right - 16, 4), nil);
|
||||
a := Bounds(8, 14, R.Right - 16, 4);
|
||||
x := GetSystemMetrics(SM_CXHTHUMB);
|
||||
ThemeServices.DrawElement(DC, ThemeServices.GetElementDetails(ttbTrack), a, nil);
|
||||
// draw progress
|
||||
R := Bounds(4 + Trunc(aProgress / aMaxProgress * R.Right), 0, GetSystemMetrics(SM_CXHTHUMB), R.Bottom);
|
||||
ThemeServices.DrawElement(DC, ThemeServices.GetElementDetails(ttbThumbBottomNormal), R, nil);
|
||||
a := Bounds(5 + Trunc(aProgress / aMaxProgress * (a.Right - 19)), 0, x, R.Bottom);
|
||||
ThemeServices.DrawElement(DC, ThemeServices.GetElementDetails(ttbThumbBottomNormal), a, nil);
|
||||
end;
|
||||
|
||||
procedure DrawGroupBox(aUX: Boolean; DC: HDC; R: TRect; aText: WideString);
|
||||
@@ -369,5 +414,49 @@ begin
|
||||
DrawTextW(DC, PWideChar(aText), Length(aText), R, DT_LEFT);
|
||||
end;
|
||||
|
||||
procedure DrawScrollBox(aUX: Boolean; DC: HDC; R: TRect; aScrollStyle: TScrollStyle);
|
||||
var
|
||||
w: Integer;
|
||||
h: Integer;
|
||||
begin
|
||||
// get btn size
|
||||
w := GetSystemMetrics(SM_CXVSCROLL);
|
||||
h := GetSystemMetrics(SM_CYVSCROLL);
|
||||
// draw back
|
||||
FillRect(DC, R, GetSysColorBrush(COLOR_BTNFACE));
|
||||
DrawEdge(DC, R, EDGE_SUNKEN, BF_RECT or BF_ADJUST);
|
||||
case aScrollStyle of
|
||||
ssHorz: DrawScrollBar(aUX, DC, Rect(R.Left, R.Bottom - h, R.Right, R.Bottom), True, False, 2, 0, 100);
|
||||
ssVert: DrawScrollBar(aUX, DC, Rect(R.Right - w, R.Top, R.Right, R.Bottom), True, True, 2, 0, 100);
|
||||
ssBoth:
|
||||
begin
|
||||
DrawScrollBar(aUX, DC, Rect(R.Left, R.Bottom - h, R.Right - w, R.Bottom), True, False, 2, 0, 100);
|
||||
DrawScrollBar(aUX, DC, Rect(R.Right - w, R.Top, R.Right, R.Bottom - h), True, True, 2, 0, 100);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
// not yet
|
||||
procedure DrawToolbar(aUX: Boolean; DC: HDC; R: TRect; aEnabled: Boolean; aText: WideString);
|
||||
var
|
||||
d: TThemedElementDetails;
|
||||
begin
|
||||
if ThemeServices.ThemesAvailable and aUX then begin
|
||||
// get element
|
||||
d := ThemeServices.GetElementDetails(ttbToolBarRoot);
|
||||
// draw element
|
||||
ThemeServices.DrawElement(DC, d, R, nil);
|
||||
|
||||
// get element
|
||||
d := ThemeServices.GetElementDetails(ttbSplitButtonNormal);
|
||||
// draw element
|
||||
ThemeServices.DrawElement(DC, d, R, nil);
|
||||
// text
|
||||
ThemeServices.DrawText(DC, d, aText, R, 0, 0);
|
||||
end else begin
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
58
mckCtrls.pas
58
mckCtrls.pas
@@ -2014,6 +2014,9 @@ type
|
||||
function Pcode_Generate: Boolean; override;
|
||||
function SupportsFormCompact: Boolean; override;
|
||||
procedure SetupConstruct_Compact; override;
|
||||
//dufa
|
||||
procedure Paint; override;
|
||||
function WYSIWIGPaintImplemented: Boolean; override;
|
||||
published
|
||||
constructor Create( AOwner: TComponent ); override;
|
||||
property ScrollBars: TScrollBars read FScrollBars write SetScrollBars;
|
||||
@@ -2065,6 +2068,9 @@ type
|
||||
constructor Create( AOwner: TComponent ); override;
|
||||
function SupportsFormCompact: Boolean; override;
|
||||
procedure SetupConstruct_Compact; override;
|
||||
//dufa
|
||||
procedure Paint; override;
|
||||
function WYSIWIGPaintImplemented: Boolean; override;
|
||||
published
|
||||
property popupMenu;
|
||||
property SBMin: Integer read FSBMin write SetSBMin;
|
||||
@@ -6098,11 +6104,23 @@ function TKOLMemo.WYSIWIGPaintImplemented: Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
function KOLMemoOptions2ScrollStyle(aOptions: TKOLMemoOptions): TScrollStyle;
|
||||
begin
|
||||
Result := mckCtrlDraw.ssBoth;
|
||||
if (eo_NoHScroll in aOptions) and (eo_NoVScroll in aOptions) then
|
||||
Result := mckCtrlDraw.ssNone
|
||||
else if (eo_NoHScroll in aOptions) then
|
||||
Result := mckCtrlDraw.ssVert
|
||||
else if (eo_NoVScroll in aOptions) then
|
||||
Result := mckCtrlDraw.ssHorz;
|
||||
end;
|
||||
|
||||
procedure TKOLMemo.Paint;
|
||||
begin
|
||||
if not (Assigned(FKOLCtrl) and (PaintType in [ptWYSIWIG, ptWYSIWIGFrames])) then begin
|
||||
PrepareCanvasFontForWYSIWIGPaint(Canvas);
|
||||
DrawMemo(True, Canvas.Handle, ClientRect, Enabled, True, True, TextHFlags[KOL.TTextAlign(TextAlign)], Text.Text);
|
||||
DrawMemo(True, Canvas.Handle, ClientRect, Color, Enabled, KOLMemoOptions2ScrollStyle(Options), TextHFlags[KOL.TTextAlign(TextAlign)], Text.Text);
|
||||
end;
|
||||
inherited;
|
||||
end;
|
||||
@@ -6198,6 +6216,8 @@ begin
|
||||
if Assigned(FKOLCtrl) then
|
||||
RecreateWnd;
|
||||
Change;
|
||||
//dufa
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TKOLMemo.SetText(const Value: TStrings);
|
||||
@@ -6970,7 +6990,7 @@ var
|
||||
begin
|
||||
if not (Assigned(FKOLCtrl) and (PaintType in [ptWYSIWIG, ptWYSIWIGFrames])) then begin
|
||||
PrepareCanvasFontForWYSIWIGPaint( Canvas );
|
||||
if (CurIndex > -1) then
|
||||
if (CurIndex > -1) and (Items.Count > 0) then
|
||||
s := Items.Strings[CurIndex]
|
||||
else
|
||||
s := '';
|
||||
@@ -9108,7 +9128,7 @@ procedure TKOLRichEdit.Paint;
|
||||
begin
|
||||
if not (Assigned(FKOLCtrl) and (PaintType in [ptWYSIWIG, ptWYSIWIGFrames])) then begin
|
||||
PrepareCanvasFontForWYSIWIGPaint(Canvas);
|
||||
DrawMemo(True, Canvas.Handle, ClientRect, Enabled, False, False, TextHFlags[KOL.TTextAlign(TextAlign)], Text.Text);
|
||||
DrawMemo(True, Canvas.Handle, ClientRect, Color, Enabled, KOLMemoOptions2ScrollStyle(Options), TextHFlags[KOL.TTextAlign(TextAlign)], Text.Text);
|
||||
end;
|
||||
inherited;
|
||||
end;
|
||||
@@ -9278,6 +9298,8 @@ begin
|
||||
if Assigned(FKOLCtrl) then
|
||||
RecreateWnd;
|
||||
Change;
|
||||
//dufa
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TKOLRichEdit.SetRE_AutoFont(const Value: Boolean);
|
||||
@@ -15178,6 +15200,15 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TKOLScrollBox.Paint;
|
||||
begin
|
||||
if not (Assigned(FKOLCtrl) and (PaintType in [ptWYSIWIG, ptWYSIWIGFrames])) then begin
|
||||
PrepareCanvasFontForWYSIWIGPaint(Canvas);
|
||||
DrawScrollBox(True, Canvas.Handle, ClientRect, TScrollStyle(ScrollBars));
|
||||
end;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TKOLScrollBox.Pcode_Generate: Boolean;
|
||||
begin
|
||||
Result := TRUE;
|
||||
@@ -15250,6 +15281,8 @@ begin
|
||||
end;
|
||||
FScrollBars := Value;
|
||||
Change;
|
||||
//dufa
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TKOLScrollBox.SetupConstruct_Compact;
|
||||
@@ -15315,6 +15348,11 @@ begin
|
||||
Result := 'ScrollBoxEx';
|
||||
end;
|
||||
|
||||
function TKOLScrollBox.WYSIWIGPaintImplemented: Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
{ TKOLMDIClient }
|
||||
|
||||
var MDIWarningLastTime: Integer;
|
||||
@@ -16874,6 +16912,15 @@ begin
|
||||
Width := DefaultWidth;
|
||||
end;
|
||||
|
||||
procedure TKOLScrollBar.Paint;
|
||||
begin
|
||||
if not (Assigned(FKOLCtrl) and (PaintType in [ptWYSIWIG, ptWYSIWIGFrames])) then begin
|
||||
PrepareCanvasFontForWYSIWIGPaint( Canvas );
|
||||
DrawScrollBar(True, Canvas.Handle, ClientRect, Enabled, (SBbar = KOL.sbVertical), SBPosition, SBMin, SBMax);
|
||||
end;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TKOLScrollBar.Pcode_Generate: Boolean;
|
||||
begin
|
||||
Result := TRUE;
|
||||
@@ -17096,6 +17143,11 @@ begin
|
||||
Result := TRUE;
|
||||
end;
|
||||
|
||||
function TKOLScrollBar.WYSIWIGPaintImplemented: Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
{ TKOLTabPage }
|
||||
|
||||
function TKOLTabPage.TypeName: String;
|
||||
|
@@ -8528,6 +8528,8 @@ begin
|
||||
else
|
||||
inherited Enabled := Faction.Enabled;
|
||||
Change;
|
||||
//dufa
|
||||
Invalidate;
|
||||
end;
|
||||
LogOK;
|
||||
finally
|
||||
|
Reference in New Issue
Block a user