Click here to Skip to main content
15,880,469 members
Articles / Desktop Programming / WTL

WTL ExplorerBar

Rate me:
Please Sign up or sign in to vote.
4.85/5 (11 votes)
24 Mar 20052 min read 54.7K   3.6K   66  
A WTL wrapper around the "XP style Explorer Bar (Win32/MFC)" control of Ingo A. Kubbilun.
#ifndef _INC_SHELLSTYLE_H_
#define _INC_SHELLSTYLE_H_
#ifdef __cplusplus
extern "C" {
#endif

#include <windows.h>
#include <commctrl.h>

typedef struct tagEXPBARINFO              EXPBARINFO, *PEXPBARINFO;

struct tagEXPBARINFO
{
  int                   cbSize;

  BOOL                  bPreXP;             // true if pre XP style
  BOOL                  bUseThemeRenderer;  // true if theme renderer must be used
  BOOL                  bShellStyleDll;     // true if shellstyle Dll present and used

  TCHAR                 szMsStylesDllName[MAX_PATH];
  TCHAR                 szColorname[MAX_PATH];
  TCHAR                 szShellStyleDllName[MAX_PATH];

  // only for pre XP (arrows of normal collapsible header)

  int                   iBmpPreXPArrowWidth;
  int                   iBmpPreXPArrowHeight;
  HBITMAP               hAlphaPreXPBmpArrowUp[3];
  HBITMAP               hAlphaPreXPBmpArrowDn[3];

  // task pane

  struct
  {
    COLORREF            crBackground1;
    COLORREF            crBackground2;
    int                 iValue;
    RECT                rcPadding;
    RECT                rcBorderThickness;
    COLORREF            crBorder;
  } taskpane;

  // pane task links (normal)

  struct
  {
    RECT                rcTitlePadding;             // generic link padding (inner)
    RECT                rcMarginsActionTask;        // margins: action task (outer)
    RECT                rcMarginsDestinationTask;   // margins: destination task (outer)
    COLORREF            crLinkNormal;               // normal link color
    COLORREF            crLinkHot;                  // hot link color (mousefocused)
  } tasknormal;

  // pane task links (special)

  struct
  {
    RECT                rcTitlePadding;             // generic link padding (inner)
    RECT                rcMarginsActionTask;        // margins: action task (outer)
    RECT                rcMarginsDestinationTask;   // margins: destination task (outer)
    COLORREF            crLinkNormal;               // normal link color
    COLORREF            crLinkHot;                  // hot link color (mousefocused)
  } taskspecial;

  // normal header

  struct
  {
    char                szFontFace[MAX_PATH];       // font face for header and content
    int                 iFontSize;                  // font size for header and content
    int                 iMargin;                    // margin (pane to bar)
    HBITMAP             hAlphaBmpListHeader;        // header bitmap, if NULL: use ThemeRenderer
    int                 iHeaderBmpWidth;            // 0 or bitmap width
    int                 iHeaderBmpHeight;           // 0 or bitmap height
    COLORREF            crHeaderNormal;             // normal color (header only)
    COLORREF            crHeaderHot;                // hot color (header only)
    UINT                uAlignment;                 // 0 or text alignment (header only)
    int                 iFontWeightHeader;          // font weight (header only)
    RECT                rcPaddingHeader;            // outer
    RECT                rcBorderThicknessHeader;    // inner
    COLORREF            crBorderColorHeader;        // unused, PRE_XP: background color of header

    int                 iBmpArrowWidth;
    int                 iBmpArrowHeight;
    HBITMAP             hAlphaBmpArrowUp[3];        // normal, hot, pressed ([0]==NULL: use ThemeRenderer)
                                                    // [2]==NULL: no pressed bitmap, use hot y+1
    HBITMAP             hAlphaBmpArrowDn[3];        // normal, hot, pressed ([0]==NULL: use ThemeRenderer)
                                                    // [2]==NULL: no pressed bitmap, use hot y+1

    COLORREF            crTLbackground;             // background color (task list)
    RECT                rcTLBorderThickness;        // border thickness
    COLORREF            crTLBorder;                 // border color
    RECT                rcTLPadding;                // padding (task pane to items)
  } headernormal;

  // special header

  struct
  {
    char                szFontFace[MAX_PATH];       // font face for header and content
    int                 iFontSize;                  // font size for header and content
    int                 iMargin;                    // margin (pane to bar)
    HBITMAP             hAlphaBmpListHeader;        // header bitmap, if NULL: use ThemeRenderer
    int                 iHeaderBmpWidth;            // 0 or bitmap width
    int                 iHeaderBmpHeight;           // 0 or bitmap height
    COLORREF            crHeaderNormal;             // normal color (header only)
    COLORREF            crHeaderHot;                // hot color (header only)
    UINT                uAlignment;                 // 0 or text alignment (header only)
    int                 iFontWeightHeader;          // font weight (header only)
    RECT                rcPaddingHeader;            // outer
    RECT                rcBorderThicknessHeader;    // inner
    COLORREF            crBorderColorHeader;        // unused, PRE_XP: background color of header

    int                 iBmpArrowWidth;
    int                 iBmpArrowHeight;
    HBITMAP             hAlphaBmpArrowUp[3];        // normal, hot, pressed ([0]==NULL: use ThemeRenderer)
                                                    // [2]==NULL: no pressed bitmap, use hot y+1
    HBITMAP             hAlphaBmpArrowDn[3];        // normal, hot, pressed ([0]==NULL: use ThemeRenderer)
                                                    // [2]==NULL: no pressed bitmap, use hot y+1

    COLORREF            crTLbackground;             // background color (task list, watermark)
    UINT                uTLAlign;                   // alignment (watermark)
    RECT                rcTLBorderThickness;        // border thickness
    COLORREF            crTLBorder;                 // border color
    RECT                rcTLPadding;                // padding (task pane to items)
  } headerspecial;

};

#define TDA_LEFT                      0x00000001L
#define TDA_CENTER                    0x00000002L
#define TDA_RIGHT                     0x00000004L
#define TDA_WRAP                      0x00000008L
#define TDA_TOP                       0x00000010L
#define TDA_MIDDLE                    0x00000020L
#define TDA_BOTTOM                    0x00000040L
#define TDA_FOCUSRECT                 0x00000080L
#define TDA_LEFTTOP                   (TDA_LEFT|TDA_TOP)
#define TDA_LEFTMIDDLE                (TDA_LEFT|TDA_MIDDLE)
#define TDA_LEFTBOTTOM                (TDA_LEFT|TDA_BOTTOM)
#define TDA_CENTERTOP                 (TDA_CENTER|TDA_TOP)
#define TDA_CENTERMIDDLE              (TDA_CENTER|TDA_MIDDLE)
#define TDA_CENTERBOTTOM              (TDA_CENTER|TDA_BOTTOM)
#define TDA_RIGHTTOP                  (TDA_RIGHT|TDA_TOP)
#define TDA_RIGHTMIDDLE               (TDA_RIGHT|TDA_MIDDLE)
#define TDA_RIGHTBOTTOM               (TDA_RIGHT|TDA_BOTTOM)
#define TDA_TOPLEFT                   (TDA_TOP|TDA_LEFT)
#define TDA_TOPCENTER                 (TDA_TOP|TDA_CENTER)
#define TDA_TOPRIGHT                  (TDA_TOP|TDA_RIGHT)
#define TDA_MIDDLELEFT                (TDA_MIDDLE|TDA_LEFT)
#define TDA_MIDDLECENTER              (TDA_MIDDLE|TDA_CENTER)
#define TDA_MIDDLERIGHT               (TDA_MIDDLE|TDA_RIGHT)
#define TDA_BOTTOMLEFT                (TDA_BOTTOM|TDA_LEFT)
#define TDA_BOTTOMCENTER              (TDA_BOTTOM|TDA_CENTER)
#define TDA_BOTTOMRIGHT               (TDA_BOTTOM|TDA_RIGHT)
#define TDA_WRAPLEFT                  (TDA_WRAP|TDA_LEFT)
#define TDA_WRAPCENTER                (TDA_WRAP|TDA_CENTER)
#define TDA_WRAPRIGHT                 (TDA_WRAP|TDA_RIGHT)

#define TDFS_NORMAL                   0x00000000L
#define TDFS_UNDERLINE                0x00000001L
#define TDFS_ITALIC                   0x00000002L
#define TDFS_BOLD                     0x00000004L

BOOL APIENTRY GetExplorerBarInfo ( PEXPBARINFO pEBI, BOOL bIgnoreShellStyleDll );

VOID APIENTRY FreeExplorerBarInfo ( PEXPBARINFO pEBI );

#ifdef __cplusplus
}
#endif
#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions