From: <arn...@us...> - 2008-04-14 20:48:55
|
Revision: 1161 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1161&view=rev Author: arnetheduck Date: 2008-04-14 13:48:35 -0700 (Mon, 14 Apr 2008) Log Message: ----------- dump menuitemdata, it might be revived later on as a MenuItem which contains a bit more info Modified Paths: -------------- dcplusplus/trunk/dwt/include/dwt/widgets/Menu.h dcplusplus/trunk/dwt/src/widgets/Menu.cpp dcplusplus/trunk/win32/QueueFrame.cpp Property Changed: ---------------- dcplusplus/trunk/ Property changes on: dcplusplus/trunk ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2008-04-11 22:54:45.322000027 +0200 committer: Jacek Sieka <arn...@gm...> properties: branch-nick: dcplusplus + timestamp: 2008-04-11 23:47:46.262000084 +0200 committer: Jacek Sieka <arn...@gm...> properties: branch-nick: dcplusplus Name: bzr:file-ids - dwt/include/dwt/widgets/Menu.h 1003@f586c4b0-9d0d-0410-bc51-f1fe239209fc:dcplusplus%2Ftrunk:smartwin%2Finclude%2Fsmartwin%2Fwidgets%2FWidgetMenu.h dwt/src/widgets/Menu.cpp 1003@f586c4b0-9d0d-0410-bc51-f1fe239209fc:dcplusplus%2Ftrunk:smartwin%2Fsource%2Fwidgets%2FWidgetMenu.cpp + Name: bzr:revision-id:v3-trunk1 - 1027 arn...@gm...-20080323183926-schknwnkgeo7ivdn 1028 zouzou123gen-20080323220411-r8usuc3qxwuh7zsn 1029 zouzou123gen-20080323221249-0su72zaj13e706mk 1030 arn...@gm...-20080324140623-muba1dl46m000o8c 1031 zouzou123gen-20080324141933-qbgr93ugpe0297m6 1032 arn...@gm...-20080324153706-siidja05n84i00b1 1033 arn...@gm...-20080324153823-lhn3awurnu77riln 1034 arn...@gm...-20080324165650-zapppziji67yf5a2 1035 zouzou123gen-20080324175936-4mqc2kh0lo5wtdu2 1036 zouzou123gen-20080325004602-6wdsoym95mjuhwd3 1037 arn...@gm...-20080325100659-8fqy6q65itmghlep 1038 zouzou123gen-20080325175216-s297sdiucukfvijh 1039 arn...@gm...-20080325210137-3dfqyoi8ykosy087 1040 arn...@gm...-20080325211747-nwwy1eb33r071sca 1041 arn...@gm...-20080326084110-qbselrjckku275xi 1042 zouzou123gen-20080326123631-35642mgbk2i4ty32 1043 zouzou123gen-20080326124345-f4xwn2d3ty8ubd6r 1044 arn...@gm...-20080326162031-il0nyms30w0mky43 1045 arn...@gm...-20080326164801-8dru8mjc06xgzjpv 1046 arn...@gm...-20080326170438-uzl2rx8fqnohak7g 1047 zouzou123gen-20080326172821-d6uqcbmfb0c6rwlv 1048 arn...@gm...-20080326213257-qlgdh7m2712p2l0q 1049 arn...@gm...-20080326214313-ktnoekgk3s0wmatz 1050 arn...@gm...-20080326215256-0j1iqrf286b9g7zf 1051 arn...@gm...-20080327082121-hoi22wh1gwjdfbyd 1052 arn...@gm...-20080327120639-um3tukdt374rwvgm 1053 zouzou123gen-20080327130703-6vtek6uxy3vua543 1054 arn...@gm...-20080327215831-dmg5mkufskabwkro 1055 arn...@gm...-20080327231459-cdztcv25alsuyqmf 1056 arn...@gm...-20080328085925-gceybsr53oml1p24 1057 arn...@gm...-20080328200512-1sjuu6bcnl2dyd2a 1058 arn...@gm...-20080328210347-bussqjrm5mfswh7o 1059 arn...@gm...-20080329055630-braiir1dskv7a4qm 1060 arn...@gm...-20080329061558-rck8dz60wpj3c5ja 1061 arn...@gm...-20080329081253-if6o5jn329mbzfpl 1062 arn...@gm...-20080329081619-cb4x930j8sp55cs0 1063 arn...@gm...-20080329103216-hgjzo7ra2zixbztd 1064 arn...@gm...-20080329124042-q3aw4iodmo5kafyp 1065 arn...@gm...-20080329124926-2je1z18p0272zpua 1066 arn...@gm...-20080329150901-ehj9t32en7eps2dp 1067 zouzou123gen-20080329153653-36xlvpik2ns9r84r 1068 zouzou123gen-20080329162703-51xr8hg073pg7wq5 1069 zouzou123gen-20080329234706-8ddipdqu0xeudkql 1070 arn...@gm...-20080330081232-ubqr1171ewalrd4q 1071 zouzou123gen-20080330131607-yppbs3mgyjef1cux 1072 zouzou123gen-20080330134835-yv1nogy77ib1uehd 1073 zouzou123gen-20080331124549-alyw7vugdn30piqy 1074 zouzou123gen-20080331135108-q8frtqsin5bosfzm 1075 zouzou123gen-20080331140757-u94q52yccl5lsifk 1076 zouzou123gen-20080331152513-ue1x5qhigcw51348 1077 arn...@gm...-20080331184436-a8g6chibmg8nswls 1078 arn...@gm...-20080331220648-81485k28qmwruwz6 1079 zouzou123gen-20080401081001-2yjn07cf8s5sxr3a 1080 zouzou123gen-20080401081247-f3p4hdjojnd460jw 1081 zouzou123gen-20080401084117-24a454g8o0x656kg 1082 zouzou123gen-20080401133146-jabb5i8870fg6f66 1083 zouzou123gen-20080401154610-mxdqoo5bksru93e6 1084 arn...@gm...-20080401185530-lqj4tflt5ldmx46f 1085 arn...@gm...-20080401212616-ffl7m0xm8gt15knk 1086 arn...@gm...-20080402084515-ofmnwihzv159jton 1087 arn...@gm...-20080402133105-y70soi38owzl76i9 1088 arn...@gm...-20080402142417-rn2dbkx19wfz3vae 1089 arn...@gm...-20080402144459-u3z3hqvl8aqjc4a0 1090 zouzou123gen-20080402145051-zi8tmvy8u3r2mzu8 1091 arn...@gm...-20080402152137-f397uz1yp9qjvfwh 1092 zouzou123gen-20080402170355-29wda40wk3cy7lu5 1093 arn...@gm...-20080402180628-ipos9li0c4bsmq1h 1094 arn...@gm...-20080402181235-s2a6f4ww4lzayl46 1095 arn...@gm...-20080402193851-6mu64vgep6tijith 1096 arn...@gm...-20080402203810-86zpxsx69q83zf3r 1097 arn...@gm...-20080402204331-so2e8n892o23pejr 1098 poy-20080402224153-225qylr2cfwhqrg7 1099 mrmikejj-20080403125112-o8polh8rkn62umyh 1100 arn...@gm...-20080403125139-8xub76j1xazhfxna 1101 po...@12...-20080403140544-13kockkjho883nb4 1102 po...@12...-20080403143012-bxghtoodiolugpbs 1103 arn...@gm...-20080403190809-bbi4bz5rfcvjnt20 1104 arn...@gm...-20080403205410-czxru1vcg1s4wcws 1105 arn...@gm...-20080403213124-54spdrwszgyimd90 1106 po...@12...-20080404002406-aj74x5tngi6mmmj1 1107 arn...@gm...-20080404122415-mjy07qzbaxyhagra 1108 po...@12...-20080404145445-84lyk5tyy3b3br14 1109 po...@12...-20080404231417-v4v8x7u3f0hm0ejc 1110 po...@12...-20080405001107-14d1ojjof8xhvcj8 1111 arn...@gm...-20080405071929-jmnrul21sxx04kky 1112 arn...@gm...-20080405080105-9qbda7be0pi7y1ai 1113 po...@12...-20080405154555-yuj2n5kyndfjlpsf 1114 po...@12...-20080405220250-8y09d0samsj8ja94 1115 po...@12...-20080406134101-4860ytb61sbu3yhg 1116 po...@12...-20080406155849-2wzxzuzs5m8zpk0g 1117 po...@12...-20080406164835-bv5dydhm3qqydsty 1118 arn...@gm...-20080406210237-c7tyfgiz2sjgv044 1119 po...@12...-20080407114423-4yajg1rffidq76bj 1120 arn...@gm...-20080407194826-c42t4bjzw4vflejn 1121 po...@12...-20080407214303-o7ul1bvcn6gvaoc9 1122 po...@12...-20080407220647-r7f3em92til5j67s 1123 po...@12...-20080408212439-54t3bqlhvw1nu4xc 1124 arn...@gm...-20080409193708-y6erfzwrcb1seet3 1125 arn...@gm...-20080409195827-ub6t2s3wdf28nfpz 1126 po...@12...-20080409215055-1zmqhhm2859878c1 1127 arn...@gm...-20080410102447-l4es4cbukkqwcnpc 1128 arn...@gm...-20080410214118-b70g50tl27cq9q29 1129 arn...@gm...-20080411074730-w1pu78qigtx87lx3 1130 arn...@gm...-20080411090724-kwdj9pg9hrv1xhwb 1131 po...@12...-20080411153057-tn7zhxqk0z7ceref 1132 arn...@gm...-20080411200946-ierqlg8v9vzj18n2 1133 arn...@gm...-20080411201718-ecshulwd7ic0wdci 1134 arn...@gm...-20080411204047-jc9vzcsf32j38dvc 1135 arn...@gm...-20080411205445-ojuz2a29yq8ww37j + 1027 arn...@gm...-20080323183926-schknwnkgeo7ivdn 1028 zouzou123gen-20080323220411-r8usuc3qxwuh7zsn 1029 zouzou123gen-20080323221249-0su72zaj13e706mk 1030 arn...@gm...-20080324140623-muba1dl46m000o8c 1031 zouzou123gen-20080324141933-qbgr93ugpe0297m6 1032 arn...@gm...-20080324153706-siidja05n84i00b1 1033 arn...@gm...-20080324153823-lhn3awurnu77riln 1034 arn...@gm...-20080324165650-zapppziji67yf5a2 1035 zouzou123gen-20080324175936-4mqc2kh0lo5wtdu2 1036 zouzou123gen-20080325004602-6wdsoym95mjuhwd3 1037 arn...@gm...-20080325100659-8fqy6q65itmghlep 1038 zouzou123gen-20080325175216-s297sdiucukfvijh 1039 arn...@gm...-20080325210137-3dfqyoi8ykosy087 1040 arn...@gm...-20080325211747-nwwy1eb33r071sca 1041 arn...@gm...-20080326084110-qbselrjckku275xi 1042 zouzou123gen-20080326123631-35642mgbk2i4ty32 1043 zouzou123gen-20080326124345-f4xwn2d3ty8ubd6r 1044 arn...@gm...-20080326162031-il0nyms30w0mky43 1045 arn...@gm...-20080326164801-8dru8mjc06xgzjpv 1046 arn...@gm...-20080326170438-uzl2rx8fqnohak7g 1047 zouzou123gen-20080326172821-d6uqcbmfb0c6rwlv 1048 arn...@gm...-20080326213257-qlgdh7m2712p2l0q 1049 arn...@gm...-20080326214313-ktnoekgk3s0wmatz 1050 arn...@gm...-20080326215256-0j1iqrf286b9g7zf 1051 arn...@gm...-20080327082121-hoi22wh1gwjdfbyd 1052 arn...@gm...-20080327120639-um3tukdt374rwvgm 1053 zouzou123gen-20080327130703-6vtek6uxy3vua543 1054 arn...@gm...-20080327215831-dmg5mkufskabwkro 1055 arn...@gm...-20080327231459-cdztcv25alsuyqmf 1056 arn...@gm...-20080328085925-gceybsr53oml1p24 1057 arn...@gm...-20080328200512-1sjuu6bcnl2dyd2a 1058 arn...@gm...-20080328210347-bussqjrm5mfswh7o 1059 arn...@gm...-20080329055630-braiir1dskv7a4qm 1060 arn...@gm...-20080329061558-rck8dz60wpj3c5ja 1061 arn...@gm...-20080329081253-if6o5jn329mbzfpl 1062 arn...@gm...-20080329081619-cb4x930j8sp55cs0 1063 arn...@gm...-20080329103216-hgjzo7ra2zixbztd 1064 arn...@gm...-20080329124042-q3aw4iodmo5kafyp 1065 arn...@gm...-20080329124926-2je1z18p0272zpua 1066 arn...@gm...-20080329150901-ehj9t32en7eps2dp 1067 zouzou123gen-20080329153653-36xlvpik2ns9r84r 1068 zouzou123gen-20080329162703-51xr8hg073pg7wq5 1069 zouzou123gen-20080329234706-8ddipdqu0xeudkql 1070 arn...@gm...-20080330081232-ubqr1171ewalrd4q 1071 zouzou123gen-20080330131607-yppbs3mgyjef1cux 1072 zouzou123gen-20080330134835-yv1nogy77ib1uehd 1073 zouzou123gen-20080331124549-alyw7vugdn30piqy 1074 zouzou123gen-20080331135108-q8frtqsin5bosfzm 1075 zouzou123gen-20080331140757-u94q52yccl5lsifk 1076 zouzou123gen-20080331152513-ue1x5qhigcw51348 1077 arn...@gm...-20080331184436-a8g6chibmg8nswls 1078 arn...@gm...-20080331220648-81485k28qmwruwz6 1079 zouzou123gen-20080401081001-2yjn07cf8s5sxr3a 1080 zouzou123gen-20080401081247-f3p4hdjojnd460jw 1081 zouzou123gen-20080401084117-24a454g8o0x656kg 1082 zouzou123gen-20080401133146-jabb5i8870fg6f66 1083 zouzou123gen-20080401154610-mxdqoo5bksru93e6 1084 arn...@gm...-20080401185530-lqj4tflt5ldmx46f 1085 arn...@gm...-20080401212616-ffl7m0xm8gt15knk 1086 arn...@gm...-20080402084515-ofmnwihzv159jton 1087 arn...@gm...-20080402133105-y70soi38owzl76i9 1088 arn...@gm...-20080402142417-rn2dbkx19wfz3vae 1089 arn...@gm...-20080402144459-u3z3hqvl8aqjc4a0 1090 zouzou123gen-20080402145051-zi8tmvy8u3r2mzu8 1091 arn...@gm...-20080402152137-f397uz1yp9qjvfwh 1092 zouzou123gen-20080402170355-29wda40wk3cy7lu5 1093 arn...@gm...-20080402180628-ipos9li0c4bsmq1h 1094 arn...@gm...-20080402181235-s2a6f4ww4lzayl46 1095 arn...@gm...-20080402193851-6mu64vgep6tijith 1096 arn...@gm...-20080402203810-86zpxsx69q83zf3r 1097 arn...@gm...-20080402204331-so2e8n892o23pejr 1098 poy-20080402224153-225qylr2cfwhqrg7 1099 mrmikejj-20080403125112-o8polh8rkn62umyh 1100 arn...@gm...-20080403125139-8xub76j1xazhfxna 1101 po...@12...-20080403140544-13kockkjho883nb4 1102 po...@12...-20080403143012-bxghtoodiolugpbs 1103 arn...@gm...-20080403190809-bbi4bz5rfcvjnt20 1104 arn...@gm...-20080403205410-czxru1vcg1s4wcws 1105 arn...@gm...-20080403213124-54spdrwszgyimd90 1106 po...@12...-20080404002406-aj74x5tngi6mmmj1 1107 arn...@gm...-20080404122415-mjy07qzbaxyhagra 1108 po...@12...-20080404145445-84lyk5tyy3b3br14 1109 po...@12...-20080404231417-v4v8x7u3f0hm0ejc 1110 po...@12...-20080405001107-14d1ojjof8xhvcj8 1111 arn...@gm...-20080405071929-jmnrul21sxx04kky 1112 arn...@gm...-20080405080105-9qbda7be0pi7y1ai 1113 po...@12...-20080405154555-yuj2n5kyndfjlpsf 1114 po...@12...-20080405220250-8y09d0samsj8ja94 1115 po...@12...-20080406134101-4860ytb61sbu3yhg 1116 po...@12...-20080406155849-2wzxzuzs5m8zpk0g 1117 po...@12...-20080406164835-bv5dydhm3qqydsty 1118 arn...@gm...-20080406210237-c7tyfgiz2sjgv044 1119 po...@12...-20080407114423-4yajg1rffidq76bj 1120 arn...@gm...-20080407194826-c42t4bjzw4vflejn 1121 po...@12...-20080407214303-o7ul1bvcn6gvaoc9 1122 po...@12...-20080407220647-r7f3em92til5j67s 1123 po...@12...-20080408212439-54t3bqlhvw1nu4xc 1124 arn...@gm...-20080409193708-y6erfzwrcb1seet3 1125 arn...@gm...-20080409195827-ub6t2s3wdf28nfpz 1126 po...@12...-20080409215055-1zmqhhm2859878c1 1127 arn...@gm...-20080410102447-l4es4cbukkqwcnpc 1128 arn...@gm...-20080410214118-b70g50tl27cq9q29 1129 arn...@gm...-20080411074730-w1pu78qigtx87lx3 1130 arn...@gm...-20080411090724-kwdj9pg9hrv1xhwb 1131 po...@12...-20080411153057-tn7zhxqk0z7ceref 1132 arn...@gm...-20080411200946-ierqlg8v9vzj18n2 1133 arn...@gm...-20080411201718-ecshulwd7ic0wdci 1134 arn...@gm...-20080411204047-jc9vzcsf32j38dvc 1135 arn...@gm...-20080411205445-ojuz2a29yq8ww37j 1136 arn...@gm...-20080411214746-r420xmdgo35pkweb Modified: dcplusplus/trunk/dwt/include/dwt/widgets/Menu.h =================================================================== --- dcplusplus/trunk/dwt/include/dwt/widgets/Menu.h 2008-04-14 20:38:17 UTC (rev 1160) +++ dcplusplus/trunk/dwt/include/dwt/widgets/Menu.h 2008-04-14 20:48:35 UTC (rev 1161) @@ -48,32 +48,6 @@ namespace dwt { -/// Contains information about menu item -struct MenuItemData -{ - /// Menu item text color - COLORREF TextColor; - - /// Menu item image - BitmapPtr Image; - - /// Creates new menu item with specified data - MenuItemData( - BitmapPtr image = BitmapPtr( new Bitmap( ( HBITMAP ) NULL ) ), // defaults to empty bitmap - COLORREF textColor = ::GetSysColor( COLOR_MENUTEXT ) ) - : TextColor( textColor ), - Image( image ) - {} -}; - -/// \ingroup GlobalStuff -// MenuItemDataPtr type, contains rendering data for e.g. Menu -/** Helps easily create color values and so on for a Menu item! <br> -* Each Menu Item can have different colors and so on, use this smart pointer to set -* those values! -*/ -typedef std::tr1::shared_ptr< MenuItemData > MenuItemDataPtr; - /// Struct for coloring different areas of Menu /** Contains the different color settings of the Menu <br> * Default values to constructor makes menu look roughly like MSVC++7.1 menus @@ -230,7 +204,7 @@ * A popup is basically another branch in the menu hierarchy <br> * See the Menu project for a demonstration. */ - ObjectType appendPopup( const tstring & text, MenuItemDataPtr itemData = MenuItemDataPtr(new MenuItemData()) ); + ObjectType appendPopup( const tstring & text ); /// Returns the "System Menu" /** The system menu is a special menu that ( normally ) is accessed by pressing @@ -284,29 +258,16 @@ * defined for several menu items even in fact across menu objects, therefore * this number should be unique across the application. */ - void appendItem(unsigned int id, const tstring & text, MenuItemDataPtr itemData = MenuItemDataPtr(new MenuItemData())); + void appendItem(unsigned int id, const tstring & text, BitmapPtr image = BitmapPtr()); + template<typename DispatcherType> - void appendItem(unsigned int id, const tstring & text, const typename DispatcherType::F& f, MenuItemDataPtr itemData = MenuItemDataPtr(new MenuItemData())) { - appendItem(id, text, itemData); + void appendItem(unsigned int id, const tstring & text, const typename DispatcherType::F& f, BitmapPtr image = BitmapPtr()) { + appendItem(id, text, image); callbacks.insert(std::make_pair(id, DispatcherType(f))); } - void appendItem(unsigned int id, const tstring & text, const IdDispatcher::F& f, MenuItemDataPtr itemData = MenuItemDataPtr(new MenuItemData())) { - appendItem<IdDispatcher>(id, text, f, itemData); - } - - void appendItem(unsigned int id, const tstring & text, BitmapPtr image); - - template<typename DispatcherType> - void appendItem(unsigned int id, const tstring & text, const typename DispatcherType::F& f, BitmapPtr image) { - MenuItemDataPtr itemData(new MenuItemData()); - if(ownerDrawn) - itemData->Image = image; - appendItem<DispatcherType>(id, text, f, itemData); - } - - void appendItem(unsigned int id, const tstring & text, const IdDispatcher::F& f, BitmapPtr image) { + void appendItem(unsigned int id, const tstring & text, const IdDispatcher::F& f, BitmapPtr image = BitmapPtr()) { appendItem<IdDispatcher>(id, text, f, image); } @@ -420,9 +381,6 @@ */ void setText( unsigned id, const tstring& text ); - /// Returns item data - MenuItemDataPtr getData( int itemIndex ); - ObjectType getChild(UINT position); virtual ~Menu(); @@ -453,15 +411,19 @@ // Specifies if item is menu title bool isMenuTitleItem; - // Contains item data - MenuItemDataPtr data; + /// Menu item text color + COLORREF textColor; + /// Menu item image + BitmapPtr image; + // Wrapper Constructor - ItemDataWrapper( const Menu* menu_, int itemIndex, MenuItemDataPtr itemData, bool isTitleItem = false ) - : menu( menu_ ) - , index( itemIndex ) - , isMenuTitleItem( isTitleItem ) - , data( itemData ) + ItemDataWrapper( const Menu* menu_, int itemIndex, bool isTitleItem = false, BitmapPtr image_ = BitmapPtr()) : + menu( menu_ ), + index( itemIndex ), + isMenuTitleItem( isTitleItem ), + textColor(::GetSysColor(COLOR_MENUTEXT)), + image(image_) {} ~ItemDataWrapper() Modified: dcplusplus/trunk/dwt/src/widgets/Menu.cpp =================================================================== --- dcplusplus/trunk/dwt/src/widgets/Menu.cpp 2008-04-14 20:38:17 UTC (rev 1160) +++ dcplusplus/trunk/dwt/src/widgets/Menu.cpp 2008-04-14 20:48:35 UTC (rev 1161) @@ -115,9 +115,7 @@ const int count = getCount(); for(int i = 0; i < count; ++i) { // init structure for items - MENUITEMINFO info; - memset( & info, 0, sizeof( info ) ); - info.cbSize = sizeof( MENUITEMINFO ); + MENUITEMINFO info = { sizeof( MENUITEMINFO ) }; // set flags info.fMask = MIIM_FTYPE | MIIM_DATA; @@ -127,7 +125,7 @@ info.fType |= MFT_OWNERDRAW; // create item data wrapper - ItemDataWrapper * wrapper = new ItemDataWrapper( this, i, MenuItemDataPtr( new MenuItemData() ) ); + ItemDataWrapper * wrapper = new ItemDataWrapper( this, i ); info.dwItemData = reinterpret_cast< ULONG_PTR >( wrapper ); if(::SetMenuItemInfo(itsHandle, i, TRUE, &info)) @@ -146,16 +144,14 @@ throw xCeption( _T( "SetMenu in Menu::setMenu fizzled..." ) ); } -Menu::ObjectType Menu::appendPopup( const tstring & text, MenuItemDataPtr itemData ) +Menu::ObjectType Menu::appendPopup( const tstring & text ) { // create popup menu pointer ObjectType retVal ( new Menu(itsParent) ); retVal->create( Seed(ownerDrawn, itsColorInfo, font) ); // init structure for new item - MENUITEMINFO info; - memset( & info, 0, sizeof( info ) ); - info.cbSize = sizeof( MENUITEMINFO ); + MENUITEMINFO info = { sizeof( MENUITEMINFO ) }; // set flags info.fMask = MIIM_SUBMENU | MIIM_CHECKMARKS | MIIM_STRING; @@ -176,7 +172,7 @@ info.fType = MFT_OWNERDRAW; // create item data - wrapper = new ItemDataWrapper( this, position, itemData ); + wrapper = new ItemDataWrapper( this, position ); info.dwItemData = reinterpret_cast< ULONG_PTR >( wrapper ); } @@ -232,15 +228,6 @@ return - 1; } -MenuItemDataPtr Menu::getData( int itemIndex ) -{ - for(size_t i = 0; i < itsItemData.size(); ++i) - if(itsItemData[i]->index == itemIndex) - return itsItemData[i]->data; - - return MenuItemDataPtr(); -} - Menu::~Menu() { // Destroy this menu @@ -361,9 +348,7 @@ if ( !drawSidebar ) { // init struct for title info - MENUITEMINFO info; - memset( & info, 0, sizeof( MENUITEMINFO ) ); - info.cbSize = sizeof( MENUITEMINFO ); + MENUITEMINFO info = { sizeof( MENUITEMINFO ) }; // set flags info.fMask = MIIM_STATE | MIIM_STRING | MIIM_FTYPE | MIIM_DATA; @@ -374,7 +359,7 @@ info.dwTypeData = const_cast< LPTSTR >( title.c_str() ); // created info for title item - ItemDataWrapper * wrapper = new ItemDataWrapper( this, 0, MenuItemDataPtr( new MenuItemData() ), true ); + ItemDataWrapper * wrapper = new ItemDataWrapper( this, 0, true ); // set item data info.dwItemData = reinterpret_cast< ULONG_PTR >( wrapper ); @@ -405,9 +390,7 @@ const bool isMenuBar = ::GetMenu( wrapper->menu->getParent()->handle() ) == wrapper->menu->handle(); // init struct for menu item info - MENUITEMINFO info; - memset( & info, 0, sizeof( MENUITEMINFO ) ); - info.cbSize = sizeof( MENUITEMINFO ); + MENUITEMINFO info = { sizeof( MENUITEMINFO ) }; // set flags info.fMask = MIIM_CHECKMARKS | MIIM_FTYPE | MIIM_DATA | MIIM_STATE | MIIM_STRING; @@ -418,10 +401,6 @@ // check if item is owner drawn xAssert( ( info.fType & MFT_OWNERDRAW ) != 0, _T( "Not a owner - drawn item in drawItem()" ) ); - // get item data - MenuItemDataPtr data ( wrapper->data ); - xAssert( data != 0, _T( "Couldn't find item data in drawItem()" ) ); - // get state info bool isGrayed = ( drawInfo->itemState & ODS_GRAYED ) == ODS_GRAYED; bool isChecked = ( drawInfo->itemState & ODS_CHECKED ) == ODS_CHECKED; @@ -433,13 +412,18 @@ HBITMAP image = NULL; // if checked/unchecked image is avaiable - if ( ( info.hbmpChecked != NULL ) && ( info.hbmpUnchecked != NULL ) ) + if ( ( info.hbmpChecked != NULL ) && ( info.hbmpUnchecked != NULL ) ) { image = isChecked ? info.hbmpChecked : info.hbmpUnchecked; - else // get normal image - image = data->Image->getBitmap(); + } else if(wrapper->image) {// get normal image + image = wrapper->image->handle(); + } // this will contain image size - Point imageSize = data->Image->getBitmapSize(); + Point imageSize(0, 0); + if(wrapper->image) { + // TODO and if we use hbmpChecked etc? + imageSize = wrapper->image->getBitmapSize(); + } if ( ( imageSize.x == 0 ) && ( imageSize.y == 0 ) ) // no image imageSize = defaultImageSize; // set default image size @@ -597,7 +581,7 @@ isGrayed ? ::GetSysColor(COLOR_GRAYTEXT) : wrapper->isMenuTitleItem ? colorInfo.colorTitleText : highlight ? colorInfo.colorHighlightText : - data->TextColor + wrapper->textColor ); // Select item font @@ -734,9 +718,7 @@ UINT & itemHeight = measureInfo->itemHeight; // init struct for item info - MENUITEMINFO info; - memset( & info, 0, sizeof( MENUITEMINFO ) ); - info.cbSize = sizeof( MENUITEMINFO ); + MENUITEMINFO info = { sizeof( MENUITEMINFO ) }; // set up flags info.fMask = MIIM_FTYPE | MIIM_DATA | MIIM_CHECKMARKS | MIIM_STRING; @@ -763,10 +745,6 @@ // get its DC HDC hdc = ::GetDC( wrapper->menu->getParent()->handle() ); - // get the item data - MenuItemDataPtr data = wrapper->data; - xAssert( data != 0, _T( "Couldn't find item data in measureItem()" ) ); - // get item text const int length = info.cch + 1; std::vector< TCHAR > buffer ( length ); @@ -789,7 +767,7 @@ itemHeight = textSize.cy + borderGap; // check to see if item has an image - Point imageSize = data->Image->getBitmapSize(); + Point imageSize = wrapper->image ? wrapper->image->getBitmapSize() : Point(0, 0); // this will contain checked/unchecked image size Point checkImageSize; @@ -852,10 +830,9 @@ void Menu::appendSeparatorItem() { // init structure for new item - MENUITEMINFO itemInfo; - memset( & itemInfo, 0, sizeof( itemInfo ) ); - itemInfo.cbSize = sizeof( MENUITEMINFO ); + MENUITEMINFO itemInfo = { sizeof( MENUITEMINFO ) }; + // set flags itemInfo.fMask = MIIM_FTYPE; itemInfo.fType = MFT_SEPARATOR; @@ -869,7 +846,7 @@ itemInfo.fType |= MFT_OWNERDRAW; // create item data wrapper - wrapper = new ItemDataWrapper( this, position, MenuItemDataPtr( new MenuItemData() ) ); + wrapper = new ItemDataWrapper( this, position ); itemInfo.dwItemData = reinterpret_cast< ULONG_PTR >( wrapper ); } @@ -934,12 +911,10 @@ return count; } -void Menu::appendItem(unsigned int id, const tstring & text, MenuItemDataPtr itemData) +void Menu::appendItem(unsigned int id, const tstring & text, BitmapPtr image) { // init structure for new item - MENUITEMINFO info; - memset( & info, 0, sizeof( info ) ); - info.cbSize = sizeof( MENUITEMINFO ); + MENUITEMINFO info = { sizeof(MENUITEMINFO) }; // set flags info.fMask = MIIM_DATA | MIIM_FTYPE | MIIM_CHECKMARKS | MIIM_ID | MIIM_STRING; @@ -964,7 +939,7 @@ info.fType = MFT_OWNERDRAW; // set item data - wrapper = new ItemDataWrapper( this, index, itemData ); + wrapper = new ItemDataWrapper( this, index, false, image); info.dwItemData = reinterpret_cast< ULONG_PTR >( wrapper ); } @@ -978,14 +953,6 @@ throw xCeption( _T( "Couldn't insert/update item in Menu::appendItem" ) ); } -void Menu::appendItem(unsigned int id, const tstring & text, BitmapPtr image) -{ - MenuItemDataPtr itemData(new MenuItemData()); - if(ownerDrawn) - itemData->Image = image; - appendItem(id, text, itemData); -} - unsigned Menu::trackPopupMenu( const ScreenCoordinate& sc, unsigned flags ) { addCommands(); Modified: dcplusplus/trunk/win32/QueueFrame.cpp =================================================================== --- dcplusplus/trunk/win32/QueueFrame.cpp 2008-04-14 20:38:17 UTC (rev 1160) +++ dcplusplus/trunk/win32/QueueFrame.cpp 2008-04-14 20:48:35 UTC (rev 1161) @@ -911,8 +911,7 @@ // Put it here to avoid a copy for each recursion... static TCHAR tmpBuf[1024]; void QueueFrame::moveNode(HTREEITEM item, HTREEITEM parent) { - TVINSERTSTRUCT tvis; - memset(&tvis, 0, sizeof(tvis)); + TVINSERTSTRUCT tvis = { 0 }; tvis.itemex.hItem = item; tvis.itemex.mask = TVIF_CHILDREN | TVIF_HANDLE | TVIF_IMAGE | TVIF_INTEGRAL | TVIF_PARAM | TVIF_SELECTEDIMAGE | TVIF_STATE | TVIF_TEXT; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |