fix UI initialization, it runs, baby\!
[duncan/yast2-web-wt.git] / src / Y2CCWeb.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       Y2CCWeb.h
14
15   Author:     Mathias Kettner <kettner@suse.de>
16   Maintainer: Stefan Hundhammer <sh@suse.de>
17
18 /-*/
19
20
21
22 #ifndef _Y2CCWeb_h
23 #define _Y2CCWeb_h
24
25 #include "YWebUIComponent.h"
26
27 /**
28  * @short Y2ComponentCreator that can create Wt user interfaces
29  * A Y2ComponentCreator is an object, that can create components.
30  * It is given a component name and - if it knows how to create
31  * such a component - returns a newly created component of this
32  * type. The Y2CCWeb can create components with the name "web".
33  */
34 class Y2CCWeb : public Y2ComponentCreator
35 {
36 public:
37     /**
38      * Creates a Web component creator
39      */
40     Y2CCWeb() : Y2ComponentCreator(Y2ComponentBroker::BUILTIN) { };
41
42     /**
43      * Returns true, since the qt component is a
44      * YaST2 server.
45      */
46     bool isServerCreator() const { return true; };
47
48     /**
49      * Creates a new Qt UI component.
50      */
51     Y2Component *create(const char * name) const
52     {
53         if (!strcmp(name, "web") )
54         {
55             Y2Component* ret = YUIComponent::uiComponent ();
56             if (!ret || ret->name () != name)
57             {
58                 ret = new YWebUIComponent();
59             }
60             return ret;
61         }
62         else
63             return 0;
64     }
65 };
66
67 #endif  // ifndef _Y2CCWeb_h
68
69
70 // EOF