/* nanogui/popupbutton.h -- Button which launches a popup widget NanoGUI was developed by Wenzel Jakob . The widget drawing code is based on the NanoVG demo application by Mikko Mononen. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE.txt file. */ /** \file */ #pragma once #include #include #include NAMESPACE_BEGIN(nanogui) /** * \class PopupButton popupbutton.h nanogui/popupbutton.h * * \brief Button which launches a popup widget. */ class NANOGUI_EXPORT PopupButton : public Button { public: PopupButton(Widget *parent, const std::string &caption = "Untitled", int buttonIcon = 0, int chevronIcon = ENTYPO_ICON_CHEVRON_SMALL_RIGHT); void setChevronIcon(int icon) { mChevronIcon = icon; } int chevronIcon() const { return mChevronIcon; } Popup *popup() { return mPopup; } const Popup *popup() const { return mPopup; } virtual void draw(NVGcontext* ctx) override; virtual Vector2i preferredSize(NVGcontext *ctx) const override; virtual void performLayout(NVGcontext *ctx) override; virtual void save(Serializer &s) const override; virtual bool load(Serializer &s) override; protected: Popup *mPopup; int mChevronIcon; }; NAMESPACE_END(nanogui)