dslinux/user/pixil/packages/viewml/viewml/src/fltk drag.cpp drag.h fltk-qbase.h fltk-qdefs.h history.cpp history.h kapp.h kcharsets.cpp kcharsets.h klocale.h nxscroll.cpp nxscroll.h nxscrollbar.cpp nxscrollbar.h nxslider.cpp nxslider.h qapp.h qapplication.h qarray.h qbitmap.h qbrush.h qbuffer.h qcheckbox.h qcollection.h qcolor.cpp qcolor.h qcombobox.h qconnection.h qconst.h qcursor.h qdict.h qdir.h qdrawutil.cpp qdrawutil.h qevent.h qfile.h qfont.cpp qfont.h qfontinfo.cpp qfontinfo.h qfontmetrics.h qframe.h qimage.h qintdict.h qiodevice.h qkeycode.h qlineedit.cpp qlineedit.h qlineedit.moc qlist.h qlistbox.h qmetaobject.h qmovie.h qmultilinedit.h qobject.cpp qobject.h qobjectdefs.h qpaintdevice.h qpainter.cpp qpainter.h qpalette.h qpen.h qpixmap.cpp qpixmap.h qpoint.h qpopupmenu.h qprinter.h qpushbutton.cpp qpushbutton.h qpushbutton.moc qradiobutton.h qrect.cpp qrect.h qregexp.cpp qregexp.h qregion.h qscrollbar.cpp qscrollbar.h qscrollbar.moc qsize.h qstack.h qstring! .cpp qstring.h qstrlist.h qtimer.cpp qtimer.h qtimer.moc qwidget.cpp qwidget.h qwmatrix.h
amadeus
dslinux_amadeus at user.in-berlin.de
Tue Oct 3 13:26:47 CEST 2006
Update of /cvsroot/dslinux/dslinux/user/pixil/packages/viewml/viewml/src/fltk
In directory antilope:/tmp/cvs-serv11916/packages/viewml/viewml/src/fltk
Added Files:
drag.cpp drag.h fltk-qbase.h fltk-qdefs.h history.cpp
history.h kapp.h kcharsets.cpp kcharsets.h klocale.h
nxscroll.cpp nxscroll.h nxscrollbar.cpp nxscrollbar.h
nxslider.cpp nxslider.h qapp.h qapplication.h qarray.h
qbitmap.h qbrush.h qbuffer.h qcheckbox.h qcollection.h
qcolor.cpp qcolor.h qcombobox.h qconnection.h qconst.h
qcursor.h qdict.h qdir.h qdrawutil.cpp qdrawutil.h qevent.h
qfile.h qfont.cpp qfont.h qfontinfo.cpp qfontinfo.h
qfontmetrics.h qframe.h qimage.h qintdict.h qiodevice.h
qkeycode.h qlineedit.cpp qlineedit.h qlineedit.moc qlist.h
qlistbox.h qmetaobject.h qmovie.h qmultilinedit.h qobject.cpp
qobject.h qobjectdefs.h qpaintdevice.h qpainter.cpp qpainter.h
qpalette.h qpen.h qpixmap.cpp qpixmap.h qpoint.h qpopupmenu.h
qprinter.h qpushbutton.cpp qpushbutton.h qpushbutton.moc
qradiobutton.h qrect.cpp qrect.h qregexp.cpp qregexp.h
qregion.h qscrollbar.cpp qscrollbar.h qscrollbar.moc qsize.h
qstack.h qstring.cpp qstring.h qstrlist.h qtimer.cpp qtimer.h
qtimer.moc qwidget.cpp qwidget.h qwmatrix.h
Log Message:
adding pristine copy of pixil to HEAD so I can branch from it
--- NEW FILE: qobject.cpp ---
#include "qobject.h"
#include "qevent.h"
#include <Fl.H>
#include <math.h>
#include <unistd.h>
QObject::__timerobj * QObject::m_TimerList[MAXTIMERS];
bool QObject::m_bInit = false;
QObject::__timerobj::__timerobj(QObject * p, int interval)
{
m_pThis = p;
m_nInterval = interval;
}
void QObject::InitializeTimers()
{
for(int i=0; i<MAXTIMERS; i++)
m_TimerList[i] = NULL;
m_bInit = true;
}
QObject::~QObject()
{
for(int i=0; i<MAXTIMERS; i++)
{
if(m_TimerList[i])
{
if(m_TimerList[i]->getThis() == this)
{
delete m_TimerList[i];
m_TimerList[i] = NULL;
}
}
}
// removeThis();
}
void QObject::addSender(QObject * p)
{
m_Senders.append(p);
}
void QObject::removeThis()
{
QDictIterator<QConnectionList> i(m_ConnectionDict);
QConnectionList * list;
QConnection * c;
QObject * p;
while( (p = m_Senders.take(0))) {
p->removeMe(this);
}
// remove me from all the sender lists
while((list = i.current())) {
for(c = list->first(); c; c = list->next()) {
if(c->object()) {
((QObject*)c->object())->removeSender(this);
}
}
++i;
}
}
void QObject::removeSender(QObject * o)
{
while(m_Senders.removeRef(o));
}
void QObject::removeMe(QObject * p)
{
QDictIterator<QConnectionList> i(m_ConnectionDict);
QConnectionList * list;
QConnection * c;
while((list = i.current())) {
for(c = list->first(); c; c = list->next()) {
if(c->object() == p) {
list->removeRef(c);
// delete c;
}
}
++i;
}
}
void QObject::initMetaObject()
{
}
void QObject::killTimer(int id)
{
DestroyTimer(id);
}
void QObject::TimerFire()
{
QTimerEvent e;
timerEvent(&e);
}
void QObject::timerEvent(QTimerEvent * e)
{
cerr << "QObject::timerEvent base called\n";
}
int QObject::startTimer(int interval)
{
__timerobj * t = CreateTimer(interval);
Fl::add_timeout(interval * .001, runthread, t);
return t->getId();
}
QObject::__timerobj * QObject::CreateTimer(int interval)
{
__timerobj * t = new __timerobj(this,interval);
if(!m_bInit)
InitializeTimers();
for(int i=1; i<MAXTIMERS; i++)
{
if(m_TimerList[i] == NULL)
{
m_TimerList[i] = t;
t->setId(i);
return t;
break;
}
}
return NULL;
}
void QObject::DestroyTimer(int timer)
{
if(m_TimerList[timer])
{
Fl::remove_timeout(runthread,m_TimerList[timer]);
delete m_TimerList[timer];
}
m_TimerList[timer] = NULL;
}
void QObject::runthread(void * p)
{
for(int i=0; i<MAXTIMERS; i++)
{
if(m_TimerList[i] == p)
{
__timerobj * t = (__timerobj*)p;
if(t->getThis())
t->getThis()->TimerFire();
// make sure that this timer hasn't been removed
// in the callback
if(m_TimerList[i] == t) {
int id = t->getId();
if(m_TimerList[id])
Fl::add_timeout(t->getInterval() * .001 ,runthread,p);
}
break;
}
}
}
bool QObject::connect ( const QObject * sender,
const char * signal, const QObject * receiver,
const char * member )
{
if(!sender->metaObject())
((QObject*)sender)->initMetaObject();
if(!receiver->metaObject())
((QObject*)receiver)->initMetaObject();
QString _signal,_member,tmp;
tmp = signal+1;
_signal = tmp.stripWhiteSpace();
tmp = member;
_member = tmp.stripWhiteSpace();
if(!((QObject*)sender)->m_ConnectionDict[_signal])
((QObject*)sender)->m_ConnectionDict.insert(_signal,new QConnectionList());
QConnectionList * cl = ((QObject*)sender)->m_ConnectionDict[_signal];
QMember p = receiver->findslot(_member);
// cerr << "Connecting " << _signal << " with " << _member << "(" << p << ")\n";
cl->append(new QConnection(receiver,p, _member));
// cl->append(new QConnection(receiver,
// receiver->findslot(_member), _member));
((QObject*)receiver)->addSender((QObject*)sender);
return true;
}
bool QObject::connect ( const QObject * sender, const char * signal,
const char * member ) const
{
return connect(sender,signal,this,member);
}
QMember QObject::findsignal(const char * signal) const
{
QString _signal,tmp;
tmp = signal;
_signal = tmp.stripWhiteSpace();
// cerr << "QObject::findsignal " << className() << "::" << signal << "\n";
if(metaObject()) {
QMember mbr = metaObject()->findsignal(_signal);
return mbr;
} else {
return 0;
}
}
QMember QObject::findslot(const char * slot) const
{
QString _slot,tmp;
tmp = slot;
_slot = tmp.stripWhiteSpace();
// cerr << "QObject::findslot " << className() << "::" << slot << "\n";
if(metaObject()) {
QMember mbr = metaObject()->findslot(_slot);
return mbr;
} else {
return 0;
}
}
void QObject::activate_signal(const char * signal, const char * p0)
{
QString _signal,tmp;
tmp = signal;
_signal = tmp.stripWhiteSpace();
QConnectionList * cl = m_ConnectionDict[_signal];
// cerr << " QObject::activate_signal " << _signal << " cl = " << cl << "\n";
// cerr << " QObject::activate_signal this = " << this << "\n";
if(!cl)
return;
// cerr << " count = " << cl->count() << "\n";
QConnection * c;
for(unsigned int i=0; i<cl->count(); i++) {
c = (*cl)[i];
if(c) {
typedef void (QObject::*RT1)(const char *);
typedef RT1 * PRT1;
// cerr << " Going to call " << c << "\n";
RT1 qm = *((PRT1)(c->member()));
// cerr << " c->object = " << c->object() << " from " << this << "\n";
if(qm)
(((QObject*)c->object())->*qm)(p0);
// cerr << " returned from call\n";
}
}
}
void QObject::activate_signal(const char * signal)
{
QString _signal,tmp;
tmp = signal;
_signal = tmp.stripWhiteSpace();
QConnectionList * cl = m_ConnectionDict[_signal];
// cerr << " QObject::activate_signal " << _signal << " cl = " << cl << "(" << cl->count() << ")\n";
//cerr << " QObject::activate_signal this = " << this << "\n";
if(!cl)
return;
QConnection * c;
for(unsigned int i=0; i<cl->count(); i++) {
c = (*cl)[i];
if(c) {
QMember qm = *c->member();
if(qm)
(((QObject*)c->object())->*qm)();
}
}
}
void QObject::activate_signal(const char * signal, int p0)
{
QString _signal,tmp;
tmp = signal;
_signal = tmp.stripWhiteSpace();
QConnectionList * cl = m_ConnectionDict[_signal];
// cerr << " QObject::activate_signal " << _signal << " cl = " << cl << "\n";
// cerr << " QObject::activate_signal this = " << this << "\n";
if(!cl)
return;
QConnection * c;
for(unsigned int i=0; i<cl->count(); i++) {
c = (*cl)[i];
if(c) {
typedef void (QObject::*RT1)(int);
typedef RT1 * PRT1;
RT1 qm = *((PRT1)(c->member()));
if(qm)
(((QObject*)c->object())->*qm)(p0);
}
}
}
QConnectionList * QObject::receivers(const char * signal) const
{
QString _signal,tmp;
tmp = signal;
_signal = tmp.stripWhiteSpace();
QConnectionList * cl = ((QObject*)this)->m_ConnectionDict[_signal];
return cl;
}
--- NEW FILE: qstrlist.h ---
#ifndef QSTRLIST_H
#define QSTRLIST_H
#include "qstring.h"
#include "qarray.h"
#include "qcollection.h"
#include <vector>
class QStrList : public vector<char *>, public QCollection
{
protected:
int m_nCurrent;
bool m_bDeepCopies;
public:
QStrList(bool deepCopies=true) { m_nCurrent=0; m_bDeepCopies = deepCopies; }
virtual ~QStrList() { }
void append(const char * t) { push_back((char *)t); }
int count() const { return size(); }
bool isEmpty() const { return empty(); }
char * next() {
if(m_nCurrent<(size()-1))
return (*this)[++m_nCurrent];
else
return NULL;
}
int find(const char * c)
{
int i;
for(i=0; i<size(); i++) {
if(!strcmp((*this)[i],c)) {
m_nCurrent = i;
return i;
}
}
return -1;
}
char * at(int & i) {
if(i<(size()-1)) {
m_nCurrent = i;
return (*this)[i];
} else {
return NULL;
}
}
int size() const { return (int)vector<char*>::size(); }
char * getLast() const {
if(size())
return (*this)[size()-1];
else
return NULL;
}
char * getFirst() const {
if(size())
return (*this)[0];
else
return NULL;
}
char * first() {
if(size()) {
m_nCurrent = 0;;
return (*this)[0];
} else {
return NULL;
}
}
};
#endif
--- NEW FILE: qtimer.h ---
#ifndef __QTIMER_H
#define __QTIMER_H
#include "fltk-qbase.h"
#include "qevent.h"
class QTimer : public QObject
{
Q_OBJECT;
protected:
bool m_bActive;
bool m_bSingleShot;
int m_nTimerID;
public:
QTimer(QObject * parent=0, const char * name = 0);
~QTimer()
{
}
virtual void timerEvent(QTimerEvent * e);
bool isActive() const;
int start( int msec, bool sshot = FALSE);
void stop();
signals:
void timeout();
};
#endif
--- NEW FILE: nxscrollbar.h ---
#ifndef __NXSCROLLBAR_H
#define __NXSCROLLBAR_H
#include "nxslider.h"
class NxScrollbar : public NxSlider
{
int linesize_;
int pushed_;
FL_EXPORT void draw();
FL_EXPORT int handle(int);
static FL_EXPORT void timeout_cb(void*);
FL_EXPORT void increment_cb();
public:
NxScrollbar(int x, int y, int w, int h, const char * l=0);
int value() {return int(NxSlider::value());}
int value(int position, int size, int top, int total) {
return scrollvalue(position, size, top, total);
}
int linesize() const {return linesize_;}
void linesize(int i) {linesize_ = i;}
};
#endif
--- NEW FILE: qcollection.h ---
#ifndef __QCOLLECTION_H
#define __QCOLLECTION_H
class QCollection
{
protected:
bool m_bAutoDelete;
public:
QCollection() { m_bAutoDelete = false; }
void setAutoDelete(bool b) { m_bAutoDelete = b; }
};
#endif
--- NEW FILE: qobjectdefs.h ---
#ifndef __QOBJECTDEFS_H
#define __QOBJECTDEFS_H
#define emit
#define METHOD(a) "0"#a
#define SLOT(a) "1"#a
#define SIGNAL(a) "2"#a
#define Q_NAME2(a,b) Q_NAME2_AUX(a,b)
#define Q_NAME2_AUX(a,b) a##b
//#define Q_DECLARE(a,t) Q_NAME2(a,declare)(t)
#define Q_DECLARE(a,t) ;
#define QListM_QConnection QConnectionList
class QConnectionListIt;
class QConnectionList;
#define Q_OBJECT \
public: \
QMetaObject *metaObject() const { return metaObj; } \
const char *className() const; \
protected: \
virtual void initMetaObject(); \
private: \
static QMetaObject *metaObj;
#endif
--- NEW FILE: qpoint.h ---
#ifndef QPOINT_H
#define QPOINT_H
#include "qarray.h"
class QPoint
{
public:
QPoint() { m_nX = 0; m_nY = 0; }
QPoint(int x, int y) { m_nX = x; m_nY = y; }
int x() const { return m_nX; }
int y() const { return m_nY; }
void setX(int x) { m_nX = x; }
void setY(int y) { m_nY = y; }
protected:
int m_nX;
int m_nY;
};
class QPointArray : public QArray<QPoint>
{
public:
void setPoint(uint i, int x, int y) { }
};
#endif
--- NEW FILE: qfont.h ---
#ifndef QFONT_H
#define QFONT_H
#include "qrect.h"
#include "qpoint.h"
#include "qsize.h"
#include "fltk-qbase.h"
#include "fl_draw.H"
class QFont
{
protected:
int m_nPixelSize;
public:
QFont();
QFont ( const QString & family, int pointSize = 16,
int weight = Normal, bool italic = FALSE );
enum CharSet {ISO_8859_1, Latin1 = ISO_8859_1, AnyCharSet, ISO_8859_2,
Latin2 = ISO_8859_2, ISO_8859_3, Latin3 = ISO_8859_3,
ISO_8859_4, Latin4 = ISO_8859_4, ISO_8859_5, ISO_8859_6,
ISO_8859_7, ISO_8859_8, ISO_8859_9, Latin5 = ISO_8859_9,
ISO_8859_10, Latin6 = ISO_8859_10, ISO_8859_11, ISO_8859_12,
ISO_8859_13, Latin7 = ISO_8859_13, ISO_8859_14,
Latin8 = ISO_8859_14, ISO_8859_15, Latin9 = ISO_8859_15,
KOI8R, Set_Ja, Set_1 = Set_Ja, Set_Ko, Set_Th_TH, Set_Zh,
Set_Zh_TW, Set_N = Set_Zh_TW, Unicode, Set_GBK, Set_Big5 };
protected:
CharSet m_CharSet;
public:
enum Weight { Light = 25, Normal = 50, DemiBold = 63, Bold = 75,
Black = 87 };
QString m_sFamily;
int m_nWeight;
bool m_bItalic;
bool m_bUnderline;
bool m_bStrikeOut;
void setFamily(const QString & f) { m_sFamily = f; }
void setWeight(int & w) { m_nWeight = w; }
void setItalic(bool & i) { m_bItalic = i; }
void setUnderline(bool & u) { m_bUnderline = u; }
void setStrikeOut(bool & s) { m_bStrikeOut = s; }
void SelectFont() const;
// CRH for qpushbutton
const int getFont() const;
CharSet charSet() const { return m_CharSet; }
void setCharSet(CharSet set) { m_CharSet = set; }
const int weight() const
{ return m_nWeight; }
const bool italic() const
{ return m_bItalic; }
const bool underline() const
{ return m_bUnderline; }
const bool strikeOut() const
{ return m_bStrikeOut; }
const char * family() const
{ return m_sFamily; }
// CRH
const int size() const
{ return m_nPixelSize; }
};
#endif
--- NEW FILE: qstring.cpp ---
#include <assert.h>
#include <string.h>
#include "qstring.h"
#include "qregexp.h"
int QString::find(const QRegExp & reg, int index) const
{
return reg.match(*this);
}
int QString::find(char c, int index=0, bool cs=true) const
{
const char *cp = c_str();
int len = strlen(cp);
for(int i=index; i<len; i++)
{
if(cs)
{
if(cp[i] == c)
return(i);
}
else
{
if(tolower(cp[i]) == tolower(c))
return(i);
}
}
return(-1);
}
int QString::find(const QString & str, int index=0, bool cs=true) const
{
const char *c = c_str();
int len = strlen(c);
int slen = str.length();
for(int i=index; i<len; i++)
{
if(cs)
{
if(strncmp(c+i,str,slen) == 0)
return(i);
}
else
{
if(strncasecmp(c+i,str,slen) == 0)
return(i);
}
}
return(-1);
}
/*
**
** Finds the first occurrence of the string 'str', starting at position
** 'index' and searching backwards. If 'index' is negative, the search
** starts at the end.
**
** The search is case sensitive if 'cs' is TRUE, or case insensitive
** if 'cs' is FALSE.
**
** Returns the position of 'str', or -1 if 'str' could not be found.
**
*/
int QString::findRev(const QString & str, int index=-1, bool cs=true) const
{
const char *ref = c_str();
const char *sub = str.data();
// this assertion fires if cs is FALSE. The code below doesn't
// handle case insensitive searches (yet).
assert(cs == TRUE);
if(index == -1)
index = strlen(ref) - 1;
while(index >= 0)
{
if(strstr(ref + index,sub))
break;
--index;
}
// printf("Searching for \"%s\" in \"%s\"\n",sub,ref);
// printf("Returning %d\n",index); getchar();
return(index);
}
/*
**
** This is an overloaded member function, provided for convenience. It
** differs from the above function only in what argument(s) it accepts.
**
*/
int QString::findRev(char c, int index=-1, bool cs=true) const
{
const char *ref = c_str();
// this assertion fires if cs is FALSE. The code below doesn't
// handle case insensitive searches (yet).
assert(cs == TRUE);
if(index == -1)
index = strlen(ref) - 1;
while(index >= 0)
{
if(*(ref + index) == c)
break;
--index;
}
// printf("Searching for '%c' in \"%s\"\n",c,ref);
// printf("Returning %d\n",index); getchar();
return(index);
}
--- NEW FILE: qdir.h ---
#ifndef __QDIR_H
#define __QDIR_H
#include "qstring.h"
#include "fltk-qdefs.h"
class QDir
{
public:
enum FilterSpec { Dirs = 0x001, Files = 0x002, Drives = 0x004,
NoSymLinks = 0x008, All = 0x007, TypeMask = 0x00F,
Readable = 0x010, Writable = 0x020, Executable = 0x040,
RWEMask = 0x070, Modified = 0x080, Hidden = 0x100,
System = 0x200, AccessMask = 0x3F0, DefaultFilter = -1 };
enum SortSpec { Name, Time, Size, Unssorted,
SortByMask = 0x03, DirsFirst = 0x04, Reversed = 0x08,
IgnoreCase = 0x10, DefaultSort = -1 };
QDir() { }
QDir(const QString & path, const QString & nameFilter = "",
int sortSpec = Name | IgnoreCase, int filterSpec = All) { }
static QString cleanDirPath(const QString & dirPath) { return ""; }
virtual bool exists() const { return true; }
virtual void setFilter(int filterSpec) { }
virtual void setSorting(int sortSpec) { }
};
#endif
--- NEW FILE: qimage.h ---
--- NEW FILE: qfontinfo.cpp ---
#include "qfontinfo.h"
QFontInfo::QFontInfo(QFont & qf)
{
m_family = qf.family();
m_italic = qf.italic();
m_weight = qf.weight();
m_charSet = qf.charSet();
}
QString QFontInfo::family()
{
return(m_family.data());
}
bool QFontInfo::italic()
{
return(m_italic);
}
static char *fixed_pitch_list[] =
{
"courier",
NULL
};
bool QFontInfo::fixedPitch()
{
int count;
count = 0;
while(fixed_pitch_list[count])
{
if(strcmp(m_family.data(),fixed_pitch_list[count++]) == 0)
return(true);
}
return(false);
}
bool QFontInfo::bold()
{
if(m_weight > 50)
return(true);
else
return(false);
}
QFont::CharSet QFontInfo::charSet()
{
return(m_charSet);
}
--- NEW FILE: history.h ---
#define MAX_HISTORY_LEN 20
class History
{
public:
History(void);
~History(void);
void AddToHistoryList(const char *str);
const char *GetHistoryEntry(int entry);
protected:
private:
char *m_list[MAX_HISTORY_LEN];
};
--- NEW FILE: klocale.h ---
#ifndef __KLOCALE_H
#define __KLOCALE_H
#include "qstring.h"
class KLocale
{
protected:
QString m_CharSet;
public:
KLocale() { m_CharSet = "us-ascii"; }
const QString & charset() const { return m_CharSet; }
};
#endif
--- NEW FILE: drag.cpp ---
#include "drag.h"
QMetaObject * KDNDWidget::metaObj = 0;
void KDNDWidget::initMetaObject()
{
}
const char * KDNDWidget::className() const
{
return "KDNDWidget";
}
--- NEW FILE: qlineedit.h ---
#ifndef __QLINEEDIT_H
#define __QLINEEDIT_H
#include "qwidget.h"
#include "qstring.h"
#include <Fl_Input.H>
class QLineEdit : public QWidget
{
Q_OBJECT
protected:
Fl_Input * m_pInput;
public:
enum EchoMode { Normal, NoEcho, Password };
QLineEdit(QWidget * parent, const char * name=0);
~QLineEdit() { }
QString text() const { return m_pInput->value(); }
void _callback();
void setText(const QString & text) { m_pInput->value(text); }
void setMaxLength(int len) { m_pInput->maximum_size(len); }
int maxLength() const { return m_pInput->maximum_size(); }
virtual void setEchoMode(bool echo) { if(echo) m_pInput->type(FL_SECRET_INPUT); }
signals:
void textChanged( const char *);
void returnPressed( );
};
#endif
--- NEW FILE: qbrush.h ---
#ifndef __QBRUSH_H
#define __QBRUSH_H
#include "qcolor.h"
enum BrushStyle // brush style
{ NoBrush, SolidPattern,
Dense1Pattern, Dense2Pattern, Dense3Pattern, Dense4Pattern,
Dense5Pattern, Dense6Pattern, Dense7Pattern,
HorPattern, VerPattern, CrossPattern,
BDiagPattern, FDiagPattern, DiagCrossPattern, CustomPattern=24 };
class QBrush
{
protected:
QColor m_Color;
BrushStyle m_BS;
public:
QBrush() { }
QBrush(const QColor & color, BrushStyle bs=SolidPattern)
{
m_Color = color;
m_BS = bs;
}
const QColor & color() const { return m_Color; }
};
#endif
--- NEW FILE: qrect.h ---
#ifndef QRECT_H
#define QRECT_H
#include "qpoint.h"
class QRect
{
protected:
int m_nX;
int m_nY;
int m_nWidth;
int m_nHeight;
public:
QRect() { m_nWidth = m_nHeight = m_nX = m_nY = 0; }
QRect(int left, int top, int width, int height)
{
m_nX = left;
m_nY = top;
m_nWidth = width;
m_nHeight = height;
}
bool contains(const QRect & r, bool proper=false) const;
bool contains(const QPoint & p, bool proper=false) const;
bool intersects(const QRect & r) const;
QRect intersect(const QRect & r) const;
void moveBy(int dx, int dy)
{
m_nX += dx;
m_nY += dy;
}
int x() const { return m_nX; }
int y() const { return m_nY; }
int width() const { return m_nWidth; }
int height() const { return m_nHeight; }
void setRight(int r) { m_nWidth = r - m_nX; }
void setBottom(int b) { m_nHeight = b - m_nY; }
void setWidth(int w) { m_nWidth = w; }
void setHeight(int h) { m_nHeight = h; }
};
#endif
--- NEW FILE: qlist.h ---
#ifndef __QLIST_H
#define __QLIST_H
#include <vector>
#include "qcollection.h"
template <class T>
class QList : public vector<T*>, public QCollection
{
private:
int m_nCurrent;
public:
QList() : QCollection() { m_nCurrent = 0;}
virtual ~QList() { clear(); }
void append(const T * t) { push_back((T*)t); }
unsigned int count() const { return (unsigned int)size(); }
bool isEmpty() const { return empty(); }
void clear() {
while(removeLast());
}
T * current() {
if(size() && m_nCurrent != -1)
return (*this)[m_nCurrent];
else
return NULL;
}
T * prev() {
if(m_nCurrent>0) {
return (*this)[--m_nCurrent];
} else {
m_nCurrent=-1;
return NULL;
}
}
T * next() {
if(m_nCurrent<(size()-1)) {
return (*this)[++m_nCurrent];
} else {
m_nCurrent=-1;
return NULL;
}
}
int at() const {
if(size() && m_nCurrent != -1)
return m_nCurrent;
else
return -1;
}
T * at(const int & i) {
if(i<(size())) {
m_nCurrent = i;
return (*this)[i];
} else {
return NULL;
}
}
bool removeLast() {
if(size()) {
if(m_bAutoDelete)
delete getLast();
pop_back();
return true;
} else {
return false;
}
}
T* take(unsigned int index) {
if(!size())
return NULL;
T* tmp = (*this)[0];
erase(begin());
if(!size())
m_nCurrent = -1;
if(m_nCurrent > size())
m_nCurrent = size();
return tmp;
}
T* getFirst() const {
if(size())
return (*this)[0];
else
return NULL;
}
T* getLast() const {
if(size())
return (*this)[size()-1];
else
return NULL;
}
T* first() {
if(size()) {
m_nCurrent = 0;;
return (*this)[0];
} else {
return NULL;
}
}
T* last() {
if(size()) {
m_nCurrent = size()-1;
return (*this)[size()-1];
} else {
return NULL;
}
}
bool remove(const T* item)
{
return removeRef(item);
}
int size() const { return (int)vector<T*>::size(); }
int findRef(const T* t)
{
int i;
for(i=0; i<size(); i++) {
if((*this)[i] == t) {
m_nCurrent = i;
return i;
}
}
return -1;
}
bool removeRef(const T* item)
{
vector<T*>::iterator pos = find(begin(),end(),item);
if(pos != end()) {
if(m_bAutoDelete)
delete *pos;
erase(pos);
return true;
}
return false;
}
};
#endif
--- NEW FILE: qapplication.h ---
#ifndef __QAPPLICATION_H
#define __QAPPLICATION_H
class QApplication
{
};
#endif
--- NEW FILE: qarray.h ---
#ifndef __QARRAY_H
#define __QARRAY_H
#include <sys/types.h>
template <class T>
class QArray
{
protected:
// T m_Temp;
unsigned char * m_pBuffer;
int m_nSize ;
public:
QArray() { m_pBuffer =0; m_nSize =0; }
QArray(int sz) { m_pBuffer =0; m_nSize =0; resize(sz); }
unsigned int size() { return (unsigned int)m_nSize; }
bool fill(const T & v, int newsize=-1)
{
unsigned int index = 0;
if(newsize > 0)
resize(newsize);
while(size() > index)
(*this)[index++] = v;
return true;
}
QArray<T> copy() const { return *this; }
void resize(int size)
{
unsigned char * b;
if(m_nSize < size) {
b = new unsigned char[size * sizeof(T)];
memcpy(b, m_pBuffer, m_nSize * sizeof(T));
delete [] m_pBuffer;
m_pBuffer = b;
m_nSize = size;
}
}
T & operator[](int index)
{
if(index >= (int)size())
resize(index + 10);
return (T&)*(T*)(m_pBuffer + (sizeof(T) * index));
}
};
#endif
--- NEW FILE: qbuffer.h ---
#ifndef __QBUFFER_H
#define __QBUFFER_H
#include "qiodevice.h"
class QByteArray
{
protected:
const char * m_Buffer;
unsigned int m_nSize;
public:
QByteArray () { m_Buffer = 0; m_nSize =0 ;}
~QByteArray() { delete [] m_Buffer; }
QByteArray(const QByteArray & a)
{
m_Buffer =0;
m_nSize=0;
if(a.buffer() && a.length())
assign(a.buffer(),a.length());
}
QByteArray & assign(const char * a, unsigned int n)
{
if(m_Buffer)
delete [] m_Buffer;
m_Buffer = new char [n];
memcpy((char*)m_Buffer,a,n);
m_nSize = n;
return *this;
}
unsigned int length() const { return m_nSize; }
const char * buffer() const { return m_Buffer; }
};
class QBuffer : public QIODevice
{
protected:
QByteArray m_Buffer;
public:
QBuffer() { }
QBuffer(const QBuffer & b) : m_Buffer(b.m_Buffer) { }
virtual ~QBuffer() { }
virtual int readBlock(char * data, unsigned int maxlen)
{
unsigned int len = (m_Buffer.length() > maxlen ? maxlen : m_Buffer.length());
memcpy(data,m_Buffer.buffer(),len );
return len;
}
virtual int writeBlock( const char * data, unsigned int len)
{
m_Buffer.assign(data,len);
return 0;
}
QByteArray buffer() const { return m_Buffer; }
};
#endif
--- NEW FILE: qpainter.h ---
#ifndef __QPAINTER_H
#define __QPAINTER_H
#include "qpen.h"
#include "qfont.h"
#include "qfontinfo.h"
#include "qbrush.h"
#include "qpixmap.h"
#include "qrect.h"
#include "qwmatrix.h"
#include "qfontmetrics.h"
#include "Fl_Widget.H"
#include <iostream.h>
//#define ADJUSTX(_x) (m_Widget->x() + _x)
//#define ADJUSTY(_y) (m_Widget->y() + _y)
#define ADJUSTX(_x) (_x)
#define ADJUSTY(_y) (_y)
class QPainter
{
protected:
QPen m_Pen;
QFont m_Font;
QColor m_BGColor;
QBrush m_Brush;
QRect m_ClipRect;
bool m_bClipping;
FLTK_PARENT_WIDGET * m_Widget;
public:
QPainter() { }
QPainter(const QPaintDevice * pd) { }
QPaintDevice * device() const { return 0; }
bool begin(const QPaintDevice * pix);
bool end();
void drawEllipse(int x, int y, int w, int h);
void drawEllipse(const QRect & rect);
void fillRect(int x, int y, int w, int h, const QBrush & br);
void drawPixmap(int x, int y, const QPixmap & pix);
void drawPixmap(const QPoint & point, const QPixmap & pixmap,
const QRect & rect);
void drawText(int x, int y, const QString & str, int len=-1);
const QPen & pen() const { return m_Pen; }
void setPen(const QColor & color) { m_Pen = QPen(color); }
void setPen(const QPen & pen) { m_Pen = pen; }
QFontMetrics fontMetrics() const { return QFontMetrics(m_Font); }
const QFont & font() const { return m_Font; }
void setFont(const QFont & font) { m_Font = font; }
void setBrush(const QBrush & brush) { m_Brush = brush; }
void __SetBrushColor()
{
__SetColor(m_Brush.color());
}
void __SetBGColor()
{
__SetColor(m_BGColor);
}
void __SetPenColor()
{
__SetColor(m_Pen.color());
}
void __SetColor(const QColor & c)
{
fl_color(c.red(),
c.green(),
c.blue());
}
void setBackgroundColor(const QColor & c);
void drawRect(int x, int y, int w, int h)
{
__SetBrushColor();
fl_rect(ADJUSTX(x-1),ADJUSTY(y-1),w,h);
}
void qDrawShadePanel( int x, int y, int w, int h,
const QColorGroup & cg, bool sunken,
int lineWidth, const QBrush *fill);
void qDrawShadeLine( int x1, int y1, int x2, int y2,
const QColorGroup &g, bool sunken = TRUE,
int lineWidth = 1, int midLineWidth = 0 );
void drawRect(const QRect & rect)
{
drawRect(rect.x(),rect.y(),rect.width(), rect.height());
}
void scale(double sx, double sy) { }
void eraseRect(int x, int y, int w, int h);
void eraseRect(const QRect & rect);
void setClipRect(int x, int y, int w, int h) { setClipRect(QRect(x,y,w,h)); }
void setClipRect(const QRect & rect) { m_ClipRect = rect; cerr << "setClipRect called\n"; }
void setClipping(bool enable) { m_bClipping = enable; }
};
#endif
--- NEW FILE: qregexp.cpp ---
#include "qregexp.h"
#include "regex.h"
QRegExp::QRegExp(const QString & reg, bool cs, bool wildcard)
{
m_RegExp = reg;
m_bCaseSensitive = cs;
}
int QRegExp::match(const QString & str, int index, int * len,
bool indexIsStart) const
{
regex_t exp;
int result;
size_t nmatch;
regmatch_t pmatch[2];
nmatch = 2;
result = regcomp(&exp,m_RegExp,REG_EXTENDED);
// CRH
if(indexIsStart)
result = regexec(&exp, (char *)str+index, nmatch,pmatch,0);
else
result = regexec(&exp, str, nmatch,pmatch,0);
// result = regexec(&exp, str, nmatch,pmatch,0);
if(len)
*len = pmatch[0].rm_eo - pmatch[0].rm_so;
regfree(&exp);
// CRH pretend to be KDE version of regexp
if(result)
return -1;
else
return pmatch[0].rm_so;
// return result;
}
--- NEW FILE: qscrollbar.h ---
#ifndef __QSCROLLBAR_H
#define __QSCROLLBAR_H
#include "qwidget.h"
//#include "Fl_Scrollbar.H"
#include "nxscrollbar.h"
class QScrollBar : public QWidget
{
Q_OBJECT;
protected:
int m_nLineStep;
int m_nPageStep;
int m_nMin;
int m_nMax;
// Fl_Scrollbar * m_pScroll;
NxScrollbar * m_pScroll;
public:
enum Orientation { Horizontal, Vertical };
QScrollBar()
{
}
QScrollBar(int min, int max, int lineStep, int pageStep, int value,
Orientation o, QWidget * parent, const char * name=0);
void _callback();
virtual void resize(int _x, int _y, int _w, int _h);
void setSteps(int line, int page) { m_nLineStep=line; m_nPageStep=page; }
void setValue(int value);
void setRange(int minValue, int maxValue)
{m_nMin = minValue; m_nMax = maxValue; setValue(0); }
int value() const { return m_pScroll->value(); }
int pageStep() const { return m_nPageStep; }
int lineStep() const { return m_nLineStep; }
void addLine() { setValue(value() + lineStep()); }
void subtractLine() { setValue(value() - lineStep()); }
void addPage() { setValue(value() + pageStep()); }
void subtractPage() { setValue(value() - pageStep()); }
signals:
void valueChanged(int);
};
#endif
--- NEW FILE: qpushbutton.h ---
#ifndef __QPUSHBUTTON_H
#define __QPUSHBUTTON_H
#include "qwidget.h"
#include "qstring.h"
#include "Fl_Button.H"
#ifdef _NANOX
#include "n_x.h"
#else
#include "x.H"
#endif
#define QPUSHBUTTON_HEIGHT 20
#define QPUSHBUTTON_PADDING 10
#define QPUSHBUTTON_VPADDING 6
class QPushButton : public QWidget
{
Q_OBJECT;
protected:
QString m_Text;
Fl_Button * b;
public:
QPushButton(QWidget * parent, const char * name =0);
~QPushButton() {}
QString text() const { return m_Text; }
void _callback();
// CRH moved to qpushbutton.cpp
void setText(const QString & text);
// virtual void setText(const QString & text)
// {
// m_Text = text;
// m_pWidget->label(text);
// fl_font(m_pWidget->labelfont(),m_pWidget->labelsize());
// QWidget::setMinimumSize(fl_width((const char *) text) + QPUSHBUTTON_PADDING,
// QPUSHBUTTON_HEIGHT);
// QWidget::resize(sizeHint());
// }
signals:
void clicked();
};
#endif
--- NEW FILE: qobject.h ---
#ifndef QOBJECT_H
#define QOBJECT_H
#include "qobjectdefs.h"
#include "qmetaobject.h"
#include "qconnection.h"
#include "qdict.h"
#include <iostream.h>
#include <signal.h>
#include <pthread.h>
#define MAXTIMERS 100
class QTimerEvent;
class QObject
{
// timer support
protected:
class __timerobj
{
protected:
QObject * m_pThis;
int m_nInterval;
int m_nID;
public:
__timerobj(QObject * p, int interval);
void setId(int id) { m_nID = id; }
int getId() const { return m_nID; }
QObject * getThis() const { return m_pThis; }
int getInterval() const { return m_nInterval; }
};
static bool m_bInit;
static __timerobj * m_TimerList[MAXTIMERS];
pthread_t m_Thread;
void TimerFire();
static void runthread(void*p);
__timerobj * CreateTimer(int interval);
void DestroyTimer(int timerid);
public:
void InitializeTimers();
// end timer support
protected:
QList<QObject> m_Senders;
QConnectionDict m_ConnectionDict;
QConnectionList * receivers(const char * signal) const;
void addSender(QObject * p);
void removeThis();
void removeSender(QObject * o);
void removeMe(QObject * p);
virtual void initMetaObject();
public:
QObject() { initMetaObject(); }
virtual ~QObject();
virtual void timerEvent(QTimerEvent * e);
int startTimer(int interval);
void killTimer(int id);
bool inherits(const char * c) const { return false; }
virtual const char * className() const { return "ClassNULL"; }
static bool connect ( const QObject * sender,
const char * signal, const QObject * receiver,
const char * member );
bool connect ( const QObject * sender, const char * signal,
const char * member ) const;
bool disconnect ( const char * signal=0, const QObject * receiver=0,
const char * member=0 ) { return false; }
bool disconnect ( const QObject * receiver,
const char * member=0 ) { return false; }
static void badSuperclassWarning(const char * className,
const char * superclassName) { }
bool signalsBlocked() const { return false; }
void blockSignals(bool b) { }
void activate_signal(const char * signal, const char *);
void activate_signal(const char * signal);
void activate_signal(const char * signal, int i);
bool isA(const char * name) const { return !strcmp(className(),name); }
virtual QMetaObject * metaObject() const { return 0; }
QMember findsignal(const char * signal) const;
QMember findslot(const char * slot) const;
};
class QSenderObject : public QObject
{
public:
void setSender(QObject * s) { }
};
#endif
--- NEW FILE: qwidget.h ---
#ifndef __QWIDGET_H
#define __QWIDGET_H
#include "fltk-qbase.h"
#include "qpaintdevice.h"
#include "qcursor.h"
#include "qpalette.h"
#include "qsize.h"
#include "qfontmetrics.h"
#include "qfontinfo.h"
#include "Fl_Widget.H"
#include "fl_draw.H"
#include <iostream.h>
#include "qevent.h"
class QWidget : public QObject, public QPaintDevice
{
Q_OBJECT
protected:
QCursor m_Cursor;
QColor m_Color;
QPalette m_Palette;
QSize m_MinSize;
QFont m_Font;
QFontMetrics m_FontMetrics;
bool m_bInPaint;
bool m_bToss;
Fl_Widget * m_pWidget;
protected:
virtual void keyPressEvent(QKeyEvent * e) { m_bToss = true; }
public:
QWidget() : QObject() { m_bInPaint = false; begin(); m_pWidget = 0; }
QWidget(QWidget * _parent, const char * _name=0, WFlags f=0) :
QObject()
{
m_pWidget = 0;
if(Fl_Group::parent())
((Fl_Group*)parent())->remove(this);
if(_parent) {
_parent->add(this);
setGeometry(0,0,_parent->width(),_parent->height());
end();
} else {
begin();
}
m_bInPaint = false;
}
~QWidget()
{
if(parent()) {
((Fl_Group*)parent())->remove(this);
}
if(m_pWidget)
delete m_pWidget;
}
int height() const { return h(); }
int width() const { return w(); }
int x() const
{
/*
if(parent())
return parent()->x() - Fl_Widget::x();
else
*/
return FLTK_PARENT_WIDGET::x();
}
int y() const
{
/*
if(parent())
return parent()->y() - Fl_Widget::y();
else
*/
return FLTK_PARENT_WIDGET::y();
}
virtual void paintEvent(QPaintEvent * _pe) { }
virtual FL_EXPORT void draw();
bool inPaint() const { return m_bInPaint; }
virtual int handle(int event);
bool isVisible() const { return Fl_Window::visible(); }
virtual void hide();
void raise() { show(); }
virtual void show();
void setMinimumSize(int w, int h) { setMinimumSize(QSize(w,h)); }
void setMinimumSize(const QSize & size) { m_MinSize = size; }
virtual void setCursor(const QCursor & cursor) { m_Cursor = cursor; }
virtual void setFocusProxy(QWidget * w) { }
virtual void setGeometry(int _x, int _y, int _w, int _h);
virtual void setGeometry(const QRect & rect)
{
setGeometry(rect.x(), rect.y(),
rect.width(), rect.height());
}
QPoint mapToGlobal( const QPoint & point) const { return QPoint(1,1); }
QPoint mapFromGlobal( const QPoint & point) const { return QPoint(1,1); }
void repaint();
void repaint(bool erase);
void repaint(int x, int y, int w, int h, bool erase = TRUE);
virtual void setMouseTracking(bool enable) { }
virtual void setBackgroundColor(const QColor & color) { m_Color = color; }
virtual void move(int x, int y);
void grabMouse() { }
void releaseMouse() { }
const QPalette & palette() { return m_Palette; }
bool isUpdatesEnabled() const { return true; }
virtual void resizeEvent( QResizeEvent *);
virtual void resize(const QSize & size)
{ resize(size.width(), size.height()); }
virtual void resize(int w, int h);
virtual void resize(int _x, int _y, int _w, int _h);
virtual QSize sizeHint() const { return m_MinSize; }
void setFont(const QFont & font) { m_Font = font; }
QFont font() const { return m_Font; }
QFontMetrics fontMetrics() const { return m_FontMetrics; }
virtual void mousePressEvent( QMouseEvent *) { }
virtual void mouseMoveEvent( QMouseEvent * ) { }
virtual void mouseReleaseEvent( QMouseEvent * ) { }
void FillKeyEvent(QKeyEvent * e);
void FillMouseEvent(QMouseEvent * e);
void setWidget(Fl_Widget * w);
// CRH
Fl_Widget *QWidget::getWidget();
};
#endif
--- NEW FILE: qcheckbox.h ---
#ifndef __QCHECKBOX_H
#define __QCHECKBOX_H
/* Lots o' changes CRH
#include "qwidget.h"
class QCheckBox : public QWidget
{
public:
QCheckBox(QWidget * parent, const char * name=0) : QWidget(parent,name)
{
}
bool isChecked() const { return true;}
void setChecked(bool check) { }
};
*/
#include "qwidget.h"
#include <Fl_Button.H>
class QCheckBox : public QWidget
{
protected:
Fl_Button *b;
public:
QCheckBox(QWidget * parent, const char * name=0) : QWidget(parent,name)
{
b = new Fl_Button(0, 0, 0, 0, 0);
b->selection_color(FL_YELLOW);
b->box(FL_DOWN_BOX);
b->down_box(FL_DOWN_BOX);
b->type(FL_TOGGLE_BUTTON);
setWidget(b);
}
~QCheckBox() { }
bool isChecked() const { return 1 == b->value();}
void setChecked(bool check) {if(check) b->value(1);}
};
#endif
--- NEW FILE: qmultilinedit.h ---
#ifndef __QMULTILINEDIT_H
#define __QMULTILINEDIT_H
#include "qwidget.h"
#include <Fl_Multiline_Input.H>
class QMultiLineEdit : public QWidget
{
protected:
QString m_Text;
Fl_Multiline_Input * m_pInput;
public:
QMultiLineEdit(QWidget * parent=0, const char * name=0) : QWidget(parent,name)
{
QWidget::setMinimumSize(40,20);
m_pInput = new Fl_Multiline_Input(0,0,40,20,"Text");
setWidget(m_pInput);
}
QString text() const { return m_pInput->value(); }
void setText(const QString & text) { m_pInput->value(text); }
};
#endif
--- NEW FILE: qsize.h ---
#ifndef QSIZE_H
#define QSIZE_H
class QSize
{
protected:
int m_nHeight;
int m_nWidth;
public:
QSize() { m_nHeight = m_nWidth = 0; }
QSize(int w, int h) { m_nHeight = h; m_nWidth = w; }
int width() const { return m_nWidth; }
int height() const { return m_nHeight; }
void setHeight(int h) { m_nHeight = h; }
void setWidth(int w) { m_nWidth = w; }
};
#endif
--- NEW FILE: kapp.h ---
#ifndef __KAPP_H
#define __KAPP_H
#include <kcharsets.h>
#include "klocale.h"
#include "qcursor.h"
#include "fltk-qdefs.h"
class KApplication;
extern KApplication g_KApp;
#ifndef klocale
#define klocale KApplication::getKApplication()->getLocale()
#endif
class KApplication
{
protected:
KCharsets m_Sets;
KLocale m_Locale;
QString m_Data;
public:
KApplication() { m_Data = "./"; }
KCharsets * getCharsets() { return &m_Sets; }
static KApplication * getKApplication() { return &g_KApp; }
static const QString & kde_datadir() { return g_KApp.m_Data; }
static const QString & kde_configdir() { return g_KApp.m_Data; }
QColor selectColor;
QColor selectTextColor;
KLocale * getLocale() { return &m_Locale; }
static GUIStyle style() { return WindowsStyle; }
};
#endif
--- NEW FILE: qmetaobject.h ---
#ifndef __QMETAOBJECT
#define __QMETAOBJECT
#include "qstring.h"
class QObject;
typedef void (QObject::*QMember)();
struct QMetaData
{
char * name;
QMember ptr;
QString _name;
void stripWhiteSpace()
{
QString tmp = name;
_name = tmp.stripWhiteSpace();
}
};
class QMetaObject
{
protected:
QMetaData * m_SlotData;
QMetaData * m_SignalData;;
int m_nSlots;
int m_nSignals;
QString m_strClassName;
public:
QMetaObject( const char *class_name, const char *superclass_name,
QMetaData *slot_data, int n_slots,
QMetaData *signal_data, int n_signals )
{
m_SlotData = slot_data;
m_SignalData = signal_data;
m_nSlots = n_slots;
m_nSignals = n_signals;
m_strClassName = class_name;
for(int i=0; i<m_nSignals; i++) {
m_SignalData[i].stripWhiteSpace();
}
for(int i=0; i<m_nSlots; i++) {
m_SlotData[i].stripWhiteSpace();
}
}
QMember findsignal(const char * signal)
{
QString _signal(signal+1);
_signal = _signal.stripWhiteSpace();
for(int i=0; i<m_nSignals; i++) {
if(!strcmp(m_SignalData[i]._name, _signal))
return m_SignalData[i].ptr;
}
return 0;
}
QMember findslot(const char * slot)
{
QString _slot(slot+1);
_slot = _slot.stripWhiteSpace();
for(int i=0; i<m_nSlots; i++) {
if(!strcmp(m_SlotData[i]._name, _slot))
return m_SlotData[i].ptr;
}
return 0;
}
};
#endif
--- NEW FILE: qfontinfo.h ---
#ifndef __QFONTINFO_H
#define __QFONTINFO_H
#include "qfont.h"
#include "qstring.h"
class QFontInfo
{
public:
QFontInfo(QFont & qf);
QString family();
bool italic();
bool fixedPitch();
bool bold();
QFont::CharSet charSet();
private:
QString m_family;
bool m_italic;
int m_weight;
QFont::CharSet m_charSet;
};
#endif
--- NEW FILE: kcharsets.h ---
#ifndef __KCHARSET_H
#define __KCHARSET_H
#include "qfont.h"
#include "qlist.h"
class KCharset
{
public:
KCharset() { }
KCharset(const char * str) { }
KCharset(const QString & str) { }
const char * name() const { return ""; }
QFont::CharSet qtCharset() const { return QFont::ISO_8859_1; }
bool isDisplayable() { return true; }
bool isDisplayable(KCharset charset, const char * face) { return true; }
KCharset & operator=(const KCharset & set) { return *this; }
QFont & setQFont(QFont & fnt) { return fnt; }
operator const char *() const { return name(); }
bool ok() const { return true; }
bool isAvailable() { return true; }
};
class KCharsetConversionResult
{
protected:
KCharset m_Set;
QString m_Text;
public:
char * copy() const
{
char * c = new char[m_Text.length()+1];
strcpy(c,m_Text);
return c;
}
void setResult(const char * r) { m_Text = r; }
KCharset charset() const { return m_Set; }
operator const QString & () const { return m_Text; }
operator const char * () const { return m_Text; }
};
class KCharsetConverter
{
protected:
QList<KCharsetConversionResult> m_Result;
public:
enum Flags{
INPUT_AMP_SEQUENCES=1,
OUTPUT_AMP_SEQUENCES=2,
AMP_SEQUENCES=INPUT_AMP_SEQUENCES|OUTPUT_AMP_SEQUENCES,
UNKNOWN_TO_ASCII=4,
UNKNOWN_TO_QUESTION_MARKS=0
};
KCharsetConverter() { }
KCharsetConverter(KCharset inputCharset
,int flags=UNKNOWN_TO_QUESTION_MARKS) { }
bool ok() { return true; }
const QList<KCharsetConversionResult> & multipleConvert(const char *str)
{
return m_Result;
}
const char * outputCharset() { return "us-ascii"; }
};
class KCharsets
{
protected:
KCharset m_KCharset;
KCharsetConversionResult m_Result;
public:
KCharsets() {}
KCharset defaultCh() const { return m_KCharset; }
KCharset defaultCharset() const { return m_KCharset; }
const KCharsetConversionResult & convertTag(const char * tag);
const KCharsetConversionResult & convertTag(const char * tag,int & len);
};
#endif
--- NEW FILE: qframe.h ---
#ifndef __QFRAME_H
#define __QFRAME_H
#include "qwidget.h"
class QFrame : public QWidget
{
protected:
int m_nLineWidth;
int m_nFrameStyle;
public:
enum Shape { NoFrame = 0, Box = 0x0001, Panel = 0x0002, WinPanel = 0x0003,
HLine = 0x0004, VLine = 0x0005, StyledPanel = 0x0006,
PopupPanel = 0x0007, MShape = 0x000f };
enum Shadow { Plain = 0x0010, Raised = 0x0020, Sunken = 0x0030,
MShadow = 0x00f0 };
QFrame(QWidget * parent =0, const char * name=0, WFlags f=0, bool s = true) :
QWidget(parent,name)
{ m_nLineWidth = 1; m_nFrameStyle = NoFrame; }
virtual void setLineWidth(int w) { m_nLineWidth = w; }
int lineWidth() const { return m_nLineWidth; }
void setFrameStyle(int style) { m_nFrameStyle = style; }
int frameStyle() const { return m_nFrameStyle; }
};
#endif
--- NEW FILE: qpalette.h ---
#ifndef __QPALETTE_H
#define __QPALETTE_H
#include "qcolor.h"
class QPalette
{
protected:
QColorGroup m_Dummy;
public:
QPalette() { }
QPalette copy() const { return *this; }
const QColorGroup & normal() const { return m_Dummy; }
void setNormal(const QColorGroup & cg) { m_Dummy = cg; }
};
#endif
--- NEW FILE: fltk-qdefs.h ---
#ifndef __FLTK_QDEFS_H
#define __FLTK_QDEFS_H
#define TRUE (1)
#define FALSE (0)
#define slots
#define signals public
#define CHECK_PTR(p)
typedef unsigned char uchar;
enum GUIStyle {
MacStyle, // OBSOLETE
WindowsStyle,
Win3Style, // OBSOLETE
PMStyle, // OBSOLETE
MotifStyle
};
#endif
--- NEW FILE: nxscroll.cpp ---
#include <FL/Enumerations.H>
#include "nxscroll.h"
#define SLIDER_WIDTH 12
NxScroll::NxScroll(int x, int y, int w, int h, const char *l) :
Fl_Group(x, y, w, h, l),
scrollbar(x+w-SLIDER_WIDTH,y,SLIDER_WIDTH,h-SLIDER_WIDTH),
hscrollbar(x,y+h-SLIDER_WIDTH,w-SLIDER_WIDTH,SLIDER_WIDTH)
{
save_h = h;
move = true;
resize_ = true;
type(BOTH);
xposition_ = 0;
yposition_ = 0;
hscrollbar.type(FL_HORIZONTAL);
hscrollbar.callback(hscrollbar_cb);
scrollbar.callback(scrollbar_cb);
scrollbar.align(FL_ALIGN_RIGHT);
hscrollbar.align(FL_ALIGN_BOTTOM);
// Provide the "look-and-feel"
box(FL_BORDER_BOX);
type(NxScroll::VERTICAL);
scrollbar.size(12,scrollbar.h());
// color(NxApp::Instance()->getGlobalColor(APP_BG));
// selection_color(NxApp::Instance()->getGlobalColor(APP_SEL));
color(FL_WHITE);
color(FL_BLUE);
} // end of NxScroll::NxScroll()
// Insure the scrollbars are the last children:
void NxScroll::fix_scrollbar_order()
{
Fl_Widget*const* a = array();
if (a[children()-1] != &scrollbar) {
Fl_Widget** a = (Fl_Widget**)array();
int i,j; for (i = j = 0; j < children(); j++)
if (a[j] != &hscrollbar && a[j] != &scrollbar) a[i++] = a[j];
a[i++] = &hscrollbar;
a[i++] = &scrollbar;
}
}
void NxScroll::draw_clip(void* v,int X, int Y, int W, int H) {
fl_clip(X,Y,W,H);
NxScroll* s = (NxScroll*)v;
// erase background if there is a boxtype:
if (s->box() && !(s->damage()&FL_DAMAGE_ALL)) {
fl_color(s->color());
fl_rectf(X,Y,W,H);
}
Fl_Widget*const* a = s->array();
int R = X; int B = Y; // track bottom & right edge of all children
for (int i=s->children()-2; i--;) {
Fl_Widget& o = **a++;
s->draw_child(o);
s->draw_outside_label(o);
if (o.x()+o.w() > R) R = o.x()+o.w();
if (o.y()+o.h() > B) B = o.y()+o.h();
}
// fill any area to right & bottom of widgets:
if (R < X+W && B > Y) {
fl_color(s->color());
fl_rectf(R,Y,X+W-R,B-Y);
}
if (B < Y+H) {
fl_color(s->color());
fl_rectf(X,B,W,Y+H-B);
}
fl_pop_clip();
}
void NxScroll::bbox(int& X, int& Y, int& W, int& H) {
X = x()+Fl::box_dx(box());
Y = y()+Fl::box_dy(box());
W = w()-Fl::box_dw(box());
H = h()-Fl::box_dh(box());
if (scrollbar.visible()) {
W -= scrollbar.w();
if (scrollbar.align() & FL_ALIGN_LEFT) X += scrollbar.w();
}
if (hscrollbar.visible()) {
H -= hscrollbar.h();
if (scrollbar.align() & FL_ALIGN_TOP) Y += hscrollbar.h();
}
}
void NxScroll::draw() {
fix_scrollbar_order();
int X,Y,W,H; bbox(X,Y,W,H);
uchar d = damage();
X=X+1;
W=W-2;
H=H-1;
if (d & FL_DAMAGE_ALL) { // full redraw
draw_box(box(),x(),y()-1,w(),h()+1,color());
draw_clip(this, X, Y, W, H);
} else {
if (d & FL_DAMAGE_SCROLL) { // scroll the contents:
fl_scroll(X, Y, W, H, oldx-xposition_, oldy-yposition_, draw_clip, this);
}
if (d & FL_DAMAGE_CHILD) { // draw damaged children
fl_clip(X, Y, W, H);
Fl_Widget*const* a = array();
for (int i=children()-2; i--;) update_child(**a++);
fl_pop_clip();
}
}
// accumulate bounding box of children:
int l = X; int r = X; int t = Y; int b = Y;
Fl_Widget*const* a = array();
for (int i=children()-2; i--;) {
Fl_Object* o = *a++;
if (o->x() < l) l = o->x();
if (o->y() < t) t = o->y();
if (o->x()+o->w() > r) r = o->x()+o->w();
if (o->y()+o->h() > b) b = o->y()+o->h();
}
// turn the scrollbars on and off as necessary:
for (int z = 0; z<2; z++) {
if ((type()&VERTICAL) && (type()&ALWAYS_ON || t < Y || b > Y+H)) {
if (!scrollbar.visible()) {
scrollbar.set_visible();
W -= scrollbar.w();
d = FL_DAMAGE_ALL;
}
} else {
if (scrollbar.visible()) {
scrollbar.clear_visible();
draw_clip(this,
scrollbar.align()&FL_ALIGN_LEFT ? X-scrollbar.w() : X+W,
Y, scrollbar.w(), H);
W += scrollbar.w();
d = FL_DAMAGE_ALL;
}
}
if ((type()&HORIZONTAL) && (type()&ALWAYS_ON || l < X || r > X+W)) {
if (!hscrollbar.visible()) {
hscrollbar.set_visible();
H -= hscrollbar.h();
d = FL_DAMAGE_ALL;
}
} else {
if (hscrollbar.visible()) {
hscrollbar.clear_visible();
draw_clip(this, X,
scrollbar.align()&FL_ALIGN_TOP ? Y-hscrollbar.h() : Y+H,
W, hscrollbar.h());
H += hscrollbar.h();
d = FL_DAMAGE_ALL;
}
}
}
#if 1
#if 1
int __Y = Y - 1;
int __H = H + 2;
int __X = X;
int __W = W;
scrollbar.resize(scrollbar.align()&FL_ALIGN_LEFT ? __X-scrollbar.w() : __X+__W,
__Y, scrollbar.w(), __H);
hscrollbar.resize(__X,
scrollbar.align()&FL_ALIGN_TOP ? __Y-hscrollbar.h() : __Y+__H,
__W, hscrollbar.h());
#else
scrollbar.resize(scrollbar.align()&FL_ALIGN_LEFT ? X-scrollbar.w() : X+W,
Y, scrollbar.w(), H);
hscrollbar.resize(X,
scrollbar.align()&FL_ALIGN_TOP ? Y-hscrollbar.h() : Y+H,
W, hscrollbar.h());
#endif
#else
scrollbar.resize(scrollbar.align()&FL_ALIGN_LEFT ? X-scrollbar.w() : X+W,
Y, scrollbar.w(), H);
hscrollbar.resize(X,
scrollbar.align()&FL_ALIGN_TOP ? Y-hscrollbar.h() : Y+H,
W, hscrollbar.h());
#endif
scrollbar.value(oldy = yposition_ = (Y-t), H, 0, b-t);
hscrollbar.value(oldx = xposition_ = (X-l), W, 0, r-l);
// draw the scrollbars:
if (d & FL_DAMAGE_ALL) {
draw_child(scrollbar);
draw_child(hscrollbar);
if (scrollbar.visible() && hscrollbar.visible()) {
// fill in the little box in the corner
fl_color(color());
fl_rectf(scrollbar.x(), hscrollbar.y(), scrollbar.w(), hscrollbar.h());
}
} else {
update_child(scrollbar);
update_child(hscrollbar);
}
if(scrollbar.visible()) {
Fl_Color old_color = color();
fl_color(FL_BLACK);
fl_line(scrollbar.x(), scrollbar.y(), scrollbar.x() + scrollbar.w(), scrollbar.y());
fl_line(scrollbar.x(), scrollbar.y() + scrollbar.h() - 1,
scrollbar.x() + scrollbar.w(), scrollbar.y() + scrollbar.h() - 1);
fl_color(old_color);
}
if(hscrollbar.visible()) {
Fl_Color old_color = color();
fl_color(FL_BLACK);
fl_line(hscrollbar.x(), hscrollbar.y(), hscrollbar.x(), hscrollbar.y() + hscrollbar.h() - 1);
fl_line(hscrollbar.x() + hscrollbar.w(), hscrollbar.y(),
hscrollbar.x() + hscrollbar.w(), hscrollbar.y() + hscrollbar.h() - 1);
fl_color(old_color);
}
}
#include <stdio.h>
void NxScroll::resize(int X, int Y, int W, int H) {
if (!resize_) return;
fix_scrollbar_order();
int new_h;
if ( H == save_h )
new_h = save_h;
else
new_h = H - (this->y() - Y) - 5;
if (move) {
// move all the children:
Fl_Widget*const* a = array();
for (int i=children()-2; i--;) {
Fl_Object* o = *a++;
o->position(o->x()+X-x(), o->y()+Y-y());
}
Fl_Widget::resize(X,Y,W,new_h);
} else {
// move all the children:
Fl_Widget*const* a = array();
for (int i=children()-2; i--;) {
Fl_Object* o = *a++;
//o->position(o->x()+X-x(), o->y()+Y-y());
o->position(o->x()+X-x(), o->y());
}
Fl_Widget::resize(this->x(), this->y(), W, new_h);
}
}
void NxScroll::position(int X, int Y) {
int dx = xposition_-X;
int dy = yposition_-Y;
if (!dx && !dy) return;
xposition_ = X;
yposition_ = Y;
Fl_Widget*const* a = array();
for (int i=children(); i--;) {
Fl_Widget* o = *a++;
if (o == &hscrollbar || o == &scrollbar) continue;
o->position(o->x()+dx, o->y()+dy);
}
damage(FL_DAMAGE_SCROLL);
}
void NxScroll::hscrollbar_cb(Fl_Widget* o, void*) {
NxScroll* s = (NxScroll*)(o->parent());
s->position(int(((NxScrollbar*)o)->value()), s->yposition());
}
void NxScroll::scrollbar_cb(Fl_Widget* o, void*) {
NxScroll* s = (NxScroll*)(o->parent());
s->position(s->xposition(), int(((NxScrollbar*)o)->value()));
}
int NxScroll::handle(int event) {
fix_scrollbar_order();
return Fl_Group::handle(event);
}
--- NEW FILE: drag.h ---
#ifndef __DRAG_H
#define __DRAG_H
#include "qwidget.h"
#include "qpixmap.h"
#define Dnd_X_Precision 2
#define Dnd_Y_Precision 2
#define DndURL 128
#define kapp KApplication::getKApplication()
class KDNDIcon : public QWidget
{
public:
KDNDIcon(QPixmap & pixmap, int _x, int _y) { }
};
class KDNDWidget : public QWidget
{
Q_OBJECT
public:
KDNDWidget( QWidget *_parent=0, const char *_name=0, WFlags f=0 ) :
QWidget(_parent,_name,f) { }
// CRH QWidget(_parent,_name,f) { cerr << "Created\n"; }
virtual void startDrag( KDNDIcon *_icon, const char *_data, int _size,
int _type, int _dx, int _dy ) { }
virtual Window findRootWindow( QPoint & p ) { return (Window)0; }
virtual void dndMouseReleaseEvent( QMouseEvent * ) { }
virtual void dndMouseMoveEvent( QMouseEvent *) { }
virtual void mousePressEvent( QMouseEvent *) { }
virtual void mouseMoveEvent( QMouseEvent * _me )
{ dndMouseMoveEvent(_me); }
virtual void mouseReleaseEvent( QMouseEvent * _me )
{ dndMouseReleaseEvent(_me); }
virtual void rootDropEvent( int _x, int _y ) { }
virtual void rootDropEvent() { }
virtual void resizeEvent( QResizeEvent *) { }
virtual void paintEvent(QPaintEvent * pe) { }
bool drag;
};
#endif
--- NEW FILE: qregion.h ---
#ifndef __QREGION_H
#define __QREGION_H
#include "qrect.h"
#include "qpoint.h"
class QRegion
{
public:
enum RegionType { Rectangle, Ellipse };
QRegion() { };
QRegion(const QPointArray & pa, bool winding=false) { }
QRegion(const QRect & rect, RegionType=Rectangle) { }
bool contains(const QPoint & p) const { return false; }
bool contains(const QRect & r) const { return false; }
};
#endif
--- NEW FILE: qpopupmenu.h ---
#ifndef __QPOPUPMENU_H
#define __QPOPUPMENU_H
class QPopupMenu
{
};
#endif
--- NEW FILE: qmovie.h ---
#ifndef __QMOVIE_H
#define __QMOVIE_H
#include "qbuffer.h"
#include "qrect.h"
#include "qpixmap.h"
class QMovie
{
protected:
QRect m_Rect;
QPixmap m_Pixmap;
public:
QMovie(QByteArray data, int bufsize=1024) { }
void connectUpdate(QObject * receiver, const char * member) { }
void connectStatus(QObject * receiver, const char * member) { }
const QRect & getValidRect() const { return m_Rect; }
const QPixmap & framePixmap() const { return m_Pixmap; }
void pause() { }
void disconnectUpdate(QObject * receiver, const char * member=0) { }
};
#endif
--- NEW FILE: qpushbutton.cpp ---
#include "qpushbutton.h"
static void Button_Callback(Fl_Widget* o, void * pThis) {
((QPushButton*)pThis)->_callback();
}
void QPushButton::_callback()
{
emit clicked();
}
QPushButton::QPushButton(QWidget * parent, const char * name ) : QWidget(parent,name)
{
QWidget::setMinimumSize(40,QPUSHBUTTON_HEIGHT);
Fl_Button * b = new Fl_Button(0,0,40,QPUSHBUTTON_HEIGHT,"Text");
Fl_Group::add(b);
setWidget(b);
b->callback((Fl_Callback*)Button_Callback,this);
}
// CRH
void QPushButton::setText(const QString & text)
{
m_Text = text;
m_pWidget->label(text);
m_pWidget->labelfont(m_Font.getFont());
m_pWidget->labelsize(m_Font.size());
//int c = fl_color();
// fl_color(m_Color.red(), m_Color.green(), m_Color.blue());
// fl_color(255, 0, 0);
// m_pWidget->color(fl_color());
//cerr << c << " " << (int)fl_color() << endl;
QFontMetrics fm(m_Font);
QWidget::setMinimumSize(fm.width(text) + QPUSHBUTTON_PADDING,
fm.height() + QPUSHBUTTON_VPADDING);
QWidget::resize(sizeHint());
}
#include "qpushbutton.moc"
--- NEW FILE: qdict.h ---
#ifndef __QDICT_H
#define __QDICT_H
#include "fltk-qbase.h"
#include "qcollection.h"
#include <map>
template <class T>
class QDict : public QCollection
{
protected:
map<string,T*> m_Map;
public:
QDict(int size=17, bool cs=true, bool ck = true) :
QCollection() { }
virtual ~QDict() { clear(); }
int count() const { return m_Map.size(); }
bool isEmpty() const { return m_Map.empty(); }
T* operator[](const QString & key) { return m_Map[key]; }
virtual void clear()
{
map<string,T*>::iterator pos;
if(m_bAutoDelete) {
for(pos=m_Map.begin(); pos != m_Map.end(); ++pos)
delete pos->second;
}
m_Map.clear();
}
T* find(const QString & key)
{
map<string,T*>::iterator pos;
pos = m_Map.find(key);
if(pos != m_Map.end())
return pos->second;
else
return 0;
}
bool remove(const QString & key)
{
map<string,T*>::iterator pos;
pos = m_Map.find(key);
if(pos != m_Map.end()) {
if(m_bAutoDelete)
delete pos->second;
m_Map.erase(pos);
return TRUE;
}
return FALSE;
}
void insert(const QString & key, const T * item)
{
m_Map[key] = (T*)item;
}
map<string,T*>::iterator end() { return m_Map.end(); }
map<string,T*>::iterator begin() { return m_Map.begin(); }
};
template <class T>
class QDictIterator
{
protected:
map<string,T*>::iterator m_Pos;
QDict<T> & m_Dict;
public:
QDictIterator(QDict<T> & t) : m_Dict(t) { m_Pos = t.begin(); }
T * current() const
{
if(m_Pos != m_Dict.end())
return m_Pos->second;
else
return NULL;
}
QDictIterator & operator++() { m_Pos++; return *this; }
QString currentKey() const { return QString(m_Pos->first.data()); }
};
#endif
--- NEW FILE: qdrawutil.cpp ---
#include "qpainter.h"
#include "qdrawutil.h"
#include "fl_draw.H"
void qDrawShadePanel( QPainter *p, int x, int y, int w, int h,
const QColorGroup & cg, bool sunken,
int lineWidth, const QBrush *fill )
{
p->qDrawShadePanel(x,y,w,h,cg,sunken,lineWidth,fill);
}
void qDrawShadeLine( QPainter *p, int x1, int y1, int x2, int y2,
const QColorGroup &g, bool sunken,
int lineWidth, int midLineWidth )
{
p->qDrawShadeLine(x1,y1,x2,y2,g,sunken,lineWidth, midLineWidth);
}
void qDrawShadeLine( QPainter *p, const QPoint &p1, const QPoint &p2,
const QColorGroup &g, bool sunken,
int lineWidth, int midLineWidth )
{
qDrawShadeLine(p,p1.x(),p1.y(),p2.x(),p2.y(),g,
sunken,lineWidth,midLineWidth);
}
--- NEW FILE: qfontmetrics.h ---
#ifndef __QFONTMETRICS_H
#define __QFONTMETRICS_H
#include "qfont.h"
#include "fl_draw.H"
class QFontMetrics
{
protected:
QFont m_Font;
public:
QFontMetrics() {}
QFontMetrics(const QFont & font) { m_Font = font; }
// int ascent() const { m_Font.SelectFont(); return height(); }
int ascent() const { m_Font.SelectFont(); return (fl_height() - fl_descent() - 1); } //davet
int descent() const
{ m_Font.SelectFont(); return fl_descent(); }
int width(const QString & str, int len=-1)
{
m_Font.SelectFont();
if(len == -1)
return (int)fl_width((const char*)str);
else
return (int)fl_width((const char*)str,len);
}
int width(char c) const
{ m_Font.SelectFont(); return (int)fl_width(c); }
int height() const
{ m_Font.SelectFont(); return fl_height(); }
};
#endif
--- NEW FILE: qfont.cpp ---
#include "qfont.h"
#ifdef NEVER // *** original method saved for posterity
void QFont::SelectFont() const
{
if(weight() > Normal)
fl_font(FL_COURIER+1,m_nPixelSize);
else
fl_font(FL_COURIER,m_nPixelSize);
}
#endif
void QFont::SelectFont() const
{
char fname[256];
int ftype;
// determine base font
strcpy(fname,(char *)m_sFamily);
if(fname[0] == 0x00)
ftype = FL_HELVETICA;
else if(stricmp(fname,"times") == 0)
ftype = FL_TIMES;
else if(stricmp(fname,"courier") == 0)
ftype = FL_COURIER;
else
ftype = FL_HELVETICA;
// determine font weight
if(weight() == Bold)
ftype += FL_BOLD;
// determine font italic
if(italic() == TRUE)
ftype += FL_ITALIC;
// set the font
fl_font(ftype,m_nPixelSize);
}
// CRH for qpushbutton
const int QFont::getFont() const
{
char fname[256];
int ftype;
// determine base font
strcpy(fname,(char *)m_sFamily);
if(fname[0] == 0x00)
ftype = FL_HELVETICA;
else if(stricmp(fname,"times") == 0)
ftype = FL_TIMES;
else if(stricmp(fname,"courier") == 0)
ftype = FL_COURIER;
else
ftype = FL_HELVETICA;
// determine font weight
if(weight() == Bold)
ftype += FL_BOLD;
// determine font italic
if(italic() == TRUE)
ftype += FL_ITALIC;
// return the font
return ftype;
}
QFont::QFont()
{
m_nPixelSize=12;
}
#ifdef NEVER // *** original method saved for posterity
QFont::QFont ( const QString & family, int pointSize,
int weight, bool italic)
{
m_nPixelSize = pointSize;
}
#endif
QFont::QFont ( const QString & family, int pointSize,
int weight, bool italic)
{
m_sFamily = family;
m_nPixelSize = pointSize;
m_nWeight = weight;
m_bItalic = italic;
m_bUnderline = false;
m_bStrikeOut = false;
}
--- NEW FILE: qconnection.h ---
#ifndef __QCONNECTION_H
#define __QCONNECTION_H
#include "qstring.h"
#include "qlist.h"
class QObject;
class QConnection
{
protected:
const QObject * m_Destination;
QMember m_Member;
QString m_strName;
int m_nArgs;
private:
// someboday please tell me that under Qt there is a better way to
// count the args .. I feel like such a hack with the below.
int countargs(const char * name)
{
int len = strlen(name);
int nargs = 0;
if(!strstr(name,"()")) {
nargs++;
for(int i=0; i<len; i++) {
if(name[i]==',')
nargs++;
}
}
return nargs;
}
public:
QConnection(const QObject * p, QMember mem, const char * memberName)
{
m_Destination = p;
m_Member = mem;
m_strName = memberName;
m_nArgs = countargs(memberName);
}
const QObject * object () const { return m_Destination; }
const QString & name() const { return m_strName; }
QMember * member() { return &m_Member; }
int numArgs() const { return m_nArgs; }
};
class QConnectionList : public QList<QConnection>
{
public:
QConnectionList() { };
};
class QConnectionListIt
{
protected:
QConnectionList * m_List;
public:
QConnectionListIt(QListM_QConnection & list)
{ m_List = &list; m_List->first(); }
void operator++() { m_List->next(); }
int count() const { return m_List->count(); }
QConnection * current()
{ return m_List->current(); }
};
#define QConnectionDict QDict<QConnectionList>
#endif
--- NEW FILE: qpainter.cpp ---
#include "qpainter.h"
#include "qwidget.h"
#include "fl_draw.H"
#ifdef NANOX
#include <FL/n_x.h>
#else
#include <FL/x.H>
#endif
#include <FL/Fl.H>
#include "qfontmetrics.h"
void QPainter::drawText(int x, int y, const QString & str, int len)
{
__SetPenColor();
font().SelectFont();
if(len == -1) {
fl_draw(str,ADJUSTX(x),ADJUSTY(y));
} else {
QString tmp(str);
fl_draw(tmp.substr(0,len).c_str(),ADJUSTX(x),ADJUSTY(y));
}
// check for underline - davet
if(font().m_bUnderline == true)
{
// cerr << "Underline len = " << len << " str = " << str << "\n";
int tlen;
if(len == -1)
tlen = (int)fl_width((const char *)str);
else
tlen = (int)fl_width((const char *)str,len);
// cerr << "Calculated len = " << tlen << "\n";
fl_line(ADJUSTX(x),ADJUSTY(y+1),ADJUSTX(x+tlen),ADJUSTY(y+1));
}
// check for strikeout flag - davet
if(font().m_bStrikeOut == true)
{
int tlen,yoff;
if(len == -1)
tlen = (int)fl_width((const char *)str);
else
tlen = (int)fl_width((const char *)str,len);
yoff = (fl_height() - fl_descent()) / 2;
fl_line(ADJUSTX(x),ADJUSTY(y-yoff),ADJUSTX(x+tlen),ADJUSTY(y-yoff));
}
}
bool QPainter::begin(const QPaintDevice * pix)
{
Fl_X *i = Fl_X::i(pix);
if(!i) {
pix->show();
i = Fl_X::i(pix);
}
if(i && fl_window != i->other_xid && fl_window != i->xid)
pix->make_current();
m_Widget = (FLTK_PARENT_WIDGET*) pix;
#ifndef USE_FL_WIDGET
if(m_Widget) {
m_Widget->show();
}
#endif
return true;
}
bool QPainter::end()
{
return true;
}
void QPainter::qDrawShadeLine( int x1, int y1, int x2, int y2,
const QColorGroup &g, bool sunken,
int lineWidth, int midLineWidth )
{
if(!sunken) {
fl_color(g.light().red(),
g.light().green(),
g.light().blue());
} else {
fl_color(g.dark().red(),
g.dark().green(),
g.dark().blue());
}
fl_line(ADJUSTX(x1),ADJUSTY(y1),ADJUSTX(x2),ADJUSTY(y2));
if(sunken) {
fl_color(g.light().red(),
g.light().green(),
g.light().blue());
} else {
fl_color(g.dark().red(),
g.dark().green(),
g.dark().blue());
}
// for now assume that the line is horizontal .. yes I know this sucks
fl_line(ADJUSTX(x1),ADJUSTY(y1+1),ADJUSTX(x2),ADJUSTY(y2+1));
}
void QPainter::qDrawShadePanel( int x, int y, int w, int h,
const QColorGroup & cg, bool sunken,
int lineWidth = 1, const QBrush *fill = 0 )
{
if(!sunken) {
fl_color(cg.light().red(),
cg.light().green(),
cg.light().blue());
} else {
fl_color(cg.dark().red(),
cg.dark().green(),
cg.dark().blue());
}
for(int i=0; i<lineWidth; i++) {
fl_line(ADJUSTX(x)+i,ADJUSTY(y)+i,ADJUSTX(x)+w-i,ADJUSTY(y)+i);
fl_line(ADJUSTX(x)+i,ADJUSTY(y)+i,ADJUSTX(x)+i,ADJUSTY(y)+h-i);
}
if(sunken) {
fl_color(cg.light().red(),
cg.light().green(),
cg.light().blue());
} else {
fl_color(cg.dark().red(),
cg.dark().green(),
cg.dark().blue());
}
for(int i=0; i<lineWidth; i++) {
fl_line(ADJUSTX(x)+i,ADJUSTY(y)-i+h,ADJUSTX(x)+w-i,ADJUSTY(y)-i+h);
fl_line(ADJUSTX(x)+w-i,ADJUSTY(y)+h-i,ADJUSTX(x)+w-i,ADJUSTY(y)+i);
}
}
void QPainter::setBackgroundColor(const QColor & c)
{
m_BGColor = c;
}
void QPainter::fillRect(int x, int y, int w, int h, const QBrush & br)
{
QWidget * p = (QWidget *)m_Widget;
if(!p->inPaint())
return;
fl_rectf(ADJUSTX(x),ADJUSTY(y),w,h,
br.color().red(),
br.color().green(),
br.color().blue());
}
void QPainter::drawPixmap(int x, int y, const QPixmap & pix)
{
QPoint tmp;
tmp.setX(ADJUSTX(x));
tmp.setY(ADJUSTY(y));
pix.drawPixmap(tmp,QRect(0,0,pix.width(),pix.height()));
}
void QPainter::drawPixmap(const QPoint & point, const QPixmap & pixmap,
const QRect & rect)
{
QPoint tmp;
tmp.setX(ADJUSTX(point.x()));
tmp.setY(ADJUSTY(point.y()));
pixmap.drawPixmap(tmp,rect);
}
void QPainter::drawEllipse(int x, int y, int w, int h)
{
__SetPenColor();
fl_pie(ADJUSTX(x),ADJUSTY(y),w,h,0,359);
}
void QPainter::drawEllipse(const QRect & rect)
{
drawEllipse(rect.x(), rect.y(), rect.width(), rect.height());
}
void QPainter::eraseRect(int x, int y, int w, int h)
{
fillRect(x+1,y+1,w,h,m_BGColor);
}
void QPainter::eraseRect(const QRect & rect)
{
eraseRect(rect.x(), rect.y(), rect.width(), rect.height());
}
--- NEW FILE: qintdict.h ---
#ifndef __QINTDICT_H
#define __QINTDICT_H
#include "fltk-qbase.h"
#include "qcollection.h"
#include <map>
template <class T>
class QIntDict : public QCollection
{
protected:
map<unsigned int,T*> m_Map;
public:
QDict(int size=17, bool cs=true, bool ck = true) :
QCollection { }
~QDict() { clear(); }
void setAutoDelete(bool enable) { };
int count() const { return m_Map.size(); }
bool isEmpty() const { return m_Map.empty(); }
T* operator[](unsigned int key) { return m_Map[key]; }
virtual void clear()
{
map<string,T*>::iterator pos;
if(m_bAutoDelete) {
for(pos=m_Map.begin(); pos != m_Map.end(); ++pos)
delete pos->second;
}
m_Map.clear();
}
T* find(unsigned int key)
{
map<unsigned int,T*>::iterator pos;
pos = m_Map.find(key);
if(pos != m_Map.end())
return pos->second;
else
return 0;
}
bool remove(unsigned int key)
{
map<unsigned int,T*>::iterator pos;
pos = m_Map.find(key);
if(pos != m_Map.end()) {
if(m_bAutoDelete)
delete pos->second;
m_Map.erase(pos);
return TRUE;
}
return FALSE;
}
void insert(unsigned int key, const T * item)
{
m_Map[key] = (T*)item;
}
map<unsigned int,T*>::iterator begin() { return m_Map.begin(); }
};
template <class T>
class QIntDictIterator
{
protected:
map<unsigned int,T*>::iterator m_Pos;
public:
QIntDictIterator(QIntDict<T> & t) { m_Pos = t.begin(); }
T * current() const { m_Pos->second; }
QIntDictIterator & operator++() { m_Pos++; return *this; }
unsigned int currentKey() const { return m_Pos->first; }
};
#endif
--- NEW FILE: qapp.h ---
#ifndef __QAPP_H
#define __QAPP_H
class QApp
{
public:
};
#endif
--- NEW FILE: qpushbutton.moc ---
/****************************************************************************
** QPushButton meta object code from reading C++ file 'qpushbutton.h'
**
** Created: Mon Nov 13 14:12:33 2000
** by: The Qt Meta Object Compiler ($Revision: 1.1 $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#if !defined(Q_MOC_OUTPUT_REVISION)
#define Q_MOC_OUTPUT_REVISION 2
#elif Q_MOC_OUTPUT_REVISION != 2
#error "Moc format conflict - please regenerate all moc files"
#endif
#include "qpushbutton.h"
#include <qmetaobject.h>
const char *QPushButton::className() const
{
return "QPushButton";
}
QMetaObject *QPushButton::metaObj = 0;
#if QT_VERSION >= 200
static QMetaObjectInit init_QPushButton(&QPushButton::staticMetaObject);
#endif
void QPushButton::initMetaObject()
{
if ( metaObj )
return;
if ( strcmp(QWidget::className(), "QWidget") != 0 )
badSuperclassWarning("QPushButton","QWidget");
#if QT_VERSION >= 200
staticMetaObject();
}
void QPushButton::staticMetaObject()
{
if ( metaObj )
return;
QWidget::staticMetaObject();
#else
QWidget::initMetaObject();
#endif
typedef void(QPushButton::*m2_t0)();
m2_t0 v2_0 = &QPushButton::clicked;
QMetaData *signal_tbl = new QMetaData[1];
signal_tbl[0].name = "clicked()";
signal_tbl[0].ptr = *((QMember*)&v2_0);
metaObj = new QMetaObject( "QPushButton", "QWidget",
0, 0,
signal_tbl, 1 );
}
// SIGNAL clicked
void QPushButton::clicked()
{
activate_signal( "clicked()" );
}
--- NEW FILE: qcolor.cpp ---
#include "qcolor.h"
#include "string.h"
#include <stdlib.h>
typedef struct
{
char *name;
unsigned char red;
unsigned char green;
unsigned char blue;
}ColorEntry;
static ColorEntry color_list[] =
{
{ "black",0,0,0},
{ "silver",192,192,192},
{ "gray",128,128,128},
// CRH
{ "lightgray",211,211,211},
{ "white",255,255,255},
{ "maroon",128,0,0},
{ "red",255,0,0},
{ "purple",128,0,128},
{ "fuchsia",255,0,255},
{ "green",0,128,0},
// CRH
{ "lightgreen",144,238,144},
{ "lime",0,255,0},
{ "olive",128,128,0},
{ "yellow",255,255,0},
// CRH
{ "lightyellow",255,255,224},
{ "navy",0,0,128},
{ "blue",0,0,255},
// CRH
{ "lightblue",173,216,230},
{ "teal",0,128,128},
{ "aqua",0,255,255},
{ NULL,0,0,0 }
};
static int _fromhex(const char * h)
{
return strtol(h,0,16);
}
void QColor::setNamedColor(const QString & color)
{
char * c = (char*)color.data();
m_nRed = m_nGreen = m_nBlue = 0;
if(c[0] == '#')
{
int n = strlen(c+1) / 3;
char buf[5];
strncpy(buf,c+1,n);
buf[n] = 0;
m_nRed = _fromhex(buf);
strncpy(buf,c+1+n,n);
buf[n] = 0;
m_nGreen = _fromhex(buf);
strncpy(buf,c+1+n+n,n);
buf[n] = 0;
m_nBlue = _fromhex(buf);
m_bSet = true;
}
else
{
color.lower();
int count = 0;
while(color_list[count].name)
{
if(strcmp(color_list[count].name,(char *)color) == 0)
{
m_nRed = color_list[count].red;
m_nGreen = color_list[count].green;
m_nBlue = color_list[count].blue;
m_bSet = true;
break;
}
++count;
}
}
}
--- NEW FILE: qpixmap.h ---
#ifndef __QPIXMAP_H
#define __QPIXMAP_H
#include "qstring.h"
#include "qpaintdevice.h"
#include "qpoint.h"
#include "qrect.h"
#include "qsize.h"
#include "qbitmap.h"
#include "qwmatrix.h"
class QPixmap : public QPaintDevice
{
public:
class QPixmap_ {
public:
QPixmap_(int w=0, int h=0);
~QPixmap_();
void destroy();
void create();
int m_nWidth;
int m_nHeight;
int m_nDepth;
QBitmap * m_pBitmap;
int m_nPix_W;
int m_nPix_H;
unsigned long m_Pixmap;
unsigned long m_Mask;
unsigned long m_IM;
#ifdef _NANOX
QString m_Filename;
#endif
int m_nRefCount;
};
protected:
static bool m_bInitialized;
QPixmap_ * m_pPixmap;
public:
enum Optimization { DefaultOptim, NoOptim, MemoryOptim=NoOptim,
NormalOptim, BestOptim };
enum ColorMode { Auto,Color,Mono };
QPixmap();
QPixmap(const QPixmap & qp);
QPixmap(int w, int h, int depth=-1, Optimization = DefaultOptim);
~QPixmap();
bool isNull() const
{
return (m_pPixmap->m_IM==0);
}
int depth() const { return m_pPixmap->m_nDepth; }
void drawPixmap(const QPoint & point, const QRect & rect) const;
int width() const { return m_pPixmap->m_nWidth; }
int height() const { return m_pPixmap->m_nHeight; }
bool loadFromData( const QByteArray & data, const char * format=0,
int conversion_flags=0);
bool load ( const QString & fileName,
const char * format=0, ColorMode mode=Auto );
void resize(const QSize & qs) { }
void resize(int width, int height) { }
const QBitmap * mask() const { return m_pPixmap->m_pBitmap;}
QPixmap xForm(const QWMatrix & matrix) const { return *this; }
};
#endif
--- NEW FILE: qwmatrix.h ---
#ifndef __QWMATRIX_H
#define __QWMATRIX_H
class QWMatrix
{
public:
QWMatrix & scale(double dx, double dy) { return *this; }
};
#endif
--- NEW FILE: qiodevice.h ---
#ifndef __QIODEVICE_H
#define __QIODEVICE_H
#define IO_ReadOnly 0x0001 // readable device
#define IO_WriteOnly 0x0002 // writeable device
#define IO_ReadWrite 0x0003 // read+write device
#define IO_Append 0x0004 // append
#define IO_Truncate 0x0008 // truncate device
#define IO_Translate 0x0010 // translate CR+LF
#define IO_ModeMask 0x00ff
class QIODevice
{
public:
bool isOpen() const { return false; }
virtual bool open(int mode) { return true; }
virtual void close() { }
virtual int writeBlock( const char * data, unsigned int len) { return 0; }
virtual int readBlock(char * data, uint maxlen) { return 0; }
virtual bool atEnd() const { return false; }
virtual int getch() const { return 1; }
};
#endif
--- NEW FILE: qstring.h ---
#ifndef __QSTRING_H
#define __QSTRING_H
#include <algo.h>
#include <string>
#include <stdarg.h>
#include <errno.h>
#include <stdio.h>
#include "fltk-qdefs.h"
//#include "qregexp.h"
class QRegExp;
class QString : public string
{
protected:
bool m_bNull;
public:
QString() { m_bNull = true; }
QString(int x) { m_bNull = true; }
QString(const string & s) { assign(s.c_str()); m_bNull = false; }
QString(const QString & s) { assign(s.c_str()); m_bNull = false;}
QString(const char * c) { if(c) assign(c); m_bNull = false;}
QString copy() const { return *this; }
operator char *() const { return (char*)c_str(); }
operator const char *() const { return c_str(); }
int find(const QRegExp & reg, int index=0) const;
int find(char c, int index=0, bool cs=true) const ;
int find(const QString & str, int index=0, bool cs=true) const;
bool isEmpty() const { return empty(); }
QString left(unsigned int len) { return substr(0,len); }
QString right(unsigned int len) { return substr(length()-len,len); }
QString mid(unsigned int index, unsigned int len=0xffffffff) const
{
QString tmp;
if(len==0xffffffff)
len = length() - index;
tmp = substr(index,len);
return tmp;
}
void detach() { }
void truncate(unsigned int len) { assign(left(len)); }
const char * data() const { return c_str(); }
QString & replace(const QString & reg, const QString & str) { return *this; }
int toInt(bool * ok=0, int base=10)
{
int result;
if(ok)
*ok = true;
result = strtol(c_str(),0,base); if(errno && ok)
*ok = false;
return result;
}
const QString & operator+(char c) { string::operator+=(c); m_bNull = false; return (*this); }
const QString & operator=(char c)
{ assign(""); if(c) (*this) + c; else m_bNull=true; return (*this); }
void setStr(const char * c) { assign(c); m_bNull = false; }
QString lower() const
{
QString s;
s.assign(c_str());
transform(s.begin(), s.end(), s.begin(), tolower);
return s;
}
QString upper() const
{
QString s;
s.assign(c_str());
transform(s.begin(), s.end(), s.begin(), toupper);
return s;
}
// isNull broken .. see QString ref
bool isNull() const { return m_bNull; }
operator bool() const { return !isNull(); }
bool operator!() const { return isNull(); }
int findRev(const QString & str, int index=-1, bool cs=true) const;
int findRev( char c, int index=-1, bool cs=true ) const;
QString & sprintf(const char * format, ...)
{
m_bNull = false;
// gag .. help me
char buf[4096];
va_list vl;
va_start(vl,format);
vsprintf(buf,format,vl);
va_end(vl);
assign(buf);
return (*this);
}
QString & setNum(int n, int base=10)
{
m_bNull = false;
(*this) = n;
return *this;
}
QString stripWhiteSpace() const
{
QString tmp;
char c;
for(unsigned int i=0; i<length(); i++) {
c = (*this)[i];
if((c>=9 && c<=13) || c == 32)
continue;
else
tmp += c;
}
return tmp;
}
};
#endif
--- NEW FILE: qpixmap.cpp ---
#include "qpixmap.h"
#include "Fl_Image.H"
#include "fl_draw.H"
#ifndef _NANOX
#include <Imlib.h>
static ImlibData * m_id;
extern Display * fl_display;
extern Window fl_window;
#else
#include "unistd.h"
#include <nano-X.h>
extern int fl_display;
extern int fl_window;
extern GR_GC_ID fl_gc;
#endif
bool QPixmap::m_bInitialized;
QPixmap::QPixmap_::QPixmap_(int w, int h)
{
m_nRefCount = 1;
m_nWidth = w; m_nHeight = h; m_pBitmap = 0; m_IM=0;
}
void QPixmap::QPixmap_::destroy()
{
if(--m_nRefCount == 0)
delete this;
}
void QPixmap::QPixmap_::create()
{
m_nRefCount++;
}
QPixmap::QPixmap_::~QPixmap_()
{
#ifndef _NANOX
if(m_id && m_IM)
Imlib_destroy_image(m_id,m_IM);
#else
if(m_IM)
GrFreeImage(m_IM);
// Delete the file
if(m_IM && m_Filename.length())
unlink(m_Filename);
#endif
}
QPixmap::QPixmap(int w, int h, int depth=-1, Optimization = DefaultOptim)
{
if(parent()) {
((Fl_Group*)parent())->remove(this);
}
m_pPixmap = new QPixmap_(w,h);
}
QPixmap::QPixmap()
{
if(parent()) {
((Fl_Group*)parent())->remove(this);
}
m_pPixmap = new QPixmap_();
}
QPixmap::QPixmap(const QPixmap & qp)
{
if(qp.m_pPixmap) {
m_pPixmap = qp.m_pPixmap;
m_pPixmap->create();
}
}
bool QPixmap::loadFromData( const QByteArray & data, const char * format,
int conversion_flags)
{
#ifdef _NANOX
GR_IMAGE_INFO info;
m_pPixmap->m_IM = GrLoadImageFromBuffer((void *) data.buffer(), (int) data.length(), 0);
if (!m_pPixmap->m_IM) return(false);
GrGetImageInfo(m_pPixmap->m_IM,&info);
m_pPixmap->m_nPix_W = m_pPixmap->m_nWidth = info.width;
m_pPixmap->m_nPix_H = m_pPixmap->m_nHeight = info.height;
return(true);
#else
// This is a bit of a hack
char namebuf[1024];
int fd;
bool ret;
strcpy(namebuf,"/tmp/viewmlXXXXXX");
fd = mkstemp(namebuf);
if(fd == -1) {
cerr << "Couldn't make temporary file for QPixmap::loadFromData!\n";
return false;
}
unsigned int loopc;
char * buf = (char*)data.buffer();
for(loopc=0;loopc<data.length();loopc++) {
write(fd,buf + loopc,1);
}
close(fd);
return(load(namebuf));
#endif
}
bool QPixmap::load ( const QString & fileName,
const char * format, ColorMode mode )
{
if(m_pPixmap->m_IM) {
m_pPixmap->destroy();
m_pPixmap = new QPixmap_();
}
#ifndef _NANOX
if(!m_bInitialized) {
m_id = Imlib_init(fl_display);
if(!m_id)
return false;
m_bInitialized = 1;
}
ImlibImage * im;
im=Imlib_load_image(m_id,(char *)fileName);
m_pPixmap->m_IM = im;
if(im==0) {
cerr << "Errk! Failed to load QPixmap " << fileName << "\n";
return false;
}
m_pPixmap->m_nPix_W = m_pPixmap->m_nWidth = im->rgb_width;
m_pPixmap->m_nPix_H = m_pPixmap->m_nHeight = im->rgb_height;
// Remove old image if there is one
if(m_pPixmap->m_Pixmap) {
Imlib_free_pixmap(m_id,(Pixmap)m_pPixmap->m_Pixmap);
}
Imlib_render(m_id,im,m_pPixmap->m_nPix_W,m_pPixmap->m_nPix_H);
m_pPixmap->m_Pixmap = (unsigned long)Imlib_move_image(m_id,im);
m_pPixmap->m_Mask = (unsigned long)Imlib_move_mask(m_id,im);
#else
#ifdef NOTUSED
/* Legacy code, not required for the latest version of microwindows */
GR_IMAGE_INFO info;
FILE * ftmp = fopen(fileName,"r");
if(!ftmp) {
return false;
}
fclose(ftmp);
m_pPixmap->m_IM = GrLoadImageFromFile(fileName,0);
GrGetImageInfo(m_pPixmap->m_IM,&info);
m_pPixmap->m_nPix_W = m_pPixmap->m_nWidth = info.width;
m_pPixmap->m_nPix_H = m_pPixmap->m_nHeight = info.height;
#endif
#endif
return true;
}
QPixmap::~QPixmap()
{
m_pPixmap->destroy();
}
void QPixmap::drawPixmap(const QPoint & point, const QRect & rect) const
{
int x = point.x()-1;
int y = point.y()-1;
#ifndef _NANOX
Imlib_paste_image(m_id, m_pPixmap->m_IM, fl_window,
x,y,rect.width(),rect.height());
#else
if(m_pPixmap->m_IM) {
GrDrawImageToFit(fl_window, fl_gc, x, y, rect.width(), rect.height(), m_pPixmap->m_IM);
}
#endif
}
--- NEW FILE: qtimer.cpp ---
#include "qtimer.h"
#include "unistd.h"
QTimer::QTimer(QObject * parent, const char * name ) :
QObject()
{
m_bActive = false;
}
void QTimer::stop()
{
killTimer(m_nTimerID);
m_bActive = false;
}
bool QTimer::isActive() const
{
return m_bActive;
}
int QTimer::start( int msec, bool sshot)
{
m_bSingleShot = sshot;
m_nTimerID = startTimer(msec);
m_bActive = true;
return m_nTimerID;
}
void QTimer::timerEvent(QTimerEvent * e)
{
timeout();
if(m_bSingleShot)
stop();
}
#include "qtimer.moc"
--- NEW FILE: nxscrollbar.cpp ---
#include <FL/fl_draw.H>
#include "nxscrollbar.h"
NxScrollbar::NxScrollbar(int x, int y, int w, int h, const char * l) :
NxSlider(x,y,w,h,l)
{
box(FL_FLAT_BOX);
slider(FL_UP_BOX);
linesize_ = 16;
pushed_ = 0;
step(1);
}
#define INITIALREPEAT .5
#define REPEAT .05
void NxScrollbar::increment_cb() {
int i;
int W = horizontal() ? w() : h();
int S = int(slider_size()*W+.5);
switch (pushed_) {
case 1: i = -linesize_; break;
default:i = linesize_; break;
case 3: i = -int(S * (maximum() - minimum()) / W); break;
case 4: i = int(S * (maximum() - minimum()) / W); break;
}
if (maximum() < minimum() && pushed_ < 3) i = -i;
handle_drag(clamp(value() + i));
}
void NxScrollbar::timeout_cb(void* v) {
NxScrollbar * s = (NxScrollbar*)v;
s->increment_cb();
//Fl::add_timeout(REPEAT, timeout_cb, s);
}
int NxScrollbar::handle(int event) {
// area of scrollbar:
int area;
int X=x(); int Y=y(); int W=w(); int H=h();
int SX = X; int SY = Y; int SW = W; int SH = H;
// adjust slider area to be inside the arrow buttons:
if (horizontal()) {
if (W >= 3*H) {X += H; W -= 2*H;}
} else {
if (H >= 3*W) {Y += W; H -= 2*W;}
}
// which widget part is highlighted?
int mx = Fl::event_x();
int my = Fl::event_y();
if (!Fl::event_inside(SX, SY, SW, SH)) area = 0;
else if (horizontal()) {
if (mx < X) area = 1;
else if (mx >= X+W) area = 2;
else {
int sliderx;
int S = int(slider_size()*W+.5);
double val = (value()-minimum())/(maximum()-minimum());
if (val >= 1.0) sliderx = W-S;
else if (val <= 0.0) sliderx = 0;
else sliderx = int(val*(W-S)+.5);
if (mx < X+sliderx) area = 3;
else if (mx >= X+sliderx+S) area = 4;
else area = 5;
}
} else {
if (mx < X || mx >= X+W) area = 0;
else if (my < Y) area = 1;
else if (my >= Y+H) area = 2;
else {
int slidery;
int S = int(slider_size()*H+.5);
double val = (value()-minimum())/(maximum()-minimum());
if (val >= 1.0) slidery = H-S;
else if (val <= 0.0) slidery = 0;
else slidery = int(val*(H-S)+.5);
if (my < Y+slidery) area = 3;
else if (my >= Y+slidery+S) area = 4;
else area = 5;
}
}
switch (event) {
case FL_ENTER:
case FL_LEAVE:
return 1;
case FL_RELEASE:
damage(FL_DAMAGE_EXPOSE);
if (pushed_) {
//Fl::remove_timeout(timeout_cb, this);
pushed_ = 0;
}
handle_release();
return 1;
case FL_PUSH:
if (pushed_) return 1;
if (area != 5) pushed_ = area;
if (pushed_) {
handle_push();
//Fl::add_timeout(INITIALREPEAT, timeout_cb, this);
increment_cb();
damage(FL_DAMAGE_EXPOSE);
return 1;
}
return NxSlider::handle(event, X,Y,W,H);
case FL_DRAG:
if (pushed_) return 1;
return NxSlider::handle(event, X,Y,W,H);
case FL_SHORTCUT: {
int v = value();
int ls = maximum()>=minimum() ? linesize_ : -linesize_;
if (horizontal()) {
switch (Fl::event_key()) {
case FL_Left:
v -= ls;
break;
case FL_Right:
v += ls;
break;
default:
return 0;
}
} else { // vertical
switch (Fl::event_key()) {
case FL_Up:
v -= ls;
break;
case FL_Down:
v += ls;
break;
case FL_Page_Up:
if (slider_size() >= 1.0) return 0;
v -= int((maximum()-minimum())*slider_size()/(1.0-slider_size()));
v += ls;
break;
case FL_Page_Down:
if (slider_size() >= 1.0) return 0;
v += int((maximum()-minimum())*slider_size()/(1.0-slider_size()));
v -= ls;
break;
case FL_Home:
v = int(minimum());
break;
case FL_End:
v = int(maximum());
break;
default:
return 0;
}
}
v = int(clamp(v));
if (v != value()) {
NxSlider::value(v);
value_damage();
do_callback();
}
return 1;}
}
return 0;
}
void NxScrollbar::draw() {
box(FL_BORDER_BOX);
Fl_Color col = scroll_tray;
Fl_Color sel_col = scroll_face;
int X = x()+Fl::box_dx(box());
int Y = y()+Fl::box_dy(box());
int W = w()-Fl::box_dw(box());
int H = h()-Fl::box_dh(box());
if (damage()&FL_DAMAGE_ALL) {
Fl_Color clr = fl_color();
fl_color(scroll_tray);
fl_rectf(X,Y,W,H);
fl_color(scroll_face);
fl_rect(X,Y,W,H);
fl_color(clr);
}
if (horizontal()) {
// the slider button
if (W < 3*H) {NxSlider::draw(X-1,Y,W+2,H); return;}
NxSlider::draw(X+H-1,Y+1,W-2*H+2,H-2);
// draw the boxes for the buttons
if (damage()) {
// draw_box((pushed_ == 1) ? FL_BLACK_BOX : FL_BORDER_BOX,
// X, Y, H, H, col);
// draw_box((pushed_ == 2) ? FL_BLACK_BOX : FL_BORDER_BOX,
// X+W-H, Y, H, H, col);
Fl_Color clr = fl_color();
// Top Box
fl_color((pushed_ == 1) ? sel_col : col );
fl_rectf(X,Y,H,H); // box
fl_color(sel_col);
fl_rect(X,Y,H,H); // border
// Bottom Box
fl_color((pushed_ == 2) ? sel_col : col );
fl_rectf(X+W-H,Y,H,H); // box
fl_color(sel_col);
fl_rect(X+W-H,Y,H,H); // border
fl_color(clr);
/*
if (active_r())
fl_color(labelcolor());
else
fl_color(inactive(labelcolor()));
*/
int w1 = (H-1)|1; // use odd sizes only
int Y1 = Y+w1/2;
int W1 = w1/3;
int X1 = X+w1/2+W1/2;
//or arrows on buttons
if ( pushed_ == 1 )
fl_color(col);
else
fl_color(sel_col);
fl_polygon(X1-W1, Y1, X1+2, Y1-W1-2, X1+2, Y1+W1+3);
X1 = X+W-(X1-X);
if ( pushed_ == 2 )
fl_color(col);
else
fl_color(sel_col);
fl_polygon(X1+W1-1, Y1, X1-2, Y1+W1+2, X1-2, Y1-W1-1);
}
} else { // vertical
if (H < 3*W) {NxSlider::draw(X,Y-1,W,H+2); return;}
NxSlider::draw(X,Y+W-1,W,H-2*W+2);
if (damage()) {
/*
draw_box((pushed_ == 1) ? FL_BLACK_BOX : FL_BORDER_BOX,
X, Y, W, W, col);
draw_box((pushed_ == 2) ? FL_BLACK_BOX : FL_BORDER_BOX,
X, Y+H-W, W, W, col);
*/
Fl_Color clr = fl_color();
// Top Box
fl_color((pushed_ == 1) ? sel_col : col );
fl_rectf(X,Y,W,W); // box
fl_color(sel_col);
fl_rect(X,Y,W,W); // border
// Bottom Box
fl_color((pushed_ == 2) ? sel_col : col );
fl_rectf(X, Y+H-W, W, W); // box
fl_color(sel_col);
fl_rect(X, Y+H-W, W, W); // border
fl_color(clr);
/*
if (active_r())
fl_color(labelcolor());
else
fl_color(labelcolor() | 8);
********/
int w1 = (W-1)|1; // use odd sizes only
int X1 = X+w1/2+1;
int W1 = w1/3+1;
int Y1 = Y+w1/2+W1/2;
// draw the arrow on the buttons
if ( pushed_ == 1 )
fl_color(col);
else
fl_color(sel_col);
fl_polygon(X1, Y1-W1, X1+W1, Y1+1, X1-W1, Y1);
Y1 = Y+H-(Y1-Y)-1;
if ( pushed_ == 2 )
fl_color(col);
else
fl_color(sel_col);
fl_polygon(X1, Y1+W1, X1-W1, Y1, X1+W1, Y1);
}
}
}
--- NEW FILE: qregexp.h ---
#ifndef __QREGEXP_H
#define __QREGEXP_H
#include "qstring.h"
class QString;
class QRegExp
{
protected:
QString m_RegExp;
bool m_bCaseSensitive;
public:
QRegExp(const QString & reg, bool cs=true, bool wildcard=false);
int match(const QString & str, int index=0, int * len=0,
bool indexIsStart=true) const;
};
#endif
--- NEW FILE: qcursor.h ---
#ifndef __QCURSOR_H
#define __QCURSOR_H
#include "qpoint.h"
#include "qbitmap.h"
class QCursor
{
public:
QCursor() { }
QCursor(const QBitmap & bitmap, const QBitmap & mask, int hotX=-1,
int hotY=-1) { }
static QPoint pos() { return QPoint(0,0); }
};
extern const QCursor arrowCursor;
extern const QCursor upArrowCursor;
extern const QCursor crossCursor;
extern const QCursor waitCursor;
extern const QCursor ibeamCursor;
extern const QCursor sizeVerCursor;
extern const QCursor sizeHorCursor;
extern const QCursor sizeBDiagCursor;
extern const QCursor sizeFDiagCursor;
extern const QCursor sizeAllCursor;
extern const QCursor blankCursor;
#endif
--- NEW FILE: qpen.h ---
#ifndef __QPEN_H
#define __QPEN_H
#include "qcolor.h"
class QColor;
enum PenStyle { NoPen, SolidLine, DashLine, // pen style
DotLine, DashDotLine, DashDotDotLine };
class QPen
{
protected:
QColor m_Color;
PenStyle m_Style;
public:
QPen() { }
QPen(const QColor & color) { m_Color = color; }
const QColor & color() const { return m_Color; }
void setColor(const QColor & color) { m_Color = color; }
void setStyle(PenStyle p) { m_Style = p; }
};
#endif
--- NEW FILE: qtimer.moc ---
/****************************************************************************
** QTimer meta object code from reading C++ file 'qtimer.h'
**
** Created: Fri Jul 14 14:55:28 2000
** by: The Qt Meta Object Compiler ($Revision: 1.1 $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#if !defined(Q_MOC_OUTPUT_REVISION)
#define Q_MOC_OUTPUT_REVISION 2
#elif Q_MOC_OUTPUT_REVISION != 2
#error "Moc format conflict - please regenerate all moc files"
#endif
#include "qtimer.h"
#include <qmetaobject.h>
const char *QTimer::className() const
{
return "QTimer";
}
QMetaObject *QTimer::metaObj = 0;
#if QT_VERSION >= 200
static QMetaObjectInit init_QTimer(&QTimer::staticMetaObject);
#endif
void QTimer::initMetaObject()
{
if ( metaObj )
return;
if ( strcmp(QObject::className(), "QObject") != 0 )
badSuperclassWarning("QTimer","QObject");
#if QT_VERSION >= 200
staticMetaObject();
}
void QTimer::staticMetaObject()
{
if ( metaObj )
return;
QObject::staticMetaObject();
#else
QObject::initMetaObject();
#endif
typedef void(QTimer::*m2_t0)();
m2_t0 v2_0 = &QTimer::timeout;
QMetaData *signal_tbl = new QMetaData[1];
signal_tbl[0].name = "timeout()";
signal_tbl[0].ptr = *((QMember*)&v2_0);
metaObj = new QMetaObject( "QTimer", "QObject",
0, 0,
signal_tbl, 1 );
}
// SIGNAL timeout
void QTimer::timeout()
{
activate_signal( "timeout()" );
}
--- NEW FILE: qstack.h ---
#ifndef __QSTACK_H
#define __QSTACK_H
#include <stack>
#include <vector>
#include "qcollection.h"
template <class T>
class QStack : public stack<T*, vector<T*> >, public QCollection
{
public:
QStack() : QCollection() { }
virtual ~QStack() { clear(); }
virtual void clear()
{
while(remove());
}
bool remove()
{
if(!size())
return false;
T * t = top();
if(t) {
if(m_bAutoDelete)
delete t;
pop();
return true;
}
return false;
}
T* top()
{
if(size())
return stack<T*,vector<T*> >::top();
else
return 0;
}
bool isEmpty() const { return empty(); }
void push(const T* t) { stack<T*, vector<T*> >::push((T*)t); }
int count() const { return size(); }
};
#endif
--- NEW FILE: qscrollbar.cpp ---
#include "qscrollbar.h"
static void Scroll_Callback(Fl_Widget* o, void * pThis) {
((QScrollBar*)pThis)->_callback();
}
void QScrollBar::_callback()
{
valueChanged(m_pScroll->value());
}
QScrollBar:: QScrollBar(int min, int max, int lineStep, int pageStep, int value,
Orientation o, QWidget * parent, const char * name=0) : QWidget(parent,name)
{
// m_pScroll = new Fl_Scrollbar(0,0,1,1,"Text");
m_pScroll = new NxScrollbar(0,0,1,1,"");
setWidget(m_pScroll);
if(o == Horizontal)
m_pScroll->type(FL_HORIZONTAL);
else
m_pScroll->type(FL_VERTICAL);
setRange(min,max);
setSteps(lineStep,pageStep);
setValue(value);
m_pScroll->callback((Fl_Callback*)Scroll_Callback,this);
}
void QScrollBar::setValue(int value)
{
if(m_pScroll->type() == FL_HORIZONTAL) {
m_pScroll->value(value,
(int)((m_nMax - m_nMin) * ((float)w() / ((float)w() +
(float)(m_nMax - m_nMin)))),
m_nMin,m_nMax);
} else {
m_pScroll->value(value,
(int)((m_nMax - m_nMin) * ((float)h() / ((float)h() +
(float)(m_nMax - m_nMin)))),
m_nMin,m_nMax);
}
m_pScroll->range(m_nMin,m_nMax);
}
void QScrollBar::resize(int _x, int _y, int _w, int _h)
{
QWidget::resize(_x,_y,_w,_h);
setValue(value());
}
#include "qscrollbar.moc"
--- NEW FILE: qprinter.h ---
#ifndef __QPRINTER_H
#define __QPRINTER_H
#include "fltk-qbase.h"
#include "qpaintdevice.h"
class QWidget;
class QPrinter : public QPaintDevice
{
public:
enum PageSize { A4,B5,Letter,Legal,Executive };
enum Orientation { Portrait, Landscape };
bool setup(QWidget * parent = 0) { return true; }
PageSize pageSize() const { return Letter; }
Orientation orientation() const { return Portrait; }
bool newPage() { return true; }
};
#endif
--- NEW FILE: qlistbox.h ---
#ifndef __QLISTBOX_H
#define __QLISTBOX_H
#include "qstring.h"
#include "qwidget.h"
#include "Fl_Browser.H"
class QListBox : public QWidget
{
protected:
// CRH new
Fl_Browser *browser;
bool m_bMultiSelection;
int m_nCount;
public:
QListBox(QWidget * parent=0, const char * name=0, WFlags f=0) : QWidget(parent,name)
{
// CRH new
browser = new Fl_Browser(0, 0, 0, 0, 0);
browser->type(FL_HOLD_BROWSER);
// CRH new
setWidget(browser);
m_nCount = 0;
}
unsigned int count() const { return m_nCount; }
virtual void setCurrentItem(int index ) { }
void setMultiSelection(bool multi)
{
m_bMultiSelection = multi;
if (multi == true) browser->type(FL_MULTI_BROWSER);
else browser->type(FL_HOLD_BROWSER);
}
bool isMultiSelection() const { return m_bMultiSelection; }
void insertItem(const QString & text, int index=-1)
{
// CRH Fl_Browser::add(text,(void*)index);
browser->add(text.data(), 0);
browser->textfont(m_Font.getFont());
browser->textsize(m_Font.size());
// end CRH
m_nCount++;
}
// CRH virtual void setSelected(int item, bool b) { }
virtual void setSelected(int item, bool b) { browser->select(item + 1, 1);}
// CRH long maxItemWidth () const { return 0; }
long maxItemWidth () const
{
double len = 0;
double max = 0;
for(int i = 1; i <= m_nCount; i++)
if(max < (len = fl_width(browser->text(i))))
max = len;
return (long)max;
}
// CRH void changeItem(const QString & text, int index) { }
void changeItem(const QString & text, int index)
{browser->text(index + 1, text.data());}
bool isSelected(int item) const { if (browser->selected(item + 1)) return true; else return false; }
};
#endif
--- NEW FILE: qcombobox.h ---
#ifndef __QCOMBOBOX_H
#define __QCOMBOBOX_H
#include "qstring.h"
#include "qwidget.h"
#include "Fl_Choice.H"
#define QCOMBO_HEIGHT 20
#define QCOMBO_PADDING 50
class QComboBox : public QWidget
{
protected:
Fl_Choice * m_pCombo;
int m_nCount;
public:
QComboBox(bool rw, QWidget * parent=0, const char * name=0) : QWidget(parent,name)
{
m_nCount = 0;
QWidget::setMinimumSize(40,20);
m_pCombo = new Fl_Choice(0,0,40,20);
setWidget(m_pCombo);
}
int count() const { return m_nCount; }
void insertItem(const QString & text, int index=-1)
{
m_nCount++;
if(!text.length()) {
m_pCombo->add(" ");
_change_size(text);
} else {
m_pCombo->add(text);
_change_size(text);
}
}
void _change_size(const QString & text)
{
/* CRH
if(sizeHint().height() < fl_width((const char *) text) + QCOMBO_PADDING,
QCOMBO_HEIGHT) {
QWidget::setMinimumSize(fl_width((const char *) text) + QCOMBO_PADDING,
QCOMBO_HEIGHT);
*/
m_pCombo->textfont(m_Font.getFont());
m_pCombo->textsize(m_Font.size());
QFontMetrics fm(m_Font);
if(sizeHint().width() < fm.width(text) + QCOMBO_PADDING)
QWidget::setMinimumSize(fm.width(text) + QCOMBO_PADDING, fm.height() + 6);
QWidget::resize(sizeHint());
}
// CRH void setCurrentItem(int index) { return; m_pCombo->value(index);}
void setCurrentItem(int index) {m_pCombo->value(index);}
int getCurrentItem() { return m_pCombo->value(); }
void changeItem(const QString & text, int index)
{
m_pCombo->replace(index,text);
_change_size(text);
}
};
#endif
--- NEW FILE: qkeycode.h ---
#ifndef QKEYCODE_H
#define QKEYCODE_H
#if 0
#include "qglobal.h"
#endif // QT_H
const unsigned int SHIFT = 0x00002000; // accelerator modifiers
const unsigned int CTRL = 0x00004000;
const unsigned int ALT = 0x00008000;
const unsigned int ASCII_ACCEL = 0x10000000;
#define Key_Escape 0x1000 // misc keys
#define Key_Tab 0x1001
#define Key_Backtab 0x1002
#define Key_Backspace 0x1003
#define Key_Return 0x1004
#define Key_Enter 0x1005
#define Key_Insert 0x1006
#define Key_Delete 0x1007
#define Key_Pause 0x1008
#define Key_Print 0x1009
#define Key_SysReq 0x100a
#define Key_Home 0x1010 // cursor movement
#define Key_End 0x1011
#define Key_Left 0x1012
#define Key_Up 0x1013
#define Key_Right 0x1014
#define Key_Down 0x1015
#define Key_Prior 0x1016
#define Key_PageUp Key_Prior
#define Key_Next 0x1017
#define Key_PageDown Key_Next
#define Key_Shift 0x1020 // modifiers
#define Key_Control 0x1021
#define Key_Meta 0x1022
#define Key_Alt 0x1023
#define Key_CapsLock 0x1024
#define Key_NumLock 0x1025
#define Key_ScrollLock 0x1026 // see translateKeyEvent()
#define Key_F1 0x1030 // function keys
#define Key_F2 0x1031
#define Key_F3 0x1032
#define Key_F4 0x1033
#define Key_F5 0x1034
#define Key_F6 0x1035
#define Key_F7 0x1036
#define Key_F8 0x1037
#define Key_F9 0x1038
#define Key_F10 0x1039
#define Key_F11 0x103a
#define Key_F12 0x103b
#define Key_F13 0x103c
#define Key_F14 0x103d
#define Key_F15 0x103e
#define Key_F16 0x103f
#define Key_F17 0x1040
#define Key_F18 0x1041
#define Key_F19 0x1042
#define Key_F20 0x1043
#define Key_F21 0x1044
#define Key_F22 0x1045
#define Key_F23 0x1046
#define Key_F24 0x1047
#define Key_F25 0x1048 // F25 .. F35 only on X11
#define Key_F26 0x1049
#define Key_F27 0x104a
#define Key_F28 0x104b
#define Key_F29 0x104c
#define Key_F30 0x104d
#define Key_F31 0x104e
#define Key_F32 0x104f
#define Key_F33 0x1050
#define Key_F34 0x1051
#define Key_F35 0x1052
#define Key_Super_L 0x1053 // extra keys
#define Key_Super_R 0x1054
#define Key_Menu 0x1055
#define Key_Hyper_L 0x1056
#define Key_Hyper_R 0x1057
#define Key_Space 0x20 // 7 bit printable ASCII
#define Key_Exclam 0x21
#define Key_QuoteDbl 0x22
#define Key_NumberSign 0x23
#define Key_Dollar 0x24
#define Key_Percent 0x25
#define Key_Ampersand 0x26
#define Key_Apostrophe 0x27
#define Key_ParenLeft 0x28
#define Key_ParenRight 0x29
#define Key_Asterisk 0x2a
#define Key_Plus 0x2b
#define Key_Comma 0x2c
#define Key_Minus 0x2d
#define Key_Period 0x2e
#define Key_Slash 0x2f
#define Key_0 0x30
#define Key_1 0x31
#define Key_2 0x32
#define Key_3 0x33
#define Key_4 0x34
#define Key_5 0x35
#define Key_6 0x36
#define Key_7 0x37
#define Key_8 0x38
#define Key_9 0x39
#define Key_Colon 0x3a
#define Key_Semicolon 0x3b
#define Key_Less 0x3c
#define Key_Equal 0x3d
#define Key_Greater 0x3e
#define Key_Question 0x3f
#define Key_At 0x40
#define Key_A 0x41
#define Key_B 0x42
#define Key_C 0x43
#define Key_D 0x44
#define Key_E 0x45
#define Key_F 0x46
#define Key_G 0x47
#define Key_H 0x48
#define Key_I 0x49
#define Key_J 0x4a
#define Key_K 0x4b
#define Key_L 0x4c
#define Key_M 0x4d
#define Key_N 0x4e
#define Key_O 0x4f
#define Key_P 0x50
#define Key_Q 0x51
#define Key_R 0x52
#define Key_S 0x53
#define Key_T 0x54
#define Key_U 0x55
#define Key_V 0x56
#define Key_W 0x57
#define Key_X 0x58
#define Key_Y 0x59
#define Key_Z 0x5a
#define Key_BracketLeft 0x5b
#define Key_Backslash 0x5c
#define Key_BracketRight 0x5d
#define Key_AsciiCircum 0x5e
#define Key_Underscore 0x5f
#define Key_QuoteLeft 0x60
#define Key_BraceLeft 0x7b
#define Key_Bar 0x7c
#define Key_BraceRight 0x7d
#define Key_AsciiTilde 0x7e
// Latin 1 codes adapted from X: keysymdef.h,v 1.21 94/08/28 16:17:06
#define Key_nobreakspace 0x0a0
#define Key_exclamdown 0x0a1
#define Key_cent 0x0a2
#define Key_sterling 0x0a3
#define Key_currency 0x0a4
#define Key_yen 0x0a5
#define Key_brokenbar 0x0a6
#define Key_section 0x0a7
#define Key_diaeresis 0x0a8
#define Key_copyright 0x0a9
#define Key_ordfeminine 0x0aa
#define Key_guillemotleft 0x0ab /* left angle quotation mark */
#define Key_notsign 0x0ac
#define Key_hyphen 0x0ad
#define Key_registered 0x0ae
#define Key_macron 0x0af
#define Key_degree 0x0b0
#define Key_plusminus 0x0b1
#define Key_twosuperior 0x0b2
#define Key_threesuperior 0x0b3
#define Key_acute 0x0b4
#define Key_mu 0x0b5
#define Key_paragraph 0x0b6
#define Key_periodcentered 0x0b7
#define Key_cedilla 0x0b8
#define Key_onesuperior 0x0b9
#define Key_masculine 0x0ba
#define Key_guillemotright 0x0bb /* right angle quotation mark */
#define Key_onequarter 0x0bc
#define Key_onehalf 0x0bd
#define Key_threequarters 0x0be
#define Key_questiondown 0x0bf
#define Key_Agrave 0x0c0
#define Key_Aacute 0x0c1
#define Key_Acircumflex 0x0c2
#define Key_Atilde 0x0c3
#define Key_Adiaeresis 0x0c4
#define Key_Aring 0x0c5
#define Key_AE 0x0c6
#define Key_Ccedilla 0x0c7
#define Key_Egrave 0x0c8
#define Key_Eacute 0x0c9
#define Key_Ecircumflex 0x0ca
#define Key_Ediaeresis 0x0cb
#define Key_Igrave 0x0cc
#define Key_Iacute 0x0cd
#define Key_Icircumflex 0x0ce
#define Key_Idiaeresis 0x0cf
#define Key_ETH 0x0d0
#define Key_Ntilde 0x0d1
#define Key_Ograve 0x0d2
#define Key_Oacute 0x0d3
#define Key_Ocircumflex 0x0d4
#define Key_Otilde 0x0d5
#define Key_Odiaeresis 0x0d6
#define Key_multiply 0x0d7
#define Key_Ooblique 0x0d8
#define Key_Ugrave 0x0d9
#define Key_Uacute 0x0da
#define Key_Ucircumflex 0x0db
#define Key_Udiaeresis 0x0dc
#define Key_Yacute 0x0dd
#define Key_THORN 0x0de
#define Key_ssharp 0x0df
#define Key_agrave 0x0e0
#define Key_aacute 0x0e1
#define Key_acircumflex 0x0e2
#define Key_atilde 0x0e3
#define Key_adiaeresis 0x0e4
#define Key_aring 0x0e5
#define Key_ae 0x0e6
#define Key_ccedilla 0x0e7
#define Key_egrave 0x0e8
#define Key_eacute 0x0e9
#define Key_ecircumflex 0x0ea
#define Key_ediaeresis 0x0eb
#define Key_igrave 0x0ec
#define Key_iacute 0x0ed
#define Key_icircumflex 0x0ee
#define Key_idiaeresis 0x0ef
#define Key_eth 0x0f0
#define Key_ntilde 0x0f1
#define Key_ograve 0x0f2
#define Key_oacute 0x0f3
#define Key_ocircumflex 0x0f4
#define Key_otilde 0x0f5
#define Key_odiaeresis 0x0f6
#define Key_division 0x0f7
#define Key_oslash 0x0f8
#define Key_ugrave 0x0f9
#define Key_uacute 0x0fa
#define Key_ucircumflex 0x0fb
#define Key_udiaeresis 0x0fc
#define Key_yacute 0x0fd
#define Key_thorn 0x0fe
#define Key_ydiaeresis 0x0ff
#define Key_unknown 0xffff
#endif // QKEYCODE_H
--- NEW FILE: qrect.cpp ---
#include <stdio.h>
#include "qrect.h"
//#define QRECTDEBUG
//#define QRECTDEBUGPAUSE
/*
**
** Returns TRUE if the rectangle 'r' is inside this rectangle.
**
** If 'proper' is TRUE, this function returns TRUE only if 'r' is entirely
** inside (not on the edge).
**
*/
bool QRect::contains(const QRect & r, bool proper=false) const
{
bool result;
int b1,b2,l1,l2,r1,r2,t1,t2;
t1 = m_nY;
b1 = t1 + m_nHeight - 1;
l1 = m_nX;
r1 = l1 + m_nWidth - 1;
t2 = r.m_nY;
b2 = t2 + r.m_nHeight - 1;
l2 = r.m_nX;
r2 = l2 + r.m_nWidth - 1;
if(proper)
{
t1++; b1--; l1++; r1--;
}
if((t2 >= t1) && (b2 <= b1) && (l2 >= l1) && (r2 <= r1))
result = true;
else
result = false;
#ifdef QRECTDEBUG
printf("QRect::contains:\n");
printf("R1: t:%s b:%d l:%d r:%d\n",t1,b1,l1,r1);
printf("R2: t:%s b:%d l:%d r:%d\n",t2,b2,l2,r2);
if(result)
printf("Returning true\n");
else
printf("Returning false\n");
#endif
#ifdef QRECTDEBUGPAUSE
getchar();
#endif
return(result);
}
/*
**
** Returns TRUE if the point 'p' is inside or on the edge of the rectangle.
**
** If 'proper' is TRUE, this function returns TRUE only if 'p' is inside
** (not on the edge).
**
*/
bool QRect::contains(const QPoint & p, bool proper=false) const
{
bool result;
int px,py,rb,rl,rr,rt;
rt = m_nY;
rb = rt + m_nHeight - 1;
rl = m_nX;
rr = rl + m_nWidth - 1;
px = p.x();
py = p.y();
if(proper)
{
rt++; rb--; rl++; rr--;
}
if((py >= rt) && (py <= rb) && (px >= rl) && (py <= rr))
result = true;
else
result = false;
#ifdef QRECTDEBUG
printf("QRect::contains:\n");
printf("R: t:%s b:%d l:%d r:%d\n",rt,rb,rl,rr);
printf("P: x:%s y:%d\n",px,py);
if(result)
printf("Returning true\n");
else
printf("Returning false\n");
#endif
#ifdef QRECTDEBUGPAUSE
getchar();
#endif
return(result);
}
/*
**
** Returns TRUE if this rectangle intersects with 'r' (there is at least one
** pixel which is within both rectangles).
**
*/
bool QRect::intersects(const QRect & r) const
{
bool result;
int b1,b2,l1,l2,r1,r2,t1,t2;
t1 = m_nY;
b1 = t1 + m_nHeight - 1;
l1 = m_nX;
r1 = l1 + m_nWidth - 1;
t2 = r.m_nY;
b2 = t2 + r.m_nHeight - 1;
l2 = r.m_nX;
r2 = l2 + r.m_nWidth - 1;
if((b2 < t1) || (t2 > b1) || (r2 < l1) || (l2 > r1))
result = true;
else
result = false;
#ifdef QRECTDEBUG
printf("QRect::intersects:\n");
printf("R1: t:%s b:%d l:%d r:%d\n",t1,b1,l1,r1);
printf("R2: t:%s b:%d l:%d r:%d\n",t2,b2,l2,r2);
if(result)
printf("Returning true\n");
else
printf("Returning false\n");
#endif
#ifdef QRECTDEBUGPAUSE
getchar();
#endif
return(result);
}
/*
**
** Returns the intersection of the two QRect's. If they don't overlap,
** a QRect at 0,0 with a width and height of 0 is returned.
**
*/
QRect QRect::intersect(const QRect & r) const
{
QRect result;
int b1,b2,b3,l1,l2,l3,r1,r2,r3,t1,t2,t3;
if(intersects(r) == false)
{
result.m_nX = result.m_nY = 0;
result.m_nWidth = result.m_nHeight = 0;
return(result);
}
t1 = m_nY;
b1 = t1 + m_nHeight - 1;
l1 = m_nX;
r1 = l1 + m_nWidth - 1;
t2 = r.m_nY;
b2 = t2 + r.m_nHeight - 1;
l2 = r.m_nX;
r2 = l2 + r.m_nWidth - 1;
if(t1 > t2)
t3 = t1;
else
t3 = t2;
if(b1 < b2)
b3 = b1;
else
b3 = b2;
if(l1 > l2)
l3 = l1;
else
l3 = l2;
if(r1 < r2)
r3 = r1;
else
r3 = r2;
result.m_nX = l3;
result.m_nY = t3;
result.m_nWidth = (r3 - l3) + 1;
result.m_nHeight = (b3 - t3) + 1;
#ifdef QRECTDEBUG
printf("QRect::intersect:\n");
printf("R1: t:%s b:%d l:%d r:%d\n",t1,b1,l1,r1);
printf("R2: t:%s b:%d l:%d r:%d\n",t2,b2,l2,r2);
printf("Result: t:%s b:%d l:%d r:%d\n",t3,b3,l3,r3);
#endif
#ifdef QRECTDEBUGPAUSE
getchar();
#endif
return(result);
}
--- NEW FILE: qpaintdevice.h ---
#ifndef __QPAINTDEVICE_H
#define __QPAINTDEVICE_H
#include "qobject.h"
#include "Fl_Widget.H"
#include "Fl_Window.H"
#include "Fl_Double_Window.H"
#include "fl_draw.H"
#define PDT_UNDEF 0x00
#define PDT_WIDGET 0x01
#define PDT_PIXMAP 0x02
#define PDT_PRINTER 0x03
#define PDT_PICTURE 0x04
#define PDT_SYSTEM 0x05
#define PDT_MASK 0x0f
enum RasterOp { CopyROP, OrROP, XorROP, EraseROP,
NotCopyROP, NotOrROP, NotXorROP,
NotEraseROP, NotROP };
//#define USE_FL_WIDGET 1
#ifdef USE_FL_WIDGET
#define FLTK_PARENT_WIDGET Fl_Widget
#else
#define FLTK_PARENT_WIDGET Fl_Double_Window
#endif
class QPaintDevice : public FLTK_PARENT_WIDGET
{
public:
QPaintDevice() : FLTK_PARENT_WIDGET(0,0,0,0,"")
{ end(); }
QPaintDevice(const QPaintDevice & pd) : FLTK_PARENT_WIDGET(0,0,0,0,"")
{ end(); }
~QPaintDevice() { if(parent()) ((Fl_Group*)parent())->remove(this); }
friend void bitBlt( QPaintDevice *, int, int,
const QPaintDevice *,
int, int, int, int, RasterOp, bool );
int devType() const { return 0; }
void make_current() const { ((QPaintDevice*)this)->FLTK_PARENT_WIDGET::make_current(); }
void show() const { ((QPaintDevice*)this)->FLTK_PARENT_WIDGET::show(); }
virtual FL_EXPORT void draw() { }
virtual int handle(int event) { return 0; }
virtual void resize(const QSize & size)
{ resize(size.width(), size.height()); }
virtual void resize(int w, int h) { resize(x(),y(),w,h); }
virtual void resize(int _x, int _y, int _w, int _h)
{
/*
QSize old_size(width(), height());
QSize new_size(_w,_h);
QResizeEvent q(new_size,old_size);
*/
FLTK_PARENT_WIDGET::resize(_x,_y,_w,_h);
// resizeEvent(&q);
}
QPaintDevice & operator=(const QPaintDevice & pd) { return *this; }
};
inline void bitBlt(QPaintDevice * dst, int dx, int dy,
const QPaintDevice * src, int sx,
int sy, int sw, int sh,RasterOp rop = CopyROP,
bool ignoreMask=false) { }
#endif
--- NEW FILE: qradiobutton.h ---
#ifndef __QRADIOBUTTON_H
#define __QRADIOBUTTON_H
/* Lots o' changes CRH
#include "qwidget.h"
#include <Fl_Check_Button.H>
class QRadioButton : public QWidget
{
public:
QRadioButton(QWidget * parent, const char * name=0) : QWidget(parent,name)
{
QWidget::setMinimumSize(30,30);
Fl_Button * b = new Fl_Check_Button(0,0,30,30,"");
Fl_Group::add(b);
setWidget(b);
}
~QRadioButton() { }
bool isChecked() const { return false; }
virtual void setChecked(bool check) { }
};
*/
#include "qwidget.h"
#include <Fl_Button.H>
static void cb_radio(Fl_Widget *, QWidget *me)
{
Fl_Group *g = ((Fl_Group *)me->parent());
int i;
for(i = 0; i < g->children(); i++)
{
QWidget *w = (QWidget *)g->child(i);
if(w->getWidget()->type() == FL_RADIO_BUTTON && w != me)
((Fl_Button *)w->getWidget())->clear();
}
}
class QRadioButton : public QWidget
{
protected:
Fl_Button *b;
public:
QRadioButton(QWidget * parent, const char * name=0) : QWidget(parent,name)
{
b = new Fl_Button(0, 0, 0, 0, 0);
b->selection_color(FL_RED);
b->box(FL_ROUND_DOWN_BOX);
b->down_box(FL_ROUND_DOWN_BOX);
b->type(FL_RADIO_BUTTON);
setWidget(b);
b->callback((Fl_Callback *)cb_radio, this);
}
~QRadioButton() { }
bool isChecked() const { return 1 == b->value();}
void setChecked(bool check) {if(check) {cb_radio(0, this); b->set();}}
};
#endif
--- NEW FILE: qconst.h ---
#ifndef __QCONST_H
#define __QCONST_H
const QColor color0(0,0,0);
const QColor color1(255,255,255);
const QColor black(0,0,0);
const QColor white(255,255,255);
const QColor darkGray(64,64,64);
const QColor gray(128,128,128);
const QColor lightGray(178,178,178);
const QColor red(255,0,0);
const QColor green(0,255,0);
const QColor blue(0,0,255);
const QColor cyan(128,0,128);
const QColor magenta(128,128,0);
const QColor yellow(0,128,128);
const QColor darkRed(178,64,64);
const QColor darkGreen(64,178,64);
const QColor darkBlue(64,64,178);
const QColor darkCyan(178,64,178);
const QColor darkMagenta(178,178,64);
const QColor darkYellow(64,178,178);
const QCursor arrowCursor;
const QCursor upArrowCursor;
const QCursor crossCursor;
const QCursor waitCursor;
const QCursor ibeamCursor;
const QCursor sizeVerCursor;
const QCursor sizeHorCursor;
const QCursor sizeBDiagCursor;
const QCursor sizeFDiagCursor;
const QCursor sizeAllCursor;
const QCursor blankCursor;
#endif
--- NEW FILE: history.cpp ---
#include <malloc.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "history.h"
//#define ENV_STORAGE
#define STR_LEN 256
#define ENV_PREFIX "VIEWMLH"
History::History()
{
char buf[256];
int index;
// allocate string storage
index = 0;
do
{
m_list[index] = (char *)malloc(STR_LEN);
*(m_list[index]) = 0x00;
}while(++index < MAX_HISTORY_LEN);
// push an initial URL on the stack
strcpy(m_list[0],"http://www.viewml.com");
// load all entries from the environment
#ifdef ENV_STORAGE
char * ptr;
index = 0;
do
{
sprintf(buf,"%s%02d",ENV_PREFIX,index);
ptr = getenv(buf);
if(ptr == NULL)
break;
AddToHistoryList(ptr);
}while(++index < MAX_HISTORY_LEN);
#else
FILE *fp;
strcpy(buf,getenv("HOME"));
strcat(buf,"/.viewmlh.txt");
if((fp = fopen(buf,"r")) == NULL)
return;
index = 0;
while(1)
{
if(fgets(buf,256,fp) == NULL)
break;
buf[strlen(buf) - 1] = 0x00;
AddToHistoryList(buf);
}
fclose(fp);
#endif
}
History::~History(void)
{
char buf[256];
int index;
// save all entries to the environment
#ifdef ENV_STORAGE
index = MAX_HISTORY_LEN - 1;
do
{
if(*(m_list[index]) == 0x00)
continue;
sprintf(buf,"%s%02d",ENV_PREFIX,index);
setenv(buf,m_list[index],1);
}while(--index >= 0);
#else
FILE *fp;
strcpy(buf,getenv("HOME"));
strcat(buf,"/.viewmlh.txt");
if((fp = fopen(buf,"w")) == NULL)
return;
index = MAX_HISTORY_LEN - 1;
do
{
if(*(m_list[index]) == 0x00)
continue;
fprintf(fp,"%s\n",m_list[index]);
}while(--index >= 0);
fclose(fp);
#endif
// free string storage
index = 0;
do
{
free(m_list[index]);
}while(++index < MAX_HISTORY_LEN);
}
void History::AddToHistoryList(const char *str)
{
char *ptr;
int index;
// scan the list - see if "str" is already there
index = 0;
do
{
if(strcmp(str,m_list[index]) == 0)
break;
}while(++index < MAX_HISTORY_LEN);
// entry exists - just bubble it up to top
if(index != MAX_HISTORY_LEN)
{
if(index == 0)
return;
ptr = m_list[index--];
while(index >= 0)
m_list[index + 1] = m_list[index--];
m_list[0] = ptr;
}
// entry does not exist - push it on the stack
else
{
ptr = m_list[MAX_HISTORY_LEN - 1];
index = MAX_HISTORY_LEN - 2;
while(index >= 0)
m_list[index + 1] = m_list[index--];
m_list[0] = ptr;
strcpy(m_list[0],str);
}
}
const char *History::GetHistoryEntry(int entry)
{
if(entry >= MAX_HISTORY_LEN)
return(NULL);
if(*(m_list[entry]) == 0x00)
return(NULL);
return(m_list[entry]);
}
--- NEW FILE: qscrollbar.moc ---
/****************************************************************************
** QScrollBar meta object code from reading C++ file 'qscrollbar.h'
**
** Created: Wed Nov 8 16:23:43 2000
** by: The Qt Meta Object Compiler ($Revision: 1.1 $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#if !defined(Q_MOC_OUTPUT_REVISION)
#define Q_MOC_OUTPUT_REVISION 2
#elif Q_MOC_OUTPUT_REVISION != 2
#error "Moc format conflict - please regenerate all moc files"
#endif
#include "qscrollbar.h"
#include <qmetaobject.h>
const char *QScrollBar::className() const
{
return "QScrollBar";
}
QMetaObject *QScrollBar::metaObj = 0;
#if QT_VERSION >= 200
static QMetaObjectInit init_QScrollBar(&QScrollBar::staticMetaObject);
#endif
void QScrollBar::initMetaObject()
{
if ( metaObj )
return;
if ( strcmp(QWidget::className(), "QWidget") != 0 )
badSuperclassWarning("QScrollBar","QWidget");
#if QT_VERSION >= 200
staticMetaObject();
}
void QScrollBar::staticMetaObject()
{
if ( metaObj )
return;
QWidget::staticMetaObject();
#else
QWidget::initMetaObject();
#endif
typedef void(QScrollBar::*m2_t0)(int);
m2_t0 v2_0 = &QScrollBar::valueChanged;
QMetaData *signal_tbl = new QMetaData[1];
signal_tbl[0].name = "valueChanged(int)";
signal_tbl[0].ptr = *((QMember*)&v2_0);
metaObj = new QMetaObject( "QScrollBar", "QWidget",
0, 0,
signal_tbl, 1 );
}
// SIGNAL valueChanged
void QScrollBar::valueChanged( int t0 )
{
activate_signal( "valueChanged(int)", t0 );
}
--- NEW FILE: kcharsets.cpp ---
#include "kcharsets.h"
const KCharsetConversionResult & KCharsets::convertTag(const char * tag)
{
int l;
return convertTag(tag,l);
}
typedef struct
{
char *tag;
char *conversion;
}TagEntry;
/*
Some of these tags were contributed by Johannes Thoma <joe at mond.at>
*/
static TagEntry tag_list[] =
{
{ "&","&"},
{ "&bull","*" },
{ "©","\xA9" },
{ "&emdash","-" },
{ "&emsp"," " },
{ "&endash","-" },
{ "&ensp"," " },
{ ">",">" },
{ "&hellip","..." },
{ "<","<" },
{ " "," " },
{ ""","\"" },
{ "®","\xAE" },
{ "&trade","(tm)" },
{ "Æ", "\xc6" }, /* capital AE diphthong (ligature) */
{ "Á", "\xc1" }, /* capital A, acute accent */
{ "Â", "\xc2" }, /* capital A, circumflex accent */
{ "À", "\xc0" }, /* capital A, grave accent */
{ "Å", "\xc5" }, /* capital A, ring */
{ "Ã", "\xc3" }, /* capital A, tilde */
{ "Ä", "\xc4" }, /* capital A, dieresis or umlaut mark*/
{ "Ç", "\xc7" }, /* capital C, cedilla */
{ "Ð", "\xd0" }, /* capital Eth, Icelandic */
{ "É", "\xc9" }, /* capital E, acute accent */
{ "Ê", "\xca" }, /* capital E, circumflex accent */
{ "È", "\xc8" }, /* capital E, grave accent */
{ "Ë", "\xcb" }, /* capital E, dieresis or umlaut mark*/
{ "Í", "\xcd" }, /* capital I, acute accent */
{ "Î", "\xce" }, /* capital I, circumflex accent */
{ "Ì", "\xcc" }, /* capital I, grave accent */
{ "Ï", "\xcf" }, /* capital I, dieresis or umlaut mark*/
{ "Ñ", "\xd1" }, /* capital N, tilde */
{ "Ó", "\xd3" }, /* capital O, acute accent */
{ "Ô", "\xd4" }, /* capital O, circumflex accent */
{ "Ò", "\xd2" }, /* capital O, grave accent */
{ "Ø", "\xd8" }, /* capital O, slash */
{ "Õ", "\xd5" }, /* capital O, tilde */
{ "Ö", "\xd6" }, /* capital O, dieresis or umlaut mark*/
{ "Þ", "\xdd" }, /* capital THORN, Icelandic */
{ "Ú", "\xda" }, /* capital U, acute accent */
{ "Û", "\xdb" }, /* capital U, circumflex accent */
{ "Ù", "\xd9" }, /* capital U, grave accent */
{ "Ü", "\xdc" }, /* capital U, dieresis or umlaut mark*/
{ "Ý", "\xdd" }, /* capital Y, acute accent */
{ "á", "\xe1" }, /* small a, acute accent */
{ "â", "\xe2" }, /* small a, circumflex accent */
{ "æ", "\xe6" }, /* small ae diphthong (ligature) */
{ "à", "\xe0" }, /* small a, grave accent */
{ "å", "\xe5" }, /* small a, ring */
{ "ã", "\xe3" }, /* small a, tilde */
{ "ä", "\xe4" }, /* small a, dieresis or umlaut mark */
{ "ç", "\xe7" }, /* small c, cedilla */
{ "é", "\xe9" }, /* small e, acute accent */
{ "ê", "\xea" }, /* small e, circumflex accent */
{ "è", "\xe8" }, /* small e, grave accent */
{ "ð", "\xf0" }, /* small eth, Icelandic */
{ "ë", "\xeb" }, /* small e, dieresis or umlaut mark */
{ "í", "\xed" }, /* small i, acute accent */
{ "î", "\xee" }, /* small i, circumflex accent */
{ "ì", "\xec" }, /* small i, grave accent */
{ "ï", "\xef" }, /* small i, dieresis or umlaut mark */
{ "ñ", "\xf1" }, /* small n, tilde */
{ "ó", "\xf3" }, /* small o, acute accent */
{ "ô", "\xf4" }, /* small o, circumflex accent */
{ "ò", "\xf2" }, /* small o, grave accent */
{ "ø", "\xf8" }, /* small o, slash */
{ "õ", "\xf5" }, /* small o, tilde */
{ "ö", "\xf6" }, /* small o, dieresis or umlaut mark */
{ "ß", "\xdf" }, /* small sharp s, German (szligature)-> */
{ "þ", "\xfe" }, /* small thorn, Icelandic */
{ "ú", "\xfa" }, /* small u, acute accent */
{ "û", "\xfb" }, /* small u, circumflex accent */
{ "ù", "\xf9" }, /* small u, grave accent */
{ "ü", "\xfc" }, /* small u, dieresis or umlaut mark */
{ "ý", "\xfd" }, /* small y, acute accent */
{ "ÿ", "\xff" }, /* small y, dieresis or umlaut mark */
{ "&","&" }, // must be last entry in table
{ NULL,NULL }
};
const KCharsetConversionResult & KCharsets::convertTag(const char * tag,
int & len)
{
char buf[8];
int count,taglen;
// check tag for number
if(*(tag + 1) == '#')
{
buf[0] = atoi(tag + 2);
buf[1] = 0x00;
m_Result.setResult(buf);
len = strlen(tag);
}
// scan list for tag
else
{
count = 0;
while(tag_list[count].tag != NULL)
{
taglen = strlen(tag_list[count].tag);
if(strncmp(tag,tag_list[count].tag,taglen) == 0)
{
m_Result.setResult(tag_list[count].conversion);
len = taglen;
break;
}
++count;
}
// no matching tag - substitute a space code
if(tag_list[count].tag == NULL)
{
m_Result.setResult(" ");
len = strlen(tag);
}
}
//printf("KCharSet: \"%s\" = \"%s\"",tag,(char*)m_Result); getchar();
// return result and exit
return(m_Result);
}
--- NEW FILE: nxscroll.h ---
#ifndef NXSCROLL_INCLUDED
#define NXSCROLL_INCLUDED 1
#include <FL/Fl_Group.H>
#include "nxscrollbar.h"
#include <FL/Fl_Scrollbar.H>
class NxScroll : public Fl_Group
{
int save_h;
bool move;
bool resize_;
int xposition_, yposition_;
int width_, height_;
int oldx, oldy;
static FL_EXPORT void hscrollbar_cb(Fl_Widget*, void*);
static FL_EXPORT void scrollbar_cb(Fl_Widget*, void*);
FL_EXPORT void fix_scrollbar_order();
static FL_EXPORT void draw_clip(void*,int,int,int,int);
FL_EXPORT void bbox(int&,int&,int&,int&);
protected:
FL_EXPORT void draw();
public:
NxScrollbar scrollbar;
NxScrollbar hscrollbar;
void movable(bool flag) { move = flag; }
void resize(bool flag) { resize_ = flag; }
FL_EXPORT void resize(int,int,int,int);
FL_EXPORT int handle(int);
enum { // values for type()
HORIZONTAL = 1,
VERTICAL = 2,
BOTH = 3,
ALWAYS_ON = 4,
HORIZONTAL_ALWAYS = 5,
VERTICAL_ALWAYS = 6,
BOTH_ALWAYS = 7
};
int xposition() const {return xposition_;}
int yposition() const {return yposition_;}
FL_EXPORT void position(int, int);
NxScroll(int x, int y, int w, int h, const char *l=0);
}; // end of NxSlider::NxScroll()
#endif // NXSCROLL_INCLUDED
--- NEW FILE: qevent.h ---
#ifndef __QEVENT_H
#define __QEVENT_H
#include "qpoint.h"
#include "qrect.h"
#include "qsize.h"
#include "qkeycode.h"
#define Event_None 0 // invalid event
#define Event_Timer 1 // timer event
#define Event_MouseButtonPress 2 // mouse button pressed
#define Event_MouseButtonRelease 3 // mouse button released
#define Event_MouseButtonDblClick 4 // mouse button double click
#define Event_MouseMove 5 // mouse move
#define Event_KeyPress 6 // key pressed
#define Event_KeyRelease 7 // key released
#define Event_FocusIn 8 // keyboard focus received
#define Event_FocusOut 9 // keyboard focus lost
#define Event_Enter 10 // mouse enters widget
#define Event_Leave 11 // mouse leaves widget
#define Event_Paint 12 // paint widget
#define Event_Move 13 // move widget
#define Event_Resize 14 // resize widget
#define Event_Create 15 // after object creation
#define Event_Destroy 16 // during object destruction
#define Event_Show 17 // widget is shown
#define Event_Hide 18 // widget is hidden
#define Event_Close 19 // request to close widget
#define Event_Quit 20 // request to quit application
#define Event_Accel 30 // accelerator event
#define Event_Clipboard 40 // internal clipboard event
#define Event_SockAct 50 // socket activation
#define Event_DragEnter 60 // drag moves into widget
#define Event_DragMove 61 // drag moves in widget
#define Event_DragLeave 62 // drag leaves or is cancelled
#define Event_Drop 63 // actual drop
#define Event_DragResponse 64 // drag accepted/rejected
#define Event_ChildInserted 70 // new child widget
#define Event_ChildRemoved 71 // deleted child widget
#define Event_LayoutHint 72 // child min/max size changed
#define Event_ActivateControl 80 // ActiveX activation
#define Event_DeactivateControl 81 // ActiveX deactivation
#define Event_User 1000 // first user event id
class QEvent
{
public:
QEvent() {}
QEvent(int type) { }
};
class QPaintEvent : public QEvent
{
public:
QPaintEvent( const QRect &paintRect )
: QEvent(Event_Paint), r(paintRect) {}
const QRect &rect() const { return r; }
protected:
QRect r;
};
class QResizeEvent : public QEvent
{
public:
QResizeEvent( const QSize &size, const QSize &oldSize )
: QEvent(Event_Resize), s(size), olds(oldSize) {}
const QSize &size() const { return s; }
const QSize &oldSize()const { return olds;}
protected:
QSize s, olds;
};
enum ButtonState { // mouse/keyboard state values
NoButton = 0x00,
LeftButton = 0x01,
RightButton = 0x02,
MidButton = 0x04,
MouseButtonMask = 0x07,
ShiftButton = 0x08,
ControlButton = 0x10,
AltButton = 0x20,
KeyButtonMask = 0x38
};
class QMouseEvent : public QEvent
{
protected:
static QPoint g;
QPoint m_Point;
int b;
unsigned short s;
public:
QMouseEvent() { s = 0; b = 0; }
const QPoint &pos() const { return m_Point; }
const QPoint &globalPos() const { return g; }
int x() const { return m_Point.x(); }
int y() const { return m_Point.y(); }
int globalX() const { return g.x(); }
int globalY() const { return g.y(); }
int button() const { return b; }
int state() const { return s; }
void setButton(int _b) { b = _b; }
void setPos(const QPoint & pos) { m_Point = pos; }
void setGlobalPos(const QPoint & pos) { g = pos; }
};
class QCloseEvent : public QEvent
{
public:
void accept() { }
};
class QKeyEvent : public QEvent
{
public:
QKeyEvent( int type, int key, int ascii, int state )
: QEvent(type), k((unsigned short)key),
s((unsigned short)state),
a((unsigned char)ascii),
accpt(true) {}
int key() const { return k; }
int ascii() const { return a; }
int state() const { return s; }
bool isAccepted() const { return accpt; }
void accept() { accpt = true; }
void ignore() { accpt = false; }
protected:
unsigned short k, s;
unsigned char a;
char accpt;
};
class QTimerEvent : public QEvent
{
};
class QFocusEvent : public QEvent
{
};
#endif
--- NEW FILE: qwidget.cpp ---
#include "qpoint.h"
#include "qwidget.h"
#include <Fl.H>
#ifdef _NANOX
#include <n_x.h>
#else
#include <x.H>
#endif
QPoint QMouseEvent::g;
//extern int fl_window;
QMetaObject *QWidget::metaObj = 0;
const char * QWidget::className() const
{
return "QWidget";
}
void QWidget::resize(int w, int h)
{
resize(x(),y(),w,h);
}
void QWidget::repaint()
{
redraw();
}
void QWidget::repaint(bool erase)
{
redraw();
}
void QWidget::draw()
{
QRect r(0,0,w(),h());
m_bInPaint = true;
if(m_pWidget) {
Fl_Window::draw();
} else {
QPaintEvent pe(r);
paintEvent(&pe);
}
m_bInPaint = false;
}
void QWidget::move(int x, int y)
{
FLTK_PARENT_WIDGET::position(x,y);
}
void QWidget::repaint(int x, int y, int w, int h, bool erase)
{
damage(0,x,y,w,h);
redraw();
}
void QWidget::show()
{
if(!visible()){
FLTK_PARENT_WIDGET::show();
#ifdef _NANOX
GrReparentWindow(fl_xid(this),fl_xid((Fl_Window*)parent()),x(),y());
#endif
} else {
if(!shown())
FLTK_PARENT_WIDGET::show();
}
if(m_pWidget) {
m_pWidget->show();
}
}
void QWidget::hide()
{
FLTK_PARENT_WIDGET::hide();
if(m_pWidget) {
m_pWidget->hide();
}
}
void QWidget::setWidget(Fl_Widget * w)
{
m_pWidget = w;
Fl_Group::add(w);
}
// CRH
Fl_Widget *QWidget::getWidget()
{
return m_pWidget;
}
void QWidget::resize(int _x, int _y, int _w, int _h)
{
QSize old_size(width(), height());
QSize new_size(_w,_h);
QResizeEvent q(new_size,old_size);
FLTK_PARENT_WIDGET::resize(_x,_y,_w,_h);
resizeEvent(&q);
if(m_pWidget) {
m_pWidget->size(_w,_h);
}
}
void QWidget::setGeometry(int _x, int _y, int _w, int _h)
{
resize(_x,_y,_w,_h);
}
void QWidget::resizeEvent( QResizeEvent *)
{
// cerr << "QWidget::resizeEvent\n";
}
void QWidget::FillMouseEvent(QMouseEvent * e)
{
/*
int x = parent() ? Fl::event_x() - parent()->x() : Fl::event_x();
int y = parent() ? Fl::event_y() - parent()->y() : Fl::event_y();
*/
int x = Fl::event_x();
int y = Fl::event_y();
int b = Fl::event_state();
int b1 = 0;
if(b == FL_BUTTON1)
b1 = LeftButton;
else if(b== FL_BUTTON2)
b1 = RightButton;
else
b1 = MidButton;
e->setButton(b1);
e->setPos(QPoint(x,y));
e->setGlobalPos(QPoint(Fl::event_x(), Fl::event_y()));
}
void QWidget::initMetaObject()
{
}
static int send(Fl_Widget* o, int event) {
if (o->type() < FL_WINDOW) return o->handle(event);
int save_x = Fl::e_x; Fl::e_x -= o->x();
int save_y = Fl::e_y; Fl::e_y -= o->y();
int ret = o->handle(event);
Fl::e_y = save_y;
Fl::e_x = save_x;
return ret;
}
int QWidget::handle(int event)
{
Fl_Widget*const* a = array();
int i;
Fl_Widget * o;
int ret = 0;
QMouseEvent e;
// if(m_pWidget)
// return Fl_Window::handle(event);
switch(event) {
case FL_PUSH:
FillMouseEvent(&e);
mousePressEvent(&e);
ret = 0;
break;
case FL_MOVE:
FillMouseEvent(&e);
// mouseMoveEvent(&e);
ret = 0;
break;
case FL_RELEASE:
FillMouseEvent(&e);
mouseReleaseEvent(&e);
for (i = children(); i--;) {
o = a[i];
if (o->takesevents() && Fl::event_inside(o)) {
if (send(o,FL_RELEASE)) {
return 1;
}
}
}
ret = 0;
break;
}
return Fl_Window::handle(event);
return ret;
}
--- NEW FILE: qbitmap.h ---
#ifndef __QBITMAP_H
#define __QBITMAP_H
class QBitmap
{
public:
QBitmap(int w, int h, const unsigned char * bits, bool isXbitmap = FALSE) { }
QBitmap() { }
};
#endif
--- NEW FILE: qfile.h ---
#ifndef QFILE_H
#define QFILE_H
#include "qiodevice.h"
class QFile : public QIODevice
{
public:
QFile(const QString & name) { }
virtual bool open(int) { return true; }
virtual void close() { }
};
#endif
--- NEW FILE: qlineedit.cpp ---
#include "qlineedit.h"
static void Edit_Callback(Fl_Widget* o, void * pThis)
{
((QLineEdit*)pThis)->_callback();
}
void QLineEdit::_callback()
{
emit textChanged(m_pInput->value());
}
QLineEdit::QLineEdit(QWidget * parent, const char * name) : QWidget(parent, name)
{
QWidget::setMinimumSize(40,20);
m_pInput = new Fl_Input(0,0,40,20,"Text");
setWidget(m_pInput);
m_pInput->callback((Fl_Callback*)Edit_Callback,this);
m_pInput->when(FL_WHEN_ENTER_KEY | FL_WHEN_CHANGED);
}
#include "qlineedit.moc"
--- NEW FILE: qdrawutil.h ---
#ifndef __QDRAWUTIL_H
#define __QDRAWUTIL_H
void qDrawShadePanel( QPainter *p, int x, int y, int w, int h,
const QColorGroup &, bool sunken=FALSE,
int lineWidth = 1, const QBrush *fill = 0 );
void qDrawShadeLine( QPainter *p, int x1, int y1, int x2, int y2,
const QColorGroup &g, bool sunken = TRUE,
int lineWidth = 1, int midLineWidth = 0 );
void qDrawShadeLine( QPainter *p, const QPoint &p1, const QPoint &p2,
const QColorGroup &g, bool sunken = TRUE,
int lineWidth = 1, int midLineWidth = 0 );
#endif
--- NEW FILE: nxslider.cpp ---
#include <FL/Enumerations.H>
#include "nxslider.h"
void NxSlider::_NxSlider() {
slider_size_ = 0;
slider_ = 0; // FL_UP_BOX;
}
NxSlider::NxSlider(int x, int y, int w, int h, const char *l) :
Fl_Valuator(x, y, w, h, l) {
// Provide the "look-and-feel"
db_handle *db = db_openDB(db_getDefaultDB(), PAR_DB_MODE_RDONLY);
unsigned long c=0;
par_getGlobalColor(db, "scrolltray", &c);
scroll_tray = fl_color_cube( ((c>>16) & 0xFF)*FL_NUM_RED/256,
((c>>8) & 0xFF)*FL_NUM_GREEN/256,(c & 0xFF)*FL_NUM_BLUE/256);
par_getGlobalColor(db, "scrollface", &c);
scroll_face = fl_color_cube( ((c>>16) & 0xFF)*FL_NUM_RED/256,
((c>>8) & 0xFF)*FL_NUM_GREEN/256,(c & 0xFF)*FL_NUM_BLUE/256);
// color(NxApp::Instance()->getGlobalColor(SCROLL_TRAY));
color(scroll_tray);
// selection_color(NxApp::Instance()->getGlobalColor(SCROLL_FACE));
selection_color(scroll_face);
box(FL_SHADOW_BOX);
align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT);
value(0);
} // end of NxSlider::NxSlider()
void NxSlider::draw() {
if (damage()&FL_DAMAGE_ALL) draw_box();
draw(x()+Fl::box_dx(box()),
y()+Fl::box_dy(box()),
w()-Fl::box_dw(box()),
h()-Fl::box_dh(box()));
}
void NxSlider::slider_size(double v) {
if (v < 0) v = 0;
if (v > 1) v = 1;
if (slider_size_ != float(v)) {
slider_size_ = float(v);
damage(FL_DAMAGE_EXPOSE);
}
}
void NxSlider::bounds(double a, double b) {
if (minimum() != a || maximum() != b) {
Fl_Valuator::bounds(a, b);
damage(FL_DAMAGE_EXPOSE);
}
}
int NxSlider::scrollvalue(int p, int w, int t, int l) {
// p = position, first line displayed
// w = window, number of lines displayed
// t = top, number of first line
// l = length, total number of lines
step(1, 1);
if (p+w > t+l) l = p+w-t;
slider_size(w >= l ? 1.0 : double(w)/double(l));
#ifdef PDA
if( slider_size() < slider_size_min_ ) {
slider_size( slider_size_min_ ) ;
}
#endif
bounds(t, l-w+t);
return value(p);
}
void NxSlider::draw_bg(int x, int y, int w, int h) {
if (!(damage()&FL_DAMAGE_ALL)) { // not a complete redraw
fl_color(color());
fl_rectf(x+1,y,w-2,h);
}
Fl_Color black = active_r() ? FL_BLACK : FL_INACTIVE_COLOR;
if (type() == FL_VERT_NICE_SLIDER) {
draw_box(FL_THIN_DOWN_BOX, x+w/2-2, y, 4, h, black);
} else if (type() == FL_HOR_NICE_SLIDER) {
draw_box(FL_THIN_DOWN_BOX, x, y+h/2-2, w, 4, black);
}
}
void NxSlider::draw(int x, int y, int w, int h)
{
double val;
if (minimum() == maximum())
val = 0.5;
else {
val = (value()-minimum())/(maximum()-minimum());
if (val > 1.0) val = 1.0;
else if (val < 0.0) val = 0.0;
}
int W = (horizontal() ? w : h);
int X, S;
if (type()==FL_HOR_FILL_SLIDER || type() == FL_VERT_FILL_SLIDER) {
S = int(val*W+.5);
if (minimum()>maximum()) {S = W-S; X = W-S;}
else X = 0;
} else {
S = int(slider_size()*W+.5);
int T = (horizontal() ? h : w)/2+1;
if (type()==FL_VERT_NICE_SLIDER || type()==FL_HOR_NICE_SLIDER) T += 4;
if (S < T) S = T;
X = int(val*(W-S)+.5);
}
int xsl, ysl, wsl, hsl;
if (horizontal()) {
xsl = x+X;
wsl = S;
ysl = y;
hsl = h;
} else {
ysl = y+X;
hsl = S;
xsl = x;
wsl = w;
}
draw_bg(x,y,w,h);
/*
if (damage()&FL_DAMAGE_ALL) { // complete redraw
draw_bg(x, y, w, h);
} else { // partial redraw, clip off new position of slider
// for moving scrollbar down
if (X > 0) {
if (horizontal())
fl_clip(x, ysl, X, hsl);
else {
fl_clip(xsl, y, wsl, X+3);
}
draw_bg(x, y, w, h);
fl_pop_clip();
}
// for moving scrollbar up
if (X+S < W) {
if (horizontal())
fl_clip(xsl+wsl, ysl, x+w-xsl-wsl, hsl);
else {
fl_clip(xsl, ysl+hsl+10, wsl, y+h-ysl-hsl);
}
draw_bg(x, y, w, h);
fl_pop_clip();
}
}
*/
Fl_Boxtype box1 = slider();
if (!box1) {box1 = (Fl_Boxtype)(box()&-2); if (!box1) box1 = FL_UP_BOX;}
if (type() == FL_VERT_NICE_SLIDER) {
draw_box(box1, xsl, ysl, wsl, hsl, FL_GRAY);
int d = (hsl-4)/2;
draw_box(FL_THIN_DOWN_BOX, xsl+2, ysl+d, wsl-4, hsl-2*d,selection_color());
} else if (type() == FL_HOR_NICE_SLIDER) {
draw_box(box1, xsl, ysl, wsl, hsl, FL_GRAY);
int d = (wsl-4)/2;
draw_box(FL_THIN_DOWN_BOX, xsl+d, ysl+2, wsl-2*d, hsl-4,selection_color());
} else {// draw the slider box
Fl_Color col = selection_color();
if ( horizontal()) {
slider_ver_lines(xsl, ysl, wsl, hsl, W, col) ;
} else {
slider_hor_lines(xsl, ysl, wsl, hsl, W, col);
}
}
draw_label(xsl, ysl, wsl, hsl);
}
void NxSlider::slider_ver_lines(int x, int y, int w, int h, int W, Fl_Color c)
{
int cx = x+w/2 ;
int cy = y+h/2 ;
fl_color(FL_BLACK);
if ( type() != FL_HORIZONTAL ) {
draw_box(FL_BORDER_BOX, x, y, w, h, c);
}
else {
if( w > 0 && h > 0 ) {
if ( w < 17 ) {
w = 17;
slider_size(double(w)/double(W));
slider_size_min_ = slider_size();
}
fl_color(c);
fl_rectf(x+3, y+2, w-6, h-4);
// draw left rounded border
fl_line(x+2, y+3, x+2, y+h-4);
// draw right rounded border
fl_line(x+w-3, y+3, x+w-3, y+h-4);
//draw_box(FL_BORDER_BOX, x, y, w, h, c );
//fl_color(FL_BLACK);
fl_color(FL_WHITE);
cx = x+w/2 ;
fl_line(cx, cy-h/2+3, cx, cy+h/2-4);
fl_line(cx-3, cy-h/2+3, cx-3, cy+h/2-4);
fl_line(cx+3, cy-h/2+3, cx+3, cy+h/2-4);
}
}
}
void NxSlider::slider_hor_lines(int x, int y, int w, int h, int W, Fl_Color c)
{
int cx = x+w/2;
int cy = y+h/2;
fl_color(FL_BLACK);
if( type() != FL_VERTICAL ) {
draw_box(FL_BORDER_BOX, x, y, w, h, c);
} else {
if ( w > 0 && h > 0 ) {
if ( h < 17 ) {
h = 17;
slider_size(double(h)/double(W));
slider_size_min_ = slider_size();
}
fl_color(c);
fl_rectf(x+3, y+3, w-6, h-6);
// draw top rounded border
fl_line(x+4, y+2, x+w-5, y+2);
// draw bottom rounded border
fl_line(x+4,y+h-3, x + w - 5, y+h-3);
// fl_color(NxApp::Instance()->getGlobalColor(SCROLL_TRAY));
fl_color(scroll_tray);
cy = y+h/2;
fl_line( cx+w/2-6, cy, cx-w/2+5, cy );
fl_line( cx+w/2-6, cy-3, cx-w/2+5, cy-3 );
fl_line( cx+w/2-6, cy+3, cx-w/2+5, cy+3 );
}
}
}
int NxSlider::handle(int event, int x, int y, int w, int h) {
switch (event) {
case FL_PUSH:
if (!Fl::event_inside(x, y, w, h)) return 0;
handle_push();
case FL_DRAG: {
int W = (horizontal() ? w : h);
//int H = (horizontal() ? h : w);
int mx = (horizontal() ? Fl::event_x()-x : Fl::event_y()-y);
int S = int(slider_size_*W+.5);
int X;
static int offcenter;
if (type() == FL_HOR_FILL_SLIDER || type() == FL_VERT_FILL_SLIDER) {
double val = (value()-minimum())/(maximum()-minimum());
if (val >= 1.0) X = W;
else if (val <= 0.0) X = 0;
else X = int(val*W+.5);
if (event == FL_PUSH) {
offcenter = mx-X;
if (offcenter < -S/2) offcenter = 0;
else if (offcenter > S/2) offcenter = 0;
else return 1;
}
S = 0;
} else {
double val = (value()-minimum())/(maximum()-minimum());
if (val >= 1.0) X = W-S;
else if (val <= 0.0) X = 0;
else X = int(val*(W-S)+.5);
if (event == FL_PUSH) {
offcenter = mx-X;
if (offcenter < 0) offcenter = 0;
else if (offcenter > S) offcenter = S;
else return 1;
}
}
X = mx-offcenter;
double v;
TRY_AGAIN:
if (X < 0) {
X = 0;
offcenter = mx; if (offcenter < 0) offcenter = 0;
} else if (X > (W-S)) {
X = W-S;
offcenter = mx-X; if (offcenter > S) offcenter = S;
}
v = round(X*(maximum()-minimum())/(W-S) + minimum());
// make sure a click outside the sliderbar moves it:
if (event == FL_PUSH && v == value()) {
offcenter = S/2;
event = FL_DRAG;
goto TRY_AGAIN;
}
handle_drag(clamp(v));
} return 1;
case FL_RELEASE:
handle_release();
return 1;
default:
return 0;
}
}
int NxSlider::handle(int event) {
return handle(event,
x()+Fl::box_dx(box()),
y()+Fl::box_dy(box()),
w()-Fl::box_dw(box()),
h()-Fl::box_dh(box()));
}
--- NEW FILE: fltk-qbase.h ---
#ifndef __FLTK_QBASE_H
#define __FLTK_QBASE_H
#include <stdio.h>
#include <stdarg.h>
#include "qstring.h"
#include "qstrlist.h"
#include "qevent.h"
#include "qlist.h"
#include "qarray.h"
#include "qbuffer.h"
#include "qregion.h"
#include "qcolor.h"
#include "qiodevice.h"
#include "qobjectdefs.h"
#include "qobject.h"
#include "qmetaobject.h"
#include "qconnection.h"
#ifndef _NANOX
#include <X11/X.h>
#include <X11/Xlib.h>
#else
typedef unsigned long Window;
typedef unsigned long Display;
typedef unsigned long XEvent;
extern unsigned long KeyPress;
bool XCheckTypedEvent( Display *, unsigned long ,
XEvent * );
#endif
#include "fltk-qdefs.h"
const uint WCursorSet = 0x00100000; // misc widget flags
const uint WDestructiveClose = 0x00200000;
const uint WPaintDesktop = 0x00400000;
const uint WPaintUnclipped = 0x00800000;
const uint WPaintClever = 0x01000000;
const uint WConfigPending = 0x02000000;
const uint WResizeNoErase = 0x04000000;
const uint WRecreated = 0x08000000;
const uint WExportFontMetrics = 0x10000000;
const uint WExportFontInfo = 0x20000000;
const uint WFocusSet = 0x40000000; // not used any more
const uint WState_TabToFocus = 0x80000000;
typedef int WFlags;
#define debug printf
#define fatal printf
#define emit
#define stricmp strcasecmp
#define strnicmp strncasecmp
inline void warning(const char * format,...)
{
va_list vl;
va_start(vl,format);
vprintf(format,vl);
va_end(vl);
}
inline Display * qt_xdisplay() { return 0; }
#endif
--- NEW FILE: qcolor.h ---
#ifndef __QCOLOR_H
#define __QCOLOR_H
#include "qstring.h"
class QColor
{
protected:
int m_nRed;
int m_nGreen;
int m_nBlue;
bool m_bSet;
public:
QColor() { m_nRed = 255; m_nGreen = 64; m_nBlue = 192; m_bSet = false; }
QColor(const QColor & c)
{
m_nRed = c.red(); m_nGreen = c.green(); m_nBlue = c.blue();
m_bSet = c.isValid();
}
QColor(int red, int green, int blue)
{
m_nRed = red; m_nGreen = green; m_nBlue = blue;
m_bSet = true;
}
const int red() const { return m_nRed; }
const int green() const { return m_nGreen; }
const int blue() const { return m_nBlue; }
void setNamedColor(const QString & name);
bool isValid() const { return m_bSet; }
};
extern const QColor color0;
extern const QColor color1;
extern const QColor black;
extern const QColor white;
extern const QColor darkGray;
extern const QColor gray;
extern const QColor lightGray;
extern const QColor red;
extern const QColor green;
extern const QColor blue;
extern const QColor cyan;
extern const QColor magenta;
extern const QColor yellow;
extern const QColor darkRed;
extern const QColor darkGreen;
extern const QColor darkBlue;
extern const QColor darkCyan;
extern const QColor darkMagenta;
extern const QColor darkYellow;
class QColorGroup
{
protected:
QColor m_Light;
QColor m_Dark;
QColor m_Mid;
QColor m_Text;
QColor m_Foreground;
public:
QColorGroup() {
m_Text = black;
m_Foreground = black;
m_Dark = darkGray;
m_Light = lightGray;
m_Mid = gray;
}
QColorGroup ( const QColor & foreground, const QColor & button,
const QColor & light, const QColor & dark,
const QColor & mid, const QColor & text,
const QColor & base )
{
m_Text = text;
m_Foreground = foreground;
m_Dark = dark;
m_Light = light;
m_Mid = mid;
}
const QColor & foreground() const { return m_Foreground; }
const QColor & light() const { return m_Light; }
const QColor & dark() const { return m_Dark; }
const QColor & mid() const { return m_Mid; }
const QColor & text() const { return m_Text; }
};
#endif
--- NEW FILE: qlineedit.moc ---
/****************************************************************************
** QLineEdit meta object code from reading C++ file 'qlineedit.h'
**
** Created: Tue Nov 14 10:25:10 2000
** by: The Qt Meta Object Compiler ($Revision: 1.1 $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#if !defined(Q_MOC_OUTPUT_REVISION)
#define Q_MOC_OUTPUT_REVISION 2
#elif Q_MOC_OUTPUT_REVISION != 2
#error "Moc format conflict - please regenerate all moc files"
#endif
#include "qlineedit.h"
#include <qmetaobject.h>
const char *QLineEdit::className() const
{
return "QLineEdit";
}
QMetaObject *QLineEdit::metaObj = 0;
#if QT_VERSION >= 200
static QMetaObjectInit init_QLineEdit(&QLineEdit::staticMetaObject);
#endif
void QLineEdit::initMetaObject()
{
if ( metaObj )
return;
if ( strcmp(QWidget::className(), "QWidget") != 0 )
badSuperclassWarning("QLineEdit","QWidget");
#if QT_VERSION >= 200
staticMetaObject();
}
void QLineEdit::staticMetaObject()
{
if ( metaObj )
return;
QWidget::staticMetaObject();
#else
QWidget::initMetaObject();
#endif
typedef void(QLineEdit::*m2_t0)(const char*);
typedef void(QLineEdit::*m2_t1)();
m2_t0 v2_0 = &QLineEdit::textChanged;
m2_t1 v2_1 = &QLineEdit::returnPressed;
QMetaData *signal_tbl = new QMetaData[2];
signal_tbl[0].name = "textChanged(const char*)";
signal_tbl[1].name = "returnPressed()";
signal_tbl[0].ptr = *((QMember*)&v2_0);
signal_tbl[1].ptr = *((QMember*)&v2_1);
metaObj = new QMetaObject( "QLineEdit", "QWidget",
0, 0,
signal_tbl, 2 );
}
// SIGNAL textChanged
void QLineEdit::textChanged( const char* t0 )
{
activate_signal( "textChanged(const char*)", t0 );
}
// SIGNAL returnPressed
void QLineEdit::returnPressed()
{
activate_signal( "returnPressed()" );
}
--- NEW FILE: nxslider.h ---
#ifndef NXSLIDER_INCLUDED
#define NXSLIDER_INCLUDED 1
#include <FL/Fl.H>
#include <FL/Fl_Slider.H>
#include <FL/fl_draw.H>
#include <FL/Fl_Valuator.H>
#include <par.h>
class NxSlider : public Fl_Valuator
{
float slider_size_;
float slider_size_min_;
uchar slider_;
FL_EXPORT void _NxSlider();
FL_EXPORT void draw_bg(int, int, int, int);
protected:
int handle(int);
Fl_Color scroll_tray;
Fl_Color scroll_face;
public:
void slider_hor_lines(int x, int y, int w, int h, int W, Fl_Color c);
void slider_ver_lines(int x, int y, int w, int h, int W, Fl_Color c);
int scrollvalue(int windowtop,int windowsize,int first,int totalsize);
NxSlider(int x, int y, int w, int h, const char *l=0);
void draw(int x, int y, int w, int h);
void draw();
FL_EXPORT void bounds(double a, double b);
float slider_size() const {return slider_size_;}
FL_EXPORT void slider_size(double v);
Fl_Boxtype slider() const {return (Fl_Boxtype)slider_;}
void slider(Fl_Boxtype c) {slider_ = c;}
FL_EXPORT int handle(int, int, int, int, int);
}; // end of NxSlider::NxSlider()
#endif // NXSLIDER_INCLUDED
More information about the dslinux-commit
mailing list