Wrapper classes for the emwin library

Dependents:   app_emwin1 app_emwin2_pos lpc4088_ebb_gui_emwin

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?

UserRevisionLine numberNew contents of line
embeddedartists 0:316c181e9b65 1 #include "mbed.h"
embeddedartists 0:316c181e9b65 2
embeddedartists 0:316c181e9b65 3 #include "EwEdit.h"
embeddedartists 0:316c181e9b65 4
embeddedartists 0:316c181e9b65 5
embeddedartists 0:316c181e9b65 6 EwEdit::EwEdit(int maxLen, EwWindow* parent) : EwWindow(parent) {
embeddedartists 0:316c181e9b65 7 init(0, 0, 0, 0, maxLen, parent);
embeddedartists 0:316c181e9b65 8 }
embeddedartists 0:316c181e9b65 9
embeddedartists 0:316c181e9b65 10 EwEdit::EwEdit(int x, int y, int width, int height, int maxLen, EwWindow* parent) :
embeddedartists 0:316c181e9b65 11 EwWindow(x, y, width, height, parent) {
embeddedartists 0:316c181e9b65 12
embeddedartists 0:316c181e9b65 13 init(x, y, width, height, maxLen, parent);
embeddedartists 0:316c181e9b65 14 }
embeddedartists 0:316c181e9b65 15
embeddedartists 0:316c181e9b65 16 void EwEdit::addKey(int32_t key) {
embeddedartists 0:316c181e9b65 17 EDIT_AddKey(_hWnd, key);
embeddedartists 0:316c181e9b65 18 }
embeddedartists 0:316c181e9b65 19
embeddedartists 0:316c181e9b65 20 void EwEdit::enableBlink(int32_t period, bool on) {
embeddedartists 0:316c181e9b65 21 EDIT_EnableBlink(_hWnd, period, (on ? 1 : 0));
embeddedartists 0:316c181e9b65 22 }
embeddedartists 0:316c181e9b65 23
embeddedartists 0:316c181e9b65 24 ewColor_t EwEdit::getBackgroundColor(ewEditColorIndex_t idx) {
embeddedartists 0:316c181e9b65 25 return EDIT_GetBkColor(_hWnd, idx);
embeddedartists 0:316c181e9b65 26 }
embeddedartists 0:316c181e9b65 27
embeddedartists 0:316c181e9b65 28 int32_t EwEdit::getCursorCharPosition() {
embeddedartists 0:316c181e9b65 29 return EDIT_GetCursorCharPos(_hWnd);
embeddedartists 0:316c181e9b65 30 }
embeddedartists 0:316c181e9b65 31
embeddedartists 0:316c181e9b65 32 void EwEdit::getCursorPixelPosition(int32_t* x, int32_t* y) {
embeddedartists 0:316c181e9b65 33 EDIT_GetCursorPixelPos(_hWnd, (int*)x, (int*)y);
embeddedartists 0:316c181e9b65 34 }
embeddedartists 0:316c181e9b65 35
embeddedartists 0:316c181e9b65 36 float EwEdit::getFloatValue() {
embeddedartists 0:316c181e9b65 37 return EDIT_GetFloatValue(_hWnd);
embeddedartists 0:316c181e9b65 38 }
embeddedartists 0:316c181e9b65 39
embeddedartists 0:316c181e9b65 40 const ewFont_t* EwEdit::getFont() {
embeddedartists 0:316c181e9b65 41 return EDIT_GetFont(_hWnd);
embeddedartists 0:316c181e9b65 42 }
embeddedartists 0:316c181e9b65 43
embeddedartists 0:316c181e9b65 44 int32_t EwEdit::getNumChars() {
embeddedartists 0:316c181e9b65 45 return EDIT_GetNumChars(_hWnd);
embeddedartists 0:316c181e9b65 46 }
embeddedartists 0:316c181e9b65 47
embeddedartists 0:316c181e9b65 48 void EwEdit::getText(char* pBuffer, int32_t maxLen) {
embeddedartists 0:316c181e9b65 49 EDIT_GetText(_hWnd, pBuffer, maxLen);
embeddedartists 0:316c181e9b65 50 }
embeddedartists 0:316c181e9b65 51
embeddedartists 0:316c181e9b65 52 ewColor_t EwEdit::getTextColor(ewEditColorIndex_t idx) {
embeddedartists 0:316c181e9b65 53 return EDIT_GetTextColor(_hWnd, idx);
embeddedartists 0:316c181e9b65 54 }
embeddedartists 0:316c181e9b65 55
embeddedartists 0:316c181e9b65 56 int32_t EwEdit::getValue() {
embeddedartists 0:316c181e9b65 57 return EDIT_GetValue(_hWnd);
embeddedartists 0:316c181e9b65 58 }
embeddedartists 0:316c181e9b65 59
embeddedartists 0:316c181e9b65 60 void EwEdit::setBinMode(uint32_t value, uint32_t min, uint32_t max) {
embeddedartists 0:316c181e9b65 61 EDIT_SetBinMode(_hWnd, value, min, max);
embeddedartists 0:316c181e9b65 62 }
embeddedartists 0:316c181e9b65 63
embeddedartists 0:316c181e9b65 64 void EwEdit::setBackgroundColor(ewEditColorIndex_t idx, ewColor_t c) {
embeddedartists 0:316c181e9b65 65 EDIT_SetBkColor(_hWnd, idx, c);
embeddedartists 0:316c181e9b65 66 }
embeddedartists 0:316c181e9b65 67
embeddedartists 0:316c181e9b65 68 void EwEdit::setCursorAtChar(int32_t charPos) {
embeddedartists 0:316c181e9b65 69 EDIT_SetCursorAtChar(_hWnd, charPos);
embeddedartists 0:316c181e9b65 70 }
embeddedartists 0:316c181e9b65 71
embeddedartists 0:316c181e9b65 72 void EwEdit::setCursorAtPixel(int32_t pos) {
embeddedartists 0:316c181e9b65 73 EDIT_SetCursorAtPixel(_hWnd, pos);
embeddedartists 0:316c181e9b65 74 }
embeddedartists 0:316c181e9b65 75
embeddedartists 0:316c181e9b65 76 void EwEdit::setDecimalMode(int32_t value, int32_t min, int32_t max, int32_t shift, ewEditMode_t mode) {
embeddedartists 0:316c181e9b65 77 EDIT_SetDecMode(_hWnd, value, min, max, shift, mode);
embeddedartists 0:316c181e9b65 78 }
embeddedartists 0:316c181e9b65 79
embeddedartists 0:316c181e9b65 80 void EwEdit::setFloatMode(float value, float min, float max, int32_t shift, ewEditMode_t mode) {
embeddedartists 0:316c181e9b65 81 EDIT_SetFloatMode(_hWnd, value, min, max, shift, mode);
embeddedartists 0:316c181e9b65 82 }
embeddedartists 0:316c181e9b65 83
embeddedartists 0:316c181e9b65 84 void EwEdit::setFloatValue(float value) {
embeddedartists 0:316c181e9b65 85 EDIT_SetFloatValue(_hWnd, value);
embeddedartists 0:316c181e9b65 86 }
embeddedartists 0:316c181e9b65 87
embeddedartists 0:316c181e9b65 88 void EwEdit::setFocussable(bool focussable) {
embeddedartists 0:316c181e9b65 89 EDIT_SetFocussable(_hWnd, (focussable ? 1 : 0));
embeddedartists 0:316c181e9b65 90 }
embeddedartists 0:316c181e9b65 91
embeddedartists 0:316c181e9b65 92 void EwEdit::setFont(const ewFont_t* pFont) {
embeddedartists 0:316c181e9b65 93 EDIT_SetFont(_hWnd, pFont);
embeddedartists 0:316c181e9b65 94 }
embeddedartists 0:316c181e9b65 95
embeddedartists 0:316c181e9b65 96 void EwEdit::setHexMode(uint32_t value, uint32_t min, uint32_t max) {
embeddedartists 0:316c181e9b65 97 EDIT_SetHexMode(_hWnd, value, min, max);
embeddedartists 0:316c181e9b65 98 }
embeddedartists 0:316c181e9b65 99
embeddedartists 0:316c181e9b65 100 void EwEdit::setInsertMode(bool on) {
embeddedartists 0:316c181e9b65 101 EDIT_SetInsertMode(_hWnd, (on ? 1 : 0));
embeddedartists 0:316c181e9b65 102 }
embeddedartists 0:316c181e9b65 103
embeddedartists 0:316c181e9b65 104 void EwEdit::setMaximumLength(int32_t maxLen) {
embeddedartists 0:316c181e9b65 105 EDIT_SetMaxLen(_hWnd, maxLen);
embeddedartists 0:316c181e9b65 106 }
embeddedartists 0:316c181e9b65 107
embeddedartists 0:316c181e9b65 108 void EwEdit::setSelection(int32_t firstChar, int32_t lastChar) {
embeddedartists 0:316c181e9b65 109 EDIT_SetSel(_hWnd, firstChar, lastChar);
embeddedartists 0:316c181e9b65 110 }
embeddedartists 0:316c181e9b65 111
embeddedartists 0:316c181e9b65 112 void EwEdit::setText(const char* s) {
embeddedartists 0:316c181e9b65 113 EDIT_SetText(_hWnd, s);
embeddedartists 0:316c181e9b65 114 }
embeddedartists 0:316c181e9b65 115
embeddedartists 0:316c181e9b65 116 void EwEdit::setTextAlign(ewTextAlign_t align) {
embeddedartists 0:316c181e9b65 117 EDIT_SetTextAlign(_hWnd, align);
embeddedartists 0:316c181e9b65 118 }
embeddedartists 0:316c181e9b65 119
embeddedartists 0:316c181e9b65 120 void EwEdit::setTextColor(ewEditColorIndex_t idx, ewColor_t c) {
embeddedartists 0:316c181e9b65 121 EDIT_SetTextColor(_hWnd, idx, c);
embeddedartists 0:316c181e9b65 122 }
embeddedartists 0:316c181e9b65 123
embeddedartists 0:316c181e9b65 124 void EwEdit::setTextMode() {
embeddedartists 0:316c181e9b65 125 EDIT_SetTextMode(_hWnd);
embeddedartists 0:316c181e9b65 126 }
embeddedartists 0:316c181e9b65 127
embeddedartists 0:316c181e9b65 128 void EwEdit::setULongMode(uint32_t value, uint32_t min, uint32_t max) {
embeddedartists 0:316c181e9b65 129 EDIT_SetUlongMode(_hWnd, value, min, max);
embeddedartists 0:316c181e9b65 130 }
embeddedartists 0:316c181e9b65 131
embeddedartists 0:316c181e9b65 132 void EwEdit::setValue(int32_t value) {
embeddedartists 0:316c181e9b65 133 EDIT_SetValue(_hWnd, value);
embeddedartists 0:316c181e9b65 134 }
embeddedartists 0:316c181e9b65 135
embeddedartists 0:316c181e9b65 136
embeddedartists 0:316c181e9b65 137 ewColor_t EwEdit::getDefaultBackgroundColor(ewEditColorIndex_t idx) {
embeddedartists 0:316c181e9b65 138 return EDIT_GetDefaultBkColor(idx);
embeddedartists 0:316c181e9b65 139 }
embeddedartists 0:316c181e9b65 140
embeddedartists 0:316c181e9b65 141 const ewFont_t* EwEdit::getDefaultFont() {
embeddedartists 0:316c181e9b65 142 return EDIT_GetDefaultFont();
embeddedartists 0:316c181e9b65 143 }
embeddedartists 0:316c181e9b65 144
embeddedartists 0:316c181e9b65 145 ewTextAlign_t EwEdit::getDefaultTextAlign() {
embeddedartists 0:316c181e9b65 146 return (ewTextAlign_t)EDIT_GetDefaultTextAlign();
embeddedartists 0:316c181e9b65 147 }
embeddedartists 0:316c181e9b65 148
embeddedartists 0:316c181e9b65 149 ewColor_t EwEdit::getDefaultTextColor(ewEditColorIndex_t idx) {
embeddedartists 0:316c181e9b65 150 return EDIT_GetDefaultTextColor(idx);
embeddedartists 0:316c181e9b65 151 }
embeddedartists 0:316c181e9b65 152
embeddedartists 0:316c181e9b65 153 void EwEdit::setDefaultBackgroundColor(ewEditColorIndex_t idx, ewColor_t c) {
embeddedartists 0:316c181e9b65 154 EDIT_SetDefaultBkColor(idx, c);
embeddedartists 0:316c181e9b65 155 }
embeddedartists 0:316c181e9b65 156
embeddedartists 0:316c181e9b65 157 void EwEdit::setDefaultFont(const ewFont_t* pFont) {
embeddedartists 0:316c181e9b65 158 EDIT_SetDefaultFont(pFont);
embeddedartists 0:316c181e9b65 159 }
embeddedartists 0:316c181e9b65 160
embeddedartists 0:316c181e9b65 161 void EwEdit::setDefaultTextAlign(ewTextAlign_t align) {
embeddedartists 0:316c181e9b65 162 EDIT_SetDefaultTextAlign(align);
embeddedartists 0:316c181e9b65 163 }
embeddedartists 0:316c181e9b65 164
embeddedartists 0:316c181e9b65 165 void EwEdit::setDefaultTextColor(ewEditColorIndex_t idx, ewColor_t c) {
embeddedartists 0:316c181e9b65 166 EDIT_SetDefaultTextColor(idx, c);
embeddedartists 0:316c181e9b65 167 }
embeddedartists 0:316c181e9b65 168
embeddedartists 0:316c181e9b65 169 uint32_t EwEdit::editBin(uint32_t value, uint32_t min, uint32_t max, int32_t len, int32_t width) {
embeddedartists 0:316c181e9b65 170 return GUI_EditBin(value, min, max, len, width);
embeddedartists 0:316c181e9b65 171 }
embeddedartists 0:316c181e9b65 172
embeddedartists 0:316c181e9b65 173 uint32_t EwEdit::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 174 return GUI_EditDec(value, min, max, len, width, shift, mode);
embeddedartists 0:316c181e9b65 175 }
embeddedartists 0:316c181e9b65 176
embeddedartists 0:316c181e9b65 177 float EwEdit::editFloat(float value, float min, float max, int32_t len, int32_t width, int32_t shift, ewEditMode_t mode) {
embeddedartists 0:316c181e9b65 178 return GUI_EditFloat(value, min, max, len, width, shift, mode);
embeddedartists 0:316c181e9b65 179 }
embeddedartists 0:316c181e9b65 180
embeddedartists 0:316c181e9b65 181 uint32_t EwEdit::editHex(uint32_t value, uint32_t min, uint32_t max, int32_t len, int32_t width) {
embeddedartists 0:316c181e9b65 182 return GUI_EditHex(value, min, max, len, width);
embeddedartists 0:316c181e9b65 183 }
embeddedartists 0:316c181e9b65 184
embeddedartists 0:316c181e9b65 185 void EwEdit::editString(char* pString, int32_t len, int32_t width) {
embeddedartists 0:316c181e9b65 186 GUI_EditString(pString, len, width);
embeddedartists 0:316c181e9b65 187 }
embeddedartists 0:316c181e9b65 188
embeddedartists 0:316c181e9b65 189
embeddedartists 0:316c181e9b65 190 void EwEdit::init(int x, int y, int width, int height, int maxLen, EwWindow* parent) {
embeddedartists 0:316c181e9b65 191 EDIT_Handle h;
embeddedartists 0:316c181e9b65 192 GUI_HWIN hWin = 0;
embeddedartists 0:316c181e9b65 193
embeddedartists 0:316c181e9b65 194
embeddedartists 0:316c181e9b65 195 if (parent) {
embeddedartists 0:316c181e9b65 196 hWin = _getHandle(parent);
embeddedartists 0:316c181e9b65 197 }
embeddedartists 0:316c181e9b65 198
embeddedartists 0:316c181e9b65 199 h = EDIT_CreateEx(x, y, width, height, hWin, (WM_CF_SHOW| WM_CF_MEMDEV),
embeddedartists 0:316c181e9b65 200 0, _guiWidgetId++, maxLen);
embeddedartists 0:316c181e9b65 201 _setNewHandle(h, _callback);
embeddedartists 0:316c181e9b65 202 }
embeddedartists 0:316c181e9b65 203
embeddedartists 0:316c181e9b65 204
embeddedartists 0:316c181e9b65 205 void EwEdit::_callback(WM_MESSAGE* pMsg, EwWindow* w) {
embeddedartists 0:316c181e9b65 206 EDIT_Callback(pMsg);
embeddedartists 0:316c181e9b65 207 }
embeddedartists 0:316c181e9b65 208