xref: /haiku/src/apps/debugger/user_interface/gui/value/TableCellValueEditor.cpp (revision 17889a8c70dbb3d59c1412f6431968753c767bab)
1 /*
2  * Copyright 2015, Rene Gollent, rene@gollent.com.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #include "TableCellValueEditor.h"
7 
8 #include "Value.h"
9 
10 
11 TableCellValueEditor::TableCellValueEditor()
12 	:
13 	BReferenceable(),
14 	fInitialValue(NULL)
15 {
16 }
17 
18 
19 TableCellValueEditor::~TableCellValueEditor()
20 {
21 	if (fInitialValue != NULL)
22 		fInitialValue->ReleaseReference();
23 }
24 
25 
26 void
27 TableCellValueEditor::AddListener(Listener* listener)
28 {
29 	fListeners.Add(listener);
30 }
31 
32 
33 void
34 TableCellValueEditor::RemoveListener(Listener* listener)
35 {
36 	fListeners.Remove(listener);
37 }
38 
39 
40 void
41 TableCellValueEditor::SetInitialValue(Value* value)
42 {
43 	if (fInitialValue != NULL)
44 		fInitialValue->ReleaseReference();
45 
46 	fInitialValue = value;
47 	if (fInitialValue != NULL)
48 		fInitialValue->AcquireReference();
49 }
50 
51 
52 void
53 TableCellValueEditor::NotifyEditBeginning()
54 {
55 	for (ListenerList::Iterator it = fListeners.GetIterator();
56 			Listener* listener = it.Next();) {
57 		listener->TableCellEditBeginning();
58 	}
59 }
60 
61 
62 void
63 TableCellValueEditor::NotifyEditCancelled()
64 {
65 	for (ListenerList::Iterator it = fListeners.GetIterator();
66 			Listener* listener = it.Next();) {
67 		listener->TableCellEditCancelled();
68 	}
69 }
70 
71 
72 void
73 TableCellValueEditor::NotifyEditCompleted(Value* newValue)
74 {
75 	for (ListenerList::Iterator it = fListeners.GetIterator();
76 			Listener* listener = it.Next();) {
77 		listener->TableCellEditEnded(newValue);
78 	}
79 }
80 
81 
82 // #pragma mark - TableCellValueEditor::Listener
83 
84 
85 TableCellValueEditor::Listener::~Listener()
86 {
87 }
88 
89 
90 void
91 TableCellValueEditor::Listener::TableCellEditBeginning()
92 {
93 }
94 
95 
96 void
97 TableCellValueEditor::Listener::TableCellEditCancelled()
98 {
99 }
100 
101 
102 void
103 TableCellValueEditor::Listener::TableCellEditEnded(Value* newValue)
104 {
105 }
106 
107 
108