1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2004 the VideoLAN team
7 * Authors: Cyril Deguet <asmax@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef SKIN_PARSER_HPP
25 #define SKIN_PARSER_HPP
27 #include "xmlparser.hpp"
28 #include "builder_data.hpp"
32 /// Parser for the skin DTD
33 class SkinParser: public XMLParser
36 SkinParser( intf_thread_t *pIntf, const string &rFileName,
37 const string &rPath, bool useDTD = true,
38 BuilderData *pData = NULL );
39 virtual ~SkinParser();
41 const BuilderData &getData() const { return *m_pData; }
43 static int convertColor( const char *transcolor );
48 /// Container for mapping data from the XML
50 /// Indicate whether the class owns the data
59 /// Current position of menu items in the popups
60 list<int> m_popupPosList;
61 /// Current offset of the controls
62 int m_xOffset, m_yOffset;
63 list<int> m_xOffsetList, m_yOffsetList;
64 /// Layer of the current control in the layout
70 virtual void handleBeginElement( const string &rName,
72 virtual void handleEndElement( const string &rName );
76 bool convertBoolean( const char *value ) const;
77 /// Transform to int, and check that it is in the given range (if not,
78 /// the closest range boundary will be used)
79 int convertInRange( const char *value, int minValue, int maxValue,
80 const string &rAttribute ) const;
84 const string generateId() const;
86 /// Check if the id is unique, and if not generate a new one
87 const string uniqueId( const string &id );