diff --git a/source/gwork/include/Gwork/Controls/TextBox.h b/source/gwork/include/Gwork/Controls/TextBox.h index eee483db..11bec419 100644 --- a/source/gwork/include/Gwork/Controls/TextBox.h +++ b/source/gwork/include/Gwork/Controls/TextBox.h @@ -75,7 +75,7 @@ namespace Gwk OnSelectAll(this); } - virtual void MakeCaratVisible(); + virtual void MakeCaretVisible(); virtual void OnEnter(); @@ -133,7 +133,7 @@ namespace Gwk virtual bool OnKeyReturn(bool bDown) override; virtual void Render(Skin::Base* skin) override; - virtual void MakeCaratVisible() override; + virtual void MakeCaretVisible() override; virtual bool OnKeyHome(bool bDown) override; virtual bool OnKeyEnd(bool bDown) override; diff --git a/source/gwork/source/Controls/TextBox.cpp b/source/gwork/source/Controls/TextBox.cpp index 7f961569..be1a34b0 100644 --- a/source/gwork/source/Controls/TextBox.cpp +++ b/source/gwork/source/Controls/TextBox.cpp @@ -135,7 +135,7 @@ void TextBox::RefreshCursorBounds() { m_fNextCaretColorChange = Gwk::Platform::GetTimeInSeconds()+1.5f; m_caretColor = Gwk::Color(30, 30, 30, 255); - MakeCaratVisible(); + MakeCaretVisible(); Gwk::Rect pA = GetCharacterPosition(m_cursorPos); Gwk::Rect pB = GetCharacterPosition(m_cursorEnd); m_rectSelectionBounds.x = std::min(pA.x, pB.x); @@ -393,7 +393,7 @@ void TextBox::OnMouseMoved(int x, int y, int /*deltaX*/, int /*deltaY*/) SetCursorPos(iChar); } -void TextBox::MakeCaratVisible() +void TextBox::MakeCaretVisible() { if (m_text->Width() < Width()) { @@ -401,21 +401,21 @@ void TextBox::MakeCaratVisible() } else { - int iCaratPos = m_text->GetCharacterPosition(m_cursorPos).x; - int iRealCaratPos = iCaratPos+m_text->X(); + int iCaretPos = m_text->GetCharacterPosition(m_cursorPos).x; + int iRealCaretPos = iCaretPos+m_text->X(); int iSlidingZone = m_text->GetFont()->size+1; // Width()*0.1f // If the carat is already in a semi-good position, leave it. - if (iRealCaratPos >= iSlidingZone && iRealCaratPos <= Width()-iSlidingZone) + if (iRealCaretPos >= iSlidingZone && iRealCaretPos <= Width()-iSlidingZone) return; int x = 0; - if (iRealCaratPos > Width()-iSlidingZone) - x = Width()-iCaratPos-iSlidingZone; + if (iRealCaretPos > Width()-iSlidingZone) + x = Width()-iCaretPos-iSlidingZone; - if (iRealCaratPos < iSlidingZone) - x = -iCaratPos+iSlidingZone; + if (iRealCaretPos < iSlidingZone) + x = -iCaretPos+iSlidingZone; // Don't show too much whitespace to the right if (x+m_text->Width() < Width()-GetPadding().right) @@ -567,7 +567,7 @@ void TextBoxMultiline::Render(Skin::Base* skin) skin->GetRender()->DrawFilledRect(m_rectCaretBounds); } -void TextBoxMultiline::MakeCaratVisible() +void TextBoxMultiline::MakeCaretVisible() { if (m_text->Height() < Height()) { @@ -582,29 +582,29 @@ void TextBoxMultiline::MakeCaratVisible() //if ( pos & Position::CenterV ) y = bounds.y + ( bounds.h - Height() ) * 0.5; Rect pos = m_text->GetCharacterPosition(m_cursorPos); - int iCaratPos = pos.y; // + pos.h; - int iRealCaratPos = iCaratPos+m_text->Y(); + int iCaretPos = pos.y; // + pos.h; + int iRealCaretPos = iCaretPos+m_text->Y(); //int iSlidingZone = m_text->GetFont()->size; //Width()*0.1f // If the carat is already in a semi-good position, leave it. // int mi = GetPadding().top; // int ma = Height()-pos.h-GetPadding().bottom; - if (iRealCaratPos >= GetPadding().top && iRealCaratPos <= Height()-pos.h- + if (iRealCaretPos >= GetPadding().top && iRealCaretPos <= Height()-pos.h- GetPadding().bottom) return; int y = 0; // bottom of carat too low - if (iRealCaratPos > Height()-pos.h-GetPadding().bottom) + if (iRealCaretPos > Height()-pos.h-GetPadding().bottom) { //align bottom - y = Height()-iCaratPos-pos.h-GetPadding().bottom; + y = Height()-iCaretPos-pos.h-GetPadding().bottom; } // top of carat too low - if (iRealCaratPos < GetPadding().top) - y = -iCaratPos+GetPadding().top; + if (iRealCaretPos < GetPadding().top) + y = -iCaretPos+GetPadding().top; // Don't show too much whitespace to the bottom if (y+m_text->Height() < Height()-GetPadding().bottom)