xref: /haiku/src/apps/terminal/InlineInput.h (revision b3de82492af3b6412ffaf7eb87fd6e1995755685)
1 /*
2  * Copyright 2003-2009, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Stefano Ceccherini (stefano.ceccherini@gmail.com)
7  */
8 
9 #ifndef __INLINEINPUT_H
10 #define __INLINEINPUT_H
11 
12 #include <Messenger.h>
13 #include <String.h>
14 
15 struct clause;
16 
17 class InlineInput {
18 public:
19 	InlineInput(BMessenger);
20 	~InlineInput();
21 
22 	const BMessenger *Method() const;
23 
24 	const char *String() const;
25 	void SetString(const char *string);
26 
27 	bool IsActive() const;
28 	void SetActive(bool active);
29 
30 	int32 SelectionLength() const;
31 	void SetSelectionLength(int32);
32 
33 	int32 SelectionOffset() const;
34 	void SetSelectionOffset(int32 offset);
35 
36 	bool AddClause(int32, int32);
37 	bool GetClause(int32 index, int32 *start, int32 *end) const;
38 	int32 CountClauses() const;
39 
40 	void ResetClauses();
41 
42 private:
43 	const BMessenger fMessenger;
44 	BString fString;
45 
46 	bool fActive;
47 
48 	int32 fSelectionOffset;
49 	int32 fSelectionLength;
50 
51 	int32 fNumClauses;
52 	clause *fClauses;
53 };
54 
55 #endif //__INLINEINPUT_H
56