kwindecoration.h
00001 /* 00002 This is the new kwindecoration kcontrol module 00003 00004 Copyright (c) 2001 00005 Karol Szwed <gallium@kde.org> 00006 http://gallium.n3.net/ 00007 00008 Supports new kwin configuration plugins, and titlebar button position 00009 modification via dnd interface. 00010 00011 Based on original "kwintheme" (Window Borders) 00012 Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org> 00013 00014 This program is free software; you can redistribute it and/or modify 00015 it under the terms of the GNU General Public License as published by 00016 the Free Software Foundation; either version 2 of the License, or 00017 (at your option) any later version. 00018 00019 This program is distributed in the hope that it will be useful, 00020 but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 GNU General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License 00025 along with this program; if not, write to the Free Software 00026 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00027 00028 */ 00029 00030 #ifndef KWINDECORATION_H 00031 #define KWINDECORATION_H 00032 00033 #include <kcmodule.h> 00034 #include <dcopobject.h> 00035 #include <buttons.h> 00036 #include <kconfig.h> 00037 #include <klibloader.h> 00038 00039 #include <kdecoration.h> 00040 00041 #include "kwindecorationIface.h" 00042 00043 class KComboBox; 00044 class QCheckBox; 00045 class QLabel; 00046 class QTabWidget; 00047 class QVBox; 00048 class QSlider; 00049 00050 class KDecorationPlugins; 00051 class KDecorationPreview; 00052 00053 // Stores themeName and its corresponding library Name 00054 struct DecorationInfo 00055 { 00056 QString name; 00057 QString libraryName; 00058 }; 00059 00060 00061 class KWinDecorationModule : public KCModule, virtual public KWinDecorationIface, public KDecorationDefines 00062 { 00063 Q_OBJECT 00064 00065 public: 00066 KWinDecorationModule(QWidget* parent, const char* name, const QStringList &); 00067 ~KWinDecorationModule(); 00068 00069 virtual void load(); 00070 virtual void save(); 00071 virtual void defaults(); 00072 00073 QString quickHelp() const; 00074 00075 virtual void dcopUpdateClientList(); 00076 00077 signals: 00078 void pluginLoad( KConfig* conf ); 00079 void pluginSave( KConfig* conf ); 00080 void pluginDefaults(); 00081 00082 protected slots: 00083 // Allows us to turn "save" on 00084 void slotSelectionChanged(); 00085 void slotChangeDecoration( const QString & ); 00086 void slotBorderChanged( int ); 00087 void slotButtonsChanged(); 00088 00089 private: 00090 void readConfig( KConfig* conf ); 00091 void writeConfig( KConfig* conf ); 00092 void findDecorations(); 00093 void createDecorationList(); 00094 void updateSelection(); 00095 QString decorationLibName( const QString& name ); 00096 QString decorationName ( QString& libName ); 00097 static QString styleToConfigLib( QString& styleLib ); 00098 void resetPlugin( KConfig* conf, const QString& currentDecoName = QString::null ); 00099 void resetKWin(); 00100 void checkSupportedBorderSizes(); 00101 static int borderSizeToIndex( BorderSize size, QValueList< BorderSize > sizes ); 00102 static BorderSize indexToBorderSize( int index, QValueList< BorderSize > sizes ); 00103 00104 QTabWidget* tabWidget; 00105 00106 // Page 1 00107 KComboBox* decorationList; 00108 QValueList<DecorationInfo> decorations; 00109 00110 KDecorationPreview* preview; 00111 KDecorationPlugins* plugins; 00112 KConfig kwinConfig; 00113 00114 QCheckBox* cbUseCustomButtonPositions; 00115 // QCheckBox* cbUseMiniWindows; 00116 QCheckBox* cbShowToolTips; 00117 QLabel* lBorder; 00118 QComboBox* cBorder; 00119 BorderSize border_size; 00120 00121 QObject* pluginObject; 00122 QWidget* pluginConfigWidget; 00123 QString currentLibraryName; 00124 QString oldLibraryName; 00125 QObject* (*allocatePlugin)( KConfig* conf, QWidget* parent ); 00126 00127 // Page 2 00128 ButtonPositionWidget *buttonPositionWidget; 00129 QVBox* buttonPage; 00130 }; 00131 00132 00133 #endif 00134 // vim: ts=4 00135 // kate: space-indent off; tab-width 4;