summaryrefslogtreecommitdiffstats
path: root/libksirtet/base/factory.h
blob: 22db765aa9f65cc76de237a1f6079673172bea7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef BASE_FACTORY_H
#define BASE_FACTORY_H

#include <tqglobal.h>

#include <kdemacros.h>

struct MainData {
    const char *appName, *trName, *description, *homepage, *removedLabel,
        *version, *longVersion;
};

struct BaseBoardInfo {
    uint width, height;
    bool withPieces;

    uint beforeRemoveTime, afterRemoveTime;
    uint nbToggles, nbFallStages;

    uint nbArcadeStages;

    const uint *histogram;
    uint histogramSize;
    bool scoreBound;
};

class BaseBoard;
class BaseInterface;
class TQWidget;
class TDEAboutData;

#define bfactory BaseFactory::self()

class TDE_EXPORT BaseFactory
{
 public:
    BaseFactory(const MainData &, const BaseBoardInfo &);
    virtual ~BaseFactory();
    void init(int argc, char **argv);

    static BaseFactory *self() { return _self; }

    const MainData      &mainData;
    const BaseBoardInfo &bbi;

    virtual BaseBoard *createBoard(bool graphic, TQWidget *parent) = 0;
    virtual BaseInterface *createInterface(TQWidget *parent) = 0;

    virtual TQWidget *createAppearanceConfig();
    virtual TQWidget *createColorConfig();
    virtual TQWidget *createGameConfig() { return 0; }
 
 protected:
    TDEAboutData *_aboutData;

 private:
    static BaseFactory *_self;
};

#endif