1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2008 - TortoiseSVN
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
21 typedef HRESULT (WINAPI *FN_GetBufferedPaintBits) (HPAINTBUFFER hBufferedPaint, RGBQUAD **ppbBuffer, int *pcxRow);
\r
22 typedef HPAINTBUFFER (WINAPI *FN_BeginBufferedPaint) (HDC hdcTarget, const RECT *prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS *pPaintParams, HDC *phdc);
\r
23 typedef HRESULT (WINAPI *FN_EndBufferedPaint) (HPAINTBUFFER hBufferedPaint, BOOL fUpdateTarget);
\r
28 * Extends the CMenu class with a convenience method to insert a menu
\r
29 * entry with an icon.
\r
31 * The icons are loaded from the resources and converted to a bitmap.
\r
32 * The bitmaps are destroyed together with the CIconMenu object.
\r
34 class CIconMenu : public CMenu
\r
40 BOOL AppendMenuIcon(UINT_PTR nIDNewItem, LPCTSTR lpszNewItem, UINT uIcon = 0);
\r
41 BOOL AppendMenuIcon(UINT_PTR nIDNewItem, UINT_PTR nNewItem, UINT uIcon = 0);
\r
42 void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
\r
43 void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
\r
46 HBITMAP IconToBitmapPARGB32(UINT uIcon);
\r
47 HRESULT Create32BitHBITMAP(HDC hdc, const SIZE *psize, __deref_opt_out void **ppvBits, __out HBITMAP* phBmp);
\r
48 HRESULT ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hdc, HICON hicon, SIZE& sizIcon);
\r
49 bool HasAlpha(__in Gdiplus::ARGB *pargb, SIZE& sizImage, int cxRow);
\r
50 HRESULT ConvertToPARGB32(HDC hdc, __inout Gdiplus::ARGB *pargb, HBITMAP hbmp, SIZE& sizImage, int cxRow);
\r
53 std::map<UINT, HBITMAP> bitmaps;
\r
54 std::map<UINT_PTR, UINT> icons;
\r
57 FN_GetBufferedPaintBits pfnGetBufferedPaintBits;
\r
58 FN_BeginBufferedPaint pfnBeginBufferedPaint;
\r
59 FN_EndBufferedPaint pfnEndBufferedPaint;
\r