wxImagePanel.cpp
Go to the documentation of this file.
1 
8 #include "gui/wxImagePanel.h"
9 #include <ros/ros.h>
10 
11 namespace GUI_PTU {
12 
13 BEGIN_EVENT_TABLE(wxImagePanel, wxPanel)
14 /*
15  EVT_MOTION(wxImagePanel::mouseMoved)
16  EVT_LEFT_DOWN(wxImagePanel::mouseDown)
17  EVT_LEFT_UP(wxImagePanel::mouseReleased)
18  EVT_RIGHT_DOWN(wxImagePanel::rightClick)
19  EVT_LEAVE_WINDOW(wxImagePanel::mouseLeftWindow)
20  EVT_KEY_DOWN(wxImagePanel::keyPressed)
21  EVT_KEY_UP(wxImagePanel::keyReleased)
22  EVT_MOUSEWHEEL(wxImagePanel::mouseWheelMoved)
23  */
24 
25 // catch paint events
26 EVT_PAINT(wxImagePanel::paintEvent)
27 
28 END_EVENT_TABLE()
29 
31  wxWindow* parent) :
32  wxPanel(parent)
33 {
34  SetSize(wxSize(640, 480));
35  image = new wxBitmap(640, 480, -1);
36 }
37 
38 /*
39  * Called by the system of by wxWidgets when the panel needs
40  * to be redrawn. You can also trigger this call by
41  * calling Refresh()/Update().
42  */
43 
44 void wxImagePanel::paintEvent(wxPaintEvent & evt)
45 {
46  // depending on your system you may need to look at double-buffered dcs
47  wxPaintDC dc(this);
48  render(dc);
49 }
50 
51 /*
52  * Alternatively, you can use a clientDC to paint on the panel
53  * at any time. Using this generally does not free you from
54  * catching paint events, since it is possible that e.g. the window
55  * manager throws away your drawing when the window comes to the
56  * background, and expects you will redraw it when the window comes
57  * back (by sending a paint event).
58  */
60 {
61  // depending on your system you may need to look at double-buffered dcs
62  wxClientDC dc(this);
63  render(dc);
64 }
65 
66 /*
67  * Here we do the actual rendering. I put it in a separate
68  * method so that it can work no matter what type of DC
69  * (e.g. wxPaintDC or wxClientDC) is used.
70  */
71 void wxImagePanel::render(wxDC& dc)
72 {
73  dc.DrawBitmap( *image, 0, 0, false );
74 }
75 
76 void wxImagePanel::setImage(wxBitmap* image) {
77  delete this->image;
78  this->image = image;
79 }
80 
81 }
void setImage(wxBitmap *image)
void paintEvent(wxPaintEvent &evt)
Definition: GUI.h:41
void render(wxDC &dc)


asr_flir_ptu_driver
Author(s): Valerij Wittenbeck, Joachim Gehrung, Pascal Mei├čner, Patrick Schlosser
autogenerated on Mon Dec 2 2019 03:15:17