Jetson Inference
DNN Vision Library
|
OpenGL graphics widget for rendering moveable/resizable shapes. More...
#include <glWidget.h>
Classes | |
struct | eventHandler |
Public Types | |
enum | Shape { Rect, Line, Ellipse } |
Shape enum. More... | |
typedef bool(* | glWidgetEventHandler) (glWidget *widget, uint16_t event, int a, int b, void *user) |
Event message handler callback for recieving UI messages from widgets. More... | |
Public Member Functions | |
glWidget (Shape shape=Rect) | |
Constructor. More... | |
glWidget (float x, float y, float width, float height, Shape shape=Rect) | |
Constructor. More... | |
virtual | ~glWidget () |
Destructor. More... | |
bool | Contains (float x, float y) const |
Test if the point is inside the widget. More... | |
void | Move (float x, float y) |
Move the widget's position by the specified offset. More... | |
float | X () const |
Get the widget's X coordinate. More... | |
float | Y () const |
Get the widget's Y coordinate. More... | |
void | SetX (float x) |
Set the widget's X coordinate. More... | |
void | SetY (float y) |
Set the widget's Y coordinate. More... | |
float | Width () const |
Get the widget's width. More... | |
float | Height () const |
Get the widget's height. More... | |
void | SetWidth (float width) |
Set the widget's width. More... | |
void | SetHeight (float height) |
Set the widget's height. More... | |
void | GetPosition (float *x, float *y) const |
Get position of widget in global window coordinates. More... | |
void | SetPosition (float x, float y) |
Set position of widget in global window coordinates. More... | |
void | GetCoords (float *x1, float *y1, float *x2, float *y2) const |
Get the bounding coordinates of the widget. More... | |
void | SetCoords (float x1, float y1, float x2, float y2) |
Set the bounding coordinates of the widget. More... | |
void | GetSize (float *width, float *height) const |
Get the widget's size. More... | |
void | SetSize (float width, float height) |
Set the widget's size. More... | |
Shape | GetShape () const |
Get the shape. More... | |
void | SetShape (Shape shape) |
Set the shape. More... | |
void | SetFillAlpha (float a) |
Set fill alpha. More... | |
void | SetLineAlpha (float a) |
Set outline alpha. More... | |
void | SetLineWidth (float width) |
Set outline width. More... | |
void | SetFillColor (float r, float g, float b, float a=1.0f) |
Set fill color. More... | |
void | SetLineColor (float r, float g, float b, float a=1.0f) |
Set outline color. More... | |
void | SetSelectedFillColor (float r, float g, float b, float a=1.0f) |
Set selected fill color. More... | |
void | SetSelectedLineColor (float r, float g, float b, float a=1.0f) |
Set selected outline color. More... | |
bool | IsMoveable () const |
Is the widget moveable/draggable by the user? More... | |
void | SetMoveable (bool moveable) |
Toggle if the user can move/drag the widget. More... | |
bool | IsResizeable () const |
Is the widget resizeable by the user? More... | |
void | SetResizeable (bool resizeable) |
Toggle if the user can resize the widget. More... | |
bool | IsSelected () const |
Is the widget selected? More... | |
void | SetSelected (bool selected) |
Select/de-select the widget. More... | |
bool | IsVisible () const |
Is the widget visible. More... | |
void | SetVisible (bool visible) |
Show/hide the widget. More... | |
void * | GetUserData () const |
Retrieve user data. More... | |
void | SetUserData (void *user) |
Set user-defined data. More... | |
glDisplay * | GetDisplay () const |
Get the root window of the widget. More... | |
int | GetIndex () const |
Get the index of the widget in the window (or -1 if none) More... | |
void | Render () |
Render (automatically called by parent) More... | |
void | GlobalToLocal (float x, float y, float *x_out, float *y_out) const |
Convert from global window coordinates to local widget offset. More... | |
void | LocalToGlobal (float x, float y, float *x_out, float *y_out) const |
Convert from local widget offset to global window coordinates. More... | |
void | AddEventHandler (glWidgetEventHandler callback, void *user=NULL) |
Register an event message handler the widget will send events to. More... | |
void | RemoveEventHandler (glWidgetEventHandler callback, void *user=NULL) |
Remove an event message handler from being called by the widget. More... | |
bool | OnEvent (uint16_t event, int a, int b, void *user) |
Protected Types | |
enum | DragState { DragNone, DragMove, DragResizeN, DragResizeNW, DragResizeNE, DragResizeS, DragResizeSW, DragResizeSE, DragResizeW, DragResizeE } |
Protected Member Functions | |
void | initDefaults () |
void | setCursor (DragState cursor) |
void | setDisplay (glDisplay *display) |
void | dispatchEvent (uint16_t msg, int a, int b) |
DragState | coordToBorder (float x, float y, float max_distance=10.0f) |
Protected Attributes | |
float | mX |
float | mY |
float | mWidth |
float | mHeight |
float | mSelectedFillColor [4] |
float | mSelectedLineColor [4] |
float | mFillColor [4] |
float | mLineColor [4] |
float | mLineWidth |
bool | mMoveable |
bool | mResizeable |
bool | mSelected |
bool | mVisible |
Shape | mShape |
void * | mUserData |
glDisplay * | mDisplay |
DragState | mDragState |
std::vector< eventHandler > | mEventHandlers |
Friends | |
class | glDisplay |
OpenGL graphics widget for rendering moveable/resizable shapes.
typedef bool(* glWidget::glWidgetEventHandler) (glWidget *widget, uint16_t event, int a, int b, void *user) |
Event message handler callback for recieving UI messages from widgets.
Recieves 4 parameters - the widget that sent the event, the event type, a & b message values (
Event message handlers should return true
if the message was handled, or false
if the message was skipped or not handled.
|
protected |
enum glWidget::Shape |
|
virtual |
Destructor.
void glWidget::AddEventHandler | ( | glWidgetEventHandler | callback, |
void * | user = NULL |
||
) |
Register an event message handler the widget will send events to.
callback | function pointer to the event message handler callback |
user | optional user-specified pointer that will be passed to all invocations of this event handler (typically an object) |
bool glWidget::Contains | ( | float | x, |
float | y | ||
) | const |
Test if the point is inside the widget.
|
protected |
|
protected |
|
inline |
Get the bounding coordinates of the widget.
|
inline |
Get the root window of the widget.
int glWidget::GetIndex | ( | ) | const |
Get the index of the widget in the window (or -1 if none)
|
inline |
Get position of widget in global window coordinates.
|
inline |
Get the shape.
|
inline |
Get the widget's size.
|
inline |
Retrieve user data.
void glWidget::GlobalToLocal | ( | float | x, |
float | y, | ||
float * | x_out, | ||
float * | y_out | ||
) | const |
Convert from global window coordinates to local widget offset.
|
inline |
Get the widget's height.
|
protected |
|
inline |
Is the widget moveable/draggable by the user?
|
inline |
Is the widget resizeable by the user?
|
inline |
Is the widget selected?
|
inline |
Is the widget visible.
void glWidget::LocalToGlobal | ( | float | x, |
float | y, | ||
float * | x_out, | ||
float * | y_out | ||
) | const |
Convert from local widget offset to global window coordinates.
|
inline |
Move the widget's position by the specified offset.
bool glWidget::OnEvent | ( | uint16_t | event, |
int | a, | ||
int | b, | ||
void * | user | ||
) |
void glWidget::RemoveEventHandler | ( | glWidgetEventHandler | callback, |
void * | user = NULL |
||
) |
Remove an event message handler from being called by the widget.
RemoveEventHandler() will search for previously registered event handlers that have the same function pointer and/or user pointer, and remove them for being called again in the future.
void glWidget::Render | ( | ) |
Render (automatically called by parent)
|
inline |
Set the bounding coordinates of the widget.
|
protected |
|
protected |
|
inline |
Set fill alpha.
|
inline |
Set fill color.
|
inline |
Set the widget's height.
|
inline |
Set outline alpha.
|
inline |
Set outline color.
|
inline |
Set outline width.
|
inline |
Toggle if the user can move/drag the widget.
|
inline |
Set position of widget in global window coordinates.
|
inline |
Toggle if the user can resize the widget.
|
inline |
Select/de-select the widget.
|
inline |
Set selected fill color.
|
inline |
Set selected outline color.
|
inline |
Set the shape.
|
inline |
Set the widget's size.
|
inline |
Set user-defined data.
|
inline |
Show/hide the widget.
|
inline |
Set the widget's width.
|
inline |
Set the widget's X coordinate.
|
inline |
Set the widget's Y coordinate.
|
inline |
Get the widget's width.
|
inline |
Get the widget's X coordinate.
|
inline |
Get the widget's Y coordinate.
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |