lib Library API Documentation

koTemplateChooseDia.h

00001 /*
00002    This file is part of the KDE project
00003    Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
00004    2000, 2001 Werner Trobin <trobin@kde.org>
00005    2002, 2003 Thomas Nagy <tnagy@eleve.emn.fr>
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public License
00018    along with this library; see the file COPYING.LIB.  If not, write to
00019    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020    Boston, MA 02111-1307, USA.
00021    */
00022 
00023 #ifndef koTemplateChooseDia_h
00024 #define koTemplateChooseDia_h
00025 
00026 #include <kdialogbase.h>
00027 #include <kicondialog.h>
00028 #include <kiconview.h>
00029 
00030 // KoTCD : KoTemplateChooseDia
00031 
00032 class KoTCDIconViewItem;
00033 class KoTemplateTree;
00034 class KoTemplateGroup;
00035 class QGridLayout;
00036 
00041 class KoTCDIconCanvas : public KIconCanvas
00042 {
00043     Q_OBJECT
00044     public:
00045     KoTCDIconCanvas( QWidget *parent = 0, const char *name = 0L )
00046         : KIconCanvas( parent, name ) {}
00047 
00048     bool isCurrentValid() { return currentItem(); }
00049     QIconViewItem * load(KoTemplateGroup *group, const QString& name);
00050 
00051     protected:
00052     virtual void keyPressEvent( QKeyEvent *e ) {
00053         if ( e->key() == Key_Return || e->key() == Key_Enter )
00054         e->ignore();
00055         else
00056         KIconCanvas::keyPressEvent( e );
00057     }
00058 };
00059 
00061 class KoTCDIconViewItem : public KIconViewItem
00062 {
00063     public:
00064     KoTCDIconViewItem(QIconView *parent=0)
00065         : KIconViewItem ( parent )
00066         {}
00067 
00068     KoTCDIconViewItem(QIconView *parent=0, const QString &text=0, const QPixmap &icon=0,
00069                       const QString &descr=0, const QString &fullname=0)
00070         : KIconViewItem(parent, text, icon)
00071         {
00072             m_descr = descr;
00073             m_full = fullname;
00074         }
00075 
00076     QString getDescr() const { return m_descr; }
00077     QString getFName() const { return m_full; }
00078 
00079     private :
00080     QString m_descr;
00081     QString m_full;
00082 
00083 };
00084 
00085 #include <kfileiconview.h>
00086 #include <qlabel.h>
00092 class KoTCDRecentFilesIconView : public KFileIconView {
00093     Q_OBJECT
00094     public:
00095     KoTCDRecentFilesIconView( QWidget* parent, const char* name ) :
00096         KFileIconView( parent, name ), toolTip(0)
00097     {
00098         connect( this, SIGNAL( onItem( QIconViewItem * ) ),
00099                      SLOT( showToolTip( QIconViewItem * ) ) );
00100         connect( this, SIGNAL( onViewport() ),
00101                      SLOT( removeToolTip() ) );
00102     }
00103         virtual ~KoTCDRecentFilesIconView();
00104     protected:
00108         virtual void hideEvent( QHideEvent * );
00109 
00110     private slots:
00111         void showToolTip( QIconViewItem* );
00112         void removeToolTip();
00113     private:
00114         QLabel* toolTip;
00115 };
00116 
00117 class KInstance;
00118 class KoTemplateChooseDiaPrivate;
00119 
00129 class KoTemplateChooseDia : public KDialogBase
00130 {
00131     Q_OBJECT
00132 
00133 public:
00142     enum ReturnType { Cancel, Template, File, Empty };
00149     enum DialogType { Everything, OnlyTemplates, NoTemplates };
00150 
00165     KoTemplateChooseDia(QWidget *parent, const char *name, KInstance* global,
00166         const QCString &format="",
00167         const QString &nativePattern=QString::null,
00168         const QString &nativeName=QString::null,
00169         const DialogType &dialogType=Everything,
00170         const QCString& templateType="");
00171     ~KoTemplateChooseDia();
00172 
00189     static ReturnType choose(KInstance* global, QString &file,
00190         const QCString &format="",
00191         const QString &nativePattern=QString::null,
00192         const QString &nativeName=QString::null,
00193         const DialogType &dialogType=Everything,
00194         const QCString& templateType="");
00195 
00199     QString getTemplate() const;
00203     QString getFullTemplate() const;
00207     ReturnType getReturnType() const;
00211     DialogType getDialogType() const;
00212 
00213 protected slots:
00217     virtual void slotOk();
00218 
00219 private:
00220 
00221     KoTemplateChooseDiaPrivate *d;
00222 
00223     QString descriptionText(const QString &name, const QString &description);
00224     void setupDialog();
00225     void setupTemplateDialog(QWidget * widgetbase, QGridLayout * layout);
00226     void setupFileDialog(QWidget * widgetbase, QGridLayout * layout);
00227     void setupRecentDialog(QWidget * widgetbase, QGridLayout * layout);
00228     bool collectInfo();
00229     bool noStartupDlg() const;
00230 
00231     private slots:
00232 
00233         void chosen(QIconViewItem *);
00234     void currentChanged( QIconViewItem * );
00235     void recentSelected( QIconViewItem * );
00236 };
00237 
00238 #endif
00239 
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Mar 11 11:47:44 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003