summaryrefslogtreecommitdiffstats
path: root/k9author/k9menubutton.h
blob: 20ebcd59c7f091f0a002f5479b359f69edb302bc (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//
// C++ Interface: k9menubutton
//
// Description:
//
//
// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef K9MENUBUTTON_H
#define K9MENUBUTTON_H

#include <tqobject.h>
#include <tqpixmap.h>
#include <tqimage.h>
#include <tqcanvas.h>

/**
	@author Jean-Michel PETIT <k9copy@free.fr>
*/
class k9MenuButton;
class k9CanvasSprite : public TQCanvasSprite {
public:
    k9CanvasSprite (TQCanvasPixmapArray *a,TQCanvas *canvas,k9MenuButton *button);
    virtual int rtti() const {
        return 1000;
    }
    void update();

    k9MenuButton* getButton() const;

private:
    k9MenuButton *m_button;
};


class k9MenuButton : public TQObject {
    Q_OBJECT
  
public:
    enum eTextPosition {BOTTOM=1,RIGHT=2};

    k9MenuButton(TQCanvas *parent = 0, const char *name = 0);

    ~k9MenuButton();
    void setWidth(int _value,bool _reload=true);
    int getWidth();
    void setHeight(int _value,bool _reload=true);
    int getHeight();
    void setTop(int _value,bool _reload=true);
    void setLeft(int _value,bool _reload=true);
    void setFont(TQFont _font);
    TQFont getFont();
    void setColor(TQColor _color);
    TQColor getColor();
    void setText(TQString _text);
    TQString getText();
    void select(bool);
    int getTop();
    int getLeft();

    void moveBy(int x,int y,bool _reload=true);
    void update();
public slots:
    void setImage(const TQImage &_image);
    void setImage(const TQString &_fileName);

    void setTextPosition(const eTextPosition& _value);
    eTextPosition getTextPosition() const;

    TQImage getImage() const;

    void setScript(const TQString& _value);
    TQString getScript() const;

    void setAngle(int _value);
    int getAngle() const;

	k9CanvasSprite* getSprite() const;

	void setNum(int _value);
	

	int getNum() const;
	
	

private:
    TQCanvas *m_canvas;
    TQCanvasPixmapArray m_pixmapArray;
    TQCanvasPixmap *m_pixmap;
    k9CanvasSprite *m_sprite;
    int m_num;
    TQCanvasText *m_text;
    TQImage m_image;
    int  m_width;
    int m_height;
    int m_angle;
    eTextPosition m_textPosition;
    TQString m_script;
    void loadImage();
signals:
    void sigsetTop(int);
    void sigsetLeft(int);
    void sigsetWidth(int);
    void sigsetHeight(int);

    void sigsetFont(const TQFont &);
    void sigsetColor(const TQColor &);
    void sigsetImage(k9MenuButton *,const TQImage &);
    void sigsetText(const TQString &);
    void sigsetTextPosition(int);
};

#endif