var
  md5str:string;
  
//--- Widget移入边栏事件，当Widget被移到边栏上时会触发此事件 ---
procedure OnWidgetDock;
begin
  BeginUpdate;
  imgbg.width:=126;
  imgbg.height:=90;
  lblInfo.width:=imgbg.width-35;
  lblInfo.height:=imgbg.height;
  Widget.Width:=imgbg.width+10;
  Widget.height:=imgbg.height;
  EndUpdateall;
end;

//--- Widget移出边栏事件，当Widget被移出边栏时会触发此事件 ---
procedure OnWidgetUnDock;
begin
  BeginUpdate;
  imgbg.width:=345;
  imgbg.height:=60;
  lblInfo.width:=imgbg.width-40;
  lblInfo.height:=imgbg.height;
  Widget.Width:=imgbg.width+10;
  Widget.height:=imgbg.height;
  EndUpdate;
end;

procedure OnWidgetInit;
begin
  md5str:='';
  nAutoCopyClipboard.checked:=GetSettingInt('AutoCopyClipboard',0)=1;
end;

procedure CopyMD5;
begin
  ClipBoard.AsText:=md5str;
end;

//--- 文件拖放到事件，当文件拖放到Widget中时会触发此事件 ---
procedure OnWidgetDropFiles(Files:string);
var
  lst:TStrings;
begin
  if trim(Files)='' then exit;
  lst:=TStringList.create;
  try
    lst.text:=Files;
    if lst.count>0 then
    begin
      md5str:=File_MD5(lst.strings[0]);
      lblInfo.caption:='MD5:'#13#10+md5str;
      if nAutoCopyClipboard.Checked then
        CopyMD5;
    end
  finally
    lst.free;
  end;
end;

procedure SetAutoCopyClipboard;
begin
  SetSettingInt('AutoCopyClipboard',nAutoCopyClipboard.checked);
end;