// TestApp1.cpp : Defines the entry point for the application. // #ifdef _WIN32 #include "Win32/stdafx.h" #endif #include class TestApp1 : public DKApplication { DKObject window; public: void OnInitialize(void) override { DKLog("%s", DKGL_FUNCTION_NAME); DKWindow::WindowCallback cb = {}; cb.draggingFeedback = DKFunction([](DKWindow*, DKWindow::DraggingState state, const DKPoint& pos, const DKStringArray& files) { DKLog("cb.draggingFeedback: pos:(%.0f, %.0f), state:%d", pos.x, pos.y, state); if (files.Count() > 2) return DKWindow::DragOperationCopy; if (files.Count() > 1) return DKWindow::DragOperationMove; return DKWindow::DragOperationLink; }); cb.closeRequest = DKFunction([](DKWindow* window) { DKLog("Close request?"); return true; }); window = DKWindow::Create("DefaultWindow", DKWindow::StyleGenericWindow|DKWindow::StyleAcceptFileDrop, this->EventLoop(), cb); window->Activate(); window->AddEventHandler(this, DKFunction([this](const DKWindow::WindowEvent& e) { if (e.type == DKWindow::WindowEvent::WindowClosed) DKApplication::Instance()->Terminate(0); }), DKFunction([this](const DKWindow::KeyboardEvent& e) { }), DKFunction([this](const DKWindow::MouseEvent& e) { }) ); } void OnTerminate(void) override { DKLog("%s", DKGL_FUNCTION_NAME); } }; #ifdef _WIN32 int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) #else int main(int argc, const char * argv[]) #endif { DKPropertySet::SystemConfig().SetValue("DisableWindowKey", 1LL); TestApp1 app; DKPropertySet::SystemConfig().SetValue("AppDelegate", "AppDelegate"); return app.Run(); }