Fixed CInterface::SetFocus not recursing into windows, this fixes highlighting of compilation errors in the editor
It's not really nice, but at least it worksmaster
parent
2792fa2c6c
commit
48f24fe6cc
|
@ -281,9 +281,10 @@ bool CControl::GetTooltip(Math::Point pos, std::string &name)
|
|||
|
||||
// Management of the focus.
|
||||
|
||||
void CControl::SetFocus(bool bFocus)
|
||||
void CControl::SetFocus(CControl* focusControl)
|
||||
{
|
||||
m_bFocus = bFocus;
|
||||
// TODO: I don't like this, but it's needed for Ui::CWindow* to work properly
|
||||
m_bFocus = focusControl == this;
|
||||
}
|
||||
|
||||
bool CControl::GetFocus()
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
virtual Gfx::FontType GetFontType();
|
||||
virtual bool SetTooltip(std::string name);
|
||||
virtual bool GetTooltip(Math::Point pos, std::string &name);
|
||||
virtual void SetFocus(bool bFocus);
|
||||
virtual void SetFocus(CControl* focusControl);
|
||||
virtual bool GetFocus();
|
||||
|
||||
virtual EventType GetEventType();
|
||||
|
|
|
@ -335,8 +335,7 @@ void CInterface::SetFocus(CControl* focusControl)
|
|||
{
|
||||
if (control != nullptr)
|
||||
{
|
||||
bool focus = control.get() == focusControl;
|
||||
control->SetFocus(focus);
|
||||
control->SetFocus(focusControl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1283,4 +1283,15 @@ void CWindow::DrawHach(Math::Point pos, Math::Point dim)
|
|||
while ( !bStop );
|
||||
}
|
||||
|
||||
void CWindow::SetFocus(CControl* focusControl)
|
||||
{
|
||||
for (auto& control : m_controls)
|
||||
{
|
||||
if (control != nullptr)
|
||||
{
|
||||
control->SetFocus(focusControl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -114,6 +114,8 @@ public:
|
|||
|
||||
void Draw() override;
|
||||
|
||||
void SetFocus(CControl* focusControl) override;
|
||||
|
||||
protected:
|
||||
int BorderDetect(Math::Point pos);
|
||||
void AdjustButtons();
|
||||
|
|
Loading…
Reference in New Issue