2013-08-09 06:57:18 +02:00
|
|
|
#ifndef _LC_GLWIDGET_H_
|
|
|
|
#define _LC_GLWIDGET_H_
|
|
|
|
|
2014-04-20 03:50:41 +02:00
|
|
|
#include "lc_context.h"
|
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
enum LC_CURSOR_TYPE
|
|
|
|
{
|
|
|
|
LC_CURSOR_DEFAULT,
|
|
|
|
LC_CURSOR_BRICK,
|
|
|
|
LC_CURSOR_LIGHT,
|
|
|
|
LC_CURSOR_SPOTLIGHT,
|
|
|
|
LC_CURSOR_CAMERA,
|
|
|
|
LC_CURSOR_SELECT,
|
|
|
|
LC_CURSOR_SELECT_GROUP,
|
|
|
|
LC_CURSOR_MOVE,
|
|
|
|
LC_CURSOR_ROTATE,
|
|
|
|
LC_CURSOR_ROTATEX,
|
|
|
|
LC_CURSOR_ROTATEY,
|
|
|
|
LC_CURSOR_DELETE,
|
|
|
|
LC_CURSOR_PAINT,
|
|
|
|
LC_CURSOR_ZOOM,
|
|
|
|
LC_CURSOR_ZOOM_REGION,
|
|
|
|
LC_CURSOR_PAN,
|
|
|
|
LC_CURSOR_ROLL,
|
|
|
|
LC_CURSOR_ROTATE_VIEW,
|
|
|
|
LC_CURSOR_COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
struct lcInputState
|
|
|
|
{
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
bool Control;
|
|
|
|
bool Shift;
|
|
|
|
bool Alt;
|
|
|
|
};
|
|
|
|
|
|
|
|
class lcGLWidget
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
lcGLWidget()
|
|
|
|
{
|
|
|
|
mCursorType = LC_CURSOR_DEFAULT;
|
|
|
|
mWidget = NULL;
|
|
|
|
mInputState.x = 0;
|
|
|
|
mInputState.y = 0;
|
|
|
|
mInputState.Control = false;
|
|
|
|
mInputState.Shift = false;
|
|
|
|
mInputState.Alt = false;
|
2014-04-20 03:50:41 +02:00
|
|
|
mContext = new lcContext();
|
2014-04-20 21:09:46 +02:00
|
|
|
mDeleteContext = true;
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~lcGLWidget()
|
|
|
|
{
|
2014-04-20 21:09:46 +02:00
|
|
|
if (mDeleteContext)
|
|
|
|
delete mContext;
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void* GetExtensionAddress(const char* FunctionName);
|
|
|
|
void ShowPopupMenu();
|
|
|
|
|
2014-04-20 21:09:46 +02:00
|
|
|
void SetContext(lcContext* Context)
|
|
|
|
{
|
|
|
|
if (mDeleteContext)
|
|
|
|
delete mContext;
|
|
|
|
|
|
|
|
mContext = Context;
|
|
|
|
mDeleteContext = false;
|
|
|
|
}
|
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
void MakeCurrent();
|
|
|
|
void Redraw();
|
|
|
|
void CaptureMouse();
|
|
|
|
void ReleaseMouse();
|
|
|
|
void SetCursor(LC_CURSOR_TYPE Cursor);
|
|
|
|
|
|
|
|
virtual void OnDraw() { }
|
|
|
|
virtual void OnInitialUpdate() { }
|
|
|
|
virtual void OnUpdateCursor() { }
|
|
|
|
virtual void OnLeftButtonDown() { }
|
|
|
|
virtual void OnLeftButtonUp() { }
|
|
|
|
virtual void OnLeftButtonDoubleClick() { }
|
|
|
|
virtual void OnMiddleButtonDown() { }
|
|
|
|
virtual void OnMiddleButtonUp() { }
|
|
|
|
virtual void OnRightButtonDown() { }
|
|
|
|
virtual void OnRightButtonUp() { }
|
|
|
|
virtual void OnMouseMove() { }
|
|
|
|
virtual void OnMouseWheel(float Direction) { }
|
|
|
|
|
|
|
|
lcInputState mInputState;
|
|
|
|
int mWidth;
|
|
|
|
int mHeight;
|
|
|
|
int mCursorType;
|
|
|
|
void* mWidget;
|
2014-04-14 05:20:16 +02:00
|
|
|
lcContext* mContext;
|
2014-04-20 21:09:46 +02:00
|
|
|
bool mDeleteContext;
|
2013-08-09 06:57:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _LC_GLWIDGET_H_
|