Beispiel #1
0
void DisplayTwoDigits (HDC hdc, int iNumber, BOOL fSuppress)
{
	if (!fSuppress || (iNumber / 10 != 0))
		DisplayDigit (hdc, iNumber / 10) ;
	OffsetWindowOrgEx (hdc, -42, 0, NULL) ;
	DisplayDigit (hdc, iNumber % 10) ;
	OffsetWindowOrgEx (hdc, -42, 0, NULL) ;
}
Beispiel #2
0
LRESULT CAddressBand::OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
{
    POINT                                   pt;
    POINT                                   ptOrig;
    HWND                                    parentWindow;
    LRESULT                                 result;

    if (fGoButtonShown == false)
    {
        bHandled = FALSE;
        return 0;
    }
    pt.x = 0;
    pt.y = 0;
    parentWindow = GetParent();
    ::MapWindowPoints(m_hWnd, parentWindow, &pt, 1);
    OffsetWindowOrgEx(reinterpret_cast<HDC>(wParam), pt.x, pt.y, &ptOrig);
    result = SendMessage(parentWindow, WM_ERASEBKGND, wParam, 0);
    SetWindowOrgEx(reinterpret_cast<HDC>(wParam), ptOrig.x, ptOrig.y, NULL);
    if (result == 0)
    {
        bHandled = FALSE;
        return 0;
    }
    return result;
}
Beispiel #3
0
/***********************************************************************
 *           OffsetWindowOrgEx    (GDI.477)
 */
BOOL16 WINAPI OffsetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
{
    POINT pt32;
    BOOL16 ret = OffsetWindowOrgEx( hdc, x, y, &pt32 );
    if (pt) CONV_POINT32TO16( &pt32, pt );
    return ret;
}
Beispiel #4
0
void DisplayColon(HDC hdc) {
	POINT ptColon[2][4] = { 2,  21,  6,  17,  10, 21,  6, 25,
		2,  51,  6,  47, 10, 51,  6, 55 };

	Polygon(hdc, ptColon[0], 4);
	Polygon(hdc, ptColon[1], 4);

	OffsetWindowOrgEx(hdc, -12, 0, NULL);
}
void uCheckBox::OnPaint() 
{
	CDC MemDC, TmpDC;
	CRect rect;
	CBitmap *pMemOldBitmap, *pTmpOld, bm, *pSrcBitmap;

	RECT DstRect;
	POINT pt = {0, 0};

	CPaintDC dc(this); // device context for painting

	// Draw

	// Get Size of Display area
    GetClientRect(rect);

    // Create memory DCs
    if (!TmpDC.CreateCompatibleDC(&dc)) return;
	MemDC.CreateCompatibleDC(&dc);
	bm.CreateCompatibleBitmap(&dc, rect.Width(), rect.Height());
	pMemOldBitmap = (CBitmap*) MemDC.SelectObject(&bm);

	CopyRect(&DstRect, &Size);

	// Draw Transparency
		MapWindowPoints(pParentWindow, &pt, 1);
		OffsetWindowOrgEx(MemDC.m_hDC, pt.x, pt.y, &pt);
		::SendMessage(pParentWindow->m_hWnd, WM_ERASEBKGND, (WPARAM) MemDC.m_hDC, 0);
		SetWindowOrgEx(MemDC.m_hDC, pt.x, pt.y, NULL);

	// Draw Lamp
	CopyRect(&DstRect, &LmpRect);
	pSrcBitmap = (State & UC_STATE_CHECKED) ? &bmpOn : &bmpOff;
	pTmpOld = (CBitmap*) TmpDC.SelectObject(pSrcBitmap);
	MemDC.BitBlt(EXPANDRECTWH(DstRect), &TmpDC, 0, 0, SRCCOPY);
	
/*
	char Caption[MAX_LABEL_STRING];
	int tcount = GetWindowText(Caption, MAX_LABEL_STRING);
	if (tcount) 
	{
		// Draw Text
		MemDC.SelectObject(uCore->GetFont((Style & ULS_FONTMASK) >> ULS_FONTSHIFT));
		MemDC.SetBkMode(TRANSPARENT);
		MemDC.SetTextColor(CaptionColor);
		MemDC.DrawText(Caption, tcount, &DstRect, Style & ULS_TEXT_MASK);
	}
*/

	dc.BitBlt(/*EXPANDRECTWH(DstRect)*/ 0, 0, rect.Width(), rect.Height(), &MemDC, 0, 0, SRCCOPY);
	
	TmpDC.SelectObject(pTmpOld);
	MemDC.SelectObject(pMemOldBitmap);

	// Do not call CWnd::OnPaint() for painting messages
}
Beispiel #6
0
void track_bar_impl::draw_background (HDC dc, const RECT * rc) const
{
    HWND wnd_parent = GetParent(get_wnd());
    POINT pt = {0, 0}, pt_old = {0,0};
    MapWindowPoints(get_wnd(), wnd_parent, &pt, 1);
    OffsetWindowOrgEx(dc, pt.x, pt.y, &pt_old);
    if (SendMessage(wnd_parent, WM_ERASEBKGND,(WPARAM)dc, 0) == FALSE)
        SendMessage(wnd_parent, WM_PRINTCLIENT,(WPARAM)dc, PRF_ERASEBKGND);
    SetWindowOrgEx(dc, pt_old.x, pt_old.y, 0);
}
Beispiel #7
0
void AtlZeroOrigin(ATL_DRAWINFO& di)
{
	RECT& rc = *(RECT*)di.prcBounds;

	// Quit if already zero origin
	if (rc.left==0 && rc.top==0)
		return;

	OffsetWindowOrgEx(di.hdcDraw, -rc.left, -rc.top, NULL);
	OffsetRect(&rc, -rc.left, -rc.top);
}
Beispiel #8
0
static LRESULT
PAGER_EraseBackground (PAGER_INFO* infoPtr, HDC hdc)
{
    POINT pt, ptorig;
    HWND parent;

    pt.x = 0;
    pt.y = 0;
    parent = GetParent(infoPtr->hwndSelf);
    MapWindowPoints(infoPtr->hwndSelf, parent, &pt, 1);
    OffsetWindowOrgEx (hdc, pt.x, pt.y, &ptorig);
    SendMessageW (parent, WM_ERASEBKGND, (WPARAM)hdc, 0);
    SetWindowOrgEx (hdc, ptorig.x, ptorig.y, 0);

    return 0;
}
LRESULT WINAPI container_window::window_proc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
{
	container_window * p_this;
	
	if(msg == WM_NCCREATE)
	{
		LPVOID * create_params = reinterpret_cast<LPVOID *>(((CREATESTRUCT *)(lp))->lpCreateParams);
		p_this = reinterpret_cast<container_window *>(create_params[0]); //retrieve pointer to class
		SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG_PTR)p_this);//store it for future use
		if (p_this) p_this->wnd_host = wnd;
		
	}
	else
		p_this = reinterpret_cast<container_window*>(GetWindowLongPtr(wnd,GWLP_USERDATA));//if isnt wm_create, retrieve pointer to class
	
	if (p_this && p_this->get_class_data().want_transparent_background)
	{
		if (msg == WM_ERASEBKGND)
		{
			HDC dc = (HDC)wp;
			
			if (dc)
			{
				HWND wnd_parent = GetParent(wnd);
				POINT pt = {0, 0}, pt_old = {0,0};
				MapWindowPoints(wnd, wnd_parent, &pt, 1);
				OffsetWindowOrgEx(dc, pt.x, pt.y, &pt_old);
				SendMessage(wnd_parent, WM_ERASEBKGND,wp, 0);
				SetWindowOrgEx(dc, pt_old.x, pt_old.y, 0);
			}
			return TRUE;
		}
		else if (msg==WM_WINDOWPOSCHANGING && p_this)
		{
			HWND meh_lazy = GetWindow(wnd, GW_CHILD);
			RedrawWindow(meh_lazy, 0, 0, RDW_ERASE);
		}
	}
	
	return p_this ? p_this->on_message(wnd, msg, wp, lp) : DefWindowProc(wnd, msg, wp, lp);
}
Beispiel #10
0
/***********************************************************************
 *           OffsetWindowOrg    (GDI.15)
 */
DWORD WINAPI OffsetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
{
    POINT pt;
    if (!OffsetWindowOrgEx( hdc, x, y, &pt )) return 0;
    return MAKELONG( pt.x, pt.y );
}
LRESULT WINAPI container_window::window_proc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
{
	container_window * p_this;
	
	if(msg == WM_NCCREATE)
	{
		LPVOID * create_params = reinterpret_cast<LPVOID *>(((CREATESTRUCT *)(lp))->lpCreateParams);
		p_this = reinterpret_cast<container_window *>(create_params[0]); //retrieve pointer to class
		SetWindowLongPtr(wnd, GWL_USERDATA, (LPARAM)p_this);//store it for future use
		if (p_this)
		{
			p_this->get_class_data().refcount++;
			p_this->wnd_host = wnd;
		}
		
	}
	else
		p_this = reinterpret_cast<container_window*>(GetWindowLongPtr(wnd,GWL_USERDATA));//if isnt wm_nccreate, retrieve pointer to class

	if (msg == WM_NCDESTROY)
	{
		if (p_this)
		{
			p_this->get_class_data().refcount--;
			p_this->wnd_host = NULL;
		}
	}
	
	if (p_this && p_this->get_class_data().want_transparent_background)
	{
		if (msg == WM_ERASEBKGND)
		{			
			HDC dc = (HDC)wp;

			HWND wnd_parent = GetParent(wnd);
			POINT pt = {0, 0}, pt_old = {0,0};
			MapWindowPoints(wnd, wnd_parent, &pt, 1);
			OffsetWindowOrgEx(dc, pt.x, pt.y, &pt_old);
			BOOL b_ret = SendMessage(wnd_parent, WM_ERASEBKGND,wp, 0);
			SetWindowOrgEx(dc, pt_old.x, pt_old.y, 0);

			return b_ret;
		}
		else if (msg==WM_MOVE || msg==WM_SIZE)
		{
			RedrawWindow(wnd, 0, 0, RDW_ERASE|RDW_INVALIDATE|RDW_ALLCHILDREN);
		}
	}

	if ( msg == WM_SETTINGCHANGE && p_this && p_this->get_class_data().forward_system_settings_change)
	{
		win32_helpers::send_message_to_direct_children(wnd, msg, wp, lp);
	}
	else if ( msg == WM_SYSCOLORCHANGE && p_this && p_this->get_class_data().forward_system_colours_change)
	{
		win32_helpers::send_message_to_direct_children(wnd, msg, wp, lp);
	}
	else if ( msg == WM_TIMECHANGE && p_this && p_this->get_class_data().forward_system_time_change)
	{
		win32_helpers::send_message_to_direct_children(wnd, msg, wp, lp);
	}
	
	return p_this ? p_this->on_message(wnd, msg, wp, lp) : uDefWindowProc(wnd, msg, wp, lp);
}
Beispiel #12
0
void DisplayBlank(HDC hdc)
{
	OffsetWindowOrgEx (hdc, -12, 0, NULL) ;
}