skin_parser.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * skin_parser.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2004 the VideoLAN team
00005  * $Id$
00006  *
00007  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 #ifndef SKIN_PARSER_HPP
00025 #define SKIN_PARSER_HPP
00026 
00027 #include "xmlparser.hpp"
00028 #include "builder_data.hpp"
00029 #include <set>
00030 
00031 
00032 /// Parser for the skin DTD
00033 class SkinParser: public XMLParser
00034 {
00035     public:
00036         SkinParser( intf_thread_t *pIntf, const string &rFileName,
00037                     const string &rPath, bool useDTD = true,
00038                     BuilderData *pData = NULL );
00039         virtual ~SkinParser();
00040 
00041         const BuilderData &getData() const { return *m_pData; }
00042 
00043         static int convertColor( const char *transcolor );
00044 
00045     private:
00046         /// Path of the theme
00047         const string m_path;
00048         /// Container for mapping data from the XML
00049         BuilderData *m_pData;
00050         /// Indicate whether the class owns the data
00051         bool m_ownData;
00052         /// Current IDs
00053         string m_curBitmapId;
00054         string m_curWindowId;
00055         string m_curLayoutId;
00056         string m_curPopupId;
00057         string m_curListId;
00058         string m_curTreeId;
00059         /// Current position of menu items in the popups
00060         list<int> m_popupPosList;
00061         /// Current offset of the controls
00062         int m_xOffset, m_yOffset;
00063         list<int> m_xOffsetList, m_yOffsetList;
00064         /// Stack of panel ids
00065         list<string> m_panelStack;
00066         /// Layer of the current control in the layout
00067         int m_curLayer;
00068         /// Set of used id
00069         set<string> m_idSet;
00070 
00071         /// Callbacks
00072         virtual void handleBeginElement( const string &rName,
00073                                          AttrList_t &attr );
00074         virtual void handleEndElement( const string &rName );
00075 
00076         /// Helper functions
00077         //@{
00078         bool convertBoolean( const char *value ) const;
00079         /// Transform to int, and check that it is in the given range (if not,
00080         /// the closest range boundary will be used)
00081         int convertInRange( const char *value, int minValue, int maxValue,
00082                             const string &rAttribute ) const;
00083         //@}
00084 
00085         /// Generate a new id
00086         const string generateId() const;
00087 
00088         /// Check if the id is unique, and if not generate a new one
00089         const string uniqueId( const string &id );
00090 };
00091 
00092 #endif

Generated on Wed Aug 13 08:02:38 2008 for VLC by  doxygen 1.5.1