| # kate Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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 <qmap.h>
    00029 #include <qlistview.h>
    00030 #include <qfont.h>
    00031
    00032 #include <kconfig.h>
    00033 #include <kaction.h>
    00034
    00035 class KateView;
    00036 class KateStyleListItem;
    00037 class KateStyleListCaption;
    00038
    00039 class KColorButton;
    00040
    00041 class QPopupMenu;
    00042 class KComboBox;
    00043
    00044 class KateSchemaManager
    00045 {
    00046   public:
    00047     KateSchemaManager ();
    00048     ~KateSchemaManager ();
    00049
    00053     void update (bool readfromfile = true);
    00054
    00058     KConfig *schema (uint number);
    00059
    00060     void addSchema (const QString &t);
    00061
    00062     void removeSchema (uint number);
    00063
    00067     bool validSchema (uint number);
    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 = 0, const char* name = 0)
    00099        : KActionMenu(text, parent, name) { init(); };
    00100
    00101     ~KateViewSchemaAction(){;};
    00102
    00103     void updateMenu (KateView *view);
    00104
    00105   private:
    00106     void init();
    00107
    00108     QGuardedPtr<KateView> m_view;
    00109     QStringList names;
    00110     int last;
    00111
    00112   public  slots:
    00113     void slotAboutToShow();
    00114
    00115   private slots:
    00116     void setSchema (int mode);
    00117 };
    00118
    00119 //
    00120 // DIALOGS
    00121 //
    00122
    00123 /*
    00124     QListView that automatically adds columns for KateStyleListItems and provides a
    00125     popup menu and a slot to edit a style using the keyboard.
    00126     Added by anders, jan 23 2002.
    00127 */
    00128 class KateStyleListView : public QListView
    00129 {
    00130   Q_OBJECT
    00131
    00132   friend class KateStyleListItem;
    00133
    00134   public:
    00135     KateStyleListView( QWidget *parent=0, bool showUseDefaults=false);
    00136     ~KateStyleListView() {};
    00137     /* Display a popupmenu for item i at the specified global position, eventually with a title,
    00138        promoting the context name of that item */
    00139     void showPopupMenu( KateStyleListItem *i, const QPoint &globalPos, bool showtitle=false );
    00140     void emitChanged() { emit changed(); };
    00141
    00142     void setBgCol( const QColor &c ) { bgcol = c; }
    00143     void setSelCol( const QColor &c ) { selcol = c; }
    00144     void setNormalCol( const QColor &c ) { normalcol = c; }
    00145
    00146   private slots:
    00147     /* Display a popupmenu for item i at item position */
    00148     void showPopupMenu( QListViewItem *i, const QPoint &globalPos );
    00149     /* call item to change a property, or display a menu */
    00150     void slotMousePressed( int, QListViewItem*, const QPoint&, int );
    00151     /* asks item to change the property in q */
    00152     void mSlotPopupHandler( int z );
    00153     void unsetColor( int );
    00154
    00155   signals:
    00156     void changed();
    00157
    00158   private:
    00159     QColor bgcol, selcol, normalcol;
    00160     QFont docfont;
    00161 };
    00162
    00163 class KateSchemaConfigColorTab : public QWidget
    00164 {
    00165   Q_OBJECT
    00166
    00167   public:
    00168     KateSchemaConfigColorTab( QWidget *parent = 0, const char *name = 0 );
    00169     ~KateSchemaConfigColorTab();
    00170
    00171   private:
    00172     KColorButton *m_back;
    00173     KColorButton *m_selected;
    00174     KColorButton *m_current;
    00175     KColorButton *m_bracket;
    00176     KColorButton *m_wwmarker;
    00177     KColorButton *m_iconborder;
    00178     KColorButton *m_tmarker;
    00179     KColorButton *m_linenumber;
    00180
    00181     KColorButton *m_markers;           // bg color for current selected marker
    00182     KComboBox* m_combobox;             // switch marker type
    00183
    00184     // Class for storing the properties on 1 schema.
    00185     class SchemaColors {
    00186       public:
    00187         QColor back, selected, current, bracket, wwmarker, iconborder, tmarker, linenumber;
    00188         QMap<int, QColor> markerColors;  // stores all markerColors
    00189     };
    00190
    00191     // schemaid=data, created when a schema is entered
    00192     QMap<int,SchemaColors> m_schemas;
    00193     // current schema
    00194     int m_schema;
    00195
    00196   public slots:
    00197     void apply();
    00198     void schemaChanged( int newSchema );
    00199
    00200   signals:
    00201     void changed(); // connected to parentWidget()->parentWidget() SLOT(slotChanged)
    00202
    00203   protected slots:
    00204     void slotMarkerColorChanged(const QColor&);
    00205     void slotComboBoxChanged(int index);
    00206 };
    00207
    00208 typedef QMap<int,QFont> FontMap; // ### remove it
    00209
    00210 class KateSchemaConfigFontTab : public QWidget
    00211 {
    00212   Q_OBJECT
    00213
    00214   public:
    00215     KateSchemaConfigFontTab( QWidget *parent = 0, const char *name = 0 );
    00216     ~KateSchemaConfigFontTab();
    00217
    00218   public:
    00219     void readConfig (KConfig *config);
    00220
    00221   public slots:
    00222     void apply();
    00223     void schemaChanged( int newSchema );
    00224
    00225   signals:
    00226     void changed(); // connected to parentWidget()->parentWidget() SLOT(slotChanged)
    00227
    00228   private:
    00229     class KFontChooser *m_fontchooser;
    00230     FontMap m_fonts;
    00231     int m_schema;
    00232
    00233   private slots:
    00234     void slotFontSelected( const QFont &font );
    00235 };
    00236
    00237 class KateSchemaConfigFontColorTab : public QWidget
    00238 {
    00239   Q_OBJECT
    00240
    00241   public:
    00242     KateSchemaConfigFontColorTab( QWidget *parent = 0, const char *name = 0 );
    00243     ~KateSchemaConfigFontColorTab();
    00244
    00245   public:
    00246     void schemaChanged (uint schema);
    00247     void reload ();
    00248     void apply ();
    00249
    00250     KateAttributeList *attributeList (uint schema);
    00251
    00252   private:
    00253     KateStyleListView *m_defaultStyles;
    00254     QIntDict<KateAttributeList> m_defaultStyleLists;
    00255 };
    00256
    00257 class KateSchemaConfigHighlightTab : public QWidget
    00258 {
    00259   Q_OBJECT
    00260
    00261   public:
    00262     KateSchemaConfigHighlightTab( QWidget *parent = 0, const char *name = 0, KateSchemaConfigFontColorTab *page = 0, uint hl = 0 );
    00263     ~KateSchemaConfigHighlightTab();
    00264
    00265   public:
    00266     void schemaChanged (uint schema);
    00267     void reload ();
    00268     void apply ();
    00269
    00270   protected slots:
    00271     void hlChanged(int z);
    00272
    00273   private:
    00274     KateSchemaConfigFontColorTab *m_defaults;
    00275
    00276     QComboBox *hlCombo;
    00277     KateStyleListView *m_styles;
    00278
    00279     uint m_schema;
    00280     int m_hl;
    00281
    00282     QIntDict< QIntDict<KateHlItemDataList> > m_hlDict;
    00283 };
    00284
    00285 class KateSchemaConfigPage : public KateConfigPage
    00286 {
    00287   Q_OBJECT
    00288
    00289   public:
    00290     KateSchemaConfigPage ( QWidget *parent, class KateDocument *doc=0 );
    00291     ~KateSchemaConfigPage ();
    00292
    00293   public slots:
    00294     void apply();
    00295     void reload();
    00296     void reset();
    00297     void defaults();
    00298
    00299   private slots:
    00300     void update ();
    00301     void deleteSchema ();
    00302     void newSchema ();
    00303     void schemaChanged (int schema);
    00304
    00305     void newCurrentPage (QWidget *w);
    00306
    00307   private:
    00308     int m_lastSchema;
    00309     int m_defaultSchema;
    00310
    00311     class QTabWidget *m_tabWidget;
    00312     class QPushButton *btndel;
    00313     class QComboBox *defaultSchemaCombo;
    00314     class QComboBox *schemaCombo;
    00315     KateSchemaConfigColorTab *m_colorTab;
    00316     KateSchemaConfigFontTab *m_fontTab;
    00317     KateSchemaConfigFontColorTab *m_fontColorTab;
    00318     KateSchemaConfigHighlightTab *m_highlightTab;
    00319 };
    00320
    00321 #endif
    00322
    00323 // kate: space-indent on; indent-width 2; replace-tabs on;

This file is part of the documentation for kate Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:36:38 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003