Added gwinListSetScroll
This commit is contained in:
parent
6cc80926f0
commit
8fce1a6fce
3 changed files with 49 additions and 5 deletions
|
@ -56,6 +56,13 @@ typedef struct GListObject {
|
||||||
gfxQueueASync list_head; // The list of items
|
gfxQueueASync list_head; // The list of items
|
||||||
} GListObject;
|
} GListObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enum to change the behaviour of the scroll area
|
||||||
|
*
|
||||||
|
* @note This might be used with @p gwinListSetScroll()
|
||||||
|
*/
|
||||||
|
typedef enum scroll_t { scrollAlways, scrollAuto } scroll_t;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -85,6 +92,18 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
GHandle gwinListCreate(GListObject *widget, GWidgetInit *pInit, bool_t multiselect);
|
GHandle gwinListCreate(GListObject *widget, GWidgetInit *pInit, bool_t multiselect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Change the behaviour of the scroll area
|
||||||
|
*
|
||||||
|
* @note Current possible values: @p scrollAlways and @p scrollAuto
|
||||||
|
*
|
||||||
|
* @param[in] gh The widget handle (must be a list handle)
|
||||||
|
* @param[in] flag The behaviour to be set
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
void gwinListSetScroll(GHandle gh, scroll_t flag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add an item to the list
|
* @brief Add an item to the list
|
||||||
*
|
*
|
||||||
|
|
15
releases.txt
15
releases.txt
|
@ -2,7 +2,15 @@
|
||||||
*** Releases ***
|
*** Releases ***
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
|
|
||||||
current release: 1.8
|
current release: 2.0
|
||||||
|
|
||||||
|
*** changes after 1.9 ***
|
||||||
|
FEATURE: GDISP Streaming
|
||||||
|
FEATURE: New driver interface for GDISP
|
||||||
|
FEATURE: Multiple display support
|
||||||
|
FEATURE: Multiple controller support
|
||||||
|
FEATURE: Add gdispFlush() for those controllers that need it
|
||||||
|
FEATURE: Add GDISP_NEED_AUTOFLUSH to automatically flush when required.
|
||||||
|
|
||||||
*** changes after 1.8 ***
|
*** changes after 1.8 ***
|
||||||
FEATURE: GWIN list boxes.
|
FEATURE: GWIN list boxes.
|
||||||
|
@ -13,9 +21,8 @@ FEATURE: SSD1306 driver by user goeck
|
||||||
FEATURE: ST7565 driver by user sam0737
|
FEATURE: ST7565 driver by user sam0737
|
||||||
FEATURE: ED060SC4 driver by user jpa-
|
FEATURE: ED060SC4 driver by user jpa-
|
||||||
FIX: SSD1289 area filling bug fix by user samofab
|
FIX: SSD1289 area filling bug fix by user samofab
|
||||||
FEATURE: GDISP Streaming
|
FEATURE: Added gwinListGetSelectedText()
|
||||||
FEATURE: New driver interface for GDISP
|
FEATURE: Added gwinListSetScroll()
|
||||||
FEATURE: Multiple display support
|
|
||||||
|
|
||||||
*** changes after 1.7 ***
|
*** changes after 1.7 ***
|
||||||
FEATURE: Rename of the project from ChibiOS/GFX to uGFX
|
FEATURE: Rename of the project from ChibiOS/GFX to uGFX
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
// Flags for the GListObject
|
// Flags for the GListObject
|
||||||
#define GLIST_FLG_MULTISELECT (GWIN_FIRST_CONTROL_FLAG << 0)
|
#define GLIST_FLG_MULTISELECT (GWIN_FIRST_CONTROL_FLAG << 0)
|
||||||
#define GLIST_FLG_HASIMAGES (GWIN_FIRST_CONTROL_FLAG << 1)
|
#define GLIST_FLG_HASIMAGES (GWIN_FIRST_CONTROL_FLAG << 1)
|
||||||
|
#define GLIST_FLG_SCROLLALWAYS (GWIN_FIRST_CONTROL_FLAG << 2)
|
||||||
|
|
||||||
// Flags on a ListItem.
|
// Flags on a ListItem.
|
||||||
#define GLIST_FLG_SELECTED 0x0001
|
#define GLIST_FLG_SELECTED 0x0001
|
||||||
|
@ -93,7 +94,7 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param) {
|
||||||
x = 1;
|
x = 1;
|
||||||
|
|
||||||
// the scroll area
|
// the scroll area
|
||||||
if (gw2obj->cnt > (gw->g.height-2) / iheight) {
|
if (gw2obj->cnt > (gw->g.height-2) / iheight || gw->g.flags & GLIST_FLG_SCROLLALWAYS) {
|
||||||
iwidth = gw->g.width - (SCROLLWIDTH+3);
|
iwidth = gw->g.width - (SCROLLWIDTH+3);
|
||||||
gdispFillArea(gw->g.x+iwidth+2, gw->g.y+1, SCROLLWIDTH, gw->g.height-2, gdispBlendColor(ps->fill, gw->pstyle->background, 128));
|
gdispFillArea(gw->g.x+iwidth+2, gw->g.y+1, SCROLLWIDTH, gw->g.height-2, gdispBlendColor(ps->fill, gw->pstyle->background, 128));
|
||||||
gdispDrawLine(gw->g.x+iwidth+1, gw->g.y+1, gw->g.x+iwidth+1, gw->g.y+gw->g.height-2, ps->edge);
|
gdispDrawLine(gw->g.x+iwidth+1, gw->g.y+1, gw->g.x+iwidth+1, gw->g.y+gw->g.height-2, ps->edge);
|
||||||
|
@ -327,12 +328,29 @@ GHandle gwinListCreate(GListObject* gobj, GWidgetInit* pInit, bool_t multiselect
|
||||||
gobj->top = 0;
|
gobj->top = 0;
|
||||||
if (multiselect)
|
if (multiselect)
|
||||||
gobj->w.g.flags |= GLIST_FLG_MULTISELECT;
|
gobj->w.g.flags |= GLIST_FLG_MULTISELECT;
|
||||||
|
gobj->w.g.flags |= GLIST_FLG_SCROLLALWAYS;
|
||||||
|
|
||||||
gwinSetVisible(&gobj->w.g, pInit->g.show);
|
gwinSetVisible(&gobj->w.g, pInit->g.show);
|
||||||
|
|
||||||
return (GHandle)gobj;
|
return (GHandle)gobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gwinListSetScroll(GHandle gh, scroll_t flag) {
|
||||||
|
// is it a valid handle?
|
||||||
|
if (gh->vmt != (gwinVMT *)&listVMT)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
switch (flag) {
|
||||||
|
case scrollAlways:
|
||||||
|
((GListObject*)gh)->w.g.flags |= GLIST_FLG_SCROLLALWAYS;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case scrollAuto:
|
||||||
|
((GListObject*)gh)->w.g.flags &=~ GLIST_FLG_SCROLLALWAYS;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int gwinListAddItem(GHandle gh, const char* item_name, bool_t useAlloc) {
|
int gwinListAddItem(GHandle gh, const char* item_name, bool_t useAlloc) {
|
||||||
ListItem *newItem;
|
ListItem *newItem;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue