void COptionTreeFontSel::OnButtonApply() { // Declare variables CHARFORMAT cfFont = {0}; LOGFONT lf; CWnd *pParent = GetParent(); // Validate parent window if (pParent == NULL) { return; } if (!::IsWindow(pParent->GetSafeHwnd())) { return; } // Get fonts GetSelectedFont(lf); ConvertFont(cfFont, lf); // Notify parent if (m_dwDialogFlags & OT_FS_USECHARFORMAT) { ::SendMessage(pParent->GetSafeHwnd(), OT_FS_NOTIFY_APPLY, (WPARAM) m_uControlID, (LPARAM) &cfFont); } else { ::SendMessage(pParent->GetSafeHwnd(), OT_FS_NOTIFY_APPLY, (WPARAM) m_uControlID, (LPARAM) &lf); } }
void COptionTreeFontSel::OnButtonOK() { // Get current font GetSelectedFont(m_lfFont); // End dialog EndDialog(ID_FONTSEL_OK); }
void COptionUI::PaintText(HDC hDC) { if( (m_uButtonState & UISTATE_SELECTED) != 0 ) { DWORD oldTextColor = m_dwTextColor; if( m_dwSelectedTextColor != 0 ) m_dwTextColor = m_dwSelectedTextColor; if( m_dwTextColor == 0 ) m_dwTextColor = m_pManager->GetDefaultFontColor(); if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor(); int iFont = GetFont(); if(GetSelectedFont() != -1) { iFont = GetSelectedFont(); } CDuiString sText = GetText(); if( sText.IsEmpty() ) return; int nLinks = 0; RECT rc = m_rcItem; RECT m_rcTextPadding = CButtonUI::m_rcTextPadding; GetManager()->GetDPIObj()->Scale(&m_rcTextPadding); rc.left += m_rcTextPadding.left; rc.right -= m_rcTextPadding.right; rc.top += m_rcTextPadding.top; rc.bottom -= m_rcTextPadding.bottom; if( m_bShowHtml ) CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, sText, IsEnabled()?m_dwTextColor:m_dwDisabledTextColor, \ NULL, NULL, nLinks, iFont, m_uTextStyle); else CRenderEngine::DrawText(hDC, m_pManager, rc, sText, IsEnabled()?m_dwTextColor:m_dwDisabledTextColor, \ iFont, m_uTextStyle); m_dwTextColor = oldTextColor; } else CButtonUI::PaintText(hDC); }
void FontManagerDialog::SetDefaultButtonClicked() { Font *returnFont = NULL; QItemSelectionModel *selectionModel = ui->fontsTableView->selectionModel(); if (selectionModel->hasSelection()) { returnFont = GetSelectedFont(selectionModel); if (returnFont) { EditorFontManager::Instance()->SetDefaultFont(returnFont); // Update table view to show new default font UpdateTableViewContents(); SafeRelease(returnFont); } } }
void FontManagerDialog::OkButtonClicked() { Font *returnFont = NULL; QItemSelectionModel *selectionModel = ui->fontsTableView->selectionModel(); if (selectionModel->hasSelection()) { returnFont = GetSelectedFont(selectionModel); if (returnFont) { //Set dialog resulting font - it corresponds to selected font by user dialogResultFont = returnFont->Clone(); SafeRelease(returnFont); //Set dialog result as QDialog::Accepted and close it accept(); } } }