mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 13:20:13 +02:00
win32, qt: fix retrieving correct imageindex for page (bug #0012029)
git-svn-id: trunk@18230 -
This commit is contained in:
parent
5df806377b
commit
5612e34a33
@ -309,13 +309,13 @@ function TCustomNotebook.GetImageIndex(ThePageIndex: Integer): Integer;
|
||||
var
|
||||
APage: TCustomPage;
|
||||
begin
|
||||
APage:=Page[ThePageIndex];
|
||||
if APage<>nil then
|
||||
Result:=APage.ImageIndex
|
||||
APage := Page[ThePageIndex];
|
||||
if APage <> nil then
|
||||
Result := APage.ImageIndex
|
||||
else
|
||||
Result:=-1;
|
||||
Result := -1;
|
||||
if Assigned(OnGetImageIndex) then
|
||||
OnGetImageIndex(Self,ThePageIndex,Result);
|
||||
OnGetImageIndex(Self, ThePageIndex, Result);
|
||||
end;
|
||||
|
||||
function TCustomNotebook.IndexOf(APage: TCustomPage): integer;
|
||||
|
@ -256,19 +256,23 @@ end;
|
||||
class procedure TQtWSCustomPage.UpdateProperties(const ACustomPage: TCustomPage);
|
||||
var
|
||||
ImageList: TCustomImageList;
|
||||
ImageIndex: Integer;
|
||||
Bmp: TBitmap;
|
||||
begin
|
||||
ImageList := TCustomNoteBook(ACustomPage.Parent).Images;
|
||||
|
||||
if Assigned(ImageList) and (ACustomPage.ImageIndex >= 0) and
|
||||
(ACustomPage.ImageIndex < ImageList.Count) then
|
||||
if Assigned(ImageList) then
|
||||
begin
|
||||
Bmp := TBitmap.Create;
|
||||
try
|
||||
ImageList.GetBitmap(ACustomPage.ImageIndex, Bmp);
|
||||
TQtPage(ACustomPage.Handle).setIcon(TQtImage(Bmp.Handle).AsIcon);
|
||||
finally
|
||||
Bmp.Free;
|
||||
ImageIndex := TCustomNoteBook(ACustomPage.Parent).GetImageIndex(ACustomPage.PageIndex);
|
||||
if (ImageIndex >= 0) and (ImageIndex < ImageList.Count) then
|
||||
begin
|
||||
Bmp := TBitmap.Create;
|
||||
try
|
||||
ImageList.GetBitmap(ACustomPage.ImageIndex, Bmp);
|
||||
TQtPage(ACustomPage.Handle).setIcon(TQtImage(Bmp.Handle).AsIcon);
|
||||
finally
|
||||
Bmp.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -58,7 +58,7 @@ type
|
||||
|
||||
TWin32WSCustomNotebook = class(TWSCustomNotebook)
|
||||
published
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): HWND; override;
|
||||
class procedure AddAllNBPages(const ANotebook: TCustomNotebook);
|
||||
class procedure AdjustSizeNotebookPages(const ANotebook: TCustomNotebook);
|
||||
@ -197,7 +197,7 @@ type
|
||||
end;
|
||||
|
||||
procedure NotebookFocusNewControl(const ANotebook: TCustomNotebook; NewIndex: integer);
|
||||
function NotebookPageRealToLCLIndex(const ANotebook: TCustomNotebook; AIndex: integer): integer;
|
||||
function NotebookPageRealToLCLIndex(const ANotebook: TCustomNotebook; AIndex: integer): integer;
|
||||
|
||||
implementation
|
||||
|
||||
@ -439,7 +439,7 @@ begin
|
||||
TCI.Mask := TCIF_TEXT or TCIF_PARAM or TCIF_IMAGE;
|
||||
// store object as extra, so we can verify we got the right page later
|
||||
TCI.lParam := PtrUInt(AChild);
|
||||
TCI.iImage := ANotebook.GetImageIndex(AIndex);
|
||||
TCI.iImage := ANotebook.GetImageIndex(NotebookPageRealToLCLIndex(ANotebook, AIndex));
|
||||
{$ifdef WindowsUnicodeSupport}
|
||||
if UnicodeEnabledOS then
|
||||
begin
|
||||
@ -459,7 +459,7 @@ begin
|
||||
// windows should send a WM_SIZE message because of this, but it doesn't
|
||||
// send it ourselves
|
||||
end;
|
||||
LCLControlSizeNeedsUpdate(ANotebook, true);
|
||||
LCLControlSizeNeedsUpdate(ANotebook, True);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -571,7 +571,7 @@ var
|
||||
begin
|
||||
Result := AIndex;
|
||||
if csDesigning in ANotebook.ComponentState then exit;
|
||||
for X := 0 to AIndex-1 do
|
||||
for X := 0 to AIndex - 1 do
|
||||
if ANotebook.Page[X].TabVisible = False then Dec(Result);
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user