From: Peter T. <pe...@us...> - 2002-10-10 09:41:03
|
Update of /cvsroot/jvcl/jvcl/source In directory usw-pr-cvs1:/tmp/cvs-serv10471/source Modified Files: JvOutEdit.pas Log Message: ImageIndex property editor now inherits from new editor in JvDsgnEditors Index: JvOutEdit.pas =================================================================== RCS file: /cvsroot/jvcl/jvcl/source/JvOutEdit.pas,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** JvOutEdit.pas 10 Oct 2002 09:05:25 -0000 1.5 --- JvOutEdit.pas 10 Oct 2002 09:41:00 -0000 1.6 *************** *** 33,37 **** interface uses ! Forms, {$IFDEF COMPILER6_UP}DesignIntf, designeditors,{$ELSE}Dsgnintf,{$ENDIF}Windows, Classes, Dialogs, Graphics, SysUtils; type --- 33,37 ---- interface uses ! Forms, JvLookOut, JvDsgnEditors, {$IFDEF COMPILER6_UP}ImgList, DesignIntf, DesignEditors,{$ELSE}Dsgnintf,{$ENDIF}Windows, Classes, Dialogs, Graphics, SysUtils; type *************** *** 89,105 **** end; ! TLookOutImageIndexProperty = class(TIntegerProperty) ! function GetAttributes: TPropertyAttributes;override; ! procedure GetValues(Proc:TGetStrProc);override; ! {$IFNDEF COMPILER6_UP } ! procedure ListMeasureWidth(const Value: string; ACanvas: TCanvas; ! var AWidth: Integer); override; ! procedure ListMeasureHeight(const Value: string; ACanvas: TCanvas; ! var AHeight: Integer); override; ! procedure ListDrawValue(const Value: string; ACanvas: TCanvas; ! const ARect: TRect; ASelected: Boolean); override; ! procedure PropDrawValue(ACanvas: TCanvas; const ARect: TRect; ! ASelected: Boolean); override; ! {$ENDIF} end; --- 89,96 ---- end; ! TLookOutImageIndexProperty = class(TJvDefaultImageIndexProperty) ! protected ! function ImageList:TCustomImageList;override; ! function GetButton:TJvCustomLookOutButton; end; *************** *** 107,112 **** implementation - uses JvLookOut; - { TLookOutPageEditor } --- 98,101 ---- *************** *** 327,417 **** { TLookOutImageIndexProperty } ! function TLookOutImageIndexProperty.GetAttributes: TPropertyAttributes; ! begin ! Result := [paValueList,paSortList,paMultiselect]; ! end; ! ! procedure TLookOutImageIndexProperty.GetValues(Proc: TGetStrProc); ! var btn:TJvLookOutButton;i:integer; ! begin ! if GetComponent(0) is TJvCustomLookOutButton then ! begin ! btn := TJvLookOutButton(GetComponent(0)); ! if (btn.ImageSize = isLarge) and Assigned(btn.LargeImages) then ! for i := 0 to btn.LargeImages.Count - 1 do ! Proc(IntToStr(i)) ! else if (btn.ImageSize = isSmall) and Assigned(btn.SmallImages) then ! for i := 0 to btn.SmallImages.Count - 1 do ! Proc(IntToStr(i)) ! end; ! end; ! ! {$IFNDEF COMPILER6_UP } ! procedure TLookOutImageIndexProperty.ListDrawValue(const Value: string; ! ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean); ! var btn:TJvLookOutButton;R:TRect; ! begin ! inherited ListDrawValue(Value,ACanvas,ARect,ASelected); ! if (GetComponent(0) is TJvCustomLookOutButton) then ! begin ! R := ARect; ! btn := TJvLookOutButton(GetComponent(0)); ! if (btn.ImageSize = isLarge) and Assigned(btn.LargeImages) then ! begin ! ACanvas.FillRect(ARect); ! btn.LargeImages.Draw(ACanvas,ARect.Left,ARect.Top,StrToInt(Value)); ! OffsetRect(R,btn.LargeImages.Width + 2,0); ! DrawText(ACanvas.Handle,PChar(Value),-1,R,0); ! end ! else if Assigned(btn.SmallImages) then ! begin ! ACanvas.FillRect(ARect); ! btn.SmallImages.Draw(ACanvas,ARect.Left,ARect.Top,StrToInt(Value)); ! OffsetRect(R,btn.SmallImages.Width + 2,1); ! DrawText(ACanvas.Handle,PChar(Value),-1,R,0); ! end; ! end; ! end; ! ! procedure TLookOutImageIndexProperty.ListMeasureHeight(const Value: string; ! ACanvas: TCanvas; var AHeight: Integer); ! var btn:TJvLookOutButton; begin - AHeight := ACanvas.TextHeight(Value) + 2; if (GetComponent(0) is TJvCustomLookOutButton) then ! begin ! btn := TJvLookOutButton(GetComponent(0)); ! if (btn.ImageSize = isLarge) and Assigned(btn.LargeImages) then ! AHeight := btn.LargeImages.Height + 2 ! else if (btn.ImageSize = isSmall) and Assigned(btn.SmallImages) then ! AHeight := btn.SmallImages.Height + 2; ! end; end; ! ! procedure TLookOutImageIndexProperty.ListMeasureWidth(const Value: string; ! ACanvas: TCanvas; var AWidth: Integer); ! var btn:TJvLookOutButton; begin ! AWidth := ACanvas.TextWidth(Value) + 4; ! if (GetComponent(0) is TJvCustomLookOutButton) then begin ! btn := TJvLookOutButton(GetComponent(0)); ! if (btn.ImageSize = isLarge) and Assigned(btn.LargeImages) then ! AWidth := btn.LargeImages.Width + AWidth ! else if (btn.ImageSize = isSmall) and Assigned(btn.SmallImages) then ! AWidth := btn.SmallImages.Width + AWidth; ! end; ! end; ! ! procedure TLookOutImageIndexProperty.PropDrawValue(ACanvas: TCanvas; ! const ARect: TRect; ASelected: Boolean); ! begin ! // if GetVisualValue <> '' then ! // ListDrawValue(GetVisualValue, ACanvas, ARect, True) ! // else ! inherited PropDrawValue(ACanvas, ARect, ASelected); end; - {$ENDIF } end. --- 316,343 ---- { TLookOutImageIndexProperty } ! function TLookOutImageIndexProperty.GetButton: TJvCustomLookOutButton; begin if (GetComponent(0) is TJvCustomLookOutButton) then ! Result := TJvCustomLookOutButton(GetComponent(0)) ! else ! Result := nil; end; ! type ! THackButton = class(TJvCustomLookOutButton); ! function TLookOutImageIndexProperty.ImageList: TCustomImageList; ! var btn:TJvCustomLookOutButton; begin ! btn := GetButton; ! if btn <> nil then begin ! if THackButton(btn).ImageSize = isLarge then ! Result := THackButton(btn).LargeImages ! else ! Result := THackButton(btn).SmallImages; ! end ! else ! Result := nil; end; end. |