| @@ -1076,6 +1076,10 @@ public: | |||||
| } | } | ||||
| } | } | ||||
| void textInputRequired (int /*x*/, int /*y*/) | |||||
| { | |||||
| } | |||||
| void repaint (int x, int y, int w, int h) | void repaint (int x, int y, int w, int h) | ||||
| { | { | ||||
| if (Rectangle::intersectRectangles (x, y, w, h, | if (Rectangle::intersectRectangles (x, y, w, h, | ||||
| @@ -751,6 +751,10 @@ public: | |||||
| } | } | ||||
| } | } | ||||
| void textInputRequired (int /*x*/, int /*y*/) | |||||
| { | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| void repaint (int x, int y, int w, int h) | void repaint (int x, int y, int w, int h) | ||||
| { | { | ||||
| @@ -484,6 +484,7 @@ public: | |||||
| fullScreen (false), | fullScreen (false), | ||||
| isDragging (false), | isDragging (false), | ||||
| isMouseOver (false), | isMouseOver (false), | ||||
| hasCreatedCaret (false), | |||||
| currentWindowIcon (0), | currentWindowIcon (0), | ||||
| taskBarIcon (0), | taskBarIcon (0), | ||||
| dropTarget (0) | dropTarget (0) | ||||
| @@ -819,6 +820,18 @@ public: | |||||
| shouldDeactivateTitleBar = oldDeactivate; | shouldDeactivateTitleBar = oldDeactivate; | ||||
| } | } | ||||
| void textInputRequired (int x, int y) | |||||
| { | |||||
| if (! hasCreatedCaret) | |||||
| { | |||||
| hasCreatedCaret = true; | |||||
| CreateCaret (hwnd, 0, 0, 0); | |||||
| } | |||||
| ShowCaret (hwnd); | |||||
| SetCaretPos (x, y); | |||||
| } | |||||
| void repaint (int x, int y, int w, int h) | void repaint (int x, int y, int w, int h) | ||||
| { | { | ||||
| const RECT r = { x, y, x + w, y + h }; | const RECT r = { x, y, x + w, y + h }; | ||||
| @@ -901,7 +914,7 @@ public: | |||||
| private: | private: | ||||
| HWND hwnd; | HWND hwnd; | ||||
| DropShadower* shadower; | DropShadower* shadower; | ||||
| bool fullScreen, isDragging, isMouseOver; | |||||
| bool fullScreen, isDragging, isMouseOver, hasCreatedCaret; | |||||
| BorderSize windowBorder; | BorderSize windowBorder; | ||||
| HICON currentWindowIcon; | HICON currentWindowIcon; | ||||
| NOTIFYICONDATA* taskBarIcon; | NOTIFYICONDATA* taskBarIcon; | ||||
| @@ -1976,6 +1989,12 @@ private: | |||||
| break; | break; | ||||
| case WM_KILLFOCUS: | case WM_KILLFOCUS: | ||||
| if (hasCreatedCaret) | |||||
| { | |||||
| hasCreatedCaret = false; | |||||
| DestroyCaret(); | |||||
| } | |||||
| handleFocusLoss(); | handleFocusLoss(); | ||||
| break; | break; | ||||
| @@ -2104,6 +2104,11 @@ void TextEditor::focusGained (FocusChangeType) | |||||
| if (caretVisible) | if (caretVisible) | ||||
| textHolder->startTimer (flashSpeedIntervalMs); | textHolder->startTimer (flashSpeedIntervalMs); | ||||
| ComponentPeer* const peer = getPeer(); | |||||
| if (peer != 0) | |||||
| peer->textInputRequired (getScreenX() - peer->getScreenX(), | |||||
| getScreenY() - peer->getScreenY()); | |||||
| } | } | ||||
| void TextEditor::focusLost (FocusChangeType) | void TextEditor::focusLost (FocusChangeType) | ||||
| @@ -82,6 +82,13 @@ public: | |||||
| peer->grabFocus(); | peer->grabFocus(); | ||||
| } | } | ||||
| void textInputRequired (int x, int y) | |||||
| { | |||||
| ComponentPeer* peer = magnifierComp->getPeer(); | |||||
| if (peer != 0) | |||||
| peer->textInputRequired (x, y); | |||||
| } | |||||
| void getBounds (int& x, int& y, int& w, int& h) const | void getBounds (int& x, int& y, int& w, int& h) const | ||||
| { | { | ||||
| x = magnifierComp->getScreenX(); | x = magnifierComp->getScreenX(); | ||||
| @@ -254,6 +254,13 @@ public: | |||||
| /** Tries to give the window keyboard focus. */ | /** Tries to give the window keyboard focus. */ | ||||
| virtual void grabFocus() = 0; | virtual void grabFocus() = 0; | ||||
| /** Tells the window that text input may be required at the given position. | |||||
| This may cause things like a virtual on-screen keyboard to appear, depending | |||||
| on the OS. | |||||
| */ | |||||
| virtual void textInputRequired (int x, int y) = 0; | |||||
| /** Called when the window gains keyboard focus. */ | /** Called when the window gains keyboard focus. */ | ||||
| void handleFocusGain(); | void handleFocusGain(); | ||||
| /** Called when the window loses keyboard focus. */ | /** Called when the window loses keyboard focus. */ | ||||