Пример #1
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CHudOrder::ApplySchemeSettings(vgui::IScheme *pScheme)
{
	Panel::ApplySchemeSettings(pScheme);

	if ( m_pOrder && m_pOrder->IsPersonalOrder() )
	{
		SetBgColor( GetSchemeColor("HudStatusSelectedBgColor", pScheme) );
	}
	else
	{
		SetBgColor( GetSchemeColor("HudStatusBgColor", pScheme) );
	}
}
Пример #2
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CHudLabel::ApplySchemeSettings(vgui::IScheme *pScheme)
{
	Panel::ApplySchemeSettings(pScheme);

	if ( m_bSelected )
	{
		SetBgColor( GetSchemeColor("HudStatusSelectedBgColor", pScheme) );
	}
	else
	{
		SetBgColor( GetSchemeColor("HudStatusBgColor", pScheme) );
	}
}
Пример #3
0
void MainMenu::ApplySchemeSettings(vgui::IScheme* pScheme)
{
	BaseClass::ApplySchemeSettings(pScheme);

	m_fButtonsSpace = atof(pScheme->GetResourceString("MainMenu.Buttons.Space"));
	m_fButtonsOffsetX = atof(pScheme->GetResourceString("MainMenu.Buttons.OffsetX"));
	m_fButtonsOffsetY = atof(pScheme->GetResourceString("MainMenu.Buttons.OffsetY"));
	m_fLogoOffsetX = atof(pScheme->GetResourceString("MainMenu.Logo.OffsetX"));
	m_fLogoOffsetY = atof(pScheme->GetResourceString("MainMenu.Logo.OffsetY"));
	m_cLogoLeft = GetSchemeColor("MainMenu.Logo.Left", pScheme);
	m_cLogoRight = GetSchemeColor("MainMenu.Logo.Right", pScheme);
	m_bLogoAttachToMenu = atoi(pScheme->GetResourceString("MainMenu.Logo.AttachToMenu"));
	m_fLogoFont = pScheme->GetFont("MainMenu.Logo.Font");
}
void CReplayListPanel::ApplySchemeSettings( vgui::IScheme *pScheme )
{
	BaseClass::ApplySchemeSettings( pScheme );

	LoadControlSettings( "resource/ui/replaybrowser/replaylistpanel.res", "GAME" );

#if !defined( TF_CLIENT_DLL )
	SetPaintBorderEnabled( false );
#endif

	MoveScrollBarToTop();

	vgui::ScrollBar *pScrollBar = dynamic_cast< vgui::ScrollBar * >( FindChildByName( "PanelListPanelVScroll" ) );
	pScrollBar->SetScrollbarButtonsVisible( false );
	Color clrButtonColor = GetSchemeColor( "Yellow", Color( 255, 255, 255, 255 ), pScheme );
	Color clrBgColor = GetSchemeColor( "TanDark", Color( 255, 255, 255, 255 ), pScheme );
	const int nWidth = XRES( 5 );
	pScrollBar->SetSize( nWidth, GetTall() );
	pScrollBar->GetSlider()->SetSize( nWidth, GetTall() );
}
Пример #5
0
	virtual void ApplySchemeSettings(IScheme *pScheme)
	{
		// set up the scheme settings
		Button::ApplySchemeSettings(pScheme);

		_textColor = GetSchemeColor("PropertySheet.SelectedTextColor", GetFgColor(), pScheme);
		_dimTextColor = GetSchemeColor("PropertySheet.TextColor", GetFgColor(), pScheme);
		m_pActiveBorder = pScheme->GetBorder("TabActiveBorder");
		m_pNormalBorder = pScheme->GetBorder("TabBorder");

		if ( m_pImage )
		{
			ClearImages();
			m_pImage->SetImage(scheme()->GetImage(m_pszImageName, false));
			AddImage( m_pImage->GetImage(), 2 );
			int w, h;
			m_pImage->GetSize( w, h );
			w += m_pContextLabel ? 10 : 0;
			if ( m_pContextLabel )
			{
				m_pImage->SetPos( 10, 0 );
			}
			SetSize( w + 4, h + 2 );
		}
		else
		{
			int wide, tall;
			int contentWide, contentTall;
			GetSize(wide, tall);
			GetContentSize(contentWide, contentTall);

			wide = max(m_bMaxTabWidth, contentWide + 10);  // 10 = 5 pixels margin on each side
			wide += m_pContextLabel ? 10 : 0;
			SetSize(wide, tall);
		}

		if ( m_pContextLabel )
		{
			SetTextInset( 12, 0 );
		}
	}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFStatPanel::ApplySchemeSettings( vgui::IScheme *pScheme )
{
	BaseClass::ApplySchemeSettings( pScheme );

	LoadControlSettings( "resource/UI/StatPanel_Base.res" );

	vgui::Panel *pStatBox = FindChildByName("StatBox");
	if ( pStatBox )
	{
		// Dirty hack: Make the statbox update now, and then change its bgColor.
		// When it then gets ApplySchemeSetting called shortly after this, it doesn't
		// reapply the scheme because its dirty-scheme flag has been removed.
		pStatBox->ApplySchemeSettings( pScheme );
		pStatBox->SetBgColor( GetSchemeColor("TransparentLightBlack", pScheme) );
	}
}
Пример #7
0
void ComboBoxButton::ApplySchemeSettings(IScheme *pScheme)
{
	Button::ApplySchemeSettings(pScheme);
	
	SetFont(pScheme->GetFont("Marlett", IsProportional()));
	SetContentAlignment(Label::a_west);
	SetTextInset(3, 0);
	SetDefaultBorder(pScheme->GetBorder("ScrollBarButtonBorder"));
	
	// arrow changes color but the background doesnt.
	SetDefaultColor(GetSchemeColor("ComboBoxButton.ArrowColor", pScheme), GetSchemeColor("ComboBoxButton.BgColor", pScheme));
	SetArmedColor(GetSchemeColor("ComboBoxButton.ArmedArrowColor", pScheme), GetSchemeColor("ComboBoxButton.BgColor", pScheme));
	SetDepressedColor(GetSchemeColor("ComboBoxButton.ArmedArrowColor", pScheme), GetSchemeColor("ComboBoxButton.BgColor", pScheme));
	m_DisabledBgColor = GetSchemeColor("ComboBoxButton.DisabledBgColor", pScheme);
}
Пример #8
0
	virtual void ApplySchemeSettings(IScheme *pScheme)
	{
		BaseClass::ApplySchemeSettings(pScheme);

		m_ArmedFgColor2 = GetSchemeColor("ListPanel.SelectedTextColor", pScheme);
		m_ArmedBgColor = GetSchemeColor("ListPanel.SelectedBgColor", pScheme);

		m_FgColor1 = GetSchemeColor("ListPanel.TextColor", pScheme);
		m_FgColor2 = GetSchemeColor("ListPanel.SelectedTextColor", pScheme);

		m_BgColor = GetSchemeColor("ListPanel.BgColor", GetBgColor(), pScheme);
		m_BgColor = GetSchemeColor("ListPanel.TextBgColor", m_BgColor, pScheme);
		m_SelectionBG2Color = GetSchemeColor("ListPanel.SelectedOutOfFocusBgColor", pScheme);
		SetBgColor(m_BgColor);
		SetFgColor(m_FgColor1);

		UpdateImage();
	}
Пример #9
0
// Checkers board window procedure
LOCAL LRESULT CALLBACK eCheckersBoardProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	union { HDC hdcTemp; HPEN hpenTemp; HCURSOR hcurTemp; LPRECT lprt; };
	union { HBRUSH hbrTemp; LONG lTemp; LRESULT lResult; };
	
	INT x, y;
	UINT t1, t2;
	INT nWidth, nHeight;
	HBITMAP hbmpTemp;
	LPCKBOARDINFO lpcki;
	PAINTSTRUCT ps;
	RECT rt;
	HDC hDC;


	// Get window local data
	lpcki = (LPCKBOARDINFO)GetWindowLong(hWnd, 0);

	switch (uMsg)
	{
		case WM_CREATE:
			
			// Create info struct
			if ((lpcki = new CKBOARDINFO) == NULL) return -1;
			if (!hcurNormal) hcurNormal = (HCURSOR)GetClassLong(hWnd, GCL_HCURSOR);


			// Set window locals
			lpcki->hckGame = NULL;
			lpcki->hbmpBoard = NULL;
			lpcki->hColorScheme = CreateColorScheme(NULL, 3);
			lpcki->DropRow = 0; lpcki->DropCol = 0;
		 	lpcki->nBoardWidth = NULL; lpcki->nBoardHeight = NULL;
			lpcki->nBorderWidth = 6; lpcki->nBorderHeight = 4;
			for (x = 0; x < CKP_RANKS; x++) { for (y = 0; y < CKP_TEAMS; y++) lpcki->ckBitmapInfo.hicoaPieces[x][y] = NULL; }
			for (x = 0; x < CKP_RANKS; x++) { for (y = 0; y < CKP_TEAMS; y++) lpcki->ckBitmapInfo.hcuraPieces[x][y] = NULL; }
			lpcki->ckBitmapInfo.nSquareWidth = 34; lpcki->ckBitmapInfo.nSquareHeight = 32;
			lpcki->ckBitmapInfo.nSquareBorderWidth = 1; lpcki->ckBitmapInfo.nSquareBorderHeight = 1;
			lpcki->x = 0; lpcki->y = 0;
			lpcki->bAutoSize = ((((LPCREATESTRUCT)lParam)->style & CKS_AUTOSIZE) == CKS_AUTOSIZE);
			lpcki->bNoAutoUpdate = ((((LPCREATESTRUCT)lParam)->style & CKS_NOAUTOUPDATE) == CKS_NOAUTOUPDATE);
			SetWindowLong(hWnd, 0, (LONG)lpcki);	// Store info in window


			// Set color scheme masks
			SetColorSchemeInfoEx(lpcki->hColorScheme, CKC_SQUAREBORDERCOLOR, 0x000000, CSM_HBRUSH);
			SetColorSchemeInfoEx(lpcki->hColorScheme, CKC_BOARDCOLOR1, 0x404040, CSM_HBRUSH);
			SetColorSchemeInfoEx(lpcki->hColorScheme, CKC_BOARDCOLOR2, 0xF0F0F0, CSM_HBRUSH);
			

			// Create game object
			lpcki->hckGame = CreateCkGame();
			InitCkGameInfo(lpcki->hckGame, NULL);
			

			// Resize window
			if (((LPCREATESTRUCT)lParam)->style & CKS_AUTOSIZE) SendMessage(hWnd, WCKM_RESIZE, 0, 0);
			SendMessage(hWnd, WCKM_UPDATEBOARD, 0, FALSE);	// Create board bitmap, if no resizing was done [and redraw]
			break;
		

		case WCKM_UPDATEBOARD:
			
			// Redraw bitmap
			if ((!lpcki->hbmpBoard) || (lParam))
			{ if (lpcki->hbmpBoard) DeleteObject(lpcki->hbmpBoard);  lpcki->hbmpBoard = CreateCkBitmap((&(lpcki->ckBitmapInfo)), lpcki->hckGame, lpcki->hColorScheme, (&(lpcki->nBoardWidth)), (&(lpcki->nBoardHeight))); }
			else
			{
				// Set up drawing
				hdcTemp = CreateCompatibleDC(NULL);
				hbmpTemp = (HBITMAP)SelectObject(hdcTemp, lpcki->hbmpBoard);
				
				// Draw board onto bitmap
				DrawCkBoard(hdcTemp, (&(lpcki->ckBitmapInfo)), lpcki->hckGame, lpcki->hColorScheme);
				
				// Clean up
				SelectObject(hdcTemp, hbmpTemp); DeleteDC(hdcTemp);
				InvalidateRect(hWnd, NULL, TRUE);
			}

			return 0;

		case WCKM_STARTGAME:
			
			if (IsPlayingCkGame(lpcki->hckGame)) return FALSE;

			// Make sure game is ok to start
			if (SendMessage(GetParent(hWnd), WM_COMMAND, MAKELONG(GetWindowLong(hWnd, GWL_ID), WCKN_QUERYSTARTGAME), (LPARAM)hWnd)) return FALSE;
			
			// Start the game
			if (StartCkGame(lpcki->hckGame, lParam)) {
				// Send gamestart message
				SendMessage(GetParent(hWnd), WM_COMMAND, MAKELONG(GetWindowLong(hWnd, GWL_ID), WCKN_STARTGAME), (LPARAM)hWnd);
		
				// Redraw board and window
				SendMessage(hWnd, WCKM_UPDATEBOARD, 0, FALSE);
				return TRUE;	// Game started ok
			}

			return FALSE;		// Game did not start

		case WCKM_STOPGAME:

			if (!StartedCkGame(lpcki->hckGame)) return FALSE;
			
			// Make sure game is ok to stopped
			if (SendMessage(GetParent(hWnd), WM_COMMAND, MAKELONG(GetWindowLong(hWnd, GWL_ID), WCKN_QUERYENDGAME), (LPARAM)hWnd)) return FALSE;
			
			// Stop the game	// !!!!! Forcefull stop (lParam)
			if (StopCkGame(lpcki->hckGame)) {
				// Send gameend message
				SendMessage(GetParent(hWnd), WM_COMMAND, MAKELONG(GetWindowLong(hWnd, GWL_ID), WCKN_ENDGAME), (LPARAM)hWnd);

				// Redraw board and window
				SendMessage(hWnd, WCKM_UPDATEBOARD, 0, FALSE);
				return TRUE;	// Game stopped ok
			}

			return FALSE;		// Game did not stopped

		case WCKM_PLAYING: return IsPlayingCkGame(lpcki->hckGame);
		case WCKM_STARTED: return StartedCkGame(lpcki->hckGame);
		case WCKM_GAMERESULT: return (LRESULT)GetCkGameResult(lpcki->hckGame);

		case WCKM_SETSCHEMECOLOR:		// Sets a scheme color
			
			// Security check
			if ((INT)wParam >= 0) { if (!lpcki->bNoAutoUpdate) SendMessage(hWnd, WCKM_UPDATEBOARD, 0, FALSE); return FALSE; }
			
			// Set the color and update board (if ok)
			lResult = (LRESULT)SetSchemeColor(lpcki->hColorScheme, (INT)wParam, (COLORREF)lParam);
			if (!lpcki->bNoAutoUpdate) SendMessage(hWnd, WCKM_UPDATEBOARD, 0, FALSE);
			
			return lResult;		// Return result

		case WCKM_GETSCHEMECOLOR:		// Gets a scheme color

			// Security check
			if ((INT)wParam >= 0) return 0x000000;
			return (LRESULT)GetSchemeColor(lpcki->hColorScheme, (UINT)wParam);	// Get color

		case WCKM_SETSCHEMECOLORS:		// Sets all basic scheme colors
			
			// Copy the passed scheme and update board (if ok)
			lResult = (LRESULT)CopySchemeColors(lpcki->hColorScheme, (HTHEMEOBJ)lParam);
			if (!lpcki->bNoAutoUpdate) SendMessage(hWnd, WCKM_UPDATEBOARD, 0, FALSE);

			return lResult;		// Return result

		case WCKM_GETSCHEMECOLORS:		// Gets a copy of the current scheme
			
			return CopySchemeColors((HTHEMEOBJ)lParam, lpcki->hColorScheme);

		case WCKM_SETSQUAREBORDERCOLOR:	// Sets the square's border color
			
			// Set the color and update board (if ok)
			lResult = (LRESULT)SetSchemeColor(lpcki->hColorScheme, CKC_SQUAREBORDERCOLOR, (COLORREF)lParam);
			if (!lpcki->bNoAutoUpdate) SendMessage(hWnd, WCKM_UPDATEBOARD, 0, FALSE);
			return lResult;		// Return result

		case WCKM_GETSQUAREBORDERCOLOR:	// Gets the square's border color
			
			return (LRESULT)GetSchemeColor(lpcki->hColorScheme, CKC_SQUAREBORDERCOLOR);

		case WCKM_SETBOARDCOLOR1:		// Sets the first board square color
			
			// Set the color and update board (if ok)
			lResult = (LRESULT)SetSchemeColor(lpcki->hColorScheme, CKC_BOARDCOLOR1, (COLORREF)lParam);
			if (!lpcki->bNoAutoUpdate) SendMessage(hWnd, WCKM_UPDATEBOARD, 0, FALSE);
			return lResult;		// Return result

		case WCKM_GETBOARDCOLOR1:		// Gets the first board square color
			
			return (LRESULT)GetSchemeColor(lpcki->hColorScheme, WCKM_GETBOARDCOLOR1);

		case WCKM_SETBOARDCOLOR2:		// Sets the second board square color
			
			// Set the color and update board (if ok)
			lResult = (LRESULT)SetSchemeColor(lpcki->hColorScheme, CKC_BOARDCOLOR2, (COLORREF)lParam);
			if (!lpcki->bNoAutoUpdate) SendMessage(hWnd, WCKM_UPDATEBOARD, 0, FALSE);
			return lResult;		// Return result

		case WCKM_GETBOARDCOLOR2:		// Gets the second board square color
			
			return (LRESULT)GetSchemeColor(lpcki->hColorScheme, WCKM_GETBOARDCOLOR2);

		case WCKM_SETBORDERSIZE:		// Sets the board's border size
			
			// Set the size and resize board (if ok)
			lpcki->nBorderWidth = (INT)wParam; lpcki->nBorderHeight = (INT)lParam;
			if ((lpcki->bAutoSize) && (!lpcki->bNoAutoUpdate)) SendMessage(hWnd, WCKM_RESIZE, 0, 0);
			return 0;

		case WCKM_GETBORDERWIDTH: return (LRESULT)lpcki->nBorderWidth;
		case WCKM_GETBORDERHEIGHT: return (LRESULT)lpcki->nBorderHeight;
		
		case WCKM_SETQUARESIZE:			// Sets the board's square size
			
			// Set the size and resize board (if ok)
			lpcki->ckBitmapInfo.nSquareWidth = (INT)wParam; lpcki->ckBitmapInfo.nSquareHeight = (INT)lParam;
			if ((lpcki->bAutoSize) && (!lpcki->bNoAutoUpdate)) SendMessage(hWnd, WCKM_RESIZE, 0, 0);
			return 0;

		case WCKM_GETSQUAREWIDTH: return (LRESULT)lpcki->ckBitmapInfo.nSquareWidth;
		case WCKM_GETSQUAREHEIGHT: return (LRESULT)lpcki->ckBitmapInfo.nSquareHeight;

		case WCKM_SETSQUAREBORDERSIZE:	// Sets the square's border size
			
			// Set the size and resize board (if ok)
			lpcki->ckBitmapInfo.nSquareBorderWidth = (INT)wParam;
			lpcki->ckBitmapInfo.nSquareBorderHeight = (INT)lParam;
			if ((lpcki->bAutoSize) && (!lpcki->bNoAutoUpdate)) SendMessage(hWnd, WCKM_RESIZE, 0, 0);
			return 0;

		case WCKM_GETSQUAREBORDERWIDTH: return (LRESULT)lpcki->ckBitmapInfo.nSquareBorderWidth;
		case WCKM_GETSQUAREBORDERHEIGHT: return (LRESULT)lpcki->ckBitmapInfo.nSquareBorderHeight;
		
		case WCKM_SETPIECEPIC:			// Sets the specified piece status's icon
			
			if (((t1 = LOWORD(wParam)) <= 0) || (t1 > CKP_TEAMS)) return FALSE;
			if (((t2 = HIWORD(wParam)) <= 0) || (t2 > CKP_RANKS)) return FALSE;

			lpcki->ckBitmapInfo.hicoaPieces[(t1-1)][(t2-1)] = (HICON)lParam;
			if (!lpcki->bNoAutoUpdate) SendMessage(hWnd, WCKM_UPDATEBOARD, 0, FALSE);
			return TRUE;
		
		case WCKM_GETPIECEPIC:			// Gets the specified piece status's icon
		
			if (((t1 = LOWORD(wParam)) <= 0) || (t1 > CKP_TEAMS)) return NULL;
			if (((t2 = HIWORD(wParam)) <= 0) || (t2 > CKP_RANKS)) return NULL;

			return (LRESULT)lpcki->ckBitmapInfo.hicoaPieces[(t1-1)][(t2-1)];
		
		case WCKM_SETPIECECURSOR:		// Sets the specified piece status's cursor
			
			if (((t1 = LOWORD(wParam)) <= 0) || (t1 > CKP_TEAMS)) return FALSE;
			if (((t2 = HIWORD(wParam)) <= 0) || (t2 > CKP_RANKS)) return FALSE;

			lpcki->ckBitmapInfo.hcuraPieces[(t1-1)][(t2-1)] = (HCURSOR)lParam;
			
			if (lTemp = GetCkHeldPiecePos(lpcki->hckGame)) {
				x = HIWORD(lTemp); y = LOWORD(lTemp);
	
				// Set the cursor
				hcurTemp = lpcki->ckBitmapInfo.hcuraPieces[(GetCkPieceRank(lpcki->hckGame, y, x)-1)][(GetCkPieceTeam(lpcki->hckGame, y, x)-1)];
				SetClassLong(hWnd, GCL_HCURSOR, (LONG)hcurTemp);
				SetCursor(hcurTemp);	// !!!!! 'Drag' a regioned window for the piece?
			}

			return TRUE;
		
		case WCKM_GETPIECECURSOR:		// Gets the specified piece status's cursor
		
			if (((t1 = LOWORD(wParam)) <= 0) || (t1 > CKP_TEAMS)) return NULL;
			if (((t2 = HIWORD(wParam)) <= 0) || (t2 > CKP_RANKS)) return NULL;

			return (LRESULT)lpcki->ckBitmapInfo.hcuraPieces[(t1-1)][(t2-1)];

		case WCKM_GETSIZE:

			// Security check
			if (lParam == NULL) return FALSE;
			
			// Calculate size
			rt.left = 0; rt.top = 0;
			rt.right = ((((lpcki->ckBitmapInfo.nSquareWidth + lpcki->ckBitmapInfo.nSquareBorderWidth) * 8) + lpcki->ckBitmapInfo.nSquareBorderWidth) + (lpcki->nBorderWidth * 2));
			rt.bottom = ((((lpcki->ckBitmapInfo.nSquareHeight + lpcki->ckBitmapInfo.nSquareBorderHeight) * 8) + lpcki->ckBitmapInfo.nSquareBorderHeight) + (lpcki->nBorderHeight * 2));
			AdjustWindowRectEx(&rt, GetWindowLong(hWnd, GWL_STYLE), FALSE, GetWindowLong(hWnd, GWL_EXSTYLE));

			memcpy((LPRECT)lParam, &rt, sizeof(RECT));
			return TRUE;

		case WCKM_RESIZE:
			
			// Calculate size
			rt.left = 0; rt.top = 0;
			rt.right = ((((lpcki->ckBitmapInfo.nSquareWidth + lpcki->ckBitmapInfo.nSquareBorderWidth) * 8) + lpcki->ckBitmapInfo.nSquareBorderWidth) + (lpcki->nBorderWidth * 2));
			rt.bottom = ((((lpcki->ckBitmapInfo.nSquareHeight + lpcki->ckBitmapInfo.nSquareBorderHeight) * 8) + lpcki->ckBitmapInfo.nSquareBorderHeight) + (lpcki->nBorderHeight * 2));
			AdjustWindowRectEx(&rt, GetWindowLong(hWnd, GWL_STYLE), FALSE, GetWindowLong(hWnd, GWL_EXSTYLE));
			
			// Set size
			SetWindowPos(hWnd, NULL, 0, 0, (rt.right - rt.left), (rt.bottom - rt.top), (SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING | SWP_NOZORDER));

			// Update board (if ok)
			if (!lpcki->bNoAutoUpdate) SendMessage(hWnd, WCKM_UPDATEBOARD, 0, TRUE);
			return 0;
		
		case WCKM_GETHELDORIGIN: return GetCkHeldPiecePos(lpcki->hckGame);
		case WCKM_GETDROPPOSITION: return MAKELONG(lpcki->DropRow, lpcki->DropCol);
		

		case WM_STYLECHANGED:
			
			lpcki->bAutoSize = ((((((LPSTYLESTRUCT)lParam)->styleNew) & CKS_AUTOSIZE) == CKS_AUTOSIZE) != FALSE);
			lpcki->bNoAutoUpdate = ((((((LPSTYLESTRUCT)lParam)->styleNew) & CKS_NOAUTOUPDATE) == CKS_NOAUTOUPDATE) != FALSE);

			// Update if changed, if not previously updated
			if ( (((((LPSTYLESTRUCT)lParam)->styleOld & CKS_AUTOSIZE) == 0) && ((((LPSTYLESTRUCT)lParam)->styleNew & CKS_AUTOSIZE) == CKS_AUTOSIZE)) ||
				(((((LPSTYLESTRUCT)lParam)->styleOld & CKS_NOAUTOUPDATE) == CKS_NOAUTOUPDATE) && ((((LPSTYLESTRUCT)lParam)->styleNew & CKS_NOAUTOUPDATE) == 0)) )
				SendMessage(hWnd, WCKM_UPDATEBOARD, 0, TRUE);

			break;

		case WM_WINDOWPOSCHANGED:
			
			return TRUE;		// Dont send WM_SIZE or WM_MOVE


		case WM_NCPAINT:

			// Allow owner to draw frame
			if (SendMessage(GetParent(hWnd), WM_COMMAND, MAKELONG(GetWindowLong(hWnd, GWL_ID), WCKN_DRAWFRAME), (LPARAM)hWnd) == 0) return 0;
			
			// Set up drawing
			hDC = GetWindowDC(hWnd); GetWindowRect(hWnd, &rt);
			

			// Set up frame coordinates
			rt.right -= rt.left; rt.left = 0; rt.bottom -= rt.top; rt.top = 0;
			nWidth = (rt.right-rt.left); nHeight = (rt.bottom-rt.top);

			if ((GetWindowLong(hWnd, GWL_EXSTYLE) & WS_EX_CLIENTEDGE) == WS_EX_CLIENTEDGE)
			{ DrawSchemeEdge(hDC, &rt, lpcki->hColorScheme, (EDGE_SUNKEN), (BF_RECT)); }
			else if ((GetWindowLong(hWnd, GWL_EXSTYLE) & WS_EX_STATICEDGE) == WS_EX_STATICEDGE)
			{ DrawSchemeEdge(hDC, &rt, lpcki->hColorScheme, (BDR_SUNKENINNER), (BF_RECT)); }
			else { DrawSchemeEdge(hDC, &rt, lpcki->hColorScheme, (EDGE_RAISED), (BF_RECT)); }


			// Clean up
			ReleaseDC(hWnd, hDC);
			return 0;

		case WM_ERASEBKGND: return TRUE;		// No drawing here

		case WM_PAINT:
			
			// Setup painting
			hDC = BeginPaint(hWnd, &ps);

			// Create board bitmap DC
			hdcTemp = CreateCompatibleDC(NULL);
			hbmpTemp = (HBITMAP)SelectObject(hdcTemp, lpcki->hbmpBoard);


			// Draw background
			hbrTemp = GetSchemeBkBrush(lpcki->hColorScheme);
			GetClientRect(hWnd, &rt); nWidth = rt.right; nHeight = rt.bottom;
			x = (lpcki->nBorderWidth+lpcki->x);
			y = (lpcki->nBorderHeight+lpcki->y);
			
			if (x > 0) {
				rt.right = x;
				FillRect(hDC, &rt, hbrTemp);
				rt.left = rt.right; rt.right = nWidth;
			} if (y > 0) {
				rt.bottom = y;
				FillRect(hDC, &rt, hbrTemp);
				rt.bottom = nHeight;
			} if ((x+lpcki->nBoardWidth) < nWidth) {
				rt.left = (x+lpcki->nBoardWidth);
				FillRect(hDC, &rt, hbrTemp);
				rt.right = rt.left; rt.left = 0;
			} if ((y+lpcki->nBoardHeight) < nHeight) {
				rt.top = (y+lpcki->nBoardHeight);
				FillRect(hDC, &rt, hbrTemp);
			}

			
			// Draw board
			BitBlt(hDC, x, y, lpcki->nBoardWidth, lpcki->nBoardHeight, hdcTemp, 0, 0, SRCCOPY);


			// Clean up
			SelectObject(hdcTemp, hbmpTemp); DeleteDC(hdcTemp);		// Delete board DC
			EndPaint(hWnd, &ps);		// End painting
			return TRUE;

		case WM_LBUTTONDOWN:

			// Bounds check
			if ((LOWORD(lParam) < (lpcki->nBorderWidth+lpcki->x)) || (HIWORD(lParam) < (lpcki->nBorderHeight+lpcki->y))) break;
			if ((LOWORD(lParam) > ((lpcki->nBorderWidth+lpcki->x)+((lpcki->ckBitmapInfo.nSquareWidth+lpcki->ckBitmapInfo.nSquareBorderWidth)*8))) || (HIWORD(lParam) > ((lpcki->nBorderHeight+lpcki->y)+((lpcki->ckBitmapInfo.nSquareHeight+lpcki->ckBitmapInfo.nSquareBorderHeight)*8)))) break;

			// Get square position
			if ((x = ((LOWORD(lParam) - (lpcki->nBorderWidth+lpcki->x)) / (lpcki->ckBitmapInfo.nSquareWidth + lpcki->ckBitmapInfo.nSquareBorderWidth)) ) > 7) x = 7;
			if ((y = ((HIWORD(lParam) - (lpcki->nBorderHeight+lpcki->y)) / (lpcki->ckBitmapInfo.nSquareHeight + lpcki->ckBitmapInfo.nSquareBorderHeight)) ) > 7) y = 7;
			x++; y++;	// Board position

			
			// Restore the cursor, if still holding
			if (IsCkHeldPiece(lpcki->hckGame)) SendMessage(hWnd, WM_LBUTTONUP, wParam, lParam);

			// Pick up piece, if available
			if (((t1 = PickUpCkPiece(lpcki->hckGame, y, x)) == CK_NOPICKUP) || (t1 == CK_ERROR)) break;
			if (t1 == CK_WRONGTEAM) { SendMessage(GetParent(hWnd), WM_COMMAND, MAKELONG(GetWindowLong(hWnd, GWL_ID), WCKN_NOPICKUPPIECE), (LPARAM)hWnd); break; }
			
			// Send 'pick up' action message, and drop again if returned -1
			if (SendMessage(GetParent(hWnd), WM_COMMAND, MAKELONG(GetWindowLong(hWnd, GWL_ID), WCKN_PICKUPPIECE), (LPARAM)hWnd))
			{ DropCkPiece(lpcki->hckGame, 0, 0, NULL); break; }


			// !!!!! Set mouse as bitmap (convert bitmap to cursor), unless cursor is specified
			SetCapture(hWnd);
			if (t2 = GetCkPieceRank(lpcki->hckGame, y, x))
			{ hcurTemp = lpcki->ckBitmapInfo.hcuraPieces[(t2-1)][(GetCkPieceTeam(lpcki->hckGame, y, x)-1)]; }
			else { DropCkPiece(lpcki->hckGame, 0, 0, NULL); break; }
			x--; y--;	// Index position

			
			// Redraw new square
			DrawCkSquare(lpcki->hbmpBoard, &lpcki->ckBitmapInfo, lpcki->hckGame, lpcki->hColorScheme, x, y);

			// Paint new square
			GetClientRect(hWnd, &rt);
			rt.left += ((lpcki->nBorderWidth+lpcki->x) + ((x * (lpcki->ckBitmapInfo.nSquareWidth + lpcki->ckBitmapInfo.nSquareBorderWidth)) + lpcki->ckBitmapInfo.nSquareBorderWidth)); rt.right = (rt.left + lpcki->ckBitmapInfo.nSquareWidth);
			rt.top += ((lpcki->nBorderHeight+lpcki->y) + ((y * (lpcki->ckBitmapInfo.nSquareHeight + lpcki->ckBitmapInfo.nSquareBorderHeight)) + lpcki->ckBitmapInfo.nSquareBorderHeight)); rt.bottom = (rt.top + lpcki->ckBitmapInfo.nSquareHeight);
 			
			// Set the cursor
			SetClassLong(hWnd, GCL_HCURSOR, (LONG)hcurTemp);
			SetCursor(hcurTemp);	// !!!!! 'Drag' a window region for the piece?

			// Paint window
			InvalidateRect(hWnd, &rt, FALSE); UpdateWindow(hWnd);
			break;

		case WM_LBUTTONUP:
			
			if (GetCapture() == hWnd) ReleaseCapture();
			if (!IsCkHeldPiece(lpcki->hckGame)) break;
			
			
			// Move the piece
			// ---------------

			// Bounds check
			if (( (LOWORD(lParam) >= (lpcki->nBorderWidth+lpcki->x)) && (LOWORD(lParam) <= ((lpcki->nBorderWidth+lpcki->x)+((lpcki->ckBitmapInfo.nSquareWidth+lpcki->ckBitmapInfo.nSquareBorderWidth)*8))) ) && ((HIWORD(lParam) >= (lpcki->nBorderHeight+lpcki->y)) && (HIWORD(lParam) <= ((lpcki->nBorderHeight+lpcki->y)+((lpcki->ckBitmapInfo.nSquareHeight+lpcki->ckBitmapInfo.nSquareBorderHeight)*8)))) )
			{
				// Get square position
				if ((x = ((LOWORD(lParam) - (lpcki->nBorderWidth+lpcki->x)) / (lpcki->ckBitmapInfo.nSquareWidth + lpcki->ckBitmapInfo.nSquareBorderWidth)) ) > 7) x = 7;
				if ((y = ((HIWORD(lParam) - (lpcki->nBorderHeight+lpcki->y)) / (lpcki->ckBitmapInfo.nSquareHeight + lpcki->ckBitmapInfo.nSquareBorderHeight)) ) > 7) y = 7;
				x++; y++;	// Board positions
			} else { x = y = 0; }

			
			// Set drop position
			lpcki->DropRow = y; lpcki->DropCol = x;
			
			// If not a legal move, send 'illegal move' action message, and drop the piece
			if (((t1 = GetCkDropStatus(lpcki->hckGame, y, x)) & CKM_MOVE) == 0)
			{
				if (t1 == CK_ERROR) return 0;
				
				// Send sound message
				SendMessage(GetParent(hWnd), WM_COMMAND, MAKELONG(GetWindowLong(hWnd, GWL_ID), WCKN_ILLEGALMOVE), (LPARAM)hWnd);
				
				// Get held original position
				lTemp = GetCkHeldPiecePos(lpcki->hckGame); x = (HIWORD(lTemp) - 1); y = (LOWORD(lTemp) - 1);
				
				// Drop the piece, then redraw the square
				DropCkPiece(lpcki->hckGame, 0, 0, NULL);
				DrawCkSquare(lpcki->hbmpBoard, &lpcki->ckBitmapInfo, lpcki->hckGame, lpcki->hColorScheme, x, y);
				goto MoveCkUpdateDisplay;
			}

			
			// Send 'move piece' action message, and drop the piece to its original position if returned -1
			if (t1 & CK_ENDGAME)  { lTemp = WCKN_ENDGAME; }
			else if (t1 & CK_KINGED)  { lTemp = WCKN_KINGED; }
			else if ((t1 & CKM_MOVE) == CK_MULTIJUMP)  { lTemp = WCKN_MULTIJUMPPIECE; }
			else if ((t1 & CKM_MOVE) == CK_JUMP)  { lTemp = WCKN_JUMPPIECE; }
			else  { lTemp = WCKN_MOVEPIECE; }

			if (SendMessage(GetParent(hWnd), WM_COMMAND, MAKELONG(GetWindowLong(hWnd, GWL_ID), lTemp), (LPARAM)hWnd))
			{
				// Get held original position
				lTemp = GetCkHeldPiecePos(lpcki->hckGame); x = (LOWORD(lTemp) - 1); y = HIWORD((lTemp) - 1);
				
				// Drop the piece, then redraw the square
				DropCkPiece(lpcki->hckGame, 0, 0, NULL);
				DrawCkSquare(lpcki->hbmpBoard, &lpcki->ckBitmapInfo, lpcki->hckGame, lpcki->hColorScheme, x, y);
				goto MoveCkUpdateDisplay;
			}
			

			// Move to new position
			t2 = ((t1 = DropCkPiece(lpcki->hckGame, y, x, NULL)) & CKM_MOVE);
			lpcki->DropRow = 0; lpcki->DropCol = 0;		// Update drop position
			x--; y--;	// Index position

			// Redraw square (or board, if jumping)
			if (((t2 == CK_JUMP) || (t2 == CK_MULTIJUMP)))
			{
				// !!!!! Redraw only those squares being jumped
				// Initialize drawing
				hDC = CreateCompatibleDC(NULL);
				hbmpTemp = (HBITMAP)SelectObject(hDC, lpcki->hbmpBoard);
				
				// Draw board
				DrawCkBoard(hDC, &lpcki->ckBitmapInfo, lpcki->hckGame, lpcki->hColorScheme);

				// Clean up
				SelectObject(hDC, hbmpTemp); DeleteDC(hDC);
			} else
			{ DrawCkSquare(lpcki->hbmpBoard, &lpcki->ckBitmapInfo, lpcki->hckGame, lpcki->hColorScheme, x, y); }
			

			// Display update
			MoveCkUpdateDisplay:
			
			// Paint new square
			GetClientRect(hWnd, &rt);
			rt.left += ((lpcki->nBorderWidth+lpcki->x) + ((x * (lpcki->ckBitmapInfo.nSquareWidth + lpcki->ckBitmapInfo.nSquareBorderWidth)) + lpcki->ckBitmapInfo.nSquareBorderWidth)); rt.right = (rt.left + lpcki->ckBitmapInfo.nSquareWidth);
			rt.top += ((lpcki->nBorderHeight+lpcki->y) + ((y * (lpcki->ckBitmapInfo.nSquareHeight + lpcki->ckBitmapInfo.nSquareBorderHeight)) + lpcki->ckBitmapInfo.nSquareBorderHeight)); rt.bottom = (rt.top + lpcki->ckBitmapInfo.nSquareHeight);

			// Restore the original cursor
			SetClassLong(hWnd, GCL_HCURSOR, (LONG)hcurNormal);
			SetCursor(hcurNormal);

			// Window Painting
			lprt = (((t2 == CK_JUMP) || (t2 == CK_MULTIJUMP))?(NULL):(&rt));
			InvalidateRect(hWnd, lprt, FALSE); UpdateWindow(hWnd);

			break;

		case WM_DESTROY:

			if (lpcki)
			{
				// Clean up
				DestroyCkGame(lpcki->hckGame);				// Destroy the game (forcefully, without stopping)
				DeleteObject(lpcki->hbmpBoard);				// Delete board bitmap
				DestroyColorScheme(lpcki->hColorScheme);	// Destroy Color Scheme
				delete lpcki; lpcki = NULL;					// Delete local data
			}
			
			break;
	}

	return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
void CDODDeathStatsPanel::ApplySchemeSettings( vgui::IScheme *pScheme )
{
	BaseClass::ApplySchemeSettings( pScheme );

	SetBgColor( GetSchemeColor("TransparentLightBlack", pScheme) );
}
void Button_Panel::ApplySchemeSettings(vgui::IScheme* Scheme)
{
	BaseClass::ApplySchemeSettings(Scheme);

	SetDefaultColor(Color(0, 0, 0, 0), Color(0, 0, 0, 0));
	SetArmedColor(Color(0, 0, 0, 0), Color(0, 0, 0, 0));
	SetSelectedColor(Color(0, 0, 0, 0), Color(0, 0, 0, 0));
	SetDepressedColor(Color(0, 0, 0, 0), Color(0, 0, 0, 0));
	SetBlinkColor(Color(0, 0, 0, 0));
	SetArmedSound("interface/ui/button_over.wav");
	SetDepressedSound("interface/ui/button_click.wav");
	SetReleasedSound("interface/ui/button_release.wav");

	Width = WidthOut = atof(Scheme->GetResourceString("Panel.Button.Width.Out"));
	WidthOver = atof(Scheme->GetResourceString("Panel.Button.Width.Over"));
	WidthPressed = atof(Scheme->GetResourceString("Panel.Button.Width.Pressed"));
	WidthReleased = atof(Scheme->GetResourceString("Panel.Button.Width.Released"));

	Height = HeightOut = atof(Scheme->GetResourceString("Panel.Button.Height.Out"));
	HeightOver = atof(Scheme->GetResourceString("Panel.Button.Height.Over"));
	HeightPressed = atof(Scheme->GetResourceString("Panel.Button.Height.Pressed"));
	HeightReleased = atof(Scheme->GetResourceString("Panel.Button.Height.Released"));

	TextOffsetX = atof(Scheme->GetResourceString("Panel.Button.Text.OffsetX"));
	TextOffsetY = atof(Scheme->GetResourceString("Panel.Button.Text.OffsetY"));

	DescriptionOffsetX = atof(Scheme->GetResourceString("Panel.Button.Description.OffsetX"));
	DescriptionOffsetY = atof(Scheme->GetResourceString("Panel.Button.Description.OffsetY"));

	bDescriptionHideOut = atoi(Scheme->GetResourceString("Panel.Button.Description.Hide.Out"));
	bDescriptionHideOver = atoi(Scheme->GetResourceString("Panel.Button.Description.Hide.Over"));
	bDescriptionHidePressed = atoi(Scheme->GetResourceString("Panel.Button.Description.Hide.Pressed"));
	bDescriptionHideReleased = atoi(Scheme->GetResourceString("Panel.Button.Description.Hide.Released"));

	AnimationWidth = atof(Scheme->GetResourceString("Panel.Button.Animation.Width"));
	AnimationHeight = atof(Scheme->GetResourceString("Panel.Button.Animation.Height"));
	AnimationBackground = atof(Scheme->GetResourceString("Panel.Button.Animation.Background"));
	AnimationText = atof(Scheme->GetResourceString("Panel.Button.Animation.Text"));
	AnimationDescription = atof(Scheme->GetResourceString("Panel.Button.Animation.Description"));

	BackgroundColor = BackgroundColorOut = GetSchemeColor("Panel.Button.Background.Out", Scheme);
	BackgroundColorOver = GetSchemeColor("Panel.Button.Background.Over", Scheme);
	BackgroundColorPressed = GetSchemeColor("Panel.Button.Background.Pressed", Scheme);
	BackgroundColorReleased = GetSchemeColor("Panel.Button.Background.Released", Scheme);

	BackgroundOutlineColor = BackgroundOutlineColorOut = GetSchemeColor("Panel.Button.Background.Outline.Out", Scheme);
	BackgroundOutlineColorOver = GetSchemeColor("Panel.Button.Background.Outline.Over", Scheme);
	BackgroundOutlineColorPressed = GetSchemeColor("Panel.Button.Background.Outline.Pressed", Scheme);
	BackgroundOutlineColorReleased = GetSchemeColor("Panel.Button.Background.Outline.Released", Scheme);

	TextColor = TextColorOut = GetSchemeColor("Panel.Button.Text.Out", Scheme);
	TextColorOver = GetSchemeColor("Panel.Button.Text.Over", Scheme);
	TextColorPressed = GetSchemeColor("Panel.Button.Text.Pressed", Scheme);
	TextColorReleased = GetSchemeColor("Panel.Button.Text.Released", Scheme);

	DescriptionColor = DescriptionColorOut = GetSchemeColor("Panel.Button.Description.Out", Scheme);
	DescriptionColorOver = GetSchemeColor("Panel.Button.Description.Over", Scheme);
	DescriptionColorPressed = GetSchemeColor("Panel.Button.Description.Pressed", Scheme);
	DescriptionColorReleased = GetSchemeColor("Panel.Button.Description.Released", Scheme);

	BackgroundBlurAlpha = Color(0, 0, 0, 0);
	bBackgroundBlurOut = atoi(Scheme->GetResourceString("Panel.Button.Background.Blur.Out"));
	bBackgroundBlurOver = atoi(Scheme->GetResourceString("Panel.Button.Background.Blur.Over"));
	bBackgroundBlurPressed = atoi(Scheme->GetResourceString("Panel.Button.Background.Blur.Pressed"));
	bBackgroundBlurReleased = atoi(Scheme->GetResourceString("Panel.Button.Background.Blur.Released"));

	TextFont = Scheme->GetFont("Panel.Button.Text.Font");
	DescriptionFont = Scheme->GetFont("Panel.Button.Description.Font");

	PreviousState = State;
}