Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

117 lines (95 sloc) 3.583 kb
/* Copyright © 2006-2007 Fredrik Höglund <>
* (c)GPL2 (c)GPL3
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 or at your option version 3 as published
* by the Free Software Foundation.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
* additional code: Ketmar // Vampire Avalon (psyc://
#ifndef CRTHEME_H
#define CRTHEME_H
#include <QtGui/QApplication>
#include <QtGui/QCursor>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtGui/QIcon>
#include <QtGui/QImage>
#include <QtCore/QString>
#include <QtCore/QStringList>
// X11 is SHIT!
struct _XcursorImage;
struct _XcursorImages;
typedef _XcursorImage XcursorImage;
typedef _XcursorImages XcursorImages;
class XCursorThemeData
enum ItemDataRole {
// Note: use printf "0x%08X\n" $(($RANDOM*$RANDOM))
// to define additional roles.
DisplayDetailRole = 0x24A3DAF8
XCursorThemeData(const QDir &aDir);
const QString &name() const { return mName; }
const QString &title() const { return mTitle; }
const QString &description() const { return mDescription; }
const QString &sample() const { return mSample; }
const QString &path() const { return mPath; }
bool isHidden() const { return mHidden; }
QPixmap icon() const;
const QStringList &inherits() const { return mInherits; }
inline void setName(const QString &name)
mName = name;
mHash = qHash(name);
bool isWritable() const;
/// Hash value for the internal name
uint hash() const { return mHash; }
/// Loads the cursor @p name, with the nominal size @p size.
/// If the theme doesn't have the cursor @p name, it should return
/// the default cursor from the active theme instead.
QCursor loadCursor(const QString &name, int size=-1) const;
/// Loads the cursor image @p name, with the nominal size @p size.
/// The image should be autocropped to the smallest possible size.
/// If the theme doesn't have the cursor @p name, it should return a null image.
QImage loadImage(const QString &name, int size=-1) const;
XcursorImage *xcLoadImage(const QString &image, int size=-1) const;
XcursorImages *xcLoadImages(const QString &image, int size=-1) const;
QString findAlternative(const QString &name) const;
void parseIndexFile();
/// Creates the icon returned by @ref icon().
QPixmap createIcon() const;
/// Convenience function for cropping an image.
QImage autoCropImage(const QImage &image) const;
QString mName;
QString mTitle;
QString mDescription;
QString mPath;
QString mSample;
mutable QPixmap mIcon;
bool mHidden;
uint mHash;
QStringList mInherits;
bool haveXfixes();
bool applyTheme(const XCursorThemeData &theme);
QString getCurrentTheme();
Jump to Line
Something went wrong with that request. Please try again.