VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gxeventhandler.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2017 Graeme Walker
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 // ===
17 ///
18 /// \file gxeventhandler.h
19 ///
20 
21 #ifndef GX_EVENT_HANDLER_H
22 #define GX_EVENT_HANDLER_H
23 
24 #include "gdef.h"
25 #include "gxdef.h"
26 
27 namespace GX
28 {
29  class EventHandler ;
30 }
31 
32 /// \class GX::EventHandler
33 /// An interface for delivering GX::EventLoop events, with do-nothing default method implementations.
34 ///
35 /// One Xlib event can trigger several different callbacks methods at this interface in order to
36 /// resemble other windowing systems.
37 ///
39 {
40 public:
41  virtual ~EventHandler() ;
42  ///< Destructor.
43 
44  virtual bool onIdle() ;
45  ///< Called by GX::Application::run() once the event queue is empty.
46  ///< Returns false when idle work is complete.
47 
48  virtual void onLeftMouseButtonDown( int x , int y , bool shift , bool control ) ;
49  ///< Called for a left-mouse-button-down event.
50 
51  virtual void onLeftMouseButtonUp( int x , int y , bool shift , bool control ) ;
52  ///< Called for a left-mouse-button-up event.
53 
54  virtual void onMouseMove( int x , int y ) ;
55  ///< Called for a mouse-move event.
56 
57  virtual void onExposure( int x , int y , int dx , int dy ) ;
58  ///< Called first for a window-expose event.
59 
60  virtual void onPaint() ;
61  ///< Called second for a window-expose event.
62 
63  virtual void onExpose( ::XExposeEvent & ) ;
64  ///< Called third for a window-expose event.
65 
66  virtual bool onCreate() ;
67  ///< Called first for a window-map event. Returns false to abort
68  ///< window creation.
69 
70  virtual void onShow() ;
71  ///< Called second for a window-map event.
72 
73  virtual void onMap( ::XMapEvent & ) ;
74  ///< Called third for a window-map event.
75 
76  virtual void onKeyPress( ::XKeyEvent & ) ;
77  ///< Called for a key-press event.
78 
79  virtual void onKeyRelease( ::XKeyEvent & ) ;
80  ///< Called for a key-release event.
81 
82  virtual void onUser() ;
83  ///< Called for a client-message event.
84 
85 private:
86  void operator=( const EventHandler & ) ;
87 } ;
88 
89 #endif
virtual void onLeftMouseButtonUp(int x, int y, bool shift, bool control)
Called for a left-mouse-button-up event.
virtual ~EventHandler()
Destructor.
virtual void onPaint()
Called second for a window-expose event.
virtual void onExposure(int x, int y, int dx, int dy)
Called first for a window-expose event.
virtual bool onCreate()
Called first for a window-map event.
virtual void onKeyRelease(::XKeyEvent &)
Called for a key-release event.
An interface for delivering GX::EventLoop events, with do-nothing default method implementations.
virtual bool onIdle()
Called by GX::Application::run() once the event queue is empty.
virtual void onLeftMouseButtonDown(int x, int y, bool shift, bool control)
Called for a left-mouse-button-down event.
virtual void onMouseMove(int x, int y)
Called for a mouse-move event.
virtual void onExpose(::XExposeEvent &)
Called third for a window-expose event.
virtual void onUser()
Called for a client-message event.
virtual void onShow()
Called second for a window-map event.
virtual void onMap(::XMapEvent &)
Called third for a window-map event.
virtual void onKeyPress(::XKeyEvent &)
Called for a key-press event.