[libchamplainmm] Add demos; add GtkChamplain::Embed example



commit 0d2c5f194184386e574de4a0616fd80feb5b3446
Author: Juan R. García Blanco <juanrgar gmail com>
Date:   Sat May 31 14:51:02 2014 +0200

    Add demos; add GtkChamplain::Embed example

 Makefile.am         |    2 +-
 configure.ac        |    1 +
 demos/.gitignore    |    1 +
 demos/Makefile.am   |   36 +++++++++++++++++++++++++
 demos/embed-demo.cc |   73 +++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 112 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index b98dcf2..16510cb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -28,7 +28,7 @@ doc_subdirs = docs
 else
 doc_subdirs =
 endif
-SUBDIRS = $(src_subdirs) champlain/champlainmm champlain-gtk/champlainmm-gtk $(doc_subdirs)
+SUBDIRS = $(src_subdirs) champlain/champlainmm champlain-gtk/champlainmm-gtk demos $(doc_subdirs)
 
 champlainmm_includedir = $(includedir)/$(CHAMPLAINMM_MODULE_NAME)
 champlainmm_include_HEADERS = champlain/champlainmm.h
diff --git a/configure.ac b/configure.ac
index c481b43..87184c2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,7 @@ AC_CONFIG_FILES([Makefile
                  
champlain-gtk/${CHAMPLAINMM_GTK_MODULE_NAME}-uninstalled.pc:champlain-gtk/champlainmm-gtk-uninstalled.pc.in
                  champlain-gtk/src/Makefile
                  champlain-gtk/champlainmm-gtk/Makefile
+                 demos/Makefile
                  docs/Makefile
                  docs/reference/Doxyfile])
 AC_OUTPUT
diff --git a/demos/.gitignore b/demos/.gitignore
new file mode 100644
index 0000000..7a0d950
--- /dev/null
+++ b/demos/.gitignore
@@ -0,0 +1 @@
+embed-demo
diff --git a/demos/Makefile.am b/demos/Makefile.am
new file mode 100644
index 0000000..7ec6f5f
--- /dev/null
+++ b/demos/Makefile.am
@@ -0,0 +1,36 @@
+## Copyright (c) 2014  Juan R. García Blanco <juanrgar gmail com>
+##
+## This file is part of libchamplainmm.
+##
+## libchamplainmm 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.
+##
+## libchamplainmm 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, see <http://www.gnu.org/licenses/>.
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+check_PROGRAMS = embed-demo
+
+embed_demo_SOURCES = embed-demo.cc
+
+champlainmm_includes = -I$(top_builddir)/champlain $(if $(srcdir:.=),-I$(top_srcdir)/champlain)
+champlainmm_ldadd    = $(top_builddir)/champlain/champlainmm/libchamplainmm-$(CHAMPLAINMM_API_VERSION).la
+
+champlainmm_gtk_includes = -I$(top_builddir)/champlain-gtk $(if $(srcdir:.=),-I$(top_srcdir)/champlain-gtk)
+champlainmm_gtk_ldadd    = 
$(top_builddir)/champlain-gtk/champlainmm-gtk/libchamplainmm-gtk-$(CHAMPLAINMM_GTK_API_VERSION).la
+
+local_includes = -I$(top_builddir) $(champlainmm_gtk_includes) $(champlainmm_includes)
+local_ldadd    = $(champlainmm_gtk_ldadd) $(champlainmm_ldadd)
+
+AM_CPPFLAGS = $(local_includes) $(CHAMPLAINMM_GTK_CFLAGS) $(CHAMPLAINMM_CFLAGS)
+AM_CXXFLAGS = $(CHAMPLAINMM_GTK_WXXFLAGS) $(CHAMPLAINMM_WXXFLAGS) -DGLIBMM_DISABLE_DEPRECATED 
-DGIOMM_DISABLE_DEPRECATED -DGTKMM_DISABLE_DEPRECATED -DGDKMM_DISABLE_DEPRECATED
+
+embed_demo_LDADD = $(CHAMPLAINMM_GTK_LIBS) $(CHAMPLAINMM_LIBS) $(local_ldadd)
diff --git a/demos/embed-demo.cc b/demos/embed-demo.cc
new file mode 100644
index 0000000..3d78a66
--- /dev/null
+++ b/demos/embed-demo.cc
@@ -0,0 +1,73 @@
+/* Copyright (c) 2014  Juan R. García Blanco <juanrgar gmail com>
+ *
+ * This file is part of libchamplainmm.
+ *
+ * libchamplainmm 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.
+ *
+ * libchamplainmm 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 program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gtkmm.h>
+#include <cluttermm.h>
+#include <champlainmm-gtk.h>
+
+class EmbedDemoWindow : public Gtk::Window
+{
+public:
+  EmbedDemoWindow();
+  virtual ~EmbedDemoWindow();
+
+protected:
+private:
+  Gtk::HeaderBar m_header_bar;
+  Gtk::Grid m_grid;
+  Gtk::SearchEntry m_search_entry;
+  GtkChamplain::Embed m_champlain_embed;
+};
+
+EmbedDemoWindow::EmbedDemoWindow()
+{
+  // Window properties
+  set_title("ChamplainEmbed demo");
+  set_default_size(600, 400);
+  set_border_width(6);
+
+  // Header bar
+  m_header_bar.set_custom_title(m_search_entry);
+  m_header_bar.set_show_close_button();
+  set_titlebar(m_header_bar);
+
+  // Search entry
+  m_search_entry.set_size_request(600, -1);
+
+  // Layout
+  m_grid.set_row_spacing(6);
+  m_grid.attach(m_champlain_embed, 0, 0, 1, 1);
+  add(m_grid);
+
+  show_all_children();
+}
+
+EmbedDemoWindow::~EmbedDemoWindow()
+{
+}
+
+int main(int argc, char *argv[])
+{
+  Clutter::init(&argc, &argv);
+
+  Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "org.libchamplainmm.embed-demo");
+
+  EmbedDemoWindow window;
+
+  return app->run(window);
+}


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