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 class KateStyleListCaption; 00036 00037 class KColorButton; 00038 00039 class QPopupMenu; 00040 class KComboBox; 00041 00042 class KateSchemaManager 00043 { 00044 public: 00045 KateSchemaManager (); 00046 ~KateSchemaManager (); 00047 00051 void update (bool readfromfile = true); 00052 00056 KConfig *schema (uint number); 00057 00058 void addSchema (const QString &t); 00059 00060 void removeSchema (uint number); 00061 00065 bool validSchema (uint number); 00066 00070 uint number (const QString &name); 00071 00075 QString name (uint number); 00076 00080 const QStringList &list () { return m_schemas; } 00081 00082 static QString normalSchema (); 00083 static QString printingSchema (); 00084 00085 private: 00086 KConfig m_config; 00087 QStringList m_schemas; 00088 }; 00089 00090 00091 class KateViewSchemaAction : public KActionMenu 00092 { 00093 Q_OBJECT 00094 00095 public: 00096 KateViewSchemaAction(const QString& text, QObject* parent = 0, const char* name = 0) 00097 : KActionMenu(text, parent, name) { init(); }; 00098 00099 ~KateViewSchemaAction(){;}; 00100 00101 void updateMenu (KateView *view); 00102 00103 private: 00104 void init(); 00105 00106 QGuardedPtr<KateView> m_view; 00107 QStringList names; 00108 int last; 00109 00110 public slots: 00111 void slotAboutToShow(); 00112 00113 private slots: 00114 void setSchema (int mode); 00115 }; 00116 00117 // 00118 // DIALOGS 00119 // 00120 00121 /* 00122 QListView that automatically adds columns for KateStyleListItems and provides a 00123 popup menu and a slot to edit a style using the keyboard. 00124 Added by anders, jan 23 2002. 00125 */ 00126 class KateStyleListView : public QListView 00127 { 00128 Q_OBJECT 00129 00130 friend class KateStyleListItem; 00131 00132 public: 00133 KateStyleListView( QWidget *parent=0, bool showUseDefaults=false); 00134 ~KateStyleListView() {}; 00135 /* Display a popupmenu for item i at the specified global position, eventually with a title, 00136 promoting the context name of that item */ 00137 void showPopupMenu( KateStyleListItem *i, const QPoint &globalPos, bool showtitle=false ); 00138 void emitChanged() { emit changed(); }; 00139 00140 void setBgCol( const QColor &c ) { bgcol = c; } 00141 void setSelCol( const QColor &c ) { selcol = c; } 00142 void setNormalCol( const QColor &c ) { normalcol = c; } 00143 00144 private slots: 00145 /* Display a popupmenu for item i at item position */ 00146 void showPopupMenu( QListViewItem *i ); 00147 /* call item to change a property, or display a menu */ 00148 void slotMousePressed( int, QListViewItem*, const QPoint&, int ); 00149 /* asks item to change the property in q */ 00150 void mSlotPopupHandler( int z ); 00151 void unsetColor( int ); 00152 00153 signals: 00154 void changed(); 00155 00156 private: 00157 QColor bgcol, selcol, normalcol; 00158 QFont docfont; 00159 }; 00160 00161 class KateSchemaConfigColorTab : public QWidget 00162 { 00163 Q_OBJECT 00164 00165 public: 00166 KateSchemaConfigColorTab( QWidget *parent = 0, const char *name = 0 ); 00167 ~KateSchemaConfigColorTab(); 00168 00169 private: 00170 KColorButton *m_back; 00171 KColorButton *m_selected; 00172 KColorButton *m_current; 00173 KColorButton *m_bracket; 00174 KColorButton *m_wwmarker; 00175 KColorButton *m_iconborder; 00176 KColorButton *m_tmarker; 00177 KColorButton *m_linenumber; 00178 00179 KColorButton *m_markers; // bg color for current selected marker 00180 QMap<int, QColor> m_markerColors; // stores all markerColors 00181 KComboBox* m_combobox; // switch marker type 00182 00183 public: 00184 void readConfig (KConfig *config); 00185 void writeConfig (KConfig *config); 00186 00187 signals: 00188 void changed(); // connected to parentWidget()->parentWidget() SLOT(slotChanged) 00189 00190 protected slots: 00191 void slotMarkerColorChanged(const QColor&); 00192 void slotComboBoxChanged(int index); 00193 }; 00194 00195 class KateSchemaConfigFontTab : public QWidget 00196 { 00197 Q_OBJECT 00198 00199 public: 00200 KateSchemaConfigFontTab( QWidget *parent = 0, const char *name = 0 ); 00201 ~KateSchemaConfigFontTab(); 00202 00203 public: 00204 void readConfig (KConfig *config); 00205 void writeConfig (KConfig *config); 00206 00207 signals: 00208 void changed(); // connected to parentWidget()->parentWidget() SLOT(slotChanged) 00209 00210 private: 00211 class KFontChooser *m_fontchooser; 00212 QFont myFont; 00213 00214 private slots: 00215 void slotFontSelected( const QFont &font ); 00216 }; 00217 00218 class KateSchemaConfigFontColorTab : public QWidget 00219 { 00220 Q_OBJECT 00221 00222 public: 00223 KateSchemaConfigFontColorTab( QWidget *parent = 0, const char *name = 0 ); 00224 ~KateSchemaConfigFontColorTab(); 00225 00226 public: 00227 void schemaChanged (uint schema); 00228 void reload (); 00229 void apply (); 00230 00231 KateAttributeList *attributeList (uint schema); 00232 00233 private: 00234 KateStyleListView *m_defaultStyles; 00235 QIntDict<KateAttributeList> m_defaultStyleLists; 00236 }; 00237 00238 class KateSchemaConfigHighlightTab : public QWidget 00239 { 00240 Q_OBJECT 00241 00242 public: 00243 KateSchemaConfigHighlightTab( QWidget *parent = 0, const char *name = 0, KateSchemaConfigFontColorTab *page = 0, uint hl = 0 ); 00244 ~KateSchemaConfigHighlightTab(); 00245 00246 public: 00247 void schemaChanged (uint schema); 00248 void reload (); 00249 void apply (); 00250 00251 protected slots: 00252 void hlChanged(int z); 00253 00254 private: 00255 KateSchemaConfigFontColorTab *m_defaults; 00256 00257 QComboBox *hlCombo; 00258 KateStyleListView *m_styles; 00259 00260 uint m_schema; 00261 int m_hl; 00262 00263 QIntDict< QIntDict<KateHlItemDataList> > m_hlDict; 00264 }; 00265 00266 class KateSchemaConfigPage : public KateConfigPage 00267 { 00268 Q_OBJECT 00269 00270 public: 00271 KateSchemaConfigPage ( QWidget *parent, class KateDocument *doc=0 ); 00272 ~KateSchemaConfigPage (); 00273 00274 public slots: 00275 void apply(); 00276 void reload(); 00277 void reset(); 00278 void defaults(); 00279 00280 private slots: 00281 void update (); 00282 void deleteSchema (); 00283 void newSchema (); 00284 void schemaChanged (int schema); 00285 00286 void newCurrentPage (QWidget *w); 00287 00288 private: 00289 int m_lastSchema; 00290 int m_defaultSchema; 00291 class QTabWidget *m_tabWidget; 00292 class QPushButton *btndel; 00293 class QComboBox *defaultSchemaCombo; 00294 class QComboBox *schemaCombo; 00295 KateSchemaConfigColorTab *m_colorTab; 00296 KateSchemaConfigFontTab *m_fontTab; 00297 KateSchemaConfigFontColorTab *m_fontColorTab; 00298 KateSchemaConfigHighlightTab *m_highlightTab; 00299 }; 00300 00301 #endif 00302 00303 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE Logo
This file is part of the documentation for kate Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:45:09 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003