2 * Copyright 2015, Rene Gollent, rene@gollent.com.
3 * Distributed under the terms of the MIT License.
6 #include "TableCellValueEditor.h"
11 TableCellValueEditor::TableCellValueEditor()
19 TableCellValueEditor::~TableCellValueEditor()
21 if (fInitialValue
!= NULL
)
22 fInitialValue
->ReleaseReference();
27 TableCellValueEditor::AddListener(Listener
* listener
)
29 fListeners
.Add(listener
);
34 TableCellValueEditor::RemoveListener(Listener
* listener
)
36 fListeners
.Remove(listener
);
41 TableCellValueEditor::SetInitialValue(Value
* value
)
43 if (fInitialValue
!= NULL
)
44 fInitialValue
->ReleaseReference();
46 fInitialValue
= value
;
47 if (fInitialValue
!= NULL
)
48 fInitialValue
->AcquireReference();
53 TableCellValueEditor::NotifyEditBeginning()
55 for (ListenerList::Iterator it
= fListeners
.GetIterator();
56 Listener
* listener
= it
.Next();) {
57 listener
->TableCellEditBeginning();
63 TableCellValueEditor::NotifyEditCancelled()
65 for (ListenerList::Iterator it
= fListeners
.GetIterator();
66 Listener
* listener
= it
.Next();) {
67 listener
->TableCellEditCancelled();
73 TableCellValueEditor::NotifyEditCompleted(Value
* newValue
)
75 for (ListenerList::Iterator it
= fListeners
.GetIterator();
76 Listener
* listener
= it
.Next();) {
77 listener
->TableCellEditEnded(newValue
);
82 // #pragma mark - TableCellValueEditor::Listener
85 TableCellValueEditor::Listener::~Listener()
91 TableCellValueEditor::Listener::TableCellEditBeginning()
97 TableCellValueEditor::Listener::TableCellEditCancelled()
103 TableCellValueEditor::Listener::TableCellEditEnded(Value
* newValue
)