Logo Search packages:      
Sourcecode: adept version File versions  Download package

tagchooser.h

/* -*- C++ -*- file adept/tagchooser.h
   written by Peter Rockai <me@mornfall.net> */

#include <kdebug.h>
#include <qlayout.h>

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

#include <adept/extendablelist.h>

#ifndef EPT_TAGCHOOSER_H
#define EPT_TAGCHOOSER_H

namespace adept {

using namespace aptFront;

class FacetItem;
class FacetExtender;
class TagChooser;

class TagItem : public KListViewItem {
public:
    typedef cache::entity::Tag Tag;
    virtual QString text( int ) const;
    TagItem( TagChooser *t );
    TagItem( FacetItem *t );
    void setTag( Tag t ) { m_tag = t; }
    Tag tag() { return m_tag; }
protected:
    bool m_toplevel;
    Tag m_tag;
};

class FacetItem : public KListViewItem
{
public:
    typedef cache::entity::Facet Facet;
    virtual QString text( int ) const;
    FacetItem( TagChooser *t );
    void setFacet( Facet f ) { m_facet = f; }
    void removeTag( TagItem::Tag );
protected:
    Facet m_facet;
};

class TagChooser : public KListView, public cache::Observer // ExtendableList
{ 
    Q_OBJECT
public:
    typedef cache::entity::Tag Tag;
    typedef cache::entity::Facet Facet;
    TagChooser( QWidget *p = 0, const char *n = 0 );
    virtual void notifyPreRebuild( cache::component::Base * );
public slots:
    virtual void setTags( TagChooser::Tag::Set );
    void setTitle( QString s ) {
        setColumnText( 0, s );
    }
    void openToplevel();

protected:
    virtual void dragEnterEvent( QDragEnterEvent *e );
    virtual void dropEvent( QDropEvent* e );
    virtual void contentsDragEnterEvent( QDragEnterEvent *e ) {
        kdDebug() << "TagChooser::contentsDragEnterEvent" << endl;
        dragEnterEvent( e );
    }
    virtual void contentsDropEvent( QDropEvent *e ) {
        kdDebug() << "TagChooser::contentsDropEvent" << endl;
        dropEvent( e );
    }
    virtual QDragObject *dragObject();
    Tag::Set m_tags;
    std::map< Facet, FacetItem * > m_facets;
};

}

#endif

Generated by  Doxygen 1.6.0   Back to index