linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #01711
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2207: better close tab icon
------------------------------------------------------------
revno: 2207
committer: poy <poy@xxxxxxxxxx>
branch nick: repo
timestamp: Wed 2010-08-11 18:48:27 +0200
message:
better close tab icon
modified:
dwt/include/dwt/dwt_vsstyle.h
dwt/include/dwt/widgets/TabView.h
dwt/src/widgets/TabView.cpp
win32/MainWindow.cpp
win32/TabsPage.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 'dwt/include/dwt/dwt_vsstyle.h'
--- dwt/include/dwt/dwt_vsstyle.h 2010-08-10 16:58:48 +0000
+++ dwt/include/dwt/dwt_vsstyle.h 2010-08-11 16:48:27 +0000
@@ -61,12 +61,6 @@
#define TIS_HOT 2
#define TIS_SELECTED 3
-#define VSCLASS_WINDOW L"WINDOW"
-#define WP_CLOSEBUTTON 18
-#define CBS_NORMAL 1
-#define CBS_HOT 2
-#define CBS_PUSHED 3
-
#else
#include <vsstyle.h>
#endif
=== modified file 'dwt/include/dwt/widgets/TabView.h'
--- dwt/include/dwt/widgets/TabView.h 2010-08-11 15:40:28 +0000
+++ dwt/include/dwt/widgets/TabView.h 2010-08-11 16:48:27 +0000
@@ -86,6 +86,10 @@
that case, any value <= 3 means infinite). */
unsigned widthConfig;
+ /** 16x16 icon to draw the close button of owner-drawn tabs (that have the
+ TCS_OWNERDRAWFIXED style). if no icon is provided, a standard 'X' icon will be used. */
+ IconPtr closeIcon;
+
bool toggleActive; /// switch the active tab when clicking on the current active tab
bool ctrlTab; /// handle Ctrl+Tab and Ctrl+Shift+Tab
@@ -152,7 +156,6 @@
};
Theme theme;
- Theme windowTheme; // to draw the close button
ToolTipPtr tip;
TitleChangedFunction titleChangedFunction;
@@ -162,6 +165,7 @@
bool toggleActive;
FontPtr font;
FontPtr boldFont;
+ IconPtr closeIcon;
bool inTab;
int highlighted;
=== modified file 'dwt/src/widgets/TabView.cpp'
--- dwt/src/widgets/TabView.cpp 2010-08-11 15:40:28 +0000
+++ dwt/src/widgets/TabView.cpp 2010-08-11 16:48:27 +0000
@@ -101,13 +101,14 @@
lf.lfWeight = FW_BOLD;
boldFont = FontPtr(new Font(::CreateFontIndirect(&lf), true));
+ closeIcon = cs.closeIcon;
+
if(cs.tabStyle == Seed::WinBrowser && util::win32::ensureVersion(util::win32::VISTA)) {
theme.load(L"BrowserTab::" VSCLASS_TAB, this);
if(!theme)
theme.load(VSCLASS_TAB, this, false);
} else
theme.load(VSCLASS_TAB, this);
- windowTheme.load(VSCLASS_WINDOW, this);
if(!(cs.style & TCS_BUTTONS)) {
// we don't want pre-drawn borders to get in the way here, so we fully take over painting.
@@ -721,9 +722,17 @@
rect.pos.y += (rect.size.y - 16) / 2; // center the icon vertically
rect.size.y = 16;
- if(windowTheme) {
- windowTheme.drawBackground(canvas, WP_CLOSEBUTTON,
- (isHighlighted && highlightClose) ? (closeAuthorized ? CBS_PUSHED : CBS_HOT) : CBS_NORMAL, rect);
+ if(closeIcon) {
+ Rectangle drawRect = rect;
+ if(isHighlighted && highlightClose) {
+ drawRect.pos.x -= 1;
+ drawRect.pos.y -= 1;
+ if(closeAuthorized) {
+ drawRect.size.x += 1;
+ drawRect.size.y += 1;
+ }
+ }
+ canvas.drawIcon(closeIcon, drawRect);
} else {
UINT format = DFCS_CAPTIONCLOSE | DFCS_FLAT;
=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp 2010-08-11 15:40:28 +0000
+++ win32/MainWindow.cpp 2010-08-11 16:48:27 +0000
@@ -460,6 +460,7 @@
}
if(SETTING(TAB_STYLE) & SettingsManager::TAB_STYLE_BUTTONS)
seed.style |= TCS_BUTTONS;
+ seed.closeIcon = WinUtil::tabIcon(IDI_EXIT);
seed.toggleActive = BOOLSETTING(TOGGLE_ACTIVE_WINDOW);
seed.ctrlTab = true;
tabs = addChild(seed);
=== modified file 'win32/TabsPage.cpp'
--- win32/TabsPage.cpp 2010-08-11 15:40:28 +0000
+++ win32/TabsPage.cpp 2010-08-11 16:48:27 +0000
@@ -177,6 +177,7 @@
}
if(buttonStyle->getChecked())
seed.style |= TCS_BUTTONS;
+ seed.closeIcon = WinUtil::tabIcon(IDI_EXIT);
TabViewPtr tabs = cur->addChild(seed);
auto makeTab = [&tabs](const tstring& text) -> ContainerPtr {