1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2003 VideoLAN
7 * Authors: Cyril Deguet <asmax@via.ecp.fr>
8 * Olivier Teulière <ipkiss@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
28 #include "ctrl_generic.hpp"
29 #include "../utils/observer.hpp"
30 #include "../utils/var_list.hpp"
36 /// Class for control list
37 class CtrlList: public CtrlGeneric, public Observer<VarList>,
38 public Observer<VarPercent>
41 CtrlList( intf_thread_t *pIntf, VarList &rList, GenericFont &rFont,
42 uint32_t fgcolor, uint32_t playcolor, uint32_t bgcolor1,
43 uint32_t bgcolor2, uint32_t selColor,
44 const UString &rHelp, VarBool *pVisible );
47 /// Handle an event on the control.
48 virtual void handleEvent( EvtGeneric &rEvent );
50 /// Check whether coordinates are inside the control.
51 virtual bool mouseOver( int x, int y ) const;
53 /// Draw the control on the given graphics
54 virtual void draw( OSGraphics &rImage, int xDest, int yDest );
56 /// Called when the layout is resized
57 virtual void onResize();
59 /// Return true if the control can gain the focus
60 virtual bool isFocusable() const { return true; }
62 /// Get the type of control (custom RTTI)
63 virtual string getType() const { return "list"; }
66 /// List associated to the control
70 /// Color of normal text
72 /// Color of the playing item
75 uint32_t m_bgColor1, m_bgColor2;
76 /// Background of selected items
78 /// Pointer on the last selected item in the list
79 VarList::Elem_t *m_pLastSelected;
80 /// Image of the control
85 /// Method called when the list variable is modified
86 virtual void onUpdate( Subject<VarList> &rList );
88 /// Method called when the position variable of the list is modified
89 virtual void onUpdate( Subject<VarPercent> &rPercent );
91 /// Called when the position is set
92 virtual void onPositionChange();
94 /// Check if the list must be scrolled
97 /// Draw the image of the control