Пример #1
0
void CTrayIcon::CreateIcon( int nId, const LPCTSTR lpText )
{
	m_Lock.Lock();
	m_NoPriorityIconData.nIconFlash	= nId;
	m_NoPriorityIconData.nIconNormal = nId;
	m_NoPriorityIconData.IsPriority = false;
	m_NoPriorityIconData.strTooltip = lpText;
	m_Lock.Unlock();

	CIcon ico;
	ico.LoadIcon(nId);
	m_data.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
	m_data.hWnd =m_hNotifyWnd;
	m_data.uID = ELIVE_TRAY_ID;
	m_data.hIcon = (HICON)ico;
	m_data.uCallbackMessage = WM_TRAYICONNOTIFY;

	::lstrcpyn(m_data.szTip, lpText, m_version.dwMajorVersion >= 5 ? 127 : 63);
	::Shell_NotifyIcon(NIM_ADD, &m_data);

	if (m_version.dwMajorVersion >= 5)
	{
		m_data.uVersion = NOTIFYICON_VERSION;
		::Shell_NotifyIcon(NIM_SETVERSION, &m_data);
		int code = GetLastError();
		ATLTRACE("SetVersion error: %d.", code);
	}

	::SetTimer(m_hNotifyWnd,_defFlashIconTimerID,400,NULL);
}
Пример #2
0
void CMenuSkin::DrawMenuItemText(CDCHandle dc, UINT uMenuRes, WORD wMenuID, const CString &lpszMenuString, const RECT &rect, CBitmapHandle hBitmap, CBitmapHandle hBitmapMask, bool bEnabled, bool bBold)
{
	if (hBitmap == (HBITMAP)-1 || hBitmap == (HBITMAP)-2)
	{
		int iWidth = m_imgMenuIcon.GetWidth() / 2;
		int iBegin = iWidth * (-(int)(HBITMAP)hBitmap - 1);
		int iY = (rect.bottom - rect.top - ICON_WIDTH) / 2;
		RECT rcDest = { rect.left + iY + 1, rect.top + iY, rect.left + iY + iWidth + 1, rect.top + iY + iWidth };
		RECT rcSrc = { iBegin, 0, iBegin + iWidth, m_imgMenuIcon.GetHeight() };
		m_imgMenuIcon.Draw(dc, rcDest, rcSrc);
	}
	else if ( (hBitmap && ::GetObjectType(hBitmap) == OBJ_BITMAP) || 
              (hBitmapMask && ::GetObjectType(hBitmapMask) == OBJ_BITMAP) )
	{
		ICONINFO ii = { TRUE, 8, 8, hBitmapMask, hBitmap };
		CIcon ico;
		ico.CreateIconIndirect(&ii);

		int iY = (rect.bottom - rect.top - ICON_WIDTH) / 2;
		ico.DrawIconEx(dc, rect.left + iY + 1, rect.top + iY, ICON_WIDTH, ICON_WIDTH);
	}

	CString strMenuText = lpszMenuString;
	int n = strMenuText.Find('\n');
	if (n >= 0)
		strMenuText = strMenuText.Mid(0, n);

	TCHAR szAcc[128] = { 0 };
	n = strMenuText.Find('\t');
	if (n >= 0)
	{
		_tcscpy_s(szAcc, strMenuText.Mid(n + 1));
		strMenuText = strMenuText.Mid(0, n);
	}

	RECT rcText = rect;
	rcText.left += ICON_WIDTH + 6;
	rcText.right -= 5;

	dc.SetBkMode(TRANSPARENT);
	dc.SetTextColor(CSkinProperty::GetColor(bEnabled ? Skin_Property_Menu_Text_Color : Skin_Property_Menu_Disabled_Text_Color));
	dc.SelectFont(bBold ? s()->Common()->GetBoldFont() : s()->Common()->GetDefaultFont());
	dc.DrawText(strMenuText, strMenuText.GetLength(), &rcText, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);

	if (szAcc[0])
	{
		dc.SetTextColor(CSkinProperty::GetColor(Skin_Property_Menu_Shortcut_Text_Color));
		dc.SelectFont(s()->Common()->GetMenuAccFont());
		dc.DrawText(szAcc, -1, &rcText, DT_RIGHT | DT_VCENTER | DT_SINGLELINE);
	}
}
Пример #3
0
BOOL WeaselTrayIcon::Create(HWND hTargetWnd)
{
	HMODULE hModule = GetModuleHandle(NULL);
	CIcon icon;
	icon.LoadIconW(IDI_ZH);
	BOOL bRet = CSystemTray::Create(hModule, NULL, WM_WEASEL_TRAY_NOTIFY, 
		WEASEL_IME_NAME, icon, IDR_MENU_POPUP);
	if (hTargetWnd)
	{
		SetTargetWnd(hTargetWnd);
	}
	if (!m_style.display_tray_icon)
	{
		RemoveIcon();
	}
	return bRet;
}
Пример #4
0
void CTrayFlash::OnInit()
{
	CIcon * pBase;
	if( !m_strIcon1.empty() )
	{
		pBase = g_pRoot->GetIcon(m_strIcon1.c_str());
		if( pBase )
			m_pIcon1 = g_pRoot->CreateIcon(pBase->IconHnd());
	}
	if( !m_strIcon2.empty() )
	{
		pBase = g_pRoot->GetIcon(m_strIcon2.c_str());
		if( pBase )
			m_pIcon2 = g_pRoot->CreateIcon(pBase->IconHnd());
	}
	Item()->m_nFlags &= ~STYLE_DESTROY_ICON;
	TBase::OnInit();
}
Пример #5
0
LRESULT 
CAboutBox::OnInitDialog( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled )
{
	CAxDialogImpl<CAboutBox>::OnInitDialog(uMsg, wParam, lParam, bHandled);

	DLLVERSIONINFO dllVerInfo;
	ZeroMemory(&dllVerInfo, sizeof(DLLVERSIONINFO));
	dllVerInfo.cbSize  = sizeof(DLLVERSIONINFO);
	DllGetVersion(GetBaseModule().GetModuleInstance(), &dllVerInfo);
	TCHAR version[100];
	_stprintf_s(version, _T("%d.%d.%d"), dllVerInfo.dwMajorVersion, dllVerInfo.dwMinorVersion, dllVerInfo.dwBuildNumber);
	::SetWindowText(GetDlgItem(IDC_VERSION), version);

	::SetWindowText(GetDlgItem(IDC_PRODUCTID), PRODUCT_ID_TEXT);

	::SetWindowText(GetDlgItem(IDC_CREDITS), 
		_T("CodeProject.com team\n")
		_T("Armen Hakobyan\n")
		_T("..."));
	// set icons
	CIcon icon;
	icon.LoadIcon(IDI_ABOUTBOX);
	SetIcon(icon);

	m_Homepage.SetHyperLink(_T("http://www.upgradr.com"));
	m_Homepage.SetLabel(_T("www.upgradr.com"));
	//m_Homepage.SetToolTipText(_T("go to Upgradr homepage"));
	m_Homepage.SubclassWindow(GetDlgItem(IDC_HOMEPAGE));
	m_Homepage.SetExtendedStyle(HLINK_UNDERLINEHOVER);

	m_Support.SetHyperLink(_T("mailto:[email protected]"));
	m_Support.SetLabel(_T("*****@*****.**"));
	//m_Support.SetToolTipText(_T("send email to Upgradr support"));
	m_Support.SubclassWindow(GetDlgItem(IDC_SUPPORT));
	m_Support.SetExtendedStyle(HLINK_UNDERLINEHOVER);

	//HBITMAP hBmp = m_Homepage.AddBitmap(IDB_TOOLBAR);
	//ATLASSERT(hBmp);

	bHandled = TRUE;
	return 1;  // Let the system set the focus
}
Пример #6
0
void CTrayIcon::OnTimer( UINT_PTR nIDEvent )
{
	if ( nIDEvent == _defFlashIconTimerID )
	{
		if ( m_IsShowIcon )
		{
			FlashIconData Data = DecideFlashIconData();
			CIcon icon;
			icon.LoadIcon(Data.nIconNormal);
			ChangeIcon(icon);
			ChangeToolTip(Data.strTooltip);
			m_IsShowIcon = false;

		}
		else
		{
			FlashIconData Data = DecideFlashIconData();
			CIcon icon;
			icon.LoadIcon(Data.nIconFlash);
			ChangeIcon(icon);
			ChangeToolTip(Data.strTooltip);
			m_IsShowIcon = true;
		}
	}
	else if ( nIDEvent == _defIconLeaveTimerID )
	{
		POINT pt = {0};
		RECT rc;
		GetCursorPos(&pt);
		if ( GetTrayIconRect(FindTrayWnd(), m_hNotifyWnd, &rc) == S_FALSE)
		{
			GetTrayIconRect(FindNotifyIconOverflowWindow(), m_hNotifyWnd, &rc);
		}

		if ( !PtInRect(&rc,pt) )
		{
			BOOL b;
			OnTrayIconNotify(WM_TRAYICONNOTIFY, 0, WM_MOUSELEAVE, b);
		}
	}
}
Пример #7
0
bool CIconSelectDialog::UpdateIcon()
{
    ListView.DeleteAllItems();
    IconList.Destroy();
    //アイコン数の取得
    long IconCount=(long)ExtractIcon(GetModuleHandle(NULL),IconPath,-1);
    if(0==IconCount) {
        ListView.EnableWindow(false);
        return false;
    }
    ListView.EnableWindow(true);
    IconList.Create(32,32,ILC_COLOR32 | ILC_MASK,IconCount,1);
    for(long i=0; i<IconCount; i++) {
        CIcon Icon;
        Icon.ExtractIcon(IconPath,i);
        IconList.AddIcon(Icon);
    }
    ListView.SetImageList(IconList,LVSIL_NORMAL);
    for(long i=0; i<IconCount; i++) {
        ListView.AddItem(i,0,_T(""),i);
    }
    return true;
}
Пример #8
0
LRESULT HubMessageControl::onPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
  CPaintDC dc(m_hWnd);
  CRect r;
  GetClientRect(r);
  dc.FillRect(r, GetSysColorBrush(COLOR_INFOBK));
  CIcon helpIcon;
  helpIcon.LoadIcon(IDI_SETTINGS_HELP, ICON_WIDTH, ICON_HEIGHT);
  if (helpIcon) {
    helpIcon.DrawIconEx(dc, (m_leftMargin - ICON_WIDTH) / 2, (r.Height() - ICON_HEIGHT) / 2, ICON_WIDTH, ICON_HEIGHT);
  }
  dc.SetBkColor(GetSysColor(COLOR_INFOBK));
  dc.SetTextColor(GetSysColor(COLOR_INFOTEXT));
  const HFONT oldFont = dc.SelectFont(WinUtil::systemFont);
  r.top += m_topMargin;
  r.left += m_leftMargin;
  r.right -= m_rightMargin;
  r.bottom -= m_bottomMargin;
  const int screenTop = r.top;
  const int screenBottom = r.bottom;
  r.top -= scrollTop;
  for (HubMessageIterator i = messages.begin(); i != messages.end(); ++i) {
    const HubMessage& msg = *i;
    r.bottom = r.top + msg.height;
    //dcdebug("scrollTop=%d r.top=%d r.bottom=%d screenTop=%d screenBottom=%d \n", scrollTop, r.top, r.bottom, screenTop, screenBottom);
    if (r.bottom > screenTop) {
      tstring tmp = msg.time + _T(" ") + msg.text;
      dc.DrawText(tmp.c_str(), tmp.length(), r, DT_WORDBREAK);
    }
    if (r.bottom >= screenBottom) break;
    r.top = r.bottom;
  }
  dc.SelectFont(oldFont);
  if (GetFocus() == m_hWnd) {
    drawFocusRect(dc);
  }
  return 0;
}
Пример #9
0
void CTray::UpdateIcon()
{
	DWORD nIconState = 0;
	
	if( CProfile * pProtection = g_pProduct->GetProfile(AVP_PROFILE_PROTECTION) )
	{
		if( pProtection->m_nState & STATE_FLAG_OPERATIONAL )
		{
			if( g_hGui->m_statistics->m_State.m_ProtectionState & eTasksMalfunction )
				nIconState |= TRAY_STATE_YELLOWXCLAMATION;
			else
				nIconState |= TRAY_STATE_PROTECTION_ON;
		}
	}
	
	if( m_bEnableTrayIconAnimation )
	{
		if( m_fUpdateActive )
		{
			for(DWORD i = 0, c = g_pProduct->GetChildrenCount(); i < c; ++i)
			{
				CProfile *pProfile = g_pProduct->GetChild(i);
				if((pProfile->m_nState & STATE_FLAG_OPERATIONAL) && pProfile->m_sType == AVP_TASK_UPDATER)
				{
//					pProfile->UpdateStatistics();
//					cUpdater2005Statistics * pUpdStat = (cUpdater2005Statistics *)pProfile->statistics(NULL, cUpdater2005Statistics::eIID);
//					if( pUpdStat && pUpdStat->m_qwDownloadedBytesCount )
					{
						nIconState |= TRAY_STATE_UPDATING;
						break;
					}
				}				
			}
		}

		cAVSStatistics * pStat = m_pAVSProfile ? (cAVSStatistics *)m_pAVSProfile->statistics(NULL, cAVSStatistics::eIID) : NULL;

		if( pStat && !(nIconState & TRAY_STATE_UPDATING) )
		{
			switch( pStat->m_nObjectOrigin )
			{
//			case OBJECT_ORIGIN_GENERIC:  nIconState |= TRAY_STATE_SCANACTIVE; break;
			case OBJECT_ORIGIN_MAIL:     nIconState |= TRAY_STATE_MAILACTIVE; break;
//			case OBJECT_ORIGIN_SCRIPT:   nIconState |= TRAY_STATE_SCRIPTACTIVE; break;
			}
		}
	}

	if( g_hGui->m_statistics && (g_hGui->m_statistics->m_State.m_UpdateState & eUpdateNeedReboot) )
		nIconState |= TRAY_STATE_NEEDREBOOT;

	if( m_nIconState == nIconState && m_pIcon )
		return;
	m_nIconState = nIconState;

	CIcon * pOldIcon = m_pIcon;
	m_pIcon = NULL;
	if( CIcon * pBase = g_pRoot->GetIcon(ICONID_TRAY_PROTECTION_OFF) )
		m_pIcon = g_pRoot->CreateIcon(pBase->IconHnd());

	if( m_pIcon )
	{
		if( m_nIconState & TRAY_STATE_PROTECTION_ON )
			m_pIcon->Merge(g_pRoot->GetIcon(ICONID_TRAY_PROTECTION_ON));

		if( m_nIconState & TRAY_STATE_YELLOWXCLAMATION )
			m_pIcon->Merge(g_pRoot->GetIcon(ICONID_TRAY_YELLOWEXCLAMATION));
		else if( m_nIconState & TRAY_STATE_SCANACTIVE )
			m_pIcon->Merge(g_pRoot->GetIcon(ICONID_TRAY_SCANACTIVE));
		else if( m_nIconState & TRAY_STATE_MAILACTIVE )
			m_pIcon->Merge(g_pRoot->GetIcon(ICONID_TRAY_MAILACTIVE));
		else if( m_nIconState & TRAY_STATE_SCRIPTACTIVE )
			m_pIcon->Merge(g_pRoot->GetIcon(ICONID_TRAY_SCRIPTACTIVE));
		else if( m_nIconState & TRAY_STATE_UPDATING )
			m_pIcon->Merge(g_pRoot->GetIcon(ICONID_TRAY_UPDATEACTIVE));

		if( m_nIconState & TRAY_STATE_NEEDREBOOT )
			m_pIcon->Merge(g_pRoot->GetIcon(ICONID_TRAY_NEEDREBOOT));

		m_pItem->SetIcon(m_pIcon);
	}

	if( pOldIcon )
		pOldIcon->Destroy();
}
Пример #10
0
void CTrayIcon::ChangeIcon( UINT nID )
{
	CIcon icon;
	icon.LoadIcon(nID);
	this->ChangeIcon(icon);
}
Пример #11
0
void CSeparateDlg::Draw()
{
	if( !IsVision() ) return;

	CTDialog::Draw();

	m_pCurrState->Draw();


	m_MaterialItemSlot.Draw();

	CIcon* pIcon = NULL;

	CWinCtrl * pCtrl = NULL;
	CWinCtrl * pCtrl2 = NULL;

	RECT rcDraw, rcDrawCount;
	int		iGapY = 0;

	///필요 MP or 줄리
	D3DXMATRIX mat;	
	D3DXMatrixTranslation( &mat, (float)m_sPosition.x, (float)m_sPosition.y,0.0f);
	::setTransformSprite( mat );

	if( pIcon = m_MaterialItemSlot.GetIcon() )
	{
		if( pCtrl = Find("DEST_ITEM_NAME") )
		{
			((CTImage*)pCtrl)->SetAlign(DT_CENTER | DT_VCENTER);
			((CTImage*)pCtrl)->SetText(pIcon->GetName());//대상 아이템
		}
	}
//05. 12. 23 - 김주현 : 분해가.. 기본스킬에 등록됨에 따라 기존에 뺏어오던 돈이랑 mp는 삭제되었다
//하지만 UI 작업이 아직 안된 관계로 찍는 부분만 삭제하고 나중에 UI 수정 작업을 해줘야 한다.
/*
	if(pCtrl = Find("REQ_MP_NUM"))
	{
		SetRect( &rcDraw,
			pCtrl->GetOffset().x, 
			pCtrl->GetOffset().y, 
			pCtrl->GetOffset().x+pCtrl->GetWidth(), 
			pCtrl->GetOffset().y+pCtrl->GetHeight() );

		CSeparate& Separate = CSeparate::GetInstance();
		switch( Separate.GetType() )
		{
		case CSeparate::TYPE_SKILL:
			drawFontf( g_GameDATA.m_hFONT[ FONT_NORMAL ], true, &rcDraw ,g_dwWHITE,DT_RIGHT,"%d", Separate.GetRequireMp() );
			break;
		case CSeparate::TYPE_NPC:
			drawFontf( g_GameDATA.m_hFONT[ FONT_NORMAL ], true, &rcDraw ,g_dwWHITE,DT_RIGHT,"%d", Separate.GetRequireMoney() );
			break;
		default:
			break;

		}		
	}
*/
	if(pCtrl = Find( "MATERIAL_00" ))
	{
		SetRect( &rcDraw,
			pCtrl->GetOffset().x,
			pCtrl->GetOffset().y + 2,
			pCtrl->GetOffset().x + pCtrl->GetWidth(),
			pCtrl->GetOffset().y + pCtrl->GetHeight() + 2);
		if( pCtrl2 = Find( "MATERIAL_01" ) )
		{
			iGapY = pCtrl2->GetPosition().y - pCtrl->GetPosition().y;
		}

	}
	if(pCtrl = Find( "MATERIAL_NUM_00" ))
	{
		SetRect( &rcDrawCount,
			pCtrl->GetOffset().x,
			pCtrl->GetOffset().y,
			pCtrl->GetOffset().x + pCtrl->GetWidth(),
			pCtrl->GetOffset().y + pCtrl->GetHeight() );
	}


	int j= 0;

	m_ResultItemSet = CSeparate::GetInstance().GetResultItemSet();

	std::vector< CSlot >::iterator iter;

	CSeparateDlgStateResult* pSeparateStateResult = CSeparateDlgStateResult::GetInstance();

	if(!pSeparateStateResult->GetStartSeparateState())
	{
		m_vecSingleString.clear();
	}
	else
	{

		if( pSeparateStateResult == NULL) return;

		if(pSeparateStateResult->GetViewNum() > 4)
		{
			iViewItem = -1;
		}
		else
		{
			iViewItem = pSeparateStateResult->GetViewNum();
		}




		for( int i = 0; i < CSeparate::GetInstance().GetResultCnt() - 1 && i <= iViewItem; i++)
		{
			m_OutputItemSlots[i].Draw();

			D3DXMatrixTranslation( &mat, (float)m_sPosition.x, (float)m_sPosition.y,0.0f);
			::setTransformSprite( mat );

			if( pIcon = m_OutputItemSlots[i].GetIcon() )
			{
				CSinglelineString sStrBuf;
				sStrBuf.set_color(g_dwBLACK);
				sStrBuf.set_format(DT_CENTER | DT_VCENTER);
				sStrBuf.set_string( pIcon->GetName() , rcDraw );
				sStrBuf.draw();

				if( sStrBuf.is_ellipsis() )
				{
					m_vecSingleString.push_back( sStrBuf );
				}			

				char Temp[125] = "";
				sprintf( Temp, "%d",CSeparate::GetInstance().GetOutputItemQuantity(i) );

				drawFont( g_GameDATA.m_hFONT[ FONT_NORMAL ], true, &rcDrawCount, g_dwWHITE, DT_CENTER , Temp );
			}
			rcDraw.top		+= iGapY;
			rcDraw.bottom	+= iGapY;
			rcDrawCount.top += iGapY;
			rcDrawCount.bottom += iGapY;

		}

	}
}