Welcome to mirror list, hosted at ThFree Co, Russian Federation.

MultiMonitor.h « mplayerc « apps « src - github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b1363494e2263d49bedae178ea0af9977833197b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
 * $Id$
 *
 * Author: Donald Kackman
 * Email: don@itsEngineering.com
 * Copyright 2002, Donald Kackman
 *
 * This file is part of mplayerc.
 *
 * Mplayerc is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * Mplayerc is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

/*
 * David Campbell's article
 * How to Exploit Multiple Monitor Support in Memphis and Windows NT 5.0
 * is very helpful for multimonitor api calls
 * http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0697/monitor/monitor.htm&nav=/msj/0697/newnav.htm
*/

// CMonitor

#pragma once

class CMonitor : public CObject
{
public:
//construction destruction
	CMonitor();
	CMonitor( const CMonitor& monitor );
	virtual ~CMonitor();

//operations
	void Attach( const HMONITOR hMonitor );
	HMONITOR Detach();

	void ClipRectToMonitor( LPRECT lprc, const BOOL UseWorkAreaRect = FALSE ) const;
	void CenterRectToMonitor( LPRECT lprc, const BOOL UseWorkAreaRect = FALSE ) const;
	void CenterWindowToMonitor( CWnd* const pWnd, const BOOL UseWorkAreaRect = FALSE ) const;

	HDC CreateDC() const;

//properties
	void GetMonitorRect( LPRECT lprc ) const;
	void GetWorkAreaRect( LPRECT lprc ) const;

	void GetName( CString& string ) const;

	int GetBitsPerPixel() const;

	BOOL IsOnMonitor( const POINT pt ) const;
	BOOL IsOnMonitor( const CWnd* pWnd ) const;
	BOOL IsOnMonitor( const LPRECT lprc ) const;

	BOOL IsPrimaryMonitor() const;
	BOOL IsMonitor() const;

//operators
	operator HMONITOR() const
	{
		return this == NULL ? NULL : m_hMonitor;
	}

	BOOL operator ==( const CMonitor& monitor ) const
	{
		return m_hMonitor == (HMONITOR)monitor;
	}

	BOOL operator !=( const CMonitor& monitor ) const
	{
		return !( *this == monitor );
	}

	CMonitor& operator =( const CMonitor& monitor )
	{
		m_hMonitor = (HMONITOR)monitor;
		return *this;
	}

private:
	HMONITOR m_hMonitor;

};