1/*
2 * Copyright 2013-2014, Rene Gollent, rene@gollent.com.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef CONSOLE_OUTPUT_VIEW_H_
6#define CONSOLE_OUTPUT_VIEW_H_
7
8
9#include <GroupView.h>
10#include <ObjectList.h>
11
12
13class BButton;
14class BCheckBox;
15class BTextView;
16
17
18class ConsoleOutputView : public BGroupView {
19public:
20								ConsoleOutputView();
21								~ConsoleOutputView();
22
23	static	ConsoleOutputView*	Create();
24									// throws
25
26			void				ConsoleOutputReceived(
27									int32 fd, const BString& output);
28
29	virtual	void				MessageReceived(BMessage* message);
30	virtual	void				AttachedToWindow();
31
32			void				LoadSettings(const BMessage& settings);
33			status_t			SaveSettings(BMessage& settings);
34
35private:
36			struct OutputInfo;
37			typedef BObjectList<OutputInfo> OutputInfoList;
38
39private:
40			void				_Init();
41	static	int32				_OutputWorker(void* arg);
42			void				_HandleConsoleOutput(OutputInfo* info);
43
44private:
45			BCheckBox*			fStdoutEnabled;
46			BCheckBox*			fStderrEnabled;
47			BTextView*			fConsoleOutput;
48			BButton*			fClearButton;
49			OutputInfoList*		fPendingOutput;
50			sem_id				fWorkToDoSem;
51			thread_id			fOutputWorker;
52};
53
54
55
56#endif	// CONSOLE_OUTPUT_VIEW_H
57