MyGUI: MyGUI_ControllerRepeatClick.cpp Source File

MyGUI 3.2.2

MyGUI_ControllerRepeatClick.cpp
Go to the documentation of this file.
1 /*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7 #include "MyGUI_Precompiled.h"
8 #include "MyGUI_ControllerRepeatClick.h"
9
10 namespace MyGUI
11 {
12 ControllerRepeatClick::ControllerRepeatClick() :
13 mInit(0.5f),
14 mStep(0.1f),
15 mTimeLeft(0)
16 {
17 }
18
19 ControllerRepeatClick::~ControllerRepeatClick()
20 {
21 }
22
23 bool ControllerRepeatClick::addTime(MyGUI::Widget* _widget, float _time)
24 {
25 if(mTimeLeft == 0)
26 mTimeLeft = mInit;
27
28 if (mStep <= 0)
29 return true;
30
31 mTimeLeft -= _time;
32 while (mTimeLeft <= 0)
33 {
34 mTimeLeft += mStep;
35 eventRepeatClick(_widget, this);
36 }
37 return true;
38 }
39
40 void ControllerRepeatClick::setRepeat(float init, float step)
41 {
42 mInit = init;
43 mStep = step;
44 }
45
46 void ControllerRepeatClick::setProperty(const std::string& _key, const std::string& _value)
47 {
48 }
49
50 void ControllerRepeatClick::prepareItem(MyGUI::Widget* _widget)
51 {
52 }
53 }
54
MyGUI::ControllerRepeatClick::~ControllerRepeatClick
virtual ~ControllerRepeatClick()
Definition: MyGUI_ControllerRepeatClick.cpp:19
MyGUI::ControllerRepeatClick::setProperty
virtual void setProperty(const std::string &_key, const std::string &_value)
Definition: MyGUI_ControllerRepeatClick.cpp:46
MyGUI::ControllerRepeatClick::addTime
virtual bool addTime(Widget *_widget, float _time)
Definition: MyGUI_ControllerRepeatClick.cpp:23
MyGUI::Widget
Widget properties. Skin childs. Widget widget description should be here.
Definition: MyGUI_Widget.h:29
MyGUI_ControllerRepeatClick.h
MyGUI::ControllerRepeatClick::ControllerRepeatClick
ControllerRepeatClick()
Definition: MyGUI_ControllerRepeatClick.cpp:12
MyGUI_Precompiled.h
MyGUI::ControllerRepeatClick::setRepeat
void setRepeat(float init, float step)
Definition: MyGUI_ControllerRepeatClick.cpp:40
MyGUI::ControllerRepeatClick::eventRepeatClick
EventHandle_RepeatClick eventRepeatClick
Definition: MyGUI_ControllerRepeatClick.h:45
MyGUI
Definition: MyGUI_ActionController.h:14
MyGUI::ControllerRepeatClick::prepareItem
virtual void prepareItem(Widget *_widget)
Definition: MyGUI_ControllerRepeatClick.cpp:50