View Issue Details

IDProjectCategoryView StatusLast Update
0003906JEDI VCL00 JVCL Componentspublic2006-09-19 08:13
ReporterykamiAssigned Toobones 
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version3.30 
Summary0003906: JVListView - Header Image is displayed at the right of the text.
DescriptionI want you to add the function to display header image at
 the right of the header text to JvListView.
I implemented HeaderImagePosition property, based on Rev.10925.
TagsNo tags attached.

Activities

2006-09-14 09:35

 

JvListView.pas (84,373 bytes)

obones

2006-09-14 10:09

administrator   ~0010123

Please provide a diff file, it makes it easier to integrate.

2006-09-14 10:20

 

JvListView.patch (8,421 bytes)
*** Org\JvListView.pas	Fri Sep 15 01:06:06 2006
--- JvListView.pas	Fri Sep 15 00:16:42 2006
***************
*** 42,47 ****
--- 42,48 ----
  
  type
    TJvViewStyle = (vsIcon, vsSmallIcon, vsList, vsReport, vsTile);
+   TJvHeaderImagePosition = (hipLeft, hipRight);
  
  const
    WM_AUTOSELECT = WM_USER + 1;
***************
*** 135,150 ****
--- 136,158 ----
  
    TJvListExtendedColumn = class(TCollectionItem)
    private
+     FHeaderImagePosition: TJvHeaderImagePosition;
      FSortMethod: TJvSortMethod;
      FUseParentSortMethod: Boolean;
+     FUseParentHeaderImagePosition: Boolean;
      function GetSortMethod: TJvSortMethod;
      procedure SetSortMethod(const Value: TJvSortMethod);
+     function GetHeaderImagePosition: TJvHeaderImagePosition;
+     procedure SetHeaderImagePosition(const Value: TJvHeaderImagePosition);
+     procedure SetUseParentHeaderImagePosition(const Value: Boolean);
    public
      constructor Create(Collection: Classes.TCollection); override;
  
      procedure Assign(AValue: TPersistent); override;
    published
+     property HeaderImagePosition: TJvHeaderImagePosition read GetHeaderImagePosition write SetHeaderImagePosition default hipLeft;
      property SortMethod: TJvSortMethod read GetSortMethod write SetSortMethod default smAutomatic;
+     property UseParentHeaderImagePosition : Boolean read FUseParentHeaderImagePosition write SetUseParentHeaderImagePosition default True;
      property UseParentSortMethod : Boolean read FUseParentSortMethod write FUseParentSortMethod default True;
    end;
  
***************
*** 318,323 ****
--- 326,332 ----
      FOnHorizontalScroll: TNotifyEvent;
      FOnVerticalScroll: TNotifyEvent;
      FImageChangeLink: TChangeLink;
+     FHeaderImagePosition: TJvHeaderImagePosition;
      FHeaderImages: TCustomImageList;
      FAutoSelect: Boolean;
      FPicture: TPicture;
***************
*** 332,337 ****
--- 341,347 ----
      FTileViewProperties: TJvTileViewProperties;
      FInsertMarkColor: TColor;
      FSettingJvViewStyle: Boolean;
+     FSettingHeaderImagePosition: Boolean;
      procedure DoPictureChange(Sender: TObject);
      procedure SetPicture(const Value: TPicture);
      procedure SetGroupView(const Value: Boolean);
***************
*** 339,344 ****
--- 349,355 ----
      procedure SetGroupsProperties(const Value: TJvGroupsProperties);
      procedure SetTileViewProperties(const Value: TJvTileViewProperties);
      procedure SetInsertMarkColor(const Value: TColor);
+     procedure SetHeaderImagePosition(const Value: TJvHeaderImagePosition);
      procedure SetHeaderImages(const Value: TCustomImageList);
      procedure UpdateHeaderImages(HeaderHandle: Integer);
      procedure WMAutoSelect(var Msg: TMessage); message WM_AUTOSELECT;
***************
*** 377,382 ****
--- 388,394 ----
      procedure WMNCCalcSize(var Msg: TWMNCCalcSize); message WM_NCCALCSIZE;
      procedure LVMDeleteColumn(var Msg: TMessage); message LVM_DELETECOLUMN;
      procedure LVMInsertColumn(var Msg: TMessage); message LVM_INSERTCOLUMN;
+     procedure LVMSetColumn(var Msg: TMessage); message LVM_SETCOLUMN;
  
      procedure InsertItem(Item: TListItem); override;
      function IsCustomDrawn(Target: TCustomDrawTarget; Stage: TCustomDrawStage): Boolean; {$IFDEF COMPILER6_UP} override; {$ENDIF}
***************
*** 425,430 ****
--- 437,443 ----
      property ColumnsOrder: string read GetColumnsOrder write SetColumnsOrder;
      property HintColor;
      property Picture: TPicture read FPicture write SetPicture;
+     property HeaderImagePosition: TJvHeaderImagePosition read FHeaderImagePosition write SetHeaderImagePosition default hipLeft;
      property HeaderImages: TCustomImageList read FHeaderImages write SetHeaderImages;
      property SortMethod: TJvSortMethod read FSortMethod write FSortMethod default smAutomatic;
      property SortOnClick: Boolean read FSortOnClick write FSortOnClick default True;
***************
*** 466,472 ****
    UnitVersioning: TUnitVersionInfo = (
      RCSfile: '$URL: https://svn.sourceforge.net:443/svnroot/jvcl/trunk/jvcl/run/JvListView.pas $';
      Revision: '$Revision: 10925 $';
!     Date: '$Date: 2006-09-01 17:49:37 +0900 (金, 01 9 2006) $';
      LogPath: 'JVCL\run'
      );
  {$ENDIF UNITVERSIONING}
--- 479,485 ----
    UnitVersioning: TUnitVersionInfo = (
      RCSfile: '$URL: https://svn.sourceforge.net:443/svnroot/jvcl/trunk/jvcl/run/JvListView.pas $';
      Revision: '$Revision: 10925 $';
!     Date: '$Date: 2006-09-01 17:49:37 +0900 (釁E 01 9 2006) $';
      LogPath: 'JVCL\run'
      );
  {$ENDIF UNITVERSIONING}
***************
*** 846,851 ****
--- 859,867 ----
    begin
      FSortMethod := TJvListExtendedColumn(AValue). SortMethod;
      FUseParentSortMethod := TJvListExtendedColumn(AValue).UseParentSortMethod;
+ 
+     FHeaderImagePosition := TJvListExtendedColumn(AValue).HeaderImagePosition;
+     FUseParentHeaderImagePosition := TJvListExtendedColumn(AValue).UseParentHeaderImagePosition;
    end
    else
      inherited Assign(AValue);
***************
*** 857,862 ****
--- 873,889 ----
  
    FSortMethod := smAutomatic;
    FUseParentSortMethod := True;
+ 
+   FHeaderImagePosition := hipLeft;
+   FUseParentHeaderImagePosition := True;
+ end;
+ 
+ function TJvListExtendedColumn.GetHeaderImagePosition: TJvHeaderImagePosition;
+ begin
+   if (TJvListExtendedColumns(Collection).Owner is TJvListView) and UseParentHeaderImagePosition then
+     Result := TJvListView(TJvListExtendedColumns(Collection).Owner).HeaderImagePosition
+   else
+     Result := FHeaderImagePosition;
  end;
  
  function TJvListExtendedColumn.GetSortMethod: TJvSortMethod;
***************
*** 867,872 ****
--- 894,912 ----
      Result := FSortMethod;
  end;
  
+ procedure TJvListExtendedColumn.SetHeaderImagePosition(
+   const Value: TJvHeaderImagePosition);
+ begin
+   FHeaderImagePosition := Value;
+   UseParentHeaderImagePosition := False;
+ 
+   if (TJvListExtendedColumns(Collection).Owner is TJvListView) then
+   begin
+     TJvListView(TJvListExtendedColumns(Collection).Owner).DoHeaderImagesChange(Self);
+   end;
+ 
+ end;
+ 
  procedure TJvListExtendedColumn.SetSortMethod(
    const Value: TJvSortMethod);
  begin
***************
*** 874,879 ****
--- 914,932 ----
    UseParentSortMethod := False;
  end;
  
+ procedure TJvListExtendedColumn.SetUseParentHeaderImagePosition(
+   const Value: Boolean);
+ begin
+   if FUseParentHeaderImagePosition <> Value then
+   begin
+     FUseParentHeaderImagePosition := Value;
+     if (TJvListExtendedColumns(Collection).Owner is TJvListView) then
+     begin
+       TJvListView(TJvListExtendedColumns(Collection).Owner).DoHeaderImagesChange(Self);
+     end;
+   end;
+ end;
+ 
  { TJvListExtendedColumns }
  
  constructor TJvListExtendedColumns.Create(AOwner: TPersistent);
***************
*** 926,931 ****
--- 979,986 ----
  
    FTileViewProperties.OnChange := TileViewPropertiesChange;
    FGroupsProperties.OnChange := GroupsPropertiesChange;
+ 
+   FHeaderImagePosition := hipLeft;
  end;
  
  destructor TJvListView.Destroy;
***************
*** 941,946 ****
--- 996,1029 ----
    inherited Destroy;
  end;
  
+ procedure TJvListView.LVMSetColumn(var Msg: TMessage);
+ var
+   i: Integer;
+   Column: tagLVCOLUMNA;
+ begin
+   inherited;
+ 
+   if not FSettingHeaderImagePosition then
+   begin
+     for i := 0 to ExtendedColumns.Count - 1 do
+     begin
+       if ExtendedColumns[i].GetHeaderImagePosition = hipRight then
+       begin
+         Column.mask := LVCF_FMT;
+         ListView_GetColumn(Handle, i, Column);
+         if Column.fmt and LVCFMT_IMAGE <> 0 then
+         begin
+           Column.fmt := Column.fmt or LVCFMT_BITMAP_ON_RIGHT;
+           FSettingHeaderImagePosition := True;
+           ListView_SetColumn(Handle, i, Column);
+           FSettingHeaderImagePosition := False;
+         end;
+       end;
+     end;
+   end;
+ 
+ end;
+ 
  procedure TJvListView.WMHScroll(var Msg: TWMHScroll);
  begin
    inherited;
***************
*** 1708,1713 ****
--- 1791,1805 ----
      ListView_SetColumnOrderArray(Columns.Owner.Handle, Columns.Count, @Res[0]);
    finally
      Free;
+   end;
+ end;
+ 
+ procedure TJvListView.SetHeaderImagePosition(const Value: TJvHeaderImagePosition);
+ begin
+   if FHeaderImagePosition <> Value then
+   begin
+     FHeaderImagePosition := Value;
+     UpdateHeaderImages(ListView_GetHeader(Handle));
    end;
  end;
  
JvListView.patch (8,421 bytes)

ykami

2006-09-14 10:21

reporter   ~0010126

Sorry, I attached JvListView.patch.

obones

2006-09-19 08:13

administrator   ~0010144

This is now in SVN (r10939)

Issue History

Date Modified Username Field Change
2006-09-14 09:35 ykami New Issue
2006-09-14 09:35 ykami File Added: JvListView.pas
2006-09-14 10:09 obones Note Added: 0010123
2006-09-14 10:09 obones Status new => feedback
2006-09-14 10:20 ykami File Added: JvListView.patch
2006-09-14 10:21 ykami Note Added: 0010126
2006-09-19 08:13 obones Status feedback => resolved
2006-09-19 08:13 obones Fixed in Version => Daily / SVN
2006-09-19 08:13 obones Resolution open => fixed
2006-09-19 08:13 obones Assigned To => obones
2006-09-19 08:13 obones Note Added: 0010144