Next: , Up: Widget classes   [Contents][Index]


6.1 mglWnd class

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>.

Method on mglWnd: int Run ()
C function: int mgl_qt_run ()
C function: 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().

Method on mglWnd: void SetDrawFunc (int (*draw)(HMGL gr, void *p), void *par=NULL, void (*reload)(void *p)=NULL)
Method on mglWnd: void SetDrawFunc (int (*draw)(mglGraph *gr))
Method on mglWnd: void SetDrawFunc (mglDraw *obj)
C function: 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.

Method on mglWnd: void SetClickFunc (void (*func)(HMGL gr, void *p))
C function: void mgl_set_click_func (void (*func)(HMGL gr, void *p))

Set callback function func which will be called on mouse click.

Method on mglWnd: void SetMutex(pthread_mutex_t *mutex)
C function: 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.

Method on mglWnd: void ToggleAlpha ()
C function: void mgl_wnd_toggle_alpha (HMGL gr)

Switch on/off transparency but do not overwrite switches in user drawing function.

Method on mglWnd: void ToggleLight ()
C function: void mgl_wnd_toggle_light (HMGL gr)

Switch on/off lighting but do not overwrite switches in user drawing function.

Method on mglWnd: void ToggleRotate ()
C function: 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.

Method on mglWnd: void ToggleZoom ()
C function: 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.

Method on mglWnd: void ToggleNo ()
C function: void mgl_wnd_toggle_no (HMGL gr)

Switch off all zooming and rotation and restore initial state.

Method on mglWnd: void Update ()
C function: 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.

Method on mglWnd: void ReLoad ()
C function: void mgl_wnd_reload (HMGL gr)

Reload user data and update picture. This function also update number of frames which drawing function can create.

Method on mglWnd: void Adjust ()
C function: void mgl_wnd_adjust (HMGL gr)

Adjust size of bitmap to window size.

Method on mglWnd: void NextFrame ()
C function: void mgl_wnd_next_frame (HMGL gr)

Show next frame if one.

Method on mglWnd: void PrevFrame ()
C function: void mgl_wnd_prev_frame (HMGL gr)

Show previous frame if one.

Method on mglWnd: void Animation ()
C function: void mgl_wnd_animation (HMGL gr)

Run/stop slideshow (animation) of frames.

Method on mglWnd: void SetDelay (double dt)
C function: void mgl_wnd_set_delay (HMGL gr, double dt)

Sets delay for animation in seconds. Default value is 1 sec.

Method on mglWnd: double GetDelay ()
C function: double mgl_wnd_get_delay (HMGL gr)

Gets delay for animation in seconds.

Method on mglWnd: void Setup (bool clfupd=true, bool showpos=false)
C function: void mgl_setup_window (HMGL gr, bool clfupd, bool showpos)

Enable/disable flags for:

Method on mglWnd: mglPoint LastMousePos ()
C function: void mgl_get_last_mouse_pos (HMGL gr, mreal *x, mreal *y, mreal *z)

Gets last position of mouse click.

Method on mglWnd: void * Widget ()
C function: void * mgl_fltk_widget (HMGL gr)
C function: void * mgl_qt_widget (HMGL gr)

Return pointer to widget (Fl_MathGL class or QMathGL class) used for plotting.


Next: , Up: Widget classes   [Contents][Index]