📄 jvqexbuttons.pas
字号:
FOnEvent(Sender, Event, Result);
if not Result then
Result := inherited EventFilter(Sender, Event);
end;
procedure TJvExBitBtn.FocusChanged;
begin
NotifyControls(CM_FOCUSCHANGED);
end;
procedure TJvExBitBtn.DoOnFontChanged(Sender: TObject);
begin
ParentFont := False;
PostMessage(Self, CM_FONTCHANGED, 0, 0);
end;
procedure TJvExBitBtn.CreateWidget;
begin
CreateWnd;
end;
procedure TJvExBitBtn.CreateWnd;
begin
inherited CreateWidget;
end;
procedure TJvExBitBtn.RecreateWnd;
begin
if not (csRecreating in ControlState) then
RecreateWidget;
end;
procedure TJvExBitBtn.PaintTo(PaintDevice: QPaintDeviceH; X, Y: Integer);
begin
WidgetControl_PaintTo(self, PaintDevice, X, Y);
end;
procedure TJvExBitBtn.PaintWindow(PaintDevice: QPaintDeviceH);
begin
PaintTo(PaintDevice, 0, 0);
end;
function TJvExBitBtn.WidgetFlags: Integer;
begin
Result := inherited WidgetFlags or
Integer(WidgetFlags_WRepaintNoErase) or
Integer(WidgetFlags_WMouseNoMask);
end;
function TJvExBitBtn.ColorToRGB(Value: TColor): TColor;
begin
Result := QWindows.ColorToRGB(Value, self);
end;
{ QControl Common}
function TJvExBitBtn.HitTest(X, Y: integer): Boolean;
begin
Result := Perform(CM_HITTEST, 0, 0) <> HTNOWHERE;
end;
procedure TJvExBitBtn.CMHintShow(var Mesg: TJvMessage);
begin
with Mesg do
begin
Handled := inherited HintShow(HintInfo^);
end;
end;
procedure TJvExBitBtn.CMSysFontChanged(var Mesg: TMessage);
begin
if FDesktopFont then
begin
Font.Assign(Application.Font);
FDesktopFont := True;
end;
end;
procedure TJvExBitBtn.EnabledChanged;
begin
Perform(CM_ENABLEDCHANGED, 0, 0);
inherited EnabledChanged;
end;
procedure TJvExBitBtn.TextChanged;
begin
Perform(CM_TEXTCHANGED, 0, 0);
inherited TextChanged;
end;
procedure TJvExBitBtn.VisibleChanged;
begin
Perform(CM_VISIBLECHANGED, 0, 0);
inherited VisibleChanged;
end;
function TJvExBitBtn.HintShow(var HintInfo : THintInfo): Boolean;
begin
Result := Perform(CM_HINTSHOW, 0, Integer(@HintInfo)) <> 0;
end;
procedure TJvExBitBtn.MouseEnter(AControl: TControl);
begin
Perform(CM_MOUSEENTER, 0, 0);
inherited MouseEnter(AControl);
end;
procedure TJvExBitBtn.MouseLeave(AControl: TControl);
begin
Perform(CM_MOUSELEAVE, 0, 0);
inherited MouseLeave(AControl);
end;
procedure TJvExBitBtn.ParentColorChanged;
begin
inherited ParentColorChanged;
if Assigned(FOnParentColorChanged) then
FOnParentColorChanged(Self);
end;
procedure TJvExBitBtn.SetDesktopFont(Value: Boolean);
begin
if FDesktopFont <> Value then
begin
FDesktopFont := Value;
Perform(CM_SYSFONTCHANGED, 0, 0);
end;
end;
procedure TJvExBitBtn.Dispatch(var Mesg);
begin
if Assigned(FWindowProc) then
FWindowProc(TMessage(Mesg))
else
inherited Dispatch(Mesg);
end;
function TJvExBitBtn.Perform(Msg: Cardinal; WParam, LParam: Longint): Longint;
var
Mesg: TMessage;
begin
Mesg.Msg := Msg;
Mesg.WParam := WParam;
Mesg.LParam := LParam;
Mesg.Result := 0;
Dispatch(Mesg);
Result := Mesg.Result;
end;
function TJvExBitBtn.IsRightToLeft: Boolean;
begin
Result := False;
end;
{ QControl Create }
constructor TJvExSpeedButton.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FHintColor := clDefault;
FWindowProc := WndProc;
end;
destructor TJvExSpeedButton.Destroy;
begin
inherited Destroy;
end;
procedure TJvExSpeedButton.WndProc(var Mesg: TMessage);
begin
//OutputDebugString(PAnsiChar(Format('JV_CONTROL %s: %s Msg $%x',[Name, ClassName, Mesg.Msg])));
with TJvMessage(Mesg) do
begin
case Msg of
{ Control Messages }
CM_FOCUSCHANGED: FocusChanged;
CM_MOUSEENTER: FMouseOver := True;
CM_MOUSELEAVE: FMouseOver := False;
CM_HINTSHOW:
case FHintColor of
clNone : HintInfo^.HintColor := Application.HintColor;
clDefault: HintInfo^.HintColor := GetHintColor(Parent);
else
HintInfo^.HintColor := FHintcolor;
end;
end;
end;
inherited Dispatch(Mesg);
end;
procedure TJvExSpeedButton.CMHitTest(var Mesg: TJvMessage);
begin
with Mesg do
begin
Handled := inherited HitTest(XPos, YPos);
if Handled then
Result := HTCLIENT;
end;
end;
procedure TJvExSpeedButton.ColorChanged;
begin
Perform(CM_COLORCHANGED, 0, 0);
inherited ColorChanged;
end;
procedure TJvExSpeedButton.FontChanged;
begin
Perform(CM_FONTCHANGED, 0, 0);
inherited FontChanged;
end;
procedure TJvExSpeedButton.FocusChanged;
begin
{ notification }
end;
{ QControl Common}
function TJvExSpeedButton.HitTest(X, Y: integer): Boolean;
begin
Result := Perform(CM_HITTEST, 0, 0) <> HTNOWHERE;
end;
procedure TJvExSpeedButton.CMHintShow(var Mesg: TJvMessage);
begin
with Mesg do
begin
Handled := inherited HintShow(HintInfo^);
end;
end;
procedure TJvExSpeedButton.CMSysFontChanged(var Mesg: TMessage);
begin
if FDesktopFont then
begin
Font.Assign(Application.Font);
FDesktopFont := True;
end;
end;
procedure TJvExSpeedButton.EnabledChanged;
begin
Perform(CM_ENABLEDCHANGED, 0, 0);
inherited EnabledChanged;
end;
procedure TJvExSpeedButton.TextChanged;
begin
Perform(CM_TEXTCHANGED, 0, 0);
inherited TextChanged;
end;
procedure TJvExSpeedButton.VisibleChanged;
begin
Perform(CM_VISIBLECHANGED, 0, 0);
inherited VisibleChanged;
end;
function TJvExSpeedButton.HintShow(var HintInfo : THintInfo): Boolean;
begin
Result := Perform(CM_HINTSHOW, 0, Integer(@HintInfo)) <> 0;
end;
procedure TJvExSpeedButton.MouseEnter(AControl: TControl);
begin
Perform(CM_MOUSEENTER, 0, 0);
inherited MouseEnter(AControl);
end;
procedure TJvExSpeedButton.MouseLeave(AControl: TControl);
begin
Perform(CM_MOUSELEAVE, 0, 0);
inherited MouseLeave(AControl);
end;
procedure TJvExSpeedButton.ParentColorChanged;
begin
inherited ParentColorChanged;
if Assigned(FOnParentColorChanged) then
FOnParentColorChanged(Self);
end;
procedure TJvExSpeedButton.SetDesktopFont(Value: Boolean);
begin
if FDesktopFont <> Value then
begin
FDesktopFont := Value;
Perform(CM_SYSFONTCHANGED, 0, 0);
end;
end;
procedure TJvExSpeedButton.Dispatch(var Mesg);
begin
if Assigned(FWindowProc) then
FWindowProc(TMessage(Mesg))
else
inherited Dispatch(Mesg);
end;
function TJvExSpeedButton.Perform(Msg: Cardinal; WParam, LParam: Longint): Longint;
var
Mesg: TMessage;
begin
Mesg.Msg := Msg;
Mesg.WParam := WParam;
Mesg.LParam := LParam;
Mesg.Result := 0;
Dispatch(Mesg);
Result := Mesg.Result;
end;
function TJvExSpeedButton.IsRightToLeft: Boolean;
begin
Result := False;
end;
{$IFDEF UNITVERSIONING}
const
UnitVersioning: TUnitVersionInfo = (
RCSfile: '$RCSfile: JvQExButtons.pas,v $';
Revision: '$Revision: 1.32 $';
Date: '$Date: 2005/02/06 14:06:05 $';
LogPath: 'JVCL\run'
);
initialization
RegisterUnitVersion(HInstance, UnitVersioning);
finalization
UnregisterUnitVersion(HInstance);
{$ENDIF UNITVERSIONING}
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -