wxWidgets implementation of vgui_adaptor. More...
#include <vgui_wx_adaptor.h>
Public Member Functions | |
vgui_wx_adaptor (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxT("vgui_wx_adaptor"), int *attributes=0) | |
Constructor - used by dynamic creation. | |
virtual | ~vgui_wx_adaptor () |
Destructor. | |
void | set_view (wxView *view) |
virtual unsigned int | get_width () const |
Return width of rendering area. | |
virtual unsigned int | get_height () const |
Return height of rendering area. | |
virtual void | post_redraw () |
Redraw the rendering area. | |
virtual void | post_overlay_redraw () |
Redraws overlay buffer. | |
virtual void | post_idle_request () |
Flags that a child requests idle processing. | |
virtual void | post_message (char const *, void const *) |
***** What is this for???. | |
virtual void | post_destroy () |
Schedules destruction of parent vgui_window. | |
virtual void | post_timer (float timeout, int id) |
Sets timer 'id' to dispatch a WM_TIMER event every 'timeout' ms. | |
virtual void | kill_timer (int id) |
Stop timer 'id'. | |
virtual void | bind_popups (vgui_modifier m, vgui_button b) |
Bind the given modifier/button combination to the popup menu. | |
virtual void | get_popup_bindings (vgui_modifier &m, vgui_button &b) const |
Return the modifier/button which displayed the popup menu. | |
virtual vgui_window * | get_window () const |
***** Return window that contains this adaptor. | |
virtual void | swap_buffers () |
Swap buffers if using double buffering. | |
virtual void | make_current () |
Make this the current GL rendering context. | |
vgui_tableau_sptr | get_tableau () const |
Get the vgui_tableau associated with this vgui_adaptor. | |
void | set_tableau (vgui_tableau_sptr const &t) |
Set the vgui_tableau associated with this vgui_adaptor. | |
void | set_double_buffering (bool b) |
True to use double buffering, false to not use it. | |
vgui_menu | get_total_popup (vgui_popup_params &) const |
Return the concatenation of the adaptor's menu with the tableau's menu. | |
void | config_dialog () |
Pop up a dialog for changing the popup modifier and button bindings. | |
vgui_menu & | get_popup () |
Return the popup menu for this adaptor. | |
void | set_popup (vgui_menu const &m) |
Set the popup menu for this adaptor. | |
void | include_in_popup (vgui_menu const &m) |
Add the given menu to the popup menu for this adaptor. | |
bool | dispatch_to_tableau (vgui_event const &) |
Dispatches the given event to the tableau. | |
int | post_timer (float) |
Public Attributes | |
unsigned | width |
Cached width of adaptor render area. | |
unsigned | height |
Cached height of adaptor render area. | |
vgui_button | popup_button |
Mouse button (used with popup_modifier) which causes the popup menu to appear. | |
vgui_modifier | popup_modifier |
Modifier (used with popup_button) which causes the popup menu to appear. | |
Static Public Attributes | |
static vgui_DLLDATA vgui_adaptor * | current = 0 |
This static datum points to the adaptor that last received a mouse event. | |
Protected Attributes | |
bool | nested_popups |
Parameters controlling the popup menu style. | |
bool | default_items |
bool | use_double_buffering |
Whether or not to use double buffering. | |
Private Types | |
typedef vgui_adaptor_mixin | mixin |
Private Member Functions | |
void | on_size (wxSizeEvent &event) |
Called when canvas is resized. | |
void | on_paint (wxPaintEvent &WXUNUSED(event)) |
Called when a window needs to be repainted. | |
void | on_erase_background (wxEraseEvent &WXUNUSED(event)) |
Called when the background needs erasing (i.e., before repainting). | |
void | on_key (vgui_event &ve, wxKeyEvent &event) |
Helper used by on_key_up/down to reduce code duplication. | |
void | on_key_down (wxKeyEvent &event) |
Called when a key is pressed. | |
void | on_key_up (wxKeyEvent &event) |
Called when a key is released. | |
void | on_char (wxKeyEvent &event) |
Called when a key is pressed, but carries a translated ascii code. | |
void | on_mouse_event (wxMouseEvent &event) |
Called for all types of mouse events (e.g., button-up, motion, etc.). | |
void | on_idle (wxIdleEvent &event) |
Called when the system becomes idle. | |
void | on_close (wxCloseEvent &event) |
Called when the user tries to close a frame or dialog box. | |
void | on_timer (wxEvent &event) |
Called at fixed intervals when using a timer. | |
void | invalidate_canvas () |
Generates a wxPaintEvent for the window to be repainted. | |
Private Attributes | |
wxView * | view_ |
bool | redraw_posted_ |
True while a redraw event has been requested but not implemented. | |
bool | overlay_redraw_posted_ |
True while an overlay redraw event has been requested but not implemented. | |
bool | idle_request_posted_ |
True while an idle time has been requested but not implemented. | |
bool | destroy_posted_ |
True when destruction of parent vgui_window has been scheduled. | |
int | last_key_down_ |
vcl_map< int, int > | ascii_code_ |
Static Private Attributes | |
static vgui_menu | last_popup_ |
***** To ensure the commands stay in scope for the lifetime of the popup. |
wxWidgets implementation of vgui_adaptor.
The adaptor allows you to draw an OpenGL area in your wxWidgets application (i.e., embedding the adaptor in wxWidgets) or in a vgui application (i.e., extending the adaptor to use wxWidgets as your vgui_toolkit).
Definition at line 31 of file vgui_wx_adaptor.h.
typedef vgui_adaptor_mixin vgui_wx_adaptor::mixin [private] |
Definition at line 39 of file vgui_wx_adaptor.h.
vgui_wx_adaptor::vgui_wx_adaptor | ( | wxWindow * | parent, |
wxWindowID | id = wxID_ANY , |
||
const wxPoint & | pos = wxDefaultPosition , |
||
const wxSize & | size = wxDefaultSize , |
||
long | style = 0 , |
||
const wxString & | name = wxT("vgui_wx_adaptor") , |
||
int * | attributes = 0 |
||
) |
Constructor - used by dynamic creation.
Constructor.
Definition at line 54 of file vgui_wx_adaptor.cxx.
vgui_wx_adaptor::~vgui_wx_adaptor | ( | ) | [virtual] |
Destructor.
Definition at line 73 of file vgui_wx_adaptor.cxx.
virtual void vgui_wx_adaptor::bind_popups | ( | vgui_modifier | m, |
vgui_button | b | ||
) | [inline, virtual] |
Bind the given modifier/button combination to the popup menu.
Reimplemented from vgui_adaptor.
Definition at line 88 of file vgui_wx_adaptor.h.
void vgui_adaptor::config_dialog | ( | ) | [inherited] |
Pop up a dialog for changing the popup modifier and button bindings.
Pops up a dialog for changing the popup modifier and button bindings.
Definition at line 102 of file vgui_adaptor.cxx.
bool vgui_adaptor::dispatch_to_tableau | ( | vgui_event const & | e | ) | [inherited] |
Dispatches the given event to the tableau.
This method performs various checks which can be performed generically for all tableaux. It is not the responsibility of this method to take care of overlay handling - the derived class must sort that out.
This method performs various checks which can be performed generically for all tableaux. It is not the responsibility of this method to take care of overlay handling - the derived class must sort that out. The derived class must also ensure that the correct draw buffer is set.
Reimplemented in vgui_qt_adaptor, and vgui_qt_adaptor.
Definition at line 182 of file vgui_adaptor.cxx.
virtual unsigned int vgui_wx_adaptor::get_height | ( | ) | const [inline, virtual] |
Return height of rendering area.
Implements vgui_adaptor.
Definition at line 64 of file vgui_wx_adaptor.h.
vgui_menu& vgui_adaptor::get_popup | ( | ) | [inline, inherited] |
Return the popup menu for this adaptor.
Reimplemented in vgui_mfc_adaptor, vgui_qt_adaptor, vgui_qt_adaptor, vgui_gtk2_adaptor, and vgui_gtk_adaptor.
Definition at line 75 of file vgui_adaptor.h.
virtual void vgui_wx_adaptor::get_popup_bindings | ( | vgui_modifier & | m, |
vgui_button & | b | ||
) | const [inline, virtual] |
Return the modifier/button which displayed the popup menu.
Reimplemented from vgui_adaptor.
Definition at line 95 of file vgui_wx_adaptor.h.
vgui_tableau_sptr vgui_adaptor::get_tableau | ( | ) | const [inherited] |
Get the vgui_tableau associated with this vgui_adaptor.
Get the vgui_tableau associated with this adaptor.
Definition at line 64 of file vgui_adaptor.cxx.
vgui_menu vgui_adaptor::get_total_popup | ( | vgui_popup_params & | params | ) | const [inherited] |
Return the concatenation of the adaptor's menu with the tableau's menu.
Returns concatenation of the adaptor's menu with the tableau's menu.
Definition at line 78 of file vgui_adaptor.cxx.
virtual unsigned int vgui_wx_adaptor::get_width | ( | ) | const [inline, virtual] |
Return width of rendering area.
Implements vgui_adaptor.
Definition at line 61 of file vgui_wx_adaptor.h.
virtual vgui_window* vgui_wx_adaptor::get_window | ( | ) | const [inline, virtual] |
***** Return window that contains this adaptor.
Reimplemented from vgui_adaptor.
Definition at line 102 of file vgui_wx_adaptor.h.
void vgui_adaptor::include_in_popup | ( | vgui_menu const & | m | ) | [inline, inherited] |
Add the given menu to the popup menu for this adaptor.
Definition at line 81 of file vgui_adaptor.h.
void vgui_wx_adaptor::invalidate_canvas | ( | void | ) | [private] |
Generates a wxPaintEvent for the window to be repainted.
Definition at line 437 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::kill_timer | ( | int | id | ) | [virtual] |
Stop timer 'id'.
Reimplemented from vgui_adaptor.
Definition at line 154 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::make_current | ( | ) | [virtual] |
Make this the current GL rendering context.
Reimplemented from vgui_adaptor.
Definition at line 166 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::on_char | ( | wxKeyEvent & | event | ) | [private] |
Called when a key is pressed, but carries a translated ascii code.
To catch this event after a key_down has been caught, call event.skip() from the on_key_down handler. Note that the char event is always generated after the key_down event in wxWidgets.
Definition at line 314 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::on_close | ( | wxCloseEvent & | event | ) | [private] |
Called when the user tries to close a frame or dialog box.
The event can be generated programmatically or when the user tries to close using the window manager (X) or system menu (Windows).
Definition at line 416 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::on_erase_background | ( | wxEraseEvent & | WXUNUSEDevent | ) | [private] |
Called when the background needs erasing (i.e., before repainting).
Definition at line 225 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::on_idle | ( | wxIdleEvent & | event | ) | [private] |
Called when the system becomes idle.
Definition at line 400 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::on_key | ( | vgui_event & | ve, |
wxKeyEvent & | event | ||
) | [private] |
Helper used by on_key_up/down to reduce code duplication.
Definition at line 232 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::on_key_down | ( | wxKeyEvent & | event | ) | [private] |
Called when a key is pressed.
Definition at line 267 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::on_key_up | ( | wxKeyEvent & | event | ) | [private] |
Called when a key is released.
Definition at line 289 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::on_mouse_event | ( | wxMouseEvent & | event | ) | [private] |
Called for all types of mouse events (e.g., button-up, motion, etc.).
Definition at line 335 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::on_paint | ( | wxPaintEvent & | WXUNUSEDevent | ) | [private] |
Called when a window needs to be repainted.
Definition at line 196 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::on_size | ( | wxSizeEvent & | event | ) | [private] |
Called when canvas is resized.
Definition at line 187 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::on_timer | ( | wxEvent & | event | ) | [private] |
Called at fixed intervals when using a timer.
Definition at line 428 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::post_destroy | ( | void | ) | [virtual] |
Schedules destruction of parent vgui_window.
Reimplemented from vgui_adaptor.
Definition at line 119 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::post_idle_request | ( | void | ) | [virtual] |
Flags that a child requests idle processing.
Reimplemented from vgui_adaptor.
Definition at line 102 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::post_message | ( | char const * | , |
void const * | |||
) | [virtual] |
***** What is this for???.
Reimplemented from vgui_adaptor.
Definition at line 113 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::post_overlay_redraw | ( | void | ) | [virtual] |
void vgui_wx_adaptor::post_redraw | ( | void | ) | [virtual] |
Redraw the rendering area.
Implements vgui_adaptor.
Definition at line 82 of file vgui_wx_adaptor.cxx.
void vgui_wx_adaptor::post_timer | ( | float | timeout, |
int | id | ||
) | [virtual] |
Sets timer 'id' to dispatch a WM_TIMER event every 'timeout' ms.
Sets timer 'id' to dispatch a vgui_TIMER event every 'timeout' ms.
Reimplemented from vgui_adaptor.
Definition at line 148 of file vgui_wx_adaptor.cxx.
int vgui_adaptor::post_timer | ( | float | t | ) | [inherited] |
Definition at line 266 of file vgui_adaptor.cxx.
void vgui_adaptor::set_double_buffering | ( | bool | b | ) | [inline, inherited] |
True to use double buffering, false to not use it.
Definition at line 66 of file vgui_adaptor.h.
void vgui_adaptor::set_popup | ( | vgui_menu const & | m | ) | [inline, inherited] |
Set the popup menu for this adaptor.
Definition at line 78 of file vgui_adaptor.h.
void vgui_adaptor::set_tableau | ( | vgui_tableau_sptr const & | t | ) | [inherited] |
Set the vgui_tableau associated with this vgui_adaptor.
Set the vgui_tableau associated with this adaptor.
Definition at line 71 of file vgui_adaptor.cxx.
void vgui_wx_adaptor::set_view | ( | wxView * | view | ) | [inline] |
Definition at line 54 of file vgui_wx_adaptor.h.
void vgui_wx_adaptor::swap_buffers | ( | ) | [virtual] |
Swap buffers if using double buffering.
Reimplemented from vgui_adaptor.
Definition at line 160 of file vgui_wx_adaptor.cxx.
vcl_map<int,int> vgui_wx_adaptor::ascii_code_ [private] |
Definition at line 175 of file vgui_wx_adaptor.h.
vgui_adaptor * vgui_adaptor::current = 0 [static, inherited] |
This static datum points to the adaptor that last received a mouse event.
It is set to zero if its pointer receives a LEAVE event. It will often point to the adaptor which was current when a popup menu was triggered, which is often what one wants it for.
Definition at line 93 of file vgui_adaptor.h.
bool vgui_adaptor::default_items [protected, inherited] |
Definition at line 143 of file vgui_adaptor.h.
bool vgui_wx_adaptor::destroy_posted_ [private] |
True when destruction of parent vgui_window has been scheduled.
Definition at line 172 of file vgui_wx_adaptor.h.
unsigned vgui_adaptor_mixin::height [inherited] |
Cached height of adaptor render area.
Definition at line 29 of file vgui_adaptor_mixin.h.
bool vgui_wx_adaptor::idle_request_posted_ [private] |
True while an idle time has been requested but not implemented.
Definition at line 169 of file vgui_wx_adaptor.h.
int vgui_wx_adaptor::last_key_down_ [private] |
Definition at line 174 of file vgui_wx_adaptor.h.
vgui_menu vgui_wx_adaptor::last_popup_ [static, private] |
***** To ensure the commands stay in scope for the lifetime of the popup.
Definition at line 160 of file vgui_wx_adaptor.h.
bool vgui_adaptor::nested_popups [protected, inherited] |
Parameters controlling the popup menu style.
These are put onto a popup_params object and passed to tableau::get_popup()
Definition at line 142 of file vgui_adaptor.h.
bool vgui_wx_adaptor::overlay_redraw_posted_ [private] |
True while an overlay redraw event has been requested but not implemented.
Definition at line 166 of file vgui_wx_adaptor.h.
vgui_button vgui_adaptor_mixin::popup_button [inherited] |
Mouse button (used with popup_modifier) which causes the popup menu to appear.
Definition at line 34 of file vgui_adaptor_mixin.h.
vgui_modifier vgui_adaptor_mixin::popup_modifier [inherited] |
Modifier (used with popup_button) which causes the popup menu to appear.
Definition at line 36 of file vgui_adaptor_mixin.h.
bool vgui_wx_adaptor::redraw_posted_ [private] |
True while a redraw event has been requested but not implemented.
Definition at line 163 of file vgui_wx_adaptor.h.
bool vgui_adaptor::use_double_buffering [protected, inherited] |
Whether or not to use double buffering.
Definition at line 146 of file vgui_adaptor.h.
wxView* vgui_wx_adaptor::view_ [private] |
Definition at line 158 of file vgui_wx_adaptor.h.
unsigned vgui_adaptor_mixin::width [inherited] |
Cached width of adaptor render area.
Definition at line 27 of file vgui_adaptor_mixin.h.