wxImagePanel.cpp
Go to the documentation of this file.
00001 
00008 #include "gui/wxImagePanel.h"
00009 #include <ros/ros.h>
00010 
00011 namespace GUI_PTU {
00012 
00013 BEGIN_EVENT_TABLE(wxImagePanel, wxPanel)
00014 /*
00015  EVT_MOTION(wxImagePanel::mouseMoved)
00016  EVT_LEFT_DOWN(wxImagePanel::mouseDown)
00017  EVT_LEFT_UP(wxImagePanel::mouseReleased)
00018  EVT_RIGHT_DOWN(wxImagePanel::rightClick)
00019  EVT_LEAVE_WINDOW(wxImagePanel::mouseLeftWindow)
00020  EVT_KEY_DOWN(wxImagePanel::keyPressed)
00021  EVT_KEY_UP(wxImagePanel::keyReleased)
00022  EVT_MOUSEWHEEL(wxImagePanel::mouseWheelMoved)
00023  */
00024 
00025 // catch paint events
00026 EVT_PAINT(wxImagePanel::paintEvent)
00027 
00028 END_EVENT_TABLE()
00029 
00030 wxImagePanel::wxImagePanel(
00031                 wxWindow* parent) :
00032         wxPanel(parent)
00033 {
00034         SetSize(wxSize(640, 480));
00035         image = new wxBitmap(640, 480, -1);
00036 }
00037 
00038 /*
00039  * Called by the system of by wxWidgets when the panel needs
00040  * to be redrawn. You can also trigger this call by
00041  * calling Refresh()/Update().
00042  */
00043 
00044 void wxImagePanel::paintEvent(wxPaintEvent & evt)
00045 {
00046     // depending on your system you may need to look at double-buffered dcs
00047     wxPaintDC dc(this);
00048     render(dc);
00049 }
00050 
00051 /*
00052  * Alternatively, you can use a clientDC to paint on the panel
00053  * at any time. Using this generally does not free you from
00054  * catching paint events, since it is possible that e.g. the window
00055  * manager throws away your drawing when the window comes to the
00056  * background, and expects you will redraw it when the window comes
00057  * back (by sending a paint event).
00058  */
00059 void wxImagePanel::paintNow()
00060 {
00061     // depending on your system you may need to look at double-buffered dcs
00062     wxClientDC dc(this);
00063     render(dc);
00064 }
00065 
00066 /*
00067  * Here we do the actual rendering. I put it in a separate
00068  * method so that it can work no matter what type of DC
00069  * (e.g. wxPaintDC or wxClientDC) is used.
00070  */
00071 void wxImagePanel::render(wxDC&  dc)
00072 {
00073     dc.DrawBitmap( *image, 0, 0, false );
00074 }
00075 
00076 void wxImagePanel::setImage(wxBitmap* image) {
00077         delete this->image;
00078         this->image = image;
00079 }
00080 
00081 }


asr_flir_ptu_driver
Author(s): Valerij Wittenbeck, Joachim Gehrung, Pascal Meißner, Patrick Schlosser
autogenerated on Thu Jun 6 2019 21:16:45