aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2013-08-01 15:06:32 +1000
committerinmarket <andrewh@inmarket.com.au>2013-08-01 15:06:32 +1000
commit157ec08034c44957afbc24a16486a680708a4379 (patch)
tree7045ff788027ef36e3eaaa671f69e477783fc2fe /include
parentdb189048929220a2a9bd83157022eb096cf6f993 (diff)
parentb0b35396395c3eadc5a656df995a17b266c4b374 (diff)
downloaduGFX-157ec08034c44957afbc24a16486a680708a4379.tar.gz
uGFX-157ec08034c44957afbc24a16486a680708a4379.tar.bz2
uGFX-157ec08034c44957afbc24a16486a680708a4379.zip
Merge branch 'master' into fonts
Diffstat (limited to 'include')
-rw-r--r--include/gdisp/gdisp.h25
-rw-r--r--include/gqueue/gqueue.h6
-rw-r--r--include/gwin/list.h154
3 files changed, 168 insertions, 17 deletions
diff --git a/include/gdisp/gdisp.h b/include/gdisp/gdisp.h
index aa418cdb..b82c9f3c 100644
--- a/include/gdisp/gdisp.h
+++ b/include/gdisp/gdisp.h
@@ -775,18 +775,6 @@ void gdispDrawBox(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color);
const char *gdispGetFontName(font_t font);
#endif
-/**
- * @brief Blend two colors together according to opacity/alpha.
- * @return The blended color.
- *
- * @param[in] fg Foreground color
- * @param[in] bg Background color
- * @param[in] alpha Opacity of the foreground color (0-255)
- *
- * @api
- */
-color_t gdispBlendColor(color_t fg, color_t bg, uint8_t alpha);
-
/* Extra Arc Functions */
#if GDISP_NEED_ARC || defined(__DOXYGEN__)
@@ -815,6 +803,19 @@ color_t gdispBlendColor(color_t fg, color_t bg, uint8_t alpha);
void gdispFillRoundedBox(coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t radius, color_t color);
#endif
+
+/**
+ * @brief Blend 2 colors according to the alpha
+ * @return The combined color
+ *
+ * @param[in] fg The foreground color
+ * @param[in] bg The background color
+ * @param[in] alpha The alpha value (0-255). 0 is all background, 255 is all foreground.
+ *
+ * @api
+ */
+color_t gdispBlendColor(color_t fg, color_t bg, uint8_t alpha);
+
/* Support routine for packed pixel formats */
#if !defined(gdispPackPixels) || defined(__DOXYGEN__)
/**
diff --git a/include/gqueue/gqueue.h b/include/gqueue/gqueue.h
index 44a42247..b590846c 100644
--- a/include/gqueue/gqueue.h
+++ b/include/gqueue/gqueue.h
@@ -206,9 +206,9 @@ bool_t gfxQueueFSyncIsEmpty(gfxQueueFSync *pqueue);
* @api
* @{
*/
-bool_t gfxQueueASyncIsIn(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem);
-bool_t gfxQueueGSyncIsIn(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem);
-bool_t gfxQueueFSyncIsIn(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem);
+bool_t gfxQueueASyncIsIn(gfxQueueASync *pqueue, const gfxQueueASyncItem *pitem);
+bool_t gfxQueueGSyncIsIn(gfxQueueGSync *pqueue, const gfxQueueGSyncItem *pitem);
+bool_t gfxQueueFSyncIsIn(gfxQueueFSync *pqueue, const gfxQueueFSyncItem *pitem);
/* @} */
/**
diff --git a/include/gwin/list.h b/include/gwin/list.h
index 0b525b03..99f5f532 100644
--- a/include/gwin/list.h
+++ b/include/gwin/list.h
@@ -37,21 +37,171 @@
* @brief A list event
*/
typedef struct GEventGWinList {
- GEventType type; // The type of this event (GEVENT_GWIN_LIST)
- GHandle list; // THe list that has generated the event
+ GEventType type; // The type of this event (GEVENT_GWIN_LIST)
+ GHandle list; // The list
+ int item; // The item that has been selected (or unselected in a multi-select listbox)
} GEventGWinList;
// A list window
typedef struct GListObject {
GWidgetObject w;
+
+ #if GINPUT_NEED_TOGGLE
+ uint16_t t_up;
+ uint16_t t_dn;
+ #endif
+
+ int cnt; // Number of items currently in the list (quicker than counting each time)
+ int top; // The element at the top of the visible list area
+ gfxQueueASync list_head; // The list of items
} GListObject;
#ifdef __cplusplus
extern "C" {
#endif
+/**
+ * @brief Create a list widget
+ *
+ * @note The drawing color and the background color get set to the current defaults. If you haven't called
+ * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are Black and White.
+ * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then
+ * there is no default font and text drawing operations will not display anything.
+ * @note A list remembers its normal drawing state. If there is a window manager then it is automatically
+ * redrawn if the window is moved or its visibility state is changed.
+ * @note The list contains no elements after creation.
+ * @note A slider supports mouse, toggle and dial input.
+ * @note When assigning a toggle, only one toggle is supported per role. If you try to assign more than
+ * one toggle to a role, it will forget the previous toggle. Two roles are supported:
+ * Role 0 = toggle for down, role 1 = toggle for up
+ * @note When assigning a dial, only one dial is supported. If you try to assign more than one dial, it
+ * will forget the previous dial. Only dial role 0 is supported.
+ *
+ * @param[in] widget The GListObject structure to initialize. If this is NULL, the structure is dynamically allocated.
+ * @param[in] pInit The initialization parameters to use
+ *
+ * @return NULL if there is no resulting drawing area, otherwise a window handle.
+ *
+ * @api
+ */
GHandle gwinListCreate(GListObject *widget, GWidgetInit *pInit);
+/**
+ * @brief Add an item to the list
+ *
+ * @note The ID you get returned is not static. If items get removed from the list, the list items get
+ * reordered.
+ *
+ * @param[in] gh The widget handle (must be a list handle)
+ * @param[in] item The string which shall be displayed in the list afterwards
+ * @param[in] useAlloc If set to TRUE, the string will be dynamically allocated. A static buffer must be passed otherwise
+ *
+ * @return The current ID of the item. The ID might change if you remove items from the middle of the list
+ *
+ * @api
+ */
+int gwinListAddItem(GHandle gh, const char* item, bool_t useAlloc);
+
+/**
+ * @brief Get the name behind an item with a given ID
+ *
+ * @param[in] gh The widget handle (must be a list handle)
+ * @param[in] item The item ID
+ *
+ * @return The string of the list item or NULL on error
+ *
+ * @api
+ */
+const char* gwinListItemGetText(GHandle gh, int item);
+
+/**
+ * @brief Get the ID of an item with a given name
+ *
+ * @param[in] gh The widget handle (must be a list handle)
+ * @param[in] text The item name
+ *
+ * @return The id of the list item or -1 on error
+ *
+ * @api
+ */
+int gwinListFindText(GHandle gh, const char* text);
+
+/**
+ * @brief Set the custom parameter of an item with a given ID
+ *
+ * @param[in] gh The widget handle (must be a list handle)
+ * @param[in] item The item ID
+ * @param[in] param The parameter to be set
+ *
+ * @api
+ */
+void gwinListItemSetParam(GHandle gh, int item, uint16_t param);
+
+/**
+ * @brief Get the custom parameter of an item with a given ID
+ *
+ * @param[in] gh The widget handle (must be a list handle)
+ * @param[in] item The item ID
+ *
+ * @return The parameter
+ *
+ * @api
+ */
+uint16_t gwinListItemGetParam(GHandle gh, int item);
+
+/**
+ * @brief Delete all the items of the list
+ *
+ * @param[in] gh The widget handle (must be a list handle)
+ *
+ * @api
+ */
+void ListDeleteAll(GHandle gh);
+
+/**
+ * @brief Delete an item from the list
+ *
+ * @param[in] gh The widget handle (must be a list handle)
+ * @param[in] item The item ID
+ *
+ * @api
+ */
+void gwinListItemDelete(GHandle gh, int item);
+
+/**
+ * @brief Get the amount of items within the list
+ *
+ * @param[in] gh The widget handle (must be a list handle)
+ *
+ * @return The amount of items in the list
+ *
+ * @api
+ */
+int gwinListItemCount(GHandle gh);
+
+/**
+ * @brief Check if an item with a given ID is selected
+ *
+ * @param[in] gh The widget handle (must be a list handle)
+ * @param[in] item The item ID
+ *
+ * @return TRUE if the item is selected, FALSE otherwise
+ *
+ * @api
+ */
+bool_t gwinListItemIsSelected(GHandle gh, int item);
+
+/**
+ * @brief Get the ID of the selected item
+ *
+ * @param[in] gh The widget handle (must be a list handle)
+ *
+ * @return The ID of the list item
+ *
+ * @api
+ */
+int gwinListGetSelected(GHandle gh);
+
#ifdef __cplusplus
}
#endif