virtual void FocusChanged(TDrawNow aDrawNow)
	{
		if ( iFlags & FeedUi::EFocusInsideControl )
			{
				iDownloadButton->SetFocus( IsFocused(), aDrawNow );
				iPhoto->SetFocus( IsFocused(), aDrawNow );
			}
		else
			CPhotoHolder::FocusChanged(aDrawNow);
	}
Exemple #2
0
	void CControlUI::PaintBorder(HDC hDC)
	{
		int nBorderSize = GetManager()->GetDPIObj()->Scale(m_nBorderSize);
		SIZE cxyBorderRound = GetManager()->GetDPIObj()->Scale(m_cxyBorderRound);
		RECT rcBorderSize = GetManager()->GetDPIObj()->Scale(m_rcBorderSize);
		if(m_dwBorderColor != 0 || m_dwFocusBorderColor != 0) {
			//»­Ô²½Ç±ß¿ò
			if(nBorderSize > 0 && ( cxyBorderRound.cx > 0 || cxyBorderRound.cy > 0 )) {
				if (IsFocused() && m_dwFocusBorderColor != 0)
					CRenderEngine::DrawRoundRect(hDC, m_rcItem, nBorderSize, cxyBorderRound.cx, cxyBorderRound.cy, GetAdjustColor(m_dwFocusBorderColor), m_nBorderStyle);
				else
					CRenderEngine::DrawRoundRect(hDC, m_rcItem, nBorderSize, cxyBorderRound.cx, cxyBorderRound.cy, GetAdjustColor(m_dwBorderColor), m_nBorderStyle);
			}
			else {
				if (IsFocused() && m_dwFocusBorderColor != 0 && m_nBorderSize > 0) {
					CRenderEngine::DrawRect(hDC, m_rcItem, nBorderSize, GetAdjustColor(m_dwFocusBorderColor), m_nBorderStyle);
				}
				else if(rcBorderSize.left > 0 || rcBorderSize.top > 0 || rcBorderSize.right > 0 || rcBorderSize.bottom > 0) {
					RECT rcBorder;

					if(rcBorderSize.left > 0){
						rcBorder		= m_rcItem;
						rcBorder.right	= rcBorder.left;
						CRenderEngine::DrawLine(hDC,rcBorder,rcBorderSize.left,GetAdjustColor(m_dwBorderColor),m_nBorderStyle);
					}
					if(rcBorderSize.top > 0){
						rcBorder		= m_rcItem;
						rcBorder.bottom	= rcBorder.top;
						CRenderEngine::DrawLine(hDC,rcBorder,rcBorderSize.top,GetAdjustColor(m_dwBorderColor),m_nBorderStyle);
					}
					if(rcBorderSize.right > 0){
						rcBorder		= m_rcItem;
						rcBorder.right -= 1;
						rcBorder.left	= rcBorder.right;
						CRenderEngine::DrawLine(hDC,rcBorder,rcBorderSize.right,GetAdjustColor(m_dwBorderColor),m_nBorderStyle);
					}
					if(rcBorderSize.bottom > 0){
						rcBorder		= m_rcItem;
						rcBorder.bottom -= 1;
						rcBorder.top	= rcBorder.bottom;
						CRenderEngine::DrawLine(hDC,rcBorder,rcBorderSize.bottom,GetAdjustColor(m_dwBorderColor),m_nBorderStyle);
					}
				}
				else if(nBorderSize > 0) {
					CRenderEngine::DrawRect(hDC, m_rcItem, nBorderSize, GetAdjustColor(m_dwBorderColor), m_nBorderStyle);
				}
			}
		}
	}
Exemple #3
0
LONG CSkinItemEdit::GetBorderHelper(LONG clrNormal, LONG clrHover, LONG clrFocus, LONG clrReadOnly, LONG clrDisabled)
{
    LONG color = 0;

    if (IsReadOnly() && m_bReadOnlyBorder) {
        color = clrReadOnly;
    } else if (IsFocused() && m_bFocusBorder) {
        color = clrFocus;
    } else if (IsHot()) {
        color = clrHover;
    } else {
        color = clrNormal;
    }

    if (GetDisabled())
        color = clrDisabled;

    if (color == -1)
        color = clrNormal;

    if (color == -1)
        return -1;

    if (GetColorTransform()) {
        GetEngine()->TransformColor(color, color);
    }

    return color;
}
WMSG_RESULT CUISpinControl::OnCharMessage( MSG* pMsg )
{
	extern UBYTE	_abKeysPressed[256];

	// If editbox is not focused
	if( !IsFocused() || m_InValidEditBox )
		return WMSG_FAIL;

	if(m_bOnlyInteger && (pMsg->wParam < 48 || pMsg->wParam > 57))
	{
		return WMSG_SUCCESS;
	}

	InsertChar(m_nCursorIndex, pMsg->wParam);

	if (_atoi64(GetString()) > m_llMax)
	{
		CTString strTmp;
		strTmp.PrintF("%I64d", m_llMax);

		SetString(strTmp.str_String);
	}

	return WMSG_SUCCESS;
}
void TransfersPanel::OnNewTransfersDone()
{
	if (IsFocused(TRUE))
		g_desktop_transfer_manager->SetNewTransfersDone(FALSE);

	PanelChanged();
}
// ---------------------------------------------------------
// CSecModUIContainerBase::FocusChanged(TDrawNow aDrawNow)
// ---------------------------------------------------------
//
void CSecModUIContainerBase::FocusChanged( TDrawNow aDrawNow )
    {
    if ( iListBox )
        {
        iListBox->SetFocus( IsFocused(), aDrawNow );
        }
    }
Exemple #7
0
void Panel::Show()
{
	if (!GetModalMode())
	{
		const auto AnotherPanel = Parent()->GetAnotherPanel(this);
		if (AnotherPanel->IsVisible())
		{
			if (SaveScr)
			{
				SaveScr->AppendArea(AnotherPanel->SaveScr.get());
			}

			if (AnotherPanel->IsFocused())
			{
				if (AnotherPanel->IsFullScreen())
				{
					SetVisible(true);
					return;
				}

				if (GetType() == panel_type::FILE_PANEL && IsFullScreen())
				{
					ScreenObject::Show();
					AnotherPanel->Show();
					return;
				}
			}
		}
	}

	ScreenObject::Show();
	ShowScreensCount();
}
Exemple #8
0
void Panel::ShowConsoleTitle()
{
	if (!IsFocused())
		return;

	ConsoleTitle::SetFarTitle(m_Title);
}
// ---------------------------------------------------------
// CMsgBodyControlEditor::PrepareFocusTransition
//
// Do not change focus when automatic find parsing has been finished
// if focus transition out of this control has been performed.
// ---------------------------------------------------------
//
void CMsgBodyControlEditor::PrepareFocusTransition()
    {
    if ( IsFocused() )
        {
        iFocusChangedBeforeParseFinish = EFalse;
        }
    }
// ---------------------------------------------------------
// CCertManUIContainerAuthority::FocusChanged( TDrawNow aDrawNow )
// ---------------------------------------------------------
//
void CCertManUIContainerAuthority::FocusChanged( TDrawNow aDrawNow )
{
    if ( iListBox )
    {
        iListBox->SetFocus( IsFocused(), aDrawNow );
    }
}
FX_BOOL CXFA_FFTextEdit::UpdateFWLData() {
  if (!m_pNormalWidget) {
    return FALSE;
  }
  XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display;
  if (IsFocused()) {
    eType = XFA_VALUEPICTURE_Edit;
  }
  FX_BOOL bUpdate = FALSE;
  if (m_pDataAcc->GetUIType() == XFA_ELEMENT_TextEdit &&
      m_pDataAcc->GetNumberOfCells() < 0) {
    XFA_ELEMENT elementType = XFA_ELEMENT_UNKNOWN;
    int32_t iMaxChars = m_pDataAcc->GetMaxChars(elementType);
    if (elementType == XFA_ELEMENT_ExData) {
      iMaxChars = eType == XFA_VALUEPICTURE_Edit ? iMaxChars : 0;
    }
    if (((CFWL_Edit*)m_pNormalWidget)->GetLimit() != iMaxChars) {
      ((CFWL_Edit*)m_pNormalWidget)->SetLimit(iMaxChars);
      bUpdate = TRUE;
    }
  }
  CFX_WideString wsText;
  m_pDataAcc->GetValue(wsText, eType);
  CFX_WideString wsOldText;
  ((CFWL_Edit*)m_pNormalWidget)->GetText(wsOldText);
  if (wsText != wsOldText || (eType == XFA_VALUEPICTURE_Edit && bUpdate)) {
    ((CFWL_Edit*)m_pNormalWidget)->SetText(wsText);
    bUpdate = TRUE;
  }
  if (bUpdate) {
    m_pNormalWidget->Update();
  }
  return TRUE;
}
void CAknLockedNote::FocusChanged(TDrawNow /*aDrawNow*/)
    {
    if (!IsFocused() &&  iCommandObserver)
        {
        TRAP_IGNORE(iCommandObserver->ProcessCommandL(KNoteCmdFocusLost))
        }
    }
Exemple #13
0
	void CFadeButtonUI::PaintStatusImage(HDC hDC)
	{
		if( IsFocused() ) m_uButtonState |= UISTATE_FOCUSED;
		else m_uButtonState &= ~ UISTATE_FOCUSED;
		if( !IsEnabled() ) m_uButtonState |= UISTATE_DISABLED;
		else m_uButtonState &= ~ UISTATE_DISABLED;

		if( (m_uButtonState & UISTATE_DISABLED) != 0 ) {
			if( !m_sDisabledImage.IsEmpty() ) {
				if( !DrawImage(hDC, (LPCTSTR)m_sDisabledImage) ) m_sDisabledImage.Empty();
				else return;
			}
		}
		else if( (m_uButtonState & UISTATE_PUSHED) != 0 ) {
			if( !m_sPushedImage.IsEmpty() ) {
				if( !DrawImage(hDC, (LPCTSTR)m_sPushedImage) ) m_sPushedImage.Empty();
				else return;
			}
		}
		else if( (m_uButtonState & UISTATE_FOCUSED) != 0 ) {
			if( !m_sFocusedImage.IsEmpty() ) {
				if( !DrawImage(hDC, (LPCTSTR)m_sFocusedImage) ) m_sFocusedImage.Empty();
				else return;
			}
		}

		CFadeAnimation::PaintAnimationStatusImage(hDC,(LPCTSTR)m_sNormalImage,(LPCTSTR)m_sHotImage,m_uButtonState);
	}
Exemple #14
0
	void BUIEdit::PaintStatusImage(HDC hDC)
	{
		if (IsFocused())
			m_buttonState |= UISTATE_FOCUSED;
		else
			m_buttonState &= ~UISTATE_FOCUSED;

		if (!IsEnabled())
			m_buttonState |= UISTATE_DISABLED;
		else
			m_buttonState &= ~UISTATE_DISABLED;

		bstring filePath = BApplication::GetInstance()->GetApplicationPath();
		if ((m_buttonState & UISTATE_DISABLED) != 0) {
			filePath += m_disabledImage;
		} else if ((m_buttonState & UISTATE_HOT) != 0) {
			filePath += m_hotImage;
		} else if ((m_buttonState & UISTATE_FOCUSED) != 0) {
			filePath += m_focusedImage;
		} else {
			filePath += m_normalImage;	
		}

		ImageDescription imageDesc;
		imageDesc.imageFile = filePath;
		imageDesc.rcSrc = m_rcItem;
		imageDesc.rcPaint = m_rcPaint;
		BRenderEngineManager::GetInstance()->RenderEngine()->DrawImage(hDC, imageDesc);
	}
Exemple #15
0
void CSingleLineEditUI::Event(TEventUI& event)
{
   if( event.Type == UIEVENT_SETCURSOR )
   {
      if( IsEnabled() ) {
         ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_IBEAM)));
         return;
      }
   }
   if( event.Type == UIEVENT_WINDOWSIZE )
   {
      if( m_pWindow != NULL ) m_pManager->SetFocus(NULL);
   }
   if( event.Type == UIEVENT_SETFOCUS ) 
   {
      if( IsEnabled() ) {
         m_pWindow = new CSingleLineEditWnd();
         ASSERT(m_pWindow);
         m_pWindow->Init(this);
      }
   }
   if( event.Type == UIEVENT_BUTTONDOWN && IsFocused() && m_pWindow == NULL ) 
   {
      // FIX: In the case of window having lost focus, editor is gone, but
      //      we don't get another SetFocus when we click on the control again.
      m_pWindow = new CSingleLineEditWnd();
      ASSERT(m_pWindow);
      m_pWindow->Init(this);
      return;
   }
   CControlUI::Event(event);
}
	void CEditUI::PaintStatusImage(HDC hDC)
	{
		if( IsFocused() ) m_uButtonState |= UISTATE_FOCUSED;
		else m_uButtonState &= ~ UISTATE_FOCUSED;
		if( !IsEnabled() ) m_uButtonState |= UISTATE_DISABLED;
		else m_uButtonState &= ~ UISTATE_DISABLED;

		if( (m_uButtonState & UISTATE_DISABLED) != 0 ) {
			if( !m_sDisabledImage.IsEmpty() ) {
				if( !DrawImage(hDC, (LPCTSTR)m_sDisabledImage) ) m_sDisabledImage.Empty();
				else return;
			}
		}
		else if( (m_uButtonState & UISTATE_FOCUSED) != 0 ) {
			if( !m_sFocusedImage.IsEmpty() ) {
				if( !DrawImage(hDC, (LPCTSTR)m_sFocusedImage) ) m_sFocusedImage.Empty();
				else return;
			}
		}
		else if( (m_uButtonState & UISTATE_HOT) != 0 ) {
			if( !m_sHotImage.IsEmpty() ) {
				if( !DrawImage(hDC, (LPCTSTR)m_sHotImage) ) m_sHotImage.Empty();
				else return;
			}
		}

		if( !m_sNormalImage.IsEmpty() ) {
			if( !DrawImage(hDC, (LPCTSTR)m_sNormalImage) ) m_sNormalImage.Empty();
			else return;
		}
	}
Exemple #17
0
	void CButtonUI::PaintText(HDC hDC)
	{
		if( IsFocused() ) m_uButtonState |= UISTATE_FOCUSED;
		else m_uButtonState &= ~ UISTATE_FOCUSED;
		if( !IsEnabled() ) m_uButtonState |= UISTATE_DISABLED;
		else m_uButtonState &= ~ UISTATE_DISABLED;

		if( m_dwTextColor == 0 ) m_dwTextColor = m_pManager->GetDefaultFontColor();
		if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor();

		if( m_sText.IsEmpty() ) return;
		int nLinks = 0;
		RECT rc = m_rcItem;
		rc.left += m_rcTextPadding.left;
		rc.right -= m_rcTextPadding.right;
		rc.top += m_rcTextPadding.top;
		rc.bottom -= m_rcTextPadding.bottom;

		DWORD clrColor = IsEnabled()?m_dwTextColor:m_dwDisabledTextColor;

		if( ((m_uButtonState & UISTATE_PUSHED) != 0) && (GetPushedTextColor() != 0) )
			clrColor = GetPushedTextColor();
		else if( ((m_uButtonState & UISTATE_HOT) != 0) && (GetHotTextColor() != 0) )
			clrColor = GetHotTextColor();
		else if( ((m_uButtonState & UISTATE_FOCUSED) != 0) && (GetFocusedTextColor() != 0) )
			clrColor = GetFocusedTextColor();

		if( m_bShowHtml )
			CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, m_sText, clrColor, \
			NULL, NULL, nLinks, m_uTextStyle);
		else
			CRenderEngine::DrawText(hDC, m_pManager, rc, m_sText, clrColor, \
			m_iFont, m_uTextStyle);
	}
Exemple #18
0
//---------------------------------------------------------------------------//
// DerivDraw
//
//---------------------------------------------------------------------------//
void CMGHotKey::DerivDraw()
{
  string text = "None";
  if (m_Char >= 0)
  {
    text = "";
    //if (m_Ctrl ) text = "Ctrl + ";
    //if (m_Shift) text+= "Shift + ";
    text+= m_Char;
  }
  
  if (IsFocused())
  {
    g_pMGDD->Rect    (TRect(Left(),   Top(),   Width(),   20), g_pMGDD->Skin()->Color(COL_EDIT_BORDER_ACTIVE));
    g_pMGDD->FillRect(TRect(Left()+1, Top()+1, Width()-2, 18), g_pMGDD->Skin()->Color(COL_EDIT_BG_ACTIVE));
    g_pMGDD->SetClipRect(TRect(Left()+1, Top()+1, Width()-2, Height()-2));
    g_pMGDD->TextDraw   (FONT_NORMAL, Left()+3, Top(), 0,20, CMGFont::LEFT, CMGFont::VCENTER, g_pMGDD->Skin()->Color(COL_FONT_EDIT_ACTIVE), text);
    g_pMGDD->SetClipRect();
  }
  else
  {
    g_pMGDD->Rect    (TRect(Left(),   Top(),   Width(),   20), g_pMGDD->Skin()->Color(COL_EDIT_BORDER));
    g_pMGDD->FillRect(TRect(Left()+1, Top()+1, Width()-2, 18), g_pMGDD->Skin()->Color(COL_EDIT_BG));
    g_pMGDD->SetClipRect(TRect(Left()+1, Top()+1, Width()-2, Height()-2));
    g_pMGDD->TextDraw   (FONT_NORMAL, Left()+3, Top(), 0,20, CMGFont::LEFT, CMGFont::VCENTER, g_pMGDD->Skin()->Color(COL_FONT_EDIT), text);
    g_pMGDD->SetClipRect();
  }
}
Exemple #19
0
void CSingleLinePickUI::DoPaint(HDC hDC, const RECT& rcPaint)
{
	int cy = m_rcItem.bottom - m_rcItem.top;
	::SetRect(&m_rcButton, m_rcItem.right - cy, m_rcItem.top, m_rcItem.right, m_rcItem.bottom);
	RECT rcText = { m_rcItem.left, m_rcItem.top, m_rcButton.left - 4, m_rcItem.bottom };
	UITYPE_COLOR iTextColor = UICOLOR_EDIT_TEXT_NORMAL;
	UITYPE_COLOR iBorderColor = UICOLOR_CONTROL_BORDER_NORMAL;
	UITYPE_COLOR iBackColor = UICOLOR_CONTROL_BACKGROUND_NORMAL;
	if( IsFocused() ) {
		iTextColor = UICOLOR_EDIT_TEXT_NORMAL;
		iBorderColor = UICOLOR_CONTROL_BORDER_NORMAL;
		iBackColor = UICOLOR_CONTROL_BACKGROUND_HOVER;
	}
	if( !IsEnabled() ) {
		iTextColor = UICOLOR_EDIT_TEXT_DISABLED;
		iBorderColor = UICOLOR_CONTROL_BORDER_DISABLED;
		iBackColor = UICOLOR__INVALID;
	}
	CBlueRenderEngineUI::DoPaintFrame(hDC, m_pManager, rcText, iBorderColor, iBorderColor, iBackColor);
	::InflateRect(&rcText, -4, -2);
	m_nLinks = lengthof(m_rcLinks);
	CBlueRenderEngineUI::DoPaintPrettyText(hDC, m_pManager, rcText, m_sText, iTextColor, UICOLOR__INVALID, m_rcLinks, m_nLinks, DT_SINGLELINE);
	RECT rcPadding = { 0 };
	CBlueRenderEngineUI::DoPaintButton(hDC, m_pManager, m_rcButton, _T("<i 4>"), rcPadding, m_uButtonState, 0);
}
// ---------------------------------------------------------
// CCertManUIContainerPersonal::FocusChanged(TDrawNow aDrawNow)
// ---------------------------------------------------------
//
void CCertManUIContainerPersonal::FocusChanged( TDrawNow aDrawNow )
    {
    if ( iListBox )
        {
        iListBox->SetFocus( IsFocused(), aDrawNow );
        }
    }
Exemple #21
0
void TagsView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
{
	switch(key)
	{
	/*case KEY_TAB:
		if(IsFocused(usernameField))
			FocusComponent(passwordField);
		else
			FocusComponent(usernameField);
		break;*/
	case KEY_ENTER:
	case KEY_RETURN:
		if(IsFocused(tagInput))
		{

			try
			{
				c->AddTag(tagInput->GetText());
			}
			catch(TagsModelException & ex)
			{
				new ErrorMessage("Could not add tag", ex.what());
			}
			tagInput->SetText("");
		}
		break;
	}
}
Exemple #22
0
bool GUI_TextField::HandleKeyEvent(const SDL_Event * event)
{
    if (IsFocused()) {
        int key = event->key.keysym.sym;
        int ch = event->key.keysym.unicode;
        switch (key) {
        case SDLK_RIGHT:
            SetCursorPos(cursorpos + 1);
            return 1;
        case SDLK_LEFT:
            SetCursorPos(cursorpos - 1);
            return 1;
        case SDLK_DELETE:
            DeleteCurrChar();
            return 1;
        case SDLK_BACKSPACE:
            Backspace();
            return 1;
        case SDLK_HOME:
            SetCursorPos(0);
            return 1;
        case SDLK_END:
            SetCursorPos(strlen(buffer));
            return 1;
        case SDLK_RETURN:
            break;
        }
        if (ch >= 32 && ch <= 126) {
            SendChar(ch, true);
            return 1;
        }
    }
    return GUI_Widget::HandleKeyEvent(event);
}
	void CControlUI::PaintBorder(HDC hDC)
	{
		if(m_dwBorderColor != 0 || m_dwFocusBorderColor != 0)
		{
			if(m_nBorderSize > 0 && ( m_cxyBorderRound.cx > 0 || m_cxyBorderRound.cy > 0 ))//»­Ô²½Ç±ß¿ò
			{
				if (IsFocused() && m_dwFocusBorderColor != 0)
					CRenderEngine::DrawRoundRect(hDC, m_rcItem, m_nBorderSize, m_cxyBorderRound.cx, m_cxyBorderRound.cy, GetAdjustColor(m_dwFocusBorderColor));
				else
					CRenderEngine::DrawRoundRect(hDC, m_rcItem, m_nBorderSize, m_cxyBorderRound.cx, m_cxyBorderRound.cy, GetAdjustColor(m_dwBorderColor));
			}
			else
			{
				if (IsFocused() && m_dwFocusBorderColor != 0 && m_nBorderSize > 0)
					CRenderEngine::DrawRect(hDC, m_rcItem, m_nBorderSize, GetAdjustColor(m_dwFocusBorderColor));
				else if(m_rcBorderSize.left > 0 || m_rcBorderSize.top > 0 || m_rcBorderSize.right > 0 || m_rcBorderSize.bottom > 0)
				{
					RECT rcBorder;

					if(m_rcBorderSize.left > 0){
						rcBorder		= m_rcItem;
						rcBorder.right	= rcBorder.left;
						CRenderEngine::DrawLine(hDC,rcBorder,m_rcBorderSize.left,GetAdjustColor(m_dwBorderColor),m_nBorderStyle);
					}
					if(m_rcBorderSize.top > 0){
						rcBorder		= m_rcItem;
						rcBorder.bottom	= rcBorder.top;
						CRenderEngine::DrawLine(hDC,rcBorder,m_rcBorderSize.top,GetAdjustColor(m_dwBorderColor),m_nBorderStyle);
					}
					if(m_rcBorderSize.right > 0){
						rcBorder		= m_rcItem;
						rcBorder.right -= 1;
						rcBorder.left	= rcBorder.right;
						CRenderEngine::DrawLine(hDC,rcBorder,m_rcBorderSize.right,GetAdjustColor(m_dwBorderColor),m_nBorderStyle);
					}
					if(m_rcBorderSize.bottom > 0){
						rcBorder		= m_rcItem;
						rcBorder.bottom -= 1;
						rcBorder.top	= rcBorder.bottom;
						CRenderEngine::DrawLine(hDC,rcBorder,m_rcBorderSize.bottom,GetAdjustColor(m_dwBorderColor),m_nBorderStyle);
					}
				}
				else if(m_nBorderSize > 0)
					CRenderEngine::DrawRect(hDC, m_rcItem, m_nBorderSize, GetAdjustColor(m_dwBorderColor));
			}
		}
	}
nsEventStates
nsNativeTheme::GetContentState(nsIFrame* aFrame, PRUint8 aWidgetType)
{
  if (!aFrame)
    return nsEventStates();

  PRBool isXULCheckboxRadio = 
    (aWidgetType == NS_THEME_CHECKBOX ||
     aWidgetType == NS_THEME_RADIO) &&
    aFrame->GetContent()->IsXUL();
  if (isXULCheckboxRadio)
    aFrame = aFrame->GetParent();

  if (!aFrame->GetContent())
    return nsEventStates();

  nsIPresShell *shell = GetPresShell(aFrame);
  if (!shell)
    return nsEventStates();

  nsIContent* frameContent = aFrame->GetContent();
  nsEventStates flags;
  if (frameContent->IsElement()) {
    flags = frameContent->AsElement()->State();
  }
  
  if (isXULCheckboxRadio && aWidgetType == NS_THEME_RADIO) {
    if (IsFocused(aFrame))
      flags |= NS_EVENT_STATE_FOCUS;
  }

  // On Windows and Mac, only draw focus rings if they should be shown. This
  // means that focus rings are only shown once the keyboard has been used to
  // focus something in the window.
#if defined(XP_MACOSX)
  // Mac always draws focus rings for textboxes and lists.
  if (aWidgetType == NS_THEME_TEXTFIELD ||
      aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
      aWidgetType == NS_THEME_SEARCHFIELD ||
      aWidgetType == NS_THEME_LISTBOX) {
    return flags;
  }
#endif
#if defined(XP_WIN)
  // On Windows, focused buttons are always drawn as such by the native theme.
  if (aWidgetType == NS_THEME_BUTTON)
    return flags;
#endif    
#if defined(XP_MACOSX) || defined(XP_WIN)
  nsIDocument* doc = aFrame->GetContent()->GetOwnerDoc();
  if (doc) {
    nsPIDOMWindow* window = doc->GetWindow();
    if (window && !window->ShouldShowFocusRing())
      flags &= ~NS_EVENT_STATE_FOCUS;
  }
#endif
  
  return flags;
}
	void CComboBoxUI::PaintStatusImage(HDC hDC)
	{
		if (m_sArrowImage.IsEmpty())
			CComboUI::PaintStatusImage(hDC);
		else
		{
			// get index
			if( IsFocused() ) m_uButtonState |= UISTATE_FOCUSED;
			else m_uButtonState &= ~ UISTATE_FOCUSED;
			if( !IsEnabled() ) m_uButtonState |= UISTATE_DISABLED;
			else m_uButtonState &= ~ UISTATE_DISABLED;

			int nIndex = 0;
			if ((m_uButtonState & UISTATE_DISABLED) != 0)
				nIndex = 4;
			else if ((m_uButtonState & UISTATE_PUSHED) != 0)
				nIndex = 2;
			else if ((m_uButtonState & UISTATE_HOT) != 0)
				nIndex = 1;
			else if ((m_uButtonState & UISTATE_FOCUSED) != 0)
				nIndex = 3;

			// make modify string
			CDuiString sModify = m_sArrowImage;

			int nPos1 = sModify.Find(_T("source"));
			int nPos2 = sModify.Find(_T("'"), nPos1 + 7);
			if (nPos2 == -1) return; //first
			int nPos3 = sModify.Find(_T("'"), nPos2 + 1);
			if (nPos3 == -1) return; //second

			CDuiRect rcBmpPart;
			LPTSTR lpszValue = NULL;
			rcBmpPart.left = _tcstol(sModify.GetData() + nPos2 + 1, &lpszValue, 10);  ASSERT(lpszValue);    
			rcBmpPart.top = _tcstol(lpszValue + 1, &lpszValue, 10);    ASSERT(lpszValue);    
			rcBmpPart.right = _tcstol(lpszValue + 1, &lpszValue, 10);  ASSERT(lpszValue);    
			rcBmpPart.bottom = _tcstol(lpszValue + 1, &lpszValue, 10); ASSERT(lpszValue); 

			m_nArrowWidth = rcBmpPart.GetWidth() / 5;
			rcBmpPart.left += nIndex * m_nArrowWidth;
			rcBmpPart.right = rcBmpPart.left + m_nArrowWidth;

			CDuiRect rcDest(0, 0, m_rcItem.right - m_rcItem.left, m_rcItem.bottom - m_rcItem.top);
			rcDest.Deflate(GetBorderSize(), GetBorderSize());
			rcDest.left = rcDest.right - m_nArrowWidth;

			CDuiString sSource = sModify.Mid(nPos1, nPos3 + 1 - nPos1);
			CDuiString sReplace;
			sReplace.SmallFormat(_T("source='%d,%d,%d,%d' dest='%d,%d,%d,%d'"),
				rcBmpPart.left, rcBmpPart.top, rcBmpPart.right, rcBmpPart.bottom,
				rcDest.left, rcDest.top, rcDest.right, rcDest.bottom);

			sModify.Replace(sSource, sReplace);

			// draw image
			if (!DrawImage(hDC, m_sArrowImage, sModify))
				m_sNormalImage.Empty();
		}
	}
Exemple #26
0
void CMultiLineEditUI::DoPaint(HDC hDC, const RECT& /*rcPaint*/)
{
   UINT uState = 0;
   if( IsFocused() ) uState |= UISTATE_FOCUSED;
   if( IsReadOnly() ) uState |= UISTATE_READONLY;
   if( !IsEnabled() ) uState |= UISTATE_DISABLED;
   CBlueRenderEngineUI::DoPaintEditBox(hDC, m_pManager, m_rcItem, _T(""), uState, 0, true);
}
Exemple #27
0
void CSingleLineEditUI::DoPaint(HDC hDC, const RECT& /*rcPaint*/)
{
   UINT uState = 0;
   if( IsFocused() ) uState |= UISTATE_FOCUSED;
   if( IsReadOnly() ) uState |= UISTATE_READONLY;
   if( !IsEnabled() ) uState |= UISTATE_DISABLED;
   CBlueRenderEngineUI::DoPaintEditBox(hDC, m_pManager, m_rcItem, m_sText, uState, m_uEditStyle, false);
}
Exemple #28
0
void SListBoxEx::OnViewOriginChanged( CPoint ptOld,CPoint ptNew )
{
    if(m_iSelItem!=-1 && IsFocused())
    {//这里需要重新设置一下选中行的焦点状态来更新光标位置
        m_arrItems[m_iSelItem]->DoFrameEvent(WM_KILLFOCUS,0,0);
        m_arrItems[m_iSelItem]->DoFrameEvent(WM_SETFOCUS,0,0);
    }
}
Exemple #29
0
void
BorderBrush::operator()(PaintEventArgs&& e)
{
	auto& sender(e.GetSender());

	DrawRect(e.Target, e.ClipArea, Rect(e.Location, GetSizeOf(sender)),
		IsFocused(sender) ? Style.ActiveColor : Style.InactiveColor);
}
	void FocusChanged( TDrawNow aDrawNow )
    {
		CCoeControl::FocusChanged( aDrawNow );
        if( iContent )
			{
				iContent->SetFocus( IsFocused(), aDrawNow );
			}
    }