/*
 * ************************************************************************************************************
 * Author: Marcin Załęczny
 * Copyright (C)2010 Marcin Załęczny <mzaleczny@hotmail.com>
 * License: The GNU Lesser General Public License, version 3.0 (LGPLv3)
 * Library Name: mzstdgraphics
 * Version: 1.05
 * First release date:   2010-11-08
 * Current release date: 2011-03-04
 *
 *
 * This file is part of mzstdgraphics library
 * 
 * mzstdgraphics library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * mzstdgraphics library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 * ************************************************************************************************************
 */

#ifndef __MZSTDGRAPHICS_FONT_H__
#define __MZSTDGRAPHICS_FONT_H__

#include "mzstdgraphicsCommon.h"
#include "mzObject.h"
#include "mzString.h"
#include "mzStringList.h"

#define SYSTEM_WINDOW_CAPTION_FONT  1

class DECLSPEC_MZSTDGRAPHICS CFont : public CObject {
public:
	HFONT hFont;
    CString name;
    LONG size;
    COLORREF color;
    LONG rotationAngle;
    LONG weight;
    BOOL italic;
    BOOL underline;
    BOOL strikeout;
    
	WINAPI CFont(HDC hdc, COLORREF color, LONG type, LONG weight = FW_NORMAL);
	WINAPI CFont(HDC hdc, COLORREF color, CString fontName, LONG size);
    // rotationAngle is in teenths of degrees
	WINAPI CFont(HDC hdc, COLORREF color, CString fontName, LONG size, LONG rotationAngle);
    // rotationAngle is in teenths of degrees
	WINAPI CFont(HDC hdc, COLORREF color, CString fontName, LONG size, LONG rotationAngle, LONG weight, BOOL italic, BOOL underline, BOOL strikeout);

	virtual WINAPI ~CFont();
	SIZE WINAPI measureString(CString s, HDC hdc);
	SIZE WINAPI measureString(CString s, LONG charSpacing, HDC hdc);
	SIZE WINAPI measureChar(WCHAR ch, HDC hdc);
	static CStringList* WINAPI getAvailableSystemFontNames();


protected:
    WINAPI CFont() {};
    VOID WINAPI _commonInit(HDC hdc, COLORREF color, CString fontName, LONG size, LONG rotationAngle, LONG weight, BOOL italic, BOOL underline, BOOL strikeout);
	VOID WINAPI _createFont(HDC hdc, COLORREF color, LONG type, LONG weight);

	static INT CALLBACK _fontEnumProcGetNames(const LOGFONT *lpelfe,
		const TEXTMETRIC *lpntme, DWORD FontType, LPARAM lParam);
};

typedef CFont* PFont;

#endif
