예제 #1
0
void _ns_subsample_dialog_draw_icons( NsSubsampleDialog *ssd )
   {
   HWND  wnd;
   HDC   dc;
   RECT  rc;


   wnd = GetDlgItem( ssd->dlg, IDS_SUB_LOCK_XY );
   dc  = GetDC( wnd );

   GetClientRect( wnd, &rc );

   if( ____ns_ssd_curr_fixed_all || ____ns_ssd_curr_fixed_width_height )
      DrawIcon( dc, 0, 0, LoadIcon( ssd->instance, "LOCK_ICON" ) );
   else
      FillRect( dc, &rc, ( HBRUSH )( COLOR_3DFACE + 1 ) );

   ReleaseDC( wnd, dc );

   wnd = GetDlgItem( ssd->dlg, IDS_SUB_LOCK_YZ );
   dc  = GetDC( wnd );

   GetClientRect( wnd, &rc );

   if( ____ns_ssd_curr_fixed_all )
      DrawIcon( dc, 0, 0, LoadIcon( ssd->instance, "LOCK_ICON" ) );
   else
      FillRect( dc, &rc, ( HBRUSH )( COLOR_3DFACE + 1 ) );

   ReleaseDC( wnd, dc );
   }
static int DrawiconWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
    static HICON myicon_small, myicon_large;
    HDC hdc;

    switch (message) {
    case MSG_CREATE:
        myicon_small = LoadIconFromFile(HDC_SCREEN, "myicon.ico", 0);
        if (myicon_small == 0)
            fprintf (stderr, "Load icon file failure!");
        myicon_large = LoadIconFromFile(HDC_SCREEN, "myicon.ico", 1);
        if (myicon_large == 0)
            fprintf (stderr, "Load icon file failure!");
        break;

    case MSG_PAINT:
        hdc = BeginPaint(hWnd);
        if (myicon_small != 0)
            DrawIcon(hdc, 10, 10, 0, 0, myicon_small);
        if (myicon_large != 0)
            DrawIcon(hdc, 60, 60, 0, 0, myicon_large);
        EndPaint(hWnd, hdc);
        return 0;

    case MSG_CLOSE:
        DestroyIcon(myicon_small);
        DestroyIcon(myicon_large);
        DestroyMainWindow (hWnd);
        PostQuitMessage (hWnd);
        return 0;
    }

    return DefaultMainWinProc(hWnd, message, wParam, lParam);
}
예제 #3
0
파일: ihm_main.c 프로젝트: amaury10/Pipboy
void main() {
  int x0, y0;
  int i = 0, j = 0;
  
  int receive_block;
  int image_to_draw;
  
  receive_block = -1;

  USBIP0_bit = 1;
  USBIP1_bit = 1;
  USBIP2_bit = 1;

  USBIE_bit = 1;

  EnableInterrupts();

  Start_TP();
  
  TFT_Fill_Screen(CL_WHITE);
  TFT_Set_Font(TFT_defaultFont, CL_BLACK, FO_HORIZONTAL);
  
  ClearBuffer(ReadBuffer, USB_LENGTH);
  ClearBuffer(WriteBuffer, USB_LENGTH);
  HID_Enable(ReadBuffer, &WriteBuffer);

  for(i=0; i<2; i++) {
      for(j=0; j<4; j++) {
               DrawIcon(j, i);
      }
  }
  
  while (1) {
    Check_TP();
    if (HID_Read()) {
       ClearBuffer(WriteBuffer, USB_LENGTH);
       if (strstr(ReadBuffer, "AT+SEND_IMAGE")) {
            strcpy(WriteBuffer, "READY");
            HID_Write(WriteBuffer,USB_LENGTH);
           receive_block = 0;
       }

       else if ((receive_block>=0)&&(receive_block<2048)) {
            memcpy((char *)Image_icon+receive_block, ReadBuffer, USB_LENGTH);
            strcpy(WriteBuffer, "OK");
            HID_Write(WriteBuffer,USB_LENGTH);
            receive_block+=USB_LENGTH;
       }
       
       else if (strstr(&ReadBuffer, "AT+DRAW_IMAGE=")) {
            image_to_draw = ReadBuffer[strlen("AT+DRAW_IMAGE=")]-'0';
            DrawIcon(image_to_draw%4, image_to_draw/4);
            strcpy(WriteBuffer, "OK");
            HID_Write(WriteBuffer,USB_LENGTH);
       }
    }
    ClearBuffer(&ReadBuffer, USB_LENGTH);
    if(receive_block > 2048-USB_LENGTH) receive_block = -1;
  }
}
예제 #4
0
void DemoState::DrawIcons() {
  for (size_t i = 0; i < channel_icons_.size(); ++i) {
    DrawIcon(channel_icons_[i], channel_texture_);
  }
  for (size_t i = 0; i < listener_icons_.size(); ++i) {
    DrawIcon(listener_icons_[i], listener_texture_);
  }
}
예제 #5
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : pDC - 
//			dstRect - 
//			detectErrors - 
//-----------------------------------------------------------------------------
void CMaterial::DrawBrowserIcons( CDC *pDC, RECT& dstRect, bool detectErrors )
{
	static CMaterial* pTranslucentIcon = 0;
	static CMaterial* pOpaqueIcon = 0;
	static CMaterial* pSelfIllumIcon = 0;
	static CMaterial* pBaseAlphaEnvMapMaskIcon = 0;
	static CMaterial* pErrorIcon = 0;

	if (!pTranslucentIcon)
	{
		pTranslucentIcon			= CreateMaterial("editor/translucenticon", true);
		pOpaqueIcon					= CreateMaterial("editor/opaqueicon", true);
		pSelfIllumIcon				= CreateMaterial("editor/selfillumicon", true);
		pBaseAlphaEnvMapMaskIcon	= CreateMaterial("editor/basealphaenvmapmaskicon", true);
		pErrorIcon					= CreateMaterial("editor/erroricon", true);

		Assert( pTranslucentIcon && pOpaqueIcon && pSelfIllumIcon && pBaseAlphaEnvMapMaskIcon && pErrorIcon );
	}

	bool error = false;

	IMaterial* pMaterial = GetMaterial();
	if ( pMaterial->GetMaterialVarFlag( MATERIAL_VAR_TRANSLUCENT ) )
	{
		DrawIcon( pDC, pTranslucentIcon, dstRect );
		if (detectErrors)
		{
			error = error || !m_TranslucentBaseTexture; 
		}
	}
	else
	{
		DrawIcon( pDC, pOpaqueIcon, dstRect ); 
	}

	if ( pMaterial->GetMaterialVarFlag( MATERIAL_VAR_SELFILLUM ))
	{
		DrawIcon( pDC, pSelfIllumIcon, dstRect ); 
		if (detectErrors)
		{
			error = error || !m_TranslucentBaseTexture;
		}
	}

	if ( pMaterial->GetMaterialVarFlag( MATERIAL_VAR_BASEALPHAENVMAPMASK ))
	{
		DrawIcon( pDC, pBaseAlphaEnvMapMaskIcon, dstRect ); 
		if (detectErrors)
		{
			error = error || !m_TranslucentBaseTexture;
		}
	}

	if (error)
	{
		DrawIcon( pDC, pErrorIcon, dstRect );
	}
}
예제 #6
0
void CImage::Draw()
{
    Math::Point     uv1,uv2, corner, pos, dim;
    float       dp;

    if ( (m_state & STATE_VISIBLE) == 0 )  return;

    if ( m_state & STATE_SHADOW )
    {
        DrawShadow(m_pos, m_dim);
    }

    dp = 0.5f/256.0f;

    if ( m_icon == 0 )  // hollow frame?
    {
        m_engine->SetTexture("button2.png");
        m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
        uv1.x = 160.0f / 256.0f;
        uv1.y = 192.0f / 256.0f;  // u-v texture
        uv2.x = 192.0f / 256.0f;
        uv2.y = 224.0f / 256.0f;
        uv1.x += dp;
        uv1.y += dp;
        uv2.x -= dp;
        uv2.y -= dp;
        corner.x = 10.0f / 640.0f;
        corner.y = 10.0f / 480.0f;
        DrawIcon(m_pos, m_dim, uv1, uv2, corner, 8.0f/256.0f);
    }

    if ( m_filename[0] != 0 )  // displays an image?
    {
        m_engine->LoadTexture(m_filename);
        m_engine->SetTexture(m_filename);
        m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
        pos = m_pos;
        dim = m_dim;
        pos.x +=  5.0f / 640.0f;
        pos.y +=  5.0f / 480.0f;
        dim.x -= 10.0f / 640.0f;
        dim.y -= 10.0f / 480.0f;
        uv1.x = 0.0f;
        uv1.y = 0.0f;
        uv2.x = 1.0f;
        uv2.y = 1.0f;
        DrawIcon(pos, dim, uv1, uv2);
    }
}
예제 #7
0
void OnPaint(HWND hWnd)
{
   HDC dialogDC;
   PAINTSTRUCT paint;
   RECT cRC, textRC;
   int i;
   HBRUSH hBrush;
   HPEN hPen;
   HFONT dcFont;
   COLORREF cr;
   int nch = GetWindowTextW(windowList[selectedWindow], windowText, 1023);

   dialogDC = BeginPaint(hWnd, &paint);
   {
      GetClientRect(hWnd, &cRC);
      FillRect(dialogDC, &cRC, GetSysColorBrush(COLOR_MENU));

      for(i=0; i< windowCount; i++)
      {
         HICON hIcon = iconList[i];
         
         int xpos = xOffset + 40 * (i % nCols);
         int ypos = yOffset + 40 * (i / nCols);

         if (selectedWindow == i)
         {
            hBrush = GetSysColorBrush(COLOR_HIGHLIGHT);
         }
         else
         {
            hBrush = GetSysColorBrush(COLOR_MENU);
         }
#if TRUE
         cr = GetSysColor(COLOR_BTNTEXT); // doesn't look right! >_<
         hPen = CreatePen(PS_DOT, 1, cr);
         SelectObject(dialogDC, hPen);
         SelectObject(dialogDC, hBrush);
         Rectangle(dialogDC, xpos-2, ypos-2, xpos+32+2, ypos+32+2);
         DeleteObject(hPen);
         // Must NOT destroy the system brush!
#else
         RECT rc = { xpos-2, ypos-2, xpos+32+2, ypos+32+2 };
         FillRect(dialogDC, &rc, hBrush);
#endif
         DrawIcon(dialogDC, xpos, ypos, hIcon);
      }

      dcFont = SelectObject(dialogDC, dialogFont);
      SetTextColor(dialogDC, GetSysColor(COLOR_BTNTEXT));
      SetBkColor(dialogDC, GetSysColor(COLOR_BTNFACE));

      textRC.top = itemsH;
      textRC.left = 8;
      textRC.right = totalW - 8;
      textRC.bottom = totalH - 8;
      DrawTextW(dialogDC, windowText, nch, &textRC, DT_CENTER|DT_END_ELLIPSIS);
      SelectObject(dialogDC, dcFont);
   }
   EndPaint(hWnd, &paint);
}
예제 #8
0
LRESULT WINAPI WndProc (HWND hWnd, UINT uMsg, WPARAM wp, LPARAM lp)
{
	
	switch (uMsg)
	{
		case WM_PAINT:
			PAINTSTRUCT ps;
			HDC dc = BeginPaint (hWnd, &ps);
			
			SelectObject (dc, GetStockObject (WHITE_BRUSH));
			SelectObject (dc, GetStockObject (WHITE_PEN));
			RECT rc;
			GetClientRect (hWnd, &rc);
			Rectangle (dc, rc.left, rc.top, rc.right, rc.bottom);
			DrawIcon (dc, 5, 5, _Icon);
			LPCSTR pszMsg = "Download was transferred to Free Download Manager...\nPlease use \"Back\" button to go back";
			RECT rcT = rc;
			rcT.left = 40; rcT.top = 5;
			DrawText (dc, pszMsg, lstrlen (pszMsg), &rcT, DT_LEFT | DT_TOP);
			EndPaint (hWnd, &ps);
			return 0;
		
	}

	return DefWindowProc (hWnd, uMsg, wp, lp);
}
예제 #9
0
HRESULT CDTDisplay::OnDrawAdvanced(ATL_DRAWINFO& di)
{
	// TODO: Add your specialized code here and/or call the base class
	BOOL bRunTime;
	GetAmbientUserMode(bRunTime);
	if(bRunTime)
	{//Draw Picture here Display the image data in the
		if(!m_DisplayImage.IsNull())
		{
			m_DisplayImage.Draw(di.hdcDraw,m_DrawRect,m_SrcRect);
		}
	}
	else
	{
		OLE_COLOR colorOle; 
		GetAmbientBackColor(colorOle); 
		COLORREF colorRgb; 
		::OleTranslateColor(colorOle,0,&colorRgb); 
		HBRUSH hBrush; 
		hBrush=CreateSolidBrush(colorRgb); 
		RECT& rc = *(RECT*)di.prcBounds; 
		FillRect(di.hdcDraw,&rc,hBrush); 
		DeleteObject(hBrush); 
		SetBkMode(di.hdcDraw,TRANSPARENT); 
		HICON hIcon=LoadIcon(_AtlBaseModule.GetResourceInstance(),MAKEINTRESOURCE(IDI_DISPLAY)); 
		DrawIcon(di.hdcDraw,rc.left,rc.top,hIcon); 
		DeleteObject(hIcon);
	}
	return 0;
	//return __super::OnDrawAdvanced(di);
}
예제 #10
0
static void draw_cursor(struct dc_capture *capture, HDC hdc)
{
	HICON icon;
	ICONINFO ii;
	CURSORINFO *ci = &capture->ci;

	if (!(capture->ci.flags & CURSOR_SHOWING))
		return;

	icon = CopyIcon(capture->ci.hCursor);
	if (!icon)
		return;

	if (GetIconInfo(icon, &ii)) {
		POINT pos;
		pos.x = ci->ptScreenPos.x - (int)ii.xHotspot - capture->x;
		pos.y = ci->ptScreenPos.y - (int)ii.yHotspot - capture->y;

		DrawIcon(hdc, pos.x, pos.y, icon);

		DeleteObject(ii.hbmColor);
		DeleteObject(ii.hbmMask);
	}

	DestroyIcon(icon);
}
예제 #11
0
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
    static HICON hIcon;
    static int cxIcon, cyIcon, cxClient, cyClient;
    HDC hdc;
    HINSTANCE hInstance;
    PAINTSTRUCT ps;
    int x, y;

    switch (message){
        case WM_CREATE:
            hInstance = ((LPCREATESTRUCT)lParam)->hInstance;
            hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON));
            cxIcon = GetSystemMetrics(SM_CXICON);
            cyIcon = GetSystemMetrics(SM_CYICON);
            return 0;

        case WM_SIZE:
            cxClient = LOWORD(lParam);
            cyClient = HIWORD(lParam);
            return 0;

        case WM_PAINT:
            hdc = BeginPaint(hwnd, &ps);
            for(y=0; y<cyClient; y+=cyIcon)for(x=0; x<cxClient; x+=cxIcon)
                DrawIcon(hdc, x, y, hIcon);
            EndPaint(hwnd, &ps);
            return 0;

        case WM_DESTROY:
            PostQuitMessage(0);
            return 0;
    }
    return DefWindowProc(hwnd, message, wParam, lParam);
}
예제 #12
0
파일: Pose.cpp 프로젝트: mylegacy/haiku
void
BPose::DeselectWithoutErasingBackground(BRect, BPoseView* poseView)
{
	ASSERT(poseView->ViewMode() != kListMode);
	ASSERT(!IsSelected());

	BPoint location(Location(poseView));

	// draw icon directly
	if (fPercent == -1)
		DrawIcon(location, poseView, poseView->IconSize(), true);
	else
		UpdateIcon(location, poseView);

	BColumn* column = poseView->FirstColumn();
	if (column == NULL)
		return;

	BTextWidget* widget = WidgetFor(column->AttrHash());
	if (widget == NULL || !widget->IsVisible())
		return;

	// just invalidate the background, don't draw anything
	poseView->Invalidate(widget->CalcRect(location, 0, poseView));
}
예제 #13
0
/*
 * Draws an icon at the coordinates x,y, after copying a saved bitmap back
 * onto the screen at the coordinates where the last icon was drawn and
 * saving the area under the icon to a DC in memory
 */
void DoDrawBolt( int x, int y, icon_mover * mover)
/************************************************/
{

    /*
     * to make this look fast, even on slow machines, only redraw the icon
     * when the x coordinate is a multiple of the bolt speed
     * thus if speed = 5, the icon will be redrawn every 5th pixel it moves
     */
    if( x % mover->speed != 0 ) return;

    /* if it is not the first iteration */
    if( mover->last.x != -1 || mover->last.y != -1 ) {
        /* redraw the area that the last icon covered */
        BitBlt( mover->screen_dc, mover->last.x, mover->last.y, mover->size.x,
                mover->size.y, mover->storage_dc, 0, 0, SRCCOPY);
    }

    /* save the area that will be under the icon to a DC in memory */
    BitBlt( mover->storage_dc, 0, 0, mover->size.x, mover->size.y,
            mover->screen_dc, x, y, SRCCOPY);

    DrawIcon( mover->screen_dc, x, y, mover->icon );

    /* save the coordinates for next time */
    mover->last.x = x;
    mover->last.y = y;

} /* DoDrawBolt */
예제 #14
0
void CRBookmarkMenuItem::Draw( LVDrawBuf & buf, lvRect & rc, CRRectSkinRef skin, CRRectSkinRef valueSkin, bool selected )
{
    _itemDirty = false;
    if ( !_bookmark ) {
        CRMenuItem::Draw( buf, rc, skin, valueSkin, selected );
        return;
    }
    lvRect itemBorders = skin->getBorderWidths();
    skin->draw( buf, rc );
    buf.SetTextColor( 0x000000 );
    buf.SetBackgroundColor( 0xFFFFFF );
    int imgWidth = DrawIcon( buf, rc, itemBorders );

    lvRect textRect = rc;
    textRect.left += imgWidth;
    lvRect posRect = textRect;
    lString16 text = _bookmark->getPosText();
    if ( !text.empty() ) {
        posRect.bottom = posRect.top + skin->getFont()->getHeight() + itemBorders.top + itemBorders.bottom;
        textRect.top = posRect.bottom - itemBorders.bottom;
    }
    lString16 postext(_("Page $1 ($2%)"));
    postext.replaceIntParam(1, _page+1);
    postext.replaceParam(2, lString16::itoa( _bookmark->getPercent()/100 ) << "." << fmt::decimal(_bookmark->getPercent()%100));
    postext << "  " << _bookmark->getTitleText();
    skin->drawText( buf, posRect, postext );
    if ( !text.empty() )
        valueSkin->drawText( buf, textRect, text );
}
예제 #15
0
void AddMouse(HDC hMemDC, LPRECT lpRect, HDC hScrDC, HWND hwnd) {
	POINT p;

	// GetCursorPos(&p); // get current x, y 0.008 ms
	
	CURSORINFO globalCursor;
	globalCursor.cbSize = sizeof(CURSORINFO); // could cache I guess...
	::GetCursorInfo(&globalCursor);
	HCURSOR hcur = globalCursor.hCursor;

	if(hwnd)
	  ScreenToClient(hwnd, &p); // 0.010ms
	else
	  GetCursorPos(&p);

	ICONINFO iconinfo;
	BOOL ret = ::GetIconInfo(hcur, &iconinfo); // 0.09ms

	if(ret) {
		p.x -= iconinfo.xHotspot; // align mouse, I guess...
		p.y -= iconinfo.yHotspot;

		// avoid some memory leak or other...
		if (iconinfo.hbmMask) {
			::DeleteObject(iconinfo.hbmMask);
		}
		if (iconinfo.hbmColor) {
			::DeleteObject(iconinfo.hbmColor);
		}
	}
	
	DrawIcon(hMemDC, p.x-lpRect->left, p.y-lpRect->top, hcur); // 0.042ms
}
void AGameplayDebuggingHUDComponent::DrawOverHeadInformation(APlayerController* PC, class UGameplayDebuggingComponent *DebugComponent)
{
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
	APawn* MyPawn = Cast<APawn>(DebugComponent->GetSelectedActor());
	const FVector Loc3d = MyPawn ? MyPawn->GetActorLocation() + FVector(0.f, 0.f, MyPawn->GetSimpleCollisionHalfHeight()) : FVector::ZeroVector;

	if (OverHeadContext.Canvas->SceneView == NULL || OverHeadContext.Canvas->SceneView->ViewFrustum.IntersectBox(Loc3d, FVector::ZeroVector) == false)
	{
		return;
	}

	const FVector ScreenLoc = OverHeadContext.Canvas->Project(Loc3d);
	static const FVector2D FontScale(1.f, 1.f);
	UFont* Font = GEngine->GetSmallFont();

	float TextXL = 0.f;
	float YL = 0.f;
	FString ObjectName = FString::Printf( TEXT("{yellow}%s {white}(%s)"), *DebugComponent->ControllerName, *DebugComponent->PawnName);
	CalulateStringSize(OverHeadContext, OverHeadContext.Font, ObjectName, TextXL, YL);

	bool bDrawFullOverHead = MyPawn != nullptr && GetDebuggingReplicator()->GetSelectedActorToDebug() == MyPawn;
	float IconXLocation = OverHeadContext.DefaultX;
	float IconYLocation = OverHeadContext.DefaultY;
	if (bDrawFullOverHead)
	{
		OverHeadContext.DefaultX -= (0.5f*TextXL*FontScale.X);
		OverHeadContext.DefaultY -= (1.2f*YL*FontScale.Y);
		IconYLocation = OverHeadContext.DefaultY;
		OverHeadContext.CursorX = OverHeadContext.DefaultX;
		OverHeadContext.CursorY = OverHeadContext.DefaultY;
	}

	if (DebugComponent->DebugIcon.Len() > 0)
	{
		UTexture2D* RegularIcon = (UTexture2D*)StaticLoadObject(UTexture2D::StaticClass(), NULL, *DebugComponent->DebugIcon, NULL, LOAD_NoWarn | LOAD_Quiet, NULL);
		if (RegularIcon)
		{
			FCanvasIcon Icon = UCanvas::MakeIcon(RegularIcon);
			if (Icon.Texture)
			{
				const float DesiredIconSize = bDrawFullOverHead ? 32.f : 16.f;
				DrawIcon(OverHeadContext, FColor::White, Icon, IconXLocation, IconYLocation - DesiredIconSize, DesiredIconSize / Icon.Texture->GetSurfaceWidth());
			}
		}
	}

	if (bDrawFullOverHead)
	{
		OverHeadContext.FontRenderInfo.bEnableShadow = bDrawFullOverHead;
		PrintString(OverHeadContext, bDrawFullOverHead ? FColor::White : FColor(255, 255, 255, 128), FString::Printf(TEXT("%s\n"), *ObjectName));
		OverHeadContext.FontRenderInfo.bEnableShadow = false;
	}

	if (EngineShowFlags.DebugAI)
	{
		DrawPath(PC, DebugComponent);
	}
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
}
예제 #17
0
  bool LaserScanPlugin::Initialize(QGLWidget* canvas)
  {
    canvas_ = canvas;

    DrawIcon();

    return true;
  }
예제 #18
0
WindowProcType WndProc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam) {
	if (message == WM_CREATE) {
		return 0; /* Success */
	}
	else if (message == WM_DESTROY) {
		PostQuitMessage(0);
		return 0; /* OK */
	}
	else if (message == WM_SETCURSOR) {
		if (LOWORD(lparam) == HTCLIENT) {
			SetCursor(LoadCursor(NULL,IDC_ARROW));
			return 1;
		}
		else {
			return DefWindowProc(hwnd,message,wparam,lparam);
		}
	}
	else if (message == WM_ERASEBKGND) {
		RECT um;

		if (GetUpdateRect(hwnd,&um,FALSE)) {
			HBRUSH oldBrush,newBrush;
			HPEN oldPen,newPen;

			newPen = (HPEN)GetStockObject(NULL_PEN);
			newBrush = (HBRUSH)GetStockObject(WHITE_BRUSH);

			oldPen = SelectObject((HDC)wparam,newPen);
			oldBrush = SelectObject((HDC)wparam,newBrush);

			Rectangle((HDC)wparam,um.left,um.top,um.right+1,um.bottom+1);

			SelectObject((HDC)wparam,oldBrush);
			SelectObject((HDC)wparam,oldPen);
		}

		return 1; /* Important: Returning 1 signals to Windows that we processed the message. Windows 3.0 gets really screwed up if we don't! */
	}
	else if (message == WM_PAINT) {
		RECT um;

		if (GetUpdateRect(hwnd,&um,TRUE)) {
			PAINTSTRUCT ps;

			BeginPaint(hwnd,&ps);
			TextOut(ps.hdc,0,0,HelloWorldText,strlen(HelloWorldText));
			DrawIcon(ps.hdc,5,20,AppIcon);
			EndPaint(hwnd,&ps);
		}

		return 0; /* Return 0 to signal we processed the message */
	}
	else {
		return DefWindowProc(hwnd,message,wparam,lparam);
	}

	return 0;
}
예제 #19
0
void CIconButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	CDC *pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
	CRect rectItem = lpDrawItemStruct->rcItem;

	// set up for double buffering
	CDC dcMem;
	dcMem.CreateCompatibleDC(pDC);
	CBitmap bmp;
	bmp.CreateCompatibleBitmap(pDC, rectItem.Width(), rectItem.Height());
	CBitmap *pOldBitmap = dcMem.SelectObject(&bmp);
	dcMem.SetBkMode(TRANSPARENT);

	DrawBackGround(&dcMem);

	// button state
	BOOL bDrawFocusRect = !(lpDrawItemStruct->itemState & ODS_NOFOCUSRECT);
	BOOL bIsFocused     = lpDrawItemStruct->itemState & ODS_FOCUS;
	BOOL bIsPressed		= lpDrawItemStruct->itemState & ODS_SELECTED;

	DWORD state = bIsPressed ? PBS_PRESSED : PBS_NORMAL;

	if (state == PBS_NORMAL)
	{
		if (m_bhover)
		{
			state = PBS_HOT;
		}
	}

	if(bIsPressed)
	{
		dcMem.FillSolidRect(&rectItem, RGB(0, 0, 155));
	}
	else if(bIsFocused)
	{
		dcMem.FillSolidRect(&rectItem, RGB(0, 155, 0));
	}


	if(m_hIcon)
	{
		DrawIcon(&dcMem, rectItem);
	}
	else if(m_bitmap.GetSafeHandle())
	{
		DrawBitmap(&dcMem, rectItem);
	}

	// end double buffering
	pDC->BitBlt(0, 0, rectItem.Width(), rectItem.Height(),
		&dcMem, 0, 0, SRCCOPY);

	// swap back the original bitmap
	dcMem.SelectObject(pOldBitmap);
	bmp.DeleteObject();
	dcMem.DeleteDC();
}
예제 #20
0
  bool RoutePlugin::Initialize(QGLWidget* canvas)
  {
    canvas_ = canvas;

    DrawIcon();

    initialized_ = true;
    return true;
  }
예제 #21
0
파일: WinRes.cpp 프로젝트: isongbo/MyCode
void OnPaint( HWND hWnd )
{
	PAINTSTRUCT ps = { 0 };
	HDC hdc = BeginPaint( hWnd, &ps );
	HICON hIcon = LoadIcon( g_hInstance, 
						MAKEINTRESOURCE(IDI_ICON1) );
	DrawIcon( hdc, 100, 100, hIcon );
	EndPaint( hWnd, &ps );
}
예제 #22
0
void DrawIconCentered(HDC hdc, RECT *pRect, HICON hIcon)
{

	if (NULL != pRect)
	{
		int left=pRect->left + ((pRect->right-pRect->left)-32)/2;
		int top= pRect-> top + ((pRect->bottom-pRect->top)-32)/2;
		DrawIcon(hdc, left, top, hIcon);
	}
}
예제 #23
0
파일: slider.cpp 프로젝트: BTML/colobot
void CSlider::DrawVertex(Math::Point pos, Math::Point dim, int icon)
{
    Math::Point     uv1, uv2, corner;
    float       ex, dp;

    if ( icon == 0 )
    {
        m_engine->SetTexture("textures/interface/button2.png");
        m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
        uv1.x =   0.0f/256.0f;  // yellow rectangle
        uv1.y =  32.0f/256.0f;
        uv2.x =  32.0f/256.0f;
        uv2.y =  64.0f/256.0f;
        corner.x = 2.0f/640.0f;
        corner.y = 2.0f/480.0f;
        ex = 4.0f/256.0f;
    }
    else if ( icon == 1 )
    {
        m_engine->SetTexture("textures/interface/button2.png");
        m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
        uv1.x = 128.0f/256.0f;  // gray rectangle
        uv1.y =  32.0f/256.0f;
        uv2.x = 160.0f/256.0f;
        uv2.y =  64.0f/256.0f;
        corner.x = 2.0f/640.0f;
        corner.y = 2.0f/480.0f;
        ex = 4.0f/256.0f;
    }
    else
    {
        m_engine->SetTexture("textures/interface/button2.png");
        m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
        uv1.x = 224.0f/256.0f;  // cursor
        uv1.y =  32.0f/256.0f;
        uv2.x = 256.0f/256.0f;
        uv2.y =  64.0f/256.0f;
        if ( !m_bHoriz )
        {
            uv1.y += 64.0f/256.0f;
            uv2.y += 64.0f/256.0f;
        }
        corner.x = 2.0f/640.0f;
        corner.y = 2.0f/480.0f;
        ex = 4.0f/256.0f;
    }

    dp = 0.5f/256.0f;
    uv1.x += dp;
    uv1.y += dp;
    uv2.x -= dp;
    uv2.y -= dp;

    DrawIcon(pos, dim, uv1, uv2, corner, ex);
}
예제 #24
0
파일: draglist.c 프로젝트: GYGit/reactos
/***********************************************************************
 *		DrawInsert (COMCTL32.15)
 *
 * Draws insert arrow by the side of the ListBox item in the parent window.
 *
 * RETURNS
 *      Nothing.
 */
VOID WINAPI DrawInsert (HWND hwndParent, HWND hwndLB, INT nItem)
{
    RECT rcItem, rcListBox, rcDragIcon;
    HDC hdc;
    DRAGLISTDATA * data;

    TRACE("(%p %p %d)\n", hwndParent, hwndLB, nItem);

    if (!hDragArrow)
        hDragArrow = LoadIconW(COMCTL32_hModule, (LPCWSTR)IDI_DRAGARROW);

    if (LB_ERR == SendMessageW(hwndLB, LB_GETITEMRECT, nItem, (LPARAM)&rcItem))
        return;

    if (!GetWindowRect(hwndLB, &rcListBox))
        return;

    /* convert item rect to parent co-ordinates */
    if (!MapWindowPoints(hwndLB, hwndParent, (LPPOINT)&rcItem, 2))
        return;

    /* convert list box rect to parent co-ordinates */
    if (!MapWindowPoints(HWND_DESKTOP, hwndParent, (LPPOINT)&rcListBox, 2))
        return;

    rcDragIcon.left = rcListBox.left - DRAGICON_HOTSPOT_X;
    rcDragIcon.top = rcItem.top - DRAGICON_HOTSPOT_Y;
    rcDragIcon.right = rcListBox.left;
    rcDragIcon.bottom = rcDragIcon.top + DRAGICON_HEIGHT;

    if (!GetWindowSubclass(hwndLB, DragList_SubclassWindowProc, DRAGLIST_SUBCLASSID, (DWORD_PTR*)&data))
        return;

    if (nItem < 0)
        SetRectEmpty(&rcDragIcon);

    /* prevent flicker by only redrawing when necessary */
    if (!EqualRect(&rcDragIcon, &data->last_drag_icon_rect))
    {
        /* get rid of any previous inserts drawn */
        RedrawWindow(hwndParent, &data->last_drag_icon_rect, NULL,
            RDW_INTERNALPAINT | RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);

        CopyRect(&data->last_drag_icon_rect, &rcDragIcon);

        if (nItem >= 0)
        {
            hdc = GetDC(hwndParent);

            DrawIcon(hdc, rcDragIcon.left, rcDragIcon.top, hDragArrow);

            ReleaseDC(hwndParent, hdc);
        }
    }
}
예제 #25
0
파일: scroll.cpp 프로젝트: CHmSID/colobot
void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon)
{
    Math::Point     uv1, uv2;
    float       ex, dp;

    if ( icon == 0 )
    {
        m_engine->SetTexture("textures/interface/button2.png");
        m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
        uv1.x =   0.0f/256.0f;  // yellow rectangle
        uv1.y =  32.0f/256.0f;
        uv2.x =  32.0f/256.0f;
        uv2.y =  64.0f/256.0f;
        ex = 8.0f/256.0f;
    }
    else if ( icon == 1 )
    {
        m_engine->SetTexture("textures/interface/button2.png");
        m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
        uv1.x = 128.0f/256.0f;  // gray rectangle
        uv1.y =  32.0f/256.0f;
        uv2.x = 160.0f/256.0f;
        uv2.y =  64.0f/256.0f;
        ex = 8.0f/256.0f;
    }
    else if ( icon == 2 )
    {
        m_engine->SetTexture("textures/interface/button1.png");
        m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
        uv1.x =  64.0f/256.0f;  // blue rectangle
        uv1.y =   0.0f/256.0f;
        uv2.x =  96.0f/256.0f;
        uv2.y =  32.0f/256.0f;
        ex = 8.0f/256.0f;
    }
    else
    {
        m_engine->SetTexture("textures/interface/button2.png");
        m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
        uv1.x = 104.0f/256.0f;  // blue line -
        uv1.y =  32.0f/256.0f;
        uv2.x = 128.0f/256.0f;
        uv2.y =  40.0f/256.0f;
        ex = 0.0f;
    }

    dp = 0.5f/256.0f;
    uv1.x += dp;
    uv1.y += dp;
    uv2.x -= dp;
    uv2.y -= dp;

    DrawIcon(pos, dim, uv1, uv2, ex);
}
예제 #26
0
void TicTacToeGame::DrawIconCentered(HDC hdc, RECT *pRect, HICON hIcon)
{
	const int ICON_SIZE = 32;

	if (NULL != pRect)
	{
		int left = pRect->left + ((pRect->right - pRect->left) - ICON_SIZE) / 2;
		int top = pRect->top + ((pRect->bottom - pRect->top) - ICON_SIZE) / 2;
		DrawIcon(hdc, left, top, hIcon);
	}
}
예제 #27
0
//Blits object icon to the objects square and offset "center"
//in the game area.
void DrawObject(SDL_Surface *screen, struct object *obj)
{
  SDL_Rect dest;
  dest.x = obj->location.x * TILE_WIDTH;
  dest.y = (14 - obj->location.y) * TILE_HEIGHT;
  dest.w = TILE_WIDTH - 1;
  dest.h = TILE_HEIGHT - 1;

  DrawIcon(screen, obj->icon, dest.x + obj->center.x,
	   dest.y + (TILE_HEIGHT - (1 + obj->center.y)));
}
예제 #28
0
 void RoutePlugin::SetDrawStyle(QString style)
 {
   if (style == "lines")
   {
     draw_style_ = LINES;
   }
   else if (style == "points")
   {
     draw_style_ = POINTS;
   }
   DrawIcon();
 }
예제 #29
0
void GEN::GameEngine::GameCycle()
{

	HDC   hDC;
	// Draw the snowflake icon at random positions on the game screen
	hDC = GetDC(m_hWindow);
	int iX = rand() % GetWidth();
	int iY = rand() % GetHeight();
	DrawIcon(hDC, iX, iY,
		(HICON)(WORD)GetClassLong(m_hWindow, GCL_HICON));
	ReleaseDC(m_hWindow, hDC);
}
예제 #30
0
void
ModelMenuItem::DrawContent()
{
	if (fDrawText) {
		BPoint drawPoint(ContentLocation());
		drawPoint.x += 20 + (fExtraPad ? 6 : 0);
		if (fHeightDelta > 0)
			drawPoint.y += ceil(fHeightDelta / 2);
		Menu()->MovePenTo(drawPoint);
		_inherited::DrawContent();
	}
	DrawIcon();
}