Popup.h
1 /* Copyright (C) 2017 Marc Boris Duerner
2 
3  This library is free software; you can redistribute it and/or
4  modify it under the terms of the GNU Lesser General Public
5  License as published by the Free Software Foundation; either
6  version 2.1 of the License, or (at your option) any later version.
7 
8  As a special exception, you may use this file as part of a free
9  software library without restriction. Specifically, if other files
10  instantiate templates or use macros or inline functions from this
11  file, or you compile this file and link it with other files to
12  produce an executable, this file does not by itself cause the
13  resulting executable to be covered by the GNU General Public
14  License. This exception does not however invalidate any other
15  reasons why the executable file might be covered by the GNU Library
16  General Public License.
17 
18  This library is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  Lesser General Public License for more details.
22 
23  You should have received a copy of the GNU Lesser General Public
24  License along with this library; if not, write to the Free Software
25  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
26  MA 02110-1301 USA
27 */
28 
29 #ifndef PT_FORMS_POPUP_H
30 #define PT_FORMS_POPUP_H
31 
32 #include <Pt/Forms/Window.h>
33 
34 namespace Pt {
35 
36 namespace Forms {
37 
47 class PT_FORMS_API Popup : public Window
48 {
49  typedef Window Base;
50 
51  public:
54  Popup();
55 
58  virtual ~Popup();
59 
63 
71  void setAnchor(Widget* anchor = 0);
72 
73  protected:
74  virtual void onAttachPeer(Widget& peer);
75 
76  virtual void onDetachPeer(Widget& peer);
77 
78  protected:
79  virtual void onShowEvent(const ShowEvent& ev);
80 
81  virtual void onCloseEvent(const CloseEvent& ev);
82 
83  virtual void onProcessMouseEvent(const MouseEvent& ev);
84 
85  virtual void onProcessTouchEvent(const TouchEvent& ev);
86 
87  private:
88  Widget* _anchor;
89 };
90 
91 } // namespace
92 
93 } // namespace
94 
95 #endif
Core module.
Definition: Allocator.h:33
Touch press, move, or release.
Definition: TouchEvent.h:51
Popup()
Creates a detached borderless popup.
Reports that a widget is closing.
Definition: CloseEvent.h:50
Form presented by a window manager.
Definition: Window.h:99
virtual void onCloseEvent(const CloseEvent &ev)
Hides, detaches, closes, and sends closed().
Common type of every visual Forms object.
Definition: Widget.h:105
void setAnchor(Widget *anchor=0)
Relates this popup to anchor for popup input handling.
virtual void onProcessTouchEvent(const TouchEvent &ev)
Routes event when the window accepts input.
virtual ~Popup()
Destroys the popup.
virtual void onDetachPeer(Widget &peer)
Detaches non-owning peer peer.
Widget that hosts controls on a paint surface.
Definition: View.h:86
Reports that a widget was shown or hidden.
Definition: ShowEvent.h:48
virtual void onProcessMouseEvent(const MouseEvent &ev)
Routes event when the window accepts input.
virtual void onAttachPeer(Widget &peer)
Attaches non-owning peer peer.
virtual void onShowEvent(const ShowEvent &ev)
Processes event and invalidates the window.
Pointer movement or button change.
Definition: MouseEvent.h:134
Widget * anchor()
Returns the anchor widget, or 0 when none is set.
Represents a borderless transient window.
Definition: Popup.h:48