kurlbar.h
/* This file is part of the KDE libraries
Copyright (C) 2001,2002,2003 Carsten Pfeiffer <pfeiffer@kde.org>
library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation, version 2.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KURLBAR_H
#define KURLBAR_H
#include <qevent.h>
#include <qframe.h>
#include <qtooltip.h>
#include <kdialogbase.h>
#include <kicontheme.h>
#include <klistbox.h>
#include <kurl.h>
class KConfig;
class KURLBar;
class KIO_EXPORT KURLBarItem : public QListBoxPixmap
{
public:
KURLBarItem( KURLBar *parent, const KURL& url, bool persistent,
const QString& description = QString::null,
const QString& icon = QString::null,
KIcon::Group group = KIcon::Panel );
KURLBarItem( KURLBar *parent, const KURL& url,
const QString& description = QString::null,
const QString& icon = QString::null,
KIcon::Group group = KIcon::Panel );
~KURLBarItem();
void setURL( const KURL& url );
void setIcon( const QString& icon, KIcon::Group group = KIcon::Panel );
void setDescription( const QString& desc );
void setToolTip( const QString& tip );
QSize sizeHint() const;
virtual int width( const QListBox * ) const;
virtual int height( const QListBox * ) const;
const KURL& url() const { return m_url; }
const QString& description() const { return m_description; }
const QString& icon() const { return m_icon; }
QString toolTip() const;
KIcon::Group iconGroup() const { return m_group; }
virtual const QPixmap * pixmap() const { return &m_pixmap; }
void setApplicationLocal( bool local );
bool applicationLocal() const { return m_appLocal; }
bool isPersistent() const;
protected:
virtual void paint( QPainter *p );
private:
int iconSize() const;
void init( const QString& icon, KIcon::Group group,
const QString& description, bool persistent );
KURL m_url;
QString m_description;
QString m_icon;
QString m_toolTip;
QPixmap m_pixmap;
KIcon::Group m_group;
KURLBar *m_parent;
bool m_appLocal :1;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KURLBarItemPrivate;
KURLBarItemPrivate *d;
};
class KURLBarListBox;
class KIO_EXPORT KURLBar : public QFrame
{
Q_OBJECT
public:
KURLBar( bool useGlobalItems,
QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
~KURLBar();
virtual KURLBarItem * insertItem( const KURL& url,
const QString& description,
bool applicationLocal = true,
const QString& icon = QString::null,
KIcon::Group group = KIcon::Panel );
virtual KURLBarItem * insertDynamicItem( const KURL& url,
const QString& description,
const QString& icon = QString::null,
KIcon::Group group = KIcon::Panel );
virtual void setOrientation( Qt::Orientation orient );
Orientation orientation() const;
virtual void setListBox( KURLBarListBox * );
KURLBarListBox *listBox() const { return m_listBox; }
virtual void setIconSize( int size );
int iconSize() const { return m_iconSize; }
virtual void clear();
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
virtual void readConfig( KConfig *config, const QString& itemGroup );
virtual void writeConfig( KConfig *config, const QString& itemGroup );
virtual void readItem( int i, KConfig *config, bool applicationLocal );
virtual void writeItem( KURLBarItem *item, int i, KConfig *, bool global );
KURLBarItem * currentItem() const;
KURL currentURL() const;
bool isModified() const { return m_isModified; }
bool isImmutable() const { return m_isImmutable; }
bool isVertical() const { return orientation() == Vertical; }
public slots:
virtual void setCurrentItem( const KURL& url );
signals:
void activated( const KURL& url );
protected:
virtual bool addNewItem();
virtual bool editItem( KURLBarItem *item );
virtual void resizeEvent( QResizeEvent * );
virtual void paletteChange( const QPalette & );
KURLBarItem * m_activeItem;
bool m_useGlobal :1;
bool m_isModified :1;
bool m_isImmutable :1;
protected slots:
virtual void slotContextMenuRequested( QListBoxItem *, const QPoint& pos );
virtual void slotSelected( QListBoxItem * );
virtual void slotDropped( QDropEvent * );
private slots:
void slotSelected( int button, QListBoxItem * );
private:
KURLBarListBox *m_listBox;
int m_iconSize;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KURLBarPrivate;
KURLBarPrivate *d;
};
class QDragObject;
class KURLBarToolTip;
class KIO_EXPORT KURLBarListBox : public KListBox
{
Q_OBJECT
public:
KURLBarListBox( QWidget *parent = 0, const char *name = 0 );
~KURLBarListBox();
virtual void setOrientation( Qt::Orientation orient );
Qt::Orientation orientation() const { return m_orientation; }
bool isVertical() const { return m_orientation == Qt::Vertical; }
signals:
void dropped( QDropEvent *e );
protected:
virtual QDragObject * dragObject();
virtual void contentsDragEnterEvent( QDragEnterEvent * );
virtual void contentsDropEvent( QDropEvent * );
virtual void contextMenuEvent( QContextMenuEvent * );
virtual void paintEvent( QPaintEvent* );
private:
Qt::Orientation m_orientation;
KURLBarToolTip *m_toolTip;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KURLBarListBoxPrivate;
KURLBarListBoxPrivate *d;
};
class QCheckBox;
class KIconButton;
class KLineEdit;
class KURLRequester;
class KIO_EXPORT KURLBarItemDialog : public KDialogBase
{
Q_OBJECT
public:
static bool getInformation( bool allowGlobal, KURL& url,
QString& description, QString& icon,
bool& appLocal, int iconSize,
QWidget *parent = 0 );
KURLBarItemDialog( bool allowGlobal, const KURL& url,
const QString& description, QString icon,
bool appLocal = true,
int iconSize = KIcon::SizeMedium,
QWidget *parent = 0, const char *name = 0 );
~KURLBarItemDialog();
KURL url() const;
QString description() const;
QString icon() const;
bool applicationLocal() const;
protected:
KURLRequester * m_urlEdit;
KLineEdit * m_edit;
KIconButton * m_iconButton;
QCheckBox * m_appLocal;
public slots:
void urlChanged(const QString & );
private:
class KURLBarItemDialogPrivate;
KURLBarItemDialogPrivate *d;
};
#endif // KURLBAR_H
KURLBarItem::url
const KURL & url() const
returns the url of this item.
Definition: kurlbar.h:127
KURLBarItemDialog::m_iconButton
KIconButton * m_iconButton
The KIconButton to configure the icon.
Definition: kurlbar.h:645
KURLBar::isImmutable
bool isImmutable() const
Definition: kurlbar.h:380
KURLBar::iconSize
int iconSize() const
Definition: kurlbar.h:311
KURLBarItem::icon
const QString & icon() const
returns the icon of this item.
Definition: kurlbar.h:137
KIconButton
A pushbutton for choosing an icon.
Definition: kicondialog.h:257
KURLBarItem::pixmap
virtual const QPixmap * pixmap() const
returns the pixmap of this item.
Definition: kurlbar.h:151
KURLBarItem::description
const QString & description() const
returns the description of this item.
Definition: kurlbar.h:132
KURLBar::isVertical
bool isVertical() const
Definition: kurlbar.h:385
KURLBarItem::iconGroup
KIcon::Group iconGroup() const
returns the icon-group of this item (determines icon-effects).
Definition: kurlbar.h:147
KURLBar
KURLBar is a widget that displays icons together with a description.
Definition: kurlbar.h:230
KURLBar::listBox
KURLBarListBox * listBox() const
Definition: kurlbar.h:298
KURLBarItemDialog::m_edit
KLineEdit * m_edit
The KLineEdit used for editing the description.
Definition: kurlbar.h:641
KURLRequester
This class is a widget showing a lineedit and a button, which invokes a filedialog.
Definition: kurlrequester.h:56
KURLBarItemDialog::m_appLocal
QCheckBox * m_appLocal
The QCheckBox to modify the local/global setting.
Definition: kurlbar.h:649
KURLBarItem
An item to be used in KURLBar / KURLBarListBox.
Definition: kurlbar.h:42
KURLBarListBox::orientation
Qt::Orientation orientation() const
Definition: kurlbar.h:518
KURLBarItemDialog::m_urlEdit
KURLRequester * m_urlEdit
The KURLRequester used for editing the url.
Definition: kurlbar.h:637
KURLBarItem::applicationLocal
bool applicationLocal() const
returns whether this is a global item or a local one.
Definition: kurlbar.h:167
KURLBarItemDialog
A dialog that allows editing entries of a KURLBar ( KURLBarItem).
Definition: kurlbar.h:567
KURLBar::m_activeItem
KURLBarItem * m_activeItem
The currently active item.
Definition: kurlbar.h:426
KURLBar::isModified
bool isModified() const
Definition: kurlbar.h:375
KURLBarListBox
This is the listbox used in KURLBar.
Definition: kurlbar.h:493

KDE Home | KDE Accessibility Home | Description of Access Keys