void OptionsDialog::slotFontDefaultBtnClicked() { FontListItem *fontItem; for(int i=0; i < global->fontCount(); i++) { fontItem=static_cast<FontListItem*>(f_List->item(i)); fontItem->setFont(global->defaultFont(i)); } f_List->triggerUpdate(false); }
/** * Commits settings changes to the configuration object. */ void PrefFont::apply() { FontListItem* pItem; // Create a list item for every GUI element for (pItem = (FontListItem*)m_pList->firstChild(); pItem != NULL; pItem = (FontListItem*)pItem->nextSibling()) { Config().setFont(pItem->getElement(), pItem->getFont()); } }
/** * Displays a font selection dialogue when an item is selected. * If the user chooses a new font, it is set to the selected item. * This slot is connected to both the doubleClicked() and the returnPressed() * signals of the list view. * @param pItem The selected item */ void PrefFont::slotItemSelected(QListViewItem* pItem) { FontListItem* pFontItem; QFont font; pFontItem = (FontListItem*)pItem; font = pFontItem->getFont(); if (KFontDialog::getFont(font) == QDialog::Accepted) { pFontItem->setFont(font); emit modified(); } }
// show font dialog for the entry void OptionsDialog::slotFontItemSelected(QListBoxItem *it) { if (it) { FontListItem *fontItem = static_cast<FontListItem*>(it); QFont font = fontItem->font(); int result = KFontDialog::getFont(font,false,this); if (result == KFontDialog::Accepted) { fontItem->setFont(font); f_List->triggerUpdate(false); slotChanged(); } } }
BOOL DocumentFontDropDown::FillInFontList(Document * WorkDoc) { ERROR2IF(ParentDlg == NULL, FALSE, "FontDropDown not properly initialised"); BeginSlowJob(); SetListRedraw(FALSE); // Disable redraw while updating KillList(); // Delete combobox contents and empty the fonts list //ClearList(); // Delete combobox contents // Setup the static class pointer variable so we can add things to this dropdown... CurrentFontDropDown = (void *)this; //if(Fonts.GetCount() == 0) //{ if (WorkDoc == NULL) { // Fill in one item in the list which is no document fonts being used String_8 DashString(_R(IDS_K_FINFODLG_DASH)); TheTopItem.FontName = DashString; TheTopItem.Type = FC_UNDEFINED; //AddFontToList((TCHAR*)&TheTopItem.FontName, TheTopItem.Type); } else { // Build the font list for the specified document // This will NOT be alphabetical FontList DocFonts; DocFonts.Build(WorkDoc); FontListItem* FontItem = DocFonts.GetFirstItem(); if (FontItem == NULL) { // Fill in one item in the list which is no document fonts being used TheTopItem.FontName = _R(IDS_NO_FONTSINDOC); TheTopItem.Type = FC_UNDEFINED; //AddFontToList((TCHAR*)&TheTopItem.FontName, TheTopItem.Type); } else { //BOOL FirstInList = TRUE; // fill up the list while (FontItem != NULL) { // get the name String_64 Name = FontItem->GetFontName(); WORD Handle = FONTMANAGER->GetFontHandle(&Name); // check the style INT32 Style = FontItem->GetFontStyle(); if(Style & 1) Name += _T(" -Bold"); if(Style & 2) Name += _T(" -Italic"); if(Handle > 0) { if (FONTMANAGER->IsFontReplaced(Handle)) Name += _T(" *"); } FontClass Type = FontItem->GetFontClass(); AddFontToList(Name, Type); FontItem = DocFonts.GetNextItem(FontItem); ContinueSlowJob(); } } } //} // Work out the top item, if any, on the alphabetically sorted list // ready for putting in the top combo box item FontDropItem *pTopItem = (FontDropItem *)Fonts.GetHead(); if (pTopItem != NULL) { // Fill in the top item in the list TheTopItem.FontName = pTopItem->FontName; TheTopItem.Type = pTopItem->Type; } ListItem *Item = Fonts.GetHead(); while (Item != NULL) { // Add the font in the list to the combo box AddItem((void *) Item); // Try the next item Item = Fonts.GetNext(Item); } // Re-enable redraw SetListRedraw(TRUE); // We have no concept of a selected font SetSelectedIndex(-1); EndSlowJob(); return(TRUE); }