linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05240
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2832: rip shared_ptr out of dwt
------------------------------------------------------------
revno: 2832
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sun 2012-01-22 21:39:56 +0100
message:
rip shared_ptr out of dwt
removed:
dwt/include/dwt/shared_ptr.h
modified:
dwt/include/dwt/forward.h
dwt/include/dwt/widgets/Notification.h
dwt/src/widgets/Notification.cpp
win32/MainWindow.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/forward.h'
--- dwt/include/dwt/forward.h 2012-01-22 20:27:14 +0000
+++ dwt/include/dwt/forward.h 2012-01-22 20:39:56 +0000
@@ -35,8 +35,6 @@
#include "WindowsHeaders.h"
-#include "shared_ptr.h"
-
namespace boost {
template<class T> class intrusive_ptr;
}
@@ -122,7 +120,7 @@
enum { NaC = 0x1000000 };
class Notification;
-typedef shared_ptr<Notification> NotificationPtr;
+typedef std::unique_ptr<Notification> NotificationPtr;
class Pen;
typedef boost::intrusive_ptr<Pen> PenPtr;
=== removed file 'dwt/include/dwt/shared_ptr.h'
--- dwt/include/dwt/shared_ptr.h 2012-01-13 20:55:20 +0000
+++ dwt/include/dwt/shared_ptr.h 1970-01-01 00:00:00 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2006-2012 Jacek Sieka, arnetheduck on gmail point com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef DWT_SHARED_PTR_H_
-#define DWT_SHARED_PTR_H_
-
-#if __MINGW32__ && __GNUC__ == 4 && __GNUC_MINOR__ <= 5
-
-/* the shared_ptr implementation provided by MinGW / GCC 4.5's libstdc++ consumes too many
-semaphores, so we prefer boost's one. see <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46455>. */
-
-#define _SHARED_PTR_H 1 // skip libstdc++'s bits/shared_ptr.h
-#include <boost/shared_ptr.hpp>
-#include <boost/enable_shared_from_this.hpp>
-#include <boost/make_shared.hpp>
-
-#define SHARED_PTR_NS boost
-
-#else
-
-#include <memory>
-
-#define SHARED_PTR_NS std
-
-#endif
-
-namespace dwt {
-
-using SHARED_PTR_NS::shared_ptr;
-using SHARED_PTR_NS::make_shared;
-using SHARED_PTR_NS::enable_shared_from_this;
-using SHARED_PTR_NS::static_pointer_cast;
-
-}
-
-#undef SHARED_PTR_NS
-
-#endif /* DCPLUSPLUS_DWT_SHARED_PTR_H_ */
=== modified file 'dwt/include/dwt/widgets/Notification.h'
--- dwt/include/dwt/widgets/Notification.h 2012-01-13 20:55:20 +0000
+++ dwt/include/dwt/widgets/Notification.h 2012-01-22 20:39:56 +0000
@@ -31,8 +31,8 @@
#ifndef DWT_NOTIFICATION_H_
#define DWT_NOTIFICATION_H_
-#include "../resources/Icon.h"
-#include "Window.h"
+#include <dwt/forward.h>
+#include <dwt/resources/Icon.h>
#include <deque>
@@ -41,17 +41,22 @@
/** A notification object represents a tray icon and a short message notification service */
class Notification {
public:
- Notification(WindowPtr parent_);
- ~Notification();
+ typedef Notification ThisType;
+ typedef NotificationPtr ObjectType;
struct Seed {
+ typedef ThisType WidgetType;
+
Seed(const IconPtr& icon_ = IconPtr(), const tstring& tip_ = tstring()) : icon(icon_), tip(tip_) { }
IconPtr icon;
tstring tip;
};
- void create(const Seed& seed = Seed());
+ Notification(Widget* parent);
+ ~Notification();
+
+ void create(const Seed& seed);
void setIcon(const IconPtr& icon_);
@@ -76,7 +81,7 @@
void onUpdateTip(const Callback& callback_) { updateTip = callback_; }
private:
- WindowPtr parent;
+ Widget* parent;
IconPtr icon;
bool visible;
=== modified file 'dwt/src/widgets/Notification.cpp'
--- dwt/src/widgets/Notification.cpp 2012-01-13 20:55:20 +0000
+++ dwt/src/widgets/Notification.cpp 2012-01-22 20:39:56 +0000
@@ -32,6 +32,7 @@
#include <dwt/widgets/Notification.h>
#include <dwt/Application.h>
+#include <dwt/Widget.h>
#include <dwt/util/win32/Version.h>
namespace dwt {
@@ -60,8 +61,8 @@
return nid;
}
-Notification::Notification(WindowPtr parent_) :
-parent(parent_),
+Notification::Notification(Widget* parent) :
+parent(parent),
visible(false),
onlyBalloons(false),
lastTick(0)
=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp 2012-01-22 20:27:14 +0000
+++ win32/MainWindow.cpp 2012-01-22 20:39:56 +0000
@@ -576,8 +576,7 @@
void MainWindow::initTray() {
dcdebug("initTray\n");
- notifier = dwt::NotificationPtr(new dwt::Notification(this));
- notifier->create(dwt::Notification::Seed(mainSmallIcon));
+ notifier = addChild(dwt::Notification::Seed(mainSmallIcon));
notifier->onContextMenu([this] { handleTrayContextMenu(); });
notifier->onIconClicked([this] { handleTrayClicked(); });
notifier->onUpdateTip([this] { handleTrayUpdate(); });