void CXTPSkinObjectFrame::CCaptionButton::Draw(CDC* pDC, BOOL bFrameActive)
{
    BOOL bHot = IsHighlighted() && (IsPressed() || !m_pFrame->m_pButtonPressed);
    BOOL pRessed = bHot && IsPressed();

    int nState = !m_bEnabled ? SBS_DISABLED : pRessed? SBS_PUSHED: bHot? SBS_HOT: SBS_NORMAL;
    if (!bFrameActive) nState += 4;

    CXTPSkinManagerClass* pClassWindow = m_pFrame->GetSkinManager()->GetSkinClass(m_pFrame, _T("WINDOW"));
    pClassWindow->DrawThemeBackground(pDC, m_nClassPart, nState, m_rcButton);
}
Пример #2
0
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void ReAnimEntityWidget::paintEvent( QPaintEvent* _event )
{
	QPainter painter( this );

	if( IsHighlighted() )
		painter.fillRect( 0, 0, width(), height(), QColor( 0, 255, 0 ) );
	else
		painter.fillRect( 0, 0, width(), height(), QColor( 0, 0, 0 ) );

	painter.setPen( QColor( 0, 0, 0 ) );
	painter.drawText( width() - 100, 0, QString( "%1" ).arg( GetTotalHeight() ) );
	TSuper::paintEvent( _event );
}
Пример #3
0
void ModelLoader::RenderDoorObjectUI(PDOOR door, bool target)
{
	auto model = m_modelData[door->ID];

	if (model)
	{
		bool visible = model->IsVisible();
		ImGui::Checkbox("Render", &visible); ImGui::SameLine();
		model->SetVisible(visible);

		bool highlight = model->IsHighlighted();
		ImGui::Checkbox("Highlight", &highlight);
		model->SetHighlight(highlight);
	}
	else
	{
		ImGui::TextColored(ImColor(255, 0, 0), "No Model Data");
	}

	if (target)
	{
		if (ImGui::TreeNode("Door Data"))
		{
			DumpDataUI(door, sizeof(_DOOR));

			ImGui::TreePop();
		}
		if (ImGui::TreeNode("Switch Data"))
		{
			DumpDataUI(door->pSwitch, sizeof(EQSWITCH));

			ImGui::TreePop();
		}
	}

	ImGui::Separator();

	ImGui::Text("ID: %d Type: %d State: %d", door->ID, door->Type, door->State);
	if (door->ZonePoint != -1)
	{
		const char* zone = GetTeleportName(door->ZonePoint);
		ImGui::TextColored(ImColor(255, 255, 0), "Zone Point: %s (%d)", zone, door->ZonePoint);
	}

	ImGui::DragFloat3("Position", &door->Y);
	ImGui::DragFloat("Heading", &door->Heading);
	ImGui::DragFloat("Angle", &door->DoorAngle);
	ImGui::LabelText("Scale", "%.2f", GetDoorScale(door));
	
	ImGui::DragFloat2("Top Speed 1", &door->TopSpeed1);

	ImGui::DragFloat3("Default Position", &door->DefaultY);
	ImGui::DragFloat("Default Heading", &door->DefaultHeading);
	ImGui::DragFloat("Default Angle", &door->DefaultDoorAngle);


	if (ImGui::Button("Target"))
	{
		CHAR temp[256];
		sprintf_s(temp, "/doortarget id %d", door->ID);

		// would be nice if there was an easier way to do this.
		EzCommand(temp);
	}

	ImGui::SameLine();

	if (ImGui::Button("Reset Position"))
	{
		door->X = door->DefaultX;
		door->Y = door->DefaultY;
		door->Z = door->DefaultZ;
		door->Heading = door->DefaultHeading;
	}

	ImGui::SameLine();

	if (ImGui::Button("Click"))
	{
		ClickDoor(door);
	}
}
static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
{
	GCEVENT *gce = (GCEVENT*)lParam, save_gce;
	GCDEST *gcd = NULL, save_gcd;
	TCHAR* pWnd = NULL;
	char* pMod = NULL;
	BOOL bIsHighlighted = FALSE;
	BOOL bRemoveFlag = FALSE;
	int iRetVal = GC_EVENT_ERROR;

	if ( gce == NULL )
		return GC_EVENT_ERROR;

	gcd = gce->pDest;
	if ( gcd == NULL )
		return GC_EVENT_ERROR;

	if ( gce->cbSize != SIZEOF_STRUCT_GCEVENT_V1 && gce->cbSize != SIZEOF_STRUCT_GCEVENT_V2 )
		return GC_EVENT_WRONGVER;

	if ( !IsEventSupported( gcd->iType ) )
		return GC_EVENT_ERROR;

	EnterCriticalSection(&cs);

	#if defined( _UNICODE )
		if ( !( gce->dwFlags & GC_UNICODE )) {
			save_gce = *gce;
			save_gcd = *gce->pDest;
			gce->pDest->ptszID = a2tf( gce->pDest->ptszID, gce->dwFlags );
			gce->ptszUID       = a2tf( gce->ptszUID,       gce->dwFlags );
			gce->ptszNick      = a2tf( gce->ptszNick,      gce->dwFlags );
			gce->ptszStatus    = a2tf( gce->ptszStatus,    gce->dwFlags );
			gce->ptszText      = a2tf( gce->ptszText,      gce->dwFlags );
			gce->ptszUserInfo  = a2tf( gce->ptszUserInfo,  gce->dwFlags );
		}
	#endif

	// Do different things according to type of event
	switch(gcd->iType) {
	case GC_EVENT_ADDGROUP:
		{
			STATUSINFO* si = SM_AddStatus( gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszStatus);
			if ( si && gce->dwItemData)
				si->hIcon = CopyIcon((HICON)gce->dwItemData);
		}
		iRetVal = 0;
		goto LBL_Exit;

	case GC_EVENT_CHUID:
	case GC_EVENT_CHANGESESSIONAME:
	case GC_EVENT_SETITEMDATA:
	case GC_EVENT_GETITEMDATA:
	case GC_EVENT_CONTROL:
	case GC_EVENT_SETSBTEXT:
	case GC_EVENT_ACK:
	case GC_EVENT_SENDMESSAGE :
	case GC_EVENT_SETSTATUSEX :
		iRetVal = DoControl(gce, wParam);
		goto LBL_Exit;

	case GC_EVENT_SETCONTACTSTATUS:
		iRetVal = SM_SetContactStatus( gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, (WORD)gce->dwItemData );
		goto LBL_Exit;

	case GC_EVENT_TOPIC:
	{
		SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
		if ( si ) {
			if ( gce->pszText ) {
				replaceStr( &si->ptszTopic, gce->ptszText);
				DBWriteContactSettingTString( si->windowData.hContact, si->pszModule , "Topic", RemoveFormatting( si->ptszTopic ));
				if ( DBGetContactSettingByte( NULL, "Chat", "TopicOnClist", 0 ))
					DBWriteContactSettingTString( si->windowData.hContact, "CList" , "StatusMsg", RemoveFormatting( si->ptszTopic ));
		}	}
		break;
	}
	case GC_EVENT_ADDSTATUS:
		SM_GiveStatus( gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, gce->ptszStatus );
		break;

	case GC_EVENT_REMOVESTATUS:
		SM_TakeStatus( gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, gce->ptszStatus);
		break;

	case GC_EVENT_MESSAGE:
	case GC_EVENT_ACTION:
		if ( !gce->bIsMe && gce->pDest->pszID && gce->pszText ) {
			SESSION_INFO* si = SM_FindSession( gce->pDest->ptszID, gce->pDest->pszModule );
			if ( si )
				if ( IsHighlighted( si, gce->ptszText ))
					bIsHighlighted = TRUE;
		}
		break;

	case GC_EVENT_NICK:
		SM_ChangeNick( gce->pDest->ptszID, gce->pDest->pszModule, gce);
		break;

	case GC_EVENT_JOIN:
		AddUser(gce);
		break;

	case GC_EVENT_PART:
	case GC_EVENT_QUIT:
	case GC_EVENT_KICK:
		bRemoveFlag = TRUE;
		break;
	}

	// Decide which window (log) should have the event
	if ( gcd->pszID ) {
		pWnd = gcd->ptszID;
		pMod = gcd->pszModule;
	}
	else if ( gcd->iType == GC_EVENT_NOTICE || gcd->iType == GC_EVENT_INFORMATION ) {
		SESSION_INFO* si = GetActiveSession();
		if ( si && !lstrcmpA( si->pszModule, gcd->pszModule )) {
			pWnd = si->ptszID;
			pMod = si->pszModule;
		}
		else {
			iRetVal = 0;
			goto LBL_Exit;
		}
	}
	else {
		// Send the event to all windows with a user pszUID. Used for broadcasting QUIT etc
		SM_AddEventToAllMatchingUID( gce );
		if ( !bRemoveFlag ) {
			iRetVal = 0;
			goto LBL_Exit;
	}	}

	// add to log
	if ( pWnd ) {
		SESSION_INFO* si = SM_FindSession(pWnd, pMod);

		// fix for IRC's old stuyle mode notifications. Should not affect any other protocol
		if ((gce->pDest->iType == GC_EVENT_ADDSTATUS || gce->pDest->iType == GC_EVENT_REMOVESTATUS) && !( gce->dwFlags & GCEF_ADDTOLOG )) {
			iRetVal = 0;
			goto LBL_Exit;
		}

		if (gce && gce->pDest->iType == GC_EVENT_JOIN && gce->time == 0) {
			iRetVal = 0;
			goto LBL_Exit;
		}

		if (si && (si->bInitDone || gce->pDest->iType == GC_EVENT_TOPIC || (gce->pDest->iType == GC_EVENT_JOIN && gce->bIsMe))) {
			if (SM_AddEvent(pWnd, pMod, gce, bIsHighlighted) && si->hWnd) {
				SendMessage(si->hWnd, GC_ADDLOG, 0, 0);
			}
			else if (si->hWnd) {
				SendMessage(si->hWnd, GC_REDRAWLOG2, 0, 0);
			}
			DoSoundsFlashPopupTrayStuff(si, gce, bIsHighlighted, 0);
			if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings.LoggingEnabled)
				LogToFile(si, gce);
		}

		if ( !bRemoveFlag ) {
			iRetVal = 0;
			goto LBL_Exit;
	}	}

	if ( bRemoveFlag )
		iRetVal = ( SM_RemoveUser( gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID ) == 0 ) ? 1 : 0;

LBL_Exit:
	LeaveCriticalSection(&cs);

	#if defined( _UNICODE )
		if ( !( gce->dwFlags & GC_UNICODE )) {
			mir_free((void*)gce->ptszText );
			mir_free((void*)gce->ptszNick );
			mir_free((void*)gce->ptszUID );
			mir_free((void*)gce->ptszStatus );
			mir_free((void*)gce->ptszUserInfo );
			mir_free((void*)gce->pDest->ptszID );
			*gce = save_gce;
			*gce->pDest = save_gcd;
		}
	#endif

	return iRetVal;
}
Пример #5
0
//*****************************************************************************************
void CBCGPColorButton::OnDraw (CDC* pDC, const CRect& rect, UINT uiState)
{
	ASSERT_VALID (pDC);

	if (m_pPalette == NULL)
	{
		RebuildPalette (NULL);
	}

	CPalette* pCurPalette = pDC->SelectPalette (m_pPalette, FALSE);
	pDC->RealizePalette();

	CSize sizeArrow = CBCGPMenuImages::Size ();

	CRect rectColor = rect;
	rectColor.right -= sizeArrow.cx + nImageHorzMargin;

	CRect rectArrow = rect;
	rectArrow.left = rectColor.right;

	COLORREF color = m_Color;
	if (color == (COLORREF) -1)	// Automatic
	{
		//---------------------------
		// Draw automatic text label:
		//---------------------------
		color = m_ColorAutomatic;
		
		if (!m_strAutoColorText.IsEmpty ())
		{
			rectColor.right = rectColor.left + rectColor.Height ();

			CRect rectText = rect;
			rectText.left = rectColor.right;
			rectText.right = rectArrow.left;

			CFont* pOldFont = SelectFont (pDC);
			ASSERT(pOldFont != NULL);

			pDC->SetBkMode (TRANSPARENT);

			if (m_clrText == (COLORREF)-1)
			{
				if (m_bVisualManagerStyle && !m_bDontSkin)
				{
					pDC->SetTextColor (IsWindowEnabled() ? globalData.clrBarText : globalData.clrGrayedText);
				}
				else
				{
					pDC->SetTextColor (IsWindowEnabled() ? globalData.clrBtnText : globalData.clrGrayedText);
				}
			}
			else
			{
				pDC->SetTextColor (m_clrText);
			}

			UINT nFormat = DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS;

			if (m_bOnGlass)
			{
				CBCGPVisualManager::GetInstance ()->DrawTextOnGlass (pDC, 
					m_strAutoColorText, rectText, nFormat, 0);
			}
			else
			{
				pDC->DrawText (m_strAutoColorText, rectText, nFormat);
			}

			pDC->SelectObject (pOldFont);
		}
	}

	//----------------
	// Draw color box:
	//----------------
	rectColor.DeflateRect (2, 2);

	if (m_bOnGlass)
	{
		CBCGPDrawManager dm (*pDC);
		dm.DrawRect (rectColor, (COLORREF)-1, globalData.clrBtnDkShadow);
	}
	else
	{
		pDC->Draw3dRect (rectColor, globalData.clrBtnHilite, globalData.clrBtnHilite);
		rectColor.DeflateRect (1, 1);
		pDC->Draw3dRect (rectColor, globalData.clrBtnDkShadow, globalData.clrBtnDkShadow);
	}

	rectColor.DeflateRect (1, 1);

	if (color != (COLORREF)-1 && (uiState & ODS_DISABLED) == 0)
	{
		if (globalData.m_nBitsPerPixel == 8) // 256 colors
		{
			ASSERT_VALID (m_pPalette);
			color =  PALETTEINDEX (m_pPalette->GetNearestPaletteIndex (color));
		}

		if (m_bOnGlass)
		{
			CBCGPDrawManager dm (*pDC);
			dm.DrawRect (rectColor, color, (COLORREF)-1);
		}
		else
		{
			CBrush br (color);
			pDC->FillRect (rectColor, &br);
		}
	}

	//----------------------
	// Draw drop-down arrow:
	//----------------------
	CRect rectArrowWinXP = rectArrow;
	rectArrowWinXP.DeflateRect (2, 2);

	if (m_bVisualManagerStyle && !m_bDontSkin)
	{
		CBCGPDrawOnGlass dog (m_bOnGlass);

		BOOL bDisabled    = !IsWindowEnabled ();
		BOOL bFocused     = GetSafeHwnd () == ::GetFocus ();
		BOOL bHighlighted = IsHighlighted ();

		CBCGPToolbarComboBoxButton buttonDummy;
#ifndef _BCGSUITE_
		buttonDummy.m_bIsCtrl = TRUE;

		CBCGPVisualManager::GetInstance ()->OnDrawComboDropButton (
			pDC, rectArrowWinXP, bDisabled, FALSE,
			bHighlighted || bFocused,
			&buttonDummy);
#else
		CMFCVisualManager::GetInstance ()->OnDrawComboDropButton (
			pDC, rectArrowWinXP, bDisabled, FALSE,
			bHighlighted || bFocused,
			&buttonDummy);
#endif
	}
	else
	{
		if (!m_bWinXPTheme || !CBCGPVisualManager::GetInstance ()->DrawComboDropButtonWinXP (
										pDC, rectArrowWinXP,
										(uiState & ODS_DISABLED), m_bPushed,
										m_bHighlighted))
		{
			pDC->FillRect (rectArrow, &globalData.brBtnFace);

			CBCGPMenuImages::Draw (pDC, CBCGPMenuImages::IdArowDownLarge, rectArrow,
				(uiState & ODS_DISABLED) ? CBCGPMenuImages::ImageGray : CBCGPMenuImages::ImageBlack);

			pDC->Draw3dRect (rectArrow, globalData.clrBtnLight, globalData.clrBtnDkShadow);
			rectArrow.DeflateRect (1, 1);
			pDC->Draw3dRect (rectArrow, globalData.clrBtnHilite, globalData.clrBtnShadow);
		}
	}

	if (pCurPalette != NULL)
	{
		pDC->SelectPalette (pCurPalette, FALSE);
	}
}
Пример #6
0
void CXTPTabManagerItem::DrawImage(CDC* pDC, CRect rcIcon, CXTPImageManagerIcon* pImage)
{
	if (rcIcon.Width() == rcIcon.Height() && GetTabManager()->GetPaintManager()->m_bRotateImageOnVerticalDraw
		&& (GetTabManager()->GetPosition() == xtpTabPositionLeft || GetTabManager()->GetPosition() == xtpTabPositionRight)
		&& DrawRotatedImage(pDC, rcIcon, pImage))
	{

	}
	else
	{
		CXTPImageManagerIconHandle& imageHandle = !IsEnabled() ? pImage->GetDisabledIcon(): IsHighlighted() ? pImage->GetHotIcon() :
			IsSelected() ? pImage->GetCheckedIcon() : pImage->GetIcon();

		pImage->Draw(pDC, rcIcon.TopLeft(), imageHandle, rcIcon.Size());
	}
}
Пример #7
0
BOOL CXTPTabManagerItem::DrawRotatedImage(CDC* pDC, CRect rcItem, CXTPImageManagerIcon* pImage)
{
	CXTPImageManagerIconHandle& imageHandle = !IsEnabled() ? pImage->GetDisabledIcon(): IsHighlighted() ? pImage->GetHotIcon() :
		IsSelected() ? pImage->GetCheckedIcon() : pImage->GetIcon();

	const int cx = rcItem.Width();
	const int cy = rcItem.Height();
	ASSERT(cx == cy);
	if (cx != cy)
		return FALSE;

	UINT* pSrcBits = NULL, *pDestBits = NULL;
	HBITMAP hbmSrc = CXTPImageManager::Create32BPPDIBSection(NULL, cx, cy, (LPBYTE*)&pSrcBits);
	if (!pSrcBits)
		return FALSE;

	HBITMAP hbmDest = CXTPImageManager::Create32BPPDIBSection(NULL, cx, cy, (LPBYTE*)&pDestBits);
	if (!pDestBits)
		return FALSE;

	CDC dc;
	dc.CreateCompatibleDC(NULL);
	HGDIOBJ hbmpOld = ::SelectObject(dc, hbmSrc);

	CRect rcDraw(0, 0, cx, cy);

	dc.BitBlt(0, 0, cx, cy, pDC, rcItem.left, rcItem.top, SRCCOPY);
	::SelectObject(dc, hbmpOld);

	UINT* pSrcInv = pDestBits;
	UINT* pDestInv = pSrcBits;

	UINT* pDest = &pDestBits[cx];
	int i;

	for (i = 0; i < cy; i++)
	{
		pDest -= 1;
		pDestBits = pDest;
		for (int j = 0; j < cx; j++)
		{
			*pDestBits = *pSrcBits;
			pSrcBits += 1;
			pDestBits += cy;
		}
	}


	hbmpOld = ::SelectObject(dc, hbmDest);
	pImage->Draw(&dc, rcDraw.TopLeft(), imageHandle, rcDraw.Size());
	::SelectObject(dc, hbmpOld);

	pDest = &pDestInv[cx * (cy - 1)];

	for (i = 0; i < cy; i++)
	{
		pDestInv = pDest;
		for (int j = 0; j < cx; j++)
		{
			*pDestInv = *pSrcInv;
			pSrcInv += 1;
			pDestInv -= cy;
		}
		pDest += 1;
	}

	pDC->DrawState(rcItem.TopLeft(), rcItem.Size(), hbmSrc, DST_BITMAP);

	DeleteObject(hbmSrc);
	DeleteObject(hbmDest);

	return TRUE;
}