kwin Library API Documentation

main.cpp

00001 /* 00002 * 00003 * Copyright (c) 2001 Waldo Bastian <bastian@kde.org> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #include <qlayout.h> 00021 00022 #include <dcopclient.h> 00023 00024 #include <kapplication.h> 00025 #include <kglobal.h> 00026 #include <klocale.h> 00027 #include <kconfig.h> 00028 #include <kgenericfactory.h> 00029 #include <kaboutdata.h> 00030 #include <kdialog.h> 00031 00032 #include "mouse.h" 00033 #include "windows.h" 00034 00035 #include "main.h" 00036 00037 extern "C" 00038 { 00039 KCModule *create_kwinfocus(QWidget *parent, const char *name) 00040 { 00041 //CT there's need for decision: kwm or kwin? 00042 KGlobal::locale()->insertCatalogue("kcmkwm"); 00043 KConfig *c = new KConfig("kwinrc", false, true); 00044 return new KFocusConfig(true, c, parent, name); 00045 } 00046 00047 KCModule *create_kwinactions(QWidget *parent, const char *name) 00048 { 00049 //CT there's need for decision: kwm or kwin? 00050 KGlobal::locale()->insertCatalogue("kcmkwm"); 00051 KConfig *c = new KConfig("kwinrc", false, true); 00052 return new KActionsConfig(true, c, parent, name); 00053 } 00054 00055 KCModule *create_kwinmoving(QWidget *parent, const char *name) 00056 { 00057 //CT there's need for decision: kwm or kwin? 00058 KGlobal::locale()->insertCatalogue("kcmkwm"); 00059 KConfig *c = new KConfig("kwinrc", false, true); 00060 return new KMovingConfig(true, c, parent, name); 00061 } 00062 00063 KCModule *create_kwinadvanced(QWidget *parent, const char *name) 00064 { 00065 //CT there's need for decision: kwm or kwin? 00066 KGlobal::locale()->insertCatalogue("kcmkwm"); 00067 KConfig *c = new KConfig("kwinrc", false, true); 00068 return new KAdvancedConfig(true, c, parent, name); 00069 } 00070 00071 KCModule *create_kwinoptions ( QWidget *parent, const char* name) 00072 { 00073 //CT there's need for decision: kwm or kwin? 00074 KGlobal::locale()->insertCatalogue("kcmkwm"); 00075 return new KWinOptions( parent, name); 00076 } 00077 } 00078 00079 KWinOptions::KWinOptions(QWidget *parent, const char *name) 00080 : KCModule(parent, name) 00081 { 00082 mConfig = new KConfig("kwinrc", false, true); 00083 00084 QVBoxLayout *layout = new QVBoxLayout(this); 00085 tab = new QTabWidget(this); 00086 layout->addWidget(tab); 00087 00088 mFocus = new KFocusConfig(false, mConfig, this, "KWin Focus Config"); 00089 mFocus->layout()->setMargin( KDialog::marginHint() ); 00090 tab->addTab(mFocus, i18n("&Focus")); 00091 connect(mFocus, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool))); 00092 00093 mActions = new KActionsConfig(false, mConfig, this, "KWin Actions"); 00094 mActions->layout()->setMargin( KDialog::marginHint() ); 00095 tab->addTab(mActions, i18n("Actio&ns")); 00096 connect(mActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool))); 00097 00098 mMoving = new KMovingConfig(false, mConfig, this, "KWin Moving"); 00099 mMoving->layout()->setMargin( KDialog::marginHint() ); 00100 tab->addTab(mMoving, i18n("&Moving")); 00101 connect(mMoving, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool))); 00102 00103 mAdvanced = new KAdvancedConfig(false, mConfig, this, "KWin Advanced"); 00104 mAdvanced->layout()->setMargin( KDialog::marginHint() ); 00105 tab->addTab(mAdvanced, i18n("Ad&vanced")); 00106 connect(mAdvanced, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool))); 00107 } 00108 00109 KWinOptions::~KWinOptions() 00110 { 00111 delete mConfig; 00112 } 00113 00114 void KWinOptions::load() 00115 { 00116 mConfig->reparseConfiguration(); 00117 mFocus->load(); 00118 mActions->load(); 00119 mMoving->load(); 00120 mAdvanced->load(); 00121 emit KCModule::changed( false ); 00122 } 00123 00124 00125 void KWinOptions::save() 00126 { 00127 mFocus->save(); 00128 mActions->save(); 00129 mMoving->save(); 00130 mAdvanced->save(); 00131 00132 emit KCModule::changed( false ); 00133 // Send signal to kwin 00134 mConfig->sync(); 00135 if ( !kapp->dcopClient()->isAttached() ) 00136 kapp->dcopClient()->attach(); 00137 kapp->dcopClient()->send("kwin*", "", "reconfigure()", ""); 00138 } 00139 00140 00141 void KWinOptions::defaults() 00142 { 00143 mFocus->defaults(); 00144 mActions->defaults(); 00145 mMoving->defaults(); 00146 mAdvanced->defaults(); 00147 } 00148 00149 QString KWinOptions::quickHelp() const 00150 { 00151 return i18n("<h1>Window Behavior</h1> Here you can customize the way windows behave when being" 00152 " moved, resized or clicked on. You can also specify a focus policy as well as a placement" 00153 " policy for new windows." 00154 " <p>Please note that this configuration will not take effect if you don't use" 00155 " KWin as your window manager. If you do use a different window manager, please refer to its documentation" 00156 " for how to customize window behavior."); 00157 } 00158 00159 const KAboutData* KWinOptions::aboutData() const 00160 { 00161 KAboutData *about = 00162 new KAboutData(I18N_NOOP("kcmkwinoptions"), I18N_NOOP("Window Behavior Configuration Module"), 00163 0, 0, KAboutData::License_GPL, 00164 I18N_NOOP("(c) 1997 - 2002 KWin and KControl Authors")); 00165 00166 about->addAuthor("Matthias Ettrich",0,"ettrich@kde.org"); 00167 about->addAuthor("Waldo Bastian",0,"bastian@kde.org"); 00168 about->addAuthor("Cristian Tibirna",0,"tibirna@kde.org"); 00169 about->addAuthor("Matthias Kalle Dalheimer",0,"kalle@kde.org"); 00170 about->addAuthor("Daniel Molkentin",0,"molkentin@kde.org"); 00171 about->addAuthor("Wynn Wilkes",0,"wynnw@caldera.com"); 00172 about->addAuthor("Pat Dowler",0,"dowler@pt1B1106.FSH.UVic.CA"); 00173 about->addAuthor("Bernd Wuebben",0,"wuebben@kde.org"); 00174 about->addAuthor("Matthias Hoelzer-Kluepfel",0,"hoelzer@kde.org"); 00175 00176 return about; 00177 } 00178 00179 void KWinOptions::moduleChanged(bool state) 00180 { 00181 emit KCModule::changed(state); 00182 } 00183 00184 00185 #include "main.moc"
KDE Logo
This file is part of the documentation for kwin Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Sep 16 15:59:32 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003