/
iwxgl.h
38 lines (30 loc) · 1012 Bytes
/
iwxgl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
#include "imodule.h"
namespace wxutil { class GLWidget; }
namespace ui
{
// Application wide manager for wxGLWidgets
// All GLWidgets need to register themselves to this module
// since the shared wxGLContext creation will be bound to
// the first registered widget
class IWxGLWidgetManager :
public RegisterableModule
{
public:
/// Registers a GL widget, storing the shared context if necessary
virtual void registerGLWidget(wxutil::GLWidget* widget) = 0;
/// Notifies the GL module that a GLWidget has been destroyed
virtual void unregisterGLWidget(wxutil::GLWidget* widget) = 0;
};
}
const char* const MODULE_WXGLWIDGET_MANAGER("wxGLWidgetManager");
inline ui::IWxGLWidgetManager& GlobalWxGlWidgetManager()
{
// Cache the reference locally
static ui::IWxGLWidgetManager& _instance(
*std::static_pointer_cast<ui::IWxGLWidgetManager>(
module::GlobalModuleRegistry().getModule(MODULE_WXGLWIDGET_MANAGER)
)
);
return _instance;
}