const wxFont& wxSheetCellAttr::GetFont() const { wxCHECK_MSG(m_refData, *wxNORMAL_FONT, wxT("wxSheetCellAttr not initializied")); if (HasFont()) return M_CELLATTRDATA->m_font; else if (GetDefaultAttr().Ok()) // && GetDefaultAttr().HasFont()) return GetDefaultAttr().GetFont(); wxFAIL_MSG(wxT("Missing default cell attribute")); return *wxNORMAL_FONT; }
// Create font from font attributes. wxFont wxTextAttr::GetFont() const { if ( !HasFont() ) return wxNullFont; int fontSize = 10; if (HasFontSize()) fontSize = GetFontSize(); wxFontStyle fontStyle = wxFONTSTYLE_NORMAL; if (HasFontItalic()) fontStyle = GetFontStyle(); wxFontWeight fontWeight = wxFONTWEIGHT_NORMAL; if (HasFontWeight()) fontWeight = GetFontWeight(); bool underlined = false; if (HasFontUnderlined()) underlined = GetFontUnderlined(); bool strikethrough = false; if (HasFontStrikethrough()) strikethrough = GetFontStrikethrough(); wxString fontFaceName; if (HasFontFaceName()) fontFaceName = GetFontFaceName(); wxFontEncoding encoding = wxFONTENCODING_DEFAULT; if (HasFontEncoding()) encoding = GetFontEncoding(); wxFontFamily fontFamily = wxFONTFAMILY_DEFAULT; if (HasFontFamily()) fontFamily = GetFontFamily(); if (HasFontPixelSize()) { wxFont font(wxSize(0, fontSize), fontFamily, fontStyle, fontWeight, underlined, fontFaceName, encoding); if (strikethrough) font.SetStrikethrough(true); return font; } else { wxFont font(fontSize, fontFamily, fontStyle, fontWeight, underlined, fontFaceName, encoding); if (strikethrough) font.SetStrikethrough(true); return font; } }
CFont* COXTreeItem::GetItemFont(int nCol) { if(!HasFont(nCol)) return NULL; if(!nCol) { return &m_font; } else { COXTreeSubItem *pSubItem = GetSubItem(nCol); if(!pSubItem) return NULL; return &(pSubItem->m_font); } }
bool wxSheetCellAttr::MergeWith(const wxSheetCellAttr &other) { wxCHECK_MSG(Ok() && other.Ok(), false, wxT("this or Attr to MergeWith from is not created")); if ( !HasForegoundColour() && other.HasForegoundColour() ) SetForegroundColour(other.GetForegroundColour()); if ( !HasBackgroundColour() && other.HasBackgroundColour() ) SetBackgroundColour(other.GetBackgroundColour()); if ( !HasFont() && other.HasFont() ) SetFont(other.GetFont()); if ( !HasAlignment() && other.HasAlignment() ) SetAlignment(other.GetAlignment()); if ( !HasOrientation() && other.HasOrientation() ) SetOrientation(other.GetOrientation()); if ( !HasLevel() && other.HasLevel() ) SetLevel(other.GetLevel()); if ( !HasReadWriteMode() && other.HasReadWriteMode() ) SetReadOnly(other.GetReadOnly()); if ( !HasOverflowMode() && other.HasOverflowMode() ) SetOverflow(other.GetOverflow()); if ( !HasOverflowMarkerMode() && other.HasOverflowMarkerMode() ) SetOverflowMarker(other.GetOverflowMarker()); if ( !HasShowEditorMode() && other.HasShowEditorMode() ) SetShowEditor(other.GetShowEditor()); // Directly access m_renderer/m_editor as GetRender/Editor may return different one // Maybe add support for merge of Render and Editor? if ( !HasRenderer() && other.HasRenderer() ) SetRenderer(((wxSheetCellAttrRefData*)other.m_refData)->m_renderer->Clone()); if ( !HasEditor() && other.HasEditor() ) SetEditor(((wxSheetCellAttrRefData*)other.m_refData)->m_editor->Clone()); if ( !HasDefaultAttr() && other.HasDefaultAttr() ) SetDefaultAttr(other.GetDefaultAttr()); return true; }
// Create font from font attributes. wxFont wxTextAttr::GetFont() const { if ( !HasFont() ) return wxNullFont; int fontSize = 10; if (HasFontSize()) fontSize = GetFontSize(); int fontStyle = wxNORMAL; if (HasFontItalic()) fontStyle = GetFontStyle(); int fontWeight = wxNORMAL; if (HasFontWeight()) fontWeight = GetFontWeight(); bool underlined = false; if (HasFontUnderlined()) underlined = GetFontUnderlined(); wxString fontFaceName; if (HasFontFaceName()) fontFaceName = GetFontFaceName(); wxFontEncoding encoding = wxFONTENCODING_DEFAULT; if (HasFontEncoding()) encoding = GetFontEncoding(); int fontFamily = wxFONTFAMILY_DEFAULT; if (HasFontFamily()) fontFamily = GetFontFamily(); wxFont font(fontSize, fontFamily, fontStyle, fontWeight, underlined, fontFaceName, encoding); return font; }
bool wxSheetCellAttr::IsComplete() const { return Ok() && HasForegoundColour() && HasBackgroundColour() && HasFont() && HasAlignment() && HasOverflowMode() && HasLevel() && HasReadWriteMode() && HasRenderer() && HasEditor(); }