MyGUI  3.2.1
MyGUI_ControllerRepeatClick.cpp
Go to the documentation of this file.
00001 /*
00002  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
00003  * Distributed under the MIT License
00004  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
00005  */
00006 
00007 #include "MyGUI_Precompiled.h"
00008 #include "MyGUI_ControllerRepeatClick.h"
00009 
00010 namespace MyGUI
00011 {
00012     ControllerRepeatClick::ControllerRepeatClick() :
00013         mInit(0.5),
00014         mStep(0.1),
00015         mTimeLeft(0)
00016     {
00017     }
00018 
00019     ControllerRepeatClick::~ControllerRepeatClick()
00020     {
00021     }
00022 
00023     bool ControllerRepeatClick::addTime(MyGUI::Widget* _widget, float _time)
00024     {
00025         if(mTimeLeft == 0)
00026             mTimeLeft = mInit;
00027 
00028         if (mStep <= 0)
00029             return true;
00030 
00031         mTimeLeft -= _time;
00032         while (mTimeLeft <= 0)
00033         {
00034             mTimeLeft += mStep;
00035             eventRepeatClick(_widget, this);
00036         }
00037         return true;
00038     }
00039 
00040     void ControllerRepeatClick::setRepeat(float init, float step)
00041     {
00042         mInit = init;
00043         mStep = step;
00044     }
00045 
00046     void ControllerRepeatClick::setProperty(const std::string& _key, const std::string& _value)
00047     {
00048     }
00049 
00050     void ControllerRepeatClick::prepareItem(MyGUI::Widget* _widget)
00051     {
00052     }
00053 }
00054