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 KAboutData *about = 00109 new KAboutData(I18N_NOOP("kcmkwinoptions"), I18N_NOOP("Window Behavior Configuration Module"), 00110 0, 0, KAboutData::License_GPL, 00111 I18N_NOOP("(c) 1997 - 2002 KWin and KControl Authors")); 00112 00113 about->addAuthor("Matthias Ettrich",0,"ettrich@kde.org"); 00114 about->addAuthor("Waldo Bastian",0,"bastian@kde.org"); 00115 about->addAuthor("Cristian Tibirna",0,"tibirna@kde.org"); 00116 about->addAuthor("Matthias Kalle Dalheimer",0,"kalle@kde.org"); 00117 about->addAuthor("Daniel Molkentin",0,"molkentin@kde.org"); 00118 about->addAuthor("Wynn Wilkes",0,"wynnw@caldera.com"); 00119 about->addAuthor("Pat Dowler",0,"dowler@pt1B1106.FSH.UVic.CA"); 00120 about->addAuthor("Bernd Wuebben",0,"wuebben@kde.org"); 00121 about->addAuthor("Matthias Hoelzer-Kluepfel",0,"hoelzer@kde.org"); 00122 setAboutData(about); 00123 } 00124 00125 KWinOptions::~KWinOptions() 00126 { 00127 delete mConfig; 00128 } 00129 00130 void KWinOptions::load() 00131 { 00132 mConfig->reparseConfiguration(); 00133 mFocus->load(); 00134 mActions->load(); 00135 mMoving->load(); 00136 mAdvanced->load(); 00137 emit KCModule::changed( false ); 00138 } 00139 00140 00141 void KWinOptions::save() 00142 { 00143 mFocus->save(); 00144 mActions->save(); 00145 mMoving->save(); 00146 mAdvanced->save(); 00147 00148 emit KCModule::changed( false ); 00149 // Send signal to kwin 00150 mConfig->sync(); 00151 if ( !kapp->dcopClient()->isAttached() ) 00152 kapp->dcopClient()->attach(); 00153 kapp->dcopClient()->send("kwin*", "", "reconfigure()", ""); 00154 } 00155 00156 00157 void KWinOptions::defaults() 00158 { 00159 mFocus->defaults(); 00160 mActions->defaults(); 00161 mMoving->defaults(); 00162 mAdvanced->defaults(); 00163 } 00164 00165 QString KWinOptions::quickHelp() const 00166 { 00167 return i18n("<h1>Window Behavior</h1> Here you can customize the way windows behave when being" 00168 " moved, resized or clicked on. You can also specify a focus policy as well as a placement" 00169 " policy for new windows." 00170 " <p>Please note that this configuration will not take effect if you do not use" 00171 " KWin as your window manager. If you do use a different window manager, please refer to its documentation" 00172 " for how to customize window behavior."); 00173 } 00174 00175 void KWinOptions::moduleChanged(bool state) 00176 { 00177 emit KCModule::changed(state); 00178 } 00179 00180 00181 #include "main.moc"
KDE Logo
This file is part of the documentation for kwin Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 13 21:47:05 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003