Source Code (Use browser search to find items of interest.)
Class Index
krn'KBusyPtr (./kdenetwork/krn/kbusyptr.h:14)
class KBusyPtr: public KAlarmTimer
{
Q_OBJECT
public:
KBusyPtr();
virtual ~KBusyPtr();
/** Show busy pointer. Subsequent calls increase the "busy level" */
virtual void busy(void);
/** Hide busy pointer if the "busy level" is reduced to zero. */
virtual void idle(void);
/** Stop pointer animation. This is necessary for some system calls. */
virtual void stopAnimation(void);
/** Continue pointer animation. */
virtual void continueAnimation(void);
/** Load cursor from given bitmap files. When the filename is relative
the $KDEDIR/lib/pics directory is searched. */
virtual void loadCursor(const char* cursorName, const char* maskName);
protected:
virtual void timerEvent(void);
private:
bool loadBitmap(QBitmap& bitmap, const QString& fileName);
protected:
KApplication* app;
int busyLevel;
int numCursors;
int frameDelay;
int currentCursor;
bool animated;
QCursor* cursorList;
QBitmap* bitmapList;
};
krn'KBusyPtr::KBusyPtr() (./kdenetwork/krn/kbusyptr.cpp:12)
KBusyPtr :: KBusyPtr ()
{
app = KApplication::kApplication();
busyLevel = 0;
numCursors = 0;
frameDelay = 500;
cursorList = NULL;
bitmapList = NULL;
//animated = TRUE;
animated = FALSE;
loadCursor("stopwatch.xbm","stopwatchMask.xbm");
//connect(timer, SIGNAL(timeout()), this, SLOT(timeout()));
}
//-----------------------------------------------------------------------------
krn'KBusyPtr::~KBusyPtr() (./kdenetwork/krn/kbusyptr.cpp:31)
KBusyPtr :: ~KBusyPtr()
{
if (cursorList) delete[] cursorList;
if (bitmapList) delete[] bitmapList;
cursorList = NULL;
bitmapList = NULL;
}
//-----------------------------------------------------------------------------
krn'KBusyPtr::busy() (./kdenetwork/krn/kbusyptr.cpp:41)
void KBusyPtr :: busy (void)
{
if (busyLevel <= 0)
{
currentCursor = 0;
if (!cursorList)
{
app->setOverrideCursor(waitCursor);
}
else
{
app->setOverrideCursor(cursorList[currentCursor]);
if (animated) start(frameDelay);
}
app->processEvents(200);
}
busyLevel++;
}
//-----------------------------------------------------------------------------
krn'KBusyPtr::idle() (./kdenetwork/krn/kbusyptr.cpp:62)
void KBusyPtr :: idle (void)
{
busyLevel--;
if (busyLevel < 0) busyLevel = 0;
if (busyLevel <= 0)
{
stop();
app->restoreOverrideCursor();
app->processEvents(200);
}
}
//-----------------------------------------------------------------------------
krn'KBusyPtr::timerEvent() (./kdenetwork/krn/kbusyptr.cpp:77)
void KBusyPtr :: timerEvent (void)
{
if (busyLevel <= 0) return;
if (++currentCursor >= numCursors) currentCursor = 0;
if (cursorList)
app->setOverrideCursor(cursorList[currentCursor], TRUE);
}
//-----------------------------------------------------------------------------
krn'KBusyPtr::stopAnimation() (./kdenetwork/krn/kbusyptr.cpp:89)
void KBusyPtr :: stopAnimation (void)
{
if (animated) stop();
animated = FALSE;
}
//-----------------------------------------------------------------------------
krn'KBusyPtr::continueAnimation() (./kdenetwork/krn/kbusyptr.cpp:97)
void KBusyPtr :: continueAnimation (void)
{
animated = TRUE;
start(frameDelay);
}
//-----------------------------------------------------------------------------
krn'KBusyPtr::loadBitmap() (./kdenetwork/krn/kbusyptr.cpp:105)
bool KBusyPtr :: loadBitmap (QBitmap& bm, const QString& filename)
{
QString f;
bool rc;
if (filename[0]=='/' || filename[0]=='.')
{
f = filename;
}
else
{
f = app->kde_datadir().copy();
f += "/kmail/pics/";
f += filename;
}
rc = bm.load(f);
if (!rc) printf ("ERROR: cannot load bitmap %s\n", f.data());
return rc;
}
//-----------------------------------------------------------------------------
krn'KBusyPtr::loadCursor() (./kdenetwork/krn/kbusyptr.cpp:127)
void KBusyPtr :: loadCursor (const char* cursorName,const char* maskName)
{
int i, ix, iy, numX, numY, x, y;
QBitmap map, mask;
QBitmap cmap(16,16), cmask(16,16);
numCursors = 0;
if (!loadBitmap(map,cursorName)) return;
if (!loadBitmap(mask,maskName)) return;
numX = map.width() >> 4;
numY = map.height() >> 4;
numCursors = numX * numY;
if (bitmapList) delete[] bitmapList;
QSize size(16,16);
bitmapList = new QBitmap[numCursors](size);
if (cursorList) delete[] cursorList;
cursorList = new QCursor[numCursors];
for (i=0,iy=0,y=0; iy<numY; iy++, y+=16)
{
for (ix=0,x=0; ix<numX; ix++, x+=16, i++)
{
bitBlt(&cmap, 0, 0, &map, x, y, 16, 16);
bitBlt(&cmask, 0, 0, &mask, x, y, 16, 16);
cursorList[i] = QCursor(cmap, cmask, 8, 8);
}
}
}