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 "EwFrameWindow.h"
embeddedartists 0:316c181e9b65 4
embeddedartists 0:316c181e9b65 5
embeddedartists 0:316c181e9b65 6 EwFrameWindow::EwFrameWindow(const char* pTitle, EwWindow* parent) : EwWindow(parent) {
embeddedartists 0:316c181e9b65 7 init(0, 0, 0, 0, pTitle, parent);
embeddedartists 0:316c181e9b65 8 }
embeddedartists 0:316c181e9b65 9
embeddedartists 0:316c181e9b65 10 EwFrameWindow::EwFrameWindow(int x, int y, int width, int height, const char* pTitle, 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, pTitle, parent);
embeddedartists 0:316c181e9b65 14 }
embeddedartists 0:316c181e9b65 15
embeddedartists 0:316c181e9b65 16
embeddedartists 0:316c181e9b65 17 void EwFrameWindow::addCloseButton(ewFrameWindowButtonAlign_t align, int32_t offset) {
embeddedartists 0:316c181e9b65 18 FRAMEWIN_AddCloseButton(_hWnd, align, offset);
embeddedartists 0:316c181e9b65 19 }
embeddedartists 0:316c181e9b65 20
embeddedartists 0:316c181e9b65 21 void EwFrameWindow::addMaxButton(ewFrameWindowButtonAlign_t align, int32_t offset) {
embeddedartists 0:316c181e9b65 22 FRAMEWIN_AddMaxButton(_hWnd, align, offset);
embeddedartists 0:316c181e9b65 23 }
embeddedartists 0:316c181e9b65 24
embeddedartists 0:316c181e9b65 25 void EwFrameWindow::addMinButton(ewFrameWindowButtonAlign_t align, int32_t offset) {
embeddedartists 0:316c181e9b65 26 FRAMEWIN_AddMinButton(_hWnd, align, offset);
embeddedartists 0:316c181e9b65 27 }
embeddedartists 0:316c181e9b65 28
embeddedartists 0:316c181e9b65 29 bool EwFrameWindow::isActive() {
embeddedartists 0:316c181e9b65 30 return (FRAMEWIN_GetActive(_hWnd) == 1);
embeddedartists 0:316c181e9b65 31 }
embeddedartists 0:316c181e9b65 32
embeddedartists 0:316c181e9b65 33 ewColor_t EwFrameWindow::getBarColor(ewFrameWindowColorIndex_t idx) {
embeddedartists 0:316c181e9b65 34 return FRAMEWIN_GetBarColor(_hWnd, idx);
embeddedartists 0:316c181e9b65 35 }
embeddedartists 0:316c181e9b65 36
embeddedartists 0:316c181e9b65 37 int32_t EwFrameWindow::getBorderSize() {
embeddedartists 0:316c181e9b65 38 return FRAMEWIN_GetBorderSize(_hWnd);
embeddedartists 0:316c181e9b65 39 }
embeddedartists 0:316c181e9b65 40
embeddedartists 0:316c181e9b65 41 const ewFont_t* EwFrameWindow::getFont() {
embeddedartists 0:316c181e9b65 42 return FRAMEWIN_GetFont(_hWnd);
embeddedartists 0:316c181e9b65 43 }
embeddedartists 0:316c181e9b65 44
embeddedartists 0:316c181e9b65 45 void EwFrameWindow::getText(char* pBuffer, int32_t maxLen) {
embeddedartists 0:316c181e9b65 46 FRAMEWIN_GetText(_hWnd, pBuffer, maxLen);
embeddedartists 0:316c181e9b65 47 }
embeddedartists 0:316c181e9b65 48
embeddedartists 0:316c181e9b65 49 ewTextAlign_t EwFrameWindow::getTextAlign() {
embeddedartists 0:316c181e9b65 50 return (ewTextAlign_t) FRAMEWIN_GetTextAlign(_hWnd);
embeddedartists 0:316c181e9b65 51 }
embeddedartists 0:316c181e9b65 52
embeddedartists 0:316c181e9b65 53 int32_t EwFrameWindow::getTitleHeight() {
embeddedartists 0:316c181e9b65 54 return FRAMEWIN_GetTitleHeight(_hWnd);
embeddedartists 0:316c181e9b65 55 }
embeddedartists 0:316c181e9b65 56
embeddedartists 0:316c181e9b65 57 bool EwFrameWindow::isMaximized() {
embeddedartists 0:316c181e9b65 58 return (FRAMEWIN_IsMaximized(_hWnd) == 1);
embeddedartists 0:316c181e9b65 59 }
embeddedartists 0:316c181e9b65 60
embeddedartists 0:316c181e9b65 61 bool EwFrameWindow::isMinimized() {
embeddedartists 0:316c181e9b65 62 return (FRAMEWIN_IsMinimized(_hWnd) == 1);
embeddedartists 0:316c181e9b65 63 }
embeddedartists 0:316c181e9b65 64
embeddedartists 0:316c181e9b65 65 void EwFrameWindow::maximize() {
embeddedartists 0:316c181e9b65 66 FRAMEWIN_Maximize(_hWnd);
embeddedartists 0:316c181e9b65 67 }
embeddedartists 0:316c181e9b65 68
embeddedartists 0:316c181e9b65 69 void EwFrameWindow::minimize() {
embeddedartists 0:316c181e9b65 70 FRAMEWIN_Minimize(_hWnd);
embeddedartists 0:316c181e9b65 71 }
embeddedartists 0:316c181e9b65 72
embeddedartists 0:316c181e9b65 73 void EwFrameWindow::restore() {
embeddedartists 0:316c181e9b65 74 FRAMEWIN_Restore(_hWnd);
embeddedartists 0:316c181e9b65 75 }
embeddedartists 0:316c181e9b65 76
embeddedartists 0:316c181e9b65 77 void EwFrameWindow::setActive(bool active) {
embeddedartists 0:316c181e9b65 78 FRAMEWIN_SetActive(_hWnd, (active ? 1 : 0));
embeddedartists 0:316c181e9b65 79 }
embeddedartists 0:316c181e9b65 80
embeddedartists 0:316c181e9b65 81 void EwFrameWindow::setBarColor(ewFrameWindowColorIndex_t idx, ewColor_t c) {
embeddedartists 0:316c181e9b65 82 FRAMEWIN_SetBarColor(_hWnd, idx, c);
embeddedartists 0:316c181e9b65 83 }
embeddedartists 0:316c181e9b65 84
embeddedartists 0:316c181e9b65 85 void EwFrameWindow::setBorderSize(uint32_t size) {
embeddedartists 0:316c181e9b65 86 FRAMEWIN_SetBorderSize(_hWnd, size);
embeddedartists 0:316c181e9b65 87 }
embeddedartists 0:316c181e9b65 88
embeddedartists 0:316c181e9b65 89 void EwFrameWindow::setClientColor(ewColor_t c) {
embeddedartists 0:316c181e9b65 90 FRAMEWIN_SetClientColor(_hWnd, c);
embeddedartists 0:316c181e9b65 91 }
embeddedartists 0:316c181e9b65 92
embeddedartists 0:316c181e9b65 93 void EwFrameWindow::setFont(const ewFont_t* pFont) {
embeddedartists 0:316c181e9b65 94 FRAMEWIN_SetFont(_hWnd, pFont);
embeddedartists 0:316c181e9b65 95 }
embeddedartists 0:316c181e9b65 96
embeddedartists 0:316c181e9b65 97 void EwFrameWindow::setMoveable(bool moveable) {
embeddedartists 0:316c181e9b65 98 FRAMEWIN_SetMoveable(_hWnd, (moveable ? 1 : 0));
embeddedartists 0:316c181e9b65 99 }
embeddedartists 0:316c181e9b65 100
embeddedartists 0:316c181e9b65 101 void EwFrameWindow::setResizeable(bool resizeable) {
embeddedartists 0:316c181e9b65 102 FRAMEWIN_SetResizeable(_hWnd, (resizeable ? 1 : 0));
embeddedartists 0:316c181e9b65 103 }
embeddedartists 0:316c181e9b65 104
embeddedartists 0:316c181e9b65 105 void EwFrameWindow::setText(const char* s) {
embeddedartists 0:316c181e9b65 106 FRAMEWIN_SetText(_hWnd, s);
embeddedartists 0:316c181e9b65 107 }
embeddedartists 0:316c181e9b65 108
embeddedartists 0:316c181e9b65 109 void EwFrameWindow::setTextAlign(ewTextAlign_t align) {
embeddedartists 0:316c181e9b65 110 FRAMEWIN_SetTextAlign(_hWnd, align);
embeddedartists 0:316c181e9b65 111 }
embeddedartists 0:316c181e9b65 112
embeddedartists 0:316c181e9b65 113 void EwFrameWindow::setTextColor(ewFrameWindowColorIndex_t idx, ewColor_t c) {
embeddedartists 0:316c181e9b65 114 FRAMEWIN_SetTextColorEx(_hWnd, idx, c);
embeddedartists 0:316c181e9b65 115 }
embeddedartists 0:316c181e9b65 116
embeddedartists 0:316c181e9b65 117 void EwFrameWindow::setTitleHeight(int32_t height) {
embeddedartists 0:316c181e9b65 118 FRAMEWIN_SetTitleHeight(_hWnd, height);
embeddedartists 0:316c181e9b65 119 }
embeddedartists 0:316c181e9b65 120
embeddedartists 0:316c181e9b65 121 void EwFrameWindow::setTitleVisible(bool visible) {
embeddedartists 0:316c181e9b65 122 FRAMEWIN_SetTitleVis(_hWnd, (visible ? 1 : 0));
embeddedartists 0:316c181e9b65 123 }
embeddedartists 0:316c181e9b65 124
embeddedartists 0:316c181e9b65 125
embeddedartists 0:316c181e9b65 126 ewColor_t EwFrameWindow::getDefaultBarColor(ewFrameWindowColorIndex_t idx) {
embeddedartists 0:316c181e9b65 127 return FRAMEWIN_GetDefaultBarColor(idx);
embeddedartists 0:316c181e9b65 128 }
embeddedartists 0:316c181e9b65 129
embeddedartists 0:316c181e9b65 130 int32_t EwFrameWindow::getDefaultBorderSize() {
embeddedartists 0:316c181e9b65 131 return FRAMEWIN_GetDefaultBorderSize();
embeddedartists 0:316c181e9b65 132 }
embeddedartists 0:316c181e9b65 133
embeddedartists 0:316c181e9b65 134 ewColor_t EwFrameWindow::getDefaultClientColor() {
embeddedartists 0:316c181e9b65 135 return FRAMEWIN_GetDefaultClientColor();
embeddedartists 0:316c181e9b65 136 }
embeddedartists 0:316c181e9b65 137
embeddedartists 0:316c181e9b65 138 const ewFont_t* EwFrameWindow::getDefaultFont() {
embeddedartists 0:316c181e9b65 139 return FRAMEWIN_GetDefaultFont();
embeddedartists 0:316c181e9b65 140 }
embeddedartists 0:316c181e9b65 141
embeddedartists 0:316c181e9b65 142 ewColor_t EwFrameWindow::getDefaultTextColor(ewFrameWindowColorIndex_t idx) {
embeddedartists 0:316c181e9b65 143 return FRAMEWIN_GetDefaultTextColor(idx);
embeddedartists 0:316c181e9b65 144 }
embeddedartists 0:316c181e9b65 145
embeddedartists 0:316c181e9b65 146 int32_t EwFrameWindow::getDefaultTitleHeight() {
embeddedartists 0:316c181e9b65 147 return FRAMEWIN_GetDefaultTitleHeight();
embeddedartists 0:316c181e9b65 148 }
embeddedartists 0:316c181e9b65 149
embeddedartists 0:316c181e9b65 150 void EwFrameWindow::setDefaultBarColor(ewFrameWindowColorIndex_t idx, ewColor_t c) {
embeddedartists 0:316c181e9b65 151 FRAMEWIN_SetDefaultBarColor(idx, c);
embeddedartists 0:316c181e9b65 152 }
embeddedartists 0:316c181e9b65 153
embeddedartists 0:316c181e9b65 154 void EwFrameWindow::setDefaultBorderSize(int32_t size) {
embeddedartists 0:316c181e9b65 155 FRAMEWIN_SetDefaultBorderSize(size);
embeddedartists 0:316c181e9b65 156 }
embeddedartists 0:316c181e9b65 157
embeddedartists 0:316c181e9b65 158 void EwFrameWindow::setDefaultClientColor(ewColor_t c) {
embeddedartists 0:316c181e9b65 159 FRAMEWIN_SetDefaultClientColor(c);
embeddedartists 0:316c181e9b65 160 }
embeddedartists 0:316c181e9b65 161
embeddedartists 0:316c181e9b65 162 void EwFrameWindow::setDefaultTextColor(ewFrameWindowColorIndex_t idx, ewColor_t c) {
embeddedartists 0:316c181e9b65 163 FRAMEWIN_SetDefaultTextColor(idx, c);
embeddedartists 0:316c181e9b65 164 }
embeddedartists 0:316c181e9b65 165
embeddedartists 0:316c181e9b65 166 void EwFrameWindow::setDefaultTitleHeight(int32_t height) {
embeddedartists 0:316c181e9b65 167 FRAMEWIN_SetDefaultTitleHeight(height);
embeddedartists 0:316c181e9b65 168 }
embeddedartists 0:316c181e9b65 169
embeddedartists 0:316c181e9b65 170
embeddedartists 0:316c181e9b65 171
embeddedartists 0:316c181e9b65 172 void EwFrameWindow::init(int x, int y, int width, int height, const char* pTitle, EwWindow* parent) {
embeddedartists 0:316c181e9b65 173 FRAMEWIN_Handle h;
embeddedartists 0:316c181e9b65 174 GUI_HWIN hWin = 0;
embeddedartists 0:316c181e9b65 175
embeddedartists 0:316c181e9b65 176 if (parent) {
embeddedartists 0:316c181e9b65 177 hWin = _getHandle(parent);
embeddedartists 0:316c181e9b65 178 }
embeddedartists 0:316c181e9b65 179
embeddedartists 0:316c181e9b65 180 h = FRAMEWIN_CreateEx(x, y, width, height, hWin, (WM_CF_SHOW| WM_CF_MEMDEV),
embeddedartists 0:316c181e9b65 181 FRAMEWIN_CF_MOVEABLE, _guiWidgetId++, pTitle, NULL);
embeddedartists 0:316c181e9b65 182 _setNewHandle(h, NULL);
embeddedartists 0:316c181e9b65 183 }
embeddedartists 0:316c181e9b65 184