MyGUI: MyGUI_ControllerRepeatClick.cpp Source File

MyGUI 3.4.2

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files
- Examples

- File List
- Globals

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
10namespace MyGUI
11{
12 ControllerRepeatClick::ControllerRepeatClick() :
13 mInit(0.5f),
14 mStep(0.1f),
15 mTimeLeft(0)
16 {
17 }
18
19 bool ControllerRepeatClick::addTime(MyGUI::Widget* _widget, float _time)
20 {
21 if(mTimeLeft == 0)
22 mTimeLeft = mInit;
23
24 if (mStep <= 0)
25 return true;
26
27 mTimeLeft -= _time;
28 while (mTimeLeft <= 0)
29 {
30 mTimeLeft += mStep;
31 eventRepeatClick(_widget, this);
32 }
33 return true;
34 }
35
36 void ControllerRepeatClick::setRepeat(float init, float step)
37 {
38 mInit = init;
39 mStep = step;
40 }
41
42 void ControllerRepeatClick::setProperty(const std::string& _key, const std::string& _value)
43 {
44 }
45
46 void ControllerRepeatClick::prepareItem(MyGUI::Widget* _widget)
47 {
48 }
49}
50
MyGUI_ControllerRepeatClick.h
MyGUI_Precompiled.h
MyGUI::ControllerRepeatClick::prepareItem
void prepareItem(Widget *_widget) override
Definition MyGUI_ControllerRepeatClick.cpp:46
MyGUI::ControllerRepeatClick::eventRepeatClick
EventHandle_RepeatClick eventRepeatClick
Definition MyGUI_ControllerRepeatClick.h:44
MyGUI::ControllerRepeatClick::setProperty
void setProperty(const std::string &_key, const std::string &_value) override
Definition MyGUI_ControllerRepeatClick.cpp:42
MyGUI::ControllerRepeatClick::addTime
bool addTime(Widget *_widget, float _time) override
Definition MyGUI_ControllerRepeatClick.cpp:19
MyGUI::ControllerRepeatClick::setRepeat
void setRepeat(float init, float step)
Definition MyGUI_ControllerRepeatClick.cpp:36
MyGUI::ControllerRepeatClick::ControllerRepeatClick
ControllerRepeatClick()
Definition MyGUI_ControllerRepeatClick.cpp:12
MyGUI::Widget
widget description should be here.
Definition MyGUI_Widget.h:37
MyGUI
Definition MyGUI_ActionController.h:15