Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

ctrl_tree.hpp

00001 /*****************************************************************************
00002  * ctrl_tree.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 VideoLAN
00005  * $Id: ctrl_tree.hpp 12464 2005-09-03 15:17:57Z ipkiss $
00006  *
00007  * Authors: Antoine Cellerier
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00022  *****************************************************************************/
00023 
00024 #ifndef CTRL_TREE_HPP
00025 #define CTRL_TREE_HPP
00026 
00027 #include "ctrl_generic.hpp"
00028 #include "../utils/observer.hpp"
00029 #include "../utils/var_tree.hpp"
00030 
00031 class OSGraphics;
00032 class GenericFont;
00033 class GenericBitmap;
00034 
00036 class CtrlTree: public CtrlGeneric, public Observer<VarTree>,
00037     public Observer<VarPercent>
00038 {
00039     public:
00040         CtrlTree( intf_thread_t *pIntf,
00041                   VarTree &rTree,
00042                   const GenericFont &rFont,
00043                   const GenericBitmap *pBgBitmap,
00044                   const GenericBitmap *pItemBitmap,
00045                   const GenericBitmap *pOpenBitmap,
00046                   const GenericBitmap *pClosedBitmap,
00047                   uint32_t fgColor,
00048                   uint32_t playColor,
00049                   uint32_t bgColor1,
00050                   uint32_t bgColor2,
00051                   uint32_t selColor,
00052                   const UString &rHelp,
00053                   VarBool *pVisible );
00054         virtual ~CtrlTree();
00055 
00057         virtual void handleEvent( EvtGeneric &rEvent );
00058 
00060         virtual bool mouseOver( int x, int y ) const;
00061 
00063         virtual void draw( OSGraphics &rImage, int xDest, int yDest );
00064 
00066         virtual void onResize();
00067 
00069         virtual bool isFocusable() const { return true; }
00070 
00072         virtual string getType() const { return "tree"; }
00073 
00074     private:
00076         VarTree &m_rTree;
00078         const GenericFont &m_rFont;
00080         const GenericBitmap *m_pBgBitmap;
00082         // (TODO : add different bitmaps for different item types
00083         //         like in the wx playlist)
00084         const GenericBitmap *m_pItemBitmap;
00086         const GenericBitmap *m_pOpenBitmap;
00088         const GenericBitmap *m_pClosedBitmap;
00090         uint32_t m_fgColor;
00092         uint32_t m_playColor;
00094         uint32_t m_bgColor1, m_bgColor2;
00096         uint32_t m_selColor;
00098         VarTree *m_pLastSelected;
00100         OSGraphics *m_pImage;
00102         VarTree::Iterator m_lastPos;
00103 
00105         virtual void onUpdate( Subject<VarTree> &rTree );
00106 
00107         // Method called when the position variable of the tree is modified
00108         virtual void onUpdate( Subject<VarPercent> &rPercent );
00109 
00111         virtual void onPositionChange();
00112 
00114         int maxItems();
00115 
00117         int itemHeight();
00118 
00120         int itemImageWidth();
00121 
00123         void autoScroll();
00124 
00126         void makeImage();
00127 
00129 
00133         VarTree::Iterator findItemAtPos( int n );
00134 };
00135 
00136 #endif

Generated on Tue Dec 20 10:14:41 2005 for vlc-0.8.4a by  doxygen 1.4.2