[gtkmm] Added Gtk::Application.



commit d34dc592bb7a353dd9814a80afdb778040815be2
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jul 30 15:23:31 2010 +0200

    Added Gtk::Application.
    
    * gtk/src/filelist.am:
    * gtk/src/application.[hg|ccg]: Added the beginnings of Gtk::Application,
    wrapping GtkApplication, using Gio::Application that I just added in glibmm.
    * gtk/gtkmm.h: Include the new header.

 ChangeLog               |    9 +++++++
 gtk/gtkmm.h             |    1 +
 gtk/src/application.ccg |   60 +++++++++++++++++++++++++++++++++++++++++++++++
 gtk/src/application.hg  |   51 +++++++++++++++++++++++++++++++++++++++
 gtk/src/filelist.am     |    1 +
 tools/m4/convert_gtk.m4 |    2 +
 6 files changed, 124 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 84c73be..d0574e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-07-30  Murray Cumming  <murrayc murrayc com>
+
+	Added Gtk::Application.
+
+	* gtk/src/filelist.am:
+	* gtk/src/application.[hg|ccg]: Added the beginnings of Gtk::Application, 
+	wrapping GtkApplication, using Gio::Application that I just added in glibmm.
+	* gtk/gtkmm.h: Include the new header.
+
 2010-07-27  Murray Cumming  <murrayc murrayc com>
 
 	MenuShell: Remove items().
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index b2c7406..58f821b 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -94,6 +94,7 @@ extern const int gtkmm_micro_version;
 #include <gtkmm/accelgroup.h>
 #include <gtkmm/adjustment.h>
 #include <gtkmm/alignment.h>
+#include <gtkmm/application.h>
 #include <gtkmm/arrow.h>
 #include <gtkmm/aspectframe.h>
 #include <gtkmm/assistant.h>
diff --git a/gtk/src/application.ccg b/gtk/src/application.ccg
new file mode 100644
index 0000000..ea88e6a
--- /dev/null
+++ b/gtk/src/application.ccg
@@ -0,0 +1,60 @@
+// -*- c++ -*-
+/* $Id: action.ccg,v 1.11 2006/05/10 20:59:27 murrayc Exp $ */
+
+/* Copyright 2003 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gtk/gtk.h>
+
+#include <gtkmm/menu.h>
+#include <gtkmm/menuitem.h>
+#include <gtkmm/toolitem.h>
+#include <gtkmm/image.h>
+#include <gtkmm/widget.h>
+
+typedef Gtk::Action Action; 
+
+namespace Gtk
+{
+
+Action::Action(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip)
+:
+  _CONSTRUCT("name", name.c_str(), "stock_id", stock_id.get_c_str(), "label", (label.empty() ? 0 : label.c_str()),  "tooltip", (tooltip.empty() ? 0 : tooltip.c_str()))
+{}
+
+Action::Action(const Glib::ustring& name, const Glib::ustring& icon_name, const Glib::ustring& label, const Glib::ustring& tooltip)
+:
+  _CONSTRUCT("name", name.c_str(), "icon_name", icon_name.c_str(), "label", (label.empty() ? 0 : label.c_str()),  "tooltip", (tooltip.empty() ? 0 : tooltip.c_str()))
+{}
+
+Glib::RefPtr<Action> Action::create(const Glib::ustring& name, const Glib::ustring& label, const Glib::ustring& tooltip)
+{
+  return Glib::RefPtr<Action>( new Action(name, Gtk::StockID(), label, tooltip) );
+}
+
+Glib::RefPtr<Action> Action::create(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip)
+{
+  return Glib::RefPtr<Action>( new Action(name, stock_id, label, tooltip) );
+}
+
+Glib::RefPtr<Action> Action::create_with_icon_name(const Glib::ustring& name, const Glib::ustring& icon_name, const Glib::ustring& label, const Glib::ustring& tooltip)
+{
+  return Glib::RefPtr<Action>( new Action(name, icon_name, label, tooltip) );
+}
+
+} // namespace Gtk
+
diff --git a/gtk/src/application.hg b/gtk/src/application.hg
new file mode 100644
index 0000000..5df0dfd
--- /dev/null
+++ b/gtk/src/application.hg
@@ -0,0 +1,51 @@
+/* Copyright (C) 2003 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+_CONFIGINCLUDE(gtkmmconfig.h)
+
+#include <giomm/application.h>
+#include <gtkmm/window.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(giomm/private/application_p.h)
+
+namespace Gtk
+{
+
+/** TODO
+ */
+class Application
+  : public Gio::Application,
+{
+protected:
+  _CLASS_GOBJECT(Application, GtkApplication, GTK_APPLICATION, Gio::Application, GApplication)
+  _IMPLEMENTS_INTERFACE(Buildable)
+
+public:
+  //TODO: _WRAP_METHOD(static Glib::RefPtr<Application> create(int& argc, gchar**& argv, const Glib::ustring& appid), gtk_application_new)
+  
+  _WRAP_METHOD(void set_action_group(const Glib::RefPtr<ActionGroup>& group), gtk_application_set_action_group)
+  
+  _WRAP_METHOD(Window* get_window(), gtk_application_get_window)
+  _WRAP_METHOD(const Window* get_window() const, gtk_application_get_window)
+    
+  _WRAP_METHOD(void add_window(Window& window), gtk_application_add_window)
+  _WRAP_METHOD(void run(), gtk_application_run)
+  _WRAP_METHOD(void quit(), gtk_application_quit)
+};
+
+} // namespace Gtk
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 630414b..2af1c2b 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -21,6 +21,7 @@ gtkmm_files_any_hg =		\
 	activatable.hg		\
 	adjustment.hg		\
 	alignment.hg		\
+	application.hg \
 	arrow.hg		\
 	aspectframe.hg		\
 	assistant.hg		\
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index 111bc7b..b308dec 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -489,6 +489,8 @@ _CONVERSION(`GtkActionGroup*',`Glib::RefPtr<ActionGroup>',`Glib::wrap($3)')
 #_CONVERSION(`GtkActionGroup*',`Glib::RefPtr<const ActionGroup>',`Glib::wrap($3)')
 _CONVERSION(`const Glib::RefPtr<ActionGroup>&',`GtkActionGroup*',__CONVERT_REFPTR_TO_P($3))
 
+_CONVERSION(`GtkApplication*',`Glib::RefPtr<Application>',`Glib::wrap($3)')
+
 _CONVERSION(`GtkEntryCompletion*',`Glib::RefPtr<EntryCompletion>',`Glib::wrap($3)')
 _CONVERSION(`GtkEntryCompletion*',`Glib::RefPtr<const EntryCompletion>',`Glib::wrap($3)')
 _CONVERSION(`const Glib::RefPtr<EntryCompletion>&',`GtkEntryCompletion*',__CONVERT_REFPTR_TO_P($3))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]