RRUZ / vcl-styles-utils

Extend and improve the Delphi VCL Styles
https://theroadtodelphi.wordpress.com/
329 stars 115 forks source link

When NCButton is disabled, moving mouse effects have to be desactivated #279

Open Delphichem opened 4 years ago

Delphichem commented 4 years ago

When the control is disabled and mouse hover it, the control is draw like it is enabled. in TNCButton.DrawControl . . if FStyle = nsAlpha then . Change if (AMouseInControl) and (FAlphaHotColor <> clNone) then With if (AMouseInControl) and (FAlphaHotColor <> clNone) and Enabled then

In else if FStyle = nsGradient then . Change

     if AMouseInControl then
        GradientFillCanvas(ACanvas, FEndColor, FStartColor, DrawRect, FDirection)
      else
        GradientFillCanvas(ACanvas, FStartColor, FEndColor, DrawRect, FDirection);

      if AMouseInControl then
        ACanvas.Pen.Color := FEndColor
      else
        ACanvas.Pen.Color := FStartColor;

With

     if AMouseInControl and Enabled then 
        GradientFillCanvas(ACanvas, FEndColor, FStartColor, DrawRect, FDirection)
      else
        GradientFillCanvas(ACanvas, FStartColor, FEndColor, DrawRect, FDirection);

      if AMouseInControl and Enabled then
        ACanvas.Pen.Color := FEndColor
      else
        ACanvas.Pen.Color := FStartColor;

In if (FStyle in [nsSplitButton, nsSplitTrans]) then . Change

    if AMouseInControl then
      ThemeTextColor := FHotFontColor
    else
      ThemeTextColor := FFontColor;

With

    if not Enabled then
      ThemeTextColor := clGrayText
    else if AMouseInControl then
      ThemeTextColor := FHotFontColor
    else
      ThemeTextColor := FFontColor;

Change

    if FUseFontAwesome and (FImageIndex >= 0) then
    begin
      if AMouseInControl then
        ThemeTextColor := FAwesomeHotFontColor

With

    if FUseFontAwesome and (FImageIndex >= 0) then
    begin
      if AMouseInControl and Enabled then
        ThemeTextColor := FAwesomeHotFontColor

Change

      // draw arrow

      if (FStyle = nsSplitTrans) and (not AMouseInControl) then
        Pen.Color := FFontColor
      else
        Pen.Color := FHotFontColor;

With

      // draw arrow

      if FStyle = nsSplitTrans then
      begin
        if (not AMouseInControl) or (not Enabled) then
          Pen.Color := FFontColor
        else
          Pen.Color := FHotFontColor;
      end;

Change

  end
  else
  begin
    if AMouseInControl then
      ThemeTextColor := FHotFontColor
    else
      ThemeTextColor := FFontColor;

    // ButtonRect := DrawRect;
    // if not StyleServices.HasElementFixedPosition(Details) then
    // CorrectLeftButtonRect(ButtonRect);
    // DrawRect := ButtonRect;

    if (FCaptionAligmentFlags and DT_CENTER) <> DT_CENTER then
      DrawRect.Left := DrawRect.Left + 5;

    DrawControlText(ACanvas, Details, BCaption, DrawRect, FCaptionAligmentFlags, ThemeTextColor);

    if FUseFontAwesome and (FImageIndex >= 0) then
    begin
      if AMouseInControl then
        ThemeTextColor := FAwesomeHotFontColor

With

  end
  else
  begin
    if not Enabled then
      ThemeTextColor := clGrayText
    else if AMouseInControl then
      ThemeTextColor := FHotFontColor
    else
      ThemeTextColor := FFontColor;

    // ButtonRect := DrawRect;
    // if not StyleServices.HasElementFixedPosition(Details) then
    // CorrectLeftButtonRect(ButtonRect);
    // DrawRect := ButtonRect;

    if (FCaptionAligmentFlags and DT_CENTER) <> DT_CENTER then
      DrawRect.Left := DrawRect.Left + 5;

    DrawControlText(ACanvas, Details, BCaption, DrawRect, FCaptionAligmentFlags,
      ThemeTextColor);

    if FUseFontAwesome and (FImageIndex >= 0) then
    begin
      if AMouseInControl and Enabled then 
        ThemeTextColor := FAwesomeHotFontColor