Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

dynamicSlider.h

Go to the documentation of this file.
00001 //==============================================
00002 //  copyright            : (C) 2003-2005 by Will Stokes
00003 //==============================================
00004 //  This program is free software; you can redistribute it
00005 //  and/or modify it under the terms of the GNU General
00006 //  Public License as published by the Free Software
00007 //  Foundation; either version 2 of the License, or
00008 //  (at your option) any later version.
00009 //==============================================
00010 
00011 #ifndef GUI_DYNAMICSLIDER_H
00012 #define GUI_DYNAMICSLIDER_H
00013 
00014 #include <qslider.h>
00015 #include <qlabel.h>
00016 #include <qpoint.h>
00017 
00018 class SliderToolTip;
00019 //==========================================
00021 class DynamicSlider : public QSlider
00022 {
00023 Q_OBJECT
00024 public:
00025   DynamicSlider( Orientation orientation, QWidget* parent, const char* name=0 );
00026   ~DynamicSlider();
00027 
00029   void setZeroString( QString val );
00030   
00032   void setPrefix( QString val );
00033 
00035   void setPrefixes( QString prefix1, QString prefix2 );
00036 
00038   void setSuffix( QString val );
00039   
00041   void setSuffixes( QString suffix1, QString suffix2 );
00042  
00043   //used by the tooltip class to determine the current mouse position
00044   QPoint getMousePos();
00045 
00046 protected:
00047   //cache and announce to the tooltip class that the mouse has moved
00048   void mouseMoveEvent(QMouseEvent* e);
00049   
00052   virtual QString mapValToString();
00053 
00054 private:
00055   QString zeroString;
00056     
00057   QString prefix1, prefix2;
00058   QString suffix1, suffix2;
00059   
00060   SliderToolTip* tooltip;
00061   QPoint cachedMousePos;
00062 
00063 signals:
00064   void mouseHasMoved();
00065 
00066 private slots:
00067   void updateTooltipLabel();
00068 };
00069 //==========================================
00071 class SliderToolTip : public QLabel
00072 {
00073 Q_OBJECT
00074 
00075 public:
00076   SliderToolTip( QWidget* parent, DynamicSlider* slider);
00077 
00078 private:
00079   DynamicSlider* slider;  
00080   
00081 private slots:
00082   void showTooltip();
00083   void update();
00084   void hideTooltip();
00085 };
00086 //==========================================
00087 
00088 #endif //GUI_DYNAMICSLIDER_H

Generated on Sat Apr 2 05:44:04 2005 for AlbumShaper by  doxygen 1.3.9.1