kwin Library API Documentation

quartz/config/config.cpp

00001 /*  
00002  *
00003  *  This file contains the quartz configuration widget
00004  *
00005  *  Copyright (c) 2001
00006  *      Karol Szwed <gallium@kde.org>
00007  *      http://gallium.n3.net/
00008  */
00009 
00010 #include "config.h"
00011 #include <kglobal.h>
00012 #include <qwhatsthis.h>
00013 #include <klocale.h>
00014 
00015 
00016 extern "C"
00017 {
00018     QObject* allocate_config( KConfig* conf, QWidget* parent )
00019     {
00020         return(new QuartzConfig(conf, parent));
00021     }
00022 }
00023 
00024 
00025 /* NOTE: 
00026  * 'conf'   is a pointer to the kwindecoration modules open kwin config,
00027  *          and is by default set to the "Style" group.
00028  *
00029  * 'parent' is the parent of the QObject, which is a VBox inside the
00030  *          Configure tab in kwindecoration
00031  */
00032 
00033 QuartzConfig::QuartzConfig( KConfig* conf, QWidget* parent )
00034     : QObject( parent )
00035 {
00036     quartzConfig = new KConfig("kwinquartzrc");
00037     KGlobal::locale()->insertCatalogue("kwin_quartz_config");
00038     gb = new QVBox( parent );
00039     cbColorBorder = new QCheckBox( 
00040                         i18n("Draw window frames using &titlebar colors"), gb );
00041     QWhatsThis::add( cbColorBorder, 
00042                         i18n("When selected, the window decoration borders "
00043                         "are drawn using the titlebar colors. Otherwise, they are "
00044                         "drawn using normal border colors instead.") );
00045     // Load configuration options
00046     load( conf );
00047 
00048     // Ensure we track user changes properly
00049     connect( cbColorBorder, SIGNAL(clicked()), this, SLOT(slotSelectionChanged()) );
00050 
00051     // Make the widgets visible in kwindecoration
00052     gb->show();
00053 }
00054 
00055 
00056 QuartzConfig::~QuartzConfig()
00057 {
00058     delete gb;
00059     delete quartzConfig;
00060 }
00061 
00062 
00063 void QuartzConfig::slotSelectionChanged()
00064 {
00065     emit changed();
00066 }
00067 
00068 
00069 // Loads the configurable options from the kwinrc config file
00070 // It is passed the open config from kwindecoration to improve efficiency
00071 void QuartzConfig::load( KConfig* /*conf*/ )
00072 {
00073     quartzConfig->setGroup("General");
00074     bool override = quartzConfig->readBoolEntry( "UseTitleBarBorderColors", true );
00075     cbColorBorder->setChecked( override );
00076 }
00077 
00078 
00079 // Saves the configurable options to the kwinrc config file
00080 void QuartzConfig::save( KConfig* /*conf*/ )
00081 {
00082     quartzConfig->setGroup("General");
00083     quartzConfig->writeEntry( "UseTitleBarBorderColors", cbColorBorder->isChecked() );
00084     // Ensure others trying to read this config get updated
00085     quartzConfig->sync();
00086 }
00087 
00088 
00089 // Sets UI widget defaults which must correspond to style defaults
00090 void QuartzConfig::defaults()
00091 {
00092     cbColorBorder->setChecked( true );
00093 }
00094 
00095 #include "config.moc"
00096 // vim: ts=4
KDE Logo
This file is part of the documentation for kwin Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Aug 20 13:39:10 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003