summaryrefslogtreecommitdiff
path: root/inputmethods/handwriting
authorerik <erik>2007-01-10 17:24:23 (UTC)
committer erik <erik>2007-01-10 17:24:23 (UTC)
commite7d3e1d0f3c75979c01ea6373ed3c80d0c986000 (patch) (side-by-side diff)
tree34a6e8aa3de82f07c0531e59f375da216fbfb97a /inputmethods/handwriting
parent51bd5e8d542372ad54898ce642fe9b82b8ba83f3 (diff)
downloadopie-e7d3e1d0f3c75979c01ea6373ed3c80d0c986000.zip
opie-e7d3e1d0f3c75979c01ea6373ed3c80d0c986000.tar.gz
opie-e7d3e1d0f3c75979c01ea6373ed3c80d0c986000.tar.bz2
All of the files in this commit have an inheritance member function
mismatch correction. None are serious, but all would have been improperly mislinked in the inheritance hierarchy if attempted to be used.
Diffstat (limited to 'inputmethods/handwriting') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/handwriting/qimpenwidget.cpp2
-rw-r--r--inputmethods/handwriting/qimpenwidget.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/inputmethods/handwriting/qimpenwidget.cpp b/inputmethods/handwriting/qimpenwidget.cpp
index 8f8f582..7223e1a 100644
--- a/inputmethods/handwriting/qimpenwidget.cpp
+++ b/inputmethods/handwriting/qimpenwidget.cpp
@@ -237,97 +237,97 @@ void QIMPenWidget::timeout()
QPoint off = lastPoint - outputChar->startingPoint();
lastPoint = outputStroke->startingPoint() + off;
} else {
timer->stop();
mode = Waiting;
}
}
} else if ( mode == Waiting ) {
QRect r( dirtyRect );
if ( !r.isNull() ) {
r.moveBy( -2, -2 );
r.setSize( r.size() + QSize( 4, 4 ) );
repaint( r );
}
}
}
/*!
If the point \a p is over one of the character set titles, switch
to the set and return TRUE.
*/
bool QIMPenWidget::selectSet( QPoint p )
{
if ( charSets.count() ) {
CharSetEntryIterator it( charSets );
int spos = 0;
int idx = 0;
for ( ; it.current(); ++it, idx++ ) {
int setWidth = width() * it.current()->stretch / totalStretch;
spos += setWidth;
if ( p.x() < spos ) {
if ( idx != currCharSet ) {
currCharSet = idx;
update( 0, 0, width(), 12 );
emit changeCharSet( currCharSet );
emit changeCharSet( charSets.at(currCharSet)->cs );
}
break;
}
}
}
return FALSE;
}
/*!
Hopefully returns a sensible size.
*/
-QSize QIMPenWidget::sizeHint()
+QSize QIMPenWidget::sizeHint() const
{
return QSize( TITLE_WIDTH * charSets.count(), 75 );
}
void QIMPenWidget::mousePressEvent( QMouseEvent *e )
{
if ( !readOnly && e->button() == LeftButton && mode == Waiting ) {
// if selectSet returns false the click was not over the
// char set selectors.
if ( !selectSet( e->pos() ) ) {
// start of character input
timer->stop();
if ( outputChar ) {
outputChar = 0;
outputStroke = 0;
repaint();
}
mode = Input;
lastPoint = e->pos();
emit beginStroke();
inputStroke = new QIMPenStroke;
strokes.append( inputStroke );
inputStroke->beginInput( e->pos() );
QPainter paint( this );
paint.setBrush( Qt::black );
paint.drawRect( lastPoint.x()-1, lastPoint.y()-1, 2, 2 );
}
}
}
void QIMPenWidget::mouseReleaseEvent( QMouseEvent *e )
{
if ( !readOnly && e->button() == LeftButton && mode == Input ) {
mode = Waiting;
inputStroke->endInput();
if ( charSets.count() )
emit stroke( inputStroke );
inputStroke = 0;
}
}
void QIMPenWidget::mouseMoveEvent( QMouseEvent *e )
{
if ( !readOnly && mode == Input ) {
int dx = QABS( e->pos().x() - lastPoint.x() );
int dy = QABS( e->pos().y() - lastPoint.y() );
if ( dx + dy > 1 ) {
if ( inputStroke->addPoint( e->pos() ) ) {
diff --git a/inputmethods/handwriting/qimpenwidget.h b/inputmethods/handwriting/qimpenwidget.h
index 98d7f5c..d156554 100644
--- a/inputmethods/handwriting/qimpenwidget.h
+++ b/inputmethods/handwriting/qimpenwidget.h
@@ -1,88 +1,88 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qwidget.h>
#include <qlist.h>
#include "qimpenchar.h"
class QIMPenWidget : public QWidget
{
Q_OBJECT
public:
QIMPenWidget( QWidget *parent );
void clear();
void greyStroke();
void setReadOnly( bool r ) { readOnly = r; }
void insertCharSet( QIMPenCharSet *cs, int stretch=1, int pos=-1 );
void removeCharSet( int );
void changeCharSet( QIMPenCharSet *cs, int pos );
void clearCharSets();
void showCharacter( QIMPenChar *, int speed = 10 );
- virtual QSize sizeHint();
+ virtual QSize sizeHint() const;
public slots:
void removeStroke();
signals:
void changeCharSet( QIMPenCharSet *cs );
void changeCharSet( int );
void beginStroke();
void stroke( QIMPenStroke *ch );
protected slots:
void timeout();
protected:
enum Mode { Waiting, Input, Output };
bool selectSet( QPoint );
virtual void mousePressEvent( QMouseEvent *e );
virtual void mouseReleaseEvent( QMouseEvent *e );
virtual void mouseMoveEvent( QMouseEvent *e );
virtual void paintEvent( QPaintEvent *e );
virtual void resizeEvent( QResizeEvent *e );
struct CharSetEntry {
QIMPenCharSet *cs;
int stretch;
};
typedef QList<CharSetEntry> CharSetEntryList;
typedef QListIterator<CharSetEntry> CharSetEntryIterator;
protected:
Mode mode;
bool autoHide;
bool readOnly;
QPoint lastPoint;
unsigned pointIndex;
int strokeIndex;
int currCharSet;
QTimer *timer;
QColor strokeColor;
QRect dirtyRect;
QIMPenChar *outputChar;
QIMPenStroke *outputStroke;
QIMPenStroke *inputStroke;
QIMPenStrokeList strokes;
CharSetEntryList charSets;
int totalStretch;
};