示例#1
0
文件: printout.cpp 项目: brho/xword
// This should throw an exception if the text runs off the page when we are
// measuring.
void
MyPrintout::DrawTextLine(const wxString & text,
                         int * x, int * y,
                         int * width, int * height)
{
    // Measure the text, draw it, and move the x and y variables to the location
    // that the next text line should be drawn.
    // The caller must ensure that the text is wrapped.

    int w, h;
    MeasureText(text, &w, &h);
    h += LINE_PADDING;

    AdjustColumn(x, y, w, h);

    const wxRect textRect(*x, *y, w, h);
    if (m_isDrawing)
        GetDC()->DrawLabel(text, textRect);
    else if (! m_pageRect.Contains(textRect))
        throw FontSizeError();

    if (width != NULL)
        *width = w;
    if (height != NULL)
        *height = h;

    *y += h;
}
示例#2
0
bool TextCutter::MoveToNextChar()
{
    if (IsEOF())
        return false;
	++m_CurIdx;
	++m_CurColumn;
    AdjustColumn();
    return true;
}
示例#3
0
void CDlgFiles::ComputeLocal( int iTop, int iHeight, int iRight )
	{
	// Partie du bas
	iTop += MARGIN_VERTICAL;
	int iWidth = iRight - MARGIN_HORIZONTAL;

	GetDlgItem( IDC_LOCAL_LIST )->MoveWindow( MARGIN_HORIZONTAL, iTop, iRight - 2 * MARGIN_HORIZONTAL, iHeight - 2 * MARGIN_VERTICAL - BUTTON_HEIGHT );
	AdjustColumn( &m_LocalList, iWidth );

		// Boutons locaux
	iTop += iHeight - MARGIN_VERTICAL - BUTTON_HEIGHT;
	int iLeft = MARGIN_HORIZONTAL;
	for ( int iButton = 0; iButton < iLocalButtons; iButton++ )
		{
		GetDlgItem( uiLocal[ iButton ] )->MoveWindow( iLeft, iTop, BUTTON_WIDTH, BUTTON_HEIGHT );
		iLeft += BUTTON_HEIGHT + MARGIN_HORIZONTAL;
		}

	iRight = iRight - 2 * MARGIN_VERTICAL - BUTTON_WIDTH;
	GetDlgItem( IDC_LOCAL_NAME )->MoveWindow( iLeft, iTop, iRight - iLeft , BUTTON_HEIGHT );
	
	GetDlgItem( IDC_CLOSE )->MoveWindow( iRight, iTop, BUTTON_WIDTH, BUTTON_HEIGHT );
	}
示例#4
0
void CDlgFiles::ComputeRemote( int iTop, int iHeight, int iRight )
	{
	// Partie du haut
	int iLeft = MARGIN_HORIZONTAL;
	iTop += MARGIN_VERTICAL;

		// Boutons distants
	for ( int iButton = 0; iButton < iRemoteButtons; iButton++ )
		{
		GetDlgItem( uiRemote[ iButton ] )->MoveWindow( iLeft, MARGIN_VERTICAL, BUTTON_WIDTH, BUTTON_HEIGHT );
		iLeft += MARGIN_HORIZONTAL + BUTTON_WIDTH;
		}


	GetDlgItem( IDC_REMOTE_LIST )->MoveWindow( MARGIN_HORIZONTAL, 2 * MARGIN_VERTICAL + BUTTON_HEIGHT, iRight - 2 * MARGIN_HORIZONTAL, iHeight - 3 * MARGIN_VERTICAL - BUTTON_HEIGHT );
	AdjustColumn( &m_RemoteList, iRight - MARGIN_HORIZONTAL );

	iRight = iRight - 2 * MARGIN_VERTICAL - BUTTON_WIDTH;

	GetDlgItem( IDC_REMOTE_NAME )->MoveWindow( iLeft, MARGIN_VERTICAL, iRight - iLeft, BUTTON_HEIGHT );

	if ( m_bExpandLocal == false && m_bExpandRemote == true )
		GetDlgItem( IDC_CLOSE )->MoveWindow( iRight, MARGIN_VERTICAL, BUTTON_WIDTH, BUTTON_HEIGHT );
	}