00001 /*************************************************************************** 00002 MCursor.cc - description 00003 ------------------- 00004 begin : Thu Dec 30 1999 00005 copyright : (C) 1999 by Jurrien Loonstra 00006 email : j.h.loonstra@st.hanze.nl 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 #include "MCursor.h" 00018 00019 #ifdef KDEVER 00020 #include <kapp.h> 00021 #include <kstandarddirs.h> 00022 #endif 00023 #include <opie2/odebug.h> 00024 #include <opie2/oresource.h> 00025 00026 #include <qbitmap.h> 00027 00028 MCursor::~MCursor() { 00029 delete cursor; 00030 } 00031 00032 void MCursor::load(const char *name, int masked) { 00033 00034 #ifdef KDEVER 00035 QString file, mfile; 00036 KStandardDirs dirs; 00037 00038 00039 file = dirs.findResource("data","kbill/bitmaps/" + QString::fromLocal8Bit(name) + ".xbm"); 00040 00041 QBitmap bitmap, mask; 00042 if (bitmap.load(file) == FALSE) { 00043 oerr << "cannot open " << file << oendl; 00044 exit(1); 00045 } 00046 if (masked == SEP_MASK) { 00047 // mfile.sprintf ("%sbitmaps/%s_mask.xbm", (const char*)dir, name); 00048 mfile = file = dirs.findResource("data","kbill/bitmaps/" + QString::fromLocal8Bit(name) + "_mask.xbm"); 00049 if (mask.load(mfile) == FALSE) { 00050 oerr << "cannot open " << file << oendl; 00051 exit(1); 00052 } 00053 } 00054 else 00055 mask = bitmap; 00056 #endif 00057 00058 QBitmap bitmap, mask; 00059 bitmap = Opie::Core::OResource::loadPixmap( "kbill/bitmaps/" + QString::fromLocal8Bit( name ) ); 00060 00061 if (masked == SEP_MASK) 00062 mask = bitmap = Opie::Core::OResource::loadPixmap( "kbill/bitmaps/" + QString::fromLocal8Bit(name) + "_mask.xbm" ); 00063 else 00064 mask = bitmap; 00065 cursor = new QCursor(bitmap, mask, bitmap.width() / 2, bitmap.height() / 2); 00066 } 00067
1.4.2