EditorToolbar: Make the ListView work with both QT and OSX. Requires IFDEFs. Patch from Balázs Székely.

git-svn-id: trunk@48580 -
This commit is contained in:
juha 2015-04-01 19:56:10 +00:00
parent c12cc20d48
commit 8599779fa6
2 changed files with 23 additions and 2 deletions

View File

@ -304,7 +304,7 @@ object EdtTbConfigForm: TEdtTbConfigForm
item
AutoSize = True
Caption = 'Name'
Width = 100
Width = 314
end
item
AutoSize = True
@ -313,7 +313,6 @@ object EdtTbConfigForm: TEdtTbConfigForm
Width = 0
end>
HideSelection = False
OwnerDraw = True
PopupMenu = puMenuItems
ReadOnly = True
ScrollBars = ssAutoBoth

View File

@ -155,6 +155,10 @@ end;
procedure TEdtTbConfigForm.FormCreate(Sender: TObject);
begin
inherited;
//we have to ownerdraw the listview on qt
{$IFDEF LCLQT}
lvToolbar.OwnerDraw := True;
{$ENDIF}
pnlButtons.Color := clBtnFace;
// load button images
@ -343,6 +347,12 @@ begin
lvItem.Caption := ACaption;
lvItem.Data := n.Data;
lvItem.SubItems.Add(IntToStr(CurrProfile));
{$IF not DEFINED(LCLQt)}
if n.ImageIndex > -1 then
lvItem.ImageIndex := n.ImageIndex
else
lvItem.ImageIndex := defImageIndex;
{$ENDIF}
if anIndex > -1 then begin
// clear previous selection to avoid double sel in Qt
lvToolbar.Selected := nil;
@ -564,6 +574,9 @@ begin
lvItem := lvToolbar.Items.Add;
lvItem.Selected := False;
lvItem.Caption:= cDivider;
{$IF not DEFINED(LCLQt)}
lvItem.ImageIndex:= divImageIndex;
{$ENDIF}
lvItem.SubItems.Add(IntToStr(CurrProfile));
if lvToolbar.ItemIndex > -1 then
InsertMainListItem(lvItem,lvToolbar.Items[anIndex])
@ -841,6 +854,12 @@ begin
lvItem := lvToolbar.Items.Add;
lvItem.Caption:= ACaption;
lvItem.Data:= Item;
{$IF not DEFINED(LCLQt)}
if Item.ImageIndex > -1 then
lvItem.ImageIndex:= Item.ImageIndex
else
lvItem.ImageIndex:= defImageIndex;
{$ENDIF}
lvItem.SubItems.Add(IntToStr(PMask));
n:= TV.Items.FindNodeWithData(Item);
n.Visible:= False;
@ -853,6 +872,9 @@ var
begin
lvItem := lvToolbar.Items.Add;
lvItem.Caption:= cDivider;
{$IF not DEFINED(LCLQt)}
lvItem.ImageIndex:= divImageIndex;
{$ENDIF}
lvItem.SubItems.Add(IntToStr(PMask));
end;