• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

Kate

kateschema.h

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, 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 <QtCore/QStringList>
00027 #include <QtCore/QMap>
00028 #include <QtGui/QFont>
00029 
00030 #include <kconfig.h>
00031 #include <kaction.h>
00032 
00033 class KateView;
00034 class KateStyleTreeWidget;
00035 
00036 
00037 class QAction;
00038 class QActionGroup;
00039 class QComboBox;
00040 
00041 namespace Ui { class SchemaConfigColorTab; }
00042 
00043 class KateSchemaManager
00044 {
00045   public:
00046     KateSchemaManager ();
00047     ~KateSchemaManager ();
00048 
00052     void update (bool readfromfile = true);
00053 
00057     KConfigGroup schema (uint number);
00058 
00059     void addSchema (const QString &t);
00060 
00061     void removeSchema (uint number);
00062 
00066     bool validSchema (uint number);
00067     bool validSchema (const QString &name);
00068 
00072     uint number (const QString &name);
00073 
00077     QString name (uint number);
00078 
00082     const QStringList &list () { return m_schemas; }
00083 
00084     static QString normalSchema ();
00085     static QString printingSchema ();
00086 
00087   private:
00088     KConfig m_config;
00089     QStringList m_schemas;
00090 };
00091 
00092 
00093 class KateViewSchemaAction : public KActionMenu
00094 {
00095   Q_OBJECT
00096 
00097   public:
00098     KateViewSchemaAction(const QString& text, QObject *parent)
00099        : KActionMenu(text, parent) { init(); }
00100 
00101     void updateMenu (KateView *view);
00102 
00103   private:
00104     void init();
00105 
00106     QPointer<KateView> m_view;
00107     QStringList names;
00108     QActionGroup *m_group;
00109     int last;
00110 
00111   public  Q_SLOTS:
00112     void slotAboutToShow();
00113 
00114   private Q_SLOTS:
00115     void setSchema();
00116 };
00117 
00118 //
00119 // DIALOGS
00120 //
00121 
00122 class KateSchemaConfigColorTab : public QWidget
00123 {
00124   Q_OBJECT
00125 
00126   public:
00127     KateSchemaConfigColorTab();
00128     ~KateSchemaConfigColorTab();
00129 
00130   private:
00131     // Class for storing the properties on 1 schema.
00132     class SchemaColors {
00133       public:
00134         QColor back, selected, current, bracket, wwmarker, iconborder, tmarker, linenumber;
00135         QMap<int, QColor> markerColors;  // stores all markerColors
00136         QMap<int, QColor> templateColors;
00137     };
00138 
00139     // schemaid=data, created when a schema is entered
00140     QMap<int,SchemaColors> m_schemas;
00141     // current schema
00142     int m_schema;
00143 
00144     Ui::SchemaConfigColorTab* ui;
00145 
00146   public Q_SLOTS:
00147     void apply();
00148     void schemaChanged( int newSchema );
00149 
00150   Q_SIGNALS:
00151     void changed();
00152 
00153   protected Q_SLOTS:
00154     void slotMarkerColorChanged(const QColor&);
00155     void slotComboBoxChanged(int index);
00156 };
00157 
00158 typedef QMap<int,QFont> FontMap; // ### remove it
00159 
00160 class KateSchemaConfigFontTab : public QWidget
00161 {
00162   Q_OBJECT
00163 
00164   public:
00165     KateSchemaConfigFontTab();
00166     ~KateSchemaConfigFontTab();
00167 
00168   public:
00169     void readConfig (KConfig *config);
00170 
00171   public Q_SLOTS:
00172     void apply();
00173     void schemaChanged( int newSchema );
00174 
00175   Q_SIGNALS:
00176     void changed();
00177 
00178   private:
00179     class KFontChooser *m_fontchooser;
00180     FontMap m_fonts;
00181     int m_schema;
00182 
00183   private Q_SLOTS:
00184     void slotFontSelected( const QFont &font );
00185 };
00186 
00187 class KateSchemaConfigFontColorTab : public QWidget
00188 {
00189   Q_OBJECT
00190 
00191   public:
00192     KateSchemaConfigFontColorTab();
00193     ~KateSchemaConfigFontColorTab();
00194 
00195   Q_SIGNALS:
00196     void changed();
00197 
00198   public:
00199     void schemaChanged (uint schema);
00200     void reload ();
00201     void apply ();
00202 
00203     KateAttributeList *attributeList (uint schema);
00204 
00205   private:
00206     KateStyleTreeWidget* m_defaultStyles;
00207     QHash<int,KateAttributeList*> m_defaultStyleLists;
00208 };
00209 
00210 class KateSchemaConfigHighlightTab : public QWidget
00211 {
00212   Q_OBJECT
00213 
00214   public:
00215     explicit KateSchemaConfigHighlightTab(KateSchemaConfigFontColorTab *page = 0, uint hl = 0 );
00216     ~KateSchemaConfigHighlightTab();
00217 
00218     void schemaChanged (int schema);
00219     void reload ();
00220     void apply ();
00221 
00222   Q_SIGNALS:
00223     void changed();
00224 
00225   protected Q_SLOTS:
00226     void hlChanged(int z);
00227 
00228   private:
00229     KateSchemaConfigFontColorTab *m_defaults;
00230 
00231     QComboBox *hlCombo;
00232     KateStyleTreeWidget *m_styles;
00233 
00234     int m_schema;
00235     int m_hl;
00236 
00237     QHash<int, QHash<int, QList<KateExtendedAttribute::Ptr> > > m_hlDict;
00238 };
00239 
00240 class KateSchemaConfigPage : public KateConfigPage
00241 {
00242   Q_OBJECT
00243 
00244   public:
00245     explicit KateSchemaConfigPage ( QWidget *parent, class KateDocument *doc=0 );
00246     ~KateSchemaConfigPage ();
00247 
00248   public Q_SLOTS:
00249     void apply();
00250     void reload();
00251     void reset();
00252     void defaults();
00253 
00254   private Q_SLOTS:
00255     void update ();
00256     void deleteSchema ();
00257     void newSchema ();
00258     void schemaChanged (int schema);
00259 
00260     void newCurrentPage(int);
00261 
00262   private:
00263     int m_lastSchema;
00264     int m_defaultSchema;
00265 
00266     class QTabWidget *m_tabWidget;
00267     class QPushButton *btndel;
00268     class QComboBox *defaultSchemaCombo;
00269     class QComboBox *schemaCombo;
00270     KateSchemaConfigColorTab *m_colorTab;
00271     KateSchemaConfigFontTab *m_fontTab;
00272     KateSchemaConfigFontColorTab *m_fontColorTab;
00273     KateSchemaConfigHighlightTab *m_highlightTab;
00274 };
00275 
00276 #endif
00277 
00278 // kate: space-indent on; indent-width 2; replace-tabs on;

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal