From: <arn...@us...> - 2008-04-14 21:19:05
|
Revision: 1165 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1165&view=rev Author: arnetheduck Date: 2008-04-14 14:18:55 -0700 (Mon, 14 Apr 2008) Log Message: ----------- Remove tabsheet, only keep tabview...tabview will get the possibility to add non-container tabs later Modified Paths: -------------- dcplusplus/trunk/dwt/include/dwt/aspects/AspectSizable.h dcplusplus/trunk/dwt/include/dwt/dwt.hpp dcplusplus/trunk/dwt/include/dwt/forward.h dcplusplus/trunk/dwt/include/dwt/widgets/Composite.h dcplusplus/trunk/dwt/include/dwt/widgets/TabView.h dcplusplus/trunk/dwt/src/widgets/TabView.cpp dcplusplus/trunk/win32/MDIChildFrame.h dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/TransferView.cpp dcplusplus/trunk/win32/TransferView.h dcplusplus/trunk/win32/stdafx.h Removed Paths: ------------- dcplusplus/trunk/dwt/include/dwt/widgets/TabSheet.h dcplusplus/trunk/dwt/src/widgets/TabSheet.cpp Property Changed: ---------------- dcplusplus/trunk/ Property changes on: dcplusplus/trunk ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2008-04-13 11:54:35.562000036 +0200 committer: Jacek Sieka <arn...@gm...> properties: branch-nick: dcplusplus + timestamp: 2008-04-13 15:39:27.368000031 +0200 committer: Jacek Sieka <arn...@gm...> properties: branch-nick: dcplusplus 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 1136 arn...@gm...-20080411214746-r420xmdgo35pkweb 1137 po...@12...-20080412010723-cibh8r0itlzqyt3f 1138 arn...@gm...-20080412200504-6qfeqnsghxgrk775 1139 arn...@gm...-20080413095435-2pkfb407hk8j54te + 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 1137 po...@12...-20080412010723-cibh8r0itlzqyt3f 1138 arn...@gm...-20080412200504-6qfeqnsghxgrk775 1139 arn...@gm...-20080413095435-2pkfb407hk8j54te 1140 arn...@gm...-20080413133927-zw2tpz8o8p3izyix Modified: dcplusplus/trunk/dwt/include/dwt/aspects/AspectSizable.h =================================================================== --- dcplusplus/trunk/dwt/include/dwt/aspects/AspectSizable.h 2008-04-14 21:17:47 UTC (rev 1164) +++ dcplusplus/trunk/dwt/include/dwt/aspects/AspectSizable.h 2008-04-14 21:18:55 UTC (rev 1165) @@ -70,8 +70,8 @@ HWND H() const { return W().handle(); } - typedef Dispatchers::ConvertBase<SizedEvent> SizeDispatcher; - typedef Dispatchers::ConvertBase<Point, &Point::fromMSG> MoveDispatcher; + typedef Dispatchers::ConvertBase<SizedEvent, &Dispatchers::convert<SizedEvent>, false> SizeDispatcher; + typedef Dispatchers::ConvertBase<Point, &Point::fromMSG, false> MoveDispatcher; public: /// Sets the new size and position of the window Modified: dcplusplus/trunk/dwt/include/dwt/dwt.hpp =================================================================== --- dcplusplus/trunk/dwt/include/dwt/dwt.hpp 2008-04-14 21:17:47 UTC (rev 1164) +++ dcplusplus/trunk/dwt/include/dwt/dwt.hpp 2008-04-14 21:18:55 UTC (rev 1165) @@ -78,7 +78,6 @@ #include "widgets/Spinner.h" #include "widgets/StatusBar.h" #include "widgets/Table.h" -#include "widgets/TabSheet.h" #include "widgets/TabView.h" #include "widgets/TextBox.h" #include "widgets/Tree.h" Modified: dcplusplus/trunk/dwt/include/dwt/forward.h =================================================================== --- dcplusplus/trunk/dwt/include/dwt/forward.h 2008-04-14 21:17:47 UTC (rev 1164) +++ dcplusplus/trunk/dwt/include/dwt/forward.h 2008-04-14 21:18:55 UTC (rev 1165) @@ -98,9 +98,6 @@ class Table; typedef Table* TablePtr; -class TabSheet; -typedef TabSheet* TabSheetPtr; - class TabView; typedef TabView* TabViewPtr; Modified: dcplusplus/trunk/dwt/include/dwt/widgets/Composite.h =================================================================== --- dcplusplus/trunk/dwt/include/dwt/widgets/Composite.h 2008-04-14 21:17:47 UTC (rev 1164) +++ dcplusplus/trunk/dwt/include/dwt/widgets/Composite.h 2008-04-14 21:18:55 UTC (rev 1165) @@ -101,8 +101,8 @@ typedef dwt::StatusBarPtr StatusBarPtr; typedef dwt::Table Table; typedef dwt::TablePtr TablePtr; - typedef dwt::TabSheet TabSheet; - typedef dwt::TabSheetPtr TabSheetPtr; + typedef dwt::TabView TabView; + typedef dwt::TabViewPtr TabViewPtr; typedef dwt::TextBox TextBox; typedef dwt::TextBoxPtr TextBoxPtr; typedef dwt::ToolBar ToolBar; Deleted: dcplusplus/trunk/dwt/include/dwt/widgets/TabSheet.h =================================================================== --- dcplusplus/trunk/dwt/include/dwt/widgets/TabSheet.h 2008-04-14 21:17:47 UTC (rev 1164) +++ dcplusplus/trunk/dwt/include/dwt/widgets/TabSheet.h 2008-04-14 21:18:55 UTC (rev 1165) @@ -1,388 +0,0 @@ -/* - DC++ Widget Toolkit - - Copyright (c) 2007-2008, Jacek Sieka - - SmartWin++ - - Copyright (c) 2005 Thomas Hansen - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the DWT nor SmartWin++ nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef DWT_TabSheet_h -#define DWT_TabSheet_h - -#include "../resources/ImageList.h" -#include "../Rectangle.h" -#include "../aspects/AspectCollection.h" -#include "../aspects/AspectFocus.h" -#include "../aspects/AspectFont.h" -#include "../aspects/AspectPainting.h" -#include "../aspects/AspectSelection.h" -#include "../aspects/AspectText.h" -#include "Control.h" - -namespace dwt { - -/// Tab Sheet Control class -/** \ingroup WidgetControls - * \WidgetUsageInfo - * \image html tabsheet.png - * Class for creating a Tab Control Widget. <br> - * A Tab Control is a control consisting of "tab buttons" normally on the top of the - * Widget where the user can select different pages to switch between to group - * related information within. E.g. Visual Studio has got tab controls on the top of - * the code area where the user can switch between the different opened files. Use - * the onSelectionChanged event to make visible/invisible the different controls you - * wish to use in the different tab pages! <br> - * Normally you would add up one Container for each Tab Page the Tab Control - * has. - */ -class TabSheet : - public CommonControl, - // Aspects - public AspectCollection<TabSheet, int>, - public AspectFocus< TabSheet >, - public AspectFont< TabSheet >, - public AspectPainting< TabSheet >, - public AspectSelection< TabSheet, int >, - public AspectText< TabSheet > -{ - typedef CommonControl BaseType; - friend class AspectCollection<TabSheet, int>; - friend class AspectSelection<TabSheet, int>; - friend class WidgetCreator< TabSheet >; - - struct ChangingDispatcher - { - typedef std::tr1::function<bool (unsigned)> F; - - ChangingDispatcher(const F& f_, TabSheet* widget_) : f(f_), widget(widget_) { } - - bool operator()(const MSG& msg, LRESULT& ret) { - unsigned param = TabCtrl_GetCurSel( widget->handle() ); - ret = f(param) ? FALSE : TRUE; - return true; - } - - F f; - TabSheet* widget; - }; - - -public: - /// Class type - typedef TabSheet ThisType; - - /// Object type - typedef ThisType* ObjectType; - - /// Seed class - /** This class contains all of the values needed to create the widget. It also - * knows the type of the class whose seed values it contains. Every widget - * should define one of these. - */ - struct Seed : public BaseType::Seed { - typedef ThisType WidgetType; - - FontPtr font; - - /// Fills with default parameters - explicit Seed(); - }; - - tstring getText(unsigned idx) const; - - void setText(unsigned idx, const tstring& text); - - /// Setting the event handler for the "selection changing" event - /** The event handler must have the signature "bool foo( TabSheet * Widget, - * unsigned indexNo )" whereby if you return true the user will be allowed to - * actually CHANGE the page but if you return false the page will not be allowed - * to change and the onSelectionChanged event will not fire ( good for - * validation of fields etc...) - */ - void onSelectionChanging(const ChangingDispatcher::F& f) { - addCallback( - Message( WM_NOTIFY, TCN_SELCHANGING ), ChangingDispatcher(f, this ) - ); - } - - /// Appends a "page" to the Tab Sheet - /** The return value is the index of the new item appended. The input index is - * where you wish to put the new page - */ - // the negative values are already covered by throwing an exception - unsigned int addPage( const tstring & header, unsigned index, LPARAM lParam = 0, int image = -1 ); - - int getImage(unsigned idx) const; - - HWND getToolTips() const; - - LPARAM getData(unsigned idx); - - void setData(unsigned idx, LPARAM data); - - /// Actually creates the Tab Sheet Control - /** You should call WidgetFactory::createTabSheet if you instantiate class - * directly. <br> - * Only if you DERIVE from class you should call this function directly. - */ - void create( const Seed & cs = Seed() ); - - /// Set tab buttons at bottom of control - /** If passed true to this function tabs will appear at the bottom of the control - */ - void setTabsAtBottom( bool value = true ); - - /// Set tabs to "button" style - /** If passed true to this function tabs will appear as buttons instead of - * default as pages - */ - void setButtonStyle( bool value = true ); - - /// Set tabs to "flat button" style - /** If passed true to this function tabs will appear as flat buttons instead of - * default as pages - */ - void setFlatButtonStyle( bool value = true ); - - /// Turns hot tracking of tabs on or off - /** If passed true hottracking of items will be turned on - */ - void setHotTrack( bool value = true ); - - /// Set tabs to "multiline" style - /** If passed true to this function tabs will be able to span across multiple - * lines - */ - void setMultiline( bool value = true ); - - /// Set tabs to "ragged right" style - /** If passed true to this function tabs be ragged to the right to make pages - * "span" across whole area if multiple lines are inserted - */ - void setRaggedRight( bool value = true ); - - /// Set tabs to appear vertically instead of horizontally which is the default style - /** If passed true to this function tabs will appear vertically instead of - * horizontally - */ - void setVerticalTabs( bool value = true ); - - /// Set tabs to appear vertically to the right - /** This one also turns on vertical style - */ - void setRightTabs( bool value = true ); - - void setHighlight(int item, bool highlight = true); - - /// Set tabs to appear with a flat separator between different tabs - /** If true passed flat separator style will be turned ON else OFF - */ - void setFlatSeparators( bool value = true ); - - void setImageList(const ImageListPtr& imageList); - - const ImageListPtr& getImageList() const; - - int hitTest(const ScreenCoordinate& pt); - - /// Get the area not used by the tabs - /** This function should be used after adding the pages, so that the area not used by - * the tabs can be calculated accurately. It returns coordinates respect to the - * TabControl, this is, you have to adjust for the position of the control itself. - */ - Rectangle getUsableArea(bool cutBorders = false) const; -protected: - // Constructor Taking pointer to parent - explicit TabSheet( Widget * parent ); - - // Protected to avoid direct instantiation, you can inherit and use - // WidgetFactory class which is friend - virtual ~TabSheet() - {} - -private: - // AspectSelection expectation implementation - static Message getSelectionChangedMessage(); - - // Keep a copy so it won't get deallocated... - ImageListPtr imageList; - - // AspectCollection - void eraseImpl( int row ); - void clearImpl(); - size_t sizeImpl() const; - - // AspectSelection - int getSelectedImpl() const; - void setSelectedImpl( int idx ); - -}; - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Implementation of class -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -inline Message TabSheet::getSelectionChangedMessage() { - return Message( WM_NOTIFY, TCN_SELCHANGE ); -} - -inline int TabSheet::getSelectedImpl() const { - return TabCtrl_GetCurSel( this->handle() ); -} - -inline int TabSheet::getImage(unsigned idx) const -{ - TCITEM item = { TCIF_IMAGE }; - if ( !TabCtrl_GetItem( this->handle(), idx, & item ) ) - { - throw xCeption( _T( "Couldn't get image of item." ) ); - } - return item.iImage; -} - -inline HWND TabSheet::getToolTips() const -{ - HWND wnd = TabCtrl_GetToolTips(this->handle()); - if(wnd == NULL) - { - throw xCeption( _T( "Couldn't get tooltips HWND." ) ); - } - return wnd; -} - -inline LPARAM TabSheet::getData(unsigned idx) -{ - TCITEM item = { TCIF_PARAM }; - if ( !TabCtrl_GetItem( this->handle(), idx, & item ) ) - { - throw xCeption( _T( "Couldn't get data of item." ) ); - } - return item.lParam; -} - -inline void TabSheet::setSelectedImpl( int idx ) { - TabCtrl_SetCurSel( this->handle(), idx ); -} - -inline void TabSheet::setText( unsigned index, const tstring& text ) -{ - TCITEM item = { TCIF_TEXT }; - item.pszText = const_cast < TCHAR * >( text.c_str() ); - TabCtrl_SetItem(this->handle(), index, &item); -} - -inline void TabSheet::setData( unsigned index, LPARAM lParam ) -{ - TCITEM item = { TCIF_PARAM }; - item.lParam = lParam; - TabCtrl_SetItem(this->handle(), index, &item); -} - -inline TabSheet::TabSheet( dwt::Widget * parent ) - : BaseType( parent ) -{ -} - -inline void TabSheet::setTabsAtBottom( bool value ) -{ - this->addRemoveStyle( TCS_BOTTOM, value ); -} - -inline void TabSheet::setButtonStyle( bool value ) -{ - this->addRemoveStyle( TCS_BUTTONS, value ); -} - -inline void TabSheet::setFlatButtonStyle( bool value ) -{ - this->addRemoveStyle( TCS_BUTTONS, value ); - this->addRemoveStyle( TCS_FLATBUTTONS, value ); -} - -inline void TabSheet::setHotTrack( bool value ) -{ - this->addRemoveStyle( TCS_HOTTRACK, value ); -} - -inline void TabSheet::setMultiline( bool value ) -{ - this->addRemoveStyle( TCS_MULTILINE, value ); -} - -inline void TabSheet::setRaggedRight( bool value ) -{ - this->addRemoveStyle( TCS_RAGGEDRIGHT, value ); -} - -inline void TabSheet::setVerticalTabs( bool value ) -{ - this->addRemoveStyle( TCS_VERTICAL, value ); -} - -inline void TabSheet::setRightTabs( bool value ) -{ - this->addRemoveStyle( TCS_VERTICAL | TCS_RIGHT, value ); -} - -inline void TabSheet::setFlatSeparators( bool value ) -{ - this->sendMessage( TCM_SETEXTENDEDSTYLE, TCS_EX_FLATSEPARATORS, value ); -} - -inline const ImageListPtr& TabSheet::getImageList() const -{ - return imageList; -} - -inline void TabSheet::setHighlight(int item, bool highlight) { - TabCtrl_HighlightItem(handle(), item, highlight); -} - -inline int TabSheet::hitTest(const ScreenCoordinate& pt) { - TCHITTESTINFO tci = { ClientCoordinate(pt, this).getPoint() }; - - return TabCtrl_HitTest(handle(), &tci); -} - -inline void TabSheet::eraseImpl(int i) { - TabCtrl_DeleteItem(this->handle(), i); -} - -inline void TabSheet::clearImpl() { - TabCtrl_DeleteAllItems(handle()); -} - -inline size_t TabSheet::sizeImpl() const { - return static_cast<size_t>(TabCtrl_GetItemCount(this->handle())); -} - -} - -#endif Modified: dcplusplus/trunk/dwt/include/dwt/widgets/TabView.h =================================================================== --- dcplusplus/trunk/dwt/include/dwt/widgets/TabView.h 2008-04-14 21:17:47 UTC (rev 1164) +++ dcplusplus/trunk/dwt/include/dwt/widgets/TabView.h 2008-04-14 21:18:55 UTC (rev 1165) @@ -32,11 +32,17 @@ #ifndef DWT_WIDGETTABVIEW_H_ #define DWT_WIDGETTABVIEW_H_ +#include "../resources/ImageList.h" +#include "../Rectangle.h" +#include "../aspects/AspectCollection.h" +#include "../aspects/AspectFocus.h" +#include "../aspects/AspectFont.h" +#include "../aspects/AspectPainting.h" +#include "../aspects/AspectSelection.h" +#include "../aspects/AspectText.h" #include "../WindowClass.h" -#include "../Policies.h" -#include "../aspects/AspectRaw.h" -#include "../aspects/AspectSizable.h" -#include "../aspects/AspectMouse.h" +#include "Control.h" + #include <list> #include <vector> @@ -45,12 +51,19 @@ * A container that keeps widgets in tabs and handles switching etc */ class TabView : - public MessageMap< Policies::Normal >, - - public AspectRaw<TabView>, - public AspectSizable<TabView> + public CommonControl, + // Aspects + private AspectCollection<TabView, int>, + public AspectFocus< TabView >, + public AspectFont< TabView >, + public AspectPainting< TabView >, + public AspectSelection< TabView, int >, + public AspectText< TabView > { - typedef MessageMap<Policies::Normal> BaseType; + typedef CommonControl BaseType; + friend class AspectCollection<TabView, int>; + friend class AspectSelection<TabView, int>; + friend class WidgetCreator< TabView >; typedef std::tr1::function<void (const tstring&)> TitleChangedFunction; typedef std::tr1::function<void (HWND, unsigned)> HelpFunction; typedef std::tr1::function<bool (const ScreenCoordinate&)> ContextMenuFunction; @@ -65,6 +78,8 @@ struct Seed : public BaseType::Seed { typedef ThisType WidgetType; + FontPtr font; + bool toggleActive; /// Fills with default parameters @@ -96,15 +111,11 @@ bool filter(const MSG& msg); - TabSheetPtr getTab(); - const Rectangle& getClientSize() const { return clientSize; } void create( const Seed & cs = Seed() ); protected: - friend class WidgetCreator<TabView>; - explicit TabView(Widget* parent); virtual ~TabView() { } @@ -120,7 +131,6 @@ static WindowClass windowClass; - TabSheetPtr tab; ToolTipPtr tip; TitleChangedFunction titleChangedFunction; @@ -134,6 +144,7 @@ typedef WindowList::iterator WindowIter; WindowList viewOrder; Rectangle clientSize; + ImageListPtr imageList; std::vector<IconPtr> icons; int active; ContainerPtr dragging; @@ -162,11 +173,58 @@ int addIcon(const IconPtr& icon); void swapWidgets(ContainerPtr oldW, ContainerPtr newW); + + tstring getText(unsigned idx) const; + + void setText(unsigned idx, const tstring& text); + + // AspectCollection + void eraseImpl( int row ); + void clearImpl(); + size_t sizeImpl() const; + + // AspectSelection + int getSelectedImpl() const; + void setSelectedImpl( int idx ); + // AspectSelection expectation implementation + static Message getSelectionChangedMessage(); + + const ImageListPtr& getImageList() const; + + int hitTest(const ScreenCoordinate& pt); + + /// Get the area not used by the tabs + /** This function should be used after adding the pages, so that the area not used by + * the tabs can be calculated accurately. It returns coordinates respect to the + * TabControl, this is, you have to adjust for the position of the control itself. + */ + Rectangle getUsableArea(bool cutBorders = false) const; + }; -inline TabSheetPtr TabView::getTab() { - return tab; +inline Message TabView::getSelectionChangedMessage() { + return Message( WM_NOTIFY, TCN_SELCHANGE ); } +inline void TabView::eraseImpl(int i) { + TabCtrl_DeleteItem(this->handle(), i); } + +inline void TabView::clearImpl() { + TabCtrl_DeleteAllItems(handle()); +} + +inline size_t TabView::sizeImpl() const { + return static_cast<size_t>(TabCtrl_GetItemCount(this->handle())); +} + +inline void TabView::setSelectedImpl( int idx ) { + TabCtrl_SetCurSel( this->handle(), idx ); +} + +inline int TabView::getSelectedImpl() const { + return TabCtrl_GetCurSel( this->handle() ); +} + +} #endif /*WIDGETTABVIEW_H_*/ Deleted: dcplusplus/trunk/dwt/src/widgets/TabSheet.cpp =================================================================== --- dcplusplus/trunk/dwt/src/widgets/TabSheet.cpp 2008-04-14 21:17:47 UTC (rev 1164) +++ dcplusplus/trunk/dwt/src/widgets/TabSheet.cpp 2008-04-14 21:18:55 UTC (rev 1165) @@ -1,106 +0,0 @@ -/* - DC++ Widget Toolkit - - Copyright (c) 2007-2008, Jacek Sieka - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the DWT nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include <dwt/widgets/TabSheet.h> - -namespace dwt { - -TabSheet::Seed::Seed() : - BaseType::Seed(WC_TABCONTROL, WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN), - font(new Font(DefaultGuiFont)) -{ -} - -void TabSheet::create( const Seed & cs ) -{ - BaseType::create(cs); - if(cs.font) - setFont( cs.font ); -} - -unsigned int TabSheet::addPage( const tstring & header, unsigned index, LPARAM data, int image ) -{ - TCITEM item; - item.mask = TCIF_TEXT | TCIF_PARAM; - item.pszText = const_cast < TCHAR * >( header.c_str() ); - item.lParam = data; - if(image != -1) { - item.mask |= TCIF_IMAGE; - item.iImage = image; - } - - int newIdx = TabCtrl_InsertItem( this->handle(), index, & item ); - if ( newIdx == - 1 ) - { - xCeption x( _T( "Error while trying to add page into Tab Sheet" ) ); - throw x; - } - return ( unsigned int ) newIdx; -} - -dwt::Rectangle TabSheet::getUsableArea(bool cutBorders) const -{ - RECT rc; - ::GetWindowRect(handle(), &rc); - ::MapWindowPoints(NULL, getParent()->handle(), (LPPOINT)&rc, 2); - TabCtrl_AdjustRect( this->handle(), false, &rc ); - Rectangle rect( rc ); - if(cutBorders) { - Rectangle rctabs(getClientAreaSize()); - // Get rid of ugly border...assume y border is the same as x border - long border = (rctabs.width() - rect.width()) / 2; - rect.pos.x = rctabs.x(); - rect.size.x = rctabs.width(); - rect.size.y += border; - } - return rect; -} - -void TabSheet::setImageList(const ImageListPtr& imageList_) -{ - imageList = imageList_; - TabCtrl_SetImageList(handle(), imageList->handle()); -} - -tstring TabSheet::getText(unsigned idx) const -{ - TCITEM item = { TCIF_TEXT }; - TCHAR buffer[200]; - item.cchTextMax = 198; - item.pszText = buffer; - if ( !TabCtrl_GetItem( this->handle(), idx, & item ) ) - { - throw xCeption( _T( "Couldn't retrieve text in TabSheet::getText." ) ); - } - return buffer; -} - -} Modified: dcplusplus/trunk/dwt/src/widgets/TabView.cpp =================================================================== --- dcplusplus/trunk/dwt/src/widgets/TabView.cpp 2008-04-14 21:17:47 UTC (rev 1164) +++ dcplusplus/trunk/dwt/src/widgets/TabView.cpp 2008-04-14 21:18:55 UTC (rev 1165) @@ -33,7 +33,6 @@ #include <dwt/widgets/Container.h> #include <dwt/widgets/ToolTip.h> -#include <dwt/widgets/TabSheet.h> #include <dwt/WidgetCreator.h> #include <dwt/util/StringUtils.h> @@ -42,14 +41,68 @@ WindowClass TabView::windowClass(_T("TabView"), &TabView::wndProc, NULL, ( HBRUSH )( COLOR_WINDOW + 1 )); TabView::Seed::Seed(bool toggleActive_) : - BaseType::Seed(windowClass.getClassName(), WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE), + BaseType::Seed(WC_TABCONTROL, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE | + TCS_HOTTRACK | TCS_MULTILINE | TCS_RAGGEDRIGHT | TCS_TOOLTIPS | TCS_FOCUSNEVER), + font(new Font(DefaultGuiFont)), toggleActive(toggleActive_) { + // Flicker bugfix, as described in SWT: + /* + * Feature in Windows. The tab control window class + * uses the CS_HREDRAW and CS_VREDRAW style bits to + * force a full redraw of the control and all children + * when resized. This causes flashing. The fix is to + * register a new window class without these bits and + * implement special code that damages only the exposed + * area. + * + * NOTE: Screen readers look for the exact class name + * of the control in order to provide the correct kind + * of assistance. Therefore, it is critical that the + * new window class have the same name. It is possible + * to register a local window class with the same name + * as a global class. Since bits that affect the class + * are being changed, it is possible that other native + * code, other than SWT, could create a control with + * this class name, and fail unexpectedly. + */ + + static bool first = true; + if(first) { + // From SWT: + /* + * Feature in Windows. The tab control window class + * uses the CS_HREDRAW and CS_VREDRAW style bits to + * force a full redraw of the control and all children + * when resized. This causes flashing. The fix is to + * register a new window class without these bits and + * implement special code that damages only the exposed + * area. + * + * NOTE: Screen readers look for the exact class name + * of the control in order to provide the correct kind + * of assistance. Therefore, it is critical that the + * new window class have the same name. It is possible + * to register a local window class with the same name + * as a global class. Since bits that affect the class + * are being changed, it is possible that other native + * code, other than SWT, could create a control with + * this class name, and fail unexpectedly. + */ + WNDCLASSEX cls = { sizeof(WNDCLASSEX) }; + ::GetClassInfoEx(NULL, WC_TABCONTROL, &cls); + + cls.lpszClassName = WC_TABCONTROL; + cls.hInstance = ::GetModuleHandle(NULL); + cls.style &= ~(CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS); + + ::RegisterClassEx(&cls); + first = false; + } } TabView::TabView(Widget* w) : BaseType(w), - tab(0), tip(0), toggleActive(false), inTab(false), @@ -61,32 +114,50 @@ PolicyType::create(cs); toggleActive = cs.toggleActive; - TabSheet::Seed tcs; - tcs.style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE | - TCS_HOTTRACK | TCS_MULTILINE | TCS_RAGGEDRIGHT | TCS_TOOLTIPS | TCS_FOCUSNEVER; - tab = WidgetCreator<TabSheet>::create(this, tcs); - tab->setImageList(ImageListPtr(new ImageList(16, 16, ILC_COLOR32 | ILC_MASK))); - tab->onSelectionChanged(std::tr1::bind(&TabView::handleTabSelected, this)); + if(cs.font) + setFont( cs.font ); + + imageList = new ImageList(16, 16, ILC_COLOR32 | ILC_MASK); + + TabCtrl_SetImageList(handle(), imageList->handle()); + + onSelectionChanged(std::tr1::bind(&TabView::handleTabSelected, this)); + onLeftMouseDown(std::tr1::bind(&TabView::handleLeftMouseDown, this, _1)); + onLeftMouseUp(std::tr1::bind(&TabView::handleLeftMouseUp, this, _1)); + onContextMenu(std::tr1::bind(&TabView::handleContextMenu, this, _1)); + onMiddleMouseDown(std::tr1::bind(&TabView::handleMiddleMouseDown, this, _1)); + onHelp(std::tr1::bind(&TabView::handleHelp, this, _1, _2)); + onSized(std::tr1::bind(&TabView::handleSized, this, _1)); - tab->onLeftMouseDown(std::tr1::bind(&TabView::handleLeftMouseDown, this, _1)); - tab->onLeftMouseUp(std::tr1::bind(&TabView::handleLeftMouseUp, this, _1)); - tab->onContextMenu(std::tr1::bind(&TabView::handleContextMenu, this, _1)); - tab->onMiddleMouseDown(std::tr1::bind(&TabView::handleMiddleMouseDown, this, _1)); - tab->onHelp(std::tr1::bind(&TabView::handleHelp, this, _1, _2)); - tip = WidgetCreator<ToolTip>::attach(this, tab->getToolTips()); // created and managed by the tab control thanks to the TCS_TOOLTIPS style - if(tip) { - tip->addRemoveStyle(TTS_NOPREFIX, true); - tip->onRaw(std::tr1::bind(&TabView::handleToolTip, this, _2), Message(WM_NOTIFY, TTN_GETDISPINFO)); - } + tip = WidgetCreator<ToolTip>::attach(this, TabCtrl_GetToolTips(handle())); // created and managed by the tab control thanks to the TCS_TOOLTIPS style + tip->addRemoveStyle(TTS_NOPREFIX, true); + tip->onRaw(std::tr1::bind(&TabView::handleToolTip, this, _2), Message(WM_NOTIFY, TTN_GETDISPINFO)); } void TabView::add(Container* w, const IconPtr& icon) { int image = addIcon(icon); - size_t tabs = tab->size(); + size_t tabs = size(); TabInfo* ti = new TabInfo(w); - tab->addPage(formatTitle(w->getText()), tabs, reinterpret_cast<LPARAM>(ti), image); + tstring title = formatTitle(w->getText()); + + TCITEM item = { 0 }; + item.mask = TCIF_TEXT | TCIF_PARAM; + item.pszText = const_cast < TCHAR * >( title.c_str() ); + item.lParam = reinterpret_cast<LPARAM>(ti); + if(image != -1) { + item.mask |= TCIF_IMAGE; + item.iImage = image; + } + + int newIdx = TabCtrl_InsertItem( handle(), tabs, &item ); + if ( newIdx == - 1 ) + { + xCeption x( _T( "Error while trying to add page into Tab Sheet" ) ); + throw x; + } + viewOrder.push_front(w); if(viewOrder.size() == 1 || w->hasStyle(WS_VISIBLE)) { @@ -104,7 +175,7 @@ } Container* TabView::getActive() { - TabInfo* ti = getTabInfo(tab->getSelected()); + TabInfo* ti = getTabInfo(getSelected()); return ti ? ti->w : 0; } @@ -113,7 +184,7 @@ setActive(*(--(--viewOrder.end()))); } - Container* cur = getTabInfo(tab->getSelected())->w; + Container* cur = getTabInfo(getSelected())->w; viewOrder.remove(w); @@ -123,7 +194,7 @@ int i = findTab(w); if(i != -1) { delete getTabInfo(i); - tab->erase(i); + erase(i); layout(); } active = findTab(cur); @@ -136,7 +207,7 @@ tstring TabView::getTabText(Container* w) { int i = findTab(w); if(i != -1) - return tab->getText(i); + return getText(i); return tstring(); } @@ -151,7 +222,7 @@ if(i == -1) return; - tab->setSelected(i); + setSelected(i); handleTabSelected(); } @@ -172,7 +243,7 @@ } void TabView::handleTabSelected() { - int i = tab->getSelected(); + int i = getSelected(); if(i == active) { return; } @@ -189,7 +260,8 @@ if(!inTab) setTop(ti->w); active = i; - tab->setHighlight(i, false); + + TabCtrl_HighlightItem(handle(), i, FALSE); if(titleChangedFunction) titleChangedFunction(ti->w->getText()); @@ -197,13 +269,13 @@ void TabView::mark(Container* w) { int i = findTab(w); - if(i != -1 && i != tab->getSelected()) { - tab->setHighlight(i, true); + if(i != -1 && i != getSelected()) { + TabCtrl_HighlightItem(handle(), i, TRUE); } } int TabView::findTab(Container* w) { - for(size_t i = 0; i < tab->size(); ++i) { + for(size_t i = 0; i < size(); ++i) { if(getTabInfo(i)->w == w) { return static_cast<int>(i); } @@ -216,13 +288,18 @@ } TabView::TabInfo* TabView::getTabInfo(int i) { - return i == -1 ? 0 : reinterpret_cast<TabInfo*>(tab->getData(i)); + if(i != -1) { + TCITEM item = { TCIF_PARAM }; + TabCtrl_GetItem(handle(), i, &item); + return reinterpret_cast<TabInfo*>(item.lParam); + } + return 0; } bool TabView::handleTextChanging(Container* w, const tstring& newText) { int i = findTab(w); if(i != -1) { - tab->setText(i, formatTitle(newText)); + setText(i, formatTitle(newText)); layout(); if((i == active) && titleChangedFunction) @@ -238,14 +315,15 @@ } void TabView::handleSized(const SizedEvent& sz) { - tab->setBounds(Rectangle(sz.size)); + // TODO the tab control itself has not seen the message yet so getUsableArea will return an invalid size if + // the number of rows changes for a multirow tab layout(); } void TabView::layout() { - Rectangle tmp = tab->getUsableArea(true); + Rectangle tmp = getUsableArea(true); if(!(tmp == clientSize)) { - int i = tab->getSelected(); + int i = getSelected(); if(i != -1) { getTabInfo(i)->w->setBounds(tmp); } @@ -312,7 +390,7 @@ if(image == -1) { image = icons.size(); icons.push_back(icon); - tab->getImageList()->add(*icon); + getImageList()->add(*icon); } } return image; @@ -329,13 +407,13 @@ } void TabView::handleLeftMouseDown(const MouseEvent& mouseEventResult) { - TabInfo* ti = getTabInfo(tab->hitTest(mouseEventResult.pos)); + TabInfo* ti = getTabInfo(hitTest(mouseEventResult.pos)); if(ti) { if(mouseEventResult.isShiftPressed) ti->w->close(); else { dragging = ti->w; - ::SetCapture(tab->handle()); + ::SetCapture(handle()); } } } @@ -350,11 +428,11 @@ if(dragPos == -1) return; - int dropPos = tab->hitTest(mouseEventResult.pos); + int dropPos = hitTest(mouseEventResult.pos); if(dropPos == -1) { // not in the tab control; move the tab to the end - dropPos = tab->size() - 1; + dropPos = size() - 1; } if(dropPos == dragPos) { @@ -368,14 +446,18 @@ } // save some information about the tab before we erase it - TabInfo* ti = getTabInfo(dragPos); - int image = tab->getImage(dragPos); + TCITEM item = { TCIF_TEXT | TCIF_PARAM | TCIF_IMAGE }; + TCHAR buf[1024] = { 0 }; + item.pszText = buf; + item.cchTextMax = (sizeof(buf) / sizeof(TCHAR)) - 1; + + TabCtrl_GetItem( this->handle(), dragPos, & item ); - tab->erase(dragPos); + erase(dragPos); - tab->addPage(formatTitle(ti->w->getText()), dropPos, reinterpret_cast<LPARAM>(ti), image); + TabCtrl_InsertItem(handle(), dropPos, &item); - active = tab->getSelected(); + active = getSelected(); layout(); } @@ -384,16 +466,16 @@ bool TabView::handleContextMenu(ScreenCoordinate pt) { TabInfo* ti = 0; if(pt.x() == -1 && pt.y() == -1) { - int i = tab->getSelected(); + int i = getSelected(); RECT rc; - if(i == -1 || !TabCtrl_GetItemRect(tab->handle(), i, &rc)) { + if(i == -1 || !TabCtrl_GetItemRect(handle(), i, &rc)) { return false; } pt = ScreenCoordinate(Point(rc.left, rc.top)); ti = getTabInfo(i); } else { - int i = tab->hitTest(pt); + int i = hitTest(pt); if(i == -1) { return false; } @@ -408,7 +490,7 @@ } void TabView::handleMiddleMouseDown(const MouseEvent& mouseEventResult) { - TabInfo* ti = getTabInfo(tab->hitTest(mouseEventResult.pos)); + TabInfo* ti = getTabInfo(hitTest(mouseEventResult.pos)); if(ti) ti->w->close(); } @@ -416,7 +498,7 @@ void TabView::handleHelp(HWND hWnd, unsigned id) { if(helpFunction) { // hWnd and id are those of the whole tab control; not those of the specific tab on which the user wants help for - TabInfo* ti = getTabInfo(tab->hitTest(ScreenCoordinate(Point::fromLParam(::GetMessagePos())))); + TabInfo* ti = getTabInfo(hitTest(ScreenCoordinate(Point::fromLParam(::GetMessagePos())))); if(ti) id = ti->w->getHelpId(); @@ -432,7 +514,7 @@ if(msg.message == WM_KEYUP && msg.wParam == VK_CONTROL) { inTab = false; - TabInfo* ti = getTabInfo(tab->getSelected()); + TabInfo* ti = getTabInfo(getSelected()); if(ti) { setTop(ti->w); } @@ -444,4 +526,51 @@ return false; } +void TabView::setText( unsigned index, const tstring& text ) +{ + TCITEM item = { TCIF_TEXT }; + item.pszText = const_cast < TCHAR * >( text.c_str() ); + TabCtrl_SetItem(this->handle(), index, &item); } + +tstring TabView::getText(unsigned idx) const +{ + TCITEM item = { TCIF_TEXT }; + TCHAR buffer[1024]; + item.cchTextMax = (sizeof(buffer) / sizeof(TCHAR)) - 1 ; + item.pszText = buffer; + if ( !TabCtrl_GetItem( this->handle(), idx, & item ) ) + { + throw xCeption( _T( "Couldn't retrieve text in TabView::getText." ) ); + } + return buffer; +} + +dwt::Rectangle TabView::getUsableArea(bool cutBorders) const +{ + RECT rc; + ::GetClientRect(handle(), &rc); + TabCtrl_AdjustRect( this->handle(), false, &rc ); + Rectangle rect( rc ); + if(cutBorders) { + Rectangle rctabs(getClientAreaSize()); + // Get rid of ugly border...assume y border is the same as x border + long border = (rctabs.width() - rect.width()) / 2; + rect.pos.x = rctabs.x(); + rect.size.x = rctabs.width(); + rect.size.y += border; + } + return rect; +} + +const ImageListPtr& TabView::getImageList() const { + return imageList; +} + +int TabView::hitTest(const ScreenCoordinate& pt) { + TCHITTESTINFO tci = { ClientCoordinate(pt, this).getPoint() }; + + return TabCtrl_HitTest(handle(), &tci); +} + +} Modified: dcplusplus/trunk/win32/MDIChildFrame.h =================================================================== --- dcplusplus/trunk/win32/MDIChildFrame.h 2008-04-14 21:17:47 UTC (rev 1164) +++ dcplusplus/trunk/win32/MDIChildFrame.h 2008-04-14 21:18:55 UTC (rev 1165) @@ -39,7 +39,7 @@ protected: MDIChildFrame(dwt::TabView* tabView, const tstring& title, unsigned helpId = 0, dwt::IconPtr icon = dwt::IconPtr(), bool activate = true) : - BaseType(tabView->getTab()), + BaseType(tabView), lastFocus(NULL), alwaysSameFocus(false), reallyClose(false) @@ -119,7 +119,7 @@ } dwt::TabView* getParent() { - return static_cast<dwt::TabView*>(BaseType::getParent()->getParent()); + return static_cast<dwt::TabView*>(BaseType::getParent()); } private: Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-04-14 21:17:47 UTC (rev 1164) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-04-14 21:18:55 UTC (rev 1165) @@ -756,7 +756,7 @@ MainWindow* mf = reinterpret_cast<MainWindow*>(p); HWND wnd, wnd2 = NULL; - while( (wnd=::GetWindow(mf->getTabView()->getTab()->handle(), GW_CHILD)) != NULL) { + while( (wnd=::GetWindow(mf->getTabView()->handle(), GW_CHILD)) != NULL) { if(wnd == wnd2) { ::Sleep(100); } else { Modified: dcplusplus/trunk/win32/TransferView.cpp =================================================================== --- dcplusplus/trunk/win32/TransferView.cpp 2008-04-14 21:17:47 UTC (rev 1164) +++ dcplusplus/trunk/win32/TransferView.cpp 2008-04-14 21:18:55 UTC (rev 1165) @@ -71,26 +71,25 @@ create(); { - TabSheet::Seed tcs; - tcs.style |= TCS_HOTTRACK | TCS_RAGGEDRIGHT | TCS_FOCUSNEVER; - tabs = addChild(tcs); - tabs->onSelectionChanged(std::tr1::bind(&TransferView::handleTabSelected, this)); - } - + TabView::Seed cs; + cs.location = getBounds(); + tabs = addChild(cs); + } + { Container::Seed cs; cs.caption = T_("Connections"); cs.background = (HBRUSH)(COLOR_3DFACE + 1); - cs.location = tabs->getUsableArea(true); + cs.location = tabs->getClientSize(); connectionsWindow = dwt::WidgetCreator<Container>::create(tabs, cs); connectionsWindow->setHelpId(IDH_CONNECTIONS); - tabs->addPage(T_("Connections"), 0); + tabs->add(connectionsWindow, dwt::IconPtr()); cs.style &= ~WS_VISIBLE; cs.caption = T_("Downloads"); downloadsWindow = dwt::WidgetCreator<Container>::create(tabs, cs); downloadsWindow->setHelpId(IDH_DOWNLOADS); - tabs->addPage(T_("Downloads"), 1); + tabs->add(downloadsWindow, dwt::IconPtr()); } { @@ -142,29 +141,13 @@ } -void TransferView::handleTabSelected() { - int i = tabs->getSelected(); - - if(i == 0) { - ::ShowWindow(downloadsWindow->handle(), SW_HIDE); - ::ShowWindow(connectionsWindow->handle(), SW_SHOW); - } else { - ::ShowWindow(connectionsWindow->handle(), SW_HIDE); - ::ShowWindow(downloadsWindow->handle(), SW_SHOW); - } -} - void TransferView::handleSized(const dwt::SizedEvent& sz) { layout(); } void TransferView::layout() { tabs->setBounds(dwt::Point(0,0), getClientAreaSize()); - dwt::Rectangle rect = tabs->getUsableArea(true); - - connectionsWindow->setBounds(rect); connections->setBounds(dwt::Rectangle(connectionsWindow->getClientAreaSize())); - downloadsWindow->setBounds(rect); downloads->setBounds(dwt::Rectangle(downloadsWindow->getClientAreaSize())); } Modified: dcplusplus/trunk/win32/TransferView.h =================================================================== --- dcplusplus/trunk/win32/TransferView.h 2008-04-14 21:17:47 UTC (rev 1164) +++ dcplusplus/trunk/win32/TransferView.h 2008-04-14 21:18:55 UTC (rev 1165) @@ -241,9 +241,9 @@ WidgetDownloadsPtr downloads; ContainerPtr downloadsWindow; - TabSheetPtr tabs; + TabViewPtr tabs; - dwt::TabView* mdi; + TabViewPtr mdi; dwt::ImageListPtr arrows; bool startup; @@ -262,7 +262,6 @@ void runUserCommand(const UserCommand& uc); bool handleKeyDown(int c); void handleDblClicked(); - void handleTabSelected(); MenuPtr makeContextMenu(ConnectionInfo* ii); Modified: dcplusplus/trunk/win32/stdafx.h =================================================================== --- dcplusplus/trunk/win32/stdafx.h 2008-04-14 21:17:47 UTC (rev 1164) +++ dcplusplus/trunk/win32/stdafx.h 2008-04-14 21:18:55 UTC (rev 1165) @@ -39,7 +39,6 @@ #include <dwt/widgets/ModelessDialog.h> #include <dwt/widgets/RadioButton.h> #include <dwt/widgets/Table.h> -#include <dwt/widgets/TabSheet.h> #include <dwt/widgets/TabView.h> #include <dwt/widgets/TextBox.h> #include <dwt/widgets/Tree.h> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |