1/*
2 * Copyright 2015, Rene Gollent, rene@gollent.com.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef VARIABLE_EDIT_WINDOW_H
6#define VARIABLE_EDIT_WINDOW_H
7
8
9#include <Window.h>
10
11#include "TableCellValueEditor.h"
12
13
14class BButton;
15class Value;
16class ValueNode;
17
18
19class VariableEditWindow : public BWindow,
20	private TableCellValueEditor::Listener {
21public:
22								VariableEditWindow(Value* initialValue,
23									ValueNode* node,
24									TableCellValueEditor* editor,
25									BHandler* target);
26
27								~VariableEditWindow();
28
29	static	VariableEditWindow* Create(Value* initialValue,
30									ValueNode* node,
31									TableCellValueEditor* editor,
32									BHandler* closeTarget);
33									// throws
34
35
36	virtual	void				MessageReceived(BMessage* message);
37
38	virtual	void				Show();
39	virtual	bool				QuitRequested();
40
41	// TableCellValueEditor::Listener
42	virtual	void				TableCellEditBeginning();
43	virtual	void				TableCellEditCancelled();
44	virtual	void				TableCellEditEnded(Value* newValue);
45
46private:
47			void	 			_Init();
48
49private:
50			BButton*			fCancelButton;
51			BButton*			fSaveButton;
52			BHandler*			fTarget;
53			ValueNode*			fNode;
54			Value*				fInitialValue;
55			Value*				fNewValue;
56			TableCellValueEditor* fEditor;
57};
58
59#endif // VARIABLE_EDIT_WINDOW_H
60