A wxGLCanvas that hosts the wx_bgi BGI drawing surface.
More...
#include <wx_bgi_canvas.h>
|
| virtual void | OnChar (wxKeyEvent &evt) |
| | Handles character input events.
|
| virtual void | OnIdle (wxIdleEvent &evt) |
| | Handles idle events for auto-refresh.
|
| virtual void | OnKeyDown (wxKeyEvent &evt) |
| | Handles key press events.
|
| virtual void | OnKeyUp (wxKeyEvent &evt) |
| | Handles key release events.
|
| virtual void | OnMouseDown (wxMouseEvent &evt) |
| | Handles mouse button press events.
|
| virtual void | OnMouseMove (wxMouseEvent &evt) |
| | Handles mouse movement over the canvas.
|
| virtual void | OnMouseUp (wxMouseEvent &evt) |
| | Handles mouse button release events.
|
| virtual void | OnMouseWheel (wxMouseEvent &evt) |
| | Handles mouse wheel events.
|
| virtual void | OnPaint (wxPaintEvent &evt) |
| | Handles paint events for the canvas.
|
| virtual void | OnSize (wxSizeEvent &evt) |
| | Handles resize events for the canvas.
|
| void | Render () |
| | Render the BGI buffer immediately.
|
| void | SetAutoRefreshHz (int hz) |
| | Enable idle-driven auto-refresh at the requested frame rate.
|
| | WxBgiCanvas (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxASCII_STR("WxBgiCanvas")) |
| | ~WxBgiCanvas () override |
|
| virtual void | PostBlit (int pageW, int pageH, int vpW, int vpH) |
| | Called AFTER wxbgi_wx_render_page_gl_vp() and all 3-D solid GL passes, but BEFORE SwapBuffers().
|
| virtual void | PreBlit (int w, int h) |
| | Called inside Render() after the GL context is current and BGI is initialised, but before the BGI pixel buffer is blitted to this canvas's OpenGL surface.
|
A wxGLCanvas that hosts the wx_bgi BGI drawing surface.
Drop this panel into any wxFrame or wxPanel. After the first paint the BGI state is initialised and you can call any BGI drawing function.
Typical usage:
wxDefaultPosition, wxSize(800, 600));
m_canvas->SetAutoRefreshHz(60);
A wxGLCanvas that hosts the wx_bgi BGI drawing surface.
Definition wx_bgi_canvas.h:32
BGI_API void BGI_CALL setbkcolor(int color)
Sets background color index used by clear operations.
BGI_API void BGI_CALL circle(int x, int y, int radius, int rb BGI_DEFAULT_ARG(0), const char *layerName BGI_DEFAULT_ARG(nullptr))
Draws a circle outline.
◆ WxBgiCanvas()
| wxbgi::WxBgiCanvas::WxBgiCanvas |
( |
wxWindow * | parent, |
|
|
wxWindowID | id = wxID_ANY, |
|
|
const wxPoint & | pos = wxDefaultPosition, |
|
|
const wxSize & | size = wxDefaultSize, |
|
|
long | style = 0, |
|
|
const wxString & | name = wxASCII_STR("WxBgiCanvas") ) |
|
explicit |
◆ ~WxBgiCanvas()
| wxbgi::WxBgiCanvas::~WxBgiCanvas |
( |
| ) |
|
|
override |
◆ OnChar()
| virtual void wxbgi::WxBgiCanvas::OnChar |
( |
wxKeyEvent & | evt | ) |
|
|
virtual |
Handles character input events.
Forwards the Unicode code point of the character to the BGI character handler, then allows wxWidgets to continue processing the event. Override this method in subclasses to implement custom character input behavior. Remember to call the base class implementation if you want to preserve the default behavior also.
- Parameters
-
| evt | Key event containing the character input information. |
◆ OnIdle()
| virtual void wxbgi::WxBgiCanvas::OnIdle |
( |
wxIdleEvent & | evt | ) |
|
|
virtual |
Handles idle events for auto-refresh.
If auto-refresh is enabled, this method checks if enough time has passed since the last render to meet the target refresh rate. If so, it triggers a refresh of the canvas. This method is called during idle time when the application is not processing other events.
- Parameters
-
◆ OnKeyDown()
| virtual void wxbgi::WxBgiCanvas::OnKeyDown |
( |
wxKeyEvent & | evt | ) |
|
|
virtual |
Handles key press events.
Forwards the key press to the BGI key handler, then allows wxWidgets to continue processing the event. Override this method in subclasses to implement custom key press behavior. Remember to call the base class implementation if you want to preserve the default behavior also.
- Parameters
-
| evt | Key event containing the key press information. |
◆ OnKeyUp()
| virtual void wxbgi::WxBgiCanvas::OnKeyUp |
( |
wxKeyEvent & | evt | ) |
|
|
virtual |
Handles key release events.
Forwards the key release to the BGI key handler, then allows wxWidgets to continue processing the event. Override this method in subclasses to implement custom key release behavior. Remember to call the base class implementation if you want to preserve the default behavior also.
- Parameters
-
| evt | Key event containing the key release information. |
◆ OnMouseDown()
| virtual void wxbgi::WxBgiCanvas::OnMouseDown |
( |
wxMouseEvent & | evt | ) |
|
|
virtual |
Handles mouse button press events.
Forwards the button press to the BGI mouse handler, then allows wxWidgets to continue processing the event. Override this method in subclasses to implement custom mouse button behavior. Remember to call the base class implementation if you want to preserve the default behavior also.
- Parameters
-
| evt | Mouse event containing the button press information. |
◆ OnMouseMove()
| virtual void wxbgi::WxBgiCanvas::OnMouseMove |
( |
wxMouseEvent & | evt | ) |
|
|
virtual |
Handles mouse movement over the canvas.
Forwards the canvas-relative mouse coordinates to the BGI mouse handler, then allows wxWidgets to continue processing the event. Override this method in subclasses to implement custom mouse behavior. Remember to call the base class implementation if you want to preserve the default behavior also.
- Parameters
-
| evt | Mouse event containing the pointer position. |
◆ OnMouseUp()
| virtual void wxbgi::WxBgiCanvas::OnMouseUp |
( |
wxMouseEvent & | evt | ) |
|
|
virtual |
Handles mouse button release events.
Forwards the button release to the BGI mouse handler, then allows wxWidgets to continue processing the event. Override this method in subclasses to implement custom mouse button behavior. Remember to call the base class implementation if you want to preserve the default behavior also.
- Parameters
-
| evt | Mouse event containing the button release information. |
◆ OnMouseWheel()
| virtual void wxbgi::WxBgiCanvas::OnMouseWheel |
( |
wxMouseEvent & | evt | ) |
|
|
virtual |
Handles mouse wheel events.
Forwards the scroll delta to the BGI scroll handler, then allows wxWidgets to continue processing the event. Override this method in subclasses to implement custom mouse wheel behavior. Remember to call the base class implementation if you want to preserve the default behavior also.
- Parameters
-
| evt | Mouse event containing the wheel rotation information. |
◆ OnPaint()
| virtual void wxbgi::WxBgiCanvas::OnPaint |
( |
wxPaintEvent & | evt | ) |
|
|
virtual |
Handles paint events for the canvas.
This method is called when the canvas needs to be repainted. It creates a wxPaintDC to prepare for drawing and then calls the Render() method to perform the actual rendering of the BGI buffer onto the canvas.
- Parameters
-
◆ OnSize()
| virtual void wxbgi::WxBgiCanvas::OnSize |
( |
wxSizeEvent & | evt | ) |
|
|
virtual |
Handles resize events for the canvas.
When the canvas is resized, this method checks if the BGI pixel buffer needs to be resized. If the new size is different from the current size, it calls wxbgi_wx_resize() to adjust the BGI buffer accordingly. Finally, it triggers a refresh of the canvas to ensure the new size is rendered.
- Parameters
-
| evt | The size event containing the new dimensions. |
◆ PostBlit()
| virtual void wxbgi::WxBgiCanvas::PostBlit |
( |
int | pageW, |
|
|
int | pageH, |
|
|
int | vpW, |
|
|
int | vpH ) |
|
inlineprotectedvirtual |
Called AFTER wxbgi_wx_render_page_gl_vp() and all 3-D solid GL passes, but BEFORE SwapBuffers().
Override in subclasses to composite overlays (concentric circles, grid, UCS axes) on top of 3-D solid geometry. Typically implemented by calling wxbgi_wx_render_overlays_for_camera() for this panel's camera.
- Parameters
-
| pageW | Logical BGI page width. |
| pageH | Logical BGI page height. |
| vpW | Physical framebuffer width (may differ on HiDPI). |
| vpH | Physical framebuffer height (may differ on HiDPI). |
◆ PreBlit()
| virtual void wxbgi::WxBgiCanvas::PreBlit |
( |
int | w, |
|
|
int | h ) |
|
inlineprotectedvirtual |
Called inside Render() after the GL context is current and BGI is initialised, but before the BGI pixel buffer is blitted to this canvas's OpenGL surface.
Override in subclasses to render a specific camera's scene into the shared BGI scratch buffer. Because wx paint events are sequential on the main thread, the scratch buffer is safe to reuse across panels.
- Parameters
-
| w | Logical pixel width of this canvas. |
| h | Logical pixel height of this canvas. |
◆ Render()
| void wxbgi::WxBgiCanvas::Render |
( |
| ) |
|
Render the BGI buffer immediately.
◆ SetAutoRefreshHz()
| void wxbgi::WxBgiCanvas::SetAutoRefreshHz |
( |
int | hz | ) |
|
Enable idle-driven auto-refresh at the requested frame rate.
- Parameters
-
| hz | Target refresh rate. Pass 0 to disable. |
The documentation for this class was generated from the following file: