00001 #ifndef GUI_UTILS___COMMAND__HPP 00002 #define GUI_UTILS___COMMAND__HPP 00003 00004 /* $Id: command.hpp 18080 2008-10-14 22:33:27Z yazhuk $ 00005 * =========================================================================== 00006 * 00007 * PUBLIC DOMAIN NOTICE 00008 * National Center for Biotechnology Information 00009 * 00010 * This software/database is a "United States Government Work" under the 00011 * terms of the United States Copyright Act. It was written as part of 00012 * the author's official duties as a United States Government employee and 00013 * thus cannot be copyrighted. This software/database is freely available 00014 * to the public for use. The National Library of Medicine and the U.S. 00015 * Government have not placed any restriction on its use or reproduction. 00016 * 00017 * Although all reasonable efforts have been taken to ensure the accuracy 00018 * and reliability of the software and data, the NLM and the U.S. 00019 * Government do not and cannot warrant the performance or results that 00020 * may be obtained by using this software or data. The NLM and the U.S. 00021 * Government disclaim all warranties, express or implied, including 00022 * warranties of performance, merchantability or fitness for any particular 00023 * purpose. 00024 * 00025 * Please cite the author in any work or product based on this material. 00026 * 00027 * =========================================================================== 00028 * 00029 * Authors: Andrey Yazhuk 00030 * 00031 */ 00032 00033 /** @addtogroup GUI_UTILS 00034 * 00035 * @{ 00036 */ 00037 00038 /// @file command.hpp 00039 /// GUI command routing and handling framework. 00040 /// 00041 /// The following are parts of the framework: 00042 /// CCommandTarget class - represents a class capable of handling commands 00043 /// using command maps. 00044 /// Command map - structure mapping command IDs to handler funtion pointers. 00045 /// IMenu - interface for CCommandTraget compatible menus. 00046 00047 #include <corelib/ncbistl.hpp> 00048 #include <corelib/ncbistd.hpp> 00049 00050 #include <gui/gui.hpp> 00051 00052 #include <gui/utils/event_handler.hpp> 00053 00054 00055 BEGIN_NCBI_SCOPE 00056 00057 //////////////////////////////////////////////////////////////////////////////// 00058 /// ICmdUI - interface for updating command GUI elements such as menu itms and 00059 /// tool bar buttons. 00060 class ICmdUI : public IEventAttachment 00061 { 00062 public: 00063 virtual ~ICmdUI() {} 00064 00065 virtual TCmdID GetCommand() const = 0; 00066 virtual void Enable(bool en) = 0; 00067 virtual void SetCheck(bool set) = 0; 00068 virtual void SetRadio(bool set) = 0; 00069 virtual void SetLabel(const string& label) = 0; 00070 }; 00071 00072 00073 /// callback for updating command UI elements 00074 typedef void (CEventHandler::*FCMDUpdateHandler) (ICmdUI*); 00075 00076 00077 /// Definitions for generic commands. 00078 /// 00079 /// Subsytems of GUI should define they own command enumerations, preferable 00080 /// with non-overlapping ranges. 00081 00082 enum EBaseCommands { 00083 eCmdMenuEnd = -2, /// marks menu end in array initializers 00084 eCmdInvalid = -1, /// not a valid command 00085 eCmdNone = 0, /// empty command 00086 00087 /// zoom events 00088 eCmdZoomIn, 00089 eCmdZoomOut, 00090 eCmdZoomAll, 00091 eCmdZoomInMouse, 00092 eCmdZoomOutMouse, 00093 eCmdZoomSel, /// Zoom to Selection 00094 eCmdZoomSeq, /// Zoom to Sequence 00095 eCmdZoomObjects, 00096 eCmdZoomSelObjects, 00097 eCmdZoomInX, 00098 eCmdZoomOutX, 00099 eCmdZoomAllX, 00100 eCmdZoomInY, 00101 eCmdZoomOutY, 00102 eCmdZoomAllY, 00103 eCmdSetEqualScale, 00104 00105 eCmdSettings, // widget/view settings 00106 00107 eCmdResetSelection, 00108 00109 eCmdEditSelection, 00110 eCmdDeleteSelection, 00111 eCmdDeleteSelectionAndOrphaned, 00112 00113 /// Navigation commands 00114 eCmdBack, 00115 eCmdForward, 00116 00117 /// goto sequence position 00118 eCmdSeqGoto, 00119 00120 // insert new command here 00121 eBaseCmdLast 00122 }; 00123 00124 00125 END_NCBI_SCOPE 00126 00127 /* @} */ 00128 00129 #endif // GUI_UTILS___COMMAND__HPP 00130 00131
1.4.6
Modified on Mon Dec 07 16:20:37 2009 by modify_doxy.py rev. 173732