Qt: Implemented ShowScrollBar() - qtwinapi.

git-svn-id: trunk@12239 -
This commit is contained in:
zeljko 2007-09-29 11:59:46 +00:00
parent 17af4bdc91
commit b9d2ceec0d
2 changed files with 60 additions and 0 deletions

View File

@ -4297,6 +4297,65 @@ begin
TQtDeviceContext(DC).vTextColor := ColorToRGB(Color); // be sure we get TColorRef
end;
{------------------------------------------------------------------------------
function ShowScrollBar(Handle: HWND; wBar: Integer; bShow: Boolean): Boolean;
Params Handle: HWND; wBar: Integer; bShow: Boolean
Result
------------------------------------------------------------------------------}
function TQtWidgetSet.ShowScrollBar(Handle: HWND; wBar: Integer; bShow: Boolean): Boolean;
var
w: TQtWidget;
ScrollArea: TQtAbstractScrollArea;
begin
{$ifdef VerboseQtWinAPI}
WriteLn('[WinAPI ShowScrollBar] Handle: ', dbghex(Handle),' wBar: ',wBar);
{$endif}
Result := (Handle <> 0);
if not Result then exit;
w := TQtWidget(Handle);
if w is TQtAbstractScrollArea then
begin
ScrollArea := TQtAbstractScrollArea(w);
case wBar of
SB_BOTH:
begin
if bShow then
ScrollArea.setScrollStyle(ssBoth)
else
ScrollArea.setScrollStyle(ssNone);
end;
SB_HORZ:
begin
if bShow then
ScrollArea.setScrollStyle(ssHorizontal)
else
QAbstractScrollArea_setHorizontalScrollBarPolicy(QAbstractScrollAreaH(ScrollArea.Widget), QtScrollBarAlwaysOff);
end;
SB_VERT:
begin
if bShow then
ScrollArea.setScrollStyle(ssVertical)
else
QAbstractScrollArea_setVerticalScrollBarPolicy(QAbstractScrollAreaH(ScrollArea.Widget), QtScrollBarAlwaysOff);
end;
SB_CTL:
begin
if bShow then
ScrollArea.Show
else
ScrollArea.Hide;
end;
end;
end else
Result := False;
end;
{------------------------------------------------------------------------------
function ShowWindow(hWnd: HWND; nCmdShow: Integer): Boolean;

View File

@ -176,6 +176,7 @@ function SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo
function SetTextColor(DC: HDC; Color: TColorRef): TColorRef; override;
function SetWindowOrgEx(DC : HDC; NewX, NewY : Integer; OldPoint: PPoint) : Boolean; override;
function ShowCaret(hWnd: HWND): Boolean; override;
function ShowScrollBar(Handle: HWND; wBar: Integer; bShow: Boolean): Boolean; override;
function ShowWindow(hWnd: HWND; nCmdShow: Integer): Boolean; override;
function StretchBlt(DestDC: HDC; X, Y, Width, Height: Integer;
SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; ROp: Cardinal): Boolean; override;