EmbeddedArtists AB / ewgui

Dependents:   app_emwin1 app_emwin2_pos lpc4088_ebb_gui_emwin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers EwEdit.h Source File

EwEdit.h

00001 
00002 #ifndef EWEDIT_H
00003 #define EWEDIT_H
00004 
00005 #include "EwPainter.h"
00006 #include "EwWindow.h"
00007 
00008 #include "EDIT.h"
00009 
00010 
00011 enum ewEditColorIndex_t {
00012     EditColorIndexDisabled = EDIT_CI_DISABELD,
00013     EditColorIndexEnabled = EDIT_CI_ENABELD,
00014 };
00015 
00016 enum ewEditMode_t {
00017     EditModeNormal = GUI_EDIT_NORMAL,
00018     EditModeSigned = GUI_EDIT_SIGNED,
00019     EditModeSuppressLeadingZeros = GUI_EDIT_SUPPRESS_LEADING_ZEROES
00020 };
00021 
00022 /**
00023  * This is a wrapper class for the emwin EDIT interface.
00024  */
00025 class EwEdit : public EwWindow {
00026 public:
00027 
00028     EwEdit(int maxLen, EwWindow* parent = 0);
00029     EwEdit(int x, int y, int width, int height, int maxLen, EwWindow* parent = 0);
00030 
00031     // TODO: enum or define? GUI_KEY_BACKSPACE
00032     void addKey(int32_t key);
00033     void enableBlink(int32_t period, bool on);
00034     ewColor_t getBackgroundColor(ewEditColorIndex_t idx);
00035     int32_t getCursorCharPosition();
00036     void getCursorPixelPosition(int32_t* x, int32_t* y);
00037     float getFloatValue();
00038     const ewFont_t* getFont();
00039     int32_t getNumChars();
00040     void getText(char* pBuffer, int32_t maxLen);
00041     ewColor_t getTextColor(ewEditColorIndex_t idx);
00042     int32_t getValue();
00043     void setBinMode(uint32_t value, uint32_t min, uint32_t max);
00044     void setBackgroundColor(ewEditColorIndex_t idx, ewColor_t c);
00045     void setCursorAtChar(int32_t charPos);
00046     void setCursorAtPixel(int32_t pos);
00047     void setDecimalMode(int32_t value, int32_t min, int32_t max, int32_t shift, ewEditMode_t mode);
00048     void setFloatMode(float value, float min, float max, int32_t shift, ewEditMode_t mode);
00049     void setFloatValue(float value);
00050     void setFocussable(bool focussable);
00051     void setFont(const ewFont_t* pFont);
00052     void setHexMode(uint32_t value, uint32_t min, uint32_t max);
00053     void setInsertMode(bool on);
00054     void setMaximumLength(int32_t maxLen);
00055     void setSelection(int32_t firstChar, int32_t lastChar);
00056     void setText(const char* s);
00057     void setTextAlign(ewTextAlign_t align);
00058     void setTextColor(ewEditColorIndex_t idx, ewColor_t c);
00059     void setTextMode();
00060     void setULongMode(uint32_t value, uint32_t min, uint32_t max);
00061     void setValue(int32_t value);
00062 
00063 
00064 
00065     static ewColor_t getDefaultBackgroundColor(ewEditColorIndex_t idx);
00066     static const ewFont_t* getDefaultFont();
00067     static ewTextAlign_t getDefaultTextAlign();
00068     static ewColor_t getDefaultTextColor(ewEditColorIndex_t idx);
00069 
00070     static void setDefaultBackgroundColor(ewEditColorIndex_t idx, ewColor_t c);
00071     static void setDefaultFont(const ewFont_t* pFont);
00072     static void setDefaultTextAlign(ewTextAlign_t align);
00073     static void setDefaultTextColor(ewEditColorIndex_t idx, ewColor_t c);
00074 
00075     static uint32_t editBin(uint32_t value, uint32_t min, uint32_t max, int32_t len, int32_t width);
00076     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);
00077     static float editFloat(float value, float min, float max, int32_t len, int32_t width, int32_t shift, ewEditMode_t mode);
00078     static uint32_t editHex(uint32_t value, uint32_t min, uint32_t max, int32_t len, int32_t width);
00079     static void editString(char* pString, int32_t len, int32_t width);
00080 
00081 private:
00082 
00083 
00084     void init(int x, int y, int width, int height, int maxLen, EwWindow* parent);
00085 
00086 
00087     static void _callback(WM_MESSAGE* pMsg, EwWindow* w);
00088 
00089 
00090 };
00091 
00092 #endif