//////////////////////////////////////////////////////////////////// // Public functions // void CDrawField::Draw( int page, CDC* dc ) /* ============================================================ Function : CDrawField::Draw Description : Draws this object. Access : Public Return : void Parameters : int page - Current page CDC* dc - CDC to draw to Usage : Called by the generator to draw the object. ============================================================*/ { CString title = GetTitle(); CDoubleRect rect = GetPosition(); CUnitConversion::InchesToPixels( rect ); CRect r( static_cast< int >( rect.left ), static_cast< int >( rect.top ), static_cast< int >( rect.right ), static_cast< int >( rect.bottom ) ); CUnitConversion::AdjustPixelsToPaper( dc, r ); LOGFONT lf; ZeroMemory( &lf, sizeof( lf ) ); lstrcpy( lf.lfFaceName, GetFontName() ); lf.lfHeight = CUnitConversion::PointsToPixels( static_cast< double >( GetFontSize() ) / 10.0 ); lf.lfItalic = static_cast< BYTE >( GetFontItalic() ); lf.lfUnderline = static_cast< BYTE >( GetFontUnderline() ); lf.lfStrikeOut = static_cast< BYTE >( GetFontStrikeout() ); lf.lfCharSet = static_cast< BYTE >( GetFontCharset() ); if( GetFontBold() ) lf.lfWeight = FW_BOLD; else lf.lfWeight = FW_NORMAL; if( IsBold( title ) ) lf.lfWeight = FW_BOLD; if( IsItalic( title ) ) lf.lfItalic = TRUE; CFont font; font.CreateFontIndirect( &lf ); dc->SelectObject( &font ); int color = dc->SetTextColor( GetFontColor() ); int mode = dc->SetBkMode( TRANSPARENT ); int justification = GetJustification(); ReplaceFields( page, title ); dc->DrawText( title, r, DT_NOPREFIX | DT_WORDBREAK | justification ); dc->SetBkMode( mode ); dc->SetTextColor( color ); dc->SelectStockObject( ANSI_VAR_FONT ); }
LRESULT CRRECToolBar::OnItemPostPaint(LPNMTBCUSTOMDRAW lpNMCustomDraw) { UINT nBtnID = lpNMCustomDraw->nmcd.dwItemSpec; switch (nBtnID) { case BUTTON_BACKCOLOR: case BUTTON_TEXTCOLOR: { // paint the lowest 3 lines with the appropriate colour // but only as far as the beginning of the drop button CRect rColor(lpNMCustomDraw->nmcd.rc); if (CThemed().AreControlsThemed()) rColor.bottom++; else rColor.DeflateRect(2, 2); rColor.top = rColor.bottom - 3; rColor.right = rColor.left + m_sizeImage.cx; CDC* pDC = CDC::FromHandle(lpNMCustomDraw->nmcd.hdc); COLORREF color = GetFontColor(nBtnID == BUTTON_TEXTCOLOR, TRUE); pDC->FillSolidRect(rColor, color); } break; } return CDRF_DODEFAULT; }
void CRRECToolBar::OnColorDropDown(NMHDR* pNMHDR, LRESULT* pResult) { LPNMTOOLBAR pNMTB = (LPNMTOOLBAR)pNMHDR; UINT nBtnID = pNMTB->iItem; switch (nBtnID) { case BUTTON_BACKCOLOR: case BUTTON_TEXTCOLOR: { CRect rButton; GetItemRect(CommandToIndex(pNMTB->iItem), rButton); ClientToScreen(rButton); COLORREF color = GetFontColor(nBtnID == BUTTON_TEXTCOLOR); CString defaultText, customText; defaultText.LoadString(STRING_DEFAULT); customText.LoadString(STRING_CUSTOM); new CColourPopup(CPoint(rButton.left, rButton.bottom), color, this, nBtnID, defaultText, customText, TRUE); } break; } *pResult = 0; }
void MAS::HyperText::Draw(Bitmap &canvas) { // get the button state int state = Disabled() ? 2 : ((Selected() || (Flags() & D_PRESSED)) ? 1 : (HasFocus() ? 3 : 0)); // get the button colors and font Color fg = GetFontColor(state); Color bg = GetShadowColor(state); Font f = GetFont(state); Color textMode = GetTextMode(); canvas.Clear(textMode); switch (state) { case 0: case 2: f.GUITextoutEx(canvas, text, 1, 1, fg, bg, textMode, 0); canvas.Hline(1, h()-3, w()-2, fg); break; case 1: f.GUITextoutEx(canvas, text, 2, 2, fg, bg, textMode, 0); canvas.DrawDottedRect(1, 1, w()-1, h()-1, skin->c_font); canvas.Hline(1, h()-2, w()-2, fg); break; case 3: f.GUITextoutEx(canvas, text, 1, 1, fg, bg, textMode, 0); canvas.DrawDottedRect(0, 0, w()-2, h()-2, skin->c_font); canvas.Hline(1, h()-3, w()-2, fg); break; }; }
int UITouchButton::GetTextHeight() { if (m_strText.Length() > 0) { m_ifontAttr.m_iFace=FONT_DEFAULT; ITpFont* pFont = NULL; if (IsFocus()) { pFont = FontManager::GetInstance()->GetFont(m_ifontAttr, m_iFocusedFontColor); } else { pFont = FontManager::GetInstance()->GetFont(m_ifontAttr, GetFontColor()); } if(NULL == pFont) { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() End: pFont = NULL"); return E_FAIL; } int _iStringHeight = pFont->GetHeight(); return _iStringHeight; } return -1; }
void MAS::RadioButton::MsgInitSkin() { Button::MsgInitSkin(); for (int i=0; i<4; i++) { if (GetFontColor(i) == Color::transparent) SetFontColor(skin->fcol[Skin::INFO_RADIO][i], skin->scol[Skin::INFO_RADIO][i], i); if (GetFontIndex(i) == -1) SetFont(skin->fnt[Skin::INFO_RADIO][i], i); } if (GetTextMode() == Color::transparent) SetTextMode(skin->c_face); if (GetBitmapIndex() == Skin::BUTTON) SetBitmap(Skin::RADIO); SetFlag(D_TOGGLE); ClearFlag(D_SPINNER | D_AUTOSIZE); }
void MAS::HyperText::MsgInitSkin() { for (int i=0; i<4; i++) { if (GetFontColor(i) == Color::transparent) SetFontColor(skin->fcol[Skin::INFO_HYPER][i], skin->scol[Skin::INFO_HYPER][i], i); if (GetFontIndex(i) == -1) SetFont(skin->fnt[Skin::INFO_HYPER][i], i); } if (GetTextMode() == Color::transparent) SetTextMode(skin->c_face); SetFlag(D_AUTOSIZE); UpdateSize(); ClearFlag(D_TOGGLE | D_SPINNER); Button::MsgInitSkin(); }
FReply DeActivateBlueprint() { FString *n = Name.Get(); if ( n ) { FLiveEditorManager::Get().DeActivate( *n ); UE_LOG( LiveEditorConfigWindow, Log, TEXT("%s DeActivated"), *(*n) ); bIsActive = (Name.Get())? FLiveEditorManager::Get().CheckActive( *Name.Get() ) : false; NameView->SetForegroundColor( GetFontColor() ); } return FReply::Handled(); }
/** * Constructs this widget * * @param InArgs Declaration from which to construct the widget */ void Construct(const FArguments& InArgs, const TSharedPtr<FString> &_Name, SLiveEditorConfigWindow *_Owner) { Name = _Name; Owner = _Owner; bIsActive = (Name.Get())? FLiveEditorManager::Get().CheckActive( *Name.Get() ) : false; Blueprint = LoadObject<UBlueprint>( NULL, *(*Name.Get()), NULL, 0, NULL ); check( Blueprint != NULL && Blueprint->GeneratedClass != NULL && Blueprint->GeneratedClass->IsChildOf( ULiveEditorBlueprint::StaticClass() ) ); ChildSlot [ SNew(SHorizontalBox) +SHorizontalBox::Slot() .AutoWidth() .Padding(2.0f) [ SNew( SButton ) .Text( this, &SLiveEditorBlueprint::GetBindButtonText ) .ToolTipText( FString(TEXT("Bind your MIDI hardware to this Blueprint")) ) .HAlign( HAlign_Center ) .VAlign( VAlign_Center ) .OnClicked( this, &SLiveEditorBlueprint::BindBlueprint ) ] +SHorizontalBox::Slot() .AutoWidth() .Padding(2.0f) [ SNew( SButton ) .Text( FString(TEXT("Activate")) ) .ToolTipText( FString(TEXT("Make this Blueprint active in the LiveEditor context")) ) .HAlign( HAlign_Center ) .VAlign( VAlign_Center ) .Visibility( this, &SLiveEditorBlueprint::CanActivate ) .OnClicked( this, &SLiveEditorBlueprint::ActivateBlueprint ) ] +SHorizontalBox::Slot() .AutoWidth() .Padding(2.0f) [ SNew( SButton ) .Text( FString(TEXT("DeActivate")) ) .ToolTipText( FString(TEXT("Stop this Blueprint running in the LiveEditor context")) ) .HAlign( HAlign_Center ) .VAlign( VAlign_Center ) .Visibility( this, &SLiveEditorBlueprint::CanDeActivate ) .OnClicked( this, &SLiveEditorBlueprint::DeActivateBlueprint ) ] +SHorizontalBox::Slot() .AutoWidth() .Padding(2.0f) [ SNew( SButton ) .Text( FString(TEXT("Remove")) ) .ToolTipText( FString(TEXT("Remove this Blueprint from the LiveEditor context")) ) .HAlign( HAlign_Center ) .VAlign( VAlign_Center ) .OnClicked( this, &SLiveEditorBlueprint::RemoveBlueprint ) ] +SHorizontalBox::Slot() .AutoWidth() .VAlign( VAlign_Center ) .Padding(2.0f) [ SAssignNew( NameView, STextBlock ) .Text( *Name.Get() ) .ColorAndOpacity( GetFontColor() ) ] ]; }
HRESULT UITouchButton::Draw(DK_IMAGE drawingImg) { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() Start"); if (!m_bIsVisible) { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() End: m_bIsVisible = false"); return S_OK; } if (drawingImg.pbData == NULL) { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() End: m_bIsVisible = false"); return E_FAIL; } HRESULT hr(S_OK); DK_IMAGE imgSelf; DK_RECT rcSelf={m_iLeft, m_iTop, m_iLeft + m_iWidth, m_iTop + m_iHeight}; RTN_HR_IF_FAILED(CropImage( drawingImg, rcSelf, &imgSelf )); CTpGraphics grf(imgSelf); if (m_bUsingBackgroundPicture) { // draw background picture if there is if (IsFocus() || IsPressed()) { if (m_spFocusedBackground) { HRESULT hr(S_OK); DebugPrintf(DLC_CHENM, "UITouchButton::Draw() Draw background Image in focus"); int startx = (m_iWidth - m_spFocusedBackground.Get()->GetWidth()); if (startx >0) startx = startx / 2; else startx =0; int starty = (m_iHeight - m_spFocusedBackground.Get()->GetHeight()); if (starty >0) starty = starty / 2; else starty =0; RTN_HR_IF_FAILED(grf.DrawImage(m_spFocusedBackground.Get(),startx,starty,0,0,m_spFocusedBackground.Get()->GetWidth(), m_spFocusedBackground.Get()->GetHeight())); //RTN_HR_IF_FAILED(grf.DrawImage(m_spFocusedBackground.Get(), 0, 0)); } } else { if (m_spBackground) { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() Draw background Image not in focus"); int startx = (m_iWidth - m_spBackground.Get()->GetWidth()); if (startx >0) startx = startx / 2; else startx =0; int starty = (m_iHeight - m_spBackground.Get()->GetHeight()); if (starty >0) starty = starty / 2; else starty =0; HRESULT hr(S_OK); RTN_HR_IF_FAILED(grf.DrawImage(m_spBackground.Get(), startx, starty, 0, 0, m_spBackground.Get()->GetWidth(), m_spBackground.Get()->GetHeight())); //RTN_HR_IF_FAILED(grf.DrawImage(m_spBackground.Get(), 0, 0)); } } } else { // draw background in color if (!m_bBackTransparent) { if (IsFocus() || IsPressed()) { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() Draw background with color in focus"); RTN_HR_IF_FAILED(grf.FillRect( 0, 0, m_iWidth, m_iHeight, m_focusedBackgroundColor)); } else { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() Draw background with color not in focus"); RTN_HR_IF_FAILED(grf.FillRect( 0, 0, m_iWidth, m_iHeight, GetBackgroundColor())); } } } //draw string if (m_strText.Length() > 0) { m_ifontAttr.m_iFace=FONT_DEFAULT; ITpFont* pFont = NULL; if (IsFocus() || IsPressed()) { pFont = FontManager::GetInstance()->GetFont(m_ifontAttr, m_iFocusedFontColor); } else { pFont = FontManager::GetInstance()->GetFont(m_ifontAttr, GetFontColor()); } if(NULL == pFont) { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() End: pFont = NULL"); return E_FAIL; } int _iStringWidth = pFont->StringWidth(m_strText); int _iStringHeight = pFont->GetHeight(); if (_iStringWidth > m_iWidth) { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() End:_iStringWidth > m_iWidth"); return E_FAIL; } int _H_offset = (m_iWidth - _iStringWidth) / 2; int _V_offset = (m_iHeight - _iStringHeight) / 2; grf.DrawStringUtf8(m_strText.GetBuffer(), _H_offset, _V_offset, pFont); } if (m_do2gray) { grf.Do2Gray(0,0,m_iWidth, m_iHeight, 80, FALSE, (IsEnable() ? 0xff : 0x66)); } DebugPrintf(DLC_CHENM, "UITouchButton::Draw() End."); return hr; }