From: <ah...@us...> - 2007-08-18 13:57:50
|
Revision: 11474 http://jvcl.svn.sourceforge.net/jvcl/?rev=11474&view=rev Author: ahuser Date: 2007-08-18 06:57:48 -0700 (Sat, 18 Aug 2007) Log Message: ----------- JvThemes.DrawThemedFrameControl now paints the controls themed in the IDE. Modified Paths: -------------- trunk/jvcl/run/JvArrowButton.pas trunk/jvcl/run/JvBalloonHint.pas trunk/jvcl/run/JvButton.pas trunk/jvcl/run/JvButtons.pas trunk/jvcl/run/JvInspector.pas trunk/jvcl/run/JvLookOut.pas trunk/jvcl/run/JvTabBar.pas trunk/jvcl/run/JvThemes.pas trunk/jvcl/run/JvxCheckListBox.pas Modified: trunk/jvcl/run/JvArrowButton.pas =================================================================== --- trunk/jvcl/run/JvArrowButton.pas 2007-08-18 13:55:57 UTC (rev 11473) +++ trunk/jvcl/run/JvArrowButton.pas 2007-08-18 13:57:48 UTC (rev 11474) @@ -746,9 +746,8 @@ begin inherited Create(AOwner); SetBounds(0, 0, 42, 25); - ControlStyle := [csCaptureMouse, csOpaque, csDoubleClicks]; + ControlStyle := [csCaptureMouse, {csOpaque, }csDoubleClicks]; IncludeThemeStyle(Self, [csParentBackground]); - ControlStyle := ControlStyle - [csOpaque]; FGlyph := TButtonGlyph.Create; TButtonGlyph(FGlyph).OnChange := GlyphChanged; FFillFont := TFont.Create; @@ -811,9 +810,9 @@ DrawFlags := DFCS_BUTTONPUSH or DFCS_ADJUSTRECT; if (FState in [bsDown, bsExclusive]) then DrawFlags := DrawFlags or DFCS_PUSHED; - if IsMouseOver(Self) then + if IsMouseOver(Self) and not (csDesigning in ComponentState) then DrawFlags := DrawFlags or DFCS_HOT; - DrawThemedFrameControl(Self, Canvas.Handle, PaintRect, DFC_BUTTON, DrawFlags); + DrawThemedFrameControl(Canvas.Handle, PaintRect, DFC_BUTTON, DrawFlags); end else begin @@ -869,9 +868,9 @@ DrawFlags := DFCS_BUTTONPUSH; // or DFCS_ADJUSTRECT; if Push then DrawFlags := DrawFlags or DFCS_PUSHED; - if IsMouseOver(Self) then + if IsMouseOver(Self) and not (csDesigning in ComponentState) then DrawFlags := DrawFlags or DFCS_HOT; - DrawThemedFrameControl(Self, Canvas.Handle, PaintRect, DFC_BUTTON, DrawFlags); + DrawThemedFrameControl(Canvas.Handle, PaintRect, DFC_BUTTON, DrawFlags); end else if FMouseInControl and Enabled or (csDesigning in ComponentState) then @@ -956,6 +955,7 @@ if Assigned(FDropDown) and FArrowClick then begin + DropDown.PopupComponent := Self; Pnt := ClientToScreen(Point(0, Height)); DropDown.Popup(Pnt.X, Pnt.Y); while PeekMessage(Msg, HWND_DESKTOP, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) do @@ -1229,8 +1229,6 @@ Invalidate; end; - - procedure TJvArrowButton.WMLButtonDblClk(var Msg: TWMLButtonDown); begin inherited; @@ -1247,8 +1245,6 @@ end; end; - - procedure TJvArrowButton.MouseEnter(Control: TControl); {$IFDEF JVCLThemesEnabled} var Modified: trunk/jvcl/run/JvBalloonHint.pas =================================================================== --- trunk/jvcl/run/JvBalloonHint.pas 2007-08-18 13:55:57 UTC (rev 11473) +++ trunk/jvcl/run/JvBalloonHint.pas 2007-08-18 13:57:48 UTC (rev 11474) @@ -2271,7 +2271,7 @@ if FCloseState and DFCS_PUSHED > 0 then Button := tttClosePressed else - if FCloseState and DFCS_HOT > 0 then + if (FCloseState and DFCS_HOT > 0) and not (csDesigning in ComponentState) then Button := tttCloseHot else Button := tttCloseNormal; @@ -2355,7 +2355,8 @@ begin State := DFCS_FLAT; - if PtInRect(FCloseBtnRect, SmallPointToPoint(Msg.Pos)) then + if PtInRect(FCloseBtnRect, SmallPointToPoint(Msg.Pos)) and + not (csDesigning in ComponentState) then begin { Note: DFCS_HOT is not supported in windows 95 systems } State := State or DFCS_HOT; Modified: trunk/jvcl/run/JvButton.pas =================================================================== --- trunk/jvcl/run/JvButton.pas 2007-08-18 13:55:57 UTC (rev 11473) +++ trunk/jvcl/run/JvButton.pas 2007-08-18 13:57:48 UTC (rev 11474) @@ -919,15 +919,7 @@ if FState in [bsDown, bsExclusive] then DrawFlags := DrawFlags or DFCS_PUSHED; - {$IFDEF JVCLThemesEnabled} - if ThemeServices.ThemesEnabled then - DrawThemedFrameControl(Self, Canvas.Handle, PaintRect, DFC_SCROLL, DrawFlags) - else - {$ENDIF JVCLThemesEnabled} - begin - DrawFrameControl(Canvas.Handle, PaintRect, DFC_SCROLL, DrawFlags); - - end; + DrawThemedFrameControl(Canvas.Handle, PaintRect, DFC_SCROLL, DrawFlags) end; procedure TJvCustomGraphicButton.DropDownClose; Modified: trunk/jvcl/run/JvButtons.pas =================================================================== --- trunk/jvcl/run/JvButtons.pas 2007-08-18 13:55:57 UTC (rev 11473) +++ trunk/jvcl/run/JvButtons.pas 2007-08-18 13:57:48 UTC (rev 11474) @@ -1099,9 +1099,9 @@ Inc(R.Top, 2); Dec(R.Bottom, 2); if FPress then - DrawThemedFrameControl(WHook.Control, DC, R, DFC_BUTTON, DFCS_BUTTONPUSH or DFCS_PUSHED) + DrawThemedFrameControl(DC, R, DFC_BUTTON, DFCS_BUTTONPUSH or DFCS_PUSHED) else - DrawThemedFrameControl(WHook.Control, DC, R, DFC_BUTTON, DFCS_BUTTONPUSH); + DrawThemedFrameControl(DC, R, DFC_BUTTON, DFCS_BUTTONPUSH); R := Rect(R.Left + 1, R.Top + 1, R.Right - 2, R.Bottom - 2); if FPress then @@ -1553,9 +1553,9 @@ begin if IsFocused or IsDefault then Flags := Flags or DFCS_MONO; // mis-used - if MouseOver then + if MouseOver and not (csDesigning in ComponentState) then Flags := Flags or DFCS_HOT; - DrawThemedFrameControl(Self, FCanvas.Handle, R, DFC_BUTTON, Flags); + DrawThemedFrameControl(FCanvas.Handle, R, DFC_BUTTON, Flags); end else {$ENDIF JVCLThemesEnabled} Modified: trunk/jvcl/run/JvInspector.pas =================================================================== --- trunk/jvcl/run/JvInspector.pas 2007-08-18 13:55:57 UTC (rev 11473) +++ trunk/jvcl/run/JvInspector.pas 2007-08-18 13:57:48 UTC (rev 11474) @@ -6854,7 +6854,7 @@ else if Pressed then BFlags := DFCS_FLAT or DFCS_PUSHED; - DrawThemedFrameControl(Inspector, ACanvas.Handle, R, DFC_SCROLL, BFlags or DFCS_SCROLLCOMBOBOX); + DrawThemedFrameControl(ACanvas.Handle, R, DFC_SCROLL, BFlags or DFCS_SCROLLCOMBOBOX); end else if iifEditButton in Flags then Modified: trunk/jvcl/run/JvLookOut.pas =================================================================== --- trunk/jvcl/run/JvLookOut.pas 2007-08-18 13:55:57 UTC (rev 11473) +++ trunk/jvcl/run/JvLookOut.pas 2007-08-18 13:57:48 UTC (rev 11474) @@ -723,7 +723,7 @@ Flags := Flags or DFCS_HOT; Canvas.Brush.Color := Color; Canvas.Pen.Color := Color; - DrawThemedFrameControl(Self, Canvas.Handle, R, DFC_SCROLL, DFCS_SCROLLUP or Flags); + DrawThemedFrameControl(Canvas.Handle, R, DFC_SCROLL, DFCS_SCROLLUP or Flags); if FFlat and MouseOver then begin @@ -833,7 +833,7 @@ Flags := Flags or DFCS_HOT; Canvas.Brush.Color := Color; Canvas.Pen.Color := Color; - DrawThemedFrameControl(Self, Canvas.Handle, R, DFC_SCROLL, DFCS_SCROLLDOWN or Flags); + DrawThemedFrameControl(Canvas.Handle, R, DFC_SCROLL, DFCS_SCROLLDOWN or Flags); if FFlat and MouseOver then begin Modified: trunk/jvcl/run/JvTabBar.pas =================================================================== --- trunk/jvcl/run/JvTabBar.pas 2007-08-18 13:55:57 UTC (rev 11473) +++ trunk/jvcl/run/JvTabBar.pas 2007-08-18 13:57:48 UTC (rev 11474) @@ -2018,7 +2018,7 @@ begin {$IFDEF JVCLThemesEnabled} if ThemeServices.ThemesEnabled then - DrawThemedFrameControl(TabBar, Canvas.Handle, R, DFC_SCROLL, ScrollTypes[Button] or States[State]) + DrawThemedFrameControl(Canvas.Handle, R, DFC_SCROLL, ScrollTypes[Button] or States[State]) else {$ELSE} begin Modified: trunk/jvcl/run/JvThemes.pas =================================================================== --- trunk/jvcl/run/JvThemes.pas 2007-08-18 13:55:57 UTC (rev 11473) +++ trunk/jvcl/run/JvThemes.pas 2007-08-18 13:57:48 UTC (rev 11474) @@ -754,11 +754,8 @@ procedure DrawThemedBackground(Control: TControl; DC: HDC; const R: TRect; Brush: HBRUSH; NeedsParentBackground: Boolean = True); overload; -{ DrawThemesFrameControl draws a themed frame control when theming is enabled. - Control = nil: the frame control will be painted themed only if the control - is not in csDesigning mode. } -function DrawThemedFrameControl(Control: TControl; DC: HDC; const Rect: TRect; - uType, uState: UINT): BOOL; +{ DrawThemesFrameControl draws a themed frame control when theming is enabled. } +function DrawThemedFrameControl(DC: HDC; const Rect: TRect; uType, uState: UINT): BOOL; { PerformEraseBackground sends a WM_ERASEBKGND message to the Control's parent. } @@ -818,12 +815,11 @@ Cl: TColor; begin {$IFDEF JVCLThemesEnabled} - if (not (csDesigning in Control.ComponentState)) and - (Control.Parent <> nil) and - ((Color = TWinControlThemeInfo(Control.Parent).Color) or - (ColorToRGB(Color) = ColorToRGB(TWinControlThemeInfo(Control.Parent).Color))) and - (ThemeServices.ThemesEnabled) and - ((not NeedsParentBackground) or (csParentBackground in GetThemeStyle(Control))) then + if ThemeServices.ThemesEnabled and + (Control.Parent <> nil) and + ((Color = TWinControlThemeInfo(Control.Parent).Color) or + (ColorToRGB(Color) = ColorToRGB(TWinControlThemeInfo(Control.Parent).Color))) and + ((not NeedsParentBackground) or (csParentBackground in GetThemeStyle(Control))) then begin if Control is TWinControl then begin @@ -856,12 +852,11 @@ begin {$IFDEF JVCLThemesEnabled} GetObject(Brush, SizeOf(LogBrush), @LogBrush); - if (not (csDesigning in Control.ComponentState)) and - (Control.Parent <> nil) and - (LogBrush.lbColor = Cardinal(ColorToRGB(TWinControlThemeInfo(Control.Parent).Color))) and - (ThemeServices.ThemesEnabled) and - ((not NeedsParentBackground) or - (csParentBackground in GetThemeStyle(Control))) then + if ThemeServices.ThemesEnabled and + (Control.Parent <> nil) and + (LogBrush.lbColor = Cardinal(ColorToRGB(TWinControlThemeInfo(Control.Parent).Color))) and + ((not NeedsParentBackground) or + (csParentBackground in GetThemeStyle(Control))) then begin if Control is TWinControl then begin @@ -878,7 +873,7 @@ FillRect(DC, R, Brush); end; -function DrawThemedFrameControl(Control: TControl; DC: HDC; const Rect: TRect; uType, uState: UINT): BOOL; +function DrawThemedFrameControl(DC: HDC; const Rect: TRect; uType, uState: UINT): BOOL; {$IFDEF JVCLThemesEnabled} const Mask = $00FF; @@ -892,8 +887,7 @@ begin Result := False; {$IFDEF JVCLThemesEnabled} - if ((Control = nil) or (not (csDesigning in Control.ComponentState))) and - ThemeServices.ThemesEnabled then + if ThemeServices.ThemesEnabled then begin R := Rect; case uType of @@ -1178,8 +1172,7 @@ {$ENDIF JVCLThemesEnabled} begin {$IFDEF JVCLThemesEnabled} - if (Style <> bsWin31) and not (csDesigning in Control.ComponentState) and - ThemeServices.ThemesEnabled then + if (Style <> bsWin31) and ThemeServices.ThemesEnabled then begin Result := Client; Modified: trunk/jvcl/run/JvxCheckListBox.pas =================================================================== --- trunk/jvcl/run/JvxCheckListBox.pas 2007-08-18 13:55:57 UTC (rev 11473) +++ trunk/jvcl/run/JvxCheckListBox.pas 2007-08-18 13:57:48 UTC (rev 11474) @@ -1793,11 +1793,11 @@ if AState = cbGrayed then Flags := Flags or DFCS_MONO; if CheckKind = ckCheckBoxes then - DrawThemedFrameControl(Self, Canvas.Handle, DrawRect, DFC_BUTTON, + DrawThemedFrameControl(Canvas.Handle, DrawRect, DFC_BUTTON, DFCS_BUTTONCHECK or Flags) else if CheckKind = ckRadioButtons then - DrawThemedFrameControl(Self, Canvas.Handle, DrawRect, DFC_BUTTON, + DrawThemedFrameControl(Canvas.Handle, DrawRect, DFC_BUTTON, DFCS_BUTTONRADIO or Flags); end else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |