summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-03-18 16:55:32 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-03-18 16:55:32 +0000
commit103f22dc9a39704b12463cb6cb761149e36cd769 (patch)
treec518d68e9c5498288fe5446533efe5ff19d2f06e /libs/gtkmm2ext
parenteff67f03e25b6a00cc8176331f47f60232419bc2 (diff)
new source files from tim m.
git-svn-id: svn://localhost/ardour2/trunk@1619 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/window_title.h44
-rw-r--r--libs/gtkmm2ext/window_title.cc26
2 files changed, 70 insertions, 0 deletions
diff --git a/libs/gtkmm2ext/gtkmm2ext/window_title.h b/libs/gtkmm2ext/gtkmm2ext/window_title.h
new file mode 100644
index 0000000000..1ce7d64b92
--- /dev/null
+++ b/libs/gtkmm2ext/gtkmm2ext/window_title.h
@@ -0,0 +1,44 @@
+#ifndef WINDOW_TITLE_INCLUDED
+#define WINDOW_TITLE_INCLUDED
+
+#include <string>
+
+namespace Gtkmm2ext {
+
+using std::string;
+
+/**
+ * \class The WindowTitle class can be used to maintain the
+ * consistancy of window titles between windows and dialogs.
+ *
+ * Each string element that is added to the window title will
+ * be separated by a hyphen.
+ */
+class WindowTitle
+{
+public:
+
+ /**
+ * \param title The first string/element of the window title
+ * which will may be the application name or the document
+ * name in a document based application.
+ */
+ WindowTitle(const string& title);
+
+ /**
+ * Add an string element to the window title.
+ */
+ void operator+= (const string&);
+
+ /// @return The window title string.
+ const string& get_string () { return m_title;}
+
+private:
+
+ string m_title;
+
+};
+
+} // Gtkmm2ext
+
+#endif // WINDOW_TITLE_INCLUDED
diff --git a/libs/gtkmm2ext/window_title.cc b/libs/gtkmm2ext/window_title.cc
new file mode 100644
index 0000000000..237be1ff0f
--- /dev/null
+++ b/libs/gtkmm2ext/window_title.cc
@@ -0,0 +1,26 @@
+#include "gtkmm2ext/window_title.h"
+
+#include "i18n.h"
+
+namespace {
+
+// I don't know if this should be translated.
+const char* const title_separator = X_(" - ");
+
+} // anonymous namespace
+
+namespace Gtkmm2ext {
+
+WindowTitle::WindowTitle(const string& title)
+ : m_title(title)
+{
+
+}
+
+void
+WindowTitle::operator+= (const string& element)
+{
+ m_title = m_title + title_separator + element;
+}
+
+}