123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- // TestApp1.cpp : Defines the entry point for the application.
- //
-
- #ifdef _WIN32
- #include "Win32/stdafx.h"
- #endif
-
- #include <DK.h>
-
-
- class TestApp1 : public DKApplication
- {
- DKObject<DKWindow> window;
- public:
- void OnInitialize(void) override
- {
- DKLog("%s", DKGL_FUNCTION_NAME);
- DKWindow::WindowCallback cb = {};
-
- cb.draggingFeedback = DKFunction([](DKWindow*, DKWindow::DraggingState state, const DKPoint&, const DKStringArray&) {
- DKLog("cb.draggingFeedback: state:%d", state);
- return DKWindow::DragOperationCopy;
- });
- cb.closeRequest = DKFunction([](DKWindow* window)
- {
- DKLog("Close request?");
- if (DKIsDebuggerPresent())
- return false;
- 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();
- }
|