00001 /* 00002 * kmood - a mood indicator 00003 * Copyright (C) 2003 Andreas Baumann 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 * 00019 */ 00020 00021 #ifndef __KMOOD_WIDGET_H__ 00022 #define __KMOOD_WIDGET_H__ 00023 00024 #include "kmood.hh" 00025 00026 // Qt includes 00027 #include <qwidget.h> 00028 #include <qlabel.h> 00029 #include <qimage.h> 00030 00031 // KDE includes 00032 #include <kpopupmenu.h> 00033 00034 class KMood; 00035 00045 class KMoodWidget : public QLabel 00046 { 00047 Q_OBJECT 00048 00049 public: 00050 KMoodWidget( QWidget *parent = 0, const char *name = 0, KMood *mood = 0, bool changeable = false ); 00051 ~KMoodWidget( ); 00052 00053 void setModel( KMood *mood ); 00054 00062 void setAge( int minutesAge ); 00063 00064 protected: 00065 KPopupMenu *m_popup; 00066 00067 virtual void renderEmoticon( ); 00068 virtual void paintEvent( QPaintEvent *e); 00069 virtual void resizeEvent( QResizeEvent *e ); 00070 virtual void mousePressEvent( QMouseEvent *e ); 00071 00072 void addEmotionsToMenu( ); 00073 void adaptMenuTicks( ); 00074 00075 protected slots: 00076 virtual void slotMoodChanged( KMood *mood ); 00077 00078 protected: 00079 KMood *m_mood; 00080 bool m_changeable; 00081 int m_minutesAge; 00082 00083 private: 00084 QImage loadEmoticon( ); 00085 QString mood2filename( KMood *mood ); 00086 }; 00087 00088 #endif 00089
1.2.18