summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-09-12 16:10:50 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-09-12 16:10:50 (GMT)
commit41e89bb5ed1a9d38d1ece1310ef708daad54a9a9 (patch)
tree729117779ef76f28bff02413ce74daac46ccc565 /SwifTools
parentde0cdc61015f86a334bc4c0589bafe0bfdf89786 (diff)
downloadswift-contrib-41e89bb5ed1a9d38d1ece1310ef708daad54a9a9.zip
swift-contrib-41e89bb5ed1a9d38d1ece1310ef708daad54a9a9.tar.bz2
Moved application message display around.
Diffstat (limited to 'SwifTools')
-rw-r--r--SwifTools/Dock/Dock.cpp14
-rw-r--r--SwifTools/Dock/Dock.h18
-rw-r--r--SwifTools/Dock/MacOSXDock.h21
-rw-r--r--SwifTools/Dock/MacOSXDock.mm20
-rw-r--r--SwifTools/Dock/NullDock.h19
-rw-r--r--SwifTools/Dock/SConscript13
-rw-r--r--SwifTools/SConscript31
7 files changed, 123 insertions, 13 deletions
diff --git a/SwifTools/Dock/Dock.cpp b/SwifTools/Dock/Dock.cpp
new file mode 100644
index 0000000..77bcd84
--- /dev/null
+++ b/SwifTools/Dock/Dock.cpp
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include "SwifTools/Dock/Dock.h"
+
+namespace Swift {
+
+Dock::~Dock() {
+}
+
+}
diff --git a/SwifTools/Dock/Dock.h b/SwifTools/Dock/Dock.h
new file mode 100644
index 0000000..a1c652d
--- /dev/null
+++ b/SwifTools/Dock/Dock.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+namespace Swift {
+ class String;
+
+ class Dock {
+ public:
+ virtual ~Dock();
+
+ virtual void setMessage(const String& message) = 0;
+ };
+}
diff --git a/SwifTools/Dock/MacOSXDock.h b/SwifTools/Dock/MacOSXDock.h
new file mode 100644
index 0000000..e9667a6
--- /dev/null
+++ b/SwifTools/Dock/MacOSXDock.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include "SwifTools/Dock/Dock.h"
+
+namespace Swift {
+ class String;
+ class CocoaApplication;
+
+ class MacOSXDock : public Dock {
+ public:
+ MacOSXDock(CocoaApplication* application);
+
+ void setMessage(const String& label);
+ };
+}
diff --git a/SwifTools/Dock/MacOSXDock.mm b/SwifTools/Dock/MacOSXDock.mm
new file mode 100644
index 0000000..d2a06b3
--- /dev/null
+++ b/SwifTools/Dock/MacOSXDock.mm
@@ -0,0 +1,20 @@
+#include "SwifTools/Dock/MacOSXDock.h"
+
+#include <AppKit/AppKit.h>
+#include <Cocoa/Cocoa.h>
+
+#include "Swiften/Base/String.h"
+
+namespace Swift {
+
+MacOSXDock::MacOSXDock(CocoaApplication*) {
+}
+
+void MacOSXDock::setMessage(const String& label) {
+ NSString *labelString = [[NSString alloc] initWithUTF8String: label.getUTF8Data()];
+ [[NSApp dockTile] setBadgeLabel: labelString];
+ [labelString release];
+ [NSApp requestUserAttention: NSInformationalRequest];
+}
+
+}
diff --git a/SwifTools/Dock/NullDock.h b/SwifTools/Dock/NullDock.h
new file mode 100644
index 0000000..f2d27b7
--- /dev/null
+++ b/SwifTools/Dock/NullDock.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include "SwifTools/Dock/Dock.h"
+
+namespace Swift {
+ class NullDock : public Dock {
+ public:
+ NullDock() {}
+
+ virtual void setMessage(const String&) {
+ }
+ };
+}
diff --git a/SwifTools/Dock/SConscript b/SwifTools/Dock/SConscript
new file mode 100644
index 0000000..94797cb
--- /dev/null
+++ b/SwifTools/Dock/SConscript
@@ -0,0 +1,13 @@
+Import("swiftools_env")
+
+sources = [
+ "Dock.cpp",
+ ]
+
+if swiftools_env["PLATFORM"] == "darwin" and swiftools_env["target"] == "native" :
+ sources += [
+ "MacOSXDock.mm",
+ ]
+
+objects = swiftools_env.StaticObject(sources)
+swiftools_env.Append(SWIFTOOLS_OBJECTS = objects)
diff --git a/SwifTools/SConscript b/SwifTools/SConscript
index 7620879..2675b9f 100644
--- a/SwifTools/SConscript
+++ b/SwifTools/SConscript
@@ -15,8 +15,8 @@ if env["SCONS_STAGE"] == "flags" :
################################################################################
if env["SCONS_STAGE"] == "build" :
- myenv = env.Clone()
- myenv.MergeFlags(myenv["BOOST_FLAGS"])
+ swiftools_env = env.Clone()
+ swiftools_env.MergeFlags(swiftools_env["BOOST_FLAGS"])
sources = [
"Idle/IdleDetector.cpp",
@@ -29,24 +29,29 @@ if env["SCONS_STAGE"] == "build" :
"TabComplete.cpp",
]
- if myenv.get("HAVE_SPARKLE", 0) :
- myenv.MergeFlags(myenv["SPARKLE_FLAGS"])
- myenv.Append(CPPDEFINES = ["HAVE_SPARKLE"])
+ if swiftools_env.get("HAVE_SPARKLE", 0) :
+ swiftools_env.MergeFlags(swiftools_env["SPARKLE_FLAGS"])
+ swiftools_env.Append(CPPDEFINES = ["HAVE_SPARKLE"])
sources += ["AutoUpdater/SparkleAutoUpdater.mm"]
- if myenv["PLATFORM"] == "win32" :
+ if swiftools_env["PLATFORM"] == "win32" :
sources += ["Idle/WindowsIdleQuerier.cpp"]
- elif myenv["PLATFORM"] == "darwin" and myenv.get("HAVE_IOKIT", False) :
- myenv.Append(CPPDEFINES = ["HAVE_IOKIT"])
+ elif swiftools_env["PLATFORM"] == "darwin" and swiftools_env.get("HAVE_IOKIT", False) :
+ swiftools_env.Append(CPPDEFINES = ["HAVE_IOKIT"])
sources += ["Idle/MacOSXIdleQuerier.cpp"]
- elif myenv["HAVE_XSS"] :
- myenv.Append(CPPDEFINES = ["HAVE_XSS"])
+ elif swiftools_env["HAVE_XSS"] :
+ swiftools_env.Append(CPPDEFINES = ["HAVE_XSS"])
sources += ["Idle/XSSIdleQuerier.cpp"]
-
- myenv.StaticLibrary("SwifTools", sources)
-
+
+ swiftools_env["SWIFTOOLS_OBJECTS"] = []
+ Export("swiftools_env")
+
SConscript(dirs = [
+ "Dock",
"Idle/IdleQuerierTest",
"Idle/UnitTest",
"UnitTest"
])
+
+ swiftools_env.StaticLibrary("SwifTools", sources + swiftools_env["SWIFTOOLS_OBJECTS"])
+ \ No newline at end of file