MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / Button

Class Button

Source/Falcor/Utils/UI/PythonUI.cpp:211–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209};
210
211class Button : public Widget
212{
213 FALCOR_OBJECT(Button)
214public:
215 using Callback = std::function<void()>;
216
217 Button(Widget* parent, std::string_view label = "", Callback callback = {}) : Widget(parent), m_label(label), m_callback(callback) {}
218
219 const std::string& get_label() const { return m_label; }
220 void set_label(std::string_view label) { m_label = label; }
221
222 Callback get_callback() const { return m_callback; }
223 void set_callback(Callback callback) { m_callback = callback; }
224
225 virtual void render() override
226 {
227 ScopedID id(this);
228 if (!m_visible)
229 return;
230 ScopedDisable disable(!m_enabled);
231 if (ImGui::Button(m_label.c_str()))
232 {
233 if (m_callback)
234 m_callback();
235 }
236 }
237
238private:
239 std::string m_label;
240 Callback m_callback;
241};
242
243class Property : public Widget
244{

Callers 5

renderOptionsMethod · 0.85
renderMethod · 0.85
addButtonMethod · 0.85
renderUIMethod · 0.85
renderMethod · 0.85

Calls

no outgoing calls

Tested by 1

renderUIMethod · 0.68