hi
  in patch are small improvements for buttons
 now speedbuttons has transparent
 color property for speedbtn
 and small bugfix for toolbutton


Darek

Index: include/speedbutton.inc
===================================================================
--- include/speedbutton.inc     (wersja 9179)
+++ include/speedbutton.inc     (kopia robocza)
@@ -284,7 +284,9 @@
     if FState in [bsDown, bsExclusive] then 
       inc(Result,DFCS_PUSHED);
     if not Enabled then
-      inc(Result,DFCS_INACTIVE);
+      inc(Result,DFCS_INACTIVE)
+    else if fMouseInControl then inc(Result,DFCS_CHECKED);
+      
   end;
 end;
 
@@ -386,7 +388,7 @@
   Flags,
   SIndex : Longint;
   TMP : String;
-  //xBevel :  tBevelCut;
+  xBevel :  tBevelCut;
 begin
   UpdateState(false);
   if FGlyph=nil then exit;
@@ -409,10 +411,24 @@
   end;}
 
   // do not draw anything if flat and mouse not in control (simplified)
-  if (FLastDrawFlags and DFCS_FLAT) = 0 then begin
-    DrawFrameControl(Canvas.GetUpdatedHandle([csBrushValid,csPenValid]),
-      PaintRect, DFC_BUTTON, FLastDrawFlags);
-     InflateRect(PaintRect, -1, -1);
+  if transparent then begin
+    if (FLastDrawFlags and DFCS_FLAT) = 0 then begin
+      if MouseInControl then begin
+//      Canvas.GetUpdatedHandle([csBrushValid,csPenValid]);
+       if (FLastDrawFlags and DFCS_PUSHED) <>0 then xBevel := bvLowered
+                                               else xBevel := bvRaised;
+        canvas.Frame3D(PaintRect,1,xBevel);
+      end;
+      InflateRect(PaintRect, -1, -1);
+    end;
+    
+
+  end else begin
+    if (FLastDrawFlags and DFCS_FLAT) = 0 then begin
+      DrawFrameControl(Canvas.GetUpdatedHandle([csBrushValid,csPenValid]),
+        PaintRect, DFC_BUTTON, FLastDrawFlags);
+       InflateRect(PaintRect, -1, -1);
+    end;
   end;
 
   //writeln('TCustomSpeedButton.Paint ',Name,':',ClassName,' 
Parent.Name=',Parent.Name,
@@ -540,7 +556,7 @@
       Canvas.Font.Color := clBtnShadow;
       OffsetRect(PaintRect, -1, -1);
     end;
-    //DebugLn('TCustomSpeedButton.Paint 
PaintRect=',PaintRect.Left,',',PaintRect.TOp,',',PaintRect.Right,',',PaintRect.Bottom);
+    //DebugLn('TCustomSpeedButton.Paint 
PaintRect=',PaintRect.Left,',',PaintRect.TOp,',',PaintRect.Right,',',PaintRect.Bottom,caption);
     Canvas.TextRect(PaintRect, PaintRect.Left, PaintRect.Top, Caption, 
TXTStyle);
   end;
 
Index: include/toolbutton.inc
===================================================================
--- include/toolbutton.inc      (wersja 9179)
+++ include/toolbutton.inc      (kopia robocza)
@@ -232,6 +232,7 @@
     if (Style in [tbsButton,tbsDropDown,tbsCheck]) and (FLastButtonDrawFlags 
and DFCS_FLAT = 0) then begin
       DrawFrameControl(Canvas.GetUpdatedHandle([csBrushValid,csPenValid]),
         PaintRect{ButtonRect}, DFC_BUTTON, FLastButtonDrawFlags);
+      InflateRect(PaintRect, -1, -1);
     end;
 
     // draw dropdown button
Index: buttons.pp
===================================================================
--- buttons.pp  (wersja 9179)
+++ buttons.pp  (kopia robocza)
@@ -226,6 +226,7 @@
     property BorderSpacing;
     property Cancel;
     property Caption;
+    property Color;
     property Constraints;
     property Default;
     property Enabled;
@@ -353,6 +354,7 @@
     property BorderSpacing;
     property Constraints;
     property Caption;
+    property Color;
     property Down;
     property Enabled;
     property Flat;

Reply via email to