⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jvbreatheskin.pas

📁 East make Tray Icon in delphi
💻 PAS
📖 第 1 页 / 共 4 页
字号:
{-----------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/MPL-1.1.html

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
the specific language governing rights and limitations under the License.

The Original Code is: JvBreatheSkin.PAS, released on 2001-02-28.

The Initial Developer of the Original Code is S閎astien Buysse [sbuysse att buypin dott com]
Portions created by S閎astien Buysse are Copyright (C) 2001 S閎astien Buysse.
All Rights Reserved.

Contributor(s): Michael Beck [mbeck att bigfoot dott com].

Last Modified: 2000-02-28

You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
located at http://jvcl.sourceforge.net

Known Issues:
-----------------------------------------------------------------------------}

{$I JVCL.INC}

unit JvBreatheSkin;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls, Registry, IniFiles, jpeg, Menus, JvBehaviorLabel,
  JvSlider, JvLabel, JvPcx, JvImage, JvTypes, JVCLVer;

type
  TJvBreatheLabel = class(TPersistent)
  private
    FLabel: TJvLabel;
    FLeft: Integer;
    FTop: Integer;
    FWidth: Integer;
    FHeight: Integer;
    FCaption: string;
    procedure SetCaption(const Value: string);
    procedure SetHeight(const Value: Integer);
    procedure SetLeft(const Value: Integer);
    procedure SetTop(const Value: Integer);
    procedure SetWidth(const Value: Integer);
    function GetColor: TColor;
    function GetFont: TFont;
    function GetTransparent: Boolean;
    procedure SetColor(const Value: TColor);
    procedure SetFont(const Value: TFont);
    procedure SetTransparent(const Value: Boolean);
    function GetHint: string;
    function GetShowHint: Boolean;
    procedure SetHint(const Value: string);
    procedure SetShowHint(const Value: Boolean);
    function GetPopupMenu: TPopupMenu;
    procedure SetPopupMenu(const Value: TPopupMenu);
  public
    constructor Create(AOwner: TComponent);
  published
    property Left: Integer read FLeft write SetLeft;
    property Top: Integer read FTop write SetTop;
    property Width: Integer read FWidth write SetWidth;
    property Height: Integer read FHeight write SetHeight;
    property Caption: string read FCaption write SetCaption;
    property Font: TFont read GetFont write SetFont;
    property Color: TColor read GetColor write SetColor;
    property Transparent: Boolean read GetTransparent write SetTransparent;
    property Hint: string read GetHint write SetHint;
    property ShowHint: Boolean read GetShowHint write SetShowHint;
    property PopupMenu: TPopupMenu read GetPopupMenu write SetPopupMenu;
  end;

  TJvBreatheScrollLabel = class(TPersistent)
  private
    FLabel: TJvBehaviorLabel;
    FHeight: Integer;
    FTop: Integer;
    FWidth: Integer;
    FLeft: Integer;
    FCaption: string;
    function GetColor: TColor;
    function GetDirection: TJvLabelScrollDirection;
    function GetFont: TFont;
    function GetHint: string;
    function GetInterval: Cardinal;
//    function GetNoGrap: Boolean;
    function GetScrolling: Boolean;
    function GetShowHint: Boolean;
    function GetTransparent: Boolean;
    procedure SetCaption(const Value: string);
    procedure SetColor(const Value: TColor);
    procedure SetDirection(const Value: TJvLabelScrollDirection);
    procedure SetFont(const Value: TFont);
    procedure SetHeight(const Value: Integer);
    procedure SetHint(const Value: string);
    procedure SetInterval(const Value: Cardinal);
    procedure SetLeft(const Value: Integer);
//    procedure SetNoGrap(const Value: Boolean);
    procedure SetScrolling(const Value: Boolean);
    procedure SetShowHint(const Value: Boolean);
    procedure SetTop(const Value: Integer);
    procedure SetTransparent(const Value: Boolean);
    procedure SetWidth(const Value: Integer);
  public
    constructor Create(AOwner: TComponent);
  published
    property Left: Integer read FLeft write SetLeft;
    property Top: Integer read FTop write SetTop;
    property Width: Integer read FWidth write SetWidth;
    property Height: Integer read FHeight write SetHeight;
    property Caption: string read FCaption write SetCaption;
    property Font: TFont read GetFont write SetFont;
    property Color: TColor read GetColor write SetColor;
    property Transparent: Boolean read GetTransparent write SetTransparent;
    property Hint: string read GetHint write SetHint;
    property ShowHint: Boolean read GetShowHint write SetShowHint;
    property Scrolling: Boolean read GetScrolling write SetScrolling;
    property ScrollDirection: TJvLabelScrollDirection read GetDirection write SetDirection;
    property ScrollInterval: Cardinal read GetInterval write SetInterval;
//    property NoGrap: Boolean read GetNoGrap write SetNoGrap;
  end;

  TJvBreatheButton = class(TPersistent)
  private
    FButton: TJvImage;
    function GetEnabled: Boolean;
    function GetHint: string;
    function GetShowHint: Boolean;
    procedure SetEnabled(const Value: Boolean);
    procedure SetHint(const Value: string);
    procedure SetShowHint(const Value: Boolean);
    function GetMouseDown: TMouseEvent;
    function GetMouseMove: TMouseMoveEvent;
    function GetOnClick: TNotifyEvent;
    function GetOnDblClick: TNotifyEvent;
    function GetPopupMenu: TPopupMenu;
    function GetVisible: Boolean;
    procedure SetMouseDown(const Value: TMouseEvent);
    procedure SetMouveMove(const Value: TMouseMoveEvent);
    procedure SetOnClick(const Value: TNotifyEvent);
    procedure SetOnDblClick(const Value: TNotifyEvent);
    procedure SetPopupMenu(const Value: TPopupMenu);
    procedure SetVisible(const Value: Boolean);
    function GetMouseUp: TMouseEvent;
    procedure SetMouseUp(const Value: TMouseEvent);
  public
    constructor Create(AOwner: TComponent);
  published
    property Hint: string read GetHint write SetHint;
    property ShowHint: Boolean read GetShowHint write SetShowHint;
    property Enabled: Boolean read GetEnabled write SetEnabled;
    property PopupMenu: TPopupMenu read GetPopupMenu write SetPopupMenu;
    property Visible: Boolean read GetVisible write SetVisible;
    property OnMouseMove: TMouseMoveEvent read GetMouseMove write SetMouveMove;
    property OnMouseDown: TMouseEvent read GetMouseDown write SetMouseDown;
    property OnMouseUp: TMouseEvent read GetMouseUp write SetMouseUp;
    property OnClick: TNotifyEvent read GetOnClick write SetOnClick;
    property OnDblClick: TNotifyEvent read GetOnDblClick write SetOnDblClick;
  end;

  TJvBreatheButtons = class(TPersistent)
  private
    FPlaylist: TJvBreatheButton;
    FPrev: TJvBreatheButton;
    FMove: TJvBreatheButton;
    FPlay: TJvBreatheButton;
    FNext: TJvBreatheButton;
    FExit: TJvBreatheButton;
    FOptions: TJvBreatheButton;
    FOpen: TJvBreatheButton;
    FPause: TJvBreatheButton;
    FId3: TJvBreatheButton;
    FForward: TJvBreatheButton;
    FRewind: TJvBreatheButton;
    FStop: TJvBreatheButton;
    FMinimize: TJvBreatheButton;
  public
    constructor Create(AOwner: TComponent);
    destructor Destroy; override;
  published
    property Play: TJvBreatheButton read FPlay write FPlay;
    property Stop: TJvBreatheButton read FStop write FStop;
    property Pause: TJvBreatheButton read FPause write FPause;
    property Next: TJvBreatheButton read FNext write FNext;
    property Previous: TJvBreatheButton read FPrev write FPrev;
    property Open: TJvBreatheButton read FOpen write FOpen;
    property Exit: TJvBreatheButton read FExit write FExit;
    property Move: TJvBreatheButton read FMove write FMove;
    property Minimize: TJvBreatheButton read FMinimize write FMinimize;
    property Id3: TJvBreatheButton read FId3 write FId3;
    // (rom) Forward is not a good name.
    property Forward: TJvBreatheButton read FForward write FForward;
    property Rewind: TJvBreatheButton read FRewind write FRewind;
    property Options: TJvBreatheButton read FOptions write FOptions;
    property Playlist: TJvBreatheButton read FPlaylist write FPlaylist;
  end;

  TJvBreatheLabels = class(TPersistent)
  private
    FStatus: TJvBreatheLabel;
    FBitRate: TJvBreatheLabel;
    FTime: TJvBreatheLabel;
    FFrequency: TJvBreatheLabel;
    FSongName: TJvBreatheScrollLabel;
    FTotalInfo: TJvBreatheLabel;
    FTotalTime: TJvBreatheLabel;
    FLayer: TJvBreatheLabel;
    FVersion: TJvBreatheLabel;
  public
    constructor Create(AOwner: TComponent);
    destructor Destroy; override;
  published
    property Status: TJvBreatheLabel read FStatus write FStatus;
    property CurrentTime: TJvBreatheLabel read FTime write FTime;
    property Layer: TJvBreatheLabel read FLayer write FLayer;
    property BitRate: TJvBreatheLabel read FBitRate write FBitRate;
    property Frequency: TJvBreatheLabel read FFrequency write FFrequency;
    property Version: TJvBreatheLabel read FVersion write FVersion;
    property SongName: TJvBreatheScrollLabel read FSongName write FSongName;
    property TotalTime: TJvBreatheLabel read FTotalTime write FTotalTime;
    property TotalInfo: TJvBreatheLabel read FTotalInfo write FTotalInfo;
  end;

  TJvBreatheOption = class(TPersistent)
  private
    FAutoSize: Boolean;
    FOnChange: TNotifyEvent;
    FAutoMove: Boolean;
    FAutoRegion: Boolean;
    FEasyMove: Boolean;
    procedure SetAutoSize(const Value: Boolean);
    procedure SetAutoMove(const Value: Boolean);
    procedure SetAutoRegion(const Value: Boolean);
    procedure SetEasyMove(const Value: Boolean);
  protected
    property OnChange: TNotifyEvent read FOnChange write FOnChange;
  public
    constructor Create(AOwner: TComponent);
  published
    property AutoSize: Boolean read FAutoSize write SetAutoSize default True;
    property AutoMove: Boolean read FAutoMove write SetAutoMove default True;
    property AutoRegion: Boolean read FAutoRegion write SetAutoRegion default False;
    property EasyMove: Boolean read FEasyMove write SetEasyMove default False;
  end;

  TJvBreatheVolume = class(TPersistent)
  private
    FSlider: TJvSlider;
    function GetMaximum: Integer;
    function GetPosition: Integer;
    procedure SetMaximum(const Value: Integer);
    procedure SetPosition(const Value: Integer);
    function GetHint: string;
    function GetShow: Boolean;
    procedure SetHint(const Value: string);
    procedure SetShow(const Value: Boolean);
  public
    constructor Create(AOwner: TComponent);
    destructor Destroy; override;
  published
    property Maximum: Integer read GetMaximum write SetMaximum;
    property Position: Integer read GetPosition write SetPosition;
    property Hint: string read GetHint write SetHint;
    property ShowHint: Boolean read GetShow write SetShow;
  end;

  TJvBreathePosition = class(TPersistent)
  private
    FSlider: TJvSlider;
    function GetMaximum: Integer;
    function GetPosition: Integer;
    procedure SetMaximum(const Value: Integer);
    procedure SetPosition(const Value: Integer);
    function GetHint: string;
    procedure SetHint(const Value: string);
    function GetShow: Boolean;
    procedure SetShow(const Value: Boolean);
  public
    constructor Create(AOwner: TComponent);
    destructor Destroy; override;
  published
    property Maximum: Integer read GetMaximum write SetMaximum;
    property Position: Integer read GetPosition write SetPosition;
    property Hint: string read GetHint write SetHint;
    property ShowHint: Boolean read GetShow write SetShow;
  end;

  TJvBreatheSkin = class(TWinControl)
  private
    // Internal data
    FImg: TImage;
    FSkin: TFileName;
    FBOptions: TJvBreatheOption;
    FLabels: TJvBreatheLabels;
    FTAbout: TStringList;
    FLastX: Integer;
    FLastY: Integer;

    // Sliders
    FVolume: TJvBreatheVolume;
    FPosition: TJvBreathePosition;

    // Images
    FBack: TBitmap;
    FDeact: TBitmap;
    FInfo: TBItmap;
    FMask: TBitmap;
    FOver: TBitmap;
    FPosRuler: TBitmap;
    FPosThumb: TBitmap;
    FVolRuler: TBitmap;
    FVolThumb: TBitmap;
    FOnMoveDown: TMouseEvent;
    FOnMoveMove: TMouseMoveEvent;
    FButtons: TJvBreatheButtons;
    FOnSkinLoaded: TNotifyEvent;
    FAboutJVCL: TJVCLAboutInfo;

    // Methods
    procedure LoadDefault;
    procedure InitBtn(Value: TJvImage);
    procedure SetSkin(const Value: TFileName);
    procedure LoadSkin(Value: string);
    procedure InitAllBtn;
    procedure DecoupeOver(Value: TJvImage);
    procedure DecoupeOverAll;
    procedure LoadBtn(Ini: TIniFile; Value: TJvImage; Prefix: string);
    procedure LoadSlider(Ini: TIniFile; Value: TJvSlider; Prefix: string);
    procedure LoadLabel(Ini: TIniFile; Value: TJvBreatheLabel; Prefix: string); overload;
    procedure LoadLabel(Ini: TIniFile; Value: TJvBreatheScrollLabel; Prefix: string); overload;
    procedure OptionsChanged(Sender: TObject);
    function GetOnExit: TNotifyEvent;
    function GetOnForward: TNotifyEvent;
    function GetOnID3: TNotifyEvent;
    function GetOnMinimize: TNotifyEvent;
    function GetOnMove: TNotifyEvent;
    function GetOnNext: TNotifyEvent;
    function GetOnOpen: TNotifyEvent;
    function GetOnOptions: TNotifyEvent;
    function GetOnPause: TNotifyEvent;
    function GetOnPlay: TNotifyEvent;
    function GetOnPlaylist: TNotifyEvent;
    function GetOnPosition: TNotifyEvent;
    function GetOnPrevious: TNotifyEvent;
    function GetOnRewind: TNotifyEvent;
    function GetOnStop: TNotifyEvent;
    function GetOnVolume: TNotifyEvent;
    procedure SetOnExit(const Value: TNotifyEvent);
    procedure SetOnForward(const Value: TNotifyEvent);
    procedure SetOnID3(const Value: TNotifyEvent);
    procedure SetOnMinimize(const Value: TNotifyEvent);
    procedure SetOnMove(const Value: TNotifyEvent);
    procedure SetOnNext(const Value: TNotifyEvent);
    procedure SetOnOpen(const Value: TNotifyEvent);
    procedure SetOnOptions(const Value: TNotifyEvent);
    procedure SetOnPause(const Value: TNotifyEvent);
    procedure SetOnPlay(const Value: TNotifyEvent);
    procedure SetOnPlaylist(const Value: TNotifyEvent);
    procedure SetOnPosition(const Value: TNotifyEvent);
    procedure SetOnPrevious(const Value: TNotifyEvent);
    procedure SetOnRewind(const Value: TNotifyEvent);
    procedure SetOnStop(const Value: TNotifyEvent);
    procedure SetOnVolume(const Value: TNotifyEvent);
    function GetOnPosChanging: TNotifyEvent;
    function GetOnVolChanging: TNotifyEvent;
    procedure SetOnPosChanging(const Value: TNotifyEvent);
    procedure SetOnVolChanging(const Value: TNotifyEvent);
    function GetCurrentTime: TNotifyEvent;
    function GetOnBitRate: TNotifyEvent;
    function GetOnFrequency: TNotifyEvent;
    function GetOnLayer: TNotifyEvent;
    function GetOnSongName: TNotifyEvent;
    function GetOnStatus: TNotifyEvent;
    function GetOnTotalInfo: TNotifyEvent;
    function GetOnTotalTime: TNotifyEvent;
    function GetOnVersion: TNotifyEvent;
    procedure SetCurrentTime(const Value: TNotifyEvent);
    procedure SetOnBitRate(const Value: TNotifyEvent);
    procedure SetOnFrequency(const Value: TNotifyEvent);
    procedure SetOnLayer(const Value: TNotifyEvent);
    procedure SetOnSongName(const Value: TNotifyEvent);
    procedure SetOnStatus(const Value: TNotifyEvent);
    procedure SetOnTotalInfo(const Value: TNotifyEvent);
    procedure SetOnTotalTime(const Value: TNotifyEvent);
    procedure SetOnVersion(const Value: TNotifyEvent);
    procedure MoveFormDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    procedure MoveFormMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
    procedure EasyFormDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    procedure EasyFormMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  published
    property AboutJVCL: TJVCLAboutInfo read FAboutJVCL write FAboutJVCL stored False;
    property SkinFile: TFileName read FSkin write SetSkin;
    property Options: TJvBreatheOption read FBOptions write FBOptions;
    property Labels: TJvBreatheLabels read FLabels write FLabels;
    property Volume: TJvBreatheVolume read FVolume write FVolume;
    property Buttons: TJvBreatheButtons read FButtons write FButtons;
    property Position: TJvBreathePosition read FPosition write FPosition;
    property OnPlayClick: TNotifyEvent read GetOnPlay write SetOnPlay;
    property OnStopClick: TNotifyEvent read GetOnStop write SetOnStop;
    property OnPauseClick: TNotifyEvent read GetOnPause write SetOnPause;
    property OnNextClick: TNotifyEvent read GetOnNext write SetOnNext;
    property OnPreviousClick: TNotifyEvent read GetOnPrevious write SetOnPrevious;
    property OnForwardClick: TNotifyEvent read GetOnForward write SetOnForward;
    property OnRewindClick: TNotifyEvent read GetOnRewind write SetOnRewind;
    property OnOptionsClick: TNotifyEvent read GetOnOptions write SetOnOptions;
    property OnID3Click: TNotifyEvent read GetOnID3 write SetOnID3;
    property OnPlaylistClick: TNotifyEvent read GetOnPlaylist write SetOnPlaylist;
    property OnMinimizeClick: TNotifyEvent read GetOnMinimize write SetOnMinimize;
    property OnExitClick: TNotifyEvent read GetOnExit write SetOnExit;
    property OnMoveClick: TNotifyEvent read GetOnMove write SetOnMove;
    property OnMoveDown: TMouseEvent read FOnMoveDown write FOnMoveDown;
    property OnMoveMove: TMouseMoveEvent read FOnMoveMove write FOnMoveMove;
    property OnOpenClick: TNotifyEvent read GetOnOpen write SetOnOpen;
    property OnVolumeChanged: TNotifyEvent read GetOnVolume write SetOnVolume;
    property OnPositionChanged: TNotifyEvent read GetOnPosition write SetOnPosition;
    property OnVolumeChanging: TNotifyEvent read GetOnVolChanging write SetOnVolChanging;
    property OnPositionChanging: TNotifyEvent read GetOnPosChanging write SetOnPosChanging;
    property OnStatusClick: TNotifyEvent read GetOnStatus write SetOnStatus;
    property OnCurrenTTimeClick: TNotifyEvent read GetCurrentTime write SetCurrentTime;
    property OnLayerClick: TNotifyEvent read GetOnLayer write SetOnLayer;
    property OnBitRateClick: TNotifyEvent read GetOnBitRate write SetOnBitRate;
    property OnFrequencyClick: TNotifyEvent read GetOnFrequency write SetOnFrequency;
    property OnVersionClick: TNotifyEvent read GetOnVersion write SetOnVersion;
    property OnSongNameClick: TNotifyEvent read GetOnSongName write SetOnSongName;
    property OnTotalTimeClick: TNotifyEvent read GetOnTotalTime write SetOnTotalTime;
    property OnTotalInfoClick: TNotifyEvent read GetOnTotalInfo write SetOnTotalInfo;
    procedure ShowAbout;
    procedure Activate;
    procedure Deactivate;
    property PopupMenu;
    property OnSkinLoaded: TNotifyEvent read FOnSkinLoaded write FOnSkinLoaded;
  end;

implementation

uses
  JvFunctions;

{$R JvBreatheSkin.res}

resourcestring
  RC_AboutCaption = 'About';

  RC_PrefixSongtitle = 'songtitle';
  RC_PrefixTotalInfo = 'totalinfo';
  RC_PrefixTotalTime = 'totaltime';
  RC_PrefixTime = 'time';
  RC_PrefixInfo = 'info';
  RC_PrefixLayer = 'layer';
  RC_PrefixBitRate = 'BitRate';
  RC_PrefixFrequency = 'frequency';
  RC_PrefixVersion = 'versiontext';
  RC_PrefixVolbar = 'volbar';
  RC_PrefixTbbar = 'tbbar';
  RC_PrefixExit = 'exit';
  RC_PrefixMove = 'move';
  RC_PrefixMinimize = 'mini';
  RC_PrefixOption = 'option';
  RC_PrefixOpen = 'open';
  RC_PrefixId3 = 'id3';
  RC_PrefixPlaylist = 'plist';
  RC_PrefixNext = 'next';
  RC_PrefixForward = 'fwd';
  RC_PrefixPlay = 'play';
  RC_PrefixPause = 'pause';
  RC_PrefixStop = 'stop';
  RC_PrefixRewind = 'rev';
  RC_PrefixPrevious = 'prev';

  RC_Section = 'main';

  RC_SufixTransp = 'transparent';
  RC_SufixTop = 'Top';
  RC_SufixLeft = 'Left';

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -