mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 06:29:29 +02:00
Fixed unicode support for TStatusBar and TListView under windows.
git-svn-id: trunk@12810 -
This commit is contained in:
parent
579e90adec
commit
5b8a949fe8
@ -264,7 +264,15 @@ begin
|
|||||||
pbLowered: BevelType := 0;
|
pbLowered: BevelType := 0;
|
||||||
pbRaised: BevelType := Windows.SBT_POPOUT;
|
pbRaised: BevelType := Windows.SBT_POPOUT;
|
||||||
end;
|
end;
|
||||||
Windows.SendMessage(StatusPanel.StatusBar.Handle, SB_SETTEXT, StatusPanel.Index or BevelType, LPARAM(PChar(Text)));
|
|
||||||
|
{$ifdef WindowsUnicodeSupport}
|
||||||
|
if UnicodeEnabledOS then
|
||||||
|
Windows.SendMessage(StatusPanel.StatusBar.Handle, SB_SETTEXTW, StatusPanel.Index or BevelType, LPARAM(PWideChar(Utf8Decode(Text))))
|
||||||
|
else
|
||||||
|
Windows.SendMessage(StatusPanel.StatusBar.Handle, SB_SETTEXT, StatusPanel.Index or BevelType, LPARAM(PChar(Utf8ToAnsi(Text))));
|
||||||
|
{$else}
|
||||||
|
Windows.SendMessage(StatusPanel.StatusBar.Handle, SB_SETTEXT, StatusPanel.Index or BevelType, LPARAM(PChar(Text)));
|
||||||
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure UpdateStatusBarPanelWidths(const StatusBar: TStatusBar);
|
procedure UpdateStatusBarPanelWidths(const StatusBar: TStatusBar);
|
||||||
@ -348,7 +356,14 @@ end;
|
|||||||
class procedure TWin32WSStatusBar.SetPanelText(const AStatusBar: TStatusBar; PanelIndex: integer);
|
class procedure TWin32WSStatusBar.SetPanelText(const AStatusBar: TStatusBar; PanelIndex: integer);
|
||||||
begin
|
begin
|
||||||
if AStatusBar.SimplePanel then
|
if AStatusBar.SimplePanel then
|
||||||
|
{$ifdef WindowsUnicodeSupport}
|
||||||
|
if UnicodeEnabledOS then
|
||||||
|
Windows.SendMessage(AStatusBar.Handle, SB_SETTEXTW, 255, LPARAM(PWideChar(Utf8Decode(AStatusBar.SimpleText))))
|
||||||
|
else
|
||||||
|
Windows.SendMessage(AStatusBar.Handle, SB_SETTEXT, 255, LPARAM(PChar(Utf8ToAnsi(AStatusBar.SimpleText))))
|
||||||
|
{$else}
|
||||||
Windows.SendMessage(AStatusBar.Handle, SB_SETTEXT, 255, LPARAM(PChar(AStatusBar.SimpleText)))
|
Windows.SendMessage(AStatusBar.Handle, SB_SETTEXT, 255, LPARAM(PChar(AStatusBar.SimpleText)))
|
||||||
|
{$endif}
|
||||||
else
|
else
|
||||||
UpdateStatusBarPanel(AStatusBar.Panels[PanelIndex]);
|
UpdateStatusBarPanel(AStatusBar.Panels[PanelIndex]);
|
||||||
end;
|
end;
|
||||||
|
@ -110,9 +110,22 @@ begin
|
|||||||
then Exit;
|
then Exit;
|
||||||
|
|
||||||
lvc.Mask := LVCF_TEXT;
|
lvc.Mask := LVCF_TEXT;
|
||||||
lvc.pszText := PChar(AColumn.Caption);
|
|
||||||
|
|
||||||
ListView_InsertColumn(ALV.Handle, AIndex, lvc);
|
{$ifdef WindowsUnicodeSupport}
|
||||||
|
if UnicodeEnabledOS then
|
||||||
|
begin
|
||||||
|
lvc.pszText := PChar(PWideChar(Utf8Decode(AColumn.Caption)));
|
||||||
|
SendMessage(ALV.Handle, LVM_INSERTCOLUMNW, WPARAM(AIndex), LPARAM(@lvc));
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
lvc.pszText := PChar(Utf8ToAnsi(AColumn.Caption));
|
||||||
|
ListView_InsertColumn(ALV.Handle, AIndex, lvc);
|
||||||
|
end;
|
||||||
|
{$else}
|
||||||
|
lvc.pszText := PChar(AColumn.Caption);
|
||||||
|
ListView_InsertColumn(ALV.Handle, AIndex, lvc);
|
||||||
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWin32WSCustomListView.ColumnMove(const ALV: TCustomListView; const AOldIndex, ANewIndex: Integer; const AColumn: TListColumn);
|
class procedure TWin32WSCustomListView.ColumnMove(const ALV: TCustomListView; const AOldIndex, ANewIndex: Integer; const AColumn: TListColumn);
|
||||||
@ -193,9 +206,22 @@ begin
|
|||||||
then Exit;
|
then Exit;
|
||||||
|
|
||||||
lvc.Mask := LVCF_TEXT;
|
lvc.Mask := LVCF_TEXT;
|
||||||
lvc.pszText := PChar(ACaption);
|
|
||||||
|
|
||||||
ListView_SetColumn(ALV.Handle, AIndex, lvc);
|
{$ifdef WindowsUnicodeSupport}
|
||||||
|
if UnicodeEnabledOS then
|
||||||
|
begin
|
||||||
|
lvc.pszText := PChar(PWideChar(Utf8Decode(AColumn.Caption)));
|
||||||
|
SendMessage(ALV.Handle, LVM_SETCOLUMNW, WPARAM(AIndex), LPARAM(@lvc));
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
lvc.pszText := PChar(Utf8ToAnsi(ACaption));
|
||||||
|
ListView_SetColumn(ALV.Handle, AIndex, lvc);
|
||||||
|
end;
|
||||||
|
{$else}
|
||||||
|
lvc.pszText := PChar(ACaption);
|
||||||
|
ListView_SetColumn(ALV.Handle, AIndex, lvc);
|
||||||
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWin32WSCustomListView.ColumnSetImage(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AImageIndex: Integer);
|
class procedure TWin32WSCustomListView.ColumnSetImage(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AImageIndex: Integer);
|
||||||
@ -340,9 +366,22 @@ begin
|
|||||||
lvi.Mask := LVIF_TEXT;
|
lvi.Mask := LVIF_TEXT;
|
||||||
lvi.iItem := AIndex;
|
lvi.iItem := AIndex;
|
||||||
lvi.iSubItem := 0;
|
lvi.iSubItem := 0;
|
||||||
lvi.pszText := PChar(AItem.Caption);
|
|
||||||
|
|
||||||
ListView_InsertItem(ALV.Handle, lvi);
|
{$ifdef WindowsUnicodeSupport}
|
||||||
|
if UnicodeEnabledOS then
|
||||||
|
begin
|
||||||
|
lvi.pszText := PChar(PWideChar(Utf8Decode(AItem.Caption)));
|
||||||
|
SendMessage(ALV.Handle, LVM_INSERTITEMW, 0, LPARAM(@lvi));
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
lvi.pszText := PChar(Utf8ToAnsi(AItem.Caption));
|
||||||
|
ListView_InsertItem(ALV.Handle, lvi);
|
||||||
|
end;
|
||||||
|
{$else}
|
||||||
|
lvi.pszText := PChar(AItem.Caption);
|
||||||
|
ListView_InsertItem(ALV.Handle, lvi);
|
||||||
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWin32WSCustomListView.ItemSetChecked(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AChecked: Boolean);
|
class procedure TWin32WSCustomListView.ItemSetChecked(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AChecked: Boolean);
|
||||||
@ -396,11 +435,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWin32WSCustomListView.ItemSetText(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex: Integer; const AText: String);
|
class procedure TWin32WSCustomListView.ItemSetText(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex: Integer; const AText: String);
|
||||||
|
{$ifdef WindowsUnicodeSupport}
|
||||||
|
var
|
||||||
|
_gnu_lvi : LV_ITEM;
|
||||||
|
{$endif}
|
||||||
begin
|
begin
|
||||||
if not WSCheckHandleAllocated(ALV, 'ItemSetText')
|
if not WSCheckHandleAllocated(ALV, 'ItemSetText')
|
||||||
then Exit;
|
then Exit;
|
||||||
|
|
||||||
ListView_SetItemText(ALV.Handle, AIndex, ASubIndex, PChar(AText));
|
{$ifdef WindowsUnicodeSupport}
|
||||||
|
if UnicodeEnabledOS then
|
||||||
|
begin
|
||||||
|
_gnu_lvi.iSubItem := ASubIndex;
|
||||||
|
_gnu_lvi.pszText := PChar(PWideChar(Utf8Decode(AText)));
|
||||||
|
|
||||||
|
SendMessage(ALV.Handle, LVM_SETITEMTEXTW, WPARAM(AIndex), LPARAM(@_gnu_lvi));
|
||||||
|
end
|
||||||
|
else
|
||||||
|
ListView_SetItemText(ALV.Handle, AIndex, ASubIndex, PChar(Utf8ToAnsi(AText)));
|
||||||
|
{$else}
|
||||||
|
ListView_SetItemText(ALV.Handle, AIndex, ASubIndex, PChar(AText));
|
||||||
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWin32WSCustomListView.ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean);
|
class procedure TWin32WSCustomListView.ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean);
|
||||||
|
Loading…
Reference in New Issue
Block a user