summaryrefslogtreecommitdiffstats
path: root/adept/libadept/taglist.h
blob: 070e93aa121d46d4b7c13ad7cd52df753cf5e417 (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
/** -*- C++ -*-
	@file adept/taglist.h
	@author Peter Rockai <me@mornfall.net>
*/

#include <tqvbox.h>
#include <tqhbox.h>
#include <tqlabel.h>
#include <layout.h>
#include <tqpushbutton.h>
#include <kiconloader.h>
#include <vector>

#include <apt-front/cache/entity/tag.h>

#ifndef EPT_TAGLIST_H
#define EPT_TAGLIST_H

class TQLabel;

namespace adept {

using namespace aptFront;

class TagList;

class TagLabel : public TQHBox
{
    Q_OBJECT
  TQ_OBJECT
public:
    typedef cache::entity::Tag Tag;
    TagLabel( Tag t, TagList *l, TQWidget *p = 0, const char *n = 0 );
    Tag tag() { return m_tag; }
protected:
    void mouseReleaseEvent( TQMouseEvent *e );
    Tag m_tag;
    TQLabel *m_remove;
    TQLabel *m_description;
    TagList *m_list;
};

class TagList : public TQVBox
{
    Q_OBJECT
  TQ_OBJECT
public:
    typedef cache::entity::Tag Tag;
    TagList( TQWidget *p = 0, const char *n = 0 );
    void setTags( Tag::Set t );
    void addTag( Tag t );
    Tag::Set tags() { return m_tags; }
    void setName( TQString n );
public slots:
    void scheduleUpdateList();
    void updateList();
signals:
    void tagsChanged( TagList::Tag::Set );
protected:
    void mouseMoveEvent( TQMouseEvent *e );
    void dropEvent( TQDropEvent * );
    void dragEnterEvent( TQDragEnterEvent * );
    void appendLabel( TagLabel * );
    void clearList();

    bool m_updateScheduled;
    Tag::Set m_tags;
    TQLabel *m_name;
    TQVBox *m_tagBox;
    TQSpacerItem *m_tagSpacer;
    typedef std::vector< TagLabel * > List;
    List m_list;
};

}

#endif