Back to index

unity  6.0.0
unity-mt-grab-handle-group.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2011 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: Sam Spilsbury <sam.spilsbury@canonical.com>
00017  */
00018 
00019 #ifndef _UNITY_MT_GRAB_HANDLE_GROUP_H
00020 #define _UNITY_MT_GRAB_HANDLE_GROUP_H
00021 
00022 #include <Nux/Nux.h>
00023 #include <glib.h>
00024 #include <boost/noncopyable.hpp>
00025 #include <boost/shared_ptr.hpp>
00026 #include <boost/enable_shared_from_this.hpp>
00027 #include <boost/weak_ptr.hpp>
00028 
00029 #include "unity-mt-grab-handle.h"
00030 #include "unity-mt-texture.h"
00031 #include "unity-mt-grab-handle-window.h"
00032 
00033 namespace unity
00034 {
00035 namespace MT
00036 {
00037 extern unsigned int FADE_MSEC;
00038 
00039 class GrabHandleGroup :
00040   public boost::enable_shared_from_this <GrabHandleGroup>,
00041   boost::noncopyable
00042 {
00043 public:
00044 
00045   typedef boost::shared_ptr <GrabHandleGroup> Ptr;
00046 
00047   static GrabHandleGroup::Ptr create (GrabHandleWindow *owner,
00048                                       std::vector<TextureSize> &textures);
00049   ~GrabHandleGroup();
00050 
00051   void relayout(const nux::Geometry&, bool);
00052   void restack();
00053 
00054   bool visible();
00055   bool animate(unsigned int);
00056   bool needsAnimate();
00057 
00058   int opacity();
00059 
00060   void hide();
00061   void show(unsigned int handles = ~0);
00062   void raiseHandle (const boost::shared_ptr <const unity::MT::GrabHandle> &);
00063 
00064   std::vector <TextureLayout> layout(unsigned int handles);
00065 
00066   void forEachHandle (const std::function<void (const unity::MT::GrabHandle::Ptr &)> &);
00067 
00068   void requestMovement (int x,
00069                         int y,
00070                         unsigned int direction,
00071                         unsigned int button);
00072 private:
00073 
00074   GrabHandleGroup(GrabHandleWindow *owner,
00075                   std::vector<TextureSize> &textures);
00076 
00077   enum class State
00078   {
00079     FADE_IN = 1,
00080     FADE_OUT,
00081     NONE
00082   };
00083 
00084   State                           mState;
00085   int                             mOpacity;
00086 
00087   bool                                        mMoreAnimate;
00088   std::vector <unity::MT::GrabHandle::Ptr> mHandles;
00089   GrabHandleWindow                     *mOwner;
00090 };
00091 };
00092 };
00093 
00094 #endif