Implement wxTextCtrl::{Set,Is}Editable() under wxQt

This commit is contained in:
ali kettab 2023-10-22 19:57:48 +01:00
parent 334814bf85
commit d91fd33ffd
2 changed files with 21 additions and 0 deletions

View file

@ -76,6 +76,9 @@ public:
virtual void EmptyUndoBuffer() override;
virtual bool IsEditable() const override;
virtual void SetEditable(bool editable) override;
virtual wxString DoGetValue() const override;
virtual void DoSetValue(const wxString &text, int flags = 0) override;
virtual void WriteText(const wxString& text) override;

View file

@ -816,6 +816,24 @@ void wxTextCtrl::EmptyUndoBuffer()
m_qtEdit->EmptyUndoBuffer();
}
bool wxTextCtrl::IsEditable() const
{
return HasFlag(wxTE_READONLY);
}
void wxTextCtrl::SetEditable(bool editable)
{
long flags = GetWindowStyle();
if ( editable )
flags &= ~wxTE_READONLY;
else
flags |= wxTE_READONLY;
SetWindowStyle(flags);
m_qtEdit->SetStyleFlags(flags);
}
void wxTextCtrl::SetInsertionPoint(long pos)
{
m_qtEdit->SetInsertionPoint(pos);