ShishGL  1.0
A simple modular cross-platform graphics library
Dialog.hpp
Go to the documentation of this file.
1 /*============================================================================*/
2 #ifndef SHISHGL_DIALOG_HPP
3 #define SHISHGL_DIALOG_HPP
4 /*============================================================================*/
5 #include "Draggable.hpp"
6 /*============================================================================*/
7 namespace Sh {
8 
9  class Dialog : public Draggable {
10  public:
11 
12  explicit Dialog(UIWindow* target)
13  : Draggable(target)
14  { }
15 
16  bool onMouseButton(MouseButtonEvent& event) override {
17 
18  if (event.state() == Mouse::UP) {
19  return Draggable::onMouseButton(event);
20  }
21 
22  for (auto& child : target<UIWindow>()->getChildren()) {
23  if (child->contains(event.where())) {
24  return false;
25  }
26  }
27 
28  return Draggable::onMouseButton(event);
29  }
30 
31  };
32 
33 }
34 /*============================================================================*/
35 #endif //SHISHGL_DIALOG_HPP
36 /*============================================================================*/
Sh::Dialog::onMouseButton
bool onMouseButton(MouseButtonEvent &event) override
Definition: Dialog.hpp:16
Sh::Draggable::onMouseButton
bool onMouseButton(MouseButtonEvent &event) override
Definition: Draggable.cpp:18
Sh::Dialog::Dialog
Dialog(UIWindow *target)
Definition: Dialog.hpp:12
Sh::Draggable
Definition: Draggable.hpp:10
Sh::Dialog
Definition: Dialog.hpp:9
Sh::Behavior::target
SomeWindow * target() const
Definition: Behavior.hpp:17
Sh::MouseButtonEvent::state
Mouse::ButtonState state() const
Definition: MouseEvent.cpp:47
Sh::UIWindow
Definition: UIWindow.hpp:16
Sh
Definition: CoreApplication.hpp:10
Sh::MouseEvent::where
const Vector2< double > & where() const
Definition: MouseEvent.cpp:13
Draggable.hpp
Sh::Mouse::UP
@ UP
Definition: Mouse.hpp:12
Sh::MouseButtonEvent
Definition: MouseEvent.hpp:38