SavvyUI C++ UI Library
Loading...
Searching...
No Matches
AutoComplete Class Reference

A combo box UI component width auto-complete functionality. More...

#include <AutoComplete.h>

Inheritance diagram for AutoComplete:
Component SelectionChangeListener

Public Member Functions

 AutoComplete ()
 Constructs a new AutoComplete instance.
virtual ~AutoComplete ()
 Destroys the AutoComplete instance.
int getPreferredHeight ()
 Returns the preferred height.
void setListener (AutoCompleteListener *l)
void setText (const wstring &text)
 Sets the text content of the field.
wstring getText ()
 Gets the current text content.
void setOptions (const vector< wstring > &selections)
 Sets the available options that can be selected via the listbox.
void onPaint (Graphics *g)
 Renders the AutoComplete.
void onWindowResized ()
 Called when the window containing the control is resized.
void onWindowMoved ()
 Called when the window containing the control is moved.
void onSelectionChanged (const SelectionChangeEvent &ev)
 Responds to selection changes triggered by internal components like CheckList.
void onMousePressed (WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed)
 Called when the mouse is pressed within the component.
void onDataChanged (WinHandle hTarget, const wstring &newValue, const ProcParams &procParams)
 Handles data changed events.
void addDataChangedListener (DataChangeListener *l)
 Adds a listener for data changed events.
Public Member Functions inherited from Component
 Component ()
 Constructs a new Component instance.
virtual ~Component ()
 Virtual destructor.
long getId ()
 Gets the unique ID assigned to this component.
void setParent (Component *parent)
ComponentgetParent ()
ComponentgetTopLevelParent ()
void bringWindowToTop ()
wstring getComponentType ()
 Gets the component type string.
BOOL isWindowCreated ()
 Returns whether the native window has been created.
WinHandle getWindowHandle ()
 Returns the native WinHandle for this component.
int createComponent (Component *parent, Bounds rect, long nCmd=-1, BOOL isVisible=TRUE)
 Creates the component's native window as a child of hParent.
void setFocus ()
void setFont (long fontSize, BOOL isBold=FALSE, BOOL isItalic=FALSE, BOOL isUnderlined=FALSE, const wstring &fontName=L"Arial")
 Sets the font for the component.
BOOL getCustomFont (long &fontSize, BOOL &isBold, BOOL &isItalic, BOOL &isUnderlined, wstring &fontName)
void showBorder (BOOL bShow=TRUE)
void setEnabled (BOOL bEnable=TRUE)
 Enables or disables the component.
void setVisible (BOOL bShow=TRUE)
 Shows or hides the component.
void GetClientRect (Bounds &rect)
void GetWindowRect (Bounds &rect)
void moveWindow (long x, long y, long width, long height, BOOL bRedraw=TRUE)
 Moves and resizes the component window.
void reconfigureScrollBar ()
 Forces the component to recalculate the scrollbar info.
void setMouseWheelDelta (int delta)
 Sets the accumulated mouse wheel delta.
int getMouseWheelDelta ()
 Gets the current mouse wheel delta.
virtual int getMinimumHeight ()
 Returns the minimum height the component can have.
void repaint (Component *comp=NULL, BOOL repaintImmediately=FALSE)
 Requests the component to repaint itself.
void clearQueuedPaintRequest ()
 clears the queued paint request. This function should only be called internally from the library.
virtual BOOL getChildren (vector< Component * > &children)
virtual void onAction (WinHandle hTarget, long actionId, const ProcParams &procParams)
 Called when an action occurs on the component.
virtual void onSelectionChanged (WinHandle hTarget, int itemIndex, const wstring &itemText, BOOL itemChecked, const ProcParams &procParams)
 Called when the selection changes.
virtual void onMouseReleased (WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed)
 Called when the mouse button is released within the component.
virtual void onMouseRightClicked (WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed)
 Called when the right mouse button is clicked within the component.
virtual void onMouseMoved (WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed)
 Called when the mouse is moved within the component.
virtual BOOL onMouseWheel (WinHandle hWnd, int x, int y, int delta)
 Called when the mouse wheel is used over the component.
virtual void onArrowLeft (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onArrowRight (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onArrowUp (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onArrowDown (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onPageUp (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onPageDown (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyHome (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyEnd (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyInsert (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyDelete (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyBackSpace (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyTyped (wchar_t ch, BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyTab (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyEnter (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyF1 (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyF2 (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyF3 (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyF4 (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyF5 (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyF6 (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyF7 (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyF8 (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyF9 (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyF10 (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyF11 (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onKeyF12 (BOOL shiftPressed, BOOL ctrlPressed)
virtual void onFocusGained ()
 Called when the component gains keyboard focus.
virtual void onFocusLost ()
 Called when the component loses keyboard focus.
virtual void onTimer (unsigned int timerId)
 Called on timer events.
virtual BOOL getScrollingInfo (__int64 &scrollMin, __int64 &scrollMax, __int64 &pageSize)
 Provides scrolling information if supported.
virtual void setScrollbarTopOffset (__int64 firstVisibleRow)
 Sets the scrollbar's top offset.
void updateScrollbarTopOffset (__int64 firstVisibleRow)
 Updates the scrollbar's top offset based on the current first visible row.

Protected Member Functions

BOOL getCreateWindowOptions (wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
 Retrieves window creation options for the control.
void windowCreated ()
 Called after the control window has been successfully created.
Protected Member Functions inherited from Component
long getActionId ()
 Returns the component's action command ID.
void doNotSubclass ()
 Marks this component's native window to avoid subclassing.
void startTimer (unsigned int timerId, unsigned int milliseconds)
 Starts a timer with the given ID and interval.
void stopTimer (unsigned int timerId)
 Stops the timer identified by timerId.
void protectedAddDataChangedListener (DataChangeListener *l)
 Adds a data change listener.
void protectedAddSelectionChangedListener (SelectionChangeListener *l)
 Adds a selection change listener.
void protectedAddActionListener (ActionListener *l)
 Adds an action listener.
void protectedAddItemDoubleClickedListener (RowDoubleClickListener *l)
 Adds a row double-click listener.
void protectedFireDataChangedEvent (const wstring &oldValue, const wstring &newValue)
 Fires a data changed event to registered listeners.
void protectedFireSelectionChangedEvent (long selectionIndex=-1, const wstring &selectionValue=L"", BOOL checked=FALSE)
 Fires a selection changed event to registered listeners.
void protectedFireActionEvent (long actionId=-1, const wstring &actionName=L"")
 Fires an action event to registered listeners.
void protectedFireItemDoubleClickedEvent (__int64 rowIndex)
 Fires a row double-click event to registered listeners.

Additional Inherited Members

Protected Attributes inherited from Component
WinHandle _hWnd
 Handle to the native window associated with this component.
wstring _componentType
 String representing the component type (e.g., "Button", "ComboBox").
BOOL _showBorder

Detailed Description

A combo box UI component width auto-complete functionality.

Combines a dropdown-style control with a listbox interface. Inherits from Component and implements SelectionChangeListener to react to internal selection events.

Constructor & Destructor Documentation

◆ AutoComplete()

AutoComplete::AutoComplete ( )

Constructs a new AutoComplete instance.

◆ ~AutoComplete()

virtual AutoComplete::~AutoComplete ( )
virtual

Destroys the AutoComplete instance.

Member Function Documentation

◆ addDataChangedListener()

void AutoComplete::addDataChangedListener ( DataChangeListener * l)

Adds a listener for data changed events.

Parameters
lPointer to the listener.

◆ getCreateWindowOptions()

BOOL AutoComplete::getCreateWindowOptions ( wstring & title,
UINT & widownStyles,
wstring & wndClassName,
BOOL & isCustomWndProc )
protectedvirtual

Retrieves window creation options for the control.

Parameters
titleOutput: window title.
widownStylesOutput: window style flags.
wndClassNameOutput: class name of the window.
isCustomWndProcOutput: whether a custom window procedure is used.
Returns
TRUE if successful, FALSE otherwise.

Implements Component.

◆ getPreferredHeight()

int AutoComplete::getPreferredHeight ( )
virtual

Returns the preferred height.

Reimplemented from Component.

◆ getText()

wstring AutoComplete::getText ( )

Gets the current text content.

Returns
The current text in the field.

◆ onDataChanged()

void AutoComplete::onDataChanged ( WinHandle hTarget,
const wstring & newValue,
const ProcParams & procParams )
virtual

Handles data changed events.

Parameters
hTargetHandle to the target window.
newValueThe new text value.
procParamsAdditional parameters.

Reimplemented from Component.

◆ onMousePressed()

void AutoComplete::onMousePressed ( WinHandle hWnd,
int x,
int y,
int clickCount,
BOOL shiftPressed,
BOOL ctrlPressed )
virtual

Called when the mouse is pressed within the component.

Reimplemented from Component.

◆ onPaint()

void AutoComplete::onPaint ( Graphics * g)
virtual

Renders the AutoComplete.

Parameters
hDCHandle to the device context.

Reimplemented from Component.

◆ onSelectionChanged()

void AutoComplete::onSelectionChanged ( const SelectionChangeEvent & ev)
virtual

Responds to selection changes triggered by internal components like CheckList.

Parameters
evThe selection change event containing details of the change.

Implements SelectionChangeListener.

◆ onWindowMoved()

void AutoComplete::onWindowMoved ( )
virtual

Called when the window containing the control is moved.

Reimplemented from Component.

◆ onWindowResized()

void AutoComplete::onWindowResized ( )
virtual

Called when the window containing the control is resized.

Reimplemented from Component.

◆ setListener()

void AutoComplete::setListener ( AutoCompleteListener * l)

◆ setOptions()

void AutoComplete::setOptions ( const vector< wstring > & selections)

Sets the available options that can be selected via the listbox.

Parameters
selectionsA list of key-value pairs representing selectable options.

◆ setText()

void AutoComplete::setText ( const wstring & text)

Sets the text content of the field.

Parameters
textThe text to set.

◆ windowCreated()

void AutoComplete::windowCreated ( )
protectedvirtual

Called after the control window has been successfully created.

Implements Component.


The documentation for this class was generated from the following file: