libigl v2.5.0
Loading...
Searching...
No Matches
ImGuiWidget.h
Go to the documentation of this file.
1// This file is part of libigl, a simple c++ geometry processing library.
2//
3// Copyright (C) 2022 Alec Jacobson <alecjacobson@gmail.com>
4//
5// This Source Code Form is subject to the terms of the Mozilla Public License
6// v. 2.0. If a copy of the MPL was not distributed with this file, You can
7// obtain one at http://mozilla.org/MPL/2.0/.
8#ifndef IGL_OPENGL_GLFW_IMGUI_IMGUIWIDGET_H
9#define IGL_OPENGL_GLFW_IMGUI_IMGUIWIDGET_H
10
11#include "ImGuiPlugin.h"
12#include "ImGuiWidget.h"
13#include "../../../igl_inline.h"
14#include <memory>
15
16namespace igl
17{
18 namespace opengl
19 {
20 namespace glfw
21 {
22 class Viewer;
23 namespace imgui
24 {
25 // Forward declaration of the parent plugin
26 class ImGuiPlugin;
31 {
32 public:
33 IGL_INLINE ImGuiWidget(){ name = "dummy"; }
34 virtual ~ImGuiWidget(){}
35 IGL_INLINE virtual void init(Viewer *_viewer, ImGuiPlugin *_plugin)
36 { viewer = _viewer; plugin = _plugin; }
37 IGL_INLINE virtual void shutdown() {}
38 IGL_INLINE virtual void draw() {}
39 IGL_INLINE virtual bool mouse_down(int /*button*/, int /*modifier*/)
40 { return false;}
41 IGL_INLINE virtual bool mouse_up(int /*button*/, int /*modifier*/)
42 { return false;}
43 IGL_INLINE virtual bool mouse_move(int /*mouse_x*/, int /*mouse_y*/)
44 { return false;}
45 IGL_INLINE virtual bool key_pressed(unsigned int /*key*/, int /*modifiers*/)
46 { return false;}
47 IGL_INLINE virtual bool key_down(int /*key*/, int /*modifiers*/)
48 { return false;}
49 IGL_INLINE virtual bool key_up(int /*key*/, int /*modifiers*/)
50 { return false;}
51 std::string name;
52 protected:
53 // Pointer to ImGuiPlugin's parent viewer
55 // Pointer to parent ImGuiPlugin class
57 };
58
59 }
60 }
61 }
62}
63
64#endif
65
Definition Viewer.h:43
Plugin for the viewer to enable imgui widgets.
Definition ImGuiPlugin.h:32
Abstract class for imgui "widgets".
Definition ImGuiWidget.h:31
virtual void shutdown()
Definition ImGuiWidget.h:37
Viewer * viewer
Definition ImGuiWidget.h:54
ImGuiWidget()
Definition ImGuiWidget.h:33
std::string name
Definition ImGuiWidget.h:51
virtual ~ImGuiWidget()
Definition ImGuiWidget.h:34
virtual bool key_down(int, int)
Definition ImGuiWidget.h:47
virtual bool key_pressed(unsigned int, int)
Definition ImGuiWidget.h:45
virtual bool mouse_up(int, int)
Definition ImGuiWidget.h:41
virtual bool key_up(int, int)
Definition ImGuiWidget.h:49
virtual bool mouse_down(int, int)
Definition ImGuiWidget.h:39
virtual void draw()
Definition ImGuiWidget.h:38
virtual bool mouse_move(int, int)
Definition ImGuiWidget.h:43
ImGuiPlugin * plugin
Definition ImGuiWidget.h:56
virtual void init(Viewer *_viewer, ImGuiPlugin *_plugin)
Definition ImGuiWidget.h:35
#define IGL_INLINE
Definition igl_inline.h:15
Definition AABB.h:17