Public Member Functions | Protected Attributes

Icon Struct Reference

#include <globals.h>

Inheritance diagram for Icon:
Inheritance graph
[legend]
Collaboration diagram for Icon:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Icon ()
 Icon (ICON_ID id, UINT nid)
 Icon (ICON_ID id, UINT nid, int icon_size)
 Icon (ICON_TYPE itype, int id, HICON hIcon)
 Icon (ICON_TYPE itype, int id, int sys_idx)
 operator ICON_ID () const
void draw (HDC hdc, int x, int y, int cx, int cy, COLORREF bk_color, HBRUSH bk_brush) const
HBITMAP create_bitmap (COLORREF bk_color, HBRUSH hbrBkgnd, HDC hdc_wnd) const
int add_to_imagelist (HIMAGELIST himl, HDC hdc_wnd, COLORREF bk_color=GetSysColor(COLOR_WINDOW), HBRUSH bk_brush=GetSysColorBrush(COLOR_WINDOW)) const
int get_sysiml_idx () const
HICON get_hicon () const
ICON_TYPE get_icontype () const
bool destroy ()

Protected Attributes

ICON_ID _id
ICON_TYPE _itype
HICON _hicon
int _sys_idx

Detailed Description

Definition at line 96 of file globals.h.


Constructor & Destructor Documentation

Icon::Icon (  )

Definition at line 246 of file explorer.cpp.

Icon::Icon ( ICON_ID  id,
UINT  nid 
)

Definition at line 253 of file explorer.cpp.

 :  _id(id),
    _itype(IT_STATIC),
    _hicon(ResIcon(nid))    // ResIconEx(nid, cx, cy)
{
}
Icon::Icon ( ICON_ID  id,
UINT  nid,
int  icon_size 
)

Definition at line 260 of file explorer.cpp.

 :  _id(id),
    _itype(IT_STATIC),
    _hicon(ResIconEx(nid, icon_size, icon_size))
{
}
Icon::Icon ( ICON_TYPE  itype,
int  id,
HICON  hIcon 
)

Definition at line 267 of file explorer.cpp.

 :  _id((ICON_ID)id),
    _itype(itype),
    _hicon(hIcon)
{
}
Icon::Icon ( ICON_TYPE  itype,
int  id,
int  sys_idx 
)

Definition at line 274 of file explorer.cpp.

 :  _id((ICON_ID)id),
    _itype(itype),
    _sys_idx(sys_idx)
{
}

Member Function Documentation

int Icon::add_to_imagelist ( HIMAGELIST  himl,
HDC  hdc_wnd,
COLORREF  bk_color = GetSysColor(COLOR_WINDOW),
HBRUSH  bk_brush = GetSysColorBrush(COLOR_WINDOW) 
) const

Definition at line 310 of file explorer.cpp.

References _hicon, ExplorerGlobals::_icon_cache, _itype, _sys_idx, IconCache::get_sys_imagelist(), ImageList_AddAlphaIcon(), and IT_SYSCACHE.

Referenced by BookmarkList::fill_tree(), and MainFrameBase::FillBookmarks().

{
    int ret;

    if (_itype == IT_SYSCACHE) {
        HIMAGELIST himl = g_Globals._icon_cache.get_sys_imagelist();

        int cx, cy;
        ImageList_GetIconSize(himl, &cx, &cy);

        HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
        HDC hdc = CreateCompatibleDC(hdc_wnd);
        HBITMAP hbmp_old = SelectBitmap(hdc, hbmp);
        ImageList_DrawEx(himl, _sys_idx, hdc, 0, 0, cx, cy, bk_color, CLR_DEFAULT, ILD_NORMAL);
        SelectBitmap(hdc, hbmp_old);
        DeleteDC(hdc);

        ret = ImageList_Add(himl, hbmp, 0);

        DeleteObject(hbmp);
    } else
        ret = ImageList_AddAlphaIcon(himl, _hicon, bk_brush, hdc_wnd);

    return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

HBITMAP Icon::create_bitmap ( COLORREF  bk_color,
HBRUSH  hbrBkgnd,
HDC  hdc_wnd 
) const

Definition at line 289 of file explorer.cpp.

References _hicon, ExplorerGlobals::_icon_cache, _itype, _sys_idx, create_bitmap_from_icon(), IconCache::get_sys_imagelist(), and IT_SYSCACHE.

Referenced by QuickLaunchBar::AddShortcuts().

{
    if (_itype == IT_SYSCACHE) {
        HIMAGELIST himl = g_Globals._icon_cache.get_sys_imagelist();

        int cx, cy;
        ImageList_GetIconSize(himl, &cx, &cy);

        HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
        HDC hdc = CreateCompatibleDC(hdc_wnd);
        HBITMAP hbmp_old = SelectBitmap(hdc, hbmp);
        ImageList_DrawEx(himl, _sys_idx, hdc, 0, 0, cx, cy, bk_color, CLR_DEFAULT, ILD_NORMAL);
        SelectBitmap(hdc, hbmp_old);
        DeleteDC(hdc);

        return hbmp;
    } else
        return create_bitmap_from_icon(_hicon, hbrBkgnd, hdc_wnd);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool Icon::destroy (  ) [inline]

Definition at line 113 of file globals.h.

References IT_DYNAMIC.

Referenced by IconCache::free_icon().

{if (_itype == IT_DYNAMIC) {DestroyIcon(_hicon); return true;} else return false;}

Here is the caller graph for this function:

void Icon::draw ( HDC  hdc,
int  x,
int  y,
int  cx,
int  cy,
COLORREF  bk_color,
HBRUSH  bk_brush 
) const

Definition at line 281 of file explorer.cpp.

References _hicon, ExplorerGlobals::_icon_cache, _itype, _sys_idx, IconCache::get_sys_imagelist(), and IT_SYSCACHE.

Referenced by Pane::draw_item().

{
    if (_itype == IT_SYSCACHE)
        ImageList_DrawEx(g_Globals._icon_cache.get_sys_imagelist(), _sys_idx, hdc, x, y, cx, cy, bk_color, CLR_DEFAULT, ILD_NORMAL);
    else
        DrawIconEx(hdc, x, y, _hicon, cx, cy, 0, bk_brush, DI_NORMAL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

HICON Icon::get_hicon (  ) const [inline]

Definition at line 110 of file globals.h.

References IT_SYSCACHE.

Referenced by ShellBrowser::get_image_idx().

{return _itype!=IT_SYSCACHE? _hicon: 0;}

Here is the caller graph for this function:

ICON_TYPE Icon::get_icontype (  ) const [inline]

Definition at line 111 of file globals.h.

{ return _itype; }
int Icon::get_sysiml_idx (  ) const [inline]

Definition at line 109 of file globals.h.

References IT_SYSCACHE.

Referenced by FindProgramDlg::Notify().

{return _itype==IT_SYSCACHE? _sys_idx: -1;}

Here is the caller graph for this function:

Icon::operator ICON_ID (  ) const [inline]

Definition at line 103 of file globals.h.

{return _id;}

Member Data Documentation

HICON Icon::_hicon [protected]

Definition at line 118 of file globals.h.

Referenced by add_to_imagelist(), create_bitmap(), and draw().

ICON_ID Icon::_id [protected]

Definition at line 116 of file globals.h.

ICON_TYPE Icon::_itype [protected]

Definition at line 117 of file globals.h.

Referenced by add_to_imagelist(), create_bitmap(), and draw().

int Icon::_sys_idx [protected]

Definition at line 119 of file globals.h.

Referenced by add_to_imagelist(), create_bitmap(), and draw().


The documentation for this struct was generated from the following files:

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage