📄 jvbreatheskin.pas
字号:
h: THandle;
begin
if FBOptions.AutoSize then
begin
Width := FBack.Width;
Height := FBack.Height;
end;
if FBOptions.AutoRegion then
begin
Left := -3;
Top := -3;
// Remove Caption
h := GetParentForm(TControl(Self)).Handle;
SetWindowLong(h, GWL_STYLE, GetWindowLong(h, GWL_STYLE) and not WS_CAPTION);
GetParentForm(Self).ClientWidth := Width;
GetParentForm(Self).ClientHeight := Height;
GetParentForm(Self).Invalidate;
// Use region
SetWindowRgn(h, RegionFromBitmap(FMask), True);
end
else
begin
// Enable Caption
h := GetParentForm(TControl(Self)).Handle;
SetWindowLong(h, GWL_STYLE, GetWindowLong(h, GWL_STYLE) or WS_CAPTION);
GetParentForm(Self).Invalidate;
// Use form region
SetWindowRgn(h, 0, True);
end;
end;
procedure TJvBreatheSkin.ShowAbout;
var
im: TJvImage;
t: TForm;
m: TMemo;
begin
if not (FInfo.Empty) or (FTAbout.Count > 0) then
begin
t := TForm.Create(Application);
with t do
begin
Caption := RC_AboutCaption;
if FTAbout.Count > 0 then
Width := 500
else
ClientWidth := 137;
ClientHeight := 157;
BorderStyle := bsDialog;
Position := poScreenCenter;
im := TJvImage.Create(t);
if not FInfo.Empty then
begin
im.Parent := t;
im.Top := 0;
im.Left := 0;
im.Width := 137;
im.AutoSize := False;
im.Stretch := True;
im.Align := alLeft;
im.Picture.Bitmap.Assign(FInfo);
im.Pictures.PicEnter.Bitmap.Assign(FInfo);
end;
m := TMemo.Create(t);
if FTAbout.Count > 0 then
begin
m.Parent := t;
m.Align := alClient;
m.ReadOnly := True;
m.ScrollBars := ssBoth;
m.Text := FTAbout.Text;
end;
ShowModal;
m.Free;
im.Free;
Free;
end;
end;
end;
procedure TJvBreatheSkin.MoveFormDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
FLastX := x;
FLastY := y;
if Assigned(FOnMoveDown) then
FOnMoveDown(Sender, Button, Shift, X, Y);
end;
procedure TJvBreatheSkin.MoveFormMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if FBOptions.AutoMove and (HiWord(GetAsyncKeystate(VK_LBUTTON)) > 0) then
begin
GetParentForm(Self).Left := GetParentForm(Self).Left + x - FLastX;
GetParentForm(Self).Top := GetParentForm(Self).Top + y - FLastY;
end;
if Assigned(FOnMoveMove) then
FOnMoveMove(Sender, Shift, X, Y);
end;
procedure TJvBreatheSkin.EasyFormDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
FLastX := X;
FLastY := Y;
end;
procedure TJvBreatheSkin.EasyFormMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
if FBOptions.AutoMove and (HiWord(GetAsyncKeystate(VK_LBUTTON)) > 0) then
begin
GetParentForm(Self).Left := GetParentForm(Self).Left + X - FLastX;
GetParentForm(Self).Top := GetParentForm(Self).Top + Y - FLastY;
end;
end;
procedure TJvBreatheSkin.Activate;
begin
FImg.Picture.Bitmap.Assign(FBack);
end;
procedure TJvBreatheSkin.Deactivate;
begin
if not FDeact.Empty then
FImg.Picture.Bitmap.Assign(FDeact);
end;
function TJvBreatheSkin.GetOnExit: TNotifyEvent;
begin
Result := FButtons.FExit.OnClick;
end;
function TJvBreatheSkin.GetOnForward: TNotifyEvent;
begin
Result := FButtons.FForward.OnClick;
end;
function TJvBreatheSkin.GetOnID3: TNotifyEvent;
begin
Result := FButtons.FID3.OnClick;
end;
function TJvBreatheSkin.GetOnMinimize: TNotifyEvent;
begin
Result := FButtons.FMinimize.OnClick;
end;
function TJvBreatheSkin.GetOnMove: TNotifyEvent;
begin
Result := FButtons.FMove.OnClick;
end;
function TJvBreatheSkin.GetOnNext: TNotifyEvent;
begin
Result := FButtons.FNext.OnClick;
end;
function TJvBreatheSkin.GetOnOpen: TNotifyEvent;
begin
Result := FButtons.FOpen.OnClick;
end;
function TJvBreatheSkin.GetOnOptions: TNotifyEvent;
begin
Result := FButtons.FOptions.OnClick;
end;
function TJvBreatheSkin.GetOnPause: TNotifyEvent;
begin
Result := FButtons.FPause.OnClick;
end;
function TJvBreatheSkin.GetOnPlay: TNotifyEvent;
begin
Result := FButtons.FPlay.OnClick;
end;
function TJvBreatheSkin.GetOnPlaylist: TNotifyEvent;
begin
Result := FButtons.FPlaylist.OnClick;
end;
function TJvBreatheSkin.GetOnPosition: TNotifyEvent;
begin
Result := FPosition.FSlider.OnStopChanged;
end;
function TJvBreatheSkin.GetOnPrevious: TNotifyEvent;
begin
Result := FButtons.FPrev.OnClick;
end;
function TJvBreatheSkin.GetOnRewind: TNotifyEvent;
begin
Result := FButtons.FRewind.OnClick;
end;
function TJvBreatheSkin.GetOnStop: TNotifyEvent;
begin
Result := FButtons.FStop.OnClick;
end;
function TJvBreatheSkin.GetOnVolume: TNotifyEvent;
begin
Result := FVolume.FSlider.OnStopChanged;
end;
procedure TJvBreatheSkin.SetOnExit(const Value: TNotifyEvent);
begin
FButtons.FExit.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnForward(const Value: TNotifyEvent);
begin
FButtons.FForward.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnID3(const Value: TNotifyEvent);
begin
FButtons.FID3.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnMinimize(const Value: TNotifyEvent);
begin
FButtons.FMinimize.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnMove(const Value: TNotifyEvent);
begin
FButtons.FMove.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnNext(const Value: TNotifyEvent);
begin
FButtons.FNext.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnOpen(const Value: TNotifyEvent);
begin
FButtons.FOpen.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnOptions(const Value: TNotifyEvent);
begin
FButtons.FOptions.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnPause(const Value: TNotifyEvent);
begin
FButtons.FPause.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnPlay(const Value: TNotifyEvent);
begin
FButtons.FPlay.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnPlaylist(const Value: TNotifyEvent);
begin
FButtons.FPlayList.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnPosition(const Value: TNotifyEvent);
begin
FPosition.FSlider.OnStopChanged := Value;
end;
procedure TJvBreatheSkin.SetOnPrevious(const Value: TNotifyEvent);
begin
FButtons.FPrev.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnRewind(const Value: TNotifyEvent);
begin
FButtons.FRewind.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnStop(const Value: TNotifyEvent);
begin
FButtons.FStop.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnVolume(const Value: TNotifyEvent);
begin
FVolume.FSlider.OnStopChanged := Value;
end;
function TJvBreatheSkin.GetOnPosChanging: TNotifyEvent;
begin
Result := FPosition.FSlider.OnChanged;
end;
function TJvBreatheSkin.GetOnVolChanging: TNotifyEvent;
begin
Result := FVolume.FSlider.OnChanged;
end;
procedure TJvBreatheSkin.SetOnPosChanging(const Value: TNotifyEvent);
begin
FPosition.FSlider.OnChanged := Value;
end;
procedure TJvBreatheSkin.SetOnVolChanging(const Value: TNotifyEvent);
begin
FVolume.FSlider.OnChanged := Value;
end;
function TJvBreatheSkin.GetCurrentTime: TNotifyEvent;
begin
Result := FLabels.FTime.FLabel.OnClick;
end;
function TJvBreatheSkin.GetOnBitRate: TNotifyEvent;
begin
Result := FLabels.FBitRate.FLabel.OnClick;
end;
function TJvBreatheSkin.GetOnFrequency: TNotifyEvent;
begin
Result := FLabels.FFrequency.FLabel.OnClick;
end;
function TJvBreatheSkin.GetOnLayer: TNotifyEvent;
begin
Result := FLabels.FLayer.FLabel.OnClick;
end;
function TJvBreatheSkin.GetOnSongName: TNotifyEvent;
begin
Result := FLabels.FSongName.FLabel.OnClick;
end;
function TJvBreatheSkin.GetOnStatus: TNotifyEvent;
begin
Result := FLabels.FStatus.FLabel.OnClick;
end;
function TJvBreatheSkin.GetOnTotalInfo: TNotifyEvent;
begin
Result := FLabels.FTotalInfo.FLabel.OnClick;
end;
function TJvBreatheSkin.GetOnTotalTime: TNotifyEvent;
begin
Result := FLabels.FTotalTime.FLabel.OnClick;
end;
function TJvBreatheSkin.GetOnVersion: TNotifyEvent;
begin
Result := FLabels.FVersion.FLabel.OnClick;
end;
procedure TJvBreatheSkin.SetCurrentTime(const Value: TNotifyEvent);
begin
FLabels.FTime.FLabel.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnBitRate(const Value: TNotifyEvent);
begin
FLabels.FBitRate.FLabel.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnFrequency(const Value: TNotifyEvent);
begin
FLabels.FFrequency.FLabel.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnLayer(const Value: TNotifyEvent);
begin
FLabels.FLayer.FLabel.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnSongName(const Value: TNotifyEvent);
begin
FLabels.FSongName.FLabel.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnStatus(const Value: TNotifyEvent);
begin
FLabels.FStatus.FLabel.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnTotalInfo(const Value: TNotifyEvent);
begin
FLabels.FTotalInfo.FLabel.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnTotalTime(const Value: TNotifyEvent);
begin
FLabels.FTotalTime.FLabel.OnClick := Value;
end;
procedure TJvBreatheSkin.SetOnVersion(const Value: TNotifyEvent);
begin
FLabels.FVersion.FLabel.OnClick := Value;
end;
//=== TJvBreatheOption =======================================================
constructor TJvBreatheOption.Create(AOwner: TComponent);
begin
inherited Create;
FAutoSize := True;
FAutoMove := True;
FAutoRegion := False;
FEasyMove := False;
end;
procedure TJvBreatheOption.SetAutoMove(const Value: Boolean);
begin
FAutoMove := Value;
if Assigned(FOnChange) then
FOnChange(Self);
end;
procedure TJvBreatheOption.SetAutoRegion(const Value: Boolean);
begin
FAutoRegion := Value;
if Assigned(FOnChange) then
FOnChange(Self);
end;
procedure TJvBreatheOption.SetAutoSize(const Value: Boolean);
begin
FAutoSize := Value;
if Assigned(FOnChange) then
FOnChange(Self);
end;
procedure TJvBreatheOption.SetEasyMove(const Value: Boolean);
begin
FEasyMove := Value;
if Assigned(FOnChange) then
FOnChange(Self);
end;
//=== TJvBreatheLabels =======================================================
constructor TJvBreatheLabels.Create(AOwner: TComponent);
begin
inherited Create;
FStatus := TJvBreatheLabel.Create(AOwner);
FBitRate := TJvBreatheLabel.Create(AOwner);
FTime := TJvBreatheLabel.Create(AOwner);
FFrequency := TJvBreatheLabel.Create(AOwner);
FSongName := TJvBreatheScrollLabel.Create(AOwner);
FTotalInfo := TJvBreatheLabel.Create(AOwner);
FTotalTime := TJvBreatheLabel.Create(AOwner);
FLayer := TJvBreatheLabel.Create(AOwner);
FVersion := TJvBreatheLabel.Create(AOwner);
end;
destructor TJvBreatheLabels.Destroy;
begin
FStatus.Free;
FBitRate.Free;
FTime.Free;
FFrequency.Free;
FSongName.Free;
FTotalInfo.Free;
FTotalTime.Free;
FLayer.Free;
FVersion.Free;
inherited Destroy;
end;
//=== TJvBreatheLabel ========================================================
constructor TJvBreatheLabel.Create(AOwner: TComponent);
begin
inherited Create;
FLabel := TJvLabel.Create(AOwner);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -