- move erase before paint in invalidateRect
- fix TQtWSCustomNotebook.GetTabIndexAtPos
- some code formatting and cleanup

git-svn-id: trunk@12078 -
This commit is contained in:
paul 2007-09-19 15:39:26 +00:00
parent fd93c72668
commit 615e7fb75a
4 changed files with 35 additions and 31 deletions

View File

@ -266,6 +266,7 @@ type
procedure DrawText(x,y,w,h,flags: Integer; s:PWideString); overload;
procedure drawLine(x1: Integer; y1: Integer; x2: Integer; y2: Integer);
procedure drawEllipse(x: Integer; y: Integer; w: Integer; h: Integer);
procedure eraseRect(ARect: PRect);
procedure fillRect(ARect: PRect; ABrush: QBrushH); overload;
procedure fillRect(x, y, w, h: Integer; ABrush: QBrushH); overload;
procedure fillRect(x, y, w, h: Integer); overload;
@ -1560,6 +1561,11 @@ begin
QPainter_drawEllipse(Widget, x, y, w, h);
end;
procedure TQtDeviceContext.eraseRect(ARect: PRect);
begin
QPainter_eraseRect(Widget, ARect);
end;
procedure TQtDeviceContext.fillRect(ARect: PRect; ABrush: QBrushH);
begin
{$ifdef VerboseQt}

View File

@ -527,6 +527,7 @@ type
procedure SignalCurrentChanged(Index: Integer); cdecl;
public
function indexOf(const AWidget: QWidgetH): integer;
function insertTab(index: Integer; page: QWidgetH; p2: WideString): Integer; overload;
function insertTab(index: Integer; page: QWidgetH; icon: QIconH; p2: WideString): Integer; overload;
function getCurrentIndex: Integer;
@ -4310,9 +4311,7 @@ end;
function TQtTabWidget.getTabBar: QTabBarH;
begin
if FTabBar = nil then
begin
// FTabBar := QTabWidget_tabBar(QTabWidgetH(Widget));
end;
FTabBar := QLCLTabWidget_tabBarHandle(QTabWidgetH(Widget));
Result := FTabBar;
end;
@ -4418,6 +4417,11 @@ begin
end;
end;
function TQtTabWidget.indexOf(const AWidget: QWidgetH): integer;
begin
Result := QTabWidget_indexOf(QTabWidgetH(Widget), AWidget);
end;
procedure TQtTabWidget.setTabText(index: Integer; p2: WideString);
begin
QTabWidget_setTabText(QTabWidgetH(Widget), index, @p2);

View File

@ -1338,11 +1338,11 @@ end;
------------------------------------------------------------------------------}
function TQtWidgetSet.EnumFontFamiliesEx(DC: HDC; lpLogFont: PLogFont; Callback: FontEnumExProc; Lparam: LParam; Flags: dword): longint;
var
EnumLogFont: TEnumLogFontEx;
Metric: TNewTextMetricEx;
FontList: TStringList;
FontType: Integer;
i: Integer;
EnumLogFont: TEnumLogFontEx;
Metric: TNewTextMetricEx;
FontList: TStringList;
FontType: Integer;
i: Integer;
function QtGetFontFamilies(var List:TStringList):integer;
var
@ -1355,7 +1355,7 @@ var
FontDB := QFontDatabase_create();
StrLst := QStringList_create;
try
QFontDatabase_families(FontDB,StrLst);
QFontDatabase_families(FontDB, StrLst);
Result := QStringList_size(StrLst);
for j := 0 to Result - 1 do
begin
@ -1366,7 +1366,7 @@ var
QFontDatabase_destroy(FontDB);
QStringList_destroy(StrLst);
end;
end;
end;
begin
{$ifdef VerboseQtWinAPI}
@ -1375,25 +1375,25 @@ begin
Result := 0;
if (lpLogFont^.lfCharSet = DEFAULT_CHARSET) and
(lpLogFont^.lfFaceName= '') and
(lpLogFont^.lfPitchAndFamily = 0) then
(lpLogFont^.lfFaceName= '') and
(lpLogFont^.lfPitchAndFamily = 0) then
begin
FontList := TStringList.create;
try
if QtGetFontFamilies(FontList)>0 then
if QtGetFontFamilies(FontList) > 0 then
begin
for i := 0 to FontList.Count-1 do
begin
EnumLogFont.elfLogFont.lfFaceName := FontList[i];
Result := Callback(EnumLogFont, Metric, FontType, LParam);
EnumLogFont.elfLogFont.lfFaceName := FontList[i];
Result := Callback(EnumLogFont, Metric, FontType, LParam);
end;
end;
finally
FontList.free;
FontList.free;
end;
end else
begin
{$note implement}
{$note implement}
Result := 0;
end;
end;
@ -2537,7 +2537,6 @@ function TQtWidgetSet.GetSysColor(nIndex: Integer): DWORD;
function GetColor(Group: QPaletteColorGroup; Role: QPaletteColorRole): TColor;
var
Handle : QPaletteH;
QColor : PQColor;
begin
Handle := QPalette_create;
QApplication_palette(Handle);
@ -3234,7 +3233,6 @@ end;
function TQtWidgetSet.InvalidateRect(aHandle: HWND; Rect: pRect; bErase: Boolean): Boolean;
var
R: TRect;
QtDC: TQtDeviceContext;
begin
{$ifdef VerboseQtWinAPI}
WriteLn('[WinAPI Invalidate Rect]');
@ -3244,14 +3242,11 @@ begin
begin
R := TQtWidget(aHandle).getClientBounds;
OffsetRect(Rect^, R.Left, R.Top);
TQtWidget(aHandle).Update(Rect);
if bErase and (TQtWidget(aHandle).Context <> 0) then
begin
QtDC := TQtDeviceContext(TQtWidget(aHandle).Context);
QPainter_eraseRect(QtDC.Widget, Rect);
end;
TQtDeviceContext(TQtWidget(aHandle).Context).eraseRect(Rect);
TQtWidget(aHandle).Update(Rect);
end else
TQtWidget(aHandle).Update;
TQtWidget(aHandle).Update;
Result := True;
end;

View File

@ -72,7 +72,7 @@ type
class function GetTabIndexAtPos(const ANotebook: TCustomNotebook; const AClientPos: TPoint): integer; override;
class procedure SetPageIndex(const ANotebook: TCustomNotebook; const AIndex: integer); override;
class procedure SetTabCaption(const ANotebook: TCustomNotebook; const AChild: TCustomPage; const AText: string); virtual;
class procedure SetTabCaption(const ANotebook: TCustomNotebook; const AChild: TCustomPage; const AText: string); override;
class procedure SetTabPosition(const ANotebook: TCustomNotebook; const ATabPosition: TTabPosition); override;
class procedure ShowTabs(const ANotebook: TCustomNotebook; AShowTabs: boolean); override;
end;
@ -377,7 +377,7 @@ var
TabWidget: TQtTabWidget;
APoint: TQtPoint;
{$ifndef USE_QT_4_3}
w: QTabBarH;
w: QWidgetH;
{$endif}
begin
TabWidget := TQtTabWidget(ANotebook.Handle);
@ -387,11 +387,10 @@ begin
{$ifdef USE_QT_4_3}
Result := QTabBar_tabAt(TabWidget.TabBar, @APoint);
{$else}
w := QTabBarH(QWidget_childAt(TabWidget.TabBar, @APoint));
w := QWidget_childAt(TabWidget.TabBar, @APoint);
if w <> nil then
begin
Result := QTabWidget_indexOf(QTabWidgetH(TabWidget.Widget), w);
end else
Result := TabWidget.indexOf(w);
else
Result := -1;
{$endif}
end