1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-06 04:00:08 +00:00

Introjucer: mouse-click cancellation of file rename box.

This commit is contained in:
jules 2013-08-29 11:19:39 +01:00
parent 59b094a603
commit 18563c6ef4
2 changed files with 26 additions and 21 deletions

View file

@ -147,8 +147,8 @@ class RenameTreeItemCallback : public ModalComponentManager::Callback,
public TextEditorListener
{
public:
RenameTreeItemCallback (JucerTreeViewBase& item_, Component& parent, const Rectangle<int>& bounds)
: item (item_)
RenameTreeItemCallback (JucerTreeViewBase& ti, Component& parent, const Rectangle<int>& bounds)
: item (ti)
{
ed.setMultiLine (false, false);
ed.setPopupMenuEnabled (false);
@ -162,19 +162,24 @@ public:
ed.enterModalState (true, this);
}
void modalStateFinished (int resultCode)
void modalStateFinished (int resultCode) override
{
if (resultCode != 0)
item.setName (ed.getText());
}
void textEditorTextChanged (TextEditor&) {}
void textEditorReturnKeyPressed (TextEditor& editor) { editor.exitModalState (1); }
void textEditorEscapeKeyPressed (TextEditor& editor) { editor.exitModalState (0); }
void textEditorFocusLost (TextEditor& editor) { editor.exitModalState (0); }
void textEditorTextChanged (TextEditor&) override {}
void textEditorReturnKeyPressed (TextEditor& editor) override { editor.exitModalState (1); }
void textEditorEscapeKeyPressed (TextEditor& editor) override { editor.exitModalState (0); }
void textEditorFocusLost (TextEditor& editor) override { editor.exitModalState (0); }
private:
TextEditor ed;
struct RenameEditor : public TextEditor
{
void inputAttemptWhenModal() override { exitModalState (0); }
};
RenameEditor ed;
JucerTreeViewBase& item;
JUCE_DECLARE_NON_COPYABLE (RenameTreeItemCallback)
@ -237,7 +242,7 @@ class JucerTreeViewBase::ItemSelectionTimer : public Timer
public:
ItemSelectionTimer (JucerTreeViewBase& owner_) : owner (owner_) {}
void timerCallback() { owner.invokeShowDocument(); }
void timerCallback() override { owner.invokeShowDocument(); }
private:
JucerTreeViewBase& owner;