reactphysics3d/testbed/nanogui/include/nanogui/popupbutton.h

44 lines
1.2 KiB
C++

/*
nanogui/popupbutton.h -- Button which launches a popup widget
NanoGUI was developed by Wenzel Jakob <wenzel@inf.ethz.ch>.
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.
*/
#pragma once
#include <nanogui/button.h>
#include <nanogui/popup.h>
#include <nanogui/entypo.h>
NAMESPACE_BEGIN(nanogui)
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);
virtual Vector2i preferredSize(NVGcontext *ctx) const;
virtual void performLayout(NVGcontext *ctx);
virtual void save(Serializer &s) const;
virtual bool load(Serializer &s);
protected:
Popup *mPopup;
int mChevronIcon;
};
NAMESPACE_END(nanogui)