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);
|
Log.setLogLevel(LogLevel.Trace);
|
||||||
DerelictCocoa.load();
|
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();
|
NSString appName = NSProcessInfo.processInfo().processName();
|
||||||
Log.i("appName = %s", appName);
|
Log.i("appName = %s", appName);
|
||||||
//writefln("appName = %s", appName);
|
//writefln("appName = %s", appName);
|
||||||
|
@ -46,17 +56,18 @@ void main(string[] args)
|
||||||
|
|
||||||
NSApp.activateIgnoringOtherApps(YES);
|
NSApp.activateIgnoringOtherApps(YES);
|
||||||
|
|
||||||
// string uuid = randomUUID().toString();
|
// string uuid = randomUUID().toString();
|
||||||
// DlanguiCocoaView.customClassName = "DlanguiCocoaView_" ~ uuid;
|
// DlanguiCocoaView.customClassName = "DlanguiCocoaView_" ~ uuid;
|
||||||
// DlanguiCocoaView.registerSubclass();
|
// DlanguiCocoaView.registerSubclass();
|
||||||
//
|
//
|
||||||
// _view = DlanguiCocoaView.alloc();
|
// _view = DlanguiCocoaView.alloc();
|
||||||
// _view.initialize(this, width, height);
|
// _view.initialize(this, width, height);
|
||||||
//
|
//
|
||||||
// parentView.addSubview(_view);
|
// parentView.addSubview(_view);
|
||||||
|
|
||||||
|
|
||||||
NSApp.run();
|
NSApp.run();
|
||||||
|
}
|
||||||
|
|
||||||
DerelictCocoa.unload();
|
DerelictCocoa.unload();
|
||||||
}
|
}
|
||||||
|
@ -75,6 +86,40 @@ interface IWindowListener {
|
||||||
Rect getDirtyRectangle();
|
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 {
|
struct MouseState {
|
||||||
bool leftButtonDown;
|
bool leftButtonDown;
|
||||||
bool rightButtonDown;
|
bool rightButtonDown;
|
||||||
|
|
Loading…
Reference in New Issue