1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2003 the VideoLAN team
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 along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
28 #include "generic_bitmap.hpp"
29 #include "generic_font.hpp"
30 #include "generic_layout.hpp"
32 #include "../src/window_manager.hpp"
33 #include "../commands/cmd_generic.hpp"
34 #include "../utils/bezier.hpp"
35 #include "../utils/variable.hpp"
36 #include "../utils/position.hpp"
37 #include "../controls/ctrl_generic.hpp"
45 /// Class storing the data of the current theme
46 class Theme: public SkinObject
50 friend class Interpreter;
52 Theme( intf_thread_t *pIntf ): SkinObject( pIntf ),
53 m_windowManager( getIntf() ) { }
59 GenericBitmap *getBitmapById( const string &id ) const;
60 GenericFont *getFontById( const string &id ) const;
62 # define ObjByID( var ) ( const string &id ) const \
63 { return var.find_object( id ); }
64 Popup *getPopupById ObjByID( m_popups )
65 TopWindow *getWindowById ObjByID( m_windows )
66 GenericLayout *getLayoutById ObjByID( m_layouts )
67 CtrlGeneric *getControlById ObjByID( m_controls )
68 Position *getPositionById ObjByID( m_positions )
71 WindowManager &getWindowManager() { return m_windowManager; }
74 template<class T> class IDmap: public std::map<string, T> {
76 typedef typename std::map<string, T> parent;
78 typename T::pointer find_object(const string &id) const
80 typename parent::const_iterator it = parent::find( id );
81 return it!=parent::end() ? it->second.get() : NULL;
83 typename T::pointer find_first_object(const string &id) const;
85 /// Store the bitmaps by ID
86 IDmap<GenericBitmapPtr> m_bitmaps;
87 /// Store the fonts by ID
88 IDmap<GenericFontPtr> m_fonts;
89 /// Store the popups by ID
90 IDmap<PopupPtr> m_popups;
91 /// Store the windows by ID
92 IDmap<TopWindowPtr> m_windows;
93 /// Store the layouts by ID
94 IDmap<GenericLayoutPtr> m_layouts;
95 /// Store the controls by ID
96 IDmap<CtrlGenericPtr> m_controls;
97 /// Store the panel positions by ID
98 IDmap<PositionPtr> m_positions;
99 /// Store the commands
100 list<CmdGenericPtr> m_commands;
101 /// Store the Bezier curves
102 list<BezierPtr> m_curves;
103 /// Store the variables
104 list<VariablePtr> m_vars;
106 WindowManager m_windowManager;