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 private slots:
00139
00140 void showPopupMenu( QListViewItem *i );
00141
00142 void slotMousePressed( int, QListViewItem*, const QPoint&, int );
00143
00144 void mSlotPopupHandler( int z );
00145
00146 signals:
00147 void changed();
00148
00149 private:
00150 QColor bgcol, selcol, normalcol;
00151 QFont docfont;
00152 };
00153
00154 class KateSchemaConfigColorTab : public QWidget
00155 {
00156 Q_OBJECT
00157
00158 public:
00159 KateSchemaConfigColorTab( QWidget *parent = 0, const char *name = 0 );
00160 ~KateSchemaConfigColorTab();
00161
00162 private:
00163 KColorButton *m_back;
00164 KColorButton *m_selected;
00165 KColorButton *m_current;
00166 KColorButton *m_bracket;
00167 KColorButton *m_wwmarker;
00168 KColorButton *m_iconborder;
00169 KColorButton *m_tmarker;
00170
00171 public:
00172 void readConfig (KConfig *config);
00173 void writeConfig (KConfig *config);
00174 };
00175
00176 class KateSchemaConfigFontTab : public QWidget
00177 {
00178 Q_OBJECT
00179
00180 public:
00181 KateSchemaConfigFontTab( QWidget *parent = 0, const char *name = 0 );
00182 ~KateSchemaConfigFontTab();
00183
00184 public:
00185 void readConfig (KConfig *config);
00186 void writeConfig (KConfig *config);
00187
00188 private:
00189 class KFontChooser *m_fontchooser;
00190 QFont myFont;
00191
00192 private slots:
00193 void slotFontSelected( const QFont &font );
00194 };
00195
00196 class KateSchemaConfigFontColorTab : public QWidget
00197 {
00198 Q_OBJECT
00199
00200 public:
00201 KateSchemaConfigFontColorTab( QWidget *parent = 0, const char *name = 0 );
00202 ~KateSchemaConfigFontColorTab();
00203
00204 public:
00205 void schemaChanged (uint schema);
00206 void reload ();
00207 void apply ();
00208
00209 KateAttributeList *attributeList (uint schema);
00210
00211 private:
00212 KateStyleListView *m_defaultStyles;
00213 QIntDict<KateAttributeList> m_defaultStyleLists;
00214 };
00215
00216 class KateSchemaConfigHighlightTab : public QWidget
00217 {
00218 Q_OBJECT
00219
00220 public:
00221 KateSchemaConfigHighlightTab( QWidget *parent = 0, const char *name = 0, KateSchemaConfigFontColorTab *page = 0 );
00222 ~KateSchemaConfigHighlightTab();
00223
00224 public:
00225 void schemaChanged (uint schema);
00226 void reload ();
00227 void apply ();
00228
00229 protected slots:
00230 void hlChanged(int z);
00231
00232 private:
00233 KateSchemaConfigFontColorTab *m_defaults;
00234
00235 QComboBox *hlCombo;
00236 KateStyleListView *m_styles;
00237
00238 uint m_schema;
00239 int m_hl;
00240
00241 QIntDict< QIntDict<ItemDataList> > m_hlDict;
00242 };
00243
00244 class KateSchemaConfigPage : public KateConfigPage
00245 {
00246 Q_OBJECT
00247
00248 public:
00249 KateSchemaConfigPage ( QWidget *parent );
00250 ~KateSchemaConfigPage ();
00251
00252 public slots:
00253 void apply();
00254 void reload();
00255 void reset();
00256 void defaults();
00257
00258 private slots:
00259 void update ();
00260 void deleteSchema ();
00261 void newSchema ();
00262 void schemaChanged (int schema);
00263
00264 void newCurrentPage (QWidget *w);
00265
00266 private:
00267 int m_lastSchema;
00268 class QTabWidget *m_tabWidget;
00269 class QPushButton *btndel;
00270 class QComboBox *defaultSchemaCombo;
00271 class QComboBox *schemaCombo;
00272 KateSchemaConfigColorTab *m_colorTab;
00273 KateSchemaConfigFontTab *m_fontTab;
00274 KateSchemaConfigFontColorTab *m_fontColorTab;
00275 KateSchemaConfigHighlightTab *m_highlightTab;
00276 };
00277
00278 #endif
00279
00280
This file is part of the documentation for kate Library Version 3.2.0.