Improve support for themes in XP, Vista and 7

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Erik-DJ
Junior Member
Junior Member
Posts: 39
Joined: 2007-09-15, 14:53 UTC
Location: Noord-Brabant, The Netherlands

Improve support for themes in XP, Vista and 7

Post by *Erik-DJ »

Some VCL-components of TC look a little old (native Windows 2000 look) if TC is installed on Windows with themes enabled (Windows XP, Vista and 7). For example the headers in the two file-panes (Name, Ext, Size, Date, Attr) look old. You probably have the Delphi-sources of these components. Perhaps you could implement themes support for these components by using the standard ‘Themes.pas’ of Delphi (also available as open source for Delphi and Lazarus). Simple example for a TGrid:

Code: Select all

uses
  Themes;

procedure TGrid.DrawCell(ACol, ARow: Integer; ARect: TRect; AState: TGridDrawState);
var
  Details: TThemedElementDetails;
begin
  if (ThemeServices.ThemesEnabled) then
    begin
    Details := ThemeServices.GetElementDetails(thHeaderItemNormal);
    ThemeServices.DrawElement(Canvas.Handle, Details, ARect);
    Canvas.Brush.Style := bsClear;
    Canvas.Font.Assign(TitleFont);
    ...
    Canvas.TextOut(ARect.Left+2, CentreV(ARect, Canvas.TextHeight(lStr)), lStr);
    ...
    end;
  ...
  inherited;
end;
Search on the internet for “TThemeDBGrid” for a good example (http://jedqc.blogspot.com/search?q=TThemeDBGrid). For the “current directory bar” there is also a modern themed element.

Thanks. I like TC to look modern.
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

For the “current directory bar” there is also a modern themed element.
Can you provide more details?
Erik-DJ
Junior Member
Junior Member
Posts: 39
Joined: 2007-09-15, 14:53 UTC
Location: Noord-Brabant, The Netherlands

Post by *Erik-DJ »

For the 'current directory bar' you can use twMaxCaptionActive.

Link to this subject in anonther forum (poll):

http://ghisler.ch/board/viewtopic.php?t=15107
Erik-DJ
Junior Member
Junior Member
Posts: 39
Joined: 2007-09-15, 14:53 UTC
Location: Noord-Brabant, The Netherlands

Post by *Erik-DJ »

I did some Paint-Shop-Pro-ing and created an example of how TC could look with the use of standard Windows themes possibilities (Delphi ThemeServices). The left panel has the current look, the right one has the themed look:

http://home.kpn.nl/jong7810/z_netlinkedfiles/TC_example1.jpg

Changed:
- Current directory bar
- File panel headers
- Selected file under cursor
- ToolBar/ButtonBar
User avatar
Herr Mann
Power Member
Power Member
Posts: 574
Joined: 2004-05-30, 17:11 UTC
Location: Niedersachsen, Deutschland

Post by *Herr Mann »

The right looks better ...
I hope to TC 8, in 2 years. :cry:
User avatar
petermad
Power Member
Power Member
Posts: 14810
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

2Erik-DJ

When sorting by multible columns (Shift+Click & Ctrl+Click) the sort order is indicated with small numbers - would that be supported by these themed file panel headers?
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2Erik-DJ
Link to this subject in anonther forum (poll)
That's about the header control not about the current path element.
For the 'current directory bar' you can use twMaxCaptionActive.
Thtis won't help the author as he uses Delphi 2. You need to explain this on a Windows API level*.
ToolBar/ButtonBar
That's indeed interesting as this control seems to be themed alright in TC but it seems that ther are different toolbar stlyes on Vista. Could you provide details on this*?
Beside that I'm not sure if this stlye would look good when there is more than one line of buttonbar buttons.
Selected file under cursor
What you display here is not only a cursor but also a selection. As TC has its own way to cursor and selection many people (including me) won't be happy with the standard cursor which is just a dotted reactangle. It might be ok as standard but an additional custom solution is required.

*Parts and states documentation
http://msdn.microsoft.com/en-us/library/bb773210(VS.85).aspx


2petermad
When sorting by multible columns (Shift+Click & Ctrl+Click) the sort order is indicated with small numbers - would that be supported by these themed file panel headers?
So called owner-drawing must be used in any case. There two reasons for that:
1. Before Vista the standard header control doesn't have a sort order indicator. Even Explorer had to paint it like that.
2. The numbers as you mentioned.

In such a owner-drawing routine you can use the Windows theming functions togehther with the above mentioned parts&states to draw sich a header.
User avatar
petermad
Power Member
Power Member
Posts: 14810
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

In such a owner-drawing routine you can use the Windows theming functions togehther with the above mentioned parts&states
Thanks for clarifying!
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply