OpenFOAM logo
Open Source CFD Toolkit

GEvent.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2005 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     GEvent
00027 
00028 Description
00029 
00030 
00031 SourceFiles
00032     GEvent.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef GEvent_H
00037 #define GEvent_H
00038 
00039 #include <X11/Xlib.h>
00040 #include <X11/Xutil.h>
00041 
00042 #include "coord2D.H"
00043 #include "word.H"
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 /*---------------------------------------------------------------------------*\
00051                            Class GEvent Declaration
00052 \*---------------------------------------------------------------------------*/
00053 
00054 class GEvent
00055 {
00056 
00057 public:
00058 
00059     enum eventType {NONE, BPRESS, KPRESS};
00060 
00061 
00062 private:
00063 
00064     // Private data
00065 
00066         eventType event_;
00067         bool happening_;
00068 
00069         unsigned int buttonNo_;
00070         unsigned int keyNo_;
00071 
00072         coord2D location_;
00073         word key_;
00074 
00075 
00076 public:
00077 
00078     // Constructors
00079 
00080         //- Construct null
00081         GEvent();
00082 
00083         //- Construct from components
00084         GEvent(XEvent&);
00085 
00086         //- Construct as copy
00087         GEvent(const GEvent&);
00088 
00089 
00090     // Destructor
00091 
00092         ~GEvent();
00093 
00094 
00095     // Member Functions
00096 
00097         // Access
00098 
00099             inline bool didItHappen() const;
00100             inline eventType whatHappened() const;
00101 
00102             inline label whichButton() const;
00103             inline word whichKey() const;
00104 
00105 
00106         // Edit
00107 
00108             void setEvent(XEvent&);    // set the event from an Xevent
00109 
00110 
00111     // Member Operators
00112 
00113         void operator=(const GEvent&);
00114 };
00115 
00116 
00117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00118 
00119 inline bool GEvent::didItHappen() const
00120 {
00121     return happening_;
00122 }
00123 
00124 inline GEvent::eventType GEvent::whatHappened() const
00125 {
00126     return event_;
00127 }
00128 
00129 inline label GEvent::whichButton() const
00130 {
00131     return buttonNo_;
00132 }
00133 
00134 inline word  GEvent::whichKey() const
00135 {
00136     return key_;
00137 }
00138 
00139 
00140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00141 
00142 } // End namespace Foam
00143 
00144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00145 
00146 #endif
00147 
00148 // ************************************************************************* //
For further information go to www.openfoam.org