/* This function handles the WM_COMMAND message. Currently only one control * on the dialog, the OK button, dispatches this message. */ void FASTCALL CmdAboutDlg_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { switch (id) { case IDCANCEL: { /* Delete the two fonts we created at the start.*/ DeleteFont(hDlgFont6); DeleteFont(hDlgFont8); EndDialog(hwnd, 0); break; } case IDOK: if (fUseInternet) { fLogSMTP = IsDlgButtonChecked(hwnd, IDC_CHKLOGSMTP); fLogPOP3 = IsDlgButtonChecked(hwnd, IDC_CHKLOGPOP3); fLogNNTP = IsDlgButtonChecked(hwnd, IDC_CHKLOGNNTP); Amuser_WritePPInt( szDebug, "LogSMTP", fLogSMTP ); Amuser_WritePPInt( szDebug, "LogNNTP", fLogNNTP ); Amuser_WritePPInt( szDebug, "LogPOP3", fLogPOP3 ); } /* Delete the two fonts we created at the start.*/ DeleteFont(hDlgFont6); DeleteFont(hDlgFont8); EndDialog(hwnd, 0); break; } }
CImportDlg::~CImportDlg(void) { clear(); if(m_fntBold) DeleteFont(m_fntBold); if(m_fntNormal) DeleteFont(m_fntNormal); if(m_fntCaption) DeleteFont(m_fntCaption); if(m_fntLinks) DeleteFont(m_fntLinks); if(m_hIcon) DestroyIcon(m_hIcon); }
//function to draw the bottom ribbon with table name and db name void TableView::DrawTableInfoRibbon(HDC hdc, RECT drawrect) { HFONT hfontnormal = GetStockFont(DEFAULT_GUI_FONT); HFONT hfontbold = NULL; LOGFONT lf = {0}; RECT recttext; if(m_mydata && m_mydata->m_db.GetLength() && m_mydata->m_table.GetLength()) { GetObject(hfontnormal, sizeof(lf), &lf); lf.lfWeight = FW_SEMIBOLD; hfontbold = CreateFontIndirect(&lf); hfontbold = (HFONT)SelectObject(hdc, hfontbold); memset(&recttext, 0, sizeof(RECT)); DrawText(hdc, _(L"Database:"), -1, &recttext, DT_SINGLELINE | DT_NOPREFIX | DT_CALCRECT); DrawText(hdc, _(L"Database:"), -1, &drawrect, DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX); hfontbold = (HFONT)SelectObject(hdc, hfontbold); drawrect.left += recttext.right + 5; hfontnormal = (HFONT)SelectObject(hdc, hfontnormal); memset(&recttext, 0, sizeof(RECT)); DrawText(hdc, m_mydata->m_db.GetAsWideChar(), -1, &recttext, DT_SINGLELINE | DT_NOPREFIX | DT_CALCRECT); DrawText(hdc, m_mydata->m_db.GetAsWideChar(), -1, &drawrect, DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX); hfontnormal = (HFONT)SelectObject(hdc, hfontnormal); drawrect.left += recttext.right + 10; hfontbold = (HFONT)SelectObject(hdc, hfontbold); memset(&recttext, 0, sizeof(RECT)); DrawText(hdc, _(L"Table:"), -1, &recttext, DT_SINGLELINE | DT_NOPREFIX | DT_CALCRECT); DrawText(hdc, _(L"Table:"), -1, &drawrect, DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX); hfontbold = (HFONT)SelectObject(hdc, hfontbold); drawrect.left += recttext.right + 5; hfontnormal = (HFONT)SelectObject(hdc, hfontnormal); memset(&recttext, 0, sizeof(RECT)); DrawText(hdc, m_mydata->m_table.GetAsWideChar(), -1, &recttext, DT_SINGLELINE | DT_NOPREFIX | DT_CALCRECT); DrawText(hdc, m_mydata->m_table.GetAsWideChar(), -1, &drawrect, DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX); hfontnormal = (HFONT)SelectObject(hdc, hfontnormal); } if(hfontbold) { DeleteFont(hfontbold); } if(hfontnormal) { DeleteFont(hfontnormal); } }
static void LLabel_OnPaint(HWND hwnd) { PAINTSTRUCT ps; RECT rc; int state; HFONT hFont; int style = DT_SINGLELINE | DT_VCENTER; BeginPaint(hwnd, &ps); GetClientRect(hwnd, &rc); state = SaveDC(ps.hdc); SetBkMode(ps.hdc, TRANSPARENT); hFont = CreateFontIndirectW((LPLOGFONTW)GetWindowLongPtrW(hwnd, 4)); SelectFont(ps.hdc, hFont); SetTextColor(ps.hdc, RGB(0, 0, 255)); if(IsWindowUnicode(hwnd)){ if(GetPropW(hwnd, LL_ALIGNW)) style |= DT_RIGHT; else style |= DT_LEFT; DrawTextW(ps.hdc, (wchar_t *)GetWindowLongPtrW(hwnd, 0), -1, &rc, style); } else{ if(GetProp(hwnd, LL_ALIGN)) style |= DT_RIGHT; else style |= DT_LEFT; DrawText(ps.hdc, (char *)GetWindowLongPtr(hwnd, 0), -1, &rc, style); } RestoreDC(ps.hdc, state); DeleteFont(hFont); EndPaint(hwnd, &ps); }
static void SetLLTextW(HWND hwnd, wchar_t * lpText){ wchar_t * pText; SIZE sz; HDC hdc; int state; HFONT hFont; RECT rc; GetWindowRect(hwnd, &rc); MapWindowPoints(HWND_DESKTOP, GetParent(hwnd), (LPPOINT)&rc, 2); pText = (wchar_t *)GetWindowLongPtrW(hwnd, 0); if(pText) free(pText); pText = (wchar_t *)calloc(wcslen(lpText) + 2, sizeof(wchar_t)); wcscpy(pText, lpText); SetWindowLongPtrW(hwnd, 0, (LONG_PTR)pText); hdc = GetDC(hwnd); state = SaveDC(hdc); hFont = CreateFontIndirectW((LPLOGFONTW)GetWindowLongPtrW(hwnd, 4)); SelectFont(hdc, hFont); GetTextExtentPoint32W(hdc, lpText, wcslen(lpText) + 1, &sz); RestoreDC(hdc, state); ReleaseDC(hwnd, hdc); DeleteFont(hFont); if(GetPropW(hwnd, LL_ALIGNW)) SetWindowPos(hwnd, 0, rc.right - sz.cx, rc.top, sz.cx, sz.cy, SWP_SHOWWINDOW); else SetWindowPos(hwnd, 0, 0, 0, sz.cx, sz.cy, SWP_NOMOVE | SWP_SHOWWINDOW); }
VOID Dx9Overlay_Reset( D3DPRESENT_PARAMETERS* PresentationParameters ) { OvLog(L"Dx9Overlay_Reset()"); DeleteFont(); UpdatePresentationParameters(PresentationParameters); }
/* Destroy window and deallocate text window structure */ void text_destroy(TW *tw) { if (tw->hwnd) DestroyWindow(tw->hwnd); tw->hwnd = HWND_DESKTOP; if (tw->hfont) DeleteFont(tw->hfont); tw->hfont = NULL; free((char *)tw->KeyBuf); tw->KeyBuf = NULL; free((char *)tw->ScreenBuffer); tw->ScreenBuffer = NULL; free((char *)tw->DragPre); tw->DragPre = NULL; free((char *)tw->DragPost); tw->DragPost = NULL; free((char *)tw->fontname); tw->fontname = NULL; #ifndef WINDOWS_NO_UNICODE free((char *)tw->TitleW); tw->TitleW = NULL; #endif }
/* Destroy window and deallocate text window structure */ void text_destroy(TW *tw) { if (tw->hwnd) DestroyWindow(tw->hwnd); tw->hwnd = HWND_DESKTOP; if (tw->hfont) DeleteFont(tw->hfont); tw->hfont = NULL; if (tw->KeyBuf) free((char *)tw->KeyBuf); tw->KeyBuf = NULL; if (tw->ScreenBuffer) free((char *)tw->ScreenBuffer); tw->ScreenBuffer = NULL; if (tw->DragPre) free((char *)tw->DragPre); tw->DragPre = NULL; if (tw->DragPost) free((char *)tw->DragPost); tw->DragPost = NULL; if (tw->fontname) free((char *)tw->fontname); tw->fontname = NULL; }
void Label::Destroy() { if (mBackgroundImage) { // Free background image DeleteBitmap(mBackgroundImage); mBackgroundImage = NULL; } if (mFont) { // Free font DeleteFont(mFont); mFont = NULL; } if (mImage) { // Free image DeleteBitmap(mImage); mImage = NULL; } if (mWindow) { // Destroy the window DestroyWindow(mWindow); } }
static void nr_typeface_w32_finalize (NRObject *object) { NRTypeFaceW32 *tfw32; tfw32 = (NRTypeFaceW32 *) object; nr_free (tfw32->otm); DeleteFont (tfw32->hfont); if (tfw32->slots) { unsigned int i; for (i = 0; i < tfw32->slots_length; i++) { if (tfw32->slots[i].outline.path > 0) { art_free (tfw32->slots[i].outline.path); } } nr_free (tfw32->slots); } if (tfw32->hgidx) nr_free (tfw32->hgidx); if (tfw32->vgidx) nr_free (tfw32->vgidx); ((NRObjectClass *) (parent_class))->finalize (object); }
void text_font(TW *tw, const char *name, int size) { /* make a new font */ LOGFONT lf; TEXTMETRIC tm; LPSTR p; HDC hdc; /* reject inappropriate arguments */ if (name == NULL) return; if (size < 4) return; /* set new name and size */ if (tw->fontname) free(tw->fontname); tw->fontname = (char *)malloc(strlen(name)+1); if (tw->fontname == NULL) return; strcpy(tw->fontname, name); tw->fontsize = size; /* if window not open, hwnd == 0 == HWND_DESKTOP */ hdc = GetDC(tw->hwnd); memset(&lf, 0, sizeof(LOGFONT)); strncpy(lf.lfFaceName,tw->fontname,LF_FACESIZE); lf.lfHeight = -MulDiv(tw->fontsize, GetDeviceCaps(hdc, LOGPIXELSY), 72); lf.lfPitchAndFamily = FIXED_PITCH; lf.lfCharSet = DEFAULT_CHARSET; if ( (p = strstr(tw->fontname," Italic")) != (LPSTR)NULL ) { lf.lfFaceName[ (unsigned int)(p-tw->fontname) ] = '\0'; lf.lfItalic = TRUE; } if ( (p = strstr(tw->fontname," Bold")) != (LPSTR)NULL ) { lf.lfFaceName[ (unsigned int)(p-tw->fontname) ] = '\0'; lf.lfWeight = FW_BOLD; } if (tw->hfont) DeleteFont(tw->hfont); tw->hfont = CreateFontIndirect((LOGFONT FAR *)&lf); /* get text size */ SelectFont(hdc, tw->hfont); GetTextMetrics(hdc,(TEXTMETRIC FAR *)&tm); tw->CharSize.y = tm.tmHeight; tw->CharSize.x = tm.tmAveCharWidth; tw->CharAscent = tm.tmAscent; if (tw->bFocus) CreateCaret(tw->hwnd, 0, tw->CharSize.x, 2+tw->CaretHeight); ReleaseDC(tw->hwnd, hdc); /* redraw window if necessary */ if (tw->hwnd != HWND_DESKTOP) { /* INCOMPLETE */ } }
WinManager::~WinManager(){ for(map<int, Window*>::iterator it=m_wndMap.begin(); it!=m_wndMap.end(); ++it){ delete (*it).second; } DeleteFont(m_defFont); }
INT_PTR CManageBookmarksDialog::OnDestroy() { CBookmarkItemNotifier::GetInstance().RemoveObserver(this); DestroyIcon(m_hDialogIcon); DeleteFont(m_hEditSearchFont); ImageList_Destroy(m_himlToolbar); return 0; }
TR::~TR(void) { //Delete every font. while (!fonts.empty()) { bool tryDelete = DeleteFont(fonts.begin()->first); assert(tryDelete); } }
void OnDestroy(HWND hwnd) { for (int i = 1; i <= 4; i++) KillTimer(hwnd, i); DeleteFont(g_app.hFont); DeletePen(g_app.hPen); DeleteDC(g_app.hdcMem); DeleteBitmap(g_app.hBmp); PostQuitMessage(0); }
OpenGLViewer::~OpenGLViewer() { animate(0); delete[] title; delete[] output_path; DeleteFont(); lucDeleteFont(); }
bool mIRCLinker::setTreeFont(HFONT newFont) { HFONT f = GetWindowFont(m_hTreeview); if (m_hTreeFont == NULL) m_hTreeFont = f; SetWindowFont( m_hTreeview, newFont, TRUE); if (f != m_hTreeFont) DeleteFont(f); return true; }
VOID ArgumentFreeResources( IN HWND hWnd ) { PDIALOG_OBJECT Object; Object = (PDIALOG_OBJECT)SdkGetObject(hWnd); if (Object->ObjectContext) { DeleteFont((HFONT)Object->ObjectContext); } }
void plResponderProc::IDrawComboItem(DRAWITEMSTRUCT *dis) { if (dis->itemID == -1) // empty item return; // The colors depend on whether the item is selected. COLORREF clrForeground = SetTextColor(dis->hDC, GetSysColor(dis->itemState & ODS_SELECTED ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT)); COLORREF clrBackground = SetBkColor(dis->hDC, GetSysColor(dis->itemState & ODS_SELECTED ? COLOR_HIGHLIGHT : COLOR_WINDOW)); // Calculate the vertical and horizontal position. TEXTMETRIC tm; GetTextMetrics(dis->hDC, &tm); int y = (dis->rcItem.bottom + dis->rcItem.top - tm.tmHeight) / 2; int x = LOWORD(GetDialogBaseUnits()) / 4; // If this is a command, not a state, make it bold HFONT oldFont = nil; if (dis->itemData != kStateName) { LOGFONT lf; memset(&lf, 0, sizeof(lf)); lf.lfHeight = tm.tmHeight; lf.lfWeight = FW_BOLD; GetTextFace(dis->hDC, LF_FACESIZE, lf.lfFaceName); HFONT boldFont = CreateFontIndirect(&lf); oldFont = SelectFont(dis->hDC, boldFont); } // Get and display the text for the list item. char buf[256]; ComboBox_GetLBText(dis->hwndItem, dis->itemID, buf); if (fPB->GetInt(kResponderStateDef) == dis->itemID) { char buf2[256]; sprintf(buf2, "* %s", buf); strcpy(buf, buf2); } ExtTextOut(dis->hDC, x, y, ETO_CLIPPED | ETO_OPAQUE, &dis->rcItem, buf, strlen(buf), NULL); // Restore the previous colors. SetTextColor(dis->hDC, clrForeground); SetBkColor(dis->hDC, clrBackground); if (oldFont) DeleteFont(SelectFont(dis->hDC, oldFont)); // If the item has the focus, draw focus rectangle. if (dis->itemState & ODS_FOCUS) DrawFocusRect(dis->hDC, &dis->rcItem); }
/// Function name : deleteDocumentsControlData // Description : Destroys documents control data // // DOCUMENTS_DATA* &pDocumentsData : [in] Documents data // VOID deleteDocumentsControlData(DOCUMENTS_DATA* &pDocumentsData) { // Delete Documents list deleteList(pDocumentsData->pDocumentList); // Destroy ImageList and title font ImageList_Destroy(pDocumentsData->hImageList); DeleteFont(pDocumentsData->hTitleFont); // Delete calling object utilDeleteObject(pDocumentsData); }
/// Function name : deleteSplashWindowData // Description : // // SPLASH_WINDOW_DATA* &pWindowData : [in] // VOID deleteSplashWindowData(SPLASH_WINDOW_DATA* &pWindowData) { /// Delete drawing objects if (pWindowData->hProgressFont) DeleteFont(pWindowData->hProgressFont); if (pWindowData->hProgressPen) DeletePen(pWindowData->hProgressPen); // Delete calling object utilDeleteObject(pWindowData); }
void mIRCLinker::unload() { // Reset mIRC's WndProc if changed resetWindowProc(); UnmapViewOfFile(m_pData); CloseHandle(m_hFileMap); // reset the treebars font if it's been changed. if (Dcx::mIRC.getTreeFont() != NULL) { HFONT hfont = GetWindowFont(m_hTreeview); if (hfont != m_hTreeFont) { SetWindowFont( m_hTreeview, m_hTreeFont, TRUE); DeleteFont(hfont); } } }
wyBool ImportBatch::SetCurDbFont() { HDC dc; wyUInt32 fontheight; HWND hwndstatic; VERIFY(hwndstatic = GetDlgItem(m_hwnd, IDC_CURDATABASE)); dc = GetDC(hwndstatic); fontheight = -MulDiv(8, GetDeviceCaps(dc, LOGPIXELSY), 72); VERIFY(ReleaseDC(hwndstatic, dc)); VERIFY(m_hfont = CreateFont(fontheight, 0, 0, 0, FW_BOLD, 0, 0, 0, 0, 0, 0, 0, 0, L"Arial")); SendMessage(hwndstatic, WM_SETFONT, (WPARAM)m_hfont, TRUE); DeleteFont(m_hfont); return wyTrue; }
/* Resets the font within the search field and removes any text. */ void CManageBookmarksDialog::RemoveSearchFieldDefaultState() { HWND hEdit = GetDlgItem(m_hDlg,IDC_MANAGEBOOKMARKS_EDITSEARCH); LOGFONT lf; HFONT hCurentFont = reinterpret_cast<HFONT>(SendMessage(hEdit,WM_GETFONT,0,0)); GetObject(hCurentFont,sizeof(lf),reinterpret_cast<LPVOID>(&lf)); HFONT hPrevEditSearchFont = m_hEditSearchFont; lf.lfItalic = FALSE; m_hEditSearchFont = CreateFontIndirect(&lf); SendMessage(hEdit,WM_SETFONT,reinterpret_cast<WPARAM>(m_hEditSearchFont),MAKEWORD(TRUE,0)); DeleteFont(hPrevEditSearchFont); SetWindowText(hEdit,EMPTY_STRING); }
void OpenGLViewer::close() { // cleanup opengl memory - required before resize if context destroyed, then call open after resize DeleteFont(); lucDeleteFont(); #ifdef FBO_SUPPORTED if (fbo_texture) glDeleteTextures(1, &fbo_texture); if (fbo_depth) glDeleteRenderbuffersEXT(1, &fbo_depth); if (fbo_frame) glDeleteFramebuffersEXT(1, &fbo_frame); #endif //Call the application close function app->close(); isopen = false; //Call close on any output interfaces for (int o=0; o<outputs.size(); o++) outputs[o]->close(); }
void Recreate(int res, bool bold, bool italic, bool underline, const core::stringw& fontName) { if (font) DeleteFont(font); font = CreateFontW( res, 0, 0, 0, bold ? FW_BOLD : 0, italic, underline, 0, ANSI_CHARSET | ARABIC_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, fontName.c_str()); fontDirty = false; }
void EditorBase::DestroyWindows() { if(m_hwnd) DestroyWindow(m_hwnd); m_hwnd = NULL; if(m_hwndhelp) DestroyWindow(m_hwndhelp); m_hwndhelp = NULL; if(m_hfont) DeleteFont(m_hfont); m_hfont = NULL; return; }
/*! ポッパップの文字サイズ変更と表示非表示が入った @param[in] ttSize 文字サイズ・12か16しかない @param[in] bView 非0表示 0表示しない @return HRESULT 終了状態コード */ HRESULT AaItemsTipSizeChange( INT ttSize, UINT bView ) { #ifdef MAA_TOOLTIP LOGFONT stFont; #endif gbAAtipView = bView ? TRUE : FALSE; #ifdef MAA_TOOLTIP SetWindowFont( ghToolTipWnd, GetStockFont(DEFAULT_GUI_FONT), FALSE ); DeleteFont( ghTipFont ); // 今使ってるヤツぶっ壊してから、新しいのつくってくっつける ViewingFontGet( &stFont ); // gstBaseFont stFont.lfHeight = (FONTSZ_REDUCE == ttSize) ? FONTSZ_REDUCE : FONTSZ_NORMAL; ghTipFont = CreateFontIndirect( &stFont ); SetWindowFont( ghToolTipWnd, ghTipFont, TRUE ); #endif return S_OK; }
VOID FilterCleanUp( IN HWND hWnd ) { PDIALOG_OBJECT Object; PFILTER_CONTEXT Context; Object = (PDIALOG_OBJECT)SdkGetObject(hWnd); Context = SdkGetContext(Object, FILTER_CONTEXT); MspFreeFilterList(&Context->FilterList); if (Context->hBoldFont) { DeleteFont(Context->hBoldFont); } if (Context->ListObject) { SdkFree(Context->ListObject); } }
nglKernel::~nglKernel() { Exit(0); SelectFont(mHDC, NULL); if (mSystemFont) DeleteFont(mSystemFont); if (mpDirect3D) mpDirect3D->Release(); if (mHWnd) { DestroyWindow(mHWnd); } mHWnd = NULL; mHDC = NULL; if (mHInstance) { UnregisterClass(NGL_CORE_CLASS, mHInstance); } }