summaryrefslogtreecommitdiffstats
path: root/quanta/dialogs/tagdialogs/tagattr.h
blob: bbd562c6c152603b262cebe92063c7dbe37225e9 (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/***************************************************************************
                          tagxml.h  -  description
                             -------------------
    begin                : ����25 14:34:07 EEST 2000
    copyright            : (C) 2000 by Dmitry Poplavsky & Alexander Yakovlev <pdima@users.sourceforge.net,yshurik@linuxfan.com>
                           (C) 2004 Andras Mantia <amantia@kde.org>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef TAGATTR_H
#define TAGATTR_H

//qt includes
#include <tqstring.h>
#include <tqcheckbox.h>
#include <tqcombobox.h>
#include <tqdom.h>

//kde includes
#include <klineedit.h>
#include <kurl.h>

//app includes
#include "colorcombo.h"
#include "filecombo.h"

class TQDomElement;
class TQWidget;
class QTag;


TQDomNode findChild( TQDomNode &parent, const TQString &name );


class Attr
{
  public:
    Attr( TQDomElement const& el, TQWidget *, QTag *dtdTag )
    : domEl(el), name(domEl.attribute("name","")), m_dtdTag(dtdTag) {}
    //{ domEl = el; name = domEl->attribute("name",""); m_dtdTag = dtdTag;}
    virtual ~Attr(){}

    virtual TQString value()=0;
    virtual void setValue(const TQString &value)=0;

    TQString attrName() const;
    TQDomElement const& domElement() const { return domEl; }

  protected:
     TQDomElement domEl;
     TQString name;
     QTag *m_dtdTag;
};


class Attr_line : public Attr
{
  protected:
    TQLineEdit *line;

  public:
    Attr_line( TQDomElement const& el, TQWidget *w, QTag *dtdTag ) : Attr(el, w, dtdTag)
        {  line = (TQLineEdit *)w; }
    virtual ~Attr_line(){};

    virtual TQString value() { return line->text(); }
    virtual void setValue(const TQString &value) { line->setText(value); }
};


class Attr_color : public Attr
{
  protected:
    ColorCombo *color;

  public:
    Attr_color( TQDomElement const& el, TQWidget *w, QTag *dtdTag ) : Attr(el, w, dtdTag)
        { color = (ColorCombo *)w; }
    virtual ~Attr_color(){};

    virtual TQString value() {  return color->colorName(); }
    virtual void setValue(const TQString &value) { color->setColorName(value); }
};

class Attr_file : public Attr
{
  protected:
    FileCombo *file;

  public:
    Attr_file( TQDomElement const& el, TQWidget *w , QTag * dtdTag ) : Attr(el, w, dtdTag)
        { file = (FileCombo *)w; }
    virtual ~Attr_file(){};

    virtual TQString value() {  return file->text(); }
    virtual void setValue(const TQString &value) { file->setText(value); }
};

class Attr_list : public Attr
{
  protected:
    TQComboBox *combo;

  public:
    Attr_list( TQDomElement const& el, TQWidget *w, QTag *dtdTag );
    virtual ~Attr_list(){};

    virtual TQString value() { return combo->currentText(); }
    virtual void setValue(const TQString &value);
};


class Attr_check : public Attr
{
  protected:
    TQCheckBox *check;

  public:
    Attr_check( TQDomElement const& el, TQWidget *w, QTag *dtdTag ) : Attr(el, w, dtdTag)
        { check = (TQCheckBox *)w; }
    virtual ~Attr_check(){};

    virtual TQString value() { return check->isChecked() ? "checked" : "unchecked" ; }
    virtual void setValue(const TQString &value) { check->setChecked( !value.isEmpty() ); }
};



#endif