Back to index

kdeartwork  4.3.2
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
Glow::GlowClientGlobals Class Reference

#include <glowclient.h>

Collaboration diagram for Glow::GlowClientGlobals:
Collaboration graph
[legend]

List of all members.

Public Types

enum  PixmapType {
  StickyOn, StickyOff, Help, Iconify,
  MaximizeOn, MaximizeOff, Close
}

Public Member Functions

 ~GlowClientGlobals ()
virtual KDecoration * createDecoration (KDecorationBridge *b)
virtual bool reset (unsigned long changed)
virtual bool supports (Ability ability)
QList
< KDecorationDefines::BorderSize > 
borderSizes () const
QString getPixmapName (PixmapType type, bool isActive)
GlowThemetheme () const
GlowClientConfigconfig () const
GlowButtonFactorybuttonFactory ()

Static Public Member Functions

static GlowClientGlobalsinstance ()

Private Member Functions

 GlowClientGlobals ()
void readConfig ()
void readTheme ()
bool createPixmaps ()
void deletePixmaps ()
bool createPixmap (PixmapType type, bool isActive)
const QString getPixmapTypeName (PixmapType type)

Private Attributes

GlowTheme_theme
GlowClientConfig_config
GlowButtonFactory_button_factory

Static Private Attributes

static GlowClientGlobalsm_instance = 0

Detailed Description

Definition at line 115 of file glowclient.h.


Member Enumeration Documentation

Enumerator:
StickyOn 
StickyOff 
Help 
Iconify 
MaximizeOn 
MaximizeOff 
Close 

Definition at line 118 of file glowclient.h.


Constructor & Destructor Documentation

Definition at line 130 of file glowclient.cpp.

Here is the call graph for this function:

Definition at line 144 of file glowclient.cpp.

       : KDecorationFactory()
{
       _button_factory = new GlowButtonFactory();
       readConfig();
       readTheme ();
       if (!createPixmaps())
       {
              deletePixmaps();
              delete _theme;
              config()->themeName = "default";
              readTheme();
              createPixmaps();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

Q3ValueList< GlowClientGlobals::BorderSize > Glow::GlowClientGlobals::borderSizes ( ) const

Definition at line 167 of file glowclient.cpp.

{
    // the list must be sorted
    return Q3ValueList< BorderSize >() << BorderNormal <<
       BorderLarge << BorderVeryLarge <<  BorderHuge <<
       BorderVeryHuge << BorderOversized;
}

Definition at line 134 of file glowclient.h.

{ return _button_factory; }

Here is the caller graph for this function:

Definition at line 133 of file glowclient.h.

{ return _config; }

Here is the caller graph for this function:

KDecoration * Glow::GlowClientGlobals::createDecoration ( KDecorationBridge *  b) [virtual]

Definition at line 888 of file glowclient.cpp.

{
       return new GlowClient( bridge, this );
}
bool Glow::GlowClientGlobals::createPixmap ( PixmapType  type,
bool  isActive 
) [private]

Definition at line 300 of file glowclient.cpp.

{
       QString theme_dir = KGlobal::dirs()->findResource ("data",
                     QString("kwin/glow-themes/") + _config->themeName + "/");

       QColor glow_color;
       QColor color = options()->color(ColorButtonBg, isActive);

       QImage bg_image (theme_dir+_theme->backgroundPixmap);
       QImage fg_image;
       QImage glow_image;

       switch(type) {
              case (StickyOn):
              {
                     fg_image = QImage (theme_dir+_theme->stickyOnPixmap);
                     glow_image = QImage (theme_dir+_theme->stickyOnGlowPixmap);
                     glow_color = _config->stickyButtonGlowColor;
                     break;
              }
              case (StickyOff):
              {
                     fg_image = QImage (theme_dir+_theme->stickyOffPixmap);
                     glow_image = QImage (theme_dir+_theme->stickyOffGlowPixmap);
                     glow_color = _config->stickyButtonGlowColor;
                     break;
              }
              case (Help):
              {
                     fg_image = QImage (theme_dir+_theme->helpPixmap);
                     glow_image = QImage (theme_dir+_theme->helpGlowPixmap);
                     glow_color = _config->helpButtonGlowColor;
                     break;
              }
              case (Iconify):
              {
                     fg_image = QImage (theme_dir+_theme->iconifyPixmap);
                     glow_image = QImage (theme_dir+_theme->iconifyGlowPixmap);
                     glow_color = _config->iconifyButtonGlowColor;
                     break;
              }
              case (MaximizeOn):
              {
                     fg_image = QImage (theme_dir+_theme->maximizeOnPixmap);
                     glow_image = QImage (theme_dir+_theme->maximizeOnGlowPixmap);
                     glow_color = _config->maximizeButtonGlowColor;
                     break;
              }
              case (MaximizeOff):
              {
                     fg_image = QImage (theme_dir+_theme->maximizeOffPixmap);
                     glow_image = QImage (theme_dir+_theme->maximizeOffGlowPixmap);
                     glow_color = _config->maximizeButtonGlowColor;
                     break;
              }
              case (Close):
              {
                     fg_image = QImage (theme_dir+_theme->closePixmap);
                     glow_image = QImage (theme_dir+_theme->closeGlowPixmap);
                     glow_color = _config->closeButtonGlowColor;
                     break;
              }
       }

       if (bg_image.size() != _theme->buttonSize
                     || fg_image.size() != _theme->buttonSize
                     || glow_image.size() != _theme->buttonSize)
              return false;

       QPixmap * glowPm = buttonFactory()->createGlowButtonPixmap(
              bg_image, fg_image, glow_image,
              color, glow_color);
       if (glowPm->isNull())
              return false;
       PixmapCache::insert(getPixmapName(type, isActive), glowPm);
       return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 262 of file glowclient.cpp.

{
       for( int type=0; type<=Close; type++ ) {
              if (! createPixmap(static_cast<PixmapType>(type), false))
                     return false;
              if (! createPixmap(static_cast<PixmapType>(type), true))
                     return false;
       }
       return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 273 of file glowclient.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

QString Glow::GlowClientGlobals::getPixmapName ( PixmapType  type,
bool  isActive 
)

Definition at line 136 of file glowclient.cpp.

{
       QString s = getPixmapTypeName(static_cast<PixmapType>(type));
       s += "|";
       s += isActive ? "Active" : "NotActive";
       return s;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const QString Glow::GlowClientGlobals::getPixmapTypeName ( PixmapType  type) [private]

Definition at line 278 of file glowclient.cpp.

{
       switch(type) {
              case (StickyOn):
                     return "StickyOn";
              case(StickyOff ):
                     return "StickyOff";
              case(Help):
                     return "Help";
              case(Iconify):
                     return "Iconify";
              case(MaximizeOn):
                     return "MaximizeOn";
              case(MaximizeOff):
                     return "MaximizeOff";
              case(Close):
                     return "Close";
              default:
                     return QString();
       }
}

Here is the caller graph for this function:

Definition at line 380 of file glowclient.cpp.

{
       if( ! m_instance )
       {
              m_instance = new GlowClientGlobals();
       }
       return m_instance;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 160 of file glowclient.cpp.

{
       _config = new GlowClientConfig();
       _config->load(this);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 175 of file glowclient.cpp.

{
       QString theme_config_file = KGlobal::dirs()->findResource ("data",
                     QString("kwin/glow-themes/") + config()->themeName + "/" +
                     config()->themeName + ".theme");
       if (theme_config_file.isNull())
       {
              config()->themeName = "default";
              return;
       }

       KConfig conf (theme_config_file);
       _theme = new GlowTheme(default_glow_theme);

       _theme->buttonSize = conf.readSizeEntry ("buttonSize",
                     &_theme->buttonSize);
       _theme->stickyOnPixmap = conf.readEntry ("stickyOnPixmap",
                     _theme->stickyOnPixmap);
       _theme->stickyOffPixmap = conf.readEntry ("stickyOffPixmap",
                     _theme->stickyOffPixmap);
       _theme->maximizeOnPixmap = conf.readEntry ("maximizeOnPixmap",
                     _theme->maximizeOnPixmap);
       _theme->maximizeOffPixmap = conf.readEntry ("maximizeOffPixmap",
                     _theme->maximizeOffPixmap);
       _theme->helpPixmap = conf.readEntry ("helpPixmap",
                     _theme->helpPixmap);
       _theme->closePixmap = conf.readEntry ("closePixmap",
                     _theme->closePixmap);
       _theme->iconifyPixmap = conf.readEntry ("iconifyPixmap",
                     _theme->iconifyPixmap);
       _theme->stickyOnGlowPixmap = conf.readEntry ("stickyOnGlowPixmap",
                     _theme->stickyOnGlowPixmap);
       _theme->stickyOffGlowPixmap = conf.readEntry ("stickyOffGlowPixmap",
                     _theme->stickyOffGlowPixmap);
       _theme->maximizeOnGlowPixmap = conf.readEntry ("maximizeOnGlowPixmap",
                     _theme->maximizeOnGlowPixmap);
       _theme->maximizeOffGlowPixmap = conf.readEntry ("maximizeOffGlowPixmap",
                     _theme->maximizeOffGlowPixmap);
       _theme->helpGlowPixmap = conf.readEntry ("helpGlowPixmap",
                     _theme->helpGlowPixmap);
       _theme->closeGlowPixmap = conf.readEntry ("closeGlowPixmap",
                     _theme->closeGlowPixmap);
       _theme->iconifyGlowPixmap = conf.readEntry ("iconifyGlowPixmap",
                     _theme->iconifyGlowPixmap);

       titleHeight = QFontMetrics(KDecoration::options()->font(true)).height();
       if (titleHeight < SIDE_MARGIN)
              titleHeight = SIDE_MARGIN;
       if (titleHeight < _theme->buttonSize.height())
              titleHeight = _theme->buttonSize.height();
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool Glow::GlowClientGlobals::reset ( unsigned long  changed) [virtual]

Definition at line 227 of file glowclient.cpp.

{
       deletePixmaps();
       delete _config;
       readConfig();
       delete _theme;
       readTheme ();
       if (! createPixmaps())
       {
              deletePixmaps();
              delete _theme;
              _config->themeName = "default";
              readTheme();
              createPixmaps();
       }
       return true; // FRAME
}

Here is the call graph for this function:

bool Glow::GlowClientGlobals::supports ( Ability  ability) [virtual]

Definition at line 245 of file glowclient.cpp.

{
    switch( ability )
    {
        case AbilityAnnounceButtons:
        case AbilityButtonOnAllDesktops:
        case AbilityButtonSpacer:
        case AbilityButtonHelp:
        case AbilityButtonMinimize:
        case AbilityButtonMaximize:
        case AbilityButtonClose:
            return true;
        default:
            return false;
    };
}

Definition at line 132 of file glowclient.h.

{ return _theme; }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 141 of file glowclient.h.

Definition at line 140 of file glowclient.h.

Definition at line 139 of file glowclient.h.

Definition at line 137 of file glowclient.h.


The documentation for this class was generated from the following files: