A simple yet powerful library for controlling graphical displays. Multiple display controllers are supported using inheritance.
Dependents: mbed_rifletool Hexi_Bubble_Game Hexi_Catch-the-dot_Game Hexi_Acceleromagnetic_Synth
NOTE: This library is in beta right now. As far as I know, everything here works, but there are many features that are lacking so far. Most notably containers, button handling, and display drivers other than the SSD1306.
Controls/Label.cpp@2:bbfc18022ee5, 2014-05-27 (annotated)
- Committer:
- neilt6
- Date:
- Tue May 27 20:05:29 2014 +0000
- Revision:
- 2:bbfc18022ee5
- Parent:
- Controls/TextBox.cpp@1:f7003ec66a51
- Child:
- 3:a8f72d4864e6
Numerous changes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
neilt6 | 0:b876cf091464 | 1 | /* NeatGUI Library |
neilt6 | 0:b876cf091464 | 2 | * Copyright (c) 2013 Neil Thiessen |
neilt6 | 0:b876cf091464 | 3 | * |
neilt6 | 0:b876cf091464 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
neilt6 | 0:b876cf091464 | 5 | * you may not use this file except in compliance with the License. |
neilt6 | 0:b876cf091464 | 6 | * You may obtain a copy of the License at |
neilt6 | 0:b876cf091464 | 7 | * |
neilt6 | 0:b876cf091464 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
neilt6 | 0:b876cf091464 | 9 | * |
neilt6 | 0:b876cf091464 | 10 | * Unless required by applicable law or agreed to in writing, software |
neilt6 | 0:b876cf091464 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
neilt6 | 0:b876cf091464 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
neilt6 | 0:b876cf091464 | 13 | * See the License for the specific language governing permissions and |
neilt6 | 0:b876cf091464 | 14 | * limitations under the License. |
neilt6 | 0:b876cf091464 | 15 | */ |
neilt6 | 0:b876cf091464 | 16 | |
neilt6 | 2:bbfc18022ee5 | 17 | #include "Label.h" |
neilt6 | 0:b876cf091464 | 18 | |
neilt6 | 2:bbfc18022ee5 | 19 | Label::Label(int x, int y, int w, int h, Font *fnt) : Control(x, y, w, h) |
neilt6 | 0:b876cf091464 | 20 | { |
neilt6 | 0:b876cf091464 | 21 | m_Text = NULL; |
neilt6 | 0:b876cf091464 | 22 | m_Font = fnt; |
neilt6 | 0:b876cf091464 | 23 | border(1); |
neilt6 | 0:b876cf091464 | 24 | padding(1); |
neilt6 | 0:b876cf091464 | 25 | foreColor(0xFFFFFFFF); |
neilt6 | 0:b876cf091464 | 26 | backColor(0xFF000000); |
neilt6 | 0:b876cf091464 | 27 | } |
neilt6 | 0:b876cf091464 | 28 | |
neilt6 | 2:bbfc18022ee5 | 29 | void Label::paint(Canvas* canvas) |
neilt6 | 0:b876cf091464 | 30 | { |
neilt6 | 0:b876cf091464 | 31 | //Paint the base class |
neilt6 | 0:b876cf091464 | 32 | Control::paint(canvas); |
neilt6 | 0:b876cf091464 | 33 | |
neilt6 | 0:b876cf091464 | 34 | //Draw the text if there is any |
neilt6 | 0:b876cf091464 | 35 | if (m_Text != NULL && m_Font != NULL) |
neilt6 | 0:b876cf091464 | 36 | canvas->drawString(m_Text, m_Font, contentPosX(), contentPosY(), contentWidth(), contentHeight()); |
neilt6 | 0:b876cf091464 | 37 | } |