6.2 mglDraw class

This class provide base functionality for callback drawing and running calculation in separate thread. It is defined in #include <mgl2/wnd.h>. You should make inherited class and implement virtual functions if you need it.

Virtual method on mglDraw: int Draw (mglGraph *gr)

This is callback drawing function, which will be called when any redrawing is required for the window. There is support of a list of plots (frames). So as one can prepare a set of frames at first and redraw it fast later (but it requires more memory). Function should return positive number of frames for the list or zero if it will plot directly.

Virtual method on mglDraw: void Reload ()

This is callback function, which will be called if user press menu or toolbutton to reload data.

Virtual method on mglDraw: void Click ()

This is callback function, which will be called if user click mouse.

Virtual method on mglDraw: void Calc ()

This is callback function, which will be called if user start calculations in separate thread by calling mglDraw::Run() function. It should periodically call mglDraw::Check() function to check if calculations should be paused.

Method on mglDraw: void Run ()

Runs mglDraw::Calc() function in separate thread. It also initialize mglDraw::thr variable and unlock mglDraw::mutex. Function is present only if FLTK support for widgets was enabled.

Method on mglDraw: void Cancel ()

Cancels thread with calculations. Function is present only if FLTK support for widgets was enabled.

Method on mglDraw: void Pause ()

Pauses thread with calculations by locking mglDraw::mutex. You should call mglDraw::Continue() to continue calculations. Function is present only if FLTK support for widgets was enabled.

Method on mglDraw: void Continue ()

Continues calculations by unlocking mglDraw::mutex. Function is present only if FLTK support for widgets was enabled.

Method on mglDraw: void Continue ()

Checks if calculations should be paused and pause it. Function is present only if FLTK support for widgets was enabled.