Repository for OpenCV's extra modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

73 lines
2.2 KiB

// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
// Copyright Amir Hassan (kallaballa) <amir@viel-zu.org>
#ifndef SRC_OPENCV_V4D_DIALOG_HPP_
#define SRC_OPENCV_V4D_DIALOG_HPP_
#include <nanogui/theme.h>
#include <nanogui/nanogui.h>
#include <opencv2/core/cvdef.h>
#include <opencv2/core/mat.hpp>
#include <set>
#include <string>
namespace cv {
namespace v4d {
using std::string;
class CustomTheme : public nanogui::Theme {
public:
CustomTheme(NVGcontext *ctx) : nanogui::Theme(ctx) {
}
virtual ~CustomTheme() {
}
};
/*!
* A class for light-weight dialog (a dialog renderered inside a window) derived from nanogui::Window.
* It keeps track of which dialogs are presented and which are lowered and is responsible for layout of lowered dialog-bars.
*/
class CV_EXPORTS Dialog: public nanogui::Window {
private:
static std::function<bool(Dialog*, Dialog*)> v4dWin_Xcomparator;
static std::set<Dialog*, decltype(v4dWin_Xcomparator)> all_windows_xsorted_;
nanogui::Screen* screen_;
nanogui::Vector2i lastDragPos_;
nanogui::Vector2i maximizedPos_;
nanogui::Button* minBtn_;
nanogui::Button* maxBtn_;
nanogui::ref<nanogui::AdvancedGridLayout> oldLayout_;
nanogui::ref<nanogui::AdvancedGridLayout> newLayout_;
bool minimized_ = false;
nanogui::ref<CustomTheme> customTheme_;
bool mouse_drag_event(const nanogui::Vector2i& p, const nanogui::Vector2i& rel, int button,
int mods) override;
public:
/*!
* Creates a Dialog.
* @param screen The parent nanogui screen
* @param x The x position of the dialog
* @param y The y position of the dialog
* @param title The title of the dialog
*/
CV_EXPORTS Dialog(nanogui::Screen* screen, int x, int y, const string& title);
/*!
* Default destructor
*/
CV_EXPORTS virtual ~Dialog();
/*!
* Checks if a dialog is minimized.
* @return true if the dialog is minimized.
*/
CV_EXPORTS bool isMinimized();
};
} /* namespace viz */
} /* namespace cv */
#endif /* SRC_OPENCV_V4D_DIALOG_HPP_ */