mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-04 04:18:25 +02:00
lcl: add treeview hot glyph drawing support to the theme services
git-svn-id: trunk@24813 -
This commit is contained in:
parent
42b80d0755
commit
4a4cdb8ee5
@ -285,7 +285,7 @@ var
|
||||
ButtonDrawInfo: HIThemeButtonDrawInfo;
|
||||
LabelRect: HIRect;
|
||||
begin
|
||||
if Details.Part = TVP_GLYPH then
|
||||
if Details.Part in [TVP_GLYPH, TVP_HOTGLYPH] then
|
||||
begin
|
||||
ButtonDrawInfo.version := 0;
|
||||
ButtonDrawInfo.State := GetDrawState(Details);
|
||||
@ -430,7 +430,7 @@ const
|
||||
begin
|
||||
case Details.Element of
|
||||
teTreeView:
|
||||
if (Details.Part = TVP_GLYPH) then
|
||||
if (Details.Part in [TVP_GLYPH, TVP_HOTGLYPH]) then
|
||||
begin
|
||||
Result := Types.Size(
|
||||
GetCarbonThemeMetric(kThemeMetricDisclosureTriangleWidth),
|
||||
|
@ -100,11 +100,14 @@ begin
|
||||
end;
|
||||
teTreeview:
|
||||
begin
|
||||
if Details.Part = TVP_GLYPH then
|
||||
if Details.Part in [TVP_GLYPH, TVP_HOTGLYPH] then
|
||||
begin
|
||||
Result.Painter := gptExpander;
|
||||
Result.Shadow := GTK_SHADOW_NONE;
|
||||
Result.State := GTK_STATE_NORMAL;
|
||||
if Details.Part = TVP_GLYPH then
|
||||
Result.State := GTK_STATE_NORMAL
|
||||
else
|
||||
Result.State := GTK_STATE_PRELIGHT;
|
||||
Result.Widget := GetStyleWidget(lgsTreeView);
|
||||
Result.Detail := 'treeview';
|
||||
if Details.State = GLPS_CLOSED then
|
||||
@ -122,7 +125,7 @@ function TGtk2ThemeServices.GetDetailSize(Details: TThemedElementDetails): TSize
|
||||
var
|
||||
AValue: TGValue;
|
||||
begin
|
||||
if (Details.Element = teTreeView) and (Details.Part = TVP_GLYPH) then
|
||||
if (Details.Element = teTreeView) and (Details.Part in [TVP_GLYPH, TVP_HOTGLYPH]) then
|
||||
begin
|
||||
FillChar(AValue, SizeOf(AValue), 0);
|
||||
g_value_init(@AValue, G_TYPE_INT);
|
||||
|
@ -245,6 +245,7 @@ begin
|
||||
begin
|
||||
opt := QStyleOption_create(Integer(QStyleOptionVersion),
|
||||
Integer(QStyleOptionSO_Default));
|
||||
QStyleOption_setState(opt, GetControlState(Details));
|
||||
if AViewPortPaint then
|
||||
begin
|
||||
{we must reinitialize QPainter brush from opt since
|
||||
@ -618,7 +619,7 @@ begin
|
||||
end;
|
||||
teTreeView:
|
||||
begin
|
||||
if Details.Part = TVP_GLYPH then
|
||||
if Details.Part in [TVP_GLYPH, TVP_HOTGLYPH] then
|
||||
begin
|
||||
Result.DrawVariant := qdvPrimitive;
|
||||
Result.PrimitiveElement := QStylePE_IndicatorBranch;
|
||||
|
@ -66,7 +66,6 @@ uses
|
||||
TmSchema;
|
||||
|
||||
const
|
||||
|
||||
ThemeDataNames: array[TThemedElement] of PWideChar = (
|
||||
'button', // teButton
|
||||
'clock', // teClock
|
||||
@ -94,6 +93,33 @@ const
|
||||
'window' // teWindow
|
||||
);
|
||||
|
||||
ThemeDataNamesVista: array[TThemedElement] of PWideChar = (
|
||||
'button', // teButton
|
||||
'clock', // teClock
|
||||
'combobox', // teComboBox
|
||||
'edit', // teEdit
|
||||
'explorerbar', // teExplorerBar
|
||||
'header', // teHeader
|
||||
'explorer::listview', // teListView
|
||||
'menu', // teMenu
|
||||
'page', // tePage
|
||||
'progress', // teProgress
|
||||
'rebar', // teRebar
|
||||
'scrollbar', // teScrollBar
|
||||
'spin', // teSpin
|
||||
'startpanel', // teStartPanel
|
||||
'status', // teStatus
|
||||
'tab', // teTab
|
||||
'taskband', // teTaskBand
|
||||
'taskbar', // teTaskBar
|
||||
'toolbar', // teToolBar
|
||||
'tooltip', // teToolTip
|
||||
'trackbar', // teTrackBar
|
||||
'traynotify', // teTrayNotify
|
||||
'explorer::treeview', // teTreeview
|
||||
'window' // teWindow
|
||||
);
|
||||
|
||||
// standard windows icons (WinUser.h)
|
||||
// they are already defined in the rtl, however the
|
||||
// const = const defines after this fail with an illegal expression
|
||||
@ -135,6 +161,8 @@ begin
|
||||
end;
|
||||
|
||||
function TWin32ThemeServices.GetDetailSize(Details: TThemedElementDetails): TSize;
|
||||
var
|
||||
R: TRect;
|
||||
begin
|
||||
// GetThemeInt(Theme[Details.Element], Details.Part, Details.State, TMT_HEIGHT, Result);
|
||||
// does not work for some reason
|
||||
@ -142,6 +170,12 @@ begin
|
||||
begin
|
||||
if (Details.Element = teToolBar) and (Details.Part = TP_SPLITBUTTONDROPDOWN) then
|
||||
Result.cx := 12
|
||||
else
|
||||
if (Details.Element = teTreeview) and (Details.Part in [TVP_GLYPH, TVP_HOTGLYPH]) then
|
||||
begin
|
||||
R := Rect(0, 0, 800, 800);
|
||||
GetThemePartSize(GetTheme(Details.Element), 0, Details.Part, Details.State, @R, TS_TRUE, Result);
|
||||
end
|
||||
else
|
||||
Result := inherited GetDetailSize(Details);
|
||||
end
|
||||
@ -254,7 +288,12 @@ end;
|
||||
function TWin32ThemeServices.GetTheme(Element: TThemedElement): HTHEME;
|
||||
begin
|
||||
if (FThemeData[Element] = 0) then
|
||||
FThemeData[Element] := OpenThemeData(0, ThemeDataNames[Element]);
|
||||
begin
|
||||
if (WindowsVersion >= wvVista) then
|
||||
FThemeData[Element] := OpenThemeData(0, ThemeDataNamesVista[Element])
|
||||
else
|
||||
FThemeData[Element] := OpenThemeData(0, ThemeDataNames[Element]);
|
||||
end;
|
||||
Result := FThemeData[Element];
|
||||
end;
|
||||
|
||||
@ -301,6 +340,12 @@ begin
|
||||
Brush := CreateSolidBrush(ColorToRGB(clInfoBk));
|
||||
FillRect(DC, ARect, Brush);
|
||||
DeleteObject(Brush);
|
||||
end
|
||||
else
|
||||
if (Details.Element = teTreeview) and (Details.Part = TVP_HOTGLYPH) and (WindowsVersion < wvVista) then
|
||||
begin
|
||||
Details.Part := TVP_GLYPH;
|
||||
inherited;
|
||||
end;
|
||||
end
|
||||
else
|
||||
|
@ -352,8 +352,9 @@ type
|
||||
ttTreeviewDontCare,
|
||||
ttTreeviewRoot,
|
||||
ttItemNormal, ttItemHot, ttItemSelected, ttItemDisabled, ttItemSelectedNotFocus,
|
||||
ttGlyphClosed, ttGlyphOpened,
|
||||
ttBranch
|
||||
ttGlyphClosed, ttGlyphOpened,
|
||||
ttBranch,
|
||||
ttHotGlyphClosed, ttHotGlyphOpened
|
||||
);
|
||||
|
||||
// 'Window' theme data
|
||||
@ -1639,6 +1640,11 @@ begin
|
||||
Part := TVP_BRANCH;
|
||||
Base := Ord(ttBranch);
|
||||
end;
|
||||
ttHotGlyphClosed..ttHotGlyphOpened:
|
||||
begin
|
||||
Part := TVP_HOTGLYPH;
|
||||
Base := Ord(ttHotGlyphClosed);
|
||||
end;
|
||||
else
|
||||
Part := 0;
|
||||
Base := 0;
|
||||
@ -1872,7 +1878,7 @@ begin
|
||||
if Details.Part = TP_SPLITBUTTONDROPDOWN then
|
||||
Result.cx := 12;
|
||||
teTreeView:
|
||||
if Details.Part = TVP_GLYPH then
|
||||
if Details.Part in [TVP_GLYPH, TVP_HOTGLYPH] then
|
||||
Result := Size(9, 9);
|
||||
end;
|
||||
end;
|
||||
@ -2225,7 +2231,10 @@ begin
|
||||
((Details.Element = teRebar) and (Details.Part >= RP_BAND)) or
|
||||
((Details.Element = teWindow) and (Details.Part >= WP_SYSBUTTON) and
|
||||
(Details.Part <= WP_MDIHELPBUTTON)) then
|
||||
Result := Details.State in [2, 6, 10];
|
||||
Result := Details.State in [2, 6, 10]
|
||||
else
|
||||
if (Details.Element = teTreeview) and (Details.Part = TVP_HOTGLYPH) then
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
function TThemeServices.IsChecked(Details: TThemedElementDetails): Boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user