kwin Library API Documentation

kcmkwin/kwinoptions/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     KDE_EXPORT 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     KDE_EXPORT 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     KDE_EXPORT 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     KDE_EXPORT 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     KDE_EXPORT KCModule *create_kwintranslucency(QWidget *parent, const char *name)
00072     {
00073         //CT there's need for decision: kwm or kwin?
00074         KGlobal::locale()->insertCatalogue("kcmkwm");
00075         KConfig *c = new KConfig("kwinrc", false, true);
00076         return new KTranslucencyConfig(true, c, parent, name);
00077     }
00078 
00079     KDE_EXPORT KCModule *create_kwinoptions ( QWidget *parent, const char* name)
00080     {
00081         //CT there's need for decision: kwm or kwin?
00082         KGlobal::locale()->insertCatalogue("kcmkwm");
00083         return new KWinOptions( parent, name);
00084     }
00085 }
00086 
00087 KWinOptions::KWinOptions(QWidget *parent, const char *name)
00088   : KCModule(parent, name)
00089 {
00090   mConfig = new KConfig("kwinrc", false, true);
00091 
00092   QVBoxLayout *layout = new QVBoxLayout(this);
00093   tab = new QTabWidget(this);
00094   layout->addWidget(tab);
00095 
00096   mFocus = new KFocusConfig(false, mConfig, this, "KWin Focus Config");
00097   mFocus->layout()->setMargin( KDialog::marginHint() );
00098   tab->addTab(mFocus, i18n("&Focus"));
00099   connect(mFocus, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
00100 
00101   mActions = new KActionsConfig(false, mConfig, this, "KWin Actions");
00102   mActions->layout()->setMargin( KDialog::marginHint() );
00103   tab->addTab(mActions, i18n("Actio&ns"));
00104   connect(mActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
00105 
00106   mMoving = new KMovingConfig(false, mConfig, this, "KWin Moving");
00107   mMoving->layout()->setMargin( KDialog::marginHint() );
00108   tab->addTab(mMoving, i18n("&Moving"));
00109   connect(mMoving, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
00110 
00111   mAdvanced = new KAdvancedConfig(false, mConfig, this, "KWin Advanced");
00112   mAdvanced->layout()->setMargin( KDialog::marginHint() );
00113   tab->addTab(mAdvanced, i18n("Ad&vanced"));
00114   connect(mAdvanced, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
00115 
00116   mTranslucency = new KTranslucencyConfig(false, mConfig, this, "KWin Translucency");
00117   mTranslucency->layout()->setMargin( KDialog::marginHint() );
00118   tab->addTab(mTranslucency, i18n("&Translucency"));
00119   connect(mTranslucency, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
00120     
00121   KAboutData *about =
00122     new KAboutData(I18N_NOOP("kcmkwinoptions"), I18N_NOOP("Window Behavior Configuration Module"),
00123                   0, 0, KAboutData::License_GPL,
00124                   I18N_NOOP("(c) 1997 - 2002 KWin and KControl Authors"));
00125 
00126   about->addAuthor("Matthias Ettrich",0,"ettrich@kde.org");
00127   about->addAuthor("Waldo Bastian",0,"bastian@kde.org");
00128   about->addAuthor("Cristian Tibirna",0,"tibirna@kde.org");
00129   about->addAuthor("Matthias Kalle Dalheimer",0,"kalle@kde.org");
00130   about->addAuthor("Daniel Molkentin",0,"molkentin@kde.org");
00131   about->addAuthor("Wynn Wilkes",0,"wynnw@caldera.com");
00132   about->addAuthor("Pat Dowler",0,"dowler@pt1B1106.FSH.UVic.CA");
00133   about->addAuthor("Bernd Wuebben",0,"wuebben@kde.org");
00134   about->addAuthor("Matthias Hoelzer-Kluepfel",0,"hoelzer@kde.org");
00135   setAboutData(about);
00136 }
00137 
00138 KWinOptions::~KWinOptions()
00139 {
00140   delete mConfig;
00141 }
00142 
00143 void KWinOptions::load()
00144 {
00145   mConfig->reparseConfiguration();
00146   mFocus->load();
00147   mActions->load();
00148   mMoving->load();
00149   mAdvanced->load();
00150   mTranslucency->load();
00151   emit KCModule::changed( false );
00152 }
00153 
00154 
00155 void KWinOptions::save()
00156 {
00157   mFocus->save();
00158   mActions->save();
00159   mMoving->save();
00160   mAdvanced->save();
00161   mTranslucency->save();
00162 
00163   emit KCModule::changed( false );
00164   // Send signal to kwin
00165   mConfig->sync();
00166   if ( !kapp->dcopClient()->isAttached() )
00167       kapp->dcopClient()->attach();
00168   kapp->dcopClient()->send("kwin*", "", "reconfigure()", "");
00169 }
00170 
00171 
00172 void KWinOptions::defaults()
00173 {
00174   mFocus->defaults();
00175   mActions->defaults();
00176   mMoving->defaults();
00177   mAdvanced->defaults();
00178   mTranslucency->defaults();
00179 }
00180 
00181 QString KWinOptions::quickHelp() const
00182 {
00183   return i18n("<h1>Window Behavior</h1> Here you can customize the way windows behave when being"
00184     " moved, resized or clicked on. You can also specify a focus policy as well as a placement"
00185     " policy for new windows."
00186     " <p>Please note that this configuration will not take effect if you do not use"
00187     " KWin as your window manager. If you do use a different window manager, please refer to its documentation"
00188     " for how to customize window behavior.");
00189 }
00190 
00191 void KWinOptions::moduleChanged(bool state)
00192 {
00193   emit KCModule::changed(state);
00194 }
00195 
00196 
00197 #include "main.moc"
KDE Logo
This file is part of the documentation for kwin Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Apr 6 02:41:06 2005 by doxygen 1.4.0 written by Dimitri van Heesch, © 1997-2003