Mercurial > projects > dynamin
annotate dynamin/gui/screen.d @ 103:73060bc3f004
Change license to Boost 1.0 and MPL 2.0.
author | Jordan Miner <jminer7@gmail.com> |
---|---|
date | Tue, 15 May 2012 22:06:02 -0500 |
parents | 836a064828e8 |
children |
rev | line source |
---|---|
0 | 1 |
2 /* | |
103
73060bc3f004
Change license to Boost 1.0 and MPL 2.0.
Jordan Miner <jminer7@gmail.com>
parents:
18
diff
changeset
|
3 * Copyright Jordan Miner |
0 | 4 * |
103
73060bc3f004
Change license to Boost 1.0 and MPL 2.0.
Jordan Miner <jminer7@gmail.com>
parents:
18
diff
changeset
|
5 * This Source Code Form is subject to the terms of the Mozilla Public |
73060bc3f004
Change license to Boost 1.0 and MPL 2.0.
Jordan Miner <jminer7@gmail.com>
parents:
18
diff
changeset
|
6 * License, v. 2.0. If a copy of the MPL was not distributed with this |
73060bc3f004
Change license to Boost 1.0 and MPL 2.0.
Jordan Miner <jminer7@gmail.com>
parents:
18
diff
changeset
|
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
0 | 8 * |
9 */ | |
10 | |
11 module dynamin.gui.screen; | |
12 | |
13 import dynamin.painting.coordinates; | |
14 | |
15 // TODO: Screen.size and Screen.DesktopRect ? | |
16 //ScreenList[] Screens() { } | |
17 //Screen PrimaryScreen() { return MonitorFromPoint(0, 0); } | |
18 //GetMonitorInfo(HMONITOR, MONITORINFO*) | |
19 //EnumDisplayMonitors(HDC, RECT*, MONITORENUMPROC, LPARAM); | |
20 /* | |
21 class Screen { | |
22 static { | |
23 Screen[] getAll() | |
24 Screen primary() | |
25 } | |
26 Size size() | |
27 Rect desktopRect() | |
28 } | |
29 */ | |
30 | |
31 /* | |
32 On Windows, Screen mainly wraps an HMONITOR. | |
33 On X, Screen mainly wraps a Screen* | |
34 */ | |
35 version(Windows) { | |
36 | |
37 import dynamin.c.windows; | |
38 /// Returns: the area on the primary monitor that is not covered by the taskbar | |
39 Rect desktopRect() { // TODO: move | |
40 RECT rect; | |
41 SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0); | |
42 return Rect(rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top); | |
43 } | |
44 /// Returns: the screen resolution of the primary monitor | |
45 Size screenSize() { // TODO: move | |
46 return Size(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); | |
47 } | |
48 | |
49 } else { | |
18
836a064828e8
Implement FileDialog/DirectoryDialog with GTK
Jordan Miner <jminer7@gmail.com>
parents:
0
diff
changeset
|
50 import dynamin.gui_backend; |
0 | 51 Rect desktopRect() { // TODO: move |
52 int* data = cast(int*)getXWindowProperty(display, | |
53 XRootWindow(display, XDefaultScreen(display)), XA._NET_WORKAREA); | |
54 scope(exit) XFree(data); | |
55 return Rect(data[0], data[1], data[2], data[3]); | |
56 } | |
57 | |
58 } | |
59 | |
60 |