Wrapper classes for the emwin library
Dependents: app_emwin1 app_emwin2_pos lpc4088_ebb_gui_emwin
EwEdit.h@1:0b16165ada7c, 2014-04-14 (annotated)
- Committer:
- embeddedartists
- Date:
- Mon Apr 14 08:38:33 2014 +0000
- Revision:
- 1:0b16165ada7c
- Parent:
- 0:316c181e9b65
Initialize uninitialized touchState in EwGui
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 0:316c181e9b65 | 1 | |
embeddedartists | 0:316c181e9b65 | 2 | #ifndef EWEDIT_H |
embeddedartists | 0:316c181e9b65 | 3 | #define EWEDIT_H |
embeddedartists | 0:316c181e9b65 | 4 | |
embeddedartists | 0:316c181e9b65 | 5 | #include "EwPainter.h" |
embeddedartists | 0:316c181e9b65 | 6 | #include "EwWindow.h" |
embeddedartists | 0:316c181e9b65 | 7 | |
embeddedartists | 0:316c181e9b65 | 8 | #include "EDIT.h" |
embeddedartists | 0:316c181e9b65 | 9 | |
embeddedartists | 0:316c181e9b65 | 10 | |
embeddedartists | 0:316c181e9b65 | 11 | enum ewEditColorIndex_t { |
embeddedartists | 0:316c181e9b65 | 12 | EditColorIndexDisabled = EDIT_CI_DISABELD, |
embeddedartists | 0:316c181e9b65 | 13 | EditColorIndexEnabled = EDIT_CI_ENABELD, |
embeddedartists | 0:316c181e9b65 | 14 | }; |
embeddedartists | 0:316c181e9b65 | 15 | |
embeddedartists | 0:316c181e9b65 | 16 | enum ewEditMode_t { |
embeddedartists | 0:316c181e9b65 | 17 | EditModeNormal = GUI_EDIT_NORMAL, |
embeddedartists | 0:316c181e9b65 | 18 | EditModeSigned = GUI_EDIT_SIGNED, |
embeddedartists | 0:316c181e9b65 | 19 | EditModeSuppressLeadingZeros = GUI_EDIT_SUPPRESS_LEADING_ZEROES |
embeddedartists | 0:316c181e9b65 | 20 | }; |
embeddedartists | 0:316c181e9b65 | 21 | |
embeddedartists | 0:316c181e9b65 | 22 | /** |
embeddedartists | 0:316c181e9b65 | 23 | * This is a wrapper class for the emwin EDIT interface. |
embeddedartists | 0:316c181e9b65 | 24 | */ |
embeddedartists | 0:316c181e9b65 | 25 | class EwEdit : public EwWindow { |
embeddedartists | 0:316c181e9b65 | 26 | public: |
embeddedartists | 0:316c181e9b65 | 27 | |
embeddedartists | 0:316c181e9b65 | 28 | EwEdit(int maxLen, EwWindow* parent = 0); |
embeddedartists | 0:316c181e9b65 | 29 | EwEdit(int x, int y, int width, int height, int maxLen, EwWindow* parent = 0); |
embeddedartists | 0:316c181e9b65 | 30 | |
embeddedartists | 0:316c181e9b65 | 31 | // TODO: enum or define? GUI_KEY_BACKSPACE |
embeddedartists | 0:316c181e9b65 | 32 | void addKey(int32_t key); |
embeddedartists | 0:316c181e9b65 | 33 | void enableBlink(int32_t period, bool on); |
embeddedartists | 0:316c181e9b65 | 34 | ewColor_t getBackgroundColor(ewEditColorIndex_t idx); |
embeddedartists | 0:316c181e9b65 | 35 | int32_t getCursorCharPosition(); |
embeddedartists | 0:316c181e9b65 | 36 | void getCursorPixelPosition(int32_t* x, int32_t* y); |
embeddedartists | 0:316c181e9b65 | 37 | float getFloatValue(); |
embeddedartists | 0:316c181e9b65 | 38 | const ewFont_t* getFont(); |
embeddedartists | 0:316c181e9b65 | 39 | int32_t getNumChars(); |
embeddedartists | 0:316c181e9b65 | 40 | void getText(char* pBuffer, int32_t maxLen); |
embeddedartists | 0:316c181e9b65 | 41 | ewColor_t getTextColor(ewEditColorIndex_t idx); |
embeddedartists | 0:316c181e9b65 | 42 | int32_t getValue(); |
embeddedartists | 0:316c181e9b65 | 43 | void setBinMode(uint32_t value, uint32_t min, uint32_t max); |
embeddedartists | 0:316c181e9b65 | 44 | void setBackgroundColor(ewEditColorIndex_t idx, ewColor_t c); |
embeddedartists | 0:316c181e9b65 | 45 | void setCursorAtChar(int32_t charPos); |
embeddedartists | 0:316c181e9b65 | 46 | void setCursorAtPixel(int32_t pos); |
embeddedartists | 0:316c181e9b65 | 47 | void setDecimalMode(int32_t value, int32_t min, int32_t max, int32_t shift, ewEditMode_t mode); |
embeddedartists | 0:316c181e9b65 | 48 | void setFloatMode(float value, float min, float max, int32_t shift, ewEditMode_t mode); |
embeddedartists | 0:316c181e9b65 | 49 | void setFloatValue(float value); |
embeddedartists | 0:316c181e9b65 | 50 | void setFocussable(bool focussable); |
embeddedartists | 0:316c181e9b65 | 51 | void setFont(const ewFont_t* pFont); |
embeddedartists | 0:316c181e9b65 | 52 | void setHexMode(uint32_t value, uint32_t min, uint32_t max); |
embeddedartists | 0:316c181e9b65 | 53 | void setInsertMode(bool on); |
embeddedartists | 0:316c181e9b65 | 54 | void setMaximumLength(int32_t maxLen); |
embeddedartists | 0:316c181e9b65 | 55 | void setSelection(int32_t firstChar, int32_t lastChar); |
embeddedartists | 0:316c181e9b65 | 56 | void setText(const char* s); |
embeddedartists | 0:316c181e9b65 | 57 | void setTextAlign(ewTextAlign_t align); |
embeddedartists | 0:316c181e9b65 | 58 | void setTextColor(ewEditColorIndex_t idx, ewColor_t c); |
embeddedartists | 0:316c181e9b65 | 59 | void setTextMode(); |
embeddedartists | 0:316c181e9b65 | 60 | void setULongMode(uint32_t value, uint32_t min, uint32_t max); |
embeddedartists | 0:316c181e9b65 | 61 | void setValue(int32_t value); |
embeddedartists | 0:316c181e9b65 | 62 | |
embeddedartists | 0:316c181e9b65 | 63 | |
embeddedartists | 0:316c181e9b65 | 64 | |
embeddedartists | 0:316c181e9b65 | 65 | static ewColor_t getDefaultBackgroundColor(ewEditColorIndex_t idx); |
embeddedartists | 0:316c181e9b65 | 66 | static const ewFont_t* getDefaultFont(); |
embeddedartists | 0:316c181e9b65 | 67 | static ewTextAlign_t getDefaultTextAlign(); |
embeddedartists | 0:316c181e9b65 | 68 | static ewColor_t getDefaultTextColor(ewEditColorIndex_t idx); |
embeddedartists | 0:316c181e9b65 | 69 | |
embeddedartists | 0:316c181e9b65 | 70 | static void setDefaultBackgroundColor(ewEditColorIndex_t idx, ewColor_t c); |
embeddedartists | 0:316c181e9b65 | 71 | static void setDefaultFont(const ewFont_t* pFont); |
embeddedartists | 0:316c181e9b65 | 72 | static void setDefaultTextAlign(ewTextAlign_t align); |
embeddedartists | 0:316c181e9b65 | 73 | static void setDefaultTextColor(ewEditColorIndex_t idx, ewColor_t c); |
embeddedartists | 0:316c181e9b65 | 74 | |
embeddedartists | 0:316c181e9b65 | 75 | static uint32_t editBin(uint32_t value, uint32_t min, uint32_t max, int32_t len, int32_t width); |
embeddedartists | 0:316c181e9b65 | 76 | static uint32_t editDec(int32_t value, int32_t min, int32_t max, int32_t len, int32_t width, int32_t shift, ewEditMode_t mode); |
embeddedartists | 0:316c181e9b65 | 77 | static float editFloat(float value, float min, float max, int32_t len, int32_t width, int32_t shift, ewEditMode_t mode); |
embeddedartists | 0:316c181e9b65 | 78 | static uint32_t editHex(uint32_t value, uint32_t min, uint32_t max, int32_t len, int32_t width); |
embeddedartists | 0:316c181e9b65 | 79 | static void editString(char* pString, int32_t len, int32_t width); |
embeddedartists | 0:316c181e9b65 | 80 | |
embeddedartists | 0:316c181e9b65 | 81 | private: |
embeddedartists | 0:316c181e9b65 | 82 | |
embeddedartists | 0:316c181e9b65 | 83 | |
embeddedartists | 0:316c181e9b65 | 84 | void init(int x, int y, int width, int height, int maxLen, EwWindow* parent); |
embeddedartists | 0:316c181e9b65 | 85 | |
embeddedartists | 0:316c181e9b65 | 86 | |
embeddedartists | 0:316c181e9b65 | 87 | static void _callback(WM_MESSAGE* pMsg, EwWindow* w); |
embeddedartists | 0:316c181e9b65 | 88 | |
embeddedartists | 0:316c181e9b65 | 89 | |
embeddedartists | 0:316c181e9b65 | 90 | }; |
embeddedartists | 0:316c181e9b65 | 91 | |
embeddedartists | 0:316c181e9b65 | 92 | #endif |