win32: implement winapi GradientFill function (strange that it is implemented for gtk only)

git-svn-id: trunk@20037 -
This commit is contained in:
paul 2009-05-19 04:36:37 +00:00
parent a8de187566
commit 385d9cdf40
4 changed files with 21 additions and 3 deletions

View File

@ -1205,7 +1205,7 @@ begin
Changing;
RequiredState([csHandleValid, csFontValid, csBrushValid]);
Flags := 0;
If TextStyle.Opaque then
if TextStyle.Opaque then
Flags := ETO_Opaque;
ExtUTF8Out(FHandle, X, Y, Flags, nil, PChar(Text), Length(Text), nil);
MoveTo(X + TextWidth(Text), Y);

View File

@ -387,6 +387,7 @@ const
// load dynamic and use ownfunction if not defined
var
AlphaBlend: function(hdcDest: HDC; nXOriginDest, nYOriginDest, nWidthDest, nHeightDest: Integer; hdcSrc: HDC; nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc: Integer; blendFunction: TBlendFunction): BOOL; stdcall;
GradientFill: function(DC: HDC; p2: PTriVertex; p3: ULONG; p4: Pointer; p5, p6: ULONG): BOOL; stdcall;
GetComboBoxInfo: function(hwndCombo: HWND; pcbi: PComboboxInfo): BOOL; stdcall;
EnumDisplayMonitors: function(hdc: HDC; lprcClip: PRect; lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool; stdcall;
GetMonitorInfo: function(hMonitor: HMONITOR; lpmi: PMonitorInfo): Boolean; stdcall;
@ -394,8 +395,6 @@ var
MonitorFromRect: function(lprcScreenCoords: PRect; dwFlags: DWord): HMONITOR; stdcall;
MonitorFromPoint: function(ptScreenCoords: TPoint; dwFlags: DWord): HMONITOR; stdcall;
const
// ComCtlVersions
ComCtlVersionIE3 = $00040046;
@ -900,6 +899,11 @@ begin
Result := _AlphaBlend(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, blendFunction);
end;
function _GradientFill(DC: HDC; p2: PTriVertex; p3: ULONG; p4: Pointer; p5, p6: ULONG): BOOL;
begin
Result := False;
end;
function _GetComboboxInfo(hwndCombo: HWND; pcbi: PComboboxInfo): BOOL; stdcall;
begin
Result := (pcbi <> nil) and (pcbi^.cbSize = SizeOf(TComboboxInfo));
@ -1082,6 +1086,11 @@ begin
Pointer(AlphaBlend) := p;
end;
end;
p := GetProcAddress(msimg32handle, 'GradientFill');
if p <> nil then
Pointer(GradientFill) := p
else
Pointer(GradientFill) := @_GradientFill;
end;
user32handle := LoadLibrary(user32lib);

View File

@ -2355,6 +2355,13 @@ begin
AdjustForBuddySize;
end;
function TWin32WidgetSet.GradientFill(DC: HDC; Vertices: PTriVertex;
NumVertices: Longint; Meshes: Pointer; NumMeshes: Longint; Mode: Longint): Boolean;
begin
Result := Win32Extra.GradientFill(DC, Windows.PTRIVERTEX(Vertices),
NumVertices, Meshes, NumMeshes, Mode);
end;
{------------------------------------------------------------------------------
Method: HideCaret
Params: HWnd - handle to the window with the caret

View File

@ -127,6 +127,8 @@ function GetWindowOrgEx(DC: HDC; P: PPoint): Integer; override;
function GetWindowRect(Handle: HWND; Var Rect: TRect): Integer; override;
function GetWindowRelativePosition(Handle : HWND; var Left, Top:integer): boolean; override;
function GetWindowSize(Handle : hwnd; var Width, Height: integer): boolean; override;
function GradientFill(DC: HDC; Vertices: PTriVertex; NumVertices : Longint;
Meshes: Pointer; NumMeshes : Longint; Mode : Longint): Boolean; override;
function HideCaret(HWnd: HWND): Boolean; override;