00001 // SuperTux 00002 // Copyright (C) 2006 Matthias Braun <matze@braunis.de> 00003 // 00004 // This program is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 00017 #ifndef HEADER_SUPERTUX_GUI_MOUSECURSOR_HPP 00018 #define HEADER_SUPERTUX_GUI_MOUSECURSOR_HPP 00019 00020 #include <string> 00021 00022 #include "video/surface_ptr.hpp" 00023 00024 #define MC_STATES_NB 3 00025 00026 enum { 00027 MC_NORMAL = 0, 00028 MC_CLICK, 00029 MC_LINK, 00030 MC_HIDE 00031 }; 00032 00033 class DrawingContext; 00034 00036 00040 class MouseCursor 00041 { 00042 public: 00044 00045 MouseCursor(std::string cursor_file); 00046 ~MouseCursor(); 00048 00049 int state(); 00051 00052 void set_state(int nstate); 00054 00055 void set_mid(int x, int y); 00056 00058 void draw(DrawingContext& context); 00059 00061 static MouseCursor* current() 00062 { return current_; }; 00064 static void set_current(MouseCursor* pcursor) 00065 { current_ = pcursor; }; 00066 00067 private: 00068 int mid_x; 00069 int mid_y; 00070 int state_before_click; 00071 int cur_state; 00072 SurfacePtr cursor; 00073 00074 private: 00075 static MouseCursor* current_; 00076 00077 private: 00078 MouseCursor(const MouseCursor&); 00079 MouseCursor& operator=(const MouseCursor&); 00080 }; 00081 00082 #endif /*SUPERTUX_MOUSECURSOR_H*/ 00083 00084 /* EOF */