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
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
00117
00118
00119
00120
00121
00122
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
00134
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
00144 void showPopupMenu( QListViewItem *i );
00145
00146 void slotMousePressed( int, QListViewItem*, const QPoint&, int );
00147
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
This file is part of the documentation for kate Library Version 3.2.2.