00001 /* 00002 * The information in this file is 00003 * Copyright(c) 2007 Ball Aerospace & Technologies Corporation 00004 * and is subject to the terms and conditions of the 00005 * GNU Lesser General Public License Version 2.1 00006 * The license text is available from 00007 * http://www.gnu.org/licenses/lgpl.html 00008 */ 00009 00010 00011 00012 #ifndef MOUSEMODE_H 00013 #define MOUSEMODE_H 00014 00015 #include <string> 00016 00017 class QAction; 00018 00019 /** 00020 * Provides custom handling of mouse events in a view. 00021 * 00022 * A mouse mode is a special mode used in a view to process mouse events. The 00023 * mouse mode consists of a name, a cursor, a cursor mask, and a cursor hot spot. 00024 * All values are specified when the mouse mode is created and this class 00025 * provides access to the mouse mode object itself and its name. 00026 * 00027 * A mouse mode also contains an optional Qt action that is added to the main 00028 * mouse mode action group when the mode is added to a view. This allows the 00029 * action to be automatically toggled off when another mouse mode action in the 00030 * group is activated and all other actions will be toggled off when this mouse 00031 * mode is activated. 00032 * 00033 * @see DesktopServices::createMouseMode(), View::setMouseMode() 00034 */ 00035 class MouseMode 00036 { 00037 public: 00038 /** 00039 * Retrieves mouse mode name. 00040 * 00041 * @param modeName 00042 * A string populated with the mouse mode name. 00043 */ 00044 virtual void getName(std::string& modeName) const = 0; 00045 00046 /** 00047 * Retrieves the action associated with the mouse mode. 00048 * 00049 * If the mouse mode has an associated action, it is added to the main mouse 00050 * mode action group when the mode is added to a view. This allows the action 00051 * to be automatically toggled off when another mouse mode action in the group 00052 * is activated and all other actions will be toggled off when this mouse mode 00053 * is activated. 00054 * 00055 * See DesktopServices::createMouseMode() for details on the default mouse 00056 * modes contained in the main mouse mode action group. 00057 * 00058 * @return The associated Qt action that is included in the main mouse mode 00059 * action group. NULL is returned if the mouse mode is not included 00060 * in the main mouse mode action group. 00061 */ 00062 virtual QAction* getAction() const = 0; 00063 00064 protected: 00065 /** 00066 * This should be destroyed by calling DesktopServices::deleteMouseMode. 00067 */ 00068 virtual ~MouseMode() {} 00069 }; 00070 00071 #endif