Exemplo n.º 1
0
Arquivo: dc.c Projeto: bpowers/wine
static void test_dc_values(void)
{
    HDC hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
    COLORREF color;

    ok( hdc != NULL, "CreateDC failed\n" );
    color = SetBkColor( hdc, 0x12345678 );
    ok( color == 0xffffff, "initial color %08x\n", color );
    color = GetBkColor( hdc );
    ok( color == 0x12345678, "wrong color %08x\n", color );
    color = SetBkColor( hdc, 0xffffffff );
    ok( color == 0x12345678, "wrong color %08x\n", color );
    color = GetBkColor( hdc );
    ok( color == 0xffffffff, "wrong color %08x\n", color );
    color = SetBkColor( hdc, 0 );
    ok( color == 0xffffffff, "wrong color %08x\n", color );
    color = GetBkColor( hdc );
    ok( color == 0, "wrong color %08x\n", color );

    color = SetTextColor( hdc, 0xffeeddcc );
    ok( color == 0, "initial color %08x\n", color );
    color = GetTextColor( hdc );
    ok( color == 0xffeeddcc, "wrong color %08x\n", color );
    color = SetTextColor( hdc, 0xffffffff );
    ok( color == 0xffeeddcc, "wrong color %08x\n", color );
    color = GetTextColor( hdc );
    ok( color == 0xffffffff, "wrong color %08x\n", color );
    color = SetTextColor( hdc, 0 );
    ok( color == 0xffffffff, "wrong color %08x\n", color );
    color = GetTextColor( hdc );
    ok( color == 0, "wrong color %08x\n", color );

    DeleteDC( hdc );
}
Exemplo n.º 2
0
void CUITextBanner::EffectFade()
{
	EffectParams	&fade = m_StyleParams[tbsFade];

	// Проверям включена ли анимация
	if (!fade.bOn) return;

	// Если пришло время сменить направление фейда
	if (fade.fTimePassed > fade.fPeriod)
	{
		if (!fade.bCyclic)
		{
			fade.bOn = false;
			return;
		}

		if (0 == fade.iEffectStage)
			fade.iEffectStage = 1;
		else
			fade.iEffectStage = 0;
		fade.fTimePassed = 0;
	}

	if (fade.iEffectStage)
	{
		m_Cl = subst_alpha(GetTextColor(), u8(iFloor(255.f*(fade.fTimePassed / fade.fPeriod))));
	}
	else
	{
		m_Cl = subst_alpha(GetTextColor(), u8(iFloor(255.f*(1 - (fade.fTimePassed / fade.fPeriod)))));
	}
}
Exemplo n.º 3
0
void CUITextBanner::EffectFlicker()
{
	EffectParams	&flicker = m_StyleParams[tbsFlicker];

	// Проверям включена ли анимация
	if (!flicker.bOn) return;

	// Если пришло время, показать/спрятать надпись
	if (flicker.fTimePassed > flicker.fPeriod)
	{
		if (!flicker.bCyclic)
		{ 
			flicker.bOn = false;
			return;
		}
		
		if (0 == flicker.iEffectStage)
			flicker.iEffectStage = 1;
		else
			flicker.iEffectStage = 0;
		flicker.fTimePassed = 0;
	}

	if (flicker.iEffectStage)
	{
		m_Cl = subst_alpha(GetTextColor(), 0);
	}
	else
	{
		m_Cl = subst_alpha(GetTextColor(), 255);
	}
}
Exemplo n.º 4
0
void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
                                      CFX_Matrix* pUser2Device) {
  CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);

  if (m_pList) {
    CFX_FloatRect rcPlate = m_pList->GetPlateRect();
    CFX_FloatRect rcList = GetListRect();
    CFX_FloatRect rcClient = GetClientRect();

    for (int32_t i = 0, sz = m_pList->GetCount(); i < sz; i++) {
      CFX_FloatRect rcItem = m_pList->GetItemRect(i);
      if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom)
        continue;

      CFX_FloatPoint ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f);
      if (IFX_Edit* pEdit = m_pList->GetItemEdit(i)) {
        CFX_FloatRect rcContent = pEdit->GetContentRect();
        if (rcContent.Width() > rcClient.Width())
          rcItem.Intersect(rcList);
        else
          rcItem.Intersect(rcClient);
      }

      if (m_pList->IsItemSelected(i)) {
        CFX_SystemHandler* pSysHandler = GetSystemHandler();
        if (pSysHandler && pSysHandler->IsSelectionImplemented()) {
          IFX_Edit::DrawEdit(
              pDevice, pUser2Device, m_pList->GetItemEdit(i),
              CPWL_Utils::PWLColorToFXColor(GetTextColor()),
              CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()), rcList,
              ptOffset, nullptr, pSysHandler, m_pFormFiller);
          pSysHandler->OutputSelectedRect(m_pFormFiller, rcItem);
        } else {
          CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcItem,
                                   ArgbEncode(255, 0, 51, 113));
          IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
                             ArgbEncode(255, 255, 255, 255), 0, rcList,
                             ptOffset, nullptr, pSysHandler, m_pFormFiller);
        }
      } else {
        CFX_SystemHandler* pSysHandler = GetSystemHandler();
        IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
                           CPWL_Utils::PWLColorToFXColor(GetTextColor()),
                           CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()),
                           rcList, ptOffset, nullptr, pSysHandler, nullptr);
      }
    }
  }
}
Exemplo n.º 5
0
void    Label::OnPaint(RenderTarget& target, RenderQueue& queue) const
{
    Widget::OnPaint(target, queue);

    queue.SetColor(GetTextColor());
    target.Draw(mCaption);
}
Exemplo n.º 6
0
void    Label::LoadStyle(const std::string& nameStyle)
{
    ResourceManager* rm = ResourceManager::Get();
    StyleProperties& properties = rm->GetStyle(nameStyle);

    SetTextColor(rm->GetColorValue(properties["textColor"], GetTextColor()));

    Font* newFont = rm->GetFont(properties["font"], GetTextSize());
    if (newFont)
    {
        SetFont(*newFont);
    }

    if (properties["textSize"] != "")
    {
        mCaption.SetSize(rm->GetValue(properties["textSize"], GetTextSize()));

        const Vector2f& strSize = mCaption.GetRect().GetSize();

        if (properties["width"] == "")
            SetWidth(strSize.x);
        if (properties["height"] == "")
            SetHeight(strSize.y);
    }

    Widget::LoadStyle(nameStyle);
}
Exemplo n.º 7
0
COLORREF far pascal zGetTextColor( HDC pp1 )
{
    COLORREF r;

    SaveRegs();
    /*
    ** Log IN Parameters (No Create/Destroy Checking Yet!)
    */
    LogIn( (LPSTR)"APICALL:GetTextColor HDC+",
        pp1 );

    /*
    ** Call the API!
    */
    RestoreRegs();
    GrovelDS();
    r = GetTextColor(pp1);
    UnGrovelDS();
    SaveRegs();
    /*
    ** Log Return Code & OUT Parameters (No Create/Destroy Checking Yet!)
    */
    LogOut( (LPSTR)"APIRET:GetTextColor COLORREF++",
        r, (short)0 );

    RestoreRegs();
    return( r );
}
Exemplo n.º 8
0
void CGUICheckMarkControl::Render()
{
  m_label.SetText(m_strLabel);

  float textWidth = m_label.GetTextWidth();
  m_width = textWidth + 5 + m_imgCheckMark.GetWidth();
  m_height = m_imgCheckMark.GetHeight();

  float textPosX = m_posX;
  float checkMarkPosX = m_posX;

  if (m_label.GetLabelInfo().align & (XBFONT_RIGHT | XBFONT_CENTER_X))
    textPosX += m_imgCheckMark.GetWidth() + 5;
  else
    checkMarkPosX += textWidth + 5;

  m_label.SetMaxRect(textPosX, m_posY, textWidth, m_height);
  m_label.SetColor(GetTextColor());
  m_label.Render();

  if (m_bSelected)
  {
    m_imgCheckMark.SetPosition(checkMarkPosX, m_posY);
    m_imgCheckMark.Render();
  }
  else
  {
    m_imgCheckMarkNoFocus.SetPosition(checkMarkPosX, m_posY);
    m_imgCheckMarkNoFocus.Render();
  }
  CGUIControl::Render();
}
Exemplo n.º 9
0
COLORREF CExtLabel::OnQueryTextColor(
	bool bEnabled
	) const
{
	ASSERT_VALID( this );
COLORREF clrText = GetTextColor( bEnabled );
	if( clrText != COLORREF(-1L) )
		return clrText;
CWindowDC dcFake( NULL );
	clrText =
		PmBridge_GetPM()->QueryObjectTextColor(
			dcFake,
			bEnabled,
			false,
			false,
			false,
			(CObject*)this
			);
	if( clrText != COLORREF(-1L) )
		return clrText;
	clrText =
		PmBridge_GetPM()->GetColor(
			bEnabled
				? COLOR_BTNTEXT
				: CExtPaintManager::CLR_TEXT_DISABLED,
			(CObject*)this
			);
	return clrText;
}
Exemplo n.º 10
0
int DLL_CALLCONV
//---------------------------------------------------------------------------
// display text object
MTI_MTextDisplay(HDC dc, POINT pos, SIZE sz, HANDLE text)
{
	if (!text) return 0;

	COLORREF cl = GetTextColor(dc);
	//	if (GetTextColor(dc)&0xffffff != 0)
	{
		LRESULT lResult;
		CHARFORMAT cf = { 0 };
		cf.cbSize = sizeof(cf);
		cf.dwMask = CFM_COLOR;
		cf.crTextColor = cl;
		((TextObject *)text)->ftd->getTextService()->TxSendMessage(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf, &lResult);
	}

	SetBkMode(dc, TRANSPARENT);

	long lWidth = sz.cx, lHeight;
	((TextObject *)text)->ftd->get_NaturalSize(dc, &lWidth, &lHeight);
	RECT rt;
	rt.left = pos.x;
	rt.top = pos.y;
	rt.right = pos.x + lWidth;
	rt.bottom = pos.y + lHeight;
	((TextObject *)text)->ftd->Draw(dc, &rt);

	return 0;
}
Exemplo n.º 11
0
// --------------------------------------------------------------
VGColor
GDeviceWin32::GetFontColor() const
{
	//COLORREF c = GetTextColor( mHDC ); // COLORREF mask is 0x00bbggrr
	unsigned char c = (unsigned char)GetTextColor( mHDC ); // COLORREF mask is 0x00bbggrr
	return VGColor ( c & 0xff, c & 0xff00, c & 0xff0000);
}
Exemplo n.º 12
0
// Draws a cross-hatch and labels the cX, cY point.
BOOL dpi_Label(HDC hdc, double cX, double cY, COLORREF color, HFONT font, UINT align) {
    wchar_t tmp[16];
    swprintf(tmp, 16, L"%-2.3f, %-2.3f", cX, cY);

    UINT old_ta = GetTextAlign(hdc);
    COLORREF old_color = GetTextColor(hdc);
    HFONT old_font = GetCurrentObject(hdc, OBJ_FONT);
    HPEN old_pen = GetCurrentObject(hdc, OBJ_PEN);

    SetTextColor(hdc, color);
    SetTextAlign(hdc, align); // TA_CENTER | VTA_TOP
    SelectObject(hdc, font);
    SelectObject(hdc, GetStockObject(WHITE_PEN));

    // Draw cross-hair:
    dpi_MoveTo(hdc, cX, cY - 0.05);
    dpi_LineTo(hdc, cX, cY + 0.0525);
    dpi_MoveTo(hdc, cX - 0.05, cY);
    dpi_LineTo(hdc, cX + 0.0525, cY);
    // Label:
    BOOL ret = TextOutW(hdc, (int)(cX * dpi), (int)(cY * dpi), tmp, (int)wcslen(tmp));

    SelectObject(hdc, old_pen);
    SelectObject(hdc, old_font);
    SetTextAlign(hdc, old_ta);
    SetTextColor(hdc, old_color);
    return ret;
}
Exemplo n.º 13
0
void GUITextBox::Draw()
{
	if(IsVisible())
	{
		COLOR4 color = GetColor();
		Box(GetX(), GetY(), GetWidth(), GetHeight(),
			color.r, color.g, color.b, color.a);

		if(GetCaption() && GetCaptionFont())
		{
			COLOR4 c_color = GetCaptionColor();
			glColor4ub(c_color.r, c_color.g, c_color.b, c_color.a);
			PrintText(GetCaption(), GetCaptionFont(),
				GetX() + GetCaptionX(), GetY() + GetCaptionY());
		}

		if(GetTextFont())
		{
			COLOR4 t_color = GetTextColor();
			glColor4ub(t_color.r, t_color.g, t_color.b, t_color.a);
			PrintText(GetText(), GetTextFont(),
				GetX() + GetTextX(), GetY() + GetTextY());
		}
	}
}
Exemplo n.º 14
0
void CPWL_Note_CloseBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device)
{
	CPWL_Button::DrawThisAppearance(pDevice, pUser2Device);

	CPDF_Rect rcClient = this->GetClientRect();
	rcClient = CPWL_Utils::DeflateRect(rcClient, 2.0f);

	CFX_GraphStateData gsd;
	gsd.m_LineWidth = 1.0f;

	CFX_PathData pathCross;

	if (m_bMouseDown)
	{
		rcClient.left += 0.5f;
		rcClient.right += 0.5f;
		rcClient.top -= 0.5f;
		rcClient.bottom -= 0.5f;
	}

	pathCross.SetPointCount(4);
	pathCross.SetPoint(0, rcClient.left, rcClient.bottom, FXPT_MOVETO);
	pathCross.SetPoint(1, rcClient.right, rcClient.top, FXPT_LINETO);
	pathCross.SetPoint(2, rcClient.left, rcClient.top, FXPT_MOVETO);
	pathCross.SetPoint(3, rcClient.right, rcClient.bottom, FXPT_LINETO);
	
	pDevice->DrawPath(&pathCross, pUser2Device, &gsd, 
		0, CPWL_Utils::PWLColorToFXColor(GetTextColor(),this->GetTransparency()), FXFILL_ALTERNATE);
}
Exemplo n.º 15
0
void CPWL_Note_Options::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device)
{
	CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);

	CPDF_Rect rcClient = GetClientRect();
	rcClient.left = rcClient.right - 15.0f;

	CPDF_Point ptCenter = CPDF_Point((rcClient.left + rcClient.right) * 0.5f, (rcClient.top + rcClient.bottom) * 0.5f);

	CPDF_Point pt1(ptCenter.x - 2.0f, ptCenter.y + 2.0f * 0.5f);
	CPDF_Point pt2(ptCenter.x + 2.0f, ptCenter.y + 2.0f * 0.5f);
	CPDF_Point pt3(ptCenter.x, ptCenter.y - 3.0f * 0.5f);

	CFX_PathData path;

	path.SetPointCount(4);
	path.SetPoint(0, pt1.x, pt1.y, FXPT_MOVETO);
	path.SetPoint(1, pt2.x, pt2.y, FXPT_LINETO);
	path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO);
	path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO);

	pDevice->DrawPath(&path, pUser2Device, NULL, 
		CPWL_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), 
		0, FXFILL_ALTERNATE);
}
Exemplo n.º 16
0
void UIStaticText::Draw(const UIGeometricData &geometricData)
{
	textBlock->SetRectSize(size);
	textBlock->SetPosition(geometricData.position);
	textBlock->SetPivotPoint(geometricData.pivotPoint);
	PrepareSprite();
	textBlock->PreDraw();

    UIControl::Draw(geometricData);

    if(!FLOAT_EQUAL(shadowBg->GetDrawColor().a, 0.0f) && (!FLOAT_EQUAL(shadowOffset.dx, 0.0f) || !FLOAT_EQUAL(shadowOffset.dy, 0.0f)))
    {
		textBlock->Draw(GetShadowColor(), &shadowOffset);
        UIGeometricData shadowGeomData;
        shadowGeomData.position = shadowOffset;
        shadowGeomData.size = GetSize();
        shadowGeomData.AddToGeometricData(geometricData);

        shadowBg->SetAlign(textBg->GetAlign());
        shadowBg->SetPerPixelAccuracyType(background->GetPerPixelAccuracyType());
        shadowBg->Draw(shadowGeomData);
    }

    textBlock->Draw(GetTextColor());
    textBg->SetPerPixelAccuracyType(background->GetPerPixelAccuracyType());
    textBg->Draw(geometricData);
}
Exemplo n.º 17
0
/* Synced with wine 1.1.32 */
static void TEXT_DrawUnderscore (HDC hdc, int x, int y, const WCHAR *str, int offset, const RECT *rect)
{
    int prefix_x;
    int prefix_end;
    SIZE size;
    HPEN hpen;
    HPEN oldPen;

    GetTextExtentPointW (hdc, str, offset, &size);
    prefix_x = x + size.cx;
    GetTextExtentPointW (hdc, str, offset+1, &size);
    prefix_end = x + size.cx - 1;
    /* The above method may eventually be slightly wrong due to kerning etc. */

    /* Check for clipping */
    if (rect)
    {
        if (prefix_x > rect->right || prefix_end < rect->left ||
            y < rect->top || y > rect->bottom)
            return; /* Completely outside */
        /* Partially outside */
        if (prefix_x   < rect->left ) prefix_x   = rect->left;
        if (prefix_end > rect->right) prefix_end = rect->right;
    }

    hpen = CreatePen (PS_SOLID, 1, GetTextColor (hdc));
    oldPen = SelectObject (hdc, hpen);
    MoveToEx (hdc, prefix_x, y, NULL);
    LineTo (hdc, prefix_end, y);
    SelectObject (hdc, oldPen);
    DeleteObject (hpen);
}
Exemplo n.º 18
0
u32  CUITextBanner::GetTextColor()
{
	void SetTextColor			(u32 cl);
	u32  GetTextColor			();

	return m_Cl;
}
Exemplo n.º 19
0
Arquivo: dc.c Projeto: GeonHun/wine
static void test_dc_values(void)
{
    HDC hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
    COLORREF color;
    int extra;

    ok( hdc != NULL, "CreateDC failed\n" );
    color = SetBkColor( hdc, 0x12345678 );
    ok( color == 0xffffff, "initial color %08x\n", color );
    color = GetBkColor( hdc );
    ok( color == 0x12345678, "wrong color %08x\n", color );
    color = SetBkColor( hdc, 0xffffffff );
    ok( color == 0x12345678, "wrong color %08x\n", color );
    color = GetBkColor( hdc );
    ok( color == 0xffffffff, "wrong color %08x\n", color );
    color = SetBkColor( hdc, 0 );
    ok( color == 0xffffffff, "wrong color %08x\n", color );
    color = GetBkColor( hdc );
    ok( color == 0, "wrong color %08x\n", color );

    color = SetTextColor( hdc, 0xffeeddcc );
    ok( color == 0, "initial color %08x\n", color );
    color = GetTextColor( hdc );
    ok( color == 0xffeeddcc, "wrong color %08x\n", color );
    color = SetTextColor( hdc, 0xffffffff );
    ok( color == 0xffeeddcc, "wrong color %08x\n", color );
    color = GetTextColor( hdc );
    ok( color == 0xffffffff, "wrong color %08x\n", color );
    color = SetTextColor( hdc, 0 );
    ok( color == 0xffffffff, "wrong color %08x\n", color );
    color = GetTextColor( hdc );
    ok( color == 0, "wrong color %08x\n", color );

    extra = GetTextCharacterExtra( hdc );
    ok( extra == 0, "initial extra %d\n", extra );
    SetTextCharacterExtra( hdc, 123 );
    extra = GetTextCharacterExtra( hdc );
    ok( extra == 123, "initial extra %d\n", extra );
    SetMapMode( hdc, MM_LOMETRIC );
    extra = GetTextCharacterExtra( hdc );
    ok( extra == 123, "initial extra %d\n", extra );
    SetMapMode( hdc, MM_TEXT );
    extra = GetTextCharacterExtra( hdc );
    ok( extra == 123, "initial extra %d\n", extra );

    DeleteDC( hdc );
}
Exemplo n.º 20
0
void EditPanel::onTextColorClicked(bool /*checked*/)
{
	QColor color;
	GetTextColor(color);
	color = QColorDialog::getColor(color, this, tr("Text Color"));
	SetTextColor(color);
	emit edited();
}
Exemplo n.º 21
0
// --------------------------------------------------------------
VGColor
GDeviceWin32::GetFontBackgroundColor() const
{
	int mode = GetBkMode(mHDC);
//	COLORREF c = GetBkColor(mHDC);
	unsigned char c = (unsigned char)GetTextColor( mHDC ); // COLORREF mask is 0x00bbggrr
	return VGColor ( c & 0xff, c & 0xff00, c & 0xff0000, mode == TRANSPARENT ? ALPHA_TRANSPARENT : ALPHA_OPAQUE);
}
Exemplo n.º 22
0
void CPWL_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects,
                                    const CPDF_Point& ptOffset) {
  CFX_ArrayTemplate<CPDF_TextObject*> ObjArray;
  IFX_Edit::GeneratePageObjects(
      pPageObjects, m_pEdit, ptOffset, NULL,
      CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
      ObjArray);
}
Exemplo n.º 23
0
void SystemDraw::DrawPolyPolyPolygonOp(const Point *vertices, int vertex_count,
                                       const int *subpolygon_counts, int subpolygon_count_count,
                                       const int *disjunct_polygon_counts, int disjunct_polygon_count_count,
                                       Color color, int width, Color outline, uint64 pattern, Color doxor)
{
    GuiLock __;
    if(vertex_count == 0)
        return;
    bool is_xor = !IsNull(doxor);
    HDC hdc = GetHandle();
    if(pattern) {
        int old_rop = GetROP2(hdc);
        HGDIOBJ old_brush = GetCurrentObject(hdc, OBJ_BRUSH);
        word wpat[8] = {
            (byte)(pattern >> 56), (byte)(pattern >> 48), (byte)(pattern >> 40), (byte)(pattern >> 32),
            (byte)(pattern >> 24), (byte)(pattern >> 16), (byte)(pattern >> 8), (byte)(pattern >> 0),
        };
        HBITMAP bitmap = CreateBitmap(8, 8, 1, 1, wpat);
        HBRUSH brush = ::CreatePatternBrush(bitmap);
        COLORREF old_bk = GetBkColor(hdc);
        COLORREF old_fg = GetTextColor(hdc);
        if(!is_xor) {
            SetROP2(hdc, R2_MASKPEN);
            SelectObject(hdc, brush);
            SetTextColor(hdc, Black());
            SetBkColor(hdc, White());
            SetDrawPen(PEN_NULL, Black);
            DrawPolyPolyPolygonRaw(*this, vertices, vertex_count,
                                   subpolygon_counts, subpolygon_count_count,
                                   disjunct_polygon_counts, disjunct_polygon_count_count);
            SetROP2(hdc, R2_MERGEPEN);
            SetTextColor(hdc, color);
            SetBkColor(hdc, Black());
        }
        else {
            SetROP2(hdc, R2_XORPEN);
            SetTextColor(hdc, COLORREF(color) ^ COLORREF(doxor));
            SelectObject(hdc, brush);
        }
        DrawPolyPolyPolygonRaw(*this, vertices, vertex_count,
                               subpolygon_counts, subpolygon_count_count,
                               disjunct_polygon_counts, disjunct_polygon_count_count);
        SelectObject(hdc, old_brush);
        SetTextColor(hdc, old_fg);
        SetBkColor(hdc, old_bk);
        SetROP2(hdc, old_rop);
        DeleteObject(brush);
        DeleteObject(bitmap);
        if(!IsNull(outline)) {
            SetColor(Null);
            SetDrawPen(width, outline);
            ASSERT(sizeof(POINT) == sizeof(Point));
            DrawPolyPolyPolygonRaw(*this, vertices, vertex_count,
                                   subpolygon_counts, subpolygon_count_count,
                                   disjunct_polygon_counts, disjunct_polygon_count_count);
        }
    }
    else { // simple fill
Exemplo n.º 24
0
Arquivo: Menu.c Projeto: tobynet/clcl
/*
 * menu_draw_ckeck - メニューのチェックマークを描画
 */
static BOOL menu_draw_ckeck(const HDC draw_dc, const int left, const int top, const int right, const int bottom)
{
	HDC hdc;
	HBITMAP hbmp, ret_hbmp;
	HDC wk_dc;
	HBITMAP wk_hbmp, wk_ret_hbmp;
	HANDLE hBrush;
	RECT draw_rect;

	// 作業用DCの作成
	if ((hdc = CreateCompatibleDC(draw_dc)) == NULL) {
		return FALSE;
	}
	if ((hbmp = CreateCompatibleBitmap(draw_dc, right - left, bottom - top)) == NULL) {
		DeleteDC(hdc);
		return FALSE;
	}
	ret_hbmp = SelectObject(hdc, hbmp);

	if ((wk_dc = CreateCompatibleDC(draw_dc)) == NULL) {
		SelectObject(hdc, ret_hbmp);
		DeleteObject(hbmp);
		DeleteDC(hdc);
		return FALSE;
	}
	if ((wk_hbmp = CreateCompatibleBitmap(draw_dc, right - left, bottom - top)) == NULL) {
		SelectObject(hdc, ret_hbmp);
		DeleteObject(hbmp);
		DeleteDC(hdc);
		DeleteDC(wk_dc);
		return FALSE;
	}
	wk_ret_hbmp = SelectObject(wk_dc, wk_hbmp);

	SetRect(&draw_rect, 0, 0, right - left, bottom - top);
	
	// マスクの描画
	DrawFrameControl(hdc, &draw_rect, DFC_MENU, DFCS_MENUCHECK);
	BitBlt(hdc, 0, 0, right - left, bottom - top, hdc, 0, 0, DSTINVERT);
	BitBlt(draw_dc, left, top, right, bottom, hdc, 0, 0, SRCPAINT);

	// チェックマークの描画
	hBrush = CreateSolidBrush(GetTextColor(draw_dc));
	FillRect(hdc, &draw_rect, hBrush);
	DeleteObject(hBrush);
	DrawFrameControl(wk_dc, &draw_rect, DFC_MENU, DFCS_MENUCHECK);
	BitBlt(hdc, 0, 0, right - left, bottom - top, wk_dc, 0, 0, SRCPAINT);
	BitBlt(draw_dc, left, top, right, bottom, hdc, 0, 0, SRCAND);

	SelectObject(hdc, ret_hbmp);
	DeleteObject(hbmp);
	DeleteDC(hdc);
	SelectObject(wk_dc, wk_ret_hbmp);
	DeleteObject(wk_hbmp);
	DeleteDC(wk_dc);
	return TRUE;
}
void CCPListCtrl::OnCustomDraw(NMHDR *pNotifyStruct, LRESULT *pLResult)
{
  NMLVCUSTOMDRAW *pLVCD = (NMLVCUSTOMDRAW *)pNotifyStruct;

  *pLResult = CDRF_DODEFAULT;

  static COLORREF crWindowText, cfNormalTextBkgrd, crSelectedText, crSelectedBkgrd;
  bool bIsSelected = IsSelected(pLVCD->nmcd.dwItemSpec);
  
  switch (pLVCD->nmcd.dwDrawStage) {
    case CDDS_PREPAINT:
      // PrePaint
      crWindowText = GetTextColor();
      cfNormalTextBkgrd = GetTextBkColor();
      crSelectedText = ::GetSysColor(COLOR_HIGHLIGHTTEXT);
      crSelectedBkgrd = ::GetSysColor(COLOR_HIGHLIGHT);
      *pLResult = CDRF_NOTIFYITEMDRAW;
      break;

    case CDDS_ITEMPREPAINT:
      // Item PrePaint
      if ((pLVCD->nmcd.uItemState & CDIS_SELECTED) == CDIS_SELECTED) {
        pLVCD->clrText = crWindowText;
        pLVCD->clrTextBk = cfNormalTextBkgrd;
        pLVCD->nmcd.uItemState &= ~CDIS_SELECTED;
        *pLResult |= CDRF_NEWFONT;
      }
      *pLResult |= CDRF_NOTIFYSUBITEMDRAW;
      break;

    case CDDS_ITEMPREPAINT | CDDS_SUBITEM:
      // Sub-item PrePaint
      if (bIsSelected &&
          (m_column != -1 && pLVCD->iSubItem == m_column)) {
        pLVCD->clrText = crSelectedText;
        pLVCD->clrTextBk = crSelectedBkgrd;
        pLVCD->nmcd.uItemState &= ~CDIS_SELECTED;
      } else {
        pLVCD->clrText = crWindowText;
        pLVCD->clrTextBk = cfNormalTextBkgrd;
      }
      *pLResult |= (CDRF_NOTIFYPOSTPAINT | CDRF_NEWFONT);
      break;

    /*
    case CDDS_PREERASE:
    case CDDS_POSTERASE:
    case CDDS_POSTPAINT:
    case CDDS_ITEMPOSTPAINT | CDDS_SUBITEM:
    case CDDS_ITEMPOSTPAINT:
    case CDDS_ITEMPREERASE:
    case CDDS_ITEMPOSTERASE:
    */
    default:
      break;
  }
}
Exemplo n.º 26
0
GUI_ButtonSmall::GUI_ButtonSmall(PG_Widget* parent, int btnid, const PG_Rect& r, char* text) : GUI_Button(parent,btnid,r,text) {
	PG_Theme* theme = PG_Application::GetTheme();

	SetFont(BtnFont);
	drawbackground = true;
	c = GUI_SmBtColor;

	LoadThemeStyle("GUI_NormalButton", "Button");

	GUI_BtnTextColor = GetTextColor();
	SDL_Color* color = theme->FindColor("GUI_MenuButton", "Button", "textcolor2");

	if(color != NULL) {
		GUI_BtnATextColor = *color;
	}

	GUI_BtnTextColor = GetTextColor();
}
Exemplo n.º 27
0
void CGUIButtonControl::ProcessText(unsigned int currentTime)
{
  CRect labelRenderRect = m_label.GetRenderRect();
  CRect label2RenderRect = m_label2.GetRenderRect();

  float renderWidth = GetWidth();
  bool changed = m_label.SetMaxRect(m_posX, m_posY, renderWidth, m_height);
  changed |= m_label.SetText(m_info.GetLabel(m_parentID));
  changed |= m_label.SetScrolling(HasFocus());
  changed |= m_label2.SetMaxRect(m_posX, m_posY, renderWidth, m_height);
  changed |= m_label2.SetText(m_info2.GetLabel(m_parentID));

  // text changed - images need resizing
  if (m_minWidth && (m_label.GetRenderRect() != labelRenderRect))
    SetInvalid();

  // auto-width - adjust hitrect
  if (m_minWidth && m_width != renderWidth)
  {
    CRect rect(m_posX, m_posY, renderWidth, m_height);
    SetHitRect(rect, m_hitColor);
  }

  // render the second label if it exists
  if (!m_info2.GetLabel(m_parentID).empty())
  {
    changed |= m_label2.SetAlign(XBFONT_RIGHT | (m_label.GetLabelInfo().align & XBFONT_CENTER_Y) | XBFONT_TRUNCATED);
    changed |= m_label2.SetScrolling(HasFocus());

    // If overlapping was corrected - compare render rects to determine
    // if they changed since last frame.
    if (CGUILabel::CheckAndCorrectOverlap(m_label, m_label2))
      changed |= (m_label.GetRenderRect()  != labelRenderRect ||
                  m_label2.GetRenderRect() != label2RenderRect);

    changed |= m_label2.SetColor(GetTextColor());
    changed |= m_label2.Process(currentTime);
  }
  changed |= m_label.SetColor(GetTextColor());
  changed |= m_label.Process(currentTime);
  if (changed)
    MarkDirtyRegion();
}
Exemplo n.º 28
0
void CUIListBoxItem::Draw()
{
	m_bTextureAvailable = m_bSelected;

	u32 CurColor = GetTextColor();
	u32 ResColor = (IsEnabled() ? 0xff000000 : 0x80000000) | (CurColor & 0x00ffffff);
	SetTextColor(ResColor);

	CUILabel::Draw();
}
Exemplo n.º 29
0
void CMultiSelTreeCtrl::SetItemFocus(HTREEITEM item) 
{
    if( item == m_LastMouseOver )
        return;

    if( m_LastMouseOver != NULL )
	{
		CRect rect;
		GetItemRect( m_LastMouseOver, &rect, TRUE );
		rect.DeflateRect(0,1,0,1);
	
		CDC *pDC= GetDC();
		CBrush brush;
		if( IsSelected( m_LastMouseOver ) )
		{
			if( GetTextColor() != -1 )
				brush.CreateSolidBrush( GetTextColor() );
			else
				brush.CreateSolidBrush( GetSysColor( COLOR_WINDOWTEXT ) );
		}
		else
			brush.CreateSolidBrush( GetSysColor( COLOR_WINDOW ) );
		pDC->FrameRect( &rect, &brush );

		ReleaseDC( pDC );
	}
    	
    m_LastMouseOver= item;

    if( m_LastMouseOver != NULL )
    {
		CRect rect;
		GetItemRect( item, &rect, TRUE );
		rect.DeflateRect(0,1,0,1);

		CDC *pDC= GetDC();
		pDC->DrawFocusRect(&rect);

		ReleaseDC( pDC );
	}
		
}
void CXTPSyntaxEditTipWnd::OnNcPaint()
{
	CXTPWindowRect rc(this);
	rc.OffsetRect(-rc.TopLeft());

	CWindowDC dc(this);
	dc.SetBkColor(GetBackColor());
	dc.SetTextColor(GetTextColor());
	dc.FillSolidRect(&rc, dc.GetBkColor());
	dc.DrawFocusRect(&rc);
}