Use string arrays
This commit is contained in:
committed by
Raphael Coeffic
parent
37a6409da0
commit
2246c3cfbc
+2
-3
@@ -333,10 +333,9 @@ class BitmapBuffer: public BitmapBufferBase<pixel_t>
|
||||
return drawSizedText(x, y, s, strlen(s), flags);
|
||||
}
|
||||
|
||||
coord_t drawTextAtIndex(coord_t x, coord_t y, const char * s, uint8_t idx, LcdFlags flags = 0)
|
||||
coord_t drawTextAtIndex(coord_t x, coord_t y, const char** s, uint8_t idx, LcdFlags flags = 0)
|
||||
{
|
||||
char length = *s++;
|
||||
return drawSizedText(x, y, s+length*idx, length, flags);
|
||||
return drawText(x, y, s[idx], flags);
|
||||
}
|
||||
|
||||
static void formatNumberAsString(char *buffer, const uint8_t buffer_size, int32_t val, LcdFlags flags = 0, uint8_t len = 0, const char * prefix = nullptr, const char * suffix = nullptr);
|
||||
|
||||
+21
-8
@@ -48,18 +48,31 @@ class ChoiceBase : public FormField
|
||||
|
||||
class Choice: public ChoiceBase {
|
||||
public:
|
||||
Choice(FormGroup * parent, const rect_t & rect, int vmin, int vmax, std::function<int()> getValue, std::function<void(int)> setValue = nullptr, WindowFlags windowFlags = 0);
|
||||
Choice(FormGroup * parent, const rect_t & rect, std::vector<std::string> values, int vmin, int vmax, std::function<int()> getValue, std::function<void(int)> setValue = nullptr, WindowFlags windowFlags = 0);
|
||||
Choice(FormGroup * parent, const rect_t & rect, const char * const values[], int vmin, int vmax, std::function<int()> getValue, std::function<void(int)> setValue = nullptr, WindowFlags windowFlags = 0);
|
||||
Choice(FormGroup * parent, const rect_t & rect, const char * values, int vmin, int vmax, std::function<int()> getValue, std::function<void(int)> setValue = nullptr, WindowFlags windowFlags = 0);
|
||||
Choice(FormGroup *parent, const rect_t &rect, int vmin, int vmax,
|
||||
std::function<int()> getValue,
|
||||
std::function<void(int)> setValue = nullptr,
|
||||
WindowFlags windowFlags = 0);
|
||||
Choice(FormGroup *parent, const rect_t &rect,
|
||||
std::vector<std::string> values, int vmin, int vmax,
|
||||
std::function<int()> getValue,
|
||||
std::function<void(int)> setValue = nullptr,
|
||||
WindowFlags windowFlags = 0);
|
||||
Choice(FormGroup *parent, const rect_t &rect, const char *const values[],
|
||||
int vmin, int vmax, std::function<int()> getValue,
|
||||
std::function<void(int)> setValue = nullptr,
|
||||
WindowFlags windowFlags = 0);
|
||||
Choice(FormGroup *parent, const rect_t &rect, const char *values, int vmin,
|
||||
int vmax, std::function<int()> getValue,
|
||||
std::function<void(int)> setValue = nullptr,
|
||||
WindowFlags windowFlags = 0);
|
||||
|
||||
void addValue(const char * value);
|
||||
void addValue(const char *value);
|
||||
|
||||
void addValues(const char * const values[], uint8_t count);
|
||||
void addValues(const char *const values[], uint8_t count);
|
||||
|
||||
void setValues(std::vector<std::string> values);
|
||||
void setValues(std::vector<std::string> values);
|
||||
|
||||
void setValues(const char * const values[]);
|
||||
void setValues(const char *const values[]);
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() const override
|
||||
|
||||
+2
-3
@@ -79,10 +79,9 @@ inline T sgn(T a)
|
||||
}
|
||||
|
||||
// TODO duplicated code
|
||||
inline std::string TEXT_AT_INDEX(const char * val, uint8_t idx)
|
||||
inline std::string TEXT_AT_INDEX(const char** val, uint8_t idx)
|
||||
{
|
||||
const char * start = val + 1 + idx * val[0];
|
||||
return std::string(start, min<uint8_t>(val[0], (uint8_t)strlen(start)));
|
||||
return std::string(val[idx]);
|
||||
}
|
||||
|
||||
inline const char * findNextLine(const char * stack)
|
||||
|
||||
Reference in New Issue
Block a user