mirror of https://github.com/buggins/dlangui.git
OSX Cocoa support, prototyping
This commit is contained in:
parent
a51abfffc1
commit
0010e02bee
|
@ -16,6 +16,16 @@ void main(string[] args)
|
|||
Log.setLogLevel(LogLevel.Trace);
|
||||
DerelictCocoa.load();
|
||||
|
||||
static if (true) {
|
||||
auto pool = new NSAutoreleasePool;
|
||||
NSString appName = NSProcessInfo.processInfo().processName();
|
||||
Log.i("appName = %s", appName);
|
||||
|
||||
CocoaWindow window = new CocoaWindow(cast(void*)null, new IWindowListenerLogger(), 300, 300);
|
||||
Log.d("");
|
||||
} else {
|
||||
|
||||
|
||||
NSString appName = NSProcessInfo.processInfo().processName();
|
||||
Log.i("appName = %s", appName);
|
||||
//writefln("appName = %s", appName);
|
||||
|
@ -57,6 +67,7 @@ void main(string[] args)
|
|||
|
||||
|
||||
NSApp.run();
|
||||
}
|
||||
|
||||
DerelictCocoa.unload();
|
||||
}
|
||||
|
@ -75,6 +86,40 @@ interface IWindowListener {
|
|||
Rect getDirtyRectangle();
|
||||
}
|
||||
|
||||
class IWindowListenerLogger : IWindowListener {
|
||||
override void onMouseWheel(int x, int y, int deltaX, int deltaY, MouseState state) {
|
||||
Log.d("onMouseWheel");
|
||||
}
|
||||
override void onKeyDown(uint key) {
|
||||
Log.d("onKeyDown");
|
||||
}
|
||||
override void onKeyUp(uint key) {
|
||||
Log.d("onKeyUp");
|
||||
}
|
||||
override void onMouseMove(int x, int y, int deltaX, int deltaY,
|
||||
MouseState mouseState) {
|
||||
Log.d("onMouseMove");
|
||||
}
|
||||
override void onMouseRelease(int x, int y, MouseButton mb, MouseState mouseState) {
|
||||
Log.d("onMouseRelease");
|
||||
}
|
||||
override void onMouseClick(int x, int y, MouseButton mb, bool isDoubleClick, MouseState mouseState) {
|
||||
Log.d("onMouseClick");
|
||||
}
|
||||
override void recomputeDirtyAreas() {
|
||||
Log.d("recomputeDirtyAreas");
|
||||
}
|
||||
override void onResized(int width, int height) {
|
||||
Log.d("onResized");
|
||||
}
|
||||
override void onAnimate(double dt, double time) {
|
||||
Log.d("onAnimate");
|
||||
}
|
||||
override Rect getDirtyRectangle() {
|
||||
return Rect(0, 0, 100, 100);
|
||||
}
|
||||
}
|
||||
|
||||
struct MouseState {
|
||||
bool leftButtonDown;
|
||||
bool rightButtonDown;
|
||||
|
|
Loading…
Reference in New Issue