aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-04-29 09:00:06 +1000
committerinmarket <andrewh@inmarket.com.au>2014-04-29 09:00:06 +1000
commit56b8dfc72f2adf3bd214428f5fa4f81d8b41b437 (patch)
tree60e09925785dfbca3090773b391219e32d5f2788 /src/gwin
parenta0b11f764b6c2e52d7a41d7bfda438a4e7a9a5b0 (diff)
downloaduGFX-56b8dfc72f2adf3bd214428f5fa4f81d8b41b437.tar.gz
uGFX-56b8dfc72f2adf3bd214428f5fa4f81d8b41b437.tar.bz2
uGFX-56b8dfc72f2adf3bd214428f5fa4f81d8b41b437.zip
New label attribute is const. Also updated comments.
Diffstat (limited to 'src/gwin')
-rw-r--r--src/gwin/label.c2
-rw-r--r--src/gwin/label.h12
2 files changed, 9 insertions, 5 deletions
diff --git a/src/gwin/label.c b/src/gwin/label.c
index 167ded84..574dc8b7 100644
--- a/src/gwin/label.c
+++ b/src/gwin/label.c
@@ -164,7 +164,7 @@ void gwinLabelSetBorder(GHandle gh, bool_t border) {
}
#if GWIN_LABEL_ATTRIBUTE
- void gwinLabelSetAttribute(GHandle gh, coord_t tab, char* attr) {
+ void gwinLabelSetAttribute(GHandle gh, coord_t tab, const char* attr) {
// is it a valid handle?
if (gh->vmt != (gwinVMT *)&labelVMT)
return;
diff --git a/src/gwin/label.h b/src/gwin/label.h
index eafa8d91..708599a6 100644
--- a/src/gwin/label.h
+++ b/src/gwin/label.h
@@ -35,7 +35,7 @@ typedef struct GLabelObject {
#if GWIN_LABEL_ATTRIBUTE
coord_t tab;
- char* attr;
+ const char* attr;
#endif
} GLabelObject;
@@ -70,7 +70,7 @@ void gwinLabelSetBorder(GHandle gh, bool_t border);
#if GWIN_LABEL_ATTRIBUTE
/**
- * @brief Add an attribute in front of the actualy label text
+ * @brief Add an text attribute in front of the normal label text
* @detail Often you want to display a text like this:
* Current IP: 192.168.1.42
* In that case, the actual IP will be variable, the text in front of it
@@ -80,7 +80,11 @@ void gwinLabelSetBorder(GHandle gh, bool_t border);
* Please check out the website for further explanation, illustraions and usage
* examples.
*
- * @note The attribute text is currently not being allocated
+ * @note The attribute text is not copied into private memory and so it
+ * must be a constant string, not one allocated in a stack buffer.
+ * @note Use of this construct is discouraged. The appropriate way is to
+ * create two labels - one for the static text and one for the
+ * dynamic text.
*
* @param[in] gh The widget handle (must be a label handle)
* @param[in] tab The distance of the label text from the left widget edge
@@ -88,7 +92,7 @@ void gwinLabelSetBorder(GHandle gh, bool_t border);
*
* @api
*/
- void gwinLabelSetAttribute(GHandle gh, coord_t tab, char* attr);
+ void gwinLabelSetAttribute(GHandle gh, coord_t tab, const char* attr);
#endif
#ifdef __cplusplus