This class is abstract class derived from mglGraph class (see MathGL core). It is defined in #include <mgl2/wnd.h>
and provide base methods for handling window with MathGL graphics. Inherited classes are exist for QT and FLTK widget libraries: mglQT
in #include <mgl2/qt.h>
, mglFLTK
in #include <mgl2/fltk.h>
.
mglWnd
: int
Run ()
¶int
mgl_qt_run ()
¶int
mgl_fltk_run ()
¶Run main loop for event handling. Usually it should be called in a separate thread or as last function call in main()
.
mglWnd
: void
SetDrawFunc (int
(*draw)(HMGL
gr, void *
p), void *
par=NULL
, void
(*reload)(void *
p)=NULL
)
¶mglWnd
: void
SetDrawFunc (int
(*draw)(mglGraph *
gr))
¶mglWnd
: void
SetDrawFunc (mglDraw *
obj)
¶void
mgl_wnd_set_func (HMGL
gr, int
(*draw)(HMGL
gr, void *
p), void *
par, void
(*reload)(void *
p))
¶Set callback functions for drawing (draw) and data reloading (reload), or instance obj of a class derived from mglDraw
.
mglWnd
: void
SetClickFunc (void
(*func)(HMGL
gr, void *
p))
¶void
mgl_set_click_func (void
(*func)(HMGL
gr, void *
p))
¶Set callback function func which will be called on mouse click.
mglWnd
: void
SetMutex(pthread_mutex_t *
mutex) ¶void
mgl_wnd_set_mutex(HMGL
gr, pthread_mutex_t *
mutex)
¶Set external mutex for lock/unlock external calculations by widget. This functions is called automatically at using mglDraw class.
mglWnd
: void
ToggleAlpha ()
¶void
mgl_wnd_toggle_alpha (HMGL
gr)
¶Switch on/off transparency but do not overwrite switches in user drawing function.
mglWnd
: void
ToggleLight ()
¶void
mgl_wnd_toggle_light (HMGL
gr)
¶Switch on/off lighting but do not overwrite switches in user drawing function.
mglWnd
: void
ToggleRotate ()
¶void
mgl_wnd_toggle_rotate (HMGL
gr)
¶Switch on/off rotation by mouse. Usually, left button is used for rotation, middle button for shift, right button for zoom/perspective.
mglWnd
: void
ToggleZoom ()
¶void
mgl_wnd_toggle_zoom (HMGL
gr)
¶Switch on/off zooming by mouse. Just select rectangular region by mouse and it will be zoomed in.
mglWnd
: void
ToggleNo ()
¶void
mgl_wnd_toggle_no (HMGL
gr)
¶Switch off all zooming and rotation and restore initial state.
mglWnd
: void
Update ()
¶void
mgl_wnd_update (HMGL
gr)
¶Update window contents. This is very useful function for manual updating the plot while long calculation was running in parallel thread.
mglWnd
: void
ReLoad ()
¶void
mgl_wnd_reload (HMGL
gr)
¶Reload user data and update picture. This function also update number of frames which drawing function can create.
mglWnd
: void
Adjust ()
¶void
mgl_wnd_adjust (HMGL
gr)
¶Adjust size of bitmap to window size.
mglWnd
: void
NextFrame ()
¶void
mgl_wnd_next_frame (HMGL
gr)
¶Show next frame if one.
mglWnd
: void
PrevFrame ()
¶void
mgl_wnd_prev_frame (HMGL
gr)
¶Show previous frame if one.
mglWnd
: void
Animation ()
¶void
mgl_wnd_animation (HMGL
gr)
¶Run/stop slideshow (animation) of frames.
mglWnd
: void
SetDelay (double
dt)
¶void
mgl_wnd_set_delay (HMGL
gr, double
dt)
¶Sets delay for animation in seconds. Default value is 1 sec.
mglWnd
: double
GetDelay ()
¶double
mgl_wnd_get_delay (HMGL
gr)
¶Gets delay for animation in seconds.
mglWnd
: void
Setup (bool
clfupd=true
, bool
showpos=false
)
¶void
mgl_setup_window (HMGL
gr, bool
clfupd, bool
showpos)
¶Enable/disable flags for:
mglWnd
: mglPoint
LastMousePos ()
¶void
mgl_get_last_mouse_pos (HMGL
gr, mreal *
x, mreal *
y, mreal *
z)
¶Gets last position of mouse click.
mglWnd
: void *
Widget ()
¶void *
mgl_fltk_widget (HMGL
gr)
¶void *
mgl_qt_widget (HMGL
gr)
¶Return pointer to widget (Fl_MathGL class or QMathGL class) used for plotting.