Back to index

unity  6.0.0
IconLoader.h
Go to the documentation of this file.
00001 // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
00002 /*
00003 * Copyright (C) 2010, 2011 Canonical Ltd
00004 *
00005 * This program is free software: you can redistribute it and/or modify
00006 * it under the terms of the GNU General Public License version 3 as
00007 * published by the Free Software Foundation.
00008 *
00009 * This program is distributed in the hope that it will be useful,
00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 * GNU General Public License for more details.
00013 *
00014 * You should have received a copy of the GNU General Public License
00015 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 *
00017 * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
00018 */
00019 
00020 #ifndef UNITY_ICON_LOADER_H
00021 #define UNITY_ICON_LOADER_H
00022 
00023 #include <boost/utility.hpp>
00024 
00025 #include <memory>
00026 #include <sigc++/sigc++.h>
00027 #include <gtk/gtk.h>
00028 #include <UnityCore/GLibWrapper.h>
00029 
00030 namespace unity
00031 {
00032 
00033 class IconLoader : public boost::noncopyable
00034 {
00035 public:
00036   typedef sigc::slot<void, std::string const&, unsigned, glib::Object<GdkPixbuf> const&> IconLoaderCallback;
00037 
00038   IconLoader();
00039   ~IconLoader();
00040 
00041   static IconLoader& GetDefault();
00042 
00048   int LoadFromIconName(std::string const& icon_name,
00049                        unsigned size,
00050                        IconLoaderCallback slot);
00051 
00052   int LoadFromGIconString(std::string const& gicon_string,
00053                           unsigned size,
00054                           IconLoaderCallback slot);
00055 
00056   int LoadFromFilename(std::string const& filename,
00057                        unsigned size,
00058                        IconLoaderCallback slot);
00059 
00060   int LoadFromURI(std::string const& uri,
00061                   unsigned size,
00062                   IconLoaderCallback slot);
00063 
00064   void DisconnectHandle(int handle);
00065 
00066 private:
00067   class Impl;
00068   std::unique_ptr<Impl> pimpl;
00069 };
00070 
00071 }
00072 
00073 #endif // UNITY_ICON_LOADER_H