scenepic 1.1.0
3D Visualization Made Easy
drop_down_menu.h
Go to the documentation of this file.
1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4#ifndef _SCENEPIC_DROP_DOWN_MENU_H_
5#define _SCENEPIC_DROP_DOWN_MENU_H_
6
7#include "json_value.h"
8
9#include <set>
10#include <string>
11#include <vector>
12
13namespace scenepic
14{
17 {
18 public:
20 DropDownMenu& title(const std::string& title);
21
23 const std::string& title() const;
24
26 DropDownMenu& items(const std::vector<std::string>& items);
27
29 const std::vector<std::string>& items() const;
30
32 std::vector<std::string>& items();
33
36
38 int selection() const;
39
41 void set_disabled(int index, bool disabled);
42
44 std::string to_string() const;
45
50
56
57 private:
58 friend class Scene;
59
63 DropDownMenu(const std::string& drop_down_menu_id);
64
65 std::string m_drop_down_menu_id;
66 std::string m_title;
67 std::vector<std::string> m_items;
68 std::set<int> m_disabled_indices;
69 int m_selection;
70 };
71} // namespace scenepic
72
73#endif
Represents a ScenePic DropDownMenu UI component.
Definition: drop_down_menu.h:17
const std::vector< std::string > & items() const
The option items displayed in the drop down.
DropDownMenu & selection(int index)
The current selection index.
void clear_script()
Call this if you are dumping a ScenePic script in multiple parts, e.g.
std::vector< std::string > & items()
The option items displayed in the drop down.
int selection() const
The current selection index.
DropDownMenu & title(const std::string &title)
The title of the menu.
const std::string & title() const
The title of the menu.
std::string to_string() const
Return a JSON string representing the object.
DropDownMenu & items(const std::vector< std::string > &items)
The option items displayed in the drop down.
void set_disabled(int index, bool disabled)
Flip a bit determining whether an index is disabled.
JsonValue to_json() const
Convert this object into ScenePic json.
Representation of a JSON value according to the specification at https://www.json....
Definition: json_value.h:30
Top level container representing an entire ScenePic.
Definition: scene.h:58
Definition: audio_track.h:14