ctrl_image.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * ctrl_image.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: eef74985805e62461d177d52bba11f600ae82714 $
00006  *
00007  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
00008  *          Olivier Teulière <ipkiss@via.ecp.fr>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License along
00021  * with this program; if not, write to the Free Software Foundation, Inc.,
00022  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef CTRL_IMAGE_HPP
00026 #define CTRL_IMAGE_HPP
00027 
00028 #include "../commands/cmd_generic.hpp"
00029 #include "../utils/observer.hpp"
00030 #include "ctrl_flat.hpp"
00031 
00032 class GenericBitmap;
00033 class OSGraphics;
00034 class CmdGeneric;
00035 class VarString;
00036 
00037 
00038 /// Control image
00039 class CtrlImage: public CtrlFlat, public Observer<VarString>
00040 {
00041 public:
00042     /// Resize methods
00043     enum resize_t
00044     {
00045         kMosaic,                // Repeat the base image in a mosaic
00046         kScale,                 // Scale the base image
00047         kScaleAndRatioPreserved // Scale image (aspect ratio preserved)
00048     };
00049 
00050     // Create an image with the given bitmap (which is NOT copied)
00051     CtrlImage( intf_thread_t *pIntf, GenericBitmap &rBitmap,
00052                CmdGeneric &rCommand, resize_t resizeMethod,
00053                const UString &rHelp, VarBool *pVisible, bool art );
00054     virtual ~CtrlImage();
00055 
00056     /// Handle an event on the control
00057     virtual void handleEvent( EvtGeneric &rEvent );
00058 
00059     /// Check whether coordinates are inside the control
00060     virtual bool mouseOver( int x, int y ) const;
00061 
00062     /// Draw the control on the given graphics
00063     virtual void draw( OSGraphics &rImage, int xDest, int yDest );
00064 
00065     /// Get the type of control (custom RTTI)
00066     virtual string getType() const { return "image"; }
00067 
00068 private:
00069     /// Bitmap
00070     GenericBitmap* m_pBitmap;
00071     /// original Bitmap
00072     GenericBitmap* m_pOriginalBitmap;
00073     /// Buffer to stored the rendered bitmap
00074     OSGraphics *m_pImage;
00075     /// Command triggered by a double-click on the image
00076     CmdGeneric &m_rCommand;
00077     /// Resize method
00078     resize_t m_resizeMethod;
00079     /// does the image get updated as art
00080     bool m_art;
00081 
00082     /// Method called when the observed variable is modified
00083     virtual void onUpdate( Subject<VarString> &rVariable, void* );
00084 
00085 
00086 };
00087 
00088 #endif

Generated on Tue May 25 08:04:58 2010 for VLC by  doxygen 1.5.6