linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #01671
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2191: add a tooltip on the close tab button
------------------------------------------------------------
revno: 2191
committer: poy <poy@xxxxxxxxxx>
branch nick: repo
timestamp: Sat 2010-08-07 15:27:45 +0200
message:
add a tooltip on the close tab button
modified:
changelog.txt
dwt/include/dwt/Texts.h
dwt/src/widgets/TabView.cpp
win32/dwt_Texts.cpp
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt 2010-08-06 21:02:04 +0000
+++ changelog.txt 2010-08-07 13:27:45 +0000
@@ -4,6 +4,7 @@
* Remove ADC empty token workaround targeting 0.698 (cologic)
* Enable Data Execution Prevention (cologic)
* Improved tabs, new settings (poy)
+* [L#571546] Add an "X" icon to close the active tab (poy)
-- 0.770 2010-07-05 --
* [L#550300] Catch more potential file corruptions (thanks bigmuscle)
=== modified file 'dwt/include/dwt/Texts.h'
--- dwt/include/dwt/Texts.h 2010-03-26 21:55:05 +0000
+++ dwt/include/dwt/Texts.h 2010-08-07 13:27:45 +0000
@@ -37,7 +37,8 @@
struct Texts {
/** Texts used by DWT that the calling application should define. */
enum Text {
- undo, cut, copy, paste, del, selAll // text-box menu commands
+ undo, cut, copy, paste, del, selAll, // text-box menu commands
+ close // tooltip for closing an owner-drawn tab
};
static tstring get(Text text);
=== modified file 'dwt/src/widgets/TabView.cpp'
--- dwt/src/widgets/TabView.cpp 2010-08-06 22:46:00 +0000
+++ dwt/src/widgets/TabView.cpp 2010-08-07 13:27:45 +0000
@@ -38,6 +38,7 @@
#include <dwt/DWTException.h>
#include <dwt/resources/Brush.h>
#include <dwt/dwt_vsstyle.h>
+#include <dwt/Texts.h>
#include <algorithm>
@@ -451,7 +452,7 @@
LPNMTTDISPINFO ttdi = reinterpret_cast<LPNMTTDISPINFO>(lParam);
TabInfo* ti = getTabInfo(ttdi->hdr.idFrom); // here idFrom corresponds to the index of the tab
if(ti) {
- tipText = ti->w->getText();
+ tipText = highlightClose ? Texts::get(Texts::close) : ti->w->getText();
ttdi->lpszText = const_cast<LPTSTR>(tipText.c_str());
}
return 0;
@@ -578,6 +579,8 @@
if(i != -1 && i == active) {
if(highlightClose ^ inCloseRect(mouseEvent.pos)) {
highlightClose = !highlightClose;
+ if(tip)
+ tip->refresh();
redraw(i);
}
}
@@ -662,8 +665,8 @@
}
if(isSelected && !hasStyle(TCS_BUTTONS)) {
- rect.pos.y += 2;
- rect.size.y -= 2;
+ rect.pos.y += 1;
+ rect.size.y -= 1;
}
const Point margin(4, 1);
@@ -699,6 +702,8 @@
if(isSelected) {
rect.pos.x = rect.right() + margin.x;
rect.size.x = 16;
+ if(16 < rect.size.y)
+ rect.pos.y += (rect.size.y - 16) / 2; // center the icon vertically
rect.size.y = 16;
UINT format = DFCS_CAPTIONCLOSE | DFCS_FLAT;
=== modified file 'win32/dwt_Texts.cpp'
--- win32/dwt_Texts.cpp 2010-03-26 21:55:05 +0000
+++ win32/dwt_Texts.cpp 2010-08-07 13:27:45 +0000
@@ -32,6 +32,7 @@
case paste: return T_("&Paste\tCtrl+V");
case del: return T_("&Delete\tDel");
case selAll: return T_("Select &All\tCtrl+A");
+ case close: return T_("Close");
}
assert(0);