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

A flexible panel layout component that arranges child components fluidly. More...

#include <FluidPanel.h>

Inheritance diagram for FluidPanel:
PanelBase Component

Public Member Functions

 FluidPanel ()
 Constructor.
virtual ~FluidPanel ()
 Destructor.
void clear ()
 Clears all child components from the panel.
void setFieldHeight (int fieldHeight)
 Sets the height of the field row, excluding the label.
void setMargin (int margin)
 Sets the left, top, right, and bottom margins.
void setMinColumnWidth (long minWidth)
 Sets the minimum width for columns.
void addComponent (Component *component, const wstring &labelText)
 Adds a component with an associated label text to the panel.
void onWindowResized ()
 Handles window resize events.
void onPaint (Graphics *g)
 Handles paint events.
BOOL onMouseWheel (WinHandle hWnd, int x, int y, int delta)
 Handles mouse wheel events for scrolling.
BOOL getScrollingInfo (__int64 &scrollMin, __int64 &scrollMax, __int64 &pageSize)
 Retrieves scrolling information.
void setScrollbarTopOffset (__int64 firstVisibleRow)
 Sets the scroll position by specifying the first visible row.
Public Member Functions inherited from PanelBase
 PanelBase ()
 Constructs a PanelBase instance.
virtual ~PanelBase ()
 Virtual destructor to clean up resources.
void onWindowMoved ()
 Called when the panel window has moved.
void onAction (WinHandle hTarget, long actionId, const ProcParams &procParams)
 Handles action events from child components.
void onSelectionChanged (WinHandle hTarget, int itemIndex, const wstring &itemText, BOOL itemChecked, const ProcParams &procParams)
 Handles selection changed events from child components.
void onDataChanged (WinHandle hTarget, const wstring &newValue, const ProcParams &procParams)
 Handles data changed events from child components.
BOOL onHorzScroll (WinHandle hTarget, const ProcParams &procParams)
 Handles horizontal scroll events.
BOOL onDrawMeasureItem (LPMEASUREITEMSTRUCT dis, const ProcParams &procParams)
 Handles measure item owner-draw events.
BOOL onDrawItem (LPDRAWITEMSTRUCT dis, const ProcParams &procParams)
 Handles draw item owner-draw 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 ()
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 (WinHandle hParent, Bounds rect, long nCmd=-1, BOOL isVisible=TRUE)
 Creates the component's native window as a child of hParent.
void setFont (long fontSize, BOOL isBold=FALSE, BOOL isItalic=FALSE, BOOL isUnderlined=FALSE, const wstring &fontName=L"Arial")
 Sets the font for the component.
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.
virtual int getPreferredHeight ()
 Returns the preferred height of the component.
void repaint (WinHandle hWnd=NULL)
 Requests the component to repaint itself.
void clearQueuedPaintRequest ()
 clears the queued paint request. This function should only be called internally from the library.
virtual void onMousePressed (WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed)
 Called when the mouse is pressed within the component.
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 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.
void updateScrollbarTopOffset (__int64 firstVisibleRow)
 Updates the scrollbar's top offset based on the current first visible row.

Static Public Attributes

static int HEIGHT_TEXTFIELD
 Standard height for text fields.
static int HEIGHT_COMBOBOX
 Standard height for combo boxes.
static int HEIGHT_TEXTAREA
 Standard height for text areas.
static int HEIGHT_DATETIME
 Standard height for date/time pickers.
static int HEIGHT_LISTBOX
 Standard height for list boxes.

Protected Member Functions

wstring getClassName ()
 Returns the class name for the component.
void windowCreated ()
 Called when the native window has been created.
Protected Member Functions inherited from PanelBase
BOOL getCreateWindowOptions (wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
 Retrieves window creation options such as window title, styles, and class name.
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 PanelBase
std::vector< PanelBaseChild_children
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 flexible panel layout component that arranges child components fluidly.

The FluidPanel manages dynamic layout of child components with scrolling support. It allows setting minimum column width and manages visible rows with scrolling.

Constructor & Destructor Documentation

◆ FluidPanel()

FluidPanel::FluidPanel ( )

Constructor.

◆ ~FluidPanel()

virtual FluidPanel::~FluidPanel ( )
virtual

Destructor.

Member Function Documentation

◆ addComponent()

void FluidPanel::addComponent ( Component * component,
const wstring & labelText )

Adds a component with an associated label text to the panel.

Parameters
componentPointer to the child component.
labelTextText label associated with the component.

◆ clear()

void FluidPanel::clear ( )

Clears all child components from the panel.

◆ getClassName()

wstring FluidPanel::getClassName ( )
protectedvirtual

Returns the class name for the component.

Returns
Class name string.

Implements PanelBase.

◆ getScrollingInfo()

BOOL FluidPanel::getScrollingInfo ( __int64 & scrollMin,
__int64 & scrollMax,
__int64 & pageSize )
virtual

Retrieves scrolling information.

Parameters
scrollMinMinimum scroll position.
scrollMaxMaximum scroll position.
pageSizeSize of the scroll page (visible area).
Returns
TRUE if scrolling info is available, FALSE otherwise.

Reimplemented from Component.

◆ onMouseWheel()

BOOL FluidPanel::onMouseWheel ( WinHandle hWnd,
int x,
int y,
int delta )
virtual

Handles mouse wheel events for scrolling.

Parameters
hWndHandle to the window receiving the event.
xX coordinate of the mouse cursor.
yY coordinate of the mouse cursor.
deltaWheel delta value.
Returns
TRUE if the event was handled, FALSE otherwise.

Reimplemented from Component.

◆ onPaint()

void FluidPanel::onPaint ( Graphics * g)
virtual

Handles paint events.

Parameters
hDCDevice context handle for drawing.

Reimplemented from Component.

◆ onWindowResized()

void FluidPanel::onWindowResized ( )
virtual

Handles window resize events.

Reimplemented from Component.

◆ setFieldHeight()

void FluidPanel::setFieldHeight ( int fieldHeight)

Sets the height of the field row, excluding the label.

◆ setMargin()

void FluidPanel::setMargin ( int margin)

Sets the left, top, right, and bottom margins.

Parameters
marginmargin width/height.

◆ setMinColumnWidth()

void FluidPanel::setMinColumnWidth ( long minWidth)

Sets the minimum width for columns.

Parameters
minWidthMinimum width in pixels.

◆ setScrollbarTopOffset()

void FluidPanel::setScrollbarTopOffset ( __int64 firstVisibleRow)
virtual

Sets the scroll position by specifying the first visible row.

Parameters
firstVisibleRowIndex of the first visible row.

Reimplemented from Component.

◆ windowCreated()

void FluidPanel::windowCreated ( )
protectedvirtual

Called when the native window has been created.

Implements Component.

Member Data Documentation

◆ HEIGHT_COMBOBOX

int FluidPanel::HEIGHT_COMBOBOX
static

Standard height for combo boxes.

◆ HEIGHT_DATETIME

int FluidPanel::HEIGHT_DATETIME
static

Standard height for date/time pickers.

◆ HEIGHT_LISTBOX

int FluidPanel::HEIGHT_LISTBOX
static

Standard height for list boxes.

◆ HEIGHT_TEXTAREA

int FluidPanel::HEIGHT_TEXTAREA
static

Standard height for text areas.

◆ HEIGHT_TEXTFIELD

int FluidPanel::HEIGHT_TEXTFIELD
static

Standard height for text fields.


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