| 1 | // MouseCursor.hxx - abstract inteface for mouse cursor control |
| 2 | |
| 3 | // Copyright (C) 2013 James Turner <[email protected]> |
| 4 | // |
| 5 | // This program is free software; you can redistribute it and/or |
| 6 | // modify it under the terms of the GNU General Public License as |
| 7 | // published by the Free Software Foundation; either version 2 of the |
| 8 | // License, or (at your option) any later version. |
| 9 | // |
| 10 | // This program is distributed in the hope that it will be useful, but |
| 11 | // WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | // General Public License for more details. |
| 14 | // |
| 15 | // You should have received a copy of the GNU General Public License |
| 16 | // along with this program; if not, write to the Free Software |
| 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | // |
| 19 | |
| 20 | |
| 21 | #ifndef FG_GUI_MOUSE_CURSOR_HXX |
| 22 | #define FG_GUI_MOUSE_CURSOR_HXX 1 |
| 23 | |
| 24 | class SGPropertyNode; |
| 25 | |
| 26 | class FGMouseCursor |
| 27 | { |
| 28 | public: |
| 29 | static FGMouseCursor* instance(); |
| 30 | |
| 31 | virtual void setAutoHideTimeMsec(unsigned int aMsec); |
| 32 | |
| 33 | enum Cursor { |
| 34 | CURSOR_NONE = 0, |
| 35 | CURSOR_ARROW, |
| 36 | CURSOR_HAND, ///< the browser 'link' cursor |
| 37 | CURSOR_CLOSED_HAND, |
| 38 | CURSOR_CROSSHAIR, |
| 39 | CURSOR_IBEAM, ///< for editing text |
| 40 | CURSOR_IN_OUT, ///< arrow pointing into / out of the screen |
| 41 | CURSOR_LEFT_RIGHT, |
| 42 | CURSOR_UP_DOWN, |
| 43 | CURSOR_LEFT_SIDE, |
| 44 | CURSOR_RIGHT_SIDE, |
| 45 | CURSOR_TOP_SIDE, |
| 46 | CURSOR_BOTTOM_SIDE, |
| 47 | CURSOR_TOP_LEFT, |
| 48 | CURSOR_TOP_RIGHT, |
| 49 | CURSOR_BOTTOM_LEFT, |
| 50 | CURSOR_BOTTOM_RIGHT, |
| 51 | CURSOR_SPIN_CW, |
| 52 | CURSOR_SPIN_CCW, |
| 53 | CURSOR_WAIT |
| 54 | }; |
| 55 | |
| 56 | virtual void setCursor(Cursor aCursor) = 0; |
| 57 | |
| 58 | virtual void setCursorVisible(bool aVis) = 0; |
| 59 | |
| 60 | virtual void hideCursorUntilMouseMove() = 0; |
| 61 | |
| 62 | virtual void mouseMoved() = 0; |
| 63 | |
| 64 | static Cursor cursorFromString(const char* str); |
| 65 | |
| 66 | virtual Cursor getCursor() const; |
| 67 | |
| 68 | protected: |
| 69 | FGMouseCursor(); |
| 70 | |
| 71 | bool setCursorCommand(const SGPropertyNode* arg, SGPropertyNode*); |
| 72 | |
| 73 | unsigned int mAutoHideTimeMsec; |
| 74 | |
| 75 | Cursor m_currentCursor = CURSOR_ARROW; |
| 76 | }; |
| 77 | |
| 78 | #endif // FG_GUI_MOUSE_CURSOR_HXX |