| Home · All Classes · Main Classes · Deprecated |
00001 /*************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (directui@nokia.com) 00006 ** 00007 ** This file is part of libmeegotouch. 00008 ** 00009 ** If you have questions regarding the use of this file, please contact 00010 ** Nokia at directui@nokia.com. 00011 ** 00012 ** This library is free software; you can redistribute it and/or 00013 ** modify it under the terms of the GNU Lesser General Public 00014 ** License version 2.1 as published by the Free Software Foundation 00015 ** and appearing in the file LICENSE.LGPL included in the packaging 00016 ** of this file. 00017 ** 00018 ****************************************************************************/ 00019 00020 #include "mseekbar.h" 00021 #include "mslider_p.h" 00022 #include "mtheme.h" 00023 00024 #include "mwidgetcreator.h" 00025 M_REGISTER_WIDGET(MSeekBar) 00026 00027 MSeekBar::MSeekBar(QGraphicsItem *parent, MSeekBarModel *model) : 00028 MSlider(new MSliderPrivate, model == NULL ? new MSeekBarModel : model, parent) 00029 { 00030 } 00031 00032 // Sets the minimum of the active area. Does not have to depend on actual range. 00033 void MSeekBar::setLoadedContentMinimum(int minimum) 00034 { 00035 int mMinimum = model()->loadedContentMin(); 00036 int mMaximum = model()->loadedContentMax(); 00037 00038 // the maximum will be at least the minimum 00039 if (minimum > mMaximum) { 00040 mMaximum = minimum; 00041 model()->setLoadedContentMax(mMaximum); 00042 } 00043 00044 if (minimum != mMinimum) { 00045 mMinimum = minimum; 00046 model()->setLoadedContentMin(mMinimum); 00047 } 00048 00049 if ((model()->value() < model()->loadedContentMin()) || 00050 (model()->value() > model()->loadedContentMax())) 00051 emit outOfLoadedContentRange(); 00052 } 00053 00054 // Sets the maximum of the active area. Does not have to depend on actual range. 00055 void MSeekBar::setLoadedContentMaximum(int maximum) 00056 { 00057 int mMinimum = model()->loadedContentMin(); 00058 int mMaximum = model()->loadedContentMax(); 00059 00060 // the minimum will be at most the minimum 00061 if (maximum < mMinimum) { 00062 mMinimum = maximum; 00063 model()->setLoadedContentMin(mMinimum); 00064 } 00065 00066 if (maximum != mMaximum) { 00067 mMaximum = maximum; 00068 model()->setLoadedContentMax(mMaximum); 00069 } 00070 00071 if ((model()->value() < model()->loadedContentMin()) || 00072 (model()->value() > model()->loadedContentMax())) 00073 emit outOfLoadedContentRange(); 00074 } 00075 00076 void MSeekBar::setLoadedContentRange(int minimum, int maximum) 00077 { 00078 setLoadedContentMaximum(maximum); 00079 // If maximum < minimum, both will be set to minimum 00080 setLoadedContentMinimum(minimum); 00081 00082 if ((model()->value() < model()->loadedContentMin()) || 00083 (model()->value() > model()->loadedContentMax())) 00084 emit outOfLoadedContentRange(); 00085 } 00086 00087 void MSeekBar::setValue(int value) 00088 { 00089 MSlider::setValue(value); 00090 00091 if ((value < model()->loadedContentMin()) || 00092 (value > model()->loadedContentMax())) 00093 emit outOfLoadedContentRange(); 00094 } 00095 00096 int MSeekBar::loadedContentMinimum() const 00097 { 00098 return model()->loadedContentMin(); 00099 } 00100 00101 int MSeekBar::loadedContentMaximum() const 00102 { 00103 return model()->loadedContentMax(); 00104 }
| Copyright © 2010 Nokia Corporation | Generated on Thu Nov 4 2010 18:14:21 (PDT) Doxygen 1.7.1 |
MeeGo Touch |