95 : m_created( false ), m_initialSize( clientSize ), m_resizing( false ), m_completedFirstRender( false ), m_renderTimer( this, ID_RENDERTIMER ), m_resizeRenderDelay( resizeRenderDelay_ms )
100#ifdef wxUSE_GRAPHICS_CONTEXT
152 int width = WXWINDOW::GetClientSize().GetWidth();
153 int height = WXWINDOW::GetClientSize().GetHeight();
155 wxPaintDC paintDc(
this );
164 paintDc.SetBackground( wxBrush( m_canvasColour ) );
169 paintDc.Blit( 0, 0, width, height, m_memoryDc, 0, 0 );
175 bool needResize = width != m_bitmap.GetWidth() || height != m_bitmap.GetHeight();
178 m_bitmap.Create( width, height, 32 );
181 m_memoryDc =
new wxMemoryDC;
182 m_memoryDc->SelectObject( m_bitmap );
183 wxDC *drawDc = m_memoryDc;
184#ifdef wxUSE_GRAPHICS_CONTEXT
185 if ( m_useGraphicsContext )
189 m_gcDc =
new wxGCDC( *m_memoryDc );
194 m_stream.SetDC( drawDc );
195 drawDc->SetBackground( wxBrush( m_canvasColour ) );
198 m_stream.SetSize( width, height );
201 paintDc.Blit( 0, 0, width, height, m_memoryDc, 0, 0 );
203 if ( width > 0 && height > 0 )
204 m_completedFirstRender =
true;
220 int width = WXWINDOW::GetClientSize().GetWidth();
221 int height = WXWINDOW::GetClientSize().GetHeight();
222 int oldWidth = m_bitmap.IsOk() ? m_bitmap.GetWidth() : 0;
223 int oldHeight = m_bitmap.IsOk() ? m_bitmap.GetHeight() : 0;
224 if ( !m_completedFirstRender || ( m_resizeRenderDelay == 0 ) ||
225 ( width == oldWidth && height == oldHeight ) )
240 if ( width > oldWidth )
241 WXWINDOW::RefreshRect( wxRect( width, 0, width - oldWidth, height ) );
242 if ( height > oldHeight )
243 WXWINDOW::RefreshRect( wxRect( 0, oldHeight, oldWidth, height - oldHeight ) );
246 m_renderTimer.Start( m_resizeRenderDelay,
true );
271 if ( m_initialSize != wxDefaultSize )
272 WXWINDOW::SetClientSize( m_initialSize );
274 int width = WXWINDOW::GetClientSize().GetWidth();
275 int height = WXWINDOW::GetClientSize().GetHeight();
276 m_bitmap.Create( width, height );
279 m_memoryDc =
new wxMemoryDC;
280 m_memoryDc->SelectObject( m_bitmap );
281 wxDC * drawDc = m_memoryDc;
282#ifdef wxUSE_GRAPHICS_CONTEXT
283 if ( m_useGraphicsContext )
287 m_gcDc =
new wxGCDC( *m_memoryDc );
291 if ( !m_stream.IsValid() )
294 m_stream.SetDC( drawDc );
295 drawDc->SetBackground( wxBrush( m_canvasColour ) );
318 wxPoint cursorPosition =
event.GetPosition();
319 wxSize clientSize = WXWINDOW::GetClientSize();
321 graphicsIn.
pX = cursorPosition.x;
322 graphicsIn.
pY = cursorPosition.y;
323 graphicsIn.
dX =
PLFLT( cursorPosition.x + 0.5 ) /
PLFLT( clientSize.GetWidth() );
324 graphicsIn.
dY = 1.0 -
PLFLT( cursorPosition.y + 0.5 ) /
PLFLT( clientSize.GetHeight() );
326 graphicsIn.
state = 0;
329 graphicsIn.
string[0] =
'\0';
330 if ( event.LeftUp() )
335 else if ( event.MiddleUp() )
340 else if ( event.RightUp() )
345 else if ( event.Aux1Up() )
350 else if ( event.Aux2Up() )
360 graphicsIn.
state = 0;
364 if ( wxGetKeyState( WXK_SHIFT ) )
366 if ( wxGetKeyState( WXK_CAPITAL ) )
368 if ( wxGetKeyState( WXK_ALT ) && wxGetKeyState( WXK_CONTROL ) )
370 else if ( wxGetKeyState( WXK_CONTROL ) )
372 else if ( wxGetKeyState( WXK_ALT ) )
374 if ( wxGetKeyState( WXK_NUMLOCK ) )
376 if ( wxGetKeyState( WXK_SCROLL ) )
381 m_stream.translatecursor( &graphicsIn );
382 this->OnLocate( graphicsIn );