libgui/include/gui/GuiDragListener.h

55 lines
1.9 KiB
C
Raw Normal View History

2018-06-21 20:44:58 +02:00
/****************************************************************************
* Copyright (C) 2016 Maschell
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef GUI_DRAG_LISTENER_H_
#define GUI_DRAG_LISTENER_H_
2022-02-05 14:28:08 +01:00
#include <gui/GuiButton.h>
2018-06-21 20:44:58 +02:00
#include <gui/GuiController.h>
2022-02-05 14:28:08 +01:00
#include <gui/GuiElement.h>
2018-06-21 20:44:58 +02:00
#include <gui/GuiTrigger.h>
class GuiDragListener : public GuiElement {
public:
//!Constructor
//!\param w Width
//!\param h Height
2020-08-13 12:38:07 +02:00
GuiDragListener(float w, float h);
2018-06-21 20:44:58 +02:00
//!Destructor
virtual ~GuiDragListener();
void setState(int32_t i, int32_t c);
//!Set a new GuiTrigger for the element
//!\param i Index of trigger array to set
//!\param t Pointer to GuiTrigger
2020-08-13 12:38:07 +02:00
void setTrigger(GuiTrigger *t, int32_t idx = -1);
2018-06-21 20:44:58 +02:00
//!Constantly called to allow the GuiDragListener to respond to updated input data
//!\param t Pointer to a GuiTrigger, containing the current input data from PAD/WPAD
2020-08-13 12:38:07 +02:00
void update(GuiController *c);
2018-06-21 20:44:58 +02:00
2020-08-13 12:38:07 +02:00
sigslot::signal5<GuiDragListener *, const GuiController *, GuiTrigger *, int32_t, int32_t> dragged;
2022-02-05 14:28:08 +01:00
2018-06-21 20:44:58 +02:00
protected:
static const int32_t iMaxGuiTriggers = 10;
2020-08-13 12:38:07 +02:00
GuiTrigger *trigger[iMaxGuiTriggers]; //!< GuiTriggers (input actions) that this element responds to
2018-06-21 20:44:58 +02:00
};
#endif