libAlgAudio  v1.99-440-g08538e5-dirty
The development library for AlgAudio framework.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UIMouseEventsBase.hpp
Go to the documentation of this file.
1 #ifndef UIMOUSEEVENTSBASE_HPP
2 #define UIMOUSEEVENTSBASE_HPP
3 /*
4 This file is part of AlgAudio.
5 
6 AlgAudio, Copyright (C) 2015 CeTA - Audiovisual Technology Center
7 
8 AlgAudio is free software: you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as
10 published by the Free Software Foundation, either version 3 of the
11 License, or (at your option) any later version.
12 
13 AlgAudio is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public License
19 along with AlgAudio. If not, see <http://www.gnu.org/licenses/>.
20 */
21 #include "Utilities.hpp"
22 #include "UI/UIVisibilityBase.hpp"
23 
24 namespace AlgAudio{
25 
27 public:
32  // Returns true, if the press event was captured (performed anything
33  // meaningful), and false in any other case.
34  bool OnMousePress(bool,MouseButton,Point2D);
35  void OnMouseEnter(Point2D);
36  void OnMouseLeave(Point2D);
41  virtual bool CustomMousePress(bool,MouseButton,Point2D) {return true;}
42  virtual void CustomMouseEnter(Point2D) {}
43  virtual void CustomMouseLeave(Point2D) {}
45 
46  virtual void RequestFocus() = 0;
47 
48  void SetFocusable(bool f){focusable = f;}
50 protected:
51  UIMouseEventsBase() {} // Only construcible when inherited
52  bool pressed = false;
53  bool pointed = false;
54  // If a child is focusable, clicking on it will call RequestFocus().
55  bool focusable = true;
56 };
57 
58 } // namespace AlgAudio
59 
60 #endif // UIMOUSEEVENTSBASE_HPP
Point2D last_mouse_pos
Definition: UIMouseEventsBase.hpp:49
virtual bool CustomMousePress(bool, MouseButton, Point2D)
Definition: UIMouseEventsBase.hpp:41
Signal< Point2D > on_motion
Definition: UIMouseEventsBase.hpp:31
Signal< bool > on_pointed
Definition: UIMouseEventsBase.hpp:29
bool OnMousePress(bool, MouseButton, Point2D)
bool pressed
Definition: UIMouseEventsBase.hpp:52
virtual void CustomMouseLeave(Point2D)
Definition: UIMouseEventsBase.hpp:43
Signal on_clicked
Definition: UIMouseEventsBase.hpp:28
Definition: UIVisibilityBase.hpp:23
MouseButton
Definition: Utilities.hpp:190
UIMouseEventsBase()
Definition: UIMouseEventsBase.hpp:51
bool focusable
Definition: UIMouseEventsBase.hpp:55
virtual void CustomMouseEnter(Point2D)
Definition: UIMouseEventsBase.hpp:42
Definition: Utilities.hpp:34
virtual void RequestFocus()=0
Definition: Alertable.hpp:26
Definition: UIMouseEventsBase.hpp:26
virtual void CustomMouseMotion(Point2D, Point2D)
Definition: UIMouseEventsBase.hpp:44
void OnMouseMotion(Point2D, Point2D)
void SetFocusable(bool f)
Definition: UIMouseEventsBase.hpp:48
bool pointed
Definition: UIMouseEventsBase.hpp:53
Definition: Signal.hpp:145
Signal< bool > on_pressed
Definition: UIMouseEventsBase.hpp:30