Browse Source

tags/2021-05-28
jules 17 years ago
parent
commit
7e19432cff
6 changed files with 47 additions and 1 deletions
  1. +4
    -0
      build/linux/platform_specific_code/juce_linux_Windowing.cpp
  2. +4
    -0
      build/macosx/platform_specific_code/juce_mac_Windowing.cpp
  3. +20
    -1
      build/win32/platform_specific_code/juce_win32_Windowing.cpp
  4. +5
    -0
      src/juce_appframework/gui/components/controls/juce_TextEditor.cpp
  5. +7
    -0
      src/juce_appframework/gui/components/special/juce_MagnifierComponent.cpp
  6. +7
    -0
      src/juce_appframework/gui/components/windows/juce_ComponentPeer.h

+ 4
- 0
build/linux/platform_specific_code/juce_linux_Windowing.cpp View File

@@ -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,


+ 4
- 0
build/macosx/platform_specific_code/juce_mac_Windowing.cpp View File

@@ -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)
{ {


+ 20
- 1
build/win32/platform_specific_code/juce_win32_Windowing.cpp View File

@@ -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;


+ 5
- 0
src/juce_appframework/gui/components/controls/juce_TextEditor.cpp View File

@@ -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)


+ 7
- 0
src/juce_appframework/gui/components/special/juce_MagnifierComponent.cpp View File

@@ -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();


+ 7
- 0
src/juce_appframework/gui/components/windows/juce_ComponentPeer.h View File

@@ -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. */


Loading…
Cancel
Save