krita

kis_label_cursor_pos.cc

00001 /*
00002  *  Copyright (c) 2003 Patrick Julien  <freak@codepimps.org>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.g
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 #include "kis_label_cursor_pos.h"
00019 #include "kis_label_cursor_pos.moc"
00020 
00021 KisLabelCursorPos::KisLabelCursorPos(QWidget *parent, const char *name, WFlags f) : super(parent, name, f)
00022 {
00023     setText("0:0");
00024     m_doUpdates = true;
00025     
00026     //setMinimumSize( 200, parent->height() - 4);
00027 }
00028 
00029 KisLabelCursorPos::~KisLabelCursorPos()
00030 {
00031 }
00032 
00033 void KisLabelCursorPos::updatePos(Q_INT32 xpos, Q_INT32 ypos)
00034 {
00035     if (m_doUpdates) {
00036         QString s;
00037 
00038         s.sprintf("%d:%d", xpos, ypos);
00039         setText(s);
00040     }
00041 }
00042 
00043 void KisLabelCursorPos::enter()
00044 {
00045     m_doUpdates = true;
00046 }
00047 
00048 void KisLabelCursorPos::leave()
00049 {
00050     m_doUpdates = false;
00051     setText(QString::null);
00052 }
00053 
KDE Home | KDE Accessibility Home | Description of Access Keys