Exemple #1
0
BOOL CResizableDialog::OnEraseBkgnd(CDC* pDC) 
{
	// Windows XP doesn't like clipping regions ...try this!
	EraseBackground(pDC);
	return TRUE;

/*	ClipChildren(pDC);	// old-method (for safety)

	return CDialog::OnEraseBkgnd(pDC);
*/
}
Exemple #2
0
// Draws the background, major and minor grids, and the frame
void	CXYChart::DrawPlotBasics( CDC *pDC, CRect destRect, CRect plotRect )
{
	// Erase the background using parent function
	EraseBackground( pDC, destRect );

	// Draw the grids using the parent function
	DrawMajorMinorGrids( pDC, plotRect );

	// Draw the frame using the parent function
	DrawFrame( pDC, plotRect );
}
Exemple #3
0
LRESULT Suggestions::WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch ( msg )
    {
        //case WM_SIZE: DoSize(); break;
        case WM_NEWGRIDTEXT: SuggestFirstStartingWith(*(std::string*)lParam); break;
        case WM_KEYDOWN: KeyDown(wParam); break;
        case WM_ERASEBKGND: EraseBackground((HDC)wParam); break;
        default: return ClassWindow::WndProc(hWnd, msg, wParam, lParam); break;
    }
    return 0;
}
Exemple #4
0
bool wxWindow::DoDrawBackground(wxDC& dc)
{
    wxRect rect;

    wxSize size = GetSize();  // Why not GetClientSize() ?
    rect.x = 0;
    rect.y = 0;
    rect.width = size.x;
    rect.height = size.y;

    wxWindow * const parent = GetParent();
    if ( HasTransparentBackground() && !UseBgCol() && parent )
    {
        // DirectFB paints the parent first, then its child windows, so by
        // the time this code is called, parent's background was already
        // drawn and there's no point in (imperfectly!) duplicating the work
        // here:
#ifndef __WXDFB__
        wxASSERT( !IsTopLevel() );

        wxPoint pos = GetPosition();

        AdjustForParentClientOrigin( pos.x, pos.y, 0 );

        // Adjust DC logical origin
        wxCoord org_x, org_y, x, y;
        dc.GetLogicalOrigin( &org_x, &org_y );
        x = org_x + pos.x;
        y = org_y + pos.y;
        dc.SetLogicalOrigin( x, y );

        // Adjust draw rect
        rect.x = pos.x;
        rect.y = pos.y;

        // Let parent draw the background
        parent->EraseBackground( dc, rect );

        // Restore DC logical origin
        dc.SetLogicalOrigin( org_x, org_y );
#endif // !__WXDFB__
    }
    else
    {
        // Draw background ourselves
        EraseBackground( dc, rect );
    }

    return true;
}
Exemple #5
0
bool wxWindow::DoDrawBackground(wxDC& dc)
{
    wxRect rect;

    wxSize size = GetSize();  // Why not GetClientSize() ?
    rect.x = 0;
    rect.y = 0;
    rect.width = size.x;
    rect.height = size.y;

    wxWindow * const parent = GetParent();
    if ( HasTransparentBackground() && parent )
    {
        wxASSERT( !IsTopLevel() );

        wxPoint pos = GetPosition();

        AdjustForParentClientOrigin( pos.x, pos.y, 0 );

        // Adjust DC logical origin
        wxCoord org_x, org_y, x, y;
        dc.GetLogicalOrigin( &org_x, &org_y );
        x = org_x + pos.x;
        y = org_y + pos.y;
        dc.SetLogicalOrigin( x, y );

        // Adjust draw rect
        rect.x = pos.x;
        rect.y = pos.y;

        // Let parent draw the background
        parent->EraseBackground( dc, rect );

        // Restore DC logical origin
        dc.SetLogicalOrigin( org_x, org_y );
    }
    else
    {
        // Draw background ourselves
        EraseBackground( dc, rect );
    }

    return true;
}
Exemple #6
0
BOOL CSubtitleUpDlg::OnEraseBkgnd(CDC* pDC)
{
    EraseBackground(pDC);

    return TRUE;
}
Exemple #7
0
/******************************************************************************
* WndProc *
*---------*
*   Description:
*       Main window procedure.
*
******************************************************************************/
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message) 
	{
        case WM_CREATE:
            // Try to initialize, quit with error message if we can't
            if ( FAILED( InitSAPI( hWnd ) ) )
            {
                const iMaxTitleLength = 64;
                TCHAR tszBuf[ MAX_PATH ];
                LoadString( g_hInst, IDS_FAILEDINIT, tszBuf, MAX_PATH );
                TCHAR tszName[ iMaxTitleLength ];
                LoadString( g_hInst, IDS_APP_TITLE, tszName, iMaxTitleLength );

                MessageBox( hWnd, tszBuf, tszName, MB_OK|MB_ICONWARNING );
                return( -1 );
            }
            // Let the entry pane know its time to do initialization work
            PostMessage( hWnd, WM_INITPANE, 0, 0 );
            break;
            
        // This is our application defined window message to let us know that a
        // speech recognition event has occurred.
        case WM_RECOEVENT:
            ProcessRecoEvent( hWnd );
            break;

        case WM_ERASEBKGND:
            EraseBackground( (HDC) wParam );
            return ( 1 );

        case WM_GETMINMAXINFO:
        {
            LPMINMAXINFO lpMM = (LPMINMAXINFO) lParam;

            lpMM->ptMaxSize.x = MINMAX_WIDTH;
            lpMM->ptMaxSize.y = MINMAX_HEIGHT;
            lpMM->ptMinTrackSize.x = MINMAX_WIDTH;
            lpMM->ptMinTrackSize.y = MINMAX_HEIGHT;
            lpMM->ptMaxTrackSize.x = MINMAX_WIDTH;
            lpMM->ptMaxTrackSize.y = MINMAX_HEIGHT;
            return ( 0 );
        }

		// Release remaining SAPI related COM references before application exits
        case WM_DESTROY:
            // Call the current pane's handler first
            (*g_fpCurrentPane)(hWnd, message, wParam, lParam);

            KillTimer( hWnd, 0 );
            CleanupGDIObjects();
            CleanupSAPI();
			PostQuitMessage(0);
			break;

		default:
        {
            _ASSERTE( g_fpCurrentPane );
            // Send unhandled messages to pane specific procedure for potential action
            LRESULT lRet = (*g_fpCurrentPane)(hWnd, message, wParam, lParam);
            if ( 0 == lRet )
            {
			    lRet = DefWindowProc(hWnd, message, wParam, lParam);
            }
            return ( lRet );
        }
   }
   return ( 0 );
}
Exemple #8
0
void CWndControl::Paint(const QRect& windowRect, const QRect& parentRect)
{
    if (!HasFlag(WBS_NODRAWFRAME))
        PaintFrame();

    const QRect viewport = m_render2D->Viewport();
    const QRect clientRect(GetClientRect(false).topLeft() + windowRect.topLeft(), m_clientRect.size());
    QRect viewRect, childViewRect;

    viewRect = clientRect;
    if (viewRect.left() < viewport.left()) viewRect.setLeft(viewport.left());
    if (viewRect.top() < viewport.top()) viewRect.setTop(viewport.top());
    if (viewRect.right() > viewport.right()) viewRect.setRight(viewport.right());
    if (viewRect.bottom() > viewport.bottom()) viewRect.setBottom(viewport.bottom());

    if (!HasFlag(WBS_CHILD))
    {
        m_render2D->SetViewport(viewRect);
        m_render2D->SetOrigin(clientRect.topLeft());
        EraseBackground();
    }

    if (m_controls.GetSize() > 0)
    {
        QRect rect;
        CWndControl* child;
        for (int i = 0; i < m_controls.GetSize(); i++)
        {
            child = m_controls[i];
            if (child->HasFlag(WBS_CHILD))
            {
                rect = child->GetWindowRect(true);
                if (child->HasFlag(WBS_DOCKING))
                {
                    rect = QRect(windowRect.topLeft() + rect.topLeft(), rect.size());
                    if (viewport.intersects(rect))
                    {
                        childViewRect = rect;
                        if (childViewRect.left() < viewport.left()) childViewRect.setLeft(viewport.left());
                        if (childViewRect.top() < viewport.top()) childViewRect.setTop(viewport.top());
                        if (childViewRect.right() > viewport.right()) childViewRect.setRight(viewport.right());
                        if (childViewRect.bottom() > viewport.bottom()) childViewRect.setBottom(viewport.bottom());
                        m_render2D->SetOrigin(rect.topLeft());
                        m_render2D->SetViewport(childViewRect);
                        child->Paint(rect, viewport);
                    }
                }
                else
                {
                    rect = QRect(clientRect.topLeft() + rect.topLeft(), rect.size());
                    if (viewport.intersects(rect))
                    {
                        childViewRect = rect;
                        if (childViewRect.left() < viewport.left()) childViewRect.setLeft(viewport.left());
                        if (childViewRect.top() < viewport.top()) childViewRect.setTop(viewport.top());
                        if (childViewRect.right() > viewport.right()) childViewRect.setRight(viewport.right());
                        if (childViewRect.bottom() > viewport.bottom()) childViewRect.setBottom(viewport.bottom());
                        m_render2D->SetOrigin(rect.topLeft());
                        m_render2D->SetViewport(childViewRect);
                        child->Paint(rect, viewport);
                    }
                }
            }
        }
    }

    m_render2D->SetOrigin(clientRect.topLeft());
    m_render2D->SetViewport(viewRect);
    Draw();

    if (s_selection.GetSize() > 0 && m_controls.GetSize() > 0)
    {
        QRect rect;
        CWndControl* child;
        for (int i = 0; i < m_controls.GetSize(); i++)
        {
            child = m_controls[i];
            if (child->HasFlag(WBS_CHILD))
            {
                rect = child->GetWindowRect(true);
                if (child->HasFlag(WBS_DOCKING))
                {
                    rect = QRect(windowRect.topLeft() + rect.topLeft(), rect.size());
                    child->RenderSelection(rect, viewport);
                }
                else
                {
                    rect = QRect(clientRect.topLeft() + rect.topLeft(), rect.size());
                    child->RenderSelection(rect, viewport);
                }
            }
        }
    }
}
void GroupListEmoticons::Draw(HDC hdc)
{
	EraseBackground(hdc);

	RECT client_rc;
	GetClientRect(hwnd, &client_rc);

	COLORREF old_text_color = SetTextColor(hdc, emoticonColor);

	int top = 0;

	for(int i = 0; i < num_groups; i++)
	{
		Group &group = groups[i];
		
		if (group.name[0] != '\0')
		{
			RECT rc = CalcRect(group.name, groupFont);
			rc.top += top + BORDER;
			rc.bottom += top + BORDER;

			int width = rc.right - rc.left;
			rc.left = client_rc.left + (client_rc.right - client_rc.left - width) / 2;
			rc.right = rc.left + width;

			RECT title_rc = client_rc;
			title_rc.top = rc.top - BORDER;
			title_rc.bottom = rc.bottom + BORDER + 1;
			HBRUSH hB = CreateSolidBrush(groupBkgColor);
			FillRect(hdc, &title_rc, hB);
			DeleteObject(hB);

			SetTextColor(hdc, groupColor);

			DrawEmoticonText(hdc, group.name, rc, groupFont);

			SetTextColor(hdc, emoticonColor);

			top += HeightWithBorders(rc);
		}

		int index = 0;
		for (int j = group.start; j <= group.end; j++)
		{	
			Emoticon *e = ssd->module->emoticons[j];
			if (e->IgnoreFor(ssd->module))
				continue;

			RECT rc = GetEmoticonRect(group, index);
			rc.top += top;
			rc.bottom += top;

			DrawEmoticon(hdc, j, rc);

			index++;
		}

		top += group.max_height * group.lines + (group.lines + 1) * BORDER;
	}

	SetTextColor(hdc, old_text_color);
}