]> git.sesse.net Git - vlc/blob - modules/gui/skins2/parser/builder.hpp
* all: first implementation of skinnable vouts (X11 only)
[vlc] / modules / gui / skins2 / parser / builder.hpp
1 /*****************************************************************************
2  * builder.hpp
3  *****************************************************************************
4  * Copyright (C) 2003 VideoLAN
5  * $Id$
6  *
7  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
8  *          Olivier Teulière <ipkiss@via.ecp.fr>
9  *
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.
14  *
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.
19  *
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  *****************************************************************************/
24
25 #ifndef BUILDER_HPP
26 #define BUILDER_HPP
27
28 #include "builder_data.hpp"
29 #include "../src/os_graphics.hpp"
30 #include "../src/generic_window.hpp"
31 #include "../src/generic_layout.hpp"
32 #include "../src/generic_bitmap.hpp"
33 #include "../src/generic_font.hpp"
34 #include "../commands/cmd_generic.hpp"
35 #include "../controls/ctrl_generic.hpp"
36 #include "../utils/bezier.hpp"
37
38 #include <string>
39 #include <list>
40 #include <map>
41
42 class Theme;
43
44
45 /// Class for skin construction
46 class Builder: public SkinObject
47 {
48     public:
49         Builder( intf_thread_t *pIntf, const BuilderData &rData );
50         virtual ~Builder() {}
51
52         /// Create a Theme object, ready to use.
53         /// Return NULL in case of problem
54         Theme *build();
55
56         /// Parse an action tag and returns a command
57         CmdGeneric *parseAction( const string &rAction );
58
59     private:
60         /// Data from the XML
61         const BuilderData &m_rData;
62
63         /// Theme under construction
64         Theme *m_pTheme;
65
66         void addTheme( const BuilderData::Theme &rData );
67         void addBitmap( const BuilderData::Bitmap &rData );
68         void addFont( const BuilderData::Font &rData );
69         void addWindow( const BuilderData::Window &rData );
70         void addLayout( const BuilderData::Layout &rData );
71         void addAnchor( const BuilderData::Anchor &rData );
72         void addButton( const BuilderData::Button &rData );
73         void addCheckbox( const BuilderData::Checkbox &rData );
74         void addImage( const BuilderData::Image &rData );
75         void addText( const BuilderData::Text &rData );
76         void addRadialSlider( const BuilderData::RadialSlider &rData );
77         void addSlider( const BuilderData::Slider &rData );
78         void addList( const BuilderData::List &rData );
79         void addVideo( const BuilderData::Video &rData );
80
81        /// Compute the position of a control
82         const Position makePosition( const string &rLeftTop,
83                                      const string &rRightBottom,
84                                      int xPos, int yPos, int width, int height,
85                                      const Box &rBox ) const;
86
87         /// Function to parse "points" tags
88         Bezier *getPoints( const char *pTag ) const;
89 };
90
91 #endif
92