| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
5.1 mglWindow class
This class is derived from mglGraph class (see MathGL core). It is defined in #include <mgl2/window.h> and provide methods for handling window with MathGL graphics. Similar classes are exist for QT and FLTK widget libraries: mglQT in #include <mgl2/qt.h>, mglFLTK in #include <mgl2/fltk.h>.
- Constructor on
mglWindow: mglWindow (const char *title="MathGL") - Constructor on
mglWindow: mglWindow (int(*draw)(HMGLgr,void *p),const char *title="MathGL",void *par=NULL,intkind=0,void(*reload)(HMGLgr,void *p)=0) - Constructor on
mglWindow: mglWindow (int(*draw)(mglGraph *gr),const char *title="MathGL",intkind=0) - Constructor on
mglWindow: mglWindow (mglDraw *draw,const char *title="MathGL",intkind=0) - C function:
HMGLmgl_create_graph_qt (int(*draw)(HMGLgr,void *p),const char *title,void *par,void(*reload)(HMGLgr,void *p)) - C function:
HMGLmgl_create_graph_fltk (int(*draw)(HMGLgr,void *p),const char *title,void *par,void(*reload)(HMGLgr,void *p)) - C function:
HMGLmgl_create_graph_glut (int(*draw)(HMGLgr,void *p),const char *title,void *par,void(*reload)(HMGLgr,void *p)) -
Creates a window for plotting. Parameter draw sets a pointer to drawing function (this is the name of function) or instance of
mglDrawclass. 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. Note, that draw can beNULLfor displaying static bitmaps only (no animation or slides). Parameter title sets the title of the window. Parameter par contains pointer to data for the plotting function draw. Parameter kind may have following values: ‘0’ – use FLTK window, ‘1’ – use Qt window.There are some keys handles for manipulating by the plot: ’a’, ’d’, ’w’, ’s’ for the rotating; ’,’, ’.’ for viewing of the previous or next frames in the list; ’r’ for the switching of transparency; ’f’ for the switching of lightning; ’x’ for hiding (closing) the window.
- Method on
mglWindow:intRunThr () - C function:
intmgl_fltk_thr () Run main loop for event handling in separate thread. Note, right now it work for FLTK windows only.
- Method on
mglWindow:intRun () - C function:
intmgl_qt_run () - C function:
intmgl_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
mglWindow:voidSetClickFunc (void(*func)(HMGLgr,void *p)) - C function:
voidmgl_set_click_func (void(*func)(HMGLgr,void *p)) Set callback function
funcwhich will be called on mouse click.
- Method on
mglWindow:voidToggleAlpha () - C function:
voidmgl_wnd_toggle_alpha (HMGLgr) Switch on/off transparency but do not overwrite switches in user drawing function.
- Method on
mglWindow:voidToggleLight () - C function:
voidmgl_wnd_toggle_light (HMGLgr) Switch on/off lighting but do not overwrite switches in user drawing function.
- Method on
mglWindow:voidToggleRotate () - C function:
voidmgl_wnd_toggle_rotate (HMGLgr) Switch on/off rotation by mouse. Usually, left button is used for rotation, middle button for shift, right button for zoom/perspective.
- Method on
mglWindow:voidToggleZoom () - C function:
voidmgl_wnd_toggle_zoom (HMGLgr) Switch on/off zooming by mouse. Just select rectangular region by mouse and it will be zoomed in.
- Method on
mglWindow:voidToggleNo () - C function:
voidmgl_wnd_toggle_no (HMGLgr) Switch off all zooming and rotation and restore initial state.
- Method on
mglWindow:voidUpdate () - C function:
voidmgl_wnd_update (HMGLgr) Update window contents. This is very useful function for manual updating the plot while long calculation was running in parallel thread.
- Method on
mglWindow:voidReLoad () - C function:
voidmgl_wnd_reload (HMGLgr) Reload user data and update picture. This function also update number of frames which drawing function can create.
- Method on
mglWindow:voidAdjust () - C function:
voidmgl_wnd_adjust (HMGLgr) Adjust size of bitmap to window size.
- Method on
mglWindow:voidNextFrame () - C function:
voidmgl_wnd_next_frame (HMGLgr) Show next frame if one.
- Method on
mglWindow:voidPrevFrame () - C function:
voidmgl_wnd_prev_frame (HMGLgr) Show previous frame if one.
- Method on
mglWindow:voidAnimation () - C function:
voidmgl_wnd_animation (HMGLgr) Run/stop slideshow (animation) of frames.
- Method on
mglWindow:voidSetDelay (doubledt) - C function:
voidmgl_wnd_set_delay (HMGLgr,doubledt) Sets delay for animation in seconds. Default value is 1 sec.
- Method on
mglWindow:doubleGetDelay () - C function:
doublemgl_wnd_get_delay (HMGLgr) Gets delay for animation in seconds.
- Method on
mglWindow:voidSetup (boolclfupd=true,boolshowpos=false) - C function:
voidmgl_setup_window (HMGLgr,boolclfupd,boolshowpos) Enable/disable flags for:
- clearing plot before Update();
- showing the last mouse click position in the widget.
- Method on
mglWindow:mglPointLastMousePos () - C function:
voidmgl_get_last_mouse_pos (HMGLgr,mreal *x,mreal *y,mreal *z) Gets last position of mouse click.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on March 21, 2014 using texi2html 5.0.
