2 * Copyright 2002-2006, project beam (http://sourceforge.net/projects/beam).
3 * All rights reserved. Distributed under the terms of the MIT License.
6 * Oliver Tappe <beam@hirschkaefer.de>
8 #ifndef _AUTO_COMPLETER_DEFAULT_IMPL_H
9 #define _AUTO_COMPLETER_DEFAULT_IMPL_H
14 #include "AutoCompleter.h"
16 class BDefaultPatternSelector
: public BAutoCompleter::PatternSelector
{
18 virtual void SelectPatternBounds(const BString
& text
,
19 int32 caretPos
, int32
* start
,
24 class BDefaultCompletionStyle
: public BAutoCompleter::CompletionStyle
{
26 BDefaultCompletionStyle(
27 BAutoCompleter::EditView
* editView
,
28 BAutoCompleter::ChoiceModel
* choiceModel
,
29 BAutoCompleter::ChoiceView
* choiceView
,
30 BAutoCompleter::PatternSelector
*
32 virtual ~BDefaultCompletionStyle();
34 virtual bool Select(int32 index
);
35 virtual bool SelectNext(bool wrap
= false);
36 virtual bool SelectPrevious(bool wrap
= false);
37 virtual bool IsChoiceSelected() const;
38 virtual int32
SelectedChoiceIndex() const;
40 virtual void ApplyChoice(bool hideChoices
= true);
41 virtual void CancelChoice();
43 virtual void EditViewStateChanged(bool updateChoices
);
46 BString fFullEnteredText
;
48 int32 fPatternStartPos
;
50 bool fIgnoreEditViewStateChanges
;
54 class BDefaultChoiceView
: public BAutoCompleter::ChoiceView
{
56 class ListView
: public BListView
{
59 BAutoCompleter::CompletionStyle
* completer
);
60 virtual void SelectionChanged();
61 virtual void MessageReceived(BMessage
* msg
);
62 virtual void MouseDown(BPoint point
);
63 virtual void AttachedToWindow();
66 BAutoCompleter::CompletionStyle
* fCompleter
;
69 class ListItem
: public BListItem
{
71 ListItem(const BAutoCompleter::Choice
* choice
);
72 virtual void DrawItem(BView
* owner
, BRect frame
,
73 bool complete
= false);
82 virtual ~BDefaultChoiceView();
84 virtual void SelectChoiceAt(int32 index
);
85 virtual void ShowChoices(
86 BAutoCompleter::CompletionStyle
* completer
);
87 virtual void HideChoices();
88 virtual bool ChoicesAreShown();
89 virtual int32
CountVisibleChoices() const;
91 void SetMaxVisibleChoices(int32 choices
);
92 int32
MaxVisibleChoices() const;
97 int32 fMaxVisibleChoices
;
100 #endif // _AUTO_COMPLETER_DEFAULT_IMPL_H