Program Listing for File window.h¶
↰ Return to documentation for file (nanogui/window.h
)
/*
nanogui/window.h -- Top-level window widget
NanoGUI was developed by Wenzel Jakob <wenzel.jakob@epfl.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/widget.h>
NAMESPACE_BEGIN(nanogui)
class NANOGUI_EXPORT Window : public Widget {
friend class Popup;
public:
Window(Widget *parent, const std::string &title = "Untitled");
const std::string &title() const { return mTitle; }
void setTitle(const std::string &title) { mTitle = title; }
bool modal() const { return mModal; }
void setModal(bool modal) { mModal = modal; }
Widget *buttonPanel();
void dispose();
void center();
virtual void draw(NVGcontext *ctx) override;
virtual bool mouseDragEvent(const Vector2i &p, const Vector2i &rel, int button, int modifiers) override;
virtual bool mouseButtonEvent(const Vector2i &p, int button, bool down, int modifiers) override;
virtual bool scrollEvent(const Vector2i &p, const Vector2f &rel) 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:
virtual void refreshRelativePlacement();
protected:
std::string mTitle;
Widget *mButtonPanel;
bool mModal;
bool mDrag;
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
NAMESPACE_END(nanogui)