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


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

@@ -484,6 +484,7 @@ public:
fullScreen (false),
isDragging (false),
isMouseOver (false),
hasCreatedCaret (false),
currentWindowIcon (0),
taskBarIcon (0),
dropTarget (0)
@@ -819,6 +820,18 @@ public:
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)
{
const RECT r = { x, y, x + w, y + h };
@@ -901,7 +914,7 @@ public:
private:
HWND hwnd;
DropShadower* shadower;
bool fullScreen, isDragging, isMouseOver;
bool fullScreen, isDragging, isMouseOver, hasCreatedCaret;
BorderSize windowBorder;
HICON currentWindowIcon;
NOTIFYICONDATA* taskBarIcon;
@@ -1976,6 +1989,12 @@ private:
break;
case WM_KILLFOCUS:
if (hasCreatedCaret)
{
hasCreatedCaret = false;
DestroyCaret();
}
handleFocusLoss();
break;


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

@@ -2104,6 +2104,11 @@ void TextEditor::focusGained (FocusChangeType)
if (caretVisible)
textHolder->startTimer (flashSpeedIntervalMs);
ComponentPeer* const peer = getPeer();
if (peer != 0)
peer->textInputRequired (getScreenX() - peer->getScreenX(),
getScreenY() - peer->getScreenY());
}
void TextEditor::focusLost (FocusChangeType)


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

@@ -82,6 +82,13 @@ public:
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
{
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. */
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. */
void handleFocusGain();
/** Called when the window loses keyboard focus. */


Loading…
Cancel
Save