Arduino style GUI
Controls/Label.cpp@0:90962b684403, 2016-05-06 (annotated)
- Committer:
- jonebuckman
- Date:
- Fri May 06 16:51:15 2016 +0000
- Revision:
- 0:90962b684403
Updated drivers.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jonebuckman | 0:90962b684403 | 1 | /* NeatGUI Library |
jonebuckman | 0:90962b684403 | 2 | * Copyright (c) 2013 Neil Thiessen |
jonebuckman | 0:90962b684403 | 3 | * |
jonebuckman | 0:90962b684403 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
jonebuckman | 0:90962b684403 | 5 | * you may not use this file except in compliance with the License. |
jonebuckman | 0:90962b684403 | 6 | * You may obtain a copy of the License at |
jonebuckman | 0:90962b684403 | 7 | * |
jonebuckman | 0:90962b684403 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
jonebuckman | 0:90962b684403 | 9 | * |
jonebuckman | 0:90962b684403 | 10 | * Unless required by applicable law or agreed to in writing, software |
jonebuckman | 0:90962b684403 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
jonebuckman | 0:90962b684403 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
jonebuckman | 0:90962b684403 | 13 | * See the License for the specific language governing permissions and |
jonebuckman | 0:90962b684403 | 14 | * limitations under the License. |
jonebuckman | 0:90962b684403 | 15 | */ |
jonebuckman | 0:90962b684403 | 16 | |
jonebuckman | 0:90962b684403 | 17 | #include "Label.h" |
jonebuckman | 0:90962b684403 | 18 | |
jonebuckman | 0:90962b684403 | 19 | Label::Label(int x, int y, int w, int h, Font *fnt) : Control(x, y, w, h) |
jonebuckman | 0:90962b684403 | 20 | { |
jonebuckman | 0:90962b684403 | 21 | text(NULL); |
jonebuckman | 0:90962b684403 | 22 | font(fnt); |
jonebuckman | 0:90962b684403 | 23 | foreColor(0xFFFFFFFF); |
jonebuckman | 0:90962b684403 | 24 | backColor(0xFF000000); |
jonebuckman | 0:90962b684403 | 25 | } |
jonebuckman | 0:90962b684403 | 26 | |
jonebuckman | 0:90962b684403 | 27 | void Label::paint(Canvas* canvas) |
jonebuckman | 0:90962b684403 | 28 | { |
jonebuckman | 0:90962b684403 | 29 | //Paint the base class |
jonebuckman | 0:90962b684403 | 30 | Control::paint(canvas); |
jonebuckman | 0:90962b684403 | 31 | |
jonebuckman | 0:90962b684403 | 32 | //Draw the text if there is any |
jonebuckman | 0:90962b684403 | 33 | if (text() != NULL && font() != NULL) |
jonebuckman | 0:90962b684403 | 34 | canvas->drawString(text(), font(), contentPosX(), contentPosY(), contentWidth(), contentHeight()); |
jonebuckman | 0:90962b684403 | 35 | } |