00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012
00013
00014 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
00015 #pragma implementation "drawing_panel.h"
00016 #endif
00017
00018
00019 #include "wx/wxprec.h"
00020
00021 #ifdef __BORLANDC__
00022 #pragma hdrstop
00023 #endif
00024
00025 #ifndef WX_PRECOMP
00026 #include "wx/wx.h"
00027 #endif
00028 #include <wx/thread.h>
00029
00032
00033 #include "drawing_panel.h"
00034
00037
00042 IMPLEMENT_DYNAMIC_CLASS( DrawingPanel, wxPanel )
00043
00044
00048 BEGIN_EVENT_TABLE( DrawingPanel, wxPanel )
00049
00051 EVT_SIZE( DrawingPanel::OnSize )
00052 EVT_PAINT( DrawingPanel::OnPaint )
00053 EVT_ERASE_BACKGROUND( DrawingPanel::OnEraseBackground )
00054
00056
00057 END_EVENT_TABLE()
00058
00063 DrawingPanel::DrawingPanel( ): m_app_settings( NULL), m_freezed(false), m_mutex( wxMUTEX_RECURSIVE), m_scope_index( 0)
00064 {
00065 }
00066
00067 DrawingPanel::DrawingPanel( int scope_index, wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ):
00068 m_app_settings( NULL), m_freezed(false), m_mutex( wxMUTEX_RECURSIVE)
00069 {
00070 this->m_scope_index= scope_index;
00071 Create( parent, id, pos, size, style);
00072 }
00073
00074 DrawingPanel::~DrawingPanel( )
00075 {
00076 }
00081 bool DrawingPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
00082 {
00085 m_draw_left_canvas = NULL;
00086 m_draw_canvas = NULL;
00087
00089 wxPanel::Create( parent, id, pos, size, style );
00090
00091 CreateControls();
00092 if (GetSizer())
00093 {
00094 GetSizer()->SetSizeHints(this);
00095 }
00096 Centre();
00098
00099 return true;
00100 }
00101
00106 void DrawingPanel::CreateControls()
00107 {
00109
00110
00111 DrawingPanel* itemPanel1 = this;
00112
00113 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
00114 itemPanel1->SetSizer(itemBoxSizer2);
00115
00117 m_draw_left_canvas = new DrawingLeftCanvas( this->m_scope_index, itemPanel1, ID_LEFT_PANEL, wxDefaultPosition, wxSize(20, -1), wxSTATIC_BORDER|wxTAB_TRAVERSAL );
00118 itemBoxSizer2->Add(m_draw_left_canvas, 0, wxGROW|wxLEFT|wxTOP|wxBOTTOM, 2);
00119
00120 m_draw_canvas = new DrawingCanvas( this->m_scope_index, itemPanel1, ID_DRAW_PANEL, wxDefaultPosition, wxDefaultSize, wxSTATIC_BORDER|wxTAB_TRAVERSAL );
00121 itemBoxSizer2->Add(m_draw_canvas, 1, wxGROW|wxRIGHT|wxTOP|wxBOTTOM, 2);
00122
00123 }
00124
00129 bool DrawingPanel::ShowToolTips()
00130 {
00131 return true;
00132 }
00133
00138 wxBitmap DrawingPanel::GetBitmapResource( const wxString& name )
00139 {
00140
00142 wxUnusedVar(name);
00143 return wxNullBitmap;
00145 }
00146
00151 wxIcon DrawingPanel::GetIconResource( const wxString& name )
00152 {
00153
00155 wxUnusedVar(name);
00156 return wxNullIcon;
00158 }
00163 void DrawingPanel::OnPaint( wxPaintEvent& event)
00164 {
00165 event.Skip();
00166 }
00171 void DrawingPanel::OnEraseBackground( wxEraseEvent& event )
00172 {
00173 event.Skip();
00174 }
00175
00180 void DrawingPanel::OnSize( wxSizeEvent& event )
00181 {
00182 event.Skip();
00183 }
00184 void DrawingPanel:: Freeze( void)
00185 {
00186 wxMutexLocker lock( this->m_app_settings->m_mutex);
00187 this->m_freezed= true;
00188
00189 }
00190 void DrawingPanel:: RefreshBackBitmap( void)
00191 {
00192 this->m_draw_canvas->RefreshBackBitmap();
00193 }
00194
00195 void DrawingPanel:: RefreshLeftBackBitmap( void)
00196 {
00197 this->m_draw_left_canvas->RefreshBackBitmap();
00198 }