63 lines
2.8 KiB
C
63 lines
2.8 KiB
C
// listHelp.h -- Public API for the shared list/dropdown helper library
|
|
//
|
|
// Declares dropdown arrow drawing, item length scanning, keyboard
|
|
// navigation, and popup list painting shared across widget DXEs
|
|
// (ListBox, Dropdown, ComboBox, ListView, TreeView).
|
|
|
|
#ifndef LIST_HELP_H
|
|
#define LIST_HELP_H
|
|
|
|
#include "../core/dvxWgtP.h"
|
|
|
|
#define DROPDOWN_BTN_WIDTH 16
|
|
#define DROPDOWN_MAX_VISIBLE 8
|
|
#define POPUP_SCROLLBAR_W SCROLLBAR_WIDTH
|
|
|
|
// ============================================================
|
|
// Dropdown arrow glyph
|
|
// ============================================================
|
|
|
|
void widgetDrawDropdownArrow(DisplayT *d, const BlitOpsT *ops, int32_t centerX, int32_t centerY, uint32_t color);
|
|
|
|
// ============================================================
|
|
// Item measurement
|
|
// ============================================================
|
|
|
|
int32_t widgetMaxItemLen(const char **items, int32_t count);
|
|
|
|
// ============================================================
|
|
// Keyboard navigation (Up/Down/Home/End/PgUp/PgDn)
|
|
// ============================================================
|
|
|
|
int32_t widgetNavigateIndex(int32_t key, int32_t current, int32_t count, int32_t pageSize);
|
|
|
|
// ============================================================
|
|
// Popup rect calculation
|
|
// ============================================================
|
|
|
|
void widgetDropdownPopupRect(WidgetT *w, const BitmapFontT *font, int32_t contentH, int32_t itemCount, int32_t *popX, int32_t *popY, int32_t *popW, int32_t *popH);
|
|
|
|
// ============================================================
|
|
// Popup list painting
|
|
// ============================================================
|
|
|
|
void widgetPaintPopupList(DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, const ColorSchemeT *colors, int32_t popX, int32_t popY, int32_t popW, int32_t popH, const char **items, int32_t itemCount, int32_t hoverIdx, int32_t scrollPos);
|
|
|
|
// ============================================================
|
|
// Type-ahead search
|
|
// ============================================================
|
|
|
|
// Search items[] for the next entry starting with ch (case-insensitive),
|
|
// starting after currentIdx and wrapping around. Returns the matching
|
|
// index, or -1 if no match found.
|
|
int32_t widgetTypeAheadSearch(char ch, const char **items, int32_t itemCount, int32_t currentIdx);
|
|
|
|
// ============================================================
|
|
// Popup scrollbar hit testing
|
|
// ============================================================
|
|
|
|
// Returns true if the click at (x, y) is on the popup scrollbar.
|
|
// Updates *scrollPos in place (clamped to valid range).
|
|
bool widgetPopupScrollbarClick(int32_t x, int32_t y, int32_t popX, int32_t popY, int32_t popW, int32_t popH, int32_t itemCount, int32_t visibleItems, int32_t *scrollPos);
|
|
|
|
#endif // LIST_HELP_H
|