stlab.adobe.com Adobe Systems Incorporated

menu_system.hpp

Go to the documentation of this file.
00001 /*
00002     Copyright 2005-2007 Adobe Systems Incorporated
00003     Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
00004     or a copy at http://stlab.adobe.com/licenses.html)
00005 */
00006 
00007 /*************************************************************************************************/
00008 
00009 #ifndef ADOBE_MENU_SYSTEM_HPP
00010 #define ADOBE_MENU_SYSTEM_HPP
00011 
00012 /*************************************************************************************************/
00013 
00014 #include <adobe/config.hpp>
00015 
00016 #include <adobe/name.hpp>
00017 #include <adobe/future/enum_ops.hpp>
00018 
00019 #include <boost/function.hpp>
00020 #include <boost/noncopyable.hpp>
00021 #include <boost/signals.hpp>
00022 #include <boost/cstdint.hpp>
00023 
00024 /****************************************************************************************************/
00025 
00026 namespace adobe {
00027 
00028 /****************************************************************************************************/
00029 
00030 class menu_system_t : boost::noncopyable
00031 {
00032 public:
00033     enum modifier_set_t
00034     {
00035         modifier_none_k     = 0,
00036         modifier_option_k   = 1L << 0,
00037         modifier_alt_k      = modifier_option_k,
00038         modifier_control_k  = 1L << 1,
00039         modifier_shift_k    = 1L << 3
00040     };
00041 
00042     typedef boost::function<void ()>    item_callback_t;
00043     typedef boost::signals::connection  connection_t;
00044 
00045     menu_system_t();
00046 
00047     ~menu_system_t();
00048 
00049     void            insert_menu(name_t name);
00050     void            insert_item(name_t          parent_name,
00051                                 name_t          name,
00052                                 boost::uint16_t cmd_key = 0,
00053                                 modifier_set_t  modifier_set = modifier_none_k);
00054     void            insert_separator(name_t parent_name);
00055     void            remove(name_t name);
00056 
00057     void            enable_menu_item(name_t name, bool enabled);
00058     void            mark_menu_item(name_t name, bool marked);
00059 
00060     connection_t    monitor_menu_item(name_t name, const item_callback_t& callback);
00061 
00062     struct implementation_t;
00063 
00064 private:
00065     implementation_t* object_m;
00066 };
00067 
00068 /****************************************************************************************************/
00069 
00070 ADOBE_DEFINE_BITSET_OPS(menu_system_t::modifier_set_t)
00071 
00072 /****************************************************************************************************/
00073 
00074 } // namespace adobe
00075 
00076 /****************************************************************************************************/
00077 
00078 #endif
00079 
00080 /****************************************************************************************************/

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google