![]() |
rtVTK
0.6.0
|
00001 00002 /****************************************************************************** 00003 * Copyright (c) 2012, Grove City College 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are 00008 * met: 00009 * 00010 * * Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 00013 * * Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in 00015 * the documentation and/or other materials provided with the 00016 * distribution. 00017 * 00018 * * Neither the name of Grove City College nor the names of its 00019 * contributors may be used to endorse or promote products derived 00020 * from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00025 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00026 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00027 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00028 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00029 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00030 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00031 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00032 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 * 00034 */ 00035 00036 00037 #ifndef Core_uiCore_Mouse_h 00038 #define Core_uiCore_Mouse_h 00039 00040 // This helped solve some definition conflict issue on Linux, I believe. 00041 #ifdef None 00042 # undef None 00043 #endif // None 00044 00045 00046 namespace uiCore 00047 { 00052 struct Mouse 00053 { 00054 enum Button { None=0, Left, Mid, Right, numButtons }; 00055 enum State { Up=0, Down, numStates }; 00056 00061 struct xyCoord 00062 { 00063 xyCoord() : x(0), y(0) {} 00064 xyCoord(int x_, int y_) : x(x_), y(y_) {} 00065 xyCoord operator+(xyCoord rhs) { return xyCoord(x+rhs.x, y+rhs.y); } 00066 xyCoord operator-(xyCoord rhs) { return xyCoord(x-rhs.x, y-rhs.y); } 00067 int x; 00068 int y; 00069 }; // struct xyCoord 00070 00075 struct ButtonState 00076 { 00077 State state; 00078 xyCoord d; 00079 xyCoord p; 00080 }; // struct ButtonState 00081 00086 struct ControlKeyState 00087 { 00088 bool ctrl; 00089 bool alt; 00090 bool shift; 00091 }; // struct ControlKeyState 00092 00093 Mouse(); 00094 00095 void dragBegin(int, int); 00096 void dragEnd(); 00097 00098 void setControlKeys(bool, bool, bool); 00099 void click(Button, State, int, int); 00100 00101 ButtonState states[numButtons]; 00102 Button button; 00103 ControlKeyState keys; 00104 xyCoord c; 00105 }; // struct Mouse 00106 00107 } // namespace uiCore 00108 00109 #endif // Core_uiCore_Mouse_h