Back to index

unity  6.0.0
PanelTray.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2010-2012 Canonical Ltd
00003  *
00004  * This program is free software: you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License version 3 as
00006  * published by the Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00015  *
00016  * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
00017  *              Marco Trevisan (TreviƱo) <3v1n0@ubuntu.com>
00018  */
00019 
00020 #ifndef PANEL_TRAY_H
00021 #define PANEL_TRAY_H
00022 
00023 #include <Nux/Nux.h>
00024 #include <Nux/View.h>
00025 #include <gtk/gtk.h>
00026 #include <gdk/gdkx.h>
00027 
00028 #include "unity-shared/Introspectable.h"
00029 #include <UnityCore/GLibWrapper.h>
00030 #include <UnityCore/GLibSignal.h>
00031 #include <UnityCore/GLibSource.h>
00032 
00033 #include <unity-misc/na-tray.h>
00034 #include <unity-misc/na-tray-child.h>
00035 #include <unity-misc/na-tray-manager.h>
00036 
00037 namespace unity
00038 {
00039 
00040 class PanelTray : public nux::View, public unity::debug::Introspectable
00041 {
00042 public:
00043   PanelTray();
00044   ~PanelTray();
00045 
00046   void Sync();
00047   Window xid();
00048 
00049 protected:
00050   void Draw(nux::GraphicsEngine& gfx_content, bool force_draw);
00051   std::string GetName() const;
00052   void AddProperties(GVariantBuilder* builder);
00053 
00054 private:
00055   bool IdleSync();
00056   static gboolean FilterTrayCallback(NaTray* tray, NaTrayChild* child, PanelTray* self);
00057   void OnTrayIconRemoved(NaTrayManager* manager, NaTrayChild* child);
00058   gboolean OnTrayDraw(GtkWidget* widget, cairo_t* cr);
00059 
00060   int WidthOfTray();
00061 
00062   glib::Object<GSettings> settings_;
00063   glib::Object<GtkWidget> window_;
00064   glib::Object<NaTray> tray_;
00065   char** whitelist_;
00066 
00067   glib::Signal<void, GSettings*, gchar*> whitelist_changed_;
00068   glib::Signal<gboolean, GtkWidget*, cairo_t*> draw_signal_;
00069   glib::Signal<void, NaTrayManager*, NaTrayChild*> icon_removed_signal_;
00070   glib::Source::UniquePtr sync_idle_;
00071   std::list<NaTrayChild*> children_;
00072   nux::Geometry last_geo_;
00073 };
00074 
00075 }
00076 
00077 #endif