Esempio n. 1
0
void CFWL_ListBoxTP::DrawListBoxItem(CFX_Graphics* pGraphics,
                                     FX_DWORD dwStates,
                                     const CFX_RectF* prtItem,
                                     void* pData,
                                     CFX_Matrix* pMatrix) {
  if (dwStates & FWL_PARTSTATE_LTB_Selected) {
    pGraphics->SaveGraphState();
    CFX_Color crFill(FWL_GetThemeColor(m_dwThemeID) == 0
                         ? FWLTHEME_COLOR_BKSelected
                         : FWLTHEME_COLOR_Green_BKSelected);
    pGraphics->SetFillColor(&crFill);
    CFX_RectF rt(*prtItem);
    CFX_Path path;
    path.Create();
#if (_FX_OS_ == _FX_MACOSX_)
    path.AddRectangle(rt.left, rt.top, rt.width - 1, rt.height - 1);
#else
    path.AddRectangle(rt.left, rt.top, rt.width, rt.height);
#endif
    pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
    pGraphics->RestoreGraphState();
  }
  if (dwStates & FWL_PARTSTATE_LTB_Focused) {
    if (pData) {
      DrawFocus(pGraphics, (CFX_RectF*)pData, pMatrix);
    }
  }
}
Esempio n. 2
0
//-----------------------------------------------------------------------------
// Name:		OnSetFocus
//-----------------------------------------------------------------------------
void CCheckBox::OnSetFocus(CWnd* pOldWnd) 
{	
	hasFocus = drawFocus;
	DrawFocus ();

	CButton::OnSetFocus(pOldWnd);
}
Esempio n. 3
0
void DropGrid::Paint(Draw& w)
{
	Size sz = GetSize();
	Size isz = clear.GetStdSize();
	if(clear_button && !notnull && IsEnabled() && IsSelected())
	{
		clear.Show();
		clear.RightPos(3, isz.cx).TopPos((sz.cy - isz.cy) / 2, isz.cy);
	}
	else
		clear.Hide();
	
	GridDisplay &disp = display ? *display : list.GetDisplay();
	bool hf = HasFocus();
	bool isnull = rowid < 0;
	Color fg = hf ? SColorHighlightText() : IsEnabled() ? SColorText() : SColorDisabled();
	Color bg = !IsEnabled() || !IsEditable() 
		? EditField::StyleDefault().disabled
	    : notnull && isnull 
	    	? Blend(SColorPaper, Color(255, 0, 0), 32)
	        : hf ? SColorHighlight() : SColorPaper();

	const int d = 0;
	
	if(isnull)
		w.DrawRect(d, d, sz.cx - d * 2, sz.cy - d * 2, bg);
	else
	{
		Font fnt(StdFont());
		Paint0(w, 1, 1, d, d, sz.cx - d * 2, sz.cy - d * 2, Format0(Null, rowid), 0, fg, bg, fnt);
	}

	if(hf)
		DrawFocus(w, d - 0, d - 0, sz.cx - (d - 0) * 2, sz.cy - (d - 0) * 2);
}
void Window_Selectable::DrawContent() const{
	TCHAR buf[WND_SELECTABLE_TITLELENGTH];
	BYTE color;
	int contentSize = 0;
	BYTE _state = state;
	if(GetActive()){
		if(drawFocus){
			DrawFocus();
		}
		int cntX = frameArea.x + contentArea.x;
		int cntY = frameArea.y + contentArea.y;
		// タイトルを描画する場合
		if(useTitle){
			GetTitle(buf);
			DrawStringToHandle(
				cntX + GetDrawDeltaX(buf, -1, titleFontSize.hFont), 
				cntY, buf,
				GetPresetColor(presetColorIndex, COLORSET_COLOR_NORMAL),
				titleFontSize.hFont);
			cntY += titleFontSize.lineHeight;
		}

		// 各選択肢の描画
		contentSize = num;
		for(int n=0; n<contentSize; n++){
			color = select.isActive[n] ? ((select.index == n) 
			? WND_SELECTABLE_COLOR_SELECTED : WND_SELECTABLE_COLOR_ACTIVE) 
			: WND_SELECTABLE_COLOR_INACTIVE,
			DrawContentItem(n, color);
		}
	}
	SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255);
}
Esempio n. 5
0
void
ZCheckBox::OnSetFocus( CWnd *pWndLostFocus )
{
   if ( m_pZSubtask->InformDriverOfSetFocus( this ) )
   {
      m_bHasFocus = m_bDrawFocus;
      DrawFocus( );

   // Default( );             // pass it along to parent
      CButton::OnSetFocus( pWndLostFocus );
   }
}
Esempio n. 6
0
//-----------------------------------------------------------------------------
// Name:		OnKillFocus
//-----------------------------------------------------------------------------
void CCheckBox::OnKillFocus(CWnd* pNewWnd) 
{
	if (spaceDown) {				// mouse pressed in another window, 
		spaceDown = false;			// while spaceDown
		if (m_bChecked) SetState (BOX_ON);
		else			SetState (BOX_OFF);
	}
	hasFocus = false;
	DrawFocus ();

	CButton::OnKillFocus(pNewWnd);
}
Esempio n. 7
0
/////////////////////////////////////////////////////////////////////////////
// Name:    OnPaint
// Description:   Blits the prepared bitmaps to the screen
/////////////////////////////////////////////////////////////////////////////
void
ZCheckBox::OnPaint( )
{
   DWORD clr1 = ::GetSysColor( COLOR_3DFACE );
   if ( m_clr != clr1 )  // sysColor changed??
   {
      for ( int k = 0; k < 6; k++ )  // => prepare bitmaps again
      {
         if ( m_bitmaps[ k ] )
         {
            DeleteObject( m_bitmaps[ k ] );  // it was subscript 0???
            m_bitmaps[ k ] = 0;
         }
      }

      m_clr = clr1;

      if ( m_brush )
         DeleteObject( m_brush );

      m_brush = ::CreateSolidBrush( m_clr );
      m_bPrepareBitmaps = TRUE;
   }

   if ( m_bHasFocus )
      DrawFocus( TRUE );

   CPaintDC dc( this );

   if ( m_bPrepareBitmaps )  // called first time or sysColor changed?
   {
      PrepareBitmaps( dc.m_hDC ); // => prepare bitmaps
      m_bPrepareBitmaps = FALSE;
   }

   BlitToScreen( dc.m_hDC, m_lState );

   if ( m_bHasFocus )
      DrawFocus( TRUE );
}
Esempio n. 8
0
//-----------------------------------------------------------------------------
// Name:		SetState
// Description:	Sets the new state and then blits the CB to the screen
//
// Entry:		
//				int nState - specifies the state of the CB and can be: 
//					BOX_ON			== checked state
//					BOX_OFF			== unchecked state
//					BOX_LDOWN_1		== mouse button down in checked state
//					BOX_LDOWN_2		== mouse button down in unchecked state
//					BOX_DISABLED_1	== CB disabled in checked state
//					BOX_DISABLED_2	== CB disabled in unchecked state		
//-----------------------------------------------------------------------------
void CCheckBox::SetState (int state)
{
	if (state != m_nState) {
		m_nState = state;

//		CDC* pdc = GetDC ();
//		BlitToScreen(pdc->m_hDC,state);
//		ReleaseDC (pdc);

		if (hasFocus)
			DrawFocus (true);
	}
}
Esempio n. 9
0
/////////////////////////////////////////////////////////////////////////////
// Sets the new state and then blits the CB to the screen
//
//   int lState - specifies the state of the CB and can be:
//         BOX_ON         == checked state
//         BOX_OFF        == unchecked state
//         BOX_LDOWN_1    == mouse button down in checked state
//         BOX_LDOWN_2    == mouse button down in unchecked state
//         BOX_DISABLED_1 == CB disabled in checked state
//         BOX_DISABLED_2 == CB disabled in unchecked state
/////////////////////////////////////////////////////////////////////////////
void
ZCheckBox::SetState( int lState )
{
   if ( lState != m_lState )
   {
      m_lState = lState;

      CDC *pDC = GetDC( );
      BlitToScreen( pDC->m_hDC, lState );
      ReleaseDC( pDC );

      if ( m_bHasFocus )
         DrawFocus( TRUE );
   }
}
void CCBButtonLook::OnUpDraw(CCButton* pButton, CCDrawContext* pDC)
{
	if( pButton->GetType() == CCBT_PUSH2  && pButton->GetCheck() ) 
	{
		OnDownDraw( pButton, pDC );
		return;
	}

	sRect r = pButton->GetInitialClientRect();
	if( GetCustomLook() )
		DrawBitmapButtonCustom1( pDC, r, m_pUpBitmaps, false, m_bStretch );
	else
		DrawBitmapFrame9(pDC, r, m_pUpBitmaps, m_bStretch, GetScale() );
	if(pButton->IsFocus()==true) DrawFocus(pDC, r);

	DrawText(pButton, pDC, pButton->GetClientRect(), pButton->m_szName, pButton->GetAlignment());
}
Esempio n. 11
0
void CBfDrawButton::DrawButton(Color OutR, Color UpBegin, Color UpEnd, Color DownBegin, Color DownEnd, Color BRColor, Color SRColor, COLORREF PtColor)
{
	CRect WndRect = m_WndRect;
	// 填充背景色
	SolidBrush FillBrush(Color(255, 255, 255));
	m_pDoGrap->FillRectangle(&FillBrush, WndRect.left, WndRect.top, WndRect.Width(), WndRect.Height());

	// 按钮外圈
	Pen OutLine(OutR);
	CRect OutRect(WndRect);
	OutRect.right--;
	OutRect.bottom--;
	RectF GRt = CUiMethod::CRect2RectF(OutRect);
	m_pDoGrap->DrawRectangle(&OutLine, GRt);

	// 上半部分高光
	CRect UpHRect(WndRect);
	UpHRect.left += 2;
	UpHRect.top += 2;
	UpHRect.right -= 2;
	UpHRect.bottom = (WndRect.Height() / 2) + WndRect.top;
	Point Pt1 = Point(UpHRect.left, UpHRect.top - 1), Pt2 = Point(UpHRect.left, UpHRect.bottom);
	LinearGradientBrush lgBrush1(Pt1, Pt2, UpBegin, UpEnd);
	m_pDoGrap->FillRectangle(&lgBrush1, UpHRect.left, UpHRect.top, UpHRect.Width(), UpHRect.Height());

	// 下半部分高光
	CRect DownHRect(WndRect);
	DownHRect.top = UpHRect.bottom;
	DownHRect.left += 2;
	DownHRect.right -= 2;
	DownHRect.bottom -= 2;
	Pt1 = Point(DownHRect.left, DownHRect.top - 1);
	Pt2 = Point(DownHRect.left, DownHRect.bottom);
	LinearGradientBrush lgBrush2(Pt1, Pt2, DownBegin, DownEnd);
	m_pDoGrap->FillRectangle(&lgBrush2, DownHRect.left, DownHRect.top, DownHRect.Width(), DownHRect.Height());

	// 四角高光
	Draw4Corner(BRColor, SRColor, PtColor);

	// 画焦点
	DrawFocus();

	// 文字
	DrawBtnText();
}
Esempio n. 12
0
void STextButton::OnPaint( IRenderTarget *pRT )
{
	SPainter painter;

	BeforePaint(pRT, painter);

	CRect rcText;
	GetTextRect(rcText);
	DrawText(pRT,m_strText, m_strText.GetLength(), rcText, GetTextAlign());

	//draw focus rect
	if(IsFocused())
	{
		DrawFocus(pRT);
	}

	AfterPaint(pRT, painter);
}
Esempio n. 13
0
FX_BOOL CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
  if (!pParams)
    return FALSE;
  switch (pParams->m_iPart) {
    case FWL_PART_CKB_Border: {
      DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
      break;
    }
    case FWL_PART_CKB_Edge: {
      DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(),
               &pParams->m_rtPart, &pParams->m_matrix);
      break;
    }
    case FWL_PART_CKB_Background: {
      FillBackground(pParams->m_pGraphics, &pParams->m_rtPart,
                     &pParams->m_matrix);
      if (pParams->m_dwStates & FWL_PARTSTATE_CKB_Focused) {
        pParams->m_rtPart = *(CFX_RectF*)pParams->m_pData;
        DrawFocus(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
      }
      break;
    }
    case FWL_PART_CKB_CheckBox: {
      DrawBoxBk(pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart,
                pParams->m_dwStates, &pParams->m_matrix);
      if (((pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask2) ==
           FWL_PARTSTATE_CKB_Checked) |
          ((pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask2) ==
           FWL_PARTSTATE_CKB_Neutral)) {
        DrawSign(pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart,
                 pParams->m_dwStates, &pParams->m_matrix);
      }
      FX_BOOL bDisable = (pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask1) ==
                         FWL_PARTSTATE_CKB_Disabled;
      DrawSignBorder(pParams->m_pWidget, pParams->m_pGraphics,
                     &pParams->m_rtPart, bDisable, &pParams->m_matrix);
      break;
    }
    default: { return FALSE; }
  }
  return TRUE;
}
Esempio n. 14
0
void
ZCheckBox::OnKillFocus( CWnd *pNewWnd )
{
   m_pZSubtask->InformDriverOfKillFocus( this );
   if ( m_bSpaceDown )
   {
      // mouse pressed in another window, while m_bSpaceDown
      m_bSpaceDown = FALSE;
      if ( m_bChecked )
         SetState( BOX_ON );
      else
         SetState( BOX_OFF );
   }

   m_bHasFocus = FALSE;
   DrawFocus( );

   CButton::OnKillFocus( pNewWnd );
// Default( );             // pass it along to parent
}
void CCBButtonLook::OnDownDraw(CCButton* pButton, CCDrawContext* pDC)
{
	sRect r = pButton->GetInitialClientRect();
	if( GetCustomLook() )
	{
		DrawBitmapButtonCustom1( pDC, r, m_pDownBitmaps, true, m_bStretch );
		r = pButton->GetClientRect();
		r.x += 1;
		r.y += 1;
		r.w += 1;
		r.h += 1;
	}
	else
	{
		DrawBitmapFrame9(pDC, r, m_pDownBitmaps, m_bStretch, GetScale() );
		r = pButton->GetClientRect();
	}
	if(pButton->IsFocus()==true) DrawFocus(pDC, r);
    
	DrawText(pButton, pDC, r, pButton->m_szName, pButton->GetAlignment());
}
Esempio n. 16
0
    void SComboBase::OnPaint(IRenderTarget * pRT )
    {
        SPainter painter;

        BeforePaint(pRT, painter);
        if(GetCurSel() != -1 && m_pEdit==NULL)
        {
            CRect rcText;
            GetTextRect(rcText);
            SStringT strText=GetWindowText();
            DrawText(pRT,strText, strText.GetLength(), rcText, GetTextAlign());
        }
        //draw focus rect
        if(IsFocused())
        {
            DrawFocus(pRT);
        }
        AfterPaint(pRT, painter);
        CRect rcBtn;
        GetDropBtnRect(&rcBtn);
        m_pSkinBtn->Draw(pRT,rcBtn,IIF_STATE3(m_dwBtnState,WndState_Normal,WndState_Hover,WndState_PushDown));
    }
Esempio n. 17
0
FX_BOOL CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
  if (!pParams)
    return FALSE;
  switch (pParams->m_iPart) {
    case CFWL_Part::Border: {
      DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
      break;
    }
    case CFWL_Part::Edge: {
      DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(),
               &pParams->m_rtPart, &pParams->m_matrix);
      break;
    }
    case CFWL_Part::Background: {
      FillBackground(pParams->m_pGraphics, &pParams->m_rtPart,
                     &pParams->m_matrix);
      if (pParams->m_dwStates & CFWL_PartState_Focused) {
        pParams->m_rtPart = *(CFX_RectF*)pParams->m_pData;
        DrawFocus(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
      }
      break;
    }
    case CFWL_Part::CheckBox: {
      DrawBoxBk(pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart,
                pParams->m_dwStates, &pParams->m_matrix);
      if ((pParams->m_dwStates & CFWL_PartState_Checked) |
          (pParams->m_dwStates & CFWL_PartState_Neutral)) {
        DrawSign(pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart,
                 pParams->m_dwStates, &pParams->m_matrix);
      }
      DrawSignBorder(
          pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart,
          pParams->m_dwStates & CFWL_PartState_Disabled, &pParams->m_matrix);
      break;
    }
    default: { return FALSE; }
  }
  return TRUE;
}
Esempio n. 18
0
void ColorPusher::Paint(Draw& w)
{
	Size sz = GetSize();
	w.DrawRect(sz, push ? SColorHighlight : SColorPaper);
	int ty = (sz.cy - StdFont().Info().GetHeight()) / 2;
	if(withtext) {
		w.DrawRect(2, 2, sz.cy - 4, sz.cy - 4, color);
		DrawFrame(w, 1, 1, sz.cy - 2, sz.cy - 2, SColorText);
		w.DrawText(sz.cy + 2, ty, FormatColor(color), StdFont(), SColorText());
	}
	else {
		if(!IsNull(color)) {
			w.DrawRect(2, 2, sz.cx - 4, sz.cy - 4, color);
			DrawFrame(w, 1, 1, sz.cx - 2, sz.cy - 2, SColorText);
		}
		else
		if(!withtext)
			w.DrawText(max(2, (sz.cx - GetTextSize(nulltext, StdFont()).cx) / 2), ty,
			           nulltext, StdFont(), SColorText());
	}
	if(HasFocus())
		DrawFocus(w, GetSize());
}
Esempio n. 19
0
void DrawFocus(Draw& w, const Rect& r, Color c) {
	DrawFocus(w, r.left, r.top, r.Width(), r.Height(), c);
}
Esempio n. 20
0
Size DrawLabel::Paint(Ctrl *ctrl, Draw& w, const Rect& r, bool visibleaccesskey) const
{
	int lspc = this->lspc;
	int rspc = this->rspc;
	Size sz1 = limg.GetSize();
	Size sz2 = rimg.GetSize();
	int txtcx = r.GetWidth() - sz1.cx - Nvl(lspc, 0) - sz2.cx - Nvl(rspc, 0);
	Size txtsz = *text ? GetSmartTextSize(text, font, txtcx) : paintrect.GetStdSize();
	if(txtsz.cx) {
		if(!rimg_never_hide && txtsz.cx + sz1.cx + sz2.cx + Nvl(lspc, 0) + Nvl(rspc, 0) > r.GetWidth()) {
			sz2.cx = 0;
			rspc = 0;
		}
		if(!limg_never_hide && txtsz.cx + sz1.cx + sz2.cx + Nvl(lspc, 0) + Nvl(rspc, 0) > r.GetWidth()) {
			sz1.cx = 0;
			lspc = 0;
		}
	}
	Size isz = GetSize(txtcx, sz1, lspc, sz2, rspc);
	Point p = r.TopLeft(), ip;
	if(align == ALIGN_LEFT)
		p.x = r.left;
	else
	if(align == ALIGN_RIGHT)
		p.x = r.right - isz.cx;
	else
	if(align == ALIGN_CENTER)
		p.x = (r.right + r.left - isz.cx) / 2;
	if(valign == ALIGN_TOP)
		p.y = r.top;
	else
	if(valign == ALIGN_BOTTOM)
		p.y = r.bottom - isz.cy;
	else
	if(valign == ALIGN_CENTER)
		p.y = (r.bottom + r.top - txtsz.cy) / 2;
	Color color = disabled && !IsNull(disabledink) ? disabledink : ink;
	if(IsNull(color))
		color = disabled ? SColorDisabled : GetLabelTextColor(ctrl);
	int ix;
	if(IsNull(lspc))
		ix = r.left + push;
	else {
		ix = p.x + push;
		p.x += sz1.cx;
		p.x += lspc;
	}
	int iy = push + (r.top + r.bottom - sz1.cy) / 2;

	if(sz1.cx)
		if(IsNull(lcolor))
			w.DrawImage(ix, iy, DisabledImage(limg, disabled));
		else
			w.DrawImage(ix, iy, limg, lcolor);

	iy = push + (r.top + r.bottom - sz2.cy) / 2;
	ix = (IsNull(rspc) ? r.right - sz2.cx : p.x + txtsz.cx + rspc) + push;
	if(sz2.cx)
		if(IsNull(rcolor))
			w.DrawImage(ix, iy, DisabledImage(rimg, disabled));
		else
			w.DrawImage(ix, iy, rimg, rcolor);
	paintrect.Paint(w, p.x + push, p.y + push, txtsz.cx, isz.cy, color, Null);
	if(*text) {
		if(disabled)
			DrawSmartText(w, p.x + push + 1, p.y + push + (isz.cy - txtsz.cy) / 2 + 1,
			              txtsz.cx, text, font, SColorPaper);
		DrawSmartText(w, p.x + push, p.y + push, txtcx,
		              text, font, color, visibleaccesskey ? accesskey : 0);
		if(focus)
			DrawFocus(w, p.x - 2, p.y, txtsz.cx + 5, isz.cy);
	}

	return isz;
}
Esempio n. 21
0
FX_BOOL CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) {
  switch (pParams->m_iPart) {
    case CFWL_Part::Border: {
      DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
      break;
    }
    case CFWL_Part::Edge: {
      DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(),
               &pParams->m_rtPart, &pParams->m_matrix);
      break;
    }
    case CFWL_Part::Background: {
      CFX_RectF& rect = pParams->m_rtPart;
      FX_FLOAT fRight = rect.right();
      FX_FLOAT fBottom = rect.bottom();
      CFX_Path strokePath;
      strokePath.Create();
      strokePath.MoveTo(rect.left + PUSHBUTTON_SIZE_Corner, rect.top);
      strokePath.LineTo(fRight - PUSHBUTTON_SIZE_Corner, rect.top);
      strokePath.LineTo(fRight, rect.top + PUSHBUTTON_SIZE_Corner);
      strokePath.LineTo(fRight, fBottom - PUSHBUTTON_SIZE_Corner);
      strokePath.LineTo(fRight - PUSHBUTTON_SIZE_Corner, fBottom);
      strokePath.LineTo(rect.left + PUSHBUTTON_SIZE_Corner, fBottom);
      strokePath.LineTo(rect.left, fBottom - PUSHBUTTON_SIZE_Corner);
      strokePath.LineTo(rect.left, rect.top + PUSHBUTTON_SIZE_Corner);
      strokePath.LineTo(rect.left + PUSHBUTTON_SIZE_Corner, rect.top);
      CFX_Path fillPath;
      fillPath.Create();
      fillPath.AddSubpath(&strokePath);
      CFX_Graphics* pGraphics = pParams->m_pGraphics;
      pGraphics->SaveGraphState();
      CFX_RectF rtInner(rect);
      rtInner.Deflate(PUSHBUTTON_SIZE_Corner + 1, PUSHBUTTON_SIZE_Corner + 1,
                      PUSHBUTTON_SIZE_Corner, PUSHBUTTON_SIZE_Corner);
      fillPath.AddRectangle(rtInner.left, rtInner.top, rtInner.width,
                            rtInner.height);
      int32_t iColor = GetColorID(pParams->m_dwStates);
      DrawAxialShading(pGraphics, rect.left + PUSHBUTTON_SIZE_Corner, rect.top,
                       rect.left + PUSHBUTTON_SIZE_Corner, rect.bottom(),
                       m_pThemeData->clrStart[iColor],
                       m_pThemeData->clrEnd[iColor], &fillPath,
                       FXFILL_ALTERNATE, &pParams->m_matrix);
      CFX_Color crStroke(m_pThemeData->clrBorder[iColor]);
      pGraphics->SetStrokeColor(&crStroke);
      pGraphics->StrokePath(&strokePath, &pParams->m_matrix);
      fillPath.Clear();
      fillPath.AddRectangle(rtInner.left, rtInner.top, rtInner.width,
                            rtInner.height);
      CFX_Color crFill(m_pThemeData->clrFill[iColor]);
      pGraphics->SetFillColor(&crFill);
      pGraphics->FillPath(&fillPath, FXFILL_WINDING, &pParams->m_matrix);
      if (pParams->m_dwStates & CFWL_PartState_Focused) {
        rtInner.Inflate(1, 1, 0, 0);
        DrawFocus(pGraphics, &rtInner, &pParams->m_matrix);
      }
      pGraphics->RestoreGraphState();
      break;
    }
    default: {}
  }
  return TRUE;
}
Esempio n. 22
0
void MultiButton::Paint(Draw& w)
{
	Size sz = GetSize();
	int border, lx, rx;
	bool frm = Metrics(border, lx, rx);
	int mst = ChState(MAIN);
	if(frm && !nobg)
		ChPaint(w, sz, style->edge[style->activeedge ? mst : 0]);
	bool left = false;
	bool right = false;
	for(int i = 0; i < button.GetCount(); i++) {
		SubButton& b = button[i];
		int st = ChState(i);
		int x = 0, cx = 0;
		GetPos(b, lx, rx, x, cx);
		bool dopaint = true;
		Value v = b.left ? left ? style->lmiddle[st] : style->left[st]
		                 : right ? style->rmiddle[st] : style->right[st];
		if(!nobg) {
			if(ComplexFrame())
				ChPaint(w, x, border, cx, sz.cy - 2 * border, style->simple[st]);
			else
			if(frm) {
				if(IsTrivial() && style->usetrivial)
					dopaint = false;
				ChPaint(w, x, border, cx, sz.cy - 2 * border,
				        dopaint ? v : style->trivial[st]);
			}
			else {
				w.Clip(x, 0, cx, sz.cy);
				ChPaint(w, sz, style->look[Frame() ? mst : st]);
				if(IsNull(v) || !Frame()) {
					if((!IsTrivial() || style->trivialsep) && IsEnabled()) {
						if(b.left) {
							if(left)
								ChPaint(w, x, style->sepm, 1, sz.cy - 2 * style->sepm, style->sep1);
							ChPaint(w, x + cx - 1, style->sepm, 1, sz.cy - 2 * style->sepm, style->sep2);
						}
						else {
							ChPaint(w, x, style->sepm, 1, sz.cy - 2 * style->sepm, style->sep1);
							if(right)
								ChPaint(w, x + cx - 1, style->sepm, 1, sz.cy - 2 * style->sepm, style->sep2);
						}
					}
				}
				else
					ChPaint(w, x, 0, cx, sz.cy, v);
				w.End();
			}
		}
		if(dopaint) {
			Size tsz = GetTextSize(b.label, StdFont());
			Image m = tsz.cx > 0 ? b.img : (Image)Nvl(b.img, CtrlsImg::DA());
			Size isz = m.GetSize();
			Point p = (st == CTRL_PRESSED) * style->pressoffset;
			p.x += x + (cx - isz.cx - tsz.cx - (tsz.cx > 0 && isz.cx > 0 ? LB_IMAGE : 0)) / 2;
			p.y += (sz.cy - isz.cy) / 2;
			if(b.left) {
				if(!left) p.x += style->loff;
			}
			else
				if(!right) p.x += style->roff;
			if(b.monoimg || IsNull(b.img))
				w.DrawImage(p.x, p.y, m, frm ? style->fmonocolor[st] : style->monocolor[st]);
			else
				w.DrawImage(p.x, p.y, m);

			if(tsz.cx > 0) {
				if(isz.cx > 0)
					p.x += isz.cx + LB_IMAGE;
				w.DrawText(p.x, (sz.cy - tsz.cy) / 2, b.label);
			}
		}
		(b.left ? left : right) = true;
	}
	Rect r, cr;
	cr = GetSize();
	cr.left = lx;
	cr.right = rx;
	Color text = SColorLabel();
	Color paper = Null;
	if(!nobg) {
		if(ComplexFrame()) {
			r = cr;
			paper = HasFocus() ? SColorHighlight() : SColorPaper();
			if(HasFocus())
				text = SColorHighlightText();
			w.DrawRect(r, paper);
		}
		else
		if(frm) {
			Rect m = GetMargin();
			r = Rect(max(lx, m.left), m.top, min(rx, sz.cx - m.right), sz.cy - m.bottom);
			Color paper;
			if(mst == CTRL_HOT && !IsTrivial())
				paper = Blend(SColorHighlight, SColorPaper, 235);
			else
			if(mst == CTRL_PRESSED && !IsTrivial())
				paper = Blend(SColorHighlight, SColorFace, 235);
			else
			if(HasFocus()) {
				paper = SColorHighlight();
				text = SColorHighlightText();
			}
			else
				paper = SColorPaper();
			w.DrawRect(r, paper);
			cr = r;
		}
		else {
			w.Clip(lx, 0, rx - lx, sz.cy);
			ChPaint(w, sz, style->look[mst]);
			Rect m = style->margin;
			r = Rect(max(lx, m.left), m.top, min(rx, sz.cx - m.right), sz.cy - m.bottom);
			if(!IsTrivial() || style->trivialsep) {
				if(left) {
					r.left++;
					if(IsEnabled())
						ChPaint(w, lx, style->sepm, 1, sz.cy - 2 * style->sepm, style->sep1);
				}
				if(right) {
					if(IsEnabled())
						ChPaint(w, rx - 1, style->sepm, 1, sz.cy - 2 * style->sepm, style->sep2);
					r.right--;
				}
			}
			w.End();
			cr = r;
		}
	}
	cr.left++;
	Rect clr = cr;
	if(!IsNull(valuecy)) {
		cr.top += (cr.GetHeight() - valuecy + 1) / 2;
		cr.bottom = cr.top + valuecy;
	}
	Value v = convert->Format(value);
	bool f = HasFocus() && !push && frm;
	if(cr.left < cr.right && display) {
		w.Clip(clr);
		display->Paint(w, cr, v,
		               IsShowEnabled() ? text : SColorDisabled,
		               paper, f ? Display::CURSOR : Display::FOCUS|Display::CURSOR);
		w.End();
	}
	if(!frm && HasFocus())
		DrawFocus(w, r);
}
void Game_DollParamManager::Draw(
	int _x, int _y, WindowSkin* _pWndSkin, BYTE _presetColorIndex, int _time) const{
	if(pDoll == NULL) return;

	TCHAR buf[64];
	bool isActive = false;
	int tmpX = 0, tmpY = 0;
	int tmp = 0;

	TCHAR paramName[DOLL_PARAM_MAX][16] = {
		_T("HP"), _T("攻撃"), _T("敏捷"), _T("魔力"), _T("技巧"),
	};


	switch(state){
	case DOLLPARAMMANAGE_STATE_MAIN:
	case DOLLPARAMMANAGE_STATE_PARAMEDIT:
		// スキル編集以外

		// フォーカスの描画
		DrawFocus(_x, _y, s_main.index, _pWndSkin, _time);

		tmpY = 48;
		tmpX = -16;
		DrawStringByPresetColor(
			_x + tmpX, _y + tmpY,
			_T("能力"), g_font.hInfo, 
			_presetColorIndex, COLORSET_COLOR_NORMAL);
		// 各項目を描画する
		tmpY = 80;
		tmpX = 50;
		DrawStringByPresetColor(
			_x + tmpX, _y + tmpY,
			_T("能力値"),
			g_font.hTinyInfo,
			_presetColorIndex, COLORSET_COLOR_NORMAL);
		tmpX = 130;
		DrawStringByPresetColor(
			_x + tmpX, _y + tmpY,
			_T("レベル"),
			g_font.hTinyInfo,
			_presetColorIndex, COLORSET_COLOR_NORMAL);
		tmpX = 206;
		DrawStringByPresetColor(
			_x + tmpX, _y + tmpY,
			_T("潜在"),
			g_font.hTinyInfo,
			_presetColorIndex, COLORSET_COLOR_NORMAL);
		tmpX = 266;
		DrawStringByPresetColor(
			_x + tmpX, _y + tmpY,
			_T("成長"),
			g_font.hTinyInfo,
			_presetColorIndex, COLORSET_COLOR_NORMAL);
		// パラメータ項目の描画
		for(int n=0; n<DOLL_PARAM_MAX; n++){
			tmpX = 0;
			tmpY = n * 28 + 110;
			isActive = (n == s_main.index);
			// パラメータ名の描画
			DrawStringByPresetColor(
				_x + tmpX, _y + tmpY,
				paramName[n], g_font.hItem, 
				_presetColorIndex, COLORSET_COLOR_NORMAL);
			// パラメータ数値
			switch(n){
			case DOLL_PARAM_HP:
				tmp = pDoll->GetMaxHP();
				break;
			case DOLL_PARAM_ATK:
				tmp = pDoll->GetAtk();
				break;
			case DOLL_PARAM_SPD:
				tmp = pDoll->GetSpd();
				break;
			case DOLL_PARAM_MGC:
				tmp = pDoll->GetMgc();
				break;
			case DOLL_PARAM_TEC:
				tmp = pDoll->GetTec();
				break;
			}
			// パラメータを文字に
			wsprintf(buf, _T("%4d"), tmp); 
			DrawStringByPresetColor(
				_x + tmpX + 60, _y + tmpY,
				buf, g_font.hItem, 
				_presetColorIndex, COLORSET_COLOR_NORMAL);
			// "="
			DrawStringByPresetColor(
				_x + tmpX + 108, _y + tmpY,
				_T("←"), g_font.hItem, 
				_presetColorIndex, COLORSET_COLOR_NORMAL);
			// ここが、現在編集中か否かで変化する。
			if(state == DOLLPARAMMANAGE_STATE_PARAMEDIT 
				&& (s_main.index == n)){
				numEdit.Draw(
					g_font.hItem, 
					_x + tmpX + 136, _y + tmpY,
					0, FONTSIZE_ITEM, 0);
			}else{
				// レベル数値
				tmp = pDoll->GetPotentialLevel(n) + pDoll->GetGrowthLevel(n)
					 + DOLL_LEVEL_FACTOR * pDoll->GetLevel();
				// パラメータを文字に
				wsprintf(buf, _T("%4d"), tmp); 
				DrawStringByPresetColor(
					_x + tmpX + 136, _y + tmpY,
					buf, g_font.hItem, 
					_presetColorIndex, COLORSET_COLOR_NORMAL);
			}
			// "="
			DrawStringByPresetColor(
				_x + tmpX + 182, _y + tmpY,
				_T("="), g_font.hItem, 
				_presetColorIndex, COLORSET_COLOR_NORMAL);
			// レベル数値
			tmp = pDoll->GetPotentialLevel(n);
			// パラメータを文字に
			wsprintf(buf, _T("%4d"), tmp); 
			DrawStringByPresetColor(
				_x + tmpX + 196, _y + tmpY,
				buf, g_font.hItem, 
				_presetColorIndex, COLORSET_COLOR_NORMAL);
			// "+"
			DrawStringByPresetColor(
				_x + tmpX + 244, _y + tmpY,
				_T("+"), g_font.hItem, 
				_presetColorIndex, COLORSET_COLOR_NORMAL);
			// レベル数値
			tmp = pDoll->GetGrowthLevel(n) + DOLL_LEVEL_FACTOR * pDoll->GetLevel();
			// パラメータを文字に
			wsprintf(buf, _T("%4d"), tmp); 
			DrawStringByPresetColor(
				_x + tmpX + 256, _y + tmpY,
				buf, g_font.hItem, 
				_presetColorIndex, COLORSET_COLOR_NORMAL);

		}
		tmpY = 260;
		tmpX = -16;
		DrawStringByPresetColor(
			_x + tmpX, _y + tmpY,
			_T("拡張スキル"), g_font.hInfo, 
			_presetColorIndex, COLORSET_COLOR_NORMAL);
		// スキルの描画
		for(int n=0; n<DOLL_EXSKILL_MAX; n++){
			isActive = (n == s_main.index-WND_MANAGE_MENU_SKILL1);
			tmp = pDoll->GetExSkillID(n);
			if(tmp != 0){
				d_skillInfo.DrawSkillInfo(
					_x-16, _y+290+28*n, 
					tmp,
					g_font.hItem, 
					GetPresetColor(_presetColorIndex, COLORSET_COLOR_NORMAL),
					false);
			}else{
				DrawStringByPresetColor(
					_x + 8, _y+290+28*n,
					_T("なし"), g_font.hItem, 
					_presetColorIndex, COLORSET_COLOR_NORMAL);
			}
		}

		// 終了の描画
		tmpY = 416;
		tmpX = 196;
		DrawStringByPresetColor(
			_x + tmpX, _y + tmpY,
			_T("編集を終了"), g_font.hInfo, 
			_presetColorIndex, COLORSET_COLOR_NORMAL);
		break;
	case DOLLPARAMMANAGE_STATE_SKILLEDIT:
		// スキル描画の場合
		for(int n=0; n<DOLLPARAMMANAGER_SKILL_PER_PAGE; n++){
			tmp = DOLLPARAMMANAGER_SKILL_PER_PAGE * skillPage
				+ n + 1;
			tmpX = -20;
			tmpY = 50 + 30 * n;

			// フォーカスの描画
			if(n == s_skill.index){
				_pWndSkin->DrawFocusRect(
					_x + tmpX - 1, _y + tmpY - 1,
					326, FONTSIZE_STR + 2,
					_time, false);
			}
	
			// スキルの描画
			d_skillInfo.DrawSkillInfo(
				_x + tmpX, _y + tmpY, 
				tmp, g_font.hItem,
				GetPresetColor(_presetColorIndex,
				d_skillInfo.GetUsed(tmp) ? COLORSET_COLOR_NORMAL : COLORSET_COLOR_INACTIVE),
				false);

		}
		// ページ番号の描画
		wsprintf(buf, _T("%2d/%2d ページ"), skillPage+1, 
			MAX_SKILL/DOLLPARAMMANAGER_SKILL_PER_PAGE);
		DrawStringToHandle(
			_x+200, _y+360,
			buf,
			GetPresetColor(_presetColorIndex, COLORSET_COLOR_NORMAL),
			g_font.hTinyInfo);

		// スキルの説明の描画
		tmp = DOLLPARAMMANAGER_SKILL_PER_PAGE * skillPage
				+ s_skill.index + 1;
		d_skillInfo.GetSkillAccount(buf, tmp);
		DrawStringToHandle(
			_x-20, _y+400,
			buf,
			GetPresetColor(_presetColorIndex, COLORSET_COLOR_NORMAL),
			g_font.hTinyInfo);
		break;
	case DOLLPARAMMANAGE_STATE_SKILLGENRE:
		DrawGenreList(_x, _y, _pWndSkin,
			_presetColorIndex, _time);
		break;
	}


}