[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [T-Merge patch] syncing code for views

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Sun, 17 Apr 2011 11:46:25 +0200

On 17.04.2011 09:30, Oto BREZINA wrote:
> On 2011-04-05 20:03, Stefan Küng wrote:
>>
>>> 2. Is there plan to support icons there? let say, same like in main
>>> menu? not worth much but nice :)
>> Good idea.
> I look at code it seems be possible without owner draw to keep string.
> (ref: http://www.codeguru.com/forum/archive/index.php/t-101074.html)
> However I don't know how to extract one bitmap from toolbar ...
> Do we need set new resource?

To get the icon for a specific command from the toolbar, something like
this might work:

HICON GetIconForCommand() {
CToolbar bar;
bar.Create(m_hWnd);
if (bar.LoadToolBar(IDR_MAINFRAME))
{
   int offset = bar.CommandToIndex(cmdId);
   CImageList imgList;
   imgList.Attach(SendMessage(bar.GetSafeHwnd(), TB_GETIMAGELIST, 0, 0));
   HICON h=imgList.ExtractIcon(offset);
   imgList.Detach();
   return h;
}
return 0;
}

If a handle is returned, use that for the AppendMenuIcon() method.
Otherwise (if 0 is returned) you can use a custom icon.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=2720704
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2011-04-17 11:46:47 CEST

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.