Fork of LCD-Window which works with Enhanced TextLCD from Wim
Fork of LcdWindow by
subwindow.h@1:65f72ed914fa, 2010-11-16 (annotated)
- Committer:
- hlipka
- Date:
- Tue Nov 16 20:49:18 2010 +0000
- Revision:
- 1:65f72ed914fa
- Parent:
- 0:ae5037e3d6e0
- Child:
- 2:5ac5bab7daaf
minor revision: made use of \const\ in the API
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hlipka | 0:ae5037e3d6e0 | 1 | /* |
hlipka | 0:ae5037e3d6e0 | 2 | * mbed LCDWindow library |
hlipka | 0:ae5037e3d6e0 | 3 | * Copyright (c) 2010 Hendrik Lipka |
hlipka | 0:ae5037e3d6e0 | 4 | * |
hlipka | 0:ae5037e3d6e0 | 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
hlipka | 0:ae5037e3d6e0 | 6 | * of this software and associated documentation files (the "Software"), to deal |
hlipka | 0:ae5037e3d6e0 | 7 | * in the Software without restriction, including without limitation the rights |
hlipka | 0:ae5037e3d6e0 | 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
hlipka | 0:ae5037e3d6e0 | 9 | * copies of the Software, and to permit persons to whom the Software is |
hlipka | 0:ae5037e3d6e0 | 10 | * furnished to do so, subject to the following conditions: |
hlipka | 0:ae5037e3d6e0 | 11 | * |
hlipka | 0:ae5037e3d6e0 | 12 | * The above copyright notice and this permission notice shall be included in |
hlipka | 0:ae5037e3d6e0 | 13 | * all copies or substantial portions of the Software. |
hlipka | 0:ae5037e3d6e0 | 14 | * |
hlipka | 0:ae5037e3d6e0 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
hlipka | 0:ae5037e3d6e0 | 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
hlipka | 0:ae5037e3d6e0 | 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
hlipka | 0:ae5037e3d6e0 | 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
hlipka | 0:ae5037e3d6e0 | 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
hlipka | 0:ae5037e3d6e0 | 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
hlipka | 0:ae5037e3d6e0 | 21 | * THE SOFTWARE. |
hlipka | 0:ae5037e3d6e0 | 22 | */ |
hlipka | 0:ae5037e3d6e0 | 23 | |
hlipka | 0:ae5037e3d6e0 | 24 | #ifndef SUBWINDOW_H_ |
hlipka | 0:ae5037e3d6e0 | 25 | #define SUBWINDOW_H_ |
hlipka | 0:ae5037e3d6e0 | 26 | |
hlipka | 0:ae5037e3d6e0 | 27 | #include "window.h" |
hlipka | 0:ae5037e3d6e0 | 28 | |
hlipka | 0:ae5037e3d6e0 | 29 | /** |
hlipka | 0:ae5037e3d6e0 | 30 | * A window class using only a part of a parent window for output. |
hlipka | 0:ae5037e3d6e0 | 31 | * It is assumed that the sub window fill fit into the parent. |
hlipka | 0:ae5037e3d6e0 | 32 | */ |
hlipka | 0:ae5037e3d6e0 | 33 | class SubWindow: public Window |
hlipka | 0:ae5037e3d6e0 | 34 | { |
hlipka | 0:ae5037e3d6e0 | 35 | public: |
hlipka | 0:ae5037e3d6e0 | 36 | /** |
hlipka | 0:ae5037e3d6e0 | 37 | * It is assumed that the sub window fill fit into the parent. |
hlipka | 0:ae5037e3d6e0 | 38 | * @param lcd the parent window |
hlipka | 0:ae5037e3d6e0 | 39 | * @param offsetX in which column to start the sub window |
hlipka | 0:ae5037e3d6e0 | 40 | * @param offsetY in which line to start the sub window |
hlipka | 0:ae5037e3d6e0 | 41 | * @param width the width of the sub window |
hlipka | 0:ae5037e3d6e0 | 42 | * @param height the height of the sub window |
hlipka | 0:ae5037e3d6e0 | 43 | */ |
hlipka | 1:65f72ed914fa | 44 | SubWindow(Window* lcd, const unsigned int offsetX, const unsigned int offsetY, const unsigned int width, const unsigned int height); |
hlipka | 1:65f72ed914fa | 45 | virtual void writeText(const unsigned int line, const unsigned int pos, const char text[]); |
hlipka | 0:ae5037e3d6e0 | 46 | virtual int getHeight(){return _height;}; |
hlipka | 0:ae5037e3d6e0 | 47 | virtual int getWidth(){return _width;}; |
hlipka | 0:ae5037e3d6e0 | 48 | /** |
hlipka | 0:ae5037e3d6e0 | 49 | * clear the part of the parent window which is spanned by the sub window. |
hlipka | 0:ae5037e3d6e0 | 50 | */ |
hlipka | 0:ae5037e3d6e0 | 51 | virtual void clear(); |
hlipka | 0:ae5037e3d6e0 | 52 | private: |
hlipka | 0:ae5037e3d6e0 | 53 | Window* _lcd; |
hlipka | 0:ae5037e3d6e0 | 54 | unsigned int _offsetX, _offsetY, _width, _height; |
hlipka | 0:ae5037e3d6e0 | 55 | }; |
hlipka | 0:ae5037e3d6e0 | 56 | |
hlipka | 0:ae5037e3d6e0 | 57 | #endif |