diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2015-08-18 05:02:34 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-06-09 10:27:50 +0200 |
| commit | 24e37795d2db8fdc6f7809e793dadbae80211d26 (patch) | |
| tree | f2fd152fb44518222e290e555f0274af18d877bd /X-Plane-SDK/CHeaders/Wrappers/XPCDisplay.cpp | |
| parent | 9a87e2cb6e588641e3cff52655013594c492e033 (diff) | |
add SDKs
Diffstat (limited to 'X-Plane-SDK/CHeaders/Wrappers/XPCDisplay.cpp')
| -rwxr-xr-x | X-Plane-SDK/CHeaders/Wrappers/XPCDisplay.cpp | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/X-Plane-SDK/CHeaders/Wrappers/XPCDisplay.cpp b/X-Plane-SDK/CHeaders/Wrappers/XPCDisplay.cpp new file mode 100755 index 0000000..fc996ca --- /dev/null +++ b/X-Plane-SDK/CHeaders/Wrappers/XPCDisplay.cpp @@ -0,0 +1,104 @@ +#include "XPCDisplay.h" + +XPCKeySniffer::XPCKeySniffer(int inBeforeWindows) : mBeforeWindows(inBeforeWindows) +{ + XPLMRegisterKeySniffer(KeySnifferCB, mBeforeWindows, reinterpret_cast<void *>(this)); +} + +XPCKeySniffer::~XPCKeySniffer() +{ + XPLMUnregisterKeySniffer(KeySnifferCB, mBeforeWindows, reinterpret_cast<void *>(this)); +} + + +int XPCKeySniffer::KeySnifferCB( + char inCharKey, + XPLMKeyFlags inFlags, + char inVirtualKey, + void * inRefCon) +{ + XPCKeySniffer * me = reinterpret_cast<XPCKeySniffer *>(inRefCon); + return me->HandleKeyStroke(inCharKey, inFlags, inVirtualKey); +} + +XPCWindow::XPCWindow( + int inLeft, + int inTop, + int inRight, + int inBottom, + int inIsVisible) +{ + mWindow = XPLMCreateWindow(inLeft, inTop, inRight, inBottom, inIsVisible, + DrawCB, HandleKeyCB, MouseClickCB, + reinterpret_cast<void *>(this)); +} + +XPCWindow::~XPCWindow() +{ + XPLMDestroyWindow(mWindow); +} + +void XPCWindow::GetWindowGeometry( + int * outLeft, + int * outTop, + int * outRight, + int * outBottom) +{ + XPLMGetWindowGeometry(mWindow, outLeft, outTop, outRight, outBottom); +} + +void XPCWindow::SetWindowGeometry( + int inLeft, + int inTop, + int inRight, + int inBottom) +{ + XPLMSetWindowGeometry(mWindow, inLeft, inTop, inRight, inBottom); +} + +int XPCWindow::GetWindowIsVisible(void) +{ + return XPLMGetWindowIsVisible(mWindow); +} + +void XPCWindow::SetWindowIsVisible( + int inIsVisible) +{ + XPLMSetWindowIsVisible(mWindow, inIsVisible); +} + +void XPCWindow::TakeKeyboardFocus(void) +{ + XPLMTakeKeyboardFocus(mWindow); +} + +void XPCWindow::BringWindowToFront(void) +{ + XPLMBringWindowToFront(mWindow); +} + +int XPCWindow::IsWindowInFront(void) +{ + return XPLMIsWindowInFront(mWindow); +} + +void XPCWindow::DrawCB(XPLMWindowID inWindowID, void * inRefcon) +{ + XPCWindow * me = reinterpret_cast<XPCWindow *>(inRefcon); + me->DoDraw(); +} + +void XPCWindow::HandleKeyCB(XPLMWindowID inWindowID, char inKey, XPLMKeyFlags inFlags, char inVirtualKey, void * inRefcon, int losingFocus) +{ + XPCWindow * me = reinterpret_cast<XPCWindow *>(inRefcon); + if (losingFocus) + me->LoseFocus(); + else + me->HandleKey(inKey, inFlags, inVirtualKey); +} + +int XPCWindow::MouseClickCB(XPLMWindowID inWindowID, int x, int y, XPLMMouseStatus inMouse, void * inRefcon) +{ + XPCWindow * me = reinterpret_cast<XPCWindow *>(inRefcon); + return me->HandleClick(x, y, inMouse); +} |
