Esempio n. 1
0
//////////////////
// Menu bar was created: install hook into owner window
//
int CMenuBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CToolBar::OnCreate(lpCreateStruct)==-1)
		return -1;
	UpdateFont();
	return 0; // OK
}
Esempio n. 2
0
bool wxGenericFontButton::Create( wxWindow *parent, wxWindowID id,
                        const wxFont &initial, const wxPoint &pos,
                        const wxSize &size, long style,
                        const wxValidator& validator, const wxString &name)
{
    wxString label = (style & wxFNTP_FONTDESC_AS_LABEL) ?
                        wxString() : // label will be updated by UpdateFont
                        _("Choose font");

    // create this button
    if (!wxButton::Create( parent, id, label, pos,
                           size, style, validator, name ))
    {
        wxFAIL_MSG( wxT("wxGenericFontButton creation failed") );
        return false;
    }

    // and handle user clicks on it
    Connect(GetId(), wxEVT_COMMAND_BUTTON_CLICKED,
            wxCommandEventHandler(wxGenericFontButton::OnButtonClick),
            NULL, this);

    m_selectedFont = initial.IsOk() ? initial : *wxNORMAL_FONT;
    UpdateFont();
    InitFontData();

    return true;
}
Esempio n. 3
0
///////////class nuiHTMLContext
nuiHTMLContext::nuiHTMLContext()
{
  mMaxWidth = 640;
  
  mVSpace = 0;
  
  mFont.SetName(_T("arial"), 0.8f);
  mFont.SetGenericName(_T("sans-serif"), 0.8f);
  mFont.SetStyle(_T("regular"), 0.5f);
  mFont.SetProportionnal(1.0f);
  
  mFont.SetScalable(1.0f);
  mFont.MustHaveSize(12.0f, 1.0f);
  mFont.SetItalic(false, 1.0f);
  mFont.SetBold(false, 1.0f);
  mpFont = NULL;
  mUnderline = false;
  mStrikeThrough = false;
  mTextFgColor = nuiColor(0,0,0,255);
  mTextBgColor = nuiColor(0,0,0,0);
  mLinkColor = nuiColor(64, 64, 200);

  mAlignHorizontal = eBegin;
  mAlignVertical = eBegin;
  
  UpdateFont();
}
Esempio n. 4
0
void GameList::ZoomIn()
{
  m_model->SetScale(m_model->GetScale() + 0.1);

  m_list_proxy->invalidate();
  m_grid_proxy->invalidate();

  UpdateFont();
}
Esempio n. 5
0
//
// Setting whether the text is underlined.
//
void CTextDisplay::Underline(BOOL enable, BOOL refresh)
{
	if (enable)
		font_settings.lfUnderline = TRUE;
	else
		font_settings.lfUnderline = FALSE;

	UpdateFont();
}
Esempio n. 6
0
//
// Setting whether the text is italic.
//
void CTextDisplay::Italic(BOOL enable, BOOL refresh)
{
	if (enable)
		font_settings.lfItalic = TRUE;
	else
		font_settings.lfItalic = FALSE;

	UpdateFont();
}
Esempio n. 7
0
//
// Setting whether the text is bold.
//
void CTextDisplay::Bold(BOOL enable, BOOL refresh)
{
	if (enable)
		font_settings.lfWeight = FW_BOLD;
	else
		font_settings.lfWeight = FW_NORMAL;

	UpdateFont();
}
HFONT Interface::SetFont(HGDIOBJ stockFont, bool update)
{
	this->font = (HFONT)stockFont;

	if (update == true)
		UpdateFont();

	return this->font;
}
HFONT Interface::SetFont(string fontName, bool update)
{
	if (fontName != "")
		this->font = CreateFont(0,0,0,0,0,0,0,0,0,0,0,0,0,fontName.c_str());

	if (update == true)
		UpdateFont();

	return this->font;
}
Esempio n. 10
0
long ExtObject::aSetFont(LPVAL params)
{
	CString newFont = params[0].GetString();

	if (newFont != fontface) {
		fontface = newFont;
		UpdateFont();
	}

	return 0;
}
Esempio n. 11
0
long ExtObject::aSetBold(LPVAL theParams)
{
	bool newBold = theParams[0].GetBool();

	if (newBold != (bold!=0)) {
		bold = newBold;
		UpdateFont();
	}

	return 0;
}
Esempio n. 12
0
long ExtObject::aSetItalic(LPVAL theParams)
{
	bool newItalic = theParams[0].GetBool();

	if (newItalic != (italics!=0)) {
		italics = newItalic;
		UpdateFont();
	}

	return 0;
}
Esempio n. 13
0
long ExtObject::aSetTextSize(LPVAL theParams)
{
	int newSize = theParams[0].GetInt();
	Clamp(newSize, 1, 500);

	if (newSize != pxSize) {
		pxSize = newSize;
		UpdateFont();
	}

	return 0;
}
Esempio n. 14
0
void GameList::ZoomOut()
{
  if (m_model->GetScale() <= 0.1)
    return;

  m_model->SetScale(m_model->GetScale() - 0.1);

  m_list_proxy->invalidate();
  m_grid_proxy->invalidate();

  UpdateFont();
}
Esempio n. 15
0
File: main.cpp Progetto: zie87/sds
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, int iShowCmd)
{
	MSG		msg;
	SCRIPT_DIGITSUBSTITUTE scriptDigitSubstitute;

	g_LogFont.lfQuality = CLEARTYPE_QUALITY;

	// Register main window class
	InitMainWnd();

	ScriptRecordDigitSubstitution(LOCALE_USER_DEFAULT, &scriptDigitSubstitute);

	//
	//	Create main window
	//
	hwndMain = CreateWindowEx(0,
				szAppName,				// window class name
				szAppName,				// window caption
				WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN,
				CW_USEDEFAULT,			// initial x position
				CW_USEDEFAULT,			// initial y position
				800,					// initial x size
				800,					// initial y size
				NULL,					// parent window handle
				NULL,					// use window class menu
				hInst,					// program instance handle
				NULL);					// creation parameters


	//
	//	Initialize the font
	//
	g_LogFont.lfHeight = -70;
	lstrcpy(g_LogFont.lfFaceName, L"Times New Roman");
	UpdateFont();

	ShowWindow(hwndMain, iShowCmd);

	//
	//	Standard message loop
	//
	while(GetMessage(&msg, NULL, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	DeleteObject(g_hFont);

	return 0;
}
Esempio n. 16
0
bool wxFontButton::Create( wxWindow *parent, wxWindowID id,
                        const wxFont &initial,
                        const wxPoint &pos, const wxSize &size,
                        long style, const wxValidator& validator,
                        const wxString &name )
{
    if (!gtk_check_version(2,4,0))
    {
        m_needParent = true;
        m_acceptsFocus = true;

        if (!PreCreation( parent, pos, size ) ||
            !wxControl::CreateBase(parent, id, pos, size, style, validator, name))
        {
            wxFAIL_MSG( wxT("wxFontButton creation failed") );
            return false;
        }

        m_widget = gtk_font_button_new();

        // set initial font
        m_selectedFont = initial.IsOk() ? initial : *wxNORMAL_FONT;
        UpdateFont();

        // honour the fontbutton styles
        bool showall = (style & wxFNTP_FONTDESC_AS_LABEL) != 0,
             usefont = (style & wxFNTP_USEFONT_FOR_LABEL) != 0;
        gtk_font_button_set_show_style(GTK_FONT_BUTTON(m_widget), showall);
        gtk_font_button_set_show_size(GTK_FONT_BUTTON(m_widget), showall);

        gtk_font_button_set_use_size(GTK_FONT_BUTTON(m_widget), usefont);
        gtk_font_button_set_use_font(GTK_FONT_BUTTON(m_widget), usefont);

        gtk_widget_show( GTK_WIDGET(m_widget) );

        // GtkFontButton signals
        g_signal_connect(m_widget, "font-set",
                        G_CALLBACK(gtk_fontbutton_setfont_callback), this);


        m_parent->DoAddChild( this );

        PostCreation(size);
        SetInitialSize(size);
    }
    else
        return wxGenericFontButton::Create(parent, id, initial, pos, size,
                                           style, validator, name);
    return true;
}
HWND Interface::CreateWindowMethod()
{
	this->hWnd = CreateWindowExA(this->additionalStyles,this->type.c_str(),this->name.c_str(),this->style,this->X(),this->Y(),this->Width(),this->Height(),this->hParent,this->hMenu,this->hInstance,0);

	if (this->hWnd == NULL) 
	{
		stringstream text;
		text << "WinAPI error " << GetLastError();
		MessageBox(HWND_DESKTOP,text.str().c_str(),"Error",MB_OK);
	}

	UpdateFont();

	return this->hWnd;
}
Esempio n. 18
0
void CSkinText::Draw(CDC* pDC, LPRECT lpInvalidRect, CRgn* pInvalidRgn)
{
	//创建字体
	if (m_textStyleNormal.IsFontChanged()) {
		UpdateFont(*pDC);
	}

	//自动调整
	if (m_bAdjustEnable){
		AdjustRect(*pDC);
	}

    //绘制背景色
	CRect drawRect = GetSkinRect();
    if (m_clrBkColorNormal != -1) {
        CRenderEngine::FillRect(*pDC, drawRect, m_clrBkColorNormal);
    }

	//选择颜色
	LONG color = m_textStyleNormal.Getcolor();
    VARIANT_BOOL newUnderline = GetnormalUnderline();
	switch (m_enMouseState)
	{
	case MOUSE_NORMAL:
		color = m_textStyleNormal.Getcolor();
        newUnderline = GetnormalUnderline();
		break;
	case MOUSE_HOVER:
		if (m_textStyleHover.Getcolor() != -1)
			color = m_textStyleHover.Getcolor();
        newUnderline = m_textStyleNormal.Getunderline();
		break;
	case MOUSE_DOWN:
		if (m_textStyleDown.Getcolor() != -1)
			color = m_textStyleDown.Getcolor();
        newUnderline = m_textStyleNormal.Getunderline();
		break;
	default:
		break;
	}
    if (GetColorTransform())
        GetEngine()->TransformColor(color, color);

	CRect oldDrawRect = GetSkinRect();
	CSize textSize;
	GetTextSize(textSize, *pDC);

	if ( (m_uScrollFlag & SKIN_SCROLL_ENABLE) != 0 ){
		int oldScrollOffset = m_nScrollOffset - m_nScrollSpeed;
		if ( (m_uScrollFlag & SKIN_SCROLL_DIRECTION) == 0 ){
			//计算旧的位置
			oldScrollOffset = oldScrollOffset % (drawRect.Width() + textSize.cx);
			if (m_nScrollSpeed >= 0)
				oldDrawRect.OffsetRect(oldScrollOffset - textSize.cx, 0);
			else
				oldDrawRect.OffsetRect(oldScrollOffset + drawRect.Width(), 0);

			//新的位置
			m_nScrollOffset = m_nScrollOffset % (drawRect.Width() + textSize.cx);
			if (m_nScrollSpeed >= 0)
				drawRect.OffsetRect(m_nScrollOffset - textSize.cx, 0);
			else
				drawRect.OffsetRect(m_nScrollOffset + drawRect.Width(), 0);
		}else{
			oldScrollOffset = oldScrollOffset % (drawRect.Height() + textSize.cy);
			//计算旧的位置
			if (m_nScrollSpeed >= 0)
				oldDrawRect.OffsetRect(0, oldScrollOffset);
			else
				oldDrawRect.OffsetRect(0, oldScrollOffset + drawRect.Height());

			//新的位置
			m_nScrollOffset = m_nScrollOffset % (drawRect.Height() + textSize.cy);
			if (m_nScrollSpeed >= 0)
				drawRect.OffsetRect(0, m_nScrollOffset);
			else
				drawRect.OffsetRect(0, m_nScrollOffset + drawRect.Height());
		}
		drawRect.right = drawRect.left + textSize.cx;
	}

    CString strSel = InternalGetSelText();
    if (strSel.IsEmpty()) {
        VARIANT_BOOL oldUnderline = m_textStyleNormal.Getunderline();
        LONG oldColor = m_textStyleNormal.Getcolor();
        m_textStyleNormal.Setunderline(newUnderline);
        m_textStyleNormal.Setcolor(color);
        m_textStyleNormal.DrawText(*pDC, m_strText, &drawRect, &m_rcTextArea);
        m_textStyleNormal.Setcolor(oldColor);
        m_textStyleNormal.Setunderline(oldUnderline);
    } else {
        LONG nStart = min(m_nSelStart, m_nSelEnd);
        nStart = max(nStart, 0);
        LONG nEnd = max(m_nSelStart, m_nSelEnd);
        nEnd = min(nEnd, m_strText.GetLength());

        VARIANT_BOOL oldUnderline = m_textStyleNormal.Getunderline();
        LONG oldColor = m_textStyleNormal.Getcolor();
        m_textStyleNormal.Setunderline(newUnderline);
        m_textStyleNormal.Setcolor(color);

        //绘制选中部分左侧文字
        CString strLeft = m_strText.Left(nStart);
        CRect rcLeft = drawRect;
        CRect rcLeftArea = drawRect;
        m_textStyleNormal.DrawText(*pDC, strLeft, &rcLeft, &rcLeftArea);

        //绘制选中文字
        strSel;
        CRect rcSel = drawRect;
        rcSel.left = rcLeftArea.right;
        CRect rcSelArea = rcSel;
        m_textStyleNormal.DrawTextEx(*pDC, strSel, &rcSel, RGB(255, 255, 255), &rcSelArea);

        //绘制选中文字右侧文字
        CString strRight = m_strText.Right(m_strText.GetLength() - nEnd);
        CRect rcRight = drawRect;
        rcRight.left = rcSelArea.right;
        CRect rcRightArea = drawRect;
        m_textStyleNormal.DrawText(*pDC, strRight, &rcRight, &rcRightArea);

        m_rcTextArea = drawRect;
        m_rcTextArea.right = rcRightArea.right;

        m_textStyleNormal.Setcolor(oldColor);
        m_textStyleNormal.Setunderline(oldUnderline);
    }
}
Esempio n. 19
0
File: main.cpp Progetto: zie87/sds
//
//	Main window procedure - just used to host the CodeView and UniView windows
//
LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	int width  = LOWORD(lParam);
	int height = HIWORD(lParam);
	int height2;
	RECT rect;

	switch(msg)
	{
	case WM_CREATE:
		g_seq.init(INITIAL_TEXT, lstrlen(INITIAL_TEXT));
		hwndUniView	 = CreateUniView(hwnd, &g_seq);
		hwndSpanView = CreateSpanView(hwnd, &g_seq);
		return 0;

	case WM_CLOSE:
		DestroyWindow(hwnd);
		return 0;

	case WM_SIZE:
		GetWindowRect(hwndUniView, &rect);
		height2 =  rect.bottom-rect.top;
		MoveWindow(hwndUniView, 0, 0, width, height2, TRUE);
		MoveWindow(hwndSpanView, 0, height2+2, width, height-height2-2, TRUE);
		InvalidateRect(hwndSpanView, 0,0);
		return 0;

	case WM_USER:
		InvalidateRect(hwndSpanView, 0, 0);
		return 0;

	case WM_SETFOCUS:
		SetFocus(hwndUniView);
		return 0;

	case WM_DESTROY:
		PostQuitMessage(0);
		return 0;

	case WM_COMMAND:

		switch(LOWORD(wParam))
		{
		case IDM_FILE_FONT:
			
			if(GetFont(hwnd, &g_LogFont))
			{
				DeleteObject(g_hFont);
				g_hFont = CreateFontIndirect(&g_LogFont);
				UpdateFont();

				InvalidateRect(hwndUniView, 0, 0);
				
				SetFocus(hwndMain);
				SetFocus(hwndUniView);
			}

			return 0;

		case IDM_FILE_ABOUT:

			MessageBox(hwnd, 
						_T("Piece Chain Demo\r\n\r\nCopyright(c) 2006 by Catch22 Productions.\r\nWritten by J Brown.\r\n\r\nHompage at www.catch22.net"), 
						_T("Piece Chain Demo"),
						MB_ICONINFORMATION);
			return 0;

		// Quit :)
		case IDM_FILE_EXIT:
			PostMessage(hwnd, WM_CLOSE, 0, 0);
			return 0;
		}
	}

	return DefWindowProc(hwnd, msg, wParam, lParam);
}
Esempio n. 20
0
void CDialogHeader::OnPaint() 
{
	//Variables
	CPaintDC	dc(this);	//Device context for painting
	CRect		rect;		//General purpose rect
	CRect		text;		//Rect for enclosing text
	int			temp=0;		//Temp variable for right side of text rect


	//Ensure the fonts have been created
	if (FALSE == m_bFonts)
	{
		UpdateFont (m_NormalFont,FW_NORMAL,m_nDescFontSize);
		UpdateFont (m_BoldFont,FW_BOLD,m_nTitleFontSize);
	}

	//Get the header client rect
	GetClientRect(rect);

	//Draw 3d border around rect
	dc.Draw3dRect(rect,GetSysColor(COLOR_BTNHIGHLIGHT),GetSysColor(COLOR_BTNSHADOW));

	//Fill the rect with solid color
	//Leaving space for line at bottom of rect
	dc.FillSolidRect(rect.left,rect.top,rect.Width(),rect.Height() - m_nxEdge,
		             m_cBackground);

	//Draw icon if one is present
	if (NULL != m_hIcon)
	{
		dc.DrawIcon(m_nIconOffset,m_nIconOffset,m_hIcon);
	}
	
	//Draw title text in bold font on one line
	dc.SelectObject(&m_BoldFont);
	text.left=rect.left + m_nTitleOffset;
	if ((NULL != m_hIcon) || (NULL != m_bBlankIcon))
	{
		//If no icon but we want space then add icon space to left margin
		text.left+=/*m_nIconWidth + */m_nIconOffset;
	}
	text.top=rect.top + m_nIconOffset;
	text.right=rect.right - m_nIconOffset - m_nyEdge;
	text.bottom=text.top + m_nTitleFontSize;
	temp=text.right;
	if (DT_CENTER == m_uAlign)
	{
		//If center align, make as much space on the right as the left
		//to make the text truly centered in the dialog
		text.right=text.right - (text.left - rect.left);
	}
	DrawText(dc.m_hDC,m_sTitle,m_sTitle.GetLength(),text,
	         m_uAlign | DT_WORDBREAK | DT_END_ELLIPSIS | DT_EDITCONTROL);
//	text.right=temp;


	//Draw description text in normal front using
	//rest of available header client area
	dc.SelectObject (&m_NormalFont);
//	if (DT_CENTER == m_uAlign)
//	{
//		//If center align, make as much space on the right as the left
//		//to make the text truly centered in the dialog
//		text.right=text.right - (text.left - rect.left);
//	}

	if (m_uAlign == DT_LEFT)
	{
		//Add desc offset if both aligned left
		//text.left=text.left + m_nDescOffset;
	}

	if (DT_RIGHT == m_uAlign)
	{
		//Subtract desc offset if both aligned right
		//text.right=text.right - m_nDescOffset;
	}
	text.top=text.bottom;
	text.bottom=rect.bottom;
	DrawText(dc.m_hDC,m_sDesc,m_sDesc.GetLength(),text,
	         m_uAlign | DT_WORDBREAK | DT_END_ELLIPSIS | DT_EDITCONTROL);
	
	// Do not call CWnd::OnPaint() for painting messages
}
Esempio n. 21
0
//
// Setting the size of the text to display.
//
void CTextDisplay::SetFontSize(LONG size, BOOL refresh)
{
	font_settings.lfHeight = size;
	UpdateFont();
}
Esempio n. 22
0
//
// Setting the text's font.
//
void CTextDisplay::SetFontType(char *font_name, BOOL refresh)
{
	strcpy(font_settings.lfFaceName, font_name);
	UpdateFont();
}
Esempio n. 23
0
void FixedLine::Init() {
	// We can not count on the dc being valid in the constructor
	// so we have to do initialization using it here
	UpdateFont();
}