SavvyUI C++ UI Library
Loading...
Searching...
No Matches
AutoComplete.h
Go to the documentation of this file.
1#pragma once
2
3#include "Component.h"
4#include "ListBox.h"
5
7{
8public:
9
10 virtual BOOL getSuggestions(const wstring& text, vector<wstring>& suggestions) = 0;
11};
12
21class AutoComplete : public Component,
23{
24 wstring _text;
25
26 AutoCompleteListener* _listener;
27
31 ListBox _listBox;
32
33 void showList();
34 void hideList();
35 void toggleList();
36
37protected:
47 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
48
53
54public:
59
63 virtual ~AutoComplete();
64
69
71
77 void setText(const wstring& text);
78
84 wstring getText();
85
91 void setOptions(const vector<wstring>& selections);
92
98 void onPaint(Graphics *g);
99
104
109
116
117 void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed);
118
126 void onDataChanged(WinHandle hTarget, const wstring& newValue, const ProcParams& procParams);
127
134};
HWND WinHandle
Definition Common.h:16
void windowCreated()
Called after the control window has been successfully created.
void setText(const wstring &text)
Sets the text content of the field.
void onDataChanged(WinHandle hTarget, const wstring &newValue, const ProcParams &procParams)
Handles data changed events.
void setOptions(const vector< wstring > &selections)
Sets the available options that can be selected via the listbox.
void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed)
Called when the mouse is pressed within the component.
void onWindowResized()
Called when the window containing the control is resized.
int getPreferredHeight()
Returns the preferred height.
void onSelectionChanged(const SelectionChangeEvent &ev)
Responds to selection changes triggered by internal components like CheckList.
void onPaint(Graphics *g)
Renders the AutoComplete.
void addDataChangedListener(DataChangeListener *l)
Adds a listener for data changed events.
BOOL getCreateWindowOptions(wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
Retrieves window creation options for the control.
void setListener(AutoCompleteListener *l)
void onWindowMoved()
Called when the window containing the control is moved.
AutoComplete()
Constructs a new AutoComplete instance.
virtual ~AutoComplete()
Destroys the AutoComplete instance.
wstring getText()
Gets the current text content.
Definition AutoComplete.h:7
virtual BOOL getSuggestions(const wstring &text, vector< wstring > &suggestions)=0
Component()
Constructs a new Component instance.
Definition EventListeners.h:15
Definition Graphics.h:171
A UI component that displays a list of selectable string options.
Definition ListBox.h:21
Definition Component.h:9
Definition EventListeners.h:22
Definition EventListeners.h:31