cgv
Loading...
Searching...
No Matches
menu_provider.cxx
1#include <cgv/gui/gui_driver.h>
2#include "menu_provider.h"
3
4namespace cgv {
5 namespace gui {
6
9{
10 if (get_gui_driver())
11 return get_gui_driver()->add_menu_separator(menu_path);
12 return cgv::base::base_ptr();
13}
14
16button_ptr menu_provider::add_menu_button(const std::string& menu_path, const std::string& options)
17{
18 if (get_gui_driver())
19 return get_gui_driver()->add_menu_button(menu_path, options);
20 return button_ptr();
21}
22
24data::ref_ptr<control<bool> > menu_provider::add_menu_bool_control(const std::string& menu_path, bool& value, const std::string& options)
25{
26 if (get_gui_driver())
27 return get_gui_driver()->add_menu_bool_control(menu_path, value, options);
29}
31base::base_ptr menu_provider::find_menu_element(const std::string& menu_path) const
32{
33 if (get_gui_driver())
34 return get_gui_driver()->find_menu_element(menu_path);
35 return base::base_ptr();
36}
39{
40 if (get_gui_driver())
41 get_gui_driver()->remove_menu_element(bp);
42}
51
52 }
53}
data::ref_ptr< control< bool > > add_menu_bool_control(const std::string &menu_path, bool &value, const std::string &options="")
use this to add a new control to the gui with a given value type, gui type and init options
base::base_ptr add_menu_separator(const std::string &menu_path)
add a newly created decorator to the group
button_ptr add_menu_button(const std::string &menu_path, const std::string &options="")
use the current gui driver to append a new button in the menu, where menu path is a '/' separated pat...
base::base_ptr find_menu_element(const std::string &menu_path) const
return the element of the given menu path
~menu_provider()
ensure to remove posted recreation callbacks
menu_provider()
default construction
void remove_menu_element(base::base_ptr)
remove a single element from the gui
data::ref_ptr< base, true > base_ptr
ref counted pointer to base
Definition base.h:37
gui_driver_ptr get_gui_driver()
return the currently registered gui driver or an empty pointer if non has been registered
data::ref_ptr< button > button_ptr
ref counted pointer to button
Definition button.h:24
the cgv namespace
Definition print.h:11