kate Library API Documentation

kateschema.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2001-2003 Christoph Cullmann <cullmann@kde.org>
00003    Copyright (C) 2002, 2003 Anders Lund <anders.lund@lund.tdcadsl.dk>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef __KATE_SCHEMA_H__
00021 #define __KATE_SCHEMA_H__
00022 
00023 #include "katehighlight.h"
00024 #include "katedialogs.h"
00025 
00026 #include <qstringlist.h>
00027 #include <qintdict.h>
00028 #include <qlistview.h>
00029 
00030 #include <kconfig.h>
00031 #include <kaction.h>
00032 
00033 class KateView;
00034 class KateStyleListItem;
00035 
00036 class KColorButton;
00037 
00038 class QPopupMenu;
00039 
00040 class KateSchemaManager
00041 {
00042   public:
00043     KateSchemaManager ();
00044     ~KateSchemaManager ();
00045 
00049     void update (bool readfromfile = true);
00050 
00054     KConfig *schema (uint number);
00055 
00056     void addSchema (const QString &t);
00057 
00058     void removeSchema (uint number);
00059 
00063     bool validSchema (uint number);
00064 
00068     uint number (const QString &name);
00069 
00073     QString name (uint number);
00074 
00078     const QStringList &list () { return m_schemas; }
00079 
00080     static QString normalSchema ();
00081     static QString printingSchema ();
00082 
00083   private:
00084     KConfig m_config;
00085     QStringList m_schemas;
00086 };
00087 
00088 
00089 class KateViewSchemaAction : public KActionMenu
00090 {
00091   Q_OBJECT
00092 
00093   public:
00094     KateViewSchemaAction(const QString& text, QObject* parent = 0, const char* name = 0)
00095        : KActionMenu(text, parent, name) { init(); };
00096 
00097     ~KateViewSchemaAction(){;};
00098 
00099     void updateMenu (KateView *view);
00100 
00101   private:
00102     void init();
00103 
00104     QGuardedPtr<KateView> m_view;
00105     QStringList names;
00106     int last;
00107 
00108   public  slots:
00109     void slotAboutToShow();
00110 
00111   private slots:
00112     void setSchema (int mode);
00113 };
00114 
00115 //
00116 // DIALOGS
00117 //
00118 
00119 /*
00120     QListView that automatically adds columns for KateStyleListItems and provides a
00121     popup menu and a slot to edit a style using the keyboard.
00122     Added by anders, jan 23 2002.
00123 */
00124 class KateStyleListView : public QListView
00125 {
00126   Q_OBJECT
00127 
00128   friend class KateStyleListItem;
00129 
00130   public:
00131     KateStyleListView( QWidget *parent=0, bool showUseDefaults=false);
00132     ~KateStyleListView() {};
00133     /* Display a popupmenu for item i at the specified global position, eventually with a title,
00134        promoting the context name of that item */
00135     void showPopupMenu( KateStyleListItem *i, const QPoint &globalPos, bool showtitle=false );
00136     void emitChanged() { emit changed(); };
00137 
00138     void setBgCol( const QColor &c ) { bgcol = c; }
00139     void setSelCol( const QColor &c ) { selcol = c; }
00140     void setNormalCol( const QColor &c ) { normalcol = c; }
00141 
00142   private slots:
00143     /* Display a popupmenu for item i at item position */
00144     void showPopupMenu( QListViewItem *i );
00145     /* call item to change a property, or display a menu */
00146     void slotMousePressed( int, QListViewItem*, const QPoint&, int );
00147     /* asks item to change the property in q */
00148     void mSlotPopupHandler( int z );
00149 
00150   signals:
00151     void changed();
00152 
00153   private:
00154     QColor bgcol, selcol, normalcol;
00155     QFont docfont;
00156 };
00157 
00158 class KateSchemaConfigColorTab : public QWidget
00159 {
00160   Q_OBJECT
00161 
00162   public:
00163     KateSchemaConfigColorTab( QWidget *parent = 0, const char *name = 0 );
00164     ~KateSchemaConfigColorTab();
00165 
00166   private:
00167     KColorButton *m_back;
00168     KColorButton *m_selected;
00169     KColorButton *m_current;
00170     KColorButton *m_bracket;
00171     KColorButton *m_wwmarker;
00172     KColorButton *m_iconborder;
00173     KColorButton *m_tmarker;
00174 
00175   public:
00176     void readConfig (KConfig *config);
00177     void writeConfig (KConfig *config);
00178 };
00179 
00180 class KateSchemaConfigFontTab : public QWidget
00181 {
00182   Q_OBJECT
00183 
00184   public:
00185     KateSchemaConfigFontTab( QWidget *parent = 0, const char *name = 0 );
00186     ~KateSchemaConfigFontTab();
00187 
00188   public:
00189     void readConfig (KConfig *config);
00190     void writeConfig (KConfig *config);
00191 
00192   private:
00193     class KFontChooser *m_fontchooser;
00194     QFont myFont;
00195 
00196   private slots:
00197     void slotFontSelected( const QFont &font );
00198 };
00199 
00200 class KateSchemaConfigFontColorTab : public QWidget
00201 {
00202   Q_OBJECT
00203 
00204   public:
00205     KateSchemaConfigFontColorTab( QWidget *parent = 0, const char *name = 0 );
00206     ~KateSchemaConfigFontColorTab();
00207 
00208   public:
00209     void schemaChanged (uint schema);
00210     void reload ();
00211     void apply ();
00212 
00213     KateAttributeList *attributeList (uint schema);
00214 
00215   private:
00216     KateStyleListView *m_defaultStyles;
00217     QIntDict<KateAttributeList> m_defaultStyleLists;
00218 };
00219 
00220 class KateSchemaConfigHighlightTab : public QWidget
00221 {
00222   Q_OBJECT
00223 
00224   public:
00225     KateSchemaConfigHighlightTab( QWidget *parent = 0, const char *name = 0, KateSchemaConfigFontColorTab *page = 0 );
00226     ~KateSchemaConfigHighlightTab();
00227 
00228   public:
00229     void schemaChanged (uint schema);
00230     void reload ();
00231     void apply ();
00232 
00233   protected slots:
00234     void hlChanged(int z);
00235 
00236   private:
00237     KateSchemaConfigFontColorTab *m_defaults;
00238 
00239     QComboBox *hlCombo;
00240     KateStyleListView *m_styles;
00241 
00242     uint m_schema;
00243     int m_hl;
00244 
00245     QIntDict< QIntDict<ItemDataList> > m_hlDict;
00246 };
00247 
00248 class KateSchemaConfigPage : public KateConfigPage
00249 {
00250   Q_OBJECT
00251 
00252   public:
00253     KateSchemaConfigPage ( QWidget *parent );
00254     ~KateSchemaConfigPage ();
00255 
00256   public slots:
00257     void apply();
00258     void reload();
00259     void reset();
00260     void defaults();
00261 
00262   private slots:
00263     void update ();
00264     void deleteSchema ();
00265     void newSchema ();
00266     void schemaChanged (int schema);
00267 
00268     void newCurrentPage (QWidget *w);
00269 
00270   private:
00271     int m_lastSchema;
00272     class QTabWidget *m_tabWidget;
00273     class QPushButton *btndel;
00274     class QComboBox *defaultSchemaCombo;
00275     class QComboBox *schemaCombo;
00276     KateSchemaConfigColorTab *m_colorTab;
00277     KateSchemaConfigFontTab *m_fontTab;
00278     KateSchemaConfigFontColorTab *m_fontColorTab;
00279     KateSchemaConfigHighlightTab *m_highlightTab;
00280 };
00281 
00282 #endif
00283 
00284 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE Logo
This file is part of the documentation for kate Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed May 5 07:22:34 2004 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003