Beispiel #1
0
LRESULT TaskSortFieldSelector::WndProc(unsigned int msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
	case WM_ERASEBKGND:
		return OnEraseBackground(wParam);
	case WM_KEYDOWN:
		if(wParam == VK_ESCAPE)
		{
			ShowWindow(m_hwnd, SW_HIDE);
		}
		break;
	case WM_CREATE:
        OnCreate();
        break;
	case WM_MOUSEMOVE:
		OnMouseMove(wParam, lParam);
		break;
	case WM_MOUSELEAVE:
		if(hilite > -1)
		{
			hilite = -1;
			InvalidateRect(m_hwnd, NULL, FALSE);
		}
		m_bTrackMouse = false;
		break;
	case WM_LBUTTONDOWN:
		OnMouseLDown(wParam, lParam);
		break;
	case WM_LBUTTONUP:
		OnMouseLUp(wParam, lParam);
		break;
	case WM_SHOWWINDOW:
		OnShow(wParam, lParam);
		break;
	case WM_PRINTCLIENT:
		{
			RECT r = { 0, 0, 0, 0 };
			GetClientRect(m_hwnd, &r);
            PaintBuffer(m_hwnd, reinterpret_cast<HDC>(wParam), r.right, r.bottom);
		}
		break;
/*	case WM_VSCROLL:
		OnScroll(wParam, lParam);
		break;
    case WM_SIZE:
        OnSize();
        break;
    case WM_DESTROY:
        OnDestroy();
        break;
    case WM_CLOSE:
        if(m_ref > 2)break; */
    default:
        return DefWindowProc(m_hwnd, msg, wParam, lParam);
    }
    return 0;
}
void wxGISDisplay::Clear()
{
    wxCriticalSectionLocker locker(m_CritSect);

    wxCHECK_RET(m_saLayerCaches.size() - m_nLastCacheID == m_nSysCacheCount, wxT("Draw caches inconsistent"));

    if (m_saLayerCaches.size() > m_nSysCacheCount)
    {
	    for(size_t i = 1; i <= m_nLastCacheID; ++i)
	    {
		    cairo_destroy(m_saLayerCaches[i].pCairoContext);
		    cairo_surface_destroy(m_saLayerCaches[i].pCairoSurface);
	    }
        m_saLayerCaches.erase(m_saLayerCaches.begin() + 1, m_saLayerCaches.end() - (m_nSysCacheCount - 1));
    }

	//default map bounds
	m_RealBounds.MinX = ENVMIN_X;
	m_RealBounds.MaxX = ENVMAX_X;
	m_RealBounds.MinY = ENVMIN_Y;
	m_RealBounds.MaxY = ENVMAX_Y;
	m_CurrentBounds = m_RealBounds;

	SetEnvelopeRatio(m_CurrentBounds, m_dFrameRatio);
	m_CurrentBoundsRotated = m_CurrentBounds;
	m_dRotatedBoundsCenterX = m_CurrentBoundsRotated.MinX + (m_CurrentBoundsRotated.MaxX - m_CurrentBoundsRotated.MinX) / 2;
	m_dRotatedBoundsCenterY = m_CurrentBoundsRotated.MinY + (m_CurrentBoundsRotated.MaxY - m_CurrentBoundsRotated.MinY) / 2;

	m_CurrentBoundsX8 = m_CurrentBounds;
	IncreaseEnvelope(m_CurrentBoundsX8, 8);

	m_nLastCacheID = 0;
	m_nCurrentLayer = 0;
	m_dAngleRad = 0;
	cairo_matrix_init(m_pMatrix, 1, 0, 0, 1, 0, 0);
	cairo_matrix_init(m_pDisplayMatrix, 1, 0, 0, 1, 0, 0);
	cairo_matrix_init(m_pDisplayMatrixNoRotate, 1, 0, 0, 1, 0, 0);

	m_bZeroCacheSet = false;

    InitTransformMatrix();
	OnEraseBackground();
}
void wxGISDisplay::ClearCache(size_t nCacheId)
{
	wxCriticalSectionLocker locker(m_CritSect);
    if (nCacheId == 0)
    {
        return OnEraseBackground();
    }
    else
    {
        cairo_save(m_saLayerCaches[nCacheId].pCairoContext);

        cairo_matrix_t mat = { 1, 0, 0, 1, 0, 0 };
        cairo_set_matrix(m_saLayerCaches[nCacheId].pCairoContext, &mat);


        cairo_set_source_surface(m_saLayerCaches[nCacheId].pCairoContext, m_saLayerCaches[nCacheId - 1].pCairoSurface, 0, 0);
        cairo_set_operator(m_saLayerCaches[nCacheId].pCairoContext, CAIRO_OPERATOR_SOURCE);
        cairo_paint(m_saLayerCaches[nCacheId].pCairoContext);

        cairo_restore(m_saLayerCaches[nCacheId].pCairoContext);
    }
}
//---------------------------------------------------------------------
// ClientWindowProc(): 
//---------------------------------------------------------------------
LRESULT WPPALLETE::ClientWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{              
   // Process window message.               
   switch (uMsg)
   {
      case WM_CREATE:
         // Store the window handle for use later.
         SetHandle(hWnd);
         // Let notebook object know that create message is being processed.
         // NOTE: Here is where folder objects have a chance to animate
         //       the zoom effect for window creation.
         OnCreate();
         // Return success so we can continue with the creation of window.
         return ((LRESULT)0);
         
      case WM_ACTIVATE:
         OnActivate(((wParam==WA_INACTIVE)? TRUE : FALSE));
         return (TRUE);
            
      case WM_COMMAND:            
         OnCommand((HWND)LOWORD(lParam),HIWORD(lParam));
         break;
                          
      case WM_SYSCOMMAND:
         // A system command has been requested.
         OnSysCommand((WORD)wParam,lParam);
         break;
         
      case WM_SETTEXT:     
         // Set new window caption text.
         DefWindowProc(hWnd,uMsg,wParam,lParam);
         // Update window caption.
         OnNCPaint();
         break;  
         
      case WM_QUERYDRAGICON:
         return (OnQueryDragIcon());

      case WM_ERASEBKGND:
         OnEraseBackground((HDC)wParam);
         break;
         
      case WM_PAINT:
         OnPaint();
         break;

      case WM_NCACTIVATE: 
         // Handle this message ONLY if the non-client area is becoming active OR
         // the window becoming active or inactive is not a notebook page (modeless dialog).
         // else, do not update non-client area to prevent flickering effect with 
         // notebook window caption.
         OnNCActivate((BOOL)wParam);
         return (TRUE);
           
      case WM_NCPAINT:         
         OnNCPaint();
         return (NULL);
         
      case WM_NCMOUSEMOVE:
         OnNCMouseMove((WORD)wParam,MAKEPOINT(lParam));
         break;
         
      case WM_NCLBUTTONUP:       
      case WM_NCLBUTTONDOWN:
         OnNCLButton(uMsg,(WORD)wParam,MAKEPOINT(lParam));
         break;
         
      case WM_MOUSEMOVE:
         OnMouseMove();
         break;
                   
      case WM_MOVE:
         OnMove(MAKEPOINT(lParam));
         break;                      
                                                              
      case WM_SIZE: 
         OnSize((WORD)wParam,LOWORD(lParam),HIWORD(lParam));
         break;
                    
      case WM_CLOSE:        
         OnClose();
         break;
    
      default:                              
         // Call the default window procedure.
         return (DefWindowProc(hWnd,uMsg,wParam,lParam));
  }                           
                                              
  // We are done processing the window message...                                              
  return (NULL);
}
//---------------------------------------------------------------------
// ClientWindowProc():
//---------------------------------------------------------------------
LRESULT WPNOTEBOOK::ClientWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
   // Process window message.
   switch (uMsg)
   {
      case WM_CREATE:
         // Store the window handle for use later.
         SetHandle(hWnd);
         // Let notebook object know that create message is being processed.
         // NOTE: Here is where folder objects have a chance to animate
         //       the zoom effect for window creation.
         OnCreate();
         // Return success so we can continue with the creation of window.
         return ((LRESULT)0);

      case WM_ACTIVATE:
         OnActivate(((wParam==WA_INACTIVE)? TRUE : FALSE));
         return (TRUE);

      // We don't want the client area to have the focus, since it
      // doesn't accept input.  When it gets the focus, which it will
      // when the window is restored from a minimized state, for
      // instance, post a user message to ourselves to reset the
      // focus to the notebook.  Posting the message is necessary
      // because the focus shouldn't be tampered with when processing
      // a WM_SETFOCUS or WM_KILLFOCUS message.
      case WM_SETFOCUS:
         PostMessage(hWnd,WM_WPS_NOTEBOOK_SETFOCUS,0,0L);
         break;

      case WM_WPS_NOTEBOOK_SETFOCUS:
         // Give focus to notebook control in our client area.
         SetFocus(GetDlgItem(hWnd,IDC_NOTEBOOK));
         break;

      case WM_COMMAND:
         if (wParam==IDC_NOTEBOOK)
            OnCommand((HWND)LOWORD(lParam),HIWORD(lParam));
         break;

      case WM_SYSCOMMAND:
         // A system command has been requested.
         OnSysCommand((WORD)wParam,lParam);
         break;

      case WM_SETTEXT:
         // Set new window caption text.
         DefWindowProc(hWnd,uMsg,wParam,lParam);
         // Update window caption.
         OnNCPaint();
         break;

      case WM_QUERYDRAGICON:
         return (OnQueryDragIcon());

      case WM_ERASEBKGND:
         OnEraseBackground((HDC)wParam);
         break;

      case WM_NCACTIVATE:
         // Handle this message ONLY if the non-client area is becoming active OR
         // the window becoming active or inactive is not a notebook page (modeless dialog).
         // else, do not update non-client area to prevent flickering effect with
         // notebook window caption.
         if ((((BOOL)wParam)==TRUE)||(IsPageWindow((HWND)LOWORD(lParam))==FALSE))
            OnNCActivate((BOOL)wParam);
         return (TRUE);

      case WM_NCPAINT:
         OnNCPaint();
         return (NULL);

      case WM_NCMOUSEMOVE:
         OnNCMouseMove((WORD)wParam,MAKEPOINT(lParam));
         break;

      case WM_NCLBUTTONUP:
      case WM_NCLBUTTONDOWN:
         OnNCLButton(uMsg,(WORD)wParam,MAKEPOINT(lParam));
         break;

      case WM_MOUSEMOVE:
         OnMouseMove();
         break;

      case WM_MOVE:
         OnMove(MAKEPOINT(lParam));
         break;

      case WM_SIZE:
         OnSize((WORD)wParam,LOWORD(lParam),HIWORD(lParam));
         break;

      case WM_CLOSE:
         OnClose();
         break;

      default:
         // Call the default window procedure.
         return (DefWindowProc(hWnd,uMsg,wParam,lParam));
  }

  // We are done processing the window message...
  return (NULL);
}
Beispiel #6
0
LRESULT GenericWindow::HandleMessage (UINT msg, WPARAM wParam, LPARAM lParam) {
	switch (msg) {	
	case WM_MOUSEMOVE:
		if (!m_flagMouseTracking) {
			// register for mouse out message (TME_LEAVE)
			TRACKMOUSEEVENT trackMouseEvent;
			trackMouseEvent.cbSize = sizeof (trackMouseEvent);
			trackMouseEvent.dwFlags = TME_LEAVE;
			trackMouseEvent.dwHoverTime = 0;
			trackMouseEvent.hwndTrack = GetHandle ();
			m_flagMouseTracking = ::TrackMouseEvent (&trackMouseEvent);
		}
		OnMouseMove (0, -1, LOWORD(lParam), HIWORD(lParam));
		break;

	case WM_MOUSELEAVE:
		OnMouseLeave ();
		m_flagMouseTracking = FALSE;
		break;

	case WM_LBUTTONDOWN:
		OnMouseDown (0, 0, LOWORD(lParam), HIWORD(lParam));
		break;

	case WM_LBUTTONUP:
		OnMouseUp (0, 0, LOWORD(lParam), HIWORD(lParam));
		break;

	case WM_RBUTTONDOWN:
		OnMouseDown (0, 1, LOWORD(lParam), HIWORD(lParam));
		break;

	case WM_RBUTTONUP:
		OnMouseUp (0, 1, LOWORD(lParam), HIWORD(lParam));
		OnContextMenu ( );
		break;

	case WM_ERASEBKGND:
		// we'll erase the background during the WM_PAINT message as necessary
		// to support dynamic background color for views
		// return FALSE to indicate we didn't erase the background here.
		return FALSE;

	case WM_PAINT: 
		{
			PAINTSTRUCT ps;
			HDC hdc = ::BeginPaint (m_hWnd, &ps);

			// erase the background if required
			if (ps.fErase) {
				OnEraseBackground (hdc, ps);
				ps.fErase = FALSE;
			}

			OnPaint (hdc, ps);

			::EndPaint (m_hWnd, &ps);
		}
		break;

	case WM_CHAR:
		OnKeyPress ( (int)wParam, LOWORD(lParam) );
		break;

	case WM_KEYDOWN:
		OnKeyDown ( (int)wParam );
		break;

	case WM_KEYUP:
		OnKeyUp ( (int)wParam );
		break;

	case WM_NCDESTROY:
		OnPreDestroy ();
		m_hWnd = NULL;
		break;

	case WM_DESTROY:
		OnDestroy ();
		if (m_isMainWnd) {
			// ::MessageBox (0, _T("callling PostQuitMessage(0)"), _T(""), 0);
			::PostQuitMessage (0);
		}
		break;

	case WM_SIZE:
		{
			int cx, cy;
			cx = LOWORD(lParam);
			cy = HIWORD(lParam);
			OnResize (cx, cy);
		}
		break;

	case WM_SETFOCUS:
		OnGotFocus ();
		break;

	case WM_KILLFOCUS:
		OnLostFocus ();
		break;

	case WM_COMMAND:
		OnCommand ( LOWORD(wParam) );
		break;

	case WM_CONTEXTMENU:
		OnContextMenu ( );
		break;

	case WM_CLOSE:
		{
			BOOL cancel = FALSE;
			OnClose (cancel);
			if (cancel == FALSE) 
				DestroyWindow (m_hWnd);
		}
		break;

	case WM_DROPFILES:
		OnDropFiles ((HDROP)wParam);
		break;

	default:
		return ::DefWindowProc (m_hWnd, msg, wParam, lParam);
	}

	return 0;
}
Beispiel #7
0
BOOL CSonicSkin::OnWndMsg(UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
	case WM_DRAWITEM:
		{
			return OnDrawItem((LPDRAWITEMSTRUCT)lParam);
		}
		break;
	case WM_CTLCOLORSTATIC:
		{
			return OnCtlColorStatic((HDC)wParam, (HWND)lParam);
		}
		break;
	case WM_CTLCOLORBTN:
		{
			return OnCtlColorBtn((HDC)wParam, (HWND)lParam);
		}
		break;
	case WM_LBUTTONDBLCLK:
		{
			int x = LOWORD(lParam);
			int y = HIWORD(lParam);
			if(y < m_bg.wTitleHeight)
			{
				SendMessage(m_hWnd, WM_NCLBUTTONDBLCLK, HTCAPTION, 0);
				return FALSE;
			}
		}
		break;
	case WM_LBUTTONDOWN:
		{
			int x = LOWORD(lParam);
			int y = HIWORD(lParam);
			if(y < m_bg.wTitleHeight && m_bg.bEnableDrag)
			{
				SendMessage(m_hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);
				return FALSE;
			}
		}
		break;
	case WM_NCHITTEST:
		{
			return OnNCHittest(LOWORD(lParam), HIWORD(lParam));
		}
		break;
	// assure the none-border window wont override the tray bar
	case WM_GETMINMAXINFO:
		{
			return OnGetMinMaxInfo((MINMAXINFO *)lParam);
		}
		break;
	case WM_WINDOWPOSCHANGING:
		{
			return OnPosChanging((LPWINDOWPOS)lParam);
		}
		break;
	case WM_WINDOWPOSCHANGED:
		{
			return OnPosChanged((LPWINDOWPOS)lParam);
		}
		break;
	case WM_ERASEBKGND:
		{
			return OnEraseBackground((HDC)wParam);
		}
		break;
	// erase NC paint
	case WM_NCACTIVATE:
		g_UI.SetCallWndProcRet(TRUE);
		return FALSE;
	case WM_NCPAINT:
		SetRgn();
	case WM_NCCALCSIZE:
		g_UI.SetCallWndProcRet(0);
		return FALSE;
	}
	return TRUE;
}
Beispiel #8
0
void CExtAviLabel::DoPaint( CDC * pDC, CRect & rcClient )
{
	ASSERT_VALID( this );
CSize sizeClient = rcClient.Size();
	if( sizeClient.cx <= 0 || sizeClient.cy <= 0 )
		return;
	if( ! ::RectVisible( pDC->GetSafeHdc(), &rcClient ) )
		return;
CExtMemoryDC dc( pDC, &rcClient );
CRgn rgnClient;
	if( rgnClient.CreateRectRgnIndirect( &rcClient ) )
		dc.SelectClipRgn( &rgnClient );
	OnEraseBackground( dc, rcClient );
	if( ( ! AviIsEmpty() ) && ( m_bSeek || m_bPlaying || ( ( ! m_bPlaying ) && ( ( AviStyleGet() & __EXT_AVI_EMPTY_BACKGROUND_ON_STOP ) == 0 ) ) ) )
	{
//		OnAviPaintCurrentFrame( dc, rcClient, m_sizeAvi );
		DWORD dwWndStyle = GetStyle();
		DWORD dwWndType = (dwWndStyle&SS_TYPEMASK);
		bool bCenterImage = ( (dwWndStyle&SS_CENTERIMAGE) != 0 );
		e_ImageMode_t eImageMode = GetImageMode();
		if( eImageMode == eStretch )
		{
			CSize sizeAvi = rcClient.Size();
			OnAviPaintCurrentFrame( dc, rcClient, sizeAvi );
		}
		else if( eImageMode == eTouchInside || eImageMode == eTouchOutside )
		{
			CRect rcTouchSurface = rcClient;
			CExtMemoryDC dcTouch( &dc, rcTouchSurface, CExtMemoryDC::MDCOPT_TO_MEMORY|CExtMemoryDC::MDCOPT_FILL_BITS|CExtMemoryDC::MDCOPT_RTL_COMPATIBILITY );
			if( dcTouch.GetSafeHdc() )
			{
				CSize sizeTouchSrc = rcTouchSurface.Size();
				CSize sizeBmp = m_sizeAvi;
				double lfAspectX = double(rcTouchSurface.Width())  / double(sizeBmp.cx);
				double lfAspectY = double(rcTouchSurface.Height()) / double(sizeBmp.cy);
				double lfAspect = ( eImageMode == eTouchInside ) ? ( min( lfAspectX, lfAspectY ) ) : ( max( lfAspectX, lfAspectY ) );
				CSize sizeNew( LONG(double(sizeBmp.cx)*lfAspect), LONG(double(sizeBmp.cy)*lfAspect) );
				CRect rcTouchDst( rcTouchSurface.left, rcTouchSurface.top, rcTouchSurface.left + sizeNew.cx, rcTouchSurface.top + sizeNew.cy );
				if( eImageMode == eTouchInside )
				{
					if( sizeNew.cx > sizeTouchSrc.cx )
						rcTouchDst.OffsetRect( ( sizeNew.cx - sizeTouchSrc.cx ) / 2, 0 );
					if( sizeNew.cy > sizeTouchSrc.cy )
						rcTouchDst.OffsetRect( 0, ( sizeNew.cy - sizeTouchSrc.cy ) / 2 );
				}
				else
				{
					rcTouchDst.OffsetRect( - ( sizeNew.cx - sizeTouchSrc.cx ) / 2, 0 );
					rcTouchDst.OffsetRect( 0, - ( sizeNew.cy - sizeTouchSrc.cy ) / 2 );
				}
				CSize sizeAvi = rcTouchDst.Size();
				OnAviPaintCurrentFrame( dcTouch, rcTouchDst, sizeAvi );
			}
		}
		else if( eImageMode == eTile )
		{
			UINT nStepCountH = sizeClient.cx / m_sizeAvi.cx + ( ( sizeClient.cx % m_sizeAvi.cx ) ? 1 : 0 );
			UINT nStepCountV = sizeClient.cy / m_sizeAvi.cy + ( ( sizeClient.cy % m_sizeAvi.cy ) ? 1 : 0 );
			if( nStepCountH > 0 && nStepCountV > 0 )
			{
				UINT nStepIndexH, nStepIndexV;
				for( nStepIndexV = 0; nStepIndexV < nStepCountV; nStepIndexV ++ )
				{
					CRect rcWalk( rcClient.TopLeft(), m_sizeAvi );
					rcWalk.OffsetRect( 0, m_sizeAvi.cy * nStepIndexV );
					for( nStepIndexH = 0; nStepIndexH < nStepCountH; nStepIndexH ++ )
					{
						if( ::RectVisible( dc.GetSafeHdc(), &rcWalk ) )
							OnAviPaintCurrentFrame( dc, rcWalk, m_sizeAvi );
						rcWalk.OffsetRect( m_sizeAvi.cx, 0 );
					}
				}
			}
		}
		else if( eImageMode == eAlign )
		{
			CRect rcDst( rcClient.left, rcClient.top, rcClient.left + m_sizeAvi.cx, rcClient.top + m_sizeAvi.cy );
			bool bCenterHorizontally = false;
			switch( dwWndType )
			{
			case SS_RIGHT:  rcDst.OffsetRect( rcClient.right - rcDst.right, 0 ); break;
			case SS_CENTER: bCenterHorizontally = true;        break;
			default: /* all the other types assumed as left */ break;
			}
			if( bCenterHorizontally )
				rcDst.OffsetRect( ( (rcClient.right - rcClient.left) - (rcDst.right - rcDst.left) ) / 2, 0 );
			if( bCenterImage )
				rcDst.OffsetRect( 0, ( (rcClient.bottom - rcClient.top) - (rcDst.bottom - rcDst.top) ) / 2 );
			OnAviPaintCurrentFrame( dc, rcDst, m_sizeAvi );
		}
	}
	PmBridge_GetPM()->OnPaintSessionComplete( this );
	if( rgnClient.GetSafeHandle() != NULL )
		dc.SelectClipRgn( &rgnClient );	
}
Beispiel #9
0
void CExtLabel::DoPaint( CDC * pDC, CRect & rcClient )
{
	ASSERT_VALID( this );
	ASSERT_VALID( pDC );
CExtMemoryDC dc( pDC, &rcClient );
CRgn rgnClient;
	if( rgnClient.CreateRectRgnIndirect( &rcClient ) )
		dc.SelectClipRgn( &rgnClient );
	OnEraseBackground( dc, rcClient );
DWORD dwWndStyle = GetStyle();
DWORD dwWndType = (dwWndStyle&SS_TYPEMASK);
bool bCenterImage = ( (dwWndStyle&SS_CENTERIMAGE) != 0 );
	if( ! m_bmp.IsEmpty() )
	{
		bool bSmootherAsPossible = true;
		e_ImageMode_t eImageMode = GetImageMode();
		if( eImageMode == eStretch )
			m_bmp.AlphaBlendSkinParts( dc.GetSafeHdc(), rcClient, CRect(0,0,0,0), CExtBitmap::__EDM_STRETCH, true, bSmootherAsPossible );
		else if( eImageMode == eTouchInside || eImageMode == eTouchOutside )
		{
			CRect rcTouchSurface = rcClient;
			CExtMemoryDC dcTouch( &dc, rcTouchSurface, CExtMemoryDC::MDCOPT_TO_MEMORY|CExtMemoryDC::MDCOPT_FILL_BITS|CExtMemoryDC::MDCOPT_RTL_COMPATIBILITY );
			if( dcTouch.GetSafeHdc() )
			{
				CSize sizeTouchSrc = rcTouchSurface.Size();
				CSize sizeBmp = m_bmp.GetSize();
				double lfAspectX = double(rcTouchSurface.Width())  / double(sizeBmp.cx);
				double lfAspectY = double(rcTouchSurface.Height()) / double(sizeBmp.cy);
				double lfAspect = ( eImageMode == eTouchInside ) ? ( min( lfAspectX, lfAspectY ) ) : ( max( lfAspectX, lfAspectY ) );
				CSize sizeNew( LONG(double(sizeBmp.cx)*lfAspect), LONG(double(sizeBmp.cy)*lfAspect) );
				CRect rcTouchDst( rcTouchSurface.left, rcTouchSurface.top, rcTouchSurface.left + sizeNew.cx, rcTouchSurface.top + sizeNew.cy );
				if( eImageMode == eTouchInside )
				{				
					if( sizeNew.cx > sizeTouchSrc.cx )
						rcTouchDst.OffsetRect( ( sizeNew.cx - sizeTouchSrc.cx ) / 2, 0 );
					if( sizeNew.cy > sizeTouchSrc.cy )
						rcTouchDst.OffsetRect( 0, ( sizeNew.cy - sizeTouchSrc.cy ) / 2 );
				}
				else
				{
					rcTouchDst.OffsetRect( - ( sizeNew.cx - sizeTouchSrc.cx ) / 2, 0 );
					rcTouchDst.OffsetRect( 0, - ( sizeNew.cy - sizeTouchSrc.cy ) / 2 );
				}
				INT nOldStretchBltMode = bSmootherAsPossible ? ( ::GetStretchBltMode( dcTouch.m_hDC ) ) : ( COLORONCOLOR ) ;
				if( bSmootherAsPossible )
					::SetStretchBltMode( dcTouch.m_hDC, ( g_PaintManager.m_bIsWinNT ) ? HALFTONE : COLORONCOLOR );
				m_bmp.AlphaBlend( dcTouch.m_hDC, rcTouchDst );
				if( bSmootherAsPossible )
					::SetStretchBltMode( dcTouch.m_hDC, nOldStretchBltMode );
			}
		}
		else if( eImageMode == eTile )
			m_bmp.AlphaBlendSkinParts(  dc.GetSafeHdc(), rcClient, CRect(0,0,0,0), CExtBitmap::__EDM_TILE, true, bSmootherAsPossible );
		else if( eImageMode == eAlign )
		{
			CSize szSize = m_bmp.GetSize();
			CRect rcDst( rcClient.left, rcClient.top, rcClient.left + szSize.cx, rcClient.top + szSize.cy );
			bool bCenterHorizontally = false;
			switch( dwWndType )
			{
			case SS_RIGHT:  rcDst.OffsetRect( rcClient.right - rcDst.right, 0 ); break;
			case SS_CENTER: bCenterHorizontally = true;        break;
			default: /* all the other types assumed as left */ break;
			}
			if( bCenterHorizontally )
				rcDst.OffsetRect( ( (rcClient.right - rcClient.left) - (rcDst.right - rcDst.left) ) / 2, 0 );
			if( bCenterImage )
				rcDst.OffsetRect( 0, ( (rcClient.bottom - rcClient.top) - (rcDst.bottom - rcDst.top) ) / 2 );
			CRect rcSrc( 0, 0, szSize.cx, szSize.cy );
			rcDst.top = max( rcDst.top, rcClient.top );
			rcDst.left = max( rcDst.left, rcClient.left );
			rcDst.bottom = min( rcDst.bottom, rcClient.bottom );
			rcDst.right = min( rcDst.right, rcClient.right );
			if( ::RectVisible( dc.GetSafeHdc(), &rcDst ) )
			{
				INT nOldStretchBltMode = bSmootherAsPossible ? ( ::GetStretchBltMode( dc.m_hDC ) ) : ( COLORONCOLOR );
				if( bSmootherAsPossible )
					::SetStretchBltMode( dc.m_hDC, ( g_PaintManager.m_bIsWinNT ) ? HALFTONE : COLORONCOLOR );
				m_bmp.AlphaBlend( dc.m_hDC, rcDst, rcSrc );
				if( bSmootherAsPossible )
					::SetStretchBltMode( dc.m_hDC, nOldStretchBltMode );
			}
		}
	}
	else if( dwWndType == SS_ICON )
	{
		HICON hIcon = GetIcon();
		if( hIcon != NULL )
		{
			CExtCmdIcon _icon;
			_icon.AssignFromHICON( hIcon, true );
			CSize szIcon = _icon.GetSize();
			int nOffsetX = bCenterImage ? (rcClient.Width() - szIcon.cx) / 2 : 0;
			int nOffsetY = bCenterImage ? (rcClient.Height() - szIcon.cy) / 2 : 0;
			_icon.Paint(
				PmBridge_GetPM(), dc.GetSafeHdc(), rcClient.left + nOffsetX, rcClient.top + nOffsetY, -1, -1,
				IsWindowEnabled() ? CExtCmdIcon::__PAINT_NORMAL : CExtCmdIcon::__PAINT_DISABLED
				);
		}
	}
	else
	{
		CExtSafeString strText;
		int nTextLen = GetWindowTextLength();
		if( nTextLen > 0 )
		{
			GetWindowText( strText.GetBuffer( nTextLen + 2 ), nTextLen + 1 );
			strText.ReleaseBuffer();
		}
		if( strText.GetLength() > 0 )
		{
			DWORD dwDrawTextFlags = 0;
			switch( dwWndType )
			{
			case SS_RIGHT:           dwDrawTextFlags = DT_RIGHT;  break; 
			case SS_CENTER:          dwDrawTextFlags = DT_CENTER; break;
			case SS_LEFTNOWORDWRAP:  dwDrawTextFlags = DT_LEFT;   break;
			default: /* all the other types assumed as left */ dwDrawTextFlags = DT_LEFT; break;
			} // switch( dwWndType )
			if( strText.Find( _T('\t') ) != -1 ) // do tabs expanding
				dwDrawTextFlags |= DT_EXPANDTABS;
			if(		(dwWndType == SS_SIMPLE)
				||	(dwWndStyle&(SS_CENTERIMAGE|SS_ENDELLIPSIS|SS_PATHELLIPSIS)) != 0
				)
			{
				dwDrawTextFlags |= DT_SINGLELINE;
				if( (dwWndStyle&SS_CENTERIMAGE) != 0 )
					dwDrawTextFlags |= DT_VCENTER;
				if( (dwWndStyle&SS_ENDELLIPSIS) != 0 )
					dwDrawTextFlags |= DT_END_ELLIPSIS;
				if( (dwWndStyle&SS_PATHELLIPSIS) != 0 )
					dwDrawTextFlags |= DT_PATH_ELLIPSIS;
			}
			else
				dwDrawTextFlags |= DT_WORDBREAK;
			if( dwWndType == SS_LEFTNOWORDWRAP )
				dwDrawTextFlags &= ~(DT_WORDBREAK|DT_SINGLELINE);
			if( (dwWndStyle&SS_NOPREFIX) != 0 )
				dwDrawTextFlags |= DT_NOPREFIX;
			bool bEnabled = IsWindowEnabled() ? true : false;
			OnDrawLabelText( dc, rcClient, strText, dwDrawTextFlags, bEnabled );
		} // if( strText.GetLength() > 0 )
	}
	PmBridge_GetPM()->OnPaintSessionComplete( this );
	if( rgnClient.GetSafeHandle() != NULL )
		dc.SelectClipRgn( &rgnClient );	
}