[gnote] Add ability to check embeds in host



commit 83726ab4630e1cf0a8fe511eb9274e8322c35f6b
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Mon Jul 29 00:00:55 2013 +0300

    Add ability to check embeds in host

 src/mainwindowembeds.hpp |    2 ++
 src/recentchanges.cpp    |   12 ++++++++++++
 src/recentchanges.hpp    |    3 ++-
 3 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/mainwindowembeds.hpp b/src/mainwindowembeds.hpp
index f7ca057..c306cc6 100644
--- a/src/mainwindowembeds.hpp
+++ b/src/mainwindowembeds.hpp
@@ -36,6 +36,8 @@ public:
   virtual void foreground_embedded(EmbeddableWidget &) = 0;
   virtual void background_embedded(EmbeddableWidget &) = 0;
   virtual bool running() = 0;
+  virtual bool contains(EmbeddableWidget &) = 0;
+  virtual bool is_foreground(EmbeddableWidget &) = 0;
 };
 
 class EmbeddableWidget
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index 05a3e1b..5414ed5 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -24,6 +24,7 @@
 #endif
 
 #include <boost/bind.hpp>
+#include <boost/foreach.hpp>
 #include <glibmm/i18n.h>
 #include <gtkmm/alignment.h>
 #include <gtkmm/image.h>
@@ -534,6 +535,17 @@ namespace gnote {
     m_embedded_toolbar.remove();
   }
 
+  bool NoteRecentChanges::contains(EmbeddableWidget & widget)
+  {
+    BOOST_FOREACH(EmbeddableWidget *wgt, m_embedded_widgets) {
+      if(wgt == &widget) {
+        return true;
+      }
+    }
+
+    return false;
+  }
+
   bool NoteRecentChanges::is_foreground(EmbeddableWidget & widget)
   {
     std::vector<Gtk::Widget*> current = m_embed_box.get_children();
diff --git a/src/recentchanges.hpp b/src/recentchanges.hpp
index f2e8820..07438aa 100644
--- a/src/recentchanges.hpp
+++ b/src/recentchanges.hpp
@@ -59,6 +59,8 @@ public:
     {
       return m_mapped;
     }
+  virtual bool contains(EmbeddableWidget &) override;
+  virtual bool is_foreground(EmbeddableWidget &) override;
 protected:
   virtual void on_show() override;
   virtual bool on_map_event(GdkEventAny *evt) override;
@@ -68,7 +70,6 @@ private:
   void on_delete_note();
   bool on_delete(GdkEventAny *);
   bool on_key_pressed(GdkEventKey *);
-  bool is_foreground(EmbeddableWidget &);
   EmbeddableWidget *currently_embedded();
   Gtk::Toolbar *make_toolbar();
   void make_search_box();


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