kateschema.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
00119
00120
00121
00122
00123
00124
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
00136
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
00146 void showPopupMenu( QListViewItem *i );
00147
00148 void slotMousePressed( int, QListViewItem*, const QPoint&, int );
00149
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;
00180 QMap<int, QColor> m_markerColors;
00181 KComboBox* m_combobox;
00182
00183 public:
00184 void readConfig (KConfig *config);
00185 void writeConfig (KConfig *config);
00186
00187 signals:
00188 void changed();
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();
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
This file is part of the documentation for kate Library Version 3.3.90.