SendTextView.h 900 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright 2021, Jaidyn Levesque <jadedctrl@teknik.io>
  3. * All rights reserved. Distributed under the terms of the MIT license.
  4. */
  5. #ifndef _SEND_TEXT_VIEW_H
  6. #define _SEND_TEXT_VIEW_H
  7. #include <StringList.h>
  8. #include <TextView.h>
  9. #include "ConversationView.h"
  10. class SendTextView : public BTextView {
  11. public:
  12. SendTextView(const char* name, ConversationView* convView);
  13. virtual void KeyDown(const char* bytes, int32 numBytes);
  14. private:
  15. void _AutoComplete();
  16. BString _NextMatch(BStringList list, BString current);
  17. BStringList _CommandNames();
  18. BStringList _UserNames();
  19. void _AppendHistory();
  20. void _UpHistory();
  21. void _DownHistory();
  22. ConversationView* fChatView;
  23. // Used for auto-completion
  24. int32 fCurrentIndex;
  25. BString fCurrentWord;
  26. BStringList fCurrentList;
  27. // Used for history
  28. BStringList fHistory;
  29. int32 fHistoryIndex;
  30. };
  31. #endif // _SEND_TEXT_VIEW_H