PageRenderTime 24ms CodeModel.GetById 13ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/platform/osx/scaffold/window.d

http://github.com/wilkie/djehuty
D | 148 lines | 87 code | 33 blank | 28 comment | 0 complexity | 51f6bff5b5b1e06917443a01df1855d1 MD5 | raw file
  1module scaffold.window;
  2
  3
  4
  5
  6import platform.vars.window;
  7import platform.vars.view;
  8import platform.osx.common;
  9
 10import graphics.view;
 11import graphics.graphics;
 12import core.color;
 13
 14import gui.window;
 15import platform.osx.main;
 16import core.string;
 17import io.file;
 18
 19import core.main;
 20
 21import core.definitions;
 22// this is an intermediate step
 23extern(C) void _D_OSXInitView(void* windPtr, _OSXViewPlatformVars* viewVars, _OSXWindowPlatformVars* windowVars)
 24{
 25	/*Window window = cast(Window)windPtr;
 26
 27	WindowPlatformVars* windVars = WindowGetPlatformVars(window);
 28	windVars.viewVars = viewVars;
 29
 30	// create the window's view object
 31	if (WindowHasView(window))
 32	{
 33		Window windref = cast(Window)window;
 34
 35		WindowInitView(windref);
 36	}*/
 37}
 38
 39
 40// all windows
 41
 42extern (C) _OSXViewPlatformVars* _OSXWindowCreate(void* windowRef, _OSXWindowPlatformVars*, _OSXWindowPlatformVars**, char* initTitle, int initX, int initY, int initW, int initH);
 43extern (C) void _OSXWindowShow(_OSXWindowPlatformVars*, int);
 44extern (C) void _OSXWindowSetTitle(_OSXWindowPlatformVars*, char*);
 45
 46extern (C) void _OSXWindowStartDraw(_OSXWindowPlatformVars* windVars, _OSXViewPlatformVars* viewVars, int isSysColorWindow, double r, double g, double b);
 47import binding.c;
 48void WindowCreate(ref Window window, WindowPlatformVars* windowVars)
 49{
 50//	String s = new String(window.getText());
 51//	s.appendChar('\0');
 52//	windowVars.viewVars = _OSXWindowCreate(cast(void*)window, null, &windowVars.vars, s.ptr, window.getX(), window.getY(), window.getWidth(), window.getHeight());
 53
 54string s = window.text;
 55s ~= '\0';
 56windowVars.viewVars = _OSXWindowCreate(cast(void*)window, null, &windowVars.vars, s.ptr, window.x, window.y, window.width, window.height);  
 57	// show or hide the window
 58	//_OSXWindowShow(windowVars.vars, cast(int)window.getVisibility());
 59	window.onInitialize();
 60	window.onAdd();
 61}
 62
 63void WindowCreate(ref Window parent, WindowPlatformVars* parentVars, ref Window window, WindowPlatformVars* windowVars)
 64{
 65//	_OSXWindowCreate(cast(void*)window, parentVars.vars, &windowVars.vars, window.getText().ptr, window.getX(), window.getY(), window.getWidth(), window.getHeight());
 66
 67printf("FOO!\n");
 68string s = window.text;
 69s ~= '\0';
 70windowVars.viewVars = _OSXWindowCreate(cast(void*)window, null, &windowVars.vars, s.ptr, window.x, window.y, window.width, window.height);  
 71	// show or hide the window
 72	//_OSXWindowShow(windowVars.vars, cast(int)window.getVisibility());
 73}
 74
 75void WindowSetStyle(ref Window window, WindowPlatformVars* windowVars)
 76{
 77}
 78
 79void WindowReposition(ref Window window, WindowPlatformVars* windowVars)
 80{
 81}
 82
 83void WindowSetState(ref Window window, WindowPlatformVars* windowVars)
 84{
 85}
 86
 87void _GatherStyleInformation(ref Window window, WindowPlatformVars* windowVars, ref uint istyle, ref uint iexstyle)
 88{
 89}
 90
 91void _ClientSizeToWindowSize(ref Window window, WindowPlatformVars* windowVars, ref int width, ref int height)
 92{
 93}
 94
 95void WindowRebound(ref Window window, WindowPlatformVars* windowVars)
 96{
 97}
 98
 99void WindowDestroy(ref Window window, WindowPlatformVars* windowVars)
100{
101}
102
103void WindowSetVisible(ref Window window, WindowPlatformVars* windowVars, bool bShow) {
104	_OSXWindowShow(windowVars.vars, 1);
105}
106
107void WindowSetTitle(ref Window window, WindowPlatformVars* windowVars)
108{
109//	String s = new String(window.getText());
110//	s.appendChar('\0');
111	string s = window.text;
112	s ~= '\0';
113	_OSXWindowSetTitle(windowVars.vars, s.ptr);
114}
115
116// CLIENT TO SCREEN
117
118// Takes a point on the window's client area and returns the actual screen
119// coordinates for that point.
120
121void WindowClientToScreen(ref Window window, WindowPlatformVars* windowVars, ref int x, ref int y)
122{
123}
124
125void WindowClientToScreen(ref Window window, WindowPlatformVars* windowVars, ref Coord pt)
126{
127}
128
129void WindowClientToScreen(ref Window window, WindowPlatformVars* windowVars, ref Rect rt)
130{
131}
132
133// Viewable windows
134void WindowStartDraw(ref Window window, WindowPlatformVars* windowVars, ref WindowView view, ref ViewPlatformVars viewVars) {
135	_OSXWindowStartDraw(windowVars.vars, windowVars.viewVars, 1, window.color.red, window.color.green, window.color.blue);
136}
137
138void WindowEndDraw(ref Window window, WindowPlatformVars* windowVars, ref WindowView view, ref ViewPlatformVars viewVars)
139{
140}
141
142void WindowCaptureMouse(ref Window window, WindowPlatformVars* windowVars)
143{
144}
145
146void WindowReleaseMouse(ref Window window, WindowPlatformVars* windowVars)
147{
148}