]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/controls/ctrl_button.hpp
skins2 vout manager
[vlc] / modules / gui / skins2 / controls / ctrl_button.hpp
index 2917ba709769f3950eafa87382835b27690fa8e4..5d11290ebda151af03d9828df049ec284897239a 100644 (file)
@@ -1,11 +1,11 @@
 /*****************************************************************************
  * ctrl_button.hpp
  *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: ctrl_button.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
+ * Copyright (C) 2003 the VideoLAN team
+ * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
- *          Olivier Teulière <ipkiss@via.ecp.fr>
+ *          Olivier Teulière <ipkiss@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #ifndef CTRL_BUTTON_HPP
 
 #include "ctrl_generic.hpp"
 #include "../utils/fsm.hpp"
+#include "../src/anim_bitmap.hpp"
 
 class GenericBitmap;
-class OSGraphics;
 class CmdGeneric;
 
 
 /// Base class for button controls
-class CtrlButton: public CtrlGeneric
+class CtrlButton: public CtrlGeneric, public Observer<AnimBitmap>
 {
     public:
         /// Create a button with 3 images
@@ -58,6 +58,9 @@ class CtrlButton: public CtrlGeneric
         /// Get the text of the tooltip
         virtual UString getTooltipText() const { return m_tooltip; }
 
+        /// Get the type of control (custom RTTI)
+        virtual string getType() const { return "button"; }
+
     private:
         /// Finite state machine of the control
         FSM m_fsm;
@@ -65,31 +68,27 @@ class CtrlButton: public CtrlGeneric
         CmdGeneric &m_rCommand;
         /// Tooltip text
         const UString m_tooltip;
-        /// Callbacks objects
-        Callback m_cmdUpOverDownOver;
-        Callback m_cmdDownOverUpOver;
-        Callback m_cmdDownOverDown;
-        Callback m_cmdDownDownOver;
-        Callback m_cmdUpOverUp;
-        Callback m_cmdUpUpOver;
-        Callback m_cmdDownUp;
-        Callback m_cmdUpHidden;
-        Callback m_cmdHiddenUp;
         /// Images of the button in the different states
-        OSGraphics *m_pImgUp, *m_pImgOver, *m_pImgDown;
+        AnimBitmap m_imgUp, m_imgOver, m_imgDown;
         /// Current image
-        OSGraphics *m_pImg;
-
-        /// Callback functions
-        static void transUpOverDownOver( SkinObject *pCtrl );
-        static void transDownOverUpOver( SkinObject *pCtrl );
-        static void transDownOverDown( SkinObject *pCtrl );
-        static void transDownDownOver( SkinObject *pCtrl );
-        static void transUpOverUp( SkinObject *pCtrl );
-        static void transUpUpOver( SkinObject *pCtrl );
-        static void transDownUp( SkinObject *pCtrl );
-        static void transUpHidden( SkinObject *pCtrl );
-        static void transHiddenUp( SkinObject *pCtrl );
+        AnimBitmap *m_pImg;
+
+        /// Callback objects
+        DEFINE_CALLBACK( CtrlButton, UpOverDownOver )
+        DEFINE_CALLBACK( CtrlButton, DownOverUpOver )
+        DEFINE_CALLBACK( CtrlButton, DownOverDown )
+        DEFINE_CALLBACK( CtrlButton, DownDownOver )
+        DEFINE_CALLBACK( CtrlButton, UpOverUp )
+        DEFINE_CALLBACK( CtrlButton, UpUpOver )
+        DEFINE_CALLBACK( CtrlButton, DownUp )
+        DEFINE_CALLBACK( CtrlButton, UpHidden )
+        DEFINE_CALLBACK( CtrlButton, HiddenUp )
+
+        /// Change the current image
+        void setImage( AnimBitmap *pImg );
+
+        /// Method called when an animated bitmap changes
+        virtual void onUpdate( Subject<AnimBitmap> &rBitmap, void* );
 };