From: <zou...@us...> - 2008-02-08 17:19:26
|
Revision: 996 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=996&view=rev Author: zouzou123gen Date: 2008-02-08 09:19:21 -0800 (Fri, 08 Feb 2008) Log Message: ----------- tab menus have icons and a title bar + more menu icons added Modified Paths: -------------- dcplusplus/trunk/smartwin/SmartUtil/StringUtils.cpp dcplusplus/trunk/smartwin/SmartUtil/StringUtils.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h dcplusplus/trunk/smartwin/source/widgets/WidgetMenu.cpp dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp dcplusplus/trunk/win32/DCPlusPlus.rc dcplusplus/trunk/win32/HubFrame.cpp dcplusplus/trunk/win32/MDIChildFrame.h dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/PrivateFrame.cpp dcplusplus/trunk/win32/resource.h Added Paths: ----------- dcplusplus/trunk/res/menu/DCPlusPlus.bmp dcplusplus/trunk/res/menu/Exit.bmp dcplusplus/trunk/res/menu/Hub.bmp Added: dcplusplus/trunk/res/menu/DCPlusPlus.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/DCPlusPlus.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/Exit.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/Exit.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/Hub.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/Hub.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: dcplusplus/trunk/smartwin/SmartUtil/StringUtils.cpp =================================================================== --- dcplusplus/trunk/smartwin/SmartUtil/StringUtils.cpp 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/smartwin/SmartUtil/StringUtils.cpp 2008-02-08 17:19:21 UTC (rev 996) @@ -3,6 +3,12 @@ #include "UtilSystemHeaders.h" namespace SmartUtil { + tstring cutText(tstring str, unsigned int maxLength) { + if(str.length() > maxLength) + str = str.substr(0, maxLength - 3) + _T("..."); + return str; + } + tstring escapeMenu(tstring str) { tstring::size_type i = 0; while( (i = str.find(_T('&'), i)) != tstring::npos) { Modified: dcplusplus/trunk/smartwin/SmartUtil/StringUtils.h =================================================================== --- dcplusplus/trunk/smartwin/SmartUtil/StringUtils.h 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/smartwin/SmartUtil/StringUtils.h 2008-02-08 17:19:21 UTC (rev 996) @@ -4,6 +4,7 @@ #include "tstring.h" namespace SmartUtil { +tstring cutText(tstring str, unsigned int maxLength); tstring escapeMenu(tstring str); } Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h 2008-02-08 17:19:21 UTC (rev 996) @@ -124,9 +124,6 @@ /// Strip bar color COLORREF colorStrip; - /// Title background color - COLORREF colorTitle; - /// Menu bar color COLORREF colorMenuBar; @@ -146,14 +143,12 @@ */ MenuColorInfo( COLORREF menuColor = ColorUtilities::darkenColor( ::GetSysColor( COLOR_WINDOW ), 0.02 ), COLORREF stripColor = ColorUtilities::darkenColor( ::GetSysColor( COLOR_3DFACE ), 0.02 ), - COLORREF titleColor = ColorUtilities::darkenColor( ::GetSysColor( COLOR_MENUBAR ), 0.1 ), COLORREF menuBarColor = ::GetSysColor( COLOR_MENUBAR ), COLORREF highlightColor = ::GetSysColor( COLOR_HIGHLIGHT ), COLORREF titleTextColor = ::GetSysColor( COLOR_MENUTEXT ), COLORREF imageBackground = RGB( 0, 0, 0 ) ) // black : colorMenu( menuColor ), colorStrip( stripColor ), - colorTitle( titleColor ), colorMenuBar( menuBarColor ), colorHighlight( highlightColor ), colorTitleText( titleTextColor ), @@ -452,11 +447,16 @@ */ void checkItem( unsigned int id, bool setChecked, bool radioMark ); - /// Returns true if item is checked - bool isItemEnabled( unsigned int id ); + UINT getMenuState(UINT id, bool byPosition = false); - /// Returns true if item is checked - bool isItemChecked( unsigned int id ); + /// Return true if the item is a separator (by position) + bool isSeparator(UINT id, bool byPosition = false); + /// Return true if the menu item is checked + bool isChecked(UINT id, bool byPosition = false); + /// Return true if the menu item is a popup menu + bool isPopup(UINT id, bool byPosition = false); + /// Return true if the menu item is enabled (not grey and not disabled) + bool isEnabled(UINT id, bool byPosition = false); /// Returns true if menu is "system menu" (icon in top left of window) bool isSystemMenu() @@ -464,15 +464,23 @@ return isSysMenu; } - /// Returns item text - SmartUtil::tstring getItemText( unsigned int id ); + /// Returns the text of a specific menu item + /** Which menu item you wish to retrieve the text for is defined by the "id" + * parameter of the function. + */ + SmartUtil::tstring getText( unsigned idOrPos, bool byPos ); - /// Sets item text - void setItemText( unsigned int id, SmartUtil::tstring text ); + /// Sets the text of a specific menu item + /** Which menu item you wish to set the text is defined by the "id" + * parameter of the function. + */ + void setText( unsigned id, const SmartUtil::tstring& text ); /// Returns item data MenuItemDataPtr getData( int itemIndex ); + ObjectType getChild(UINT position); + virtual ~WidgetMenuExtended(); protected: Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h 2008-02-08 17:19:21 UTC (rev 996) @@ -60,6 +60,8 @@ void create( const Seed & cs = Seed() ); + enum { MAX_TITLE_LENGTH = 20 }; + protected: friend class WidgetCreator<WidgetTabView>; @@ -68,7 +70,6 @@ virtual ~WidgetTabView() { } private: - enum { MAX_TITLE_LENGTH = 20 }; struct TabInfo { TabInfo(WidgetChildWindow* w_) : w(w_) { } WidgetChildWindow* w; Modified: dcplusplus/trunk/smartwin/source/widgets/WidgetMenu.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/WidgetMenu.cpp 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/smartwin/source/widgets/WidgetMenu.cpp 2008-02-08 17:19:21 UTC (rev 996) @@ -36,7 +36,7 @@ { MENUITEMINFO mi = { sizeof(MENUITEMINFO) }; - mi.fMask = MIIM_TYPE; + mi.fMask = MIIM_STRING; if ( ::GetMenuItemInfo( this->handle(), id, byPosition, & mi ) == 0 ) { xAssert( false, _T( "Error while trying to get MenuItemInfo in WidgetMenu::getText..." ) ); @@ -59,7 +59,7 @@ info.dwTypeData = (TCHAR*) text.c_str(); if ( ::SetMenuItemInfo( this->handle(), id, FALSE, & info ) == FALSE ) - throw xCeption( _T( "Couldn't set item info in setItemText()" ) ); + throw xCeption( _T( "Couldn't set item info in WidgetMenu::setText" ) ); } void WidgetMenuBase::addCommands(Widget* widget) { Modified: dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp 2008-02-08 17:19:21 UTC (rev 996) @@ -101,74 +101,58 @@ ::CheckMenuRadioItem( this->itsHandle, id, id, id, id ); } -bool WidgetMenuExtended::isItemEnabled( unsigned int id ) +UINT WidgetMenuExtended::getMenuState( UINT id, bool byPosition ) { - // init struct for item info - MENUITEMINFO info; - memset( & info, 0, sizeof( MENUITEMINFO ) ); - info.cbSize = sizeof( MENUITEMINFO ); + return ::GetMenuState(this->handle(), id, byPosition ? MF_BYPOSITION : MF_BYCOMMAND); +} - // set flag - info.fMask = MIIM_STATE; +bool WidgetMenuExtended::isChecked( UINT id, bool byPosition ) +{ + return (getMenuState(id, byPosition) & MF_CHECKED) == MF_CHECKED; +} - // get item info - if ( ::GetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == FALSE ) - throw xCeption( _T( "Couldn't get item info in isItemEnabled()" ) ); - - return ( info.fState & MFS_ENABLED ) == MFS_ENABLED; +bool WidgetMenuExtended::isEnabled( UINT id, bool byPosition ) +{ + return !(getMenuState(id, byPosition) & (MF_DISABLED | MF_GRAYED)); } -bool WidgetMenuExtended::isItemChecked( unsigned int id ) +bool WidgetMenuExtended::isPopup( UINT id, bool byPosition ) { - // init struct for item info - MENUITEMINFO info; - memset( & info, 0, sizeof( MENUITEMINFO ) ); - info.cbSize = sizeof( MENUITEMINFO ); + return (getMenuState(id, byPosition) & MF_POPUP) == MF_POPUP; +} - // set flag - info.fMask = MIIM_STATE; - - // get item info - if ( ::GetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == FALSE ) - throw xCeption( _T( "Couldn't get item info in isItemChecked()" ) ); - - return ( info.fState & MF_CHECKED ) == MF_CHECKED; +bool WidgetMenuExtended::isSeparator( UINT id, bool byPosition ) +{ + return (getMenuState(id, byPosition) & MF_SEPARATOR) == MF_SEPARATOR; } -SmartUtil::tstring WidgetMenuExtended::getItemText( unsigned int id ) +SmartUtil::tstring WidgetMenuExtended::getText( unsigned id, bool byPosition ) { - MENUITEMINFO info; - memset( & info, 0, sizeof( MENUITEMINFO ) ); - info.cbSize = sizeof( MENUITEMINFO ); + MENUITEMINFO mi = { sizeof(MENUITEMINFO) }; // set flag - info.fMask = MIIM_STRING; + mi.fMask = MIIM_STRING; - if ( ::GetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == FALSE ) - throw xCeption( _T( "Couldn't get item info in getItemText()" ) ); + if ( ::GetMenuItemInfo( this->itsHandle, id, byPosition, & mi ) == FALSE ) + throw xCeption( _T( "Couldn't get item info in WidgetMenuExtended::getText" ) ); - boost::scoped_array< TCHAR > buffer( new TCHAR[++info.cch] ); - info.dwTypeData = buffer.get(); - - if ( ::GetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == FALSE ) - throw xCeption( _T( "Couldn't get item info in getItemText()" ) ); - - SmartUtil::tstring retVal = info.dwTypeData; - return retVal; + boost::scoped_array< TCHAR > buffer( new TCHAR[++mi.cch] ); + mi.dwTypeData = buffer.get(); + if ( ::GetMenuItemInfo( this->itsHandle, id, byPosition, & mi ) == FALSE ) + throw xCeption( _T( "Couldn't get item info in WidgetMenuExtended::getText" ) ); + return mi.dwTypeData; } -void WidgetMenuExtended::setItemText( unsigned int id, SmartUtil::tstring text ) +void WidgetMenuExtended::setText( unsigned id, const SmartUtil::tstring& text ) { - MENUITEMINFO info; - memset( & info, 0, sizeof( MENUITEMINFO ) ); - info.cbSize = sizeof( MENUITEMINFO ); + MENUITEMINFO mi = { sizeof(MENUITEMINFO) }; // set flag - info.fMask = MIIM_STRING; - info.dwTypeData = (TCHAR*) text.c_str(); + mi.fMask = MIIM_STRING; + mi.dwTypeData = (TCHAR*) text.c_str(); - if ( ::SetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == FALSE ) - throw xCeption( _T( "Couldn't set item info in setItemText()" ) ); + if ( ::SetMenuItemInfo( this->itsHandle, id, FALSE, & mi ) == FALSE ) + throw xCeption( _T( "Couldn't set item info in WidgetMenuExtended::setText" ) ); } void WidgetMenuExtended::setTitle( const SmartUtil::tstring & title, bool drawSidebar /* = false */) @@ -224,7 +208,6 @@ // setup colors MenuColorInfo colorInfo = this->itsColorInfo; COLORREF colorMenuBar = colorInfo.colorMenuBar; - COLORREF colorTitle = colorInfo.colorTitle; COLORREF colorMenuDraw = colorInfo.colorMenu; // color for drawing menu COLORREF colorFillHighlighted = ColorUtilities::lightenColor( colorInfo.colorHighlight, 0.7 ); @@ -351,7 +334,7 @@ Rectangle textRectangle( 0, 0, sidebarWidth, rect.bottom - rect.top ); // draw background - Brush brush ( colorInfo.colorTitle ); + Brush brush ( colorInfo.colorMenuBar ); canvas.fillRectangle( textRectangle, brush ); // draw title @@ -372,7 +355,7 @@ // set item background if ( wrapper->isMenuTitleItem ) // for title { - Brush brush ( colorTitle ); + Brush brush ( colorMenuBar ); canvas.fillRectangle( itemRectangle, brush ); // draw raised border @@ -859,9 +842,20 @@ return retVal; } +WidgetMenuExtended::ObjectType WidgetMenuExtended::getChild( unsigned position ) { + HMENU h = ::GetSubMenu(handle(), position); + for(size_t i = 0; i < this->itsChildren.size(); ++i) { + ObjectType& menu = this->itsChildren[i]; + if(menu->handle() == h) { + return menu; + } + } + return ObjectType(); +} + WidgetMenuExtended::WidgetMenuExtended( SmartWin::Widget* parent ) : isSysMenu( false ), -itsTitleFont( new Font( _T( "Tahoma" ), 20, 10 ) ), +itsTitleFont( new Font( DefaultGuiFont ) ), drawSidebar( false ), itsChildrenRef( WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform >::itsChildren ), itsItemDataRef( WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform >::itsItemData ) Modified: dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp 2008-02-08 17:19:21 UTC (rev 996) @@ -184,10 +184,7 @@ } SmartUtil::tstring WidgetTabView::formatTitle(SmartUtil::tstring title) { - if(title.length() > MAX_TITLE_LENGTH) { - title = title.substr(0, MAX_TITLE_LENGTH - 3) + _T("..."); - } - return SmartUtil::escapeMenu(title); + return SmartUtil::escapeMenu(SmartUtil::cutText(title, MAX_TITLE_LENGTH)); } bool WidgetTabView::handleSized(const WidgetSizedEventResult& sz) { Modified: dcplusplus/trunk/win32/DCPlusPlus.rc =================================================================== --- dcplusplus/trunk/win32/DCPlusPlus.rc 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/win32/DCPlusPlus.rc 2008-02-08 17:19:21 UTC (rev 996) @@ -31,13 +31,16 @@ IDB_ADL_SEARCH BITMAP "res/menu/ADLSearch.bmp" IDB_ARROWS BITMAP "res/arrows.bmp" +IDB_DCPP BITMAP "res/menu/DCPlusPlus.bmp" IDB_DL_QUEUE BITMAP "res/menu/DLQueue.bmp" +IDB_EXIT BITMAP "res/menu/Exit.bmp" IDB_FAVORITE_HUBS BITMAP "res/menu/FavoriteHubs.bmp" IDB_FAVORITE_USERS BITMAP "res/menu/FavoriteUsers.bmp" IDB_FINISHED_DL BITMAP "res/menu/FinishedDL.bmp" IDB_FINISHED_UL BITMAP "res/menu/FinishedUL.bmp" IDB_FOLDERS BITMAP "res/folders.bmp" IDB_FOLLOW BITMAP "res/menu/Follow.bmp" +IDB_HUB BITMAP "res/menu/Hub.bmp" IDB_NETWORK_STATS BITMAP "res/menu/NetworkStats.bmp" IDB_NOTEPAD BITMAP "res/menu/Notepad.bmp" IDB_OPEN_FILE_LIST BITMAP "res/menu/OpenFileList.bmp" Modified: dcplusplus/trunk/win32/HubFrame.cpp =================================================================== --- dcplusplus/trunk/win32/HubFrame.cpp 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/win32/HubFrame.cpp 2008-02-08 17:19:21 UTC (rev 996) @@ -1170,18 +1170,23 @@ } bool HubFrame::handleTabContextMenu(const SmartWin::ScreenCoordinate& pt) { - WidgetMenuPtr menu = createMenu(true); + WidgetMenuExtended::Seed cs; + cs.popup = true; + cs.colorInfo.colorImageBackground = RGB(255, 0, 255); // DC++ bitmaps use RGB(255, 0, 255) as their background (transparent) color + WidgetMenuExtendedPtr menu = createExtendedMenu(cs); + menu->setTitle(SmartUtil::cutText(getText(), SmartWin::WidgetTabView::MAX_TITLE_LENGTH)); + if(!FavoriteManager::getInstance()->isFavoriteHub(url)) { - menu->appendItem(IDC_ADD_TO_FAVORITES, T_("Add To &Favorites"), std::tr1::bind(&HubFrame::addAsFavorite, this)); + menu->appendItem(IDC_ADD_TO_FAVORITES, T_("Add To &Favorites"), std::tr1::bind(&HubFrame::addAsFavorite, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FAVORITE_HUBS))); } - menu->appendItem(IDC_RECONNECT, T_("&Reconnect\tCtrl+R"), std::tr1::bind(&HubFrame::handleReconnect, this)); + menu->appendItem(IDC_RECONNECT, T_("&Reconnect\tCtrl+R"), std::tr1::bind(&HubFrame::handleReconnect, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_RECONNECT))); menu->appendItem(IDC_COPY_HUB, T_("Copy &address to clipboard"), std::tr1::bind(&HubFrame::handleCopyHub, this)); prepareMenu(menu, UserCommand::CONTEXT_HUB, url); menu->appendSeparatorItem(); - menu->appendItem(IDC_CLOSE_WINDOW, T_("&Close"), std::tr1::bind(&HubFrame::close, this, true)); + menu->appendItem(IDC_CLOSE_WINDOW, T_("&Close"), std::tr1::bind(&HubFrame::close, this, true), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_EXIT))); inTabMenu = true; Modified: dcplusplus/trunk/win32/MDIChildFrame.h =================================================================== --- dcplusplus/trunk/win32/MDIChildFrame.h 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/win32/MDIChildFrame.h 2008-02-08 17:19:21 UTC (rev 996) @@ -186,11 +186,13 @@ } bool handleContextMenu(const SmartWin::ScreenCoordinate& pt) { - SmartWin::WidgetMenu::ObjectType menu = SmartWin::WidgetCreator<SmartWin::WidgetMenu>::create(SmartWin::WidgetMenu::Seed(true)); - menu->appendItem(IDC_CLOSE_WINDOW, T_("&Close"), std::tr1::bind(&ThisType::close, this, true)); - + WidgetMenuExtended::Seed cs; + cs.popup = true; + cs.colorInfo.colorImageBackground = RGB(255, 0, 255); // DC++ bitmaps use RGB(255, 0, 255) as their background (transparent) color + SmartWin::WidgetMenuExtended::ObjectType menu = createExtendedMenu(cs); + menu->setTitle(SmartUtil::cutText(getText(), SmartWin::WidgetTabView::MAX_TITLE_LENGTH)); + menu->appendItem(IDC_CLOSE_WINDOW, T_("&Close"), std::tr1::bind(&ThisType::close, this, true), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_EXIT))); menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); - return true; } Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-02-08 17:19:21 UTC (rev 996) @@ -186,7 +186,7 @@ { WidgetMenuExtendedPtr file = mainMenu->appendPopup(T_("&File")); - file->appendItem(IDC_QUICK_CONNECT, T_("&Quick Connect ...\tCtrl+Q"), std::tr1::bind(&MainWindow::handleQuickConnect, this)); + file->appendItem(IDC_QUICK_CONNECT, T_("&Quick Connect ...\tCtrl+Q"), std::tr1::bind(&MainWindow::handleQuickConnect, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_HUB))); file->appendItem(IDC_FOLLOW, T_("Follow last redirec&t\tCtrl+T"), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FOLLOW))); file->appendItem(IDC_RECONNECT, T_("&Reconnect\tCtrl+R"), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_RECONNECT))); file->appendSeparatorItem(); @@ -200,7 +200,7 @@ file->appendItem(IDC_SETTINGS, T_("Settings..."), std::tr1::bind(&MainWindow::handleSettings, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_SETTINGS))); file->appendSeparatorItem(); - file->appendItem(IDC_EXIT, T_("E&xit"), std::tr1::bind(&MainWindow::handleExit, this)); + file->appendItem(IDC_EXIT, T_("E&xit"), std::tr1::bind(&MainWindow::handleExit, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_EXIT))); } { @@ -241,7 +241,7 @@ help->appendItem(IDC_HELP_CONTENTS, T_("Help &Contents\tF1"), std::tr1::bind(&MainWindow::handleMenuHelp, this, _1)); help->appendSeparatorItem(); help->appendItem(IDC_HELP_CHANGELOG, T_("Change Log"), std::tr1::bind(&MainWindow::handleMenuHelp, this, _1)); - help->appendItem(IDC_ABOUT, T_("About DC++..."), std::tr1::bind(&MainWindow::handleAbout, this)); + help->appendItem(IDC_ABOUT, T_("About DC++..."), std::tr1::bind(&MainWindow::handleAbout, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_DCPP))); help->appendSeparatorItem(); help->appendItem(IDC_HELP_HOMEPAGE, T_("DC++ Homepage"), std::tr1::bind(&MainWindow::handleLink, this, _1)); help->appendItem(IDC_HELP_DOWNLOADS, T_("Downloads"), std::tr1::bind(&MainWindow::handleLink, this, _1)); Modified: dcplusplus/trunk/win32/PrivateFrame.cpp =================================================================== --- dcplusplus/trunk/win32/PrivateFrame.cpp 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/win32/PrivateFrame.cpp 2008-02-08 17:19:21 UTC (rev 996) @@ -360,20 +360,25 @@ } bool PrivateFrame::handleTabContextMenu(const SmartWin::ScreenCoordinate& pt) { - WidgetMenuPtr menu = createMenu(true); + WidgetMenuExtended::Seed cs; + cs.popup = true; + cs.colorInfo.colorImageBackground = RGB(255, 0, 255); // DC++ bitmaps use RGB(255, 0, 255) as their background (transparent) color + WidgetMenuExtendedPtr menu = createExtendedMenu(cs); + + menu->setTitle(SmartUtil::cutText(getText(), SmartWin::WidgetTabView::MAX_TITLE_LENGTH)); menu->appendItem(IDC_GETLIST, T_("&Get file list"), std::tr1::bind(&PrivateFrame::handleGetList, this)); menu->appendItem(IDC_MATCH_QUEUE, T_("&Match queue"), std::tr1::bind(&PrivateFrame::handleMatchQueue, this)); menu->appendItem(IDC_GRANTSLOT, T_("Grant &extra slot"), std::tr1::bind(&UploadManager::reserveSlot, UploadManager::getInstance(), replyTo)); if(!FavoriteManager::getInstance()->isFavoriteUser(replyTo)) - menu->appendItem(IDC_ADD_TO_FAVORITES, T_("Add To &Favorites"), std::tr1::bind(&FavoriteManager::addFavoriteUser, FavoriteManager::getInstance(), replyTo)); + menu->appendItem(IDC_ADD_TO_FAVORITES, T_("Add To &Favorites"), std::tr1::bind(&FavoriteManager::addFavoriteUser, FavoriteManager::getInstance(), replyTo), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FAVORITE_USERS))); prepareMenu(menu, UserCommand::CONTEXT_CHAT, ClientManager::getInstance()->getHubs(replyTo->getCID())); menu->appendSeparatorItem(); - menu->appendItem(IDC_CLOSE_WINDOW, T_("&Close"), std::tr1::bind(&PrivateFrame::close, this, true)); + menu->appendItem(IDC_CLOSE_WINDOW, T_("&Close"), std::tr1::bind(&PrivateFrame::close, this, true), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_EXIT))); menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); - return TRUE; + return true; } void PrivateFrame::runUserCommand(const UserCommand& uc) { Modified: dcplusplus/trunk/win32/resource.h =================================================================== --- dcplusplus/trunk/win32/resource.h 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/win32/resource.h 2008-02-08 17:19:21 UTC (rev 996) @@ -42,6 +42,9 @@ #define IDB_TOOLBAR20_HOT 168 #define IDB_USERS 169 #define IDB_WAITING_USERS 170 +#define IDB_EXIT 171 +#define IDB_HUB 172 +#define IDB_DCPP 173 #define IDD_ABOUTBOX 200 #define IDD_ADLS_PROPERTIES 201 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |