|
|
|
@ -162,8 +162,6 @@ namespace olc::QuickGUI |
|
|
|
|
// Copy all theme attributes into a different manager object
|
|
|
|
|
void CopyThemeFrom(const Manager& manager); |
|
|
|
|
|
|
|
|
|
bool anotherBoxHighlighted=false; |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
// Should this manager call delete on the controls it opeerates?
|
|
|
|
|
bool m_bEraseControlsOnDestroy = true; |
|
|
|
@ -214,10 +212,12 @@ namespace olc::QuickGUI |
|
|
|
|
void Update(olc::PixelGameEngine* pge) override; |
|
|
|
|
void Draw(olc::PixelGameEngine* pge) override; |
|
|
|
|
void DrawDecal(olc::PixelGameEngine* pge) override; |
|
|
|
|
static bool bBoxClicked; // Whether or not a Textbox instance was clicked this frame.
|
|
|
|
|
TextBox*tabNext=nullptr; |
|
|
|
|
TextBox*tabPrev=nullptr; |
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
|
bool m_bTextEdit = false; |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// Creates a Button Control - a clickable, labelled rectangle
|
|
|
|
@ -436,7 +436,7 @@ namespace olc::QuickGUI |
|
|
|
|
|
|
|
|
|
void Manager::Update(olc::PixelGameEngine* pge) |
|
|
|
|
{ |
|
|
|
|
anotherBoxHighlighted=false; |
|
|
|
|
TextBox::bBoxClicked=false; |
|
|
|
|
for (auto& p : m_vControls) p->Update(pge); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -539,6 +539,8 @@ namespace olc::QuickGUI |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma region TextBox |
|
|
|
|
bool TextBox::bBoxClicked=false; |
|
|
|
|
|
|
|
|
|
TextBox::TextBox(olc::QuickGUI::Manager& manager, const std::string& text, const olc::vf2d& pos, const olc::vf2d& size) |
|
|
|
|
: Label(manager, text, pos, size) |
|
|
|
|
{ |
|
|
|
@ -573,7 +575,7 @@ namespace olc::QuickGUI |
|
|
|
|
|
|
|
|
|
if (bPressed && !pge->IsTextEntryEnabled() && !m_bTextEdit) |
|
|
|
|
{
|
|
|
|
|
m_manager.anotherBoxHighlighted=true; |
|
|
|
|
TextBox::bBoxClicked=true; |
|
|
|
|
pge->TextEntryEnable(true, sText); |
|
|
|
|
m_bTextEdit = true; |
|
|
|
|
} |
|
|
|
@ -591,7 +593,7 @@ namespace olc::QuickGUI |
|
|
|
|
|
|
|
|
|
if (bPressed && m_bTextEdit) |
|
|
|
|
{ |
|
|
|
|
if(!m_manager.anotherBoxHighlighted){ |
|
|
|
|
if(!TextBox::bBoxClicked){ |
|
|
|
|
sText = pge->TextEntryGetString(); |
|
|
|
|
pge->TextEntryEnable(false); |
|
|
|
|
} |
|
|
|
@ -601,9 +603,6 @@ namespace olc::QuickGUI |
|
|
|
|
|
|
|
|
|
if (m_bTextEdit && pge->IsTextEntryEnabled()) |
|
|
|
|
sText = pge->TextEntryGetString(); |
|
|
|
|
if(pge->GetKey(olc::Key::TAB).bPressed){ |
|
|
|
|
m_manager.goNext=this; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void TextBox::Draw(olc::PixelGameEngine* pge) |
|
|
|
|