Arduino style GUI
Controls/ProgressBar.h@4:d353b314d244, 2019-02-27 (annotated)
- Committer:
- jonebuckman
- Date:
- Wed Feb 27 22:34:06 2019 +0000
- Revision:
- 4:d353b314d244
- Parent:
- 0:90962b684403
Updated writeCommand and writeData.
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) 2014 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 | #ifndef PROGRESS_BAR_H |
jonebuckman | 0:90962b684403 | 18 | #define PROGRESS_BAR_H |
jonebuckman | 0:90962b684403 | 19 | |
jonebuckman | 0:90962b684403 | 20 | #include "mbed.h" |
jonebuckman | 0:90962b684403 | 21 | #include "Control.h" |
jonebuckman | 0:90962b684403 | 22 | #include "Font.h" |
jonebuckman | 0:90962b684403 | 23 | |
jonebuckman | 0:90962b684403 | 24 | /** ProgressBar class. |
jonebuckman | 0:90962b684403 | 25 | * Used to a percentage as a bar. |
jonebuckman | 0:90962b684403 | 26 | */ |
jonebuckman | 0:90962b684403 | 27 | class ProgressBar : public Control |
jonebuckman | 0:90962b684403 | 28 | { |
jonebuckman | 0:90962b684403 | 29 | public: |
jonebuckman | 0:90962b684403 | 30 | /** Create a ProgressBar object with the specified size, position, and font |
jonebuckman | 0:90962b684403 | 31 | * |
jonebuckman | 0:90962b684403 | 32 | * @param x The X coordinate of the ProgressBar. |
jonebuckman | 0:90962b684403 | 33 | * @param y The Y coordinate of the ProgressBar. |
jonebuckman | 0:90962b684403 | 34 | * @param w The width of the ProgressBar. |
jonebuckman | 0:90962b684403 | 35 | * @param h The height of the ProgressBar. |
jonebuckman | 0:90962b684403 | 36 | * @param fnt The font to draw text with. |
jonebuckman | 0:90962b684403 | 37 | */ |
jonebuckman | 0:90962b684403 | 38 | ProgressBar(int x, int y, int w, int h, Font *fnt); |
jonebuckman | 0:90962b684403 | 39 | |
jonebuckman | 0:90962b684403 | 40 | /** Get the current value of the ProgressBar |
jonebuckman | 0:90962b684403 | 41 | * |
jonebuckman | 0:90962b684403 | 42 | * @returns The current value as a percentage (0.0 to 1.0). |
jonebuckman | 0:90962b684403 | 43 | */ |
jonebuckman | 0:90962b684403 | 44 | float value(); |
jonebuckman | 0:90962b684403 | 45 | |
jonebuckman | 0:90962b684403 | 46 | /** Set the value of the ProgressBar |
jonebuckman | 0:90962b684403 | 47 | * |
jonebuckman | 0:90962b684403 | 48 | * @param v The new progress bar value as a percentage (0.0 to 1.0). |
jonebuckman | 0:90962b684403 | 49 | */ |
jonebuckman | 0:90962b684403 | 50 | void value(float v); |
jonebuckman | 0:90962b684403 | 51 | |
jonebuckman | 0:90962b684403 | 52 | /** Paint the ProgressBar on the specified canvas |
jonebuckman | 0:90962b684403 | 53 | * |
jonebuckman | 0:90962b684403 | 54 | * @param canvas Pointer to the canvas to paint on. |
jonebuckman | 0:90962b684403 | 55 | */ |
jonebuckman | 0:90962b684403 | 56 | virtual void paint(Canvas* canvas); |
jonebuckman | 0:90962b684403 | 57 | |
jonebuckman | 0:90962b684403 | 58 | protected: |
jonebuckman | 0:90962b684403 | 59 | //Internal variables |
jonebuckman | 0:90962b684403 | 60 | float m_Value; |
jonebuckman | 0:90962b684403 | 61 | }; |
jonebuckman | 0:90962b684403 | 62 | |
jonebuckman | 0:90962b684403 | 63 | #endif |