linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #03373
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2432: draw splitters as progress bars
------------------------------------------------------------
revno: 2432
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sun 2011-02-20 17:20:37 +0100
message:
draw splitters as progress bars
modified:
dwt/include/dwt/dwt_vsstyle.h
dwt/include/dwt/widgets/Splitter.h
win32/main.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 2011-02-01 20:32:13 +0000
+++ dwt/include/dwt/dwt_vsstyle.h 2011-02-20 16:20:37 +0000
@@ -59,6 +59,14 @@
#define MPI_DISABLED 3
#define MPI_DISABLEDHOT 4
+#define VSCLASS_PROGRESS L"PROGRESS"
+#define PP_BAR 1
+#define PP_BARVERT 2
+#define PP_FILL 5
+#define PP_FILLVERT 6
+#define PBFS_NORMAL 1
+#define PBFVS_NORMAL 1
+
#define VSCLASS_TAB L"TAB"
#define TABP_TABITEM 1
#define TIS_NORMAL 1
=== modified file 'dwt/include/dwt/widgets/Splitter.h'
--- dwt/include/dwt/widgets/Splitter.h 2011-02-19 17:20:34 +0000
+++ dwt/include/dwt/widgets/Splitter.h 2011-02-20 16:20:37 +0000
@@ -35,6 +35,7 @@
#include "Container.h"
#include "ToolTip.h"
#include <dwt/Texts.h>
+#include <dwt/dwt_vsstyle.h>
namespace dwt {
@@ -102,6 +103,8 @@
Widget* first;
Widget* second;
+ Theme theme;
+
double pos;
bool hovering;
@@ -112,13 +115,22 @@
Rectangle getSplitterRect();
void layout();
- bool handleBg(Canvas& canvas) {
- if(hovering) {
+ void handlePainting(PaintCanvas& canvas) {
+ if(theme) {
+ int part, state;
+ if(hovering) {
+ part = horizontal ? PP_FILL : PP_FILLVERT;
+ state = horizontal ? PBFS_NORMAL : PBFVS_NORMAL;
+ } else {
+ part = horizontal ? PP_BAR : PP_BARVERT;
+ state = 0;
+ }
+ theme.drawBackground(canvas, part, state, canvas.getPaintRect());
+
+ } else {
// safe to assume that the text color is different enough from the default background.
- canvas.fill(Rectangle(getClientSize()), Brush(Brush::WindowText));
- return true;
+ canvas.fill(canvas.getPaintRect(), Brush(Brush::WindowText));
}
- return false;
}
bool handleLButtonDown() {
@@ -178,7 +190,8 @@
pos = cs.pos;
BaseType::create(cs);
- onEraseBackground([this](Canvas& canvas) { return GCC_WTF->handleBg(canvas); });
+ theme.load(VSCLASS_PROGRESS, this);
+ onPainting([this](PaintCanvas& canvas) { GCC_WTF->handlePainting(canvas); });
onLeftMouseDown([this](const MouseEvent&) { return GCC_WTF->handleLButtonDown(); });
onMouseMove([this](const MouseEvent& mouseEvent) { return GCC_WTF->handleMouseMove(mouseEvent); });
=== modified file 'win32/main.cpp'
--- win32/main.cpp 2011-02-19 17:03:15 +0000
+++ win32/main.cpp 2011-02-20 16:20:37 +0000
@@ -22,6 +22,7 @@
#include "WinUtil.h"
#include "MainWindow.h"
#include "SplashWindow.h"
+
#include "Mapper_NATPMP.h"
#include "Mapper_MiniUPnPc.h"
#include "Mapper_WinUPnP.h"