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.

Committer:
neilt6
Date:
Tue May 27 20:05:29 2014 +0000
Revision:
2:bbfc18022ee5
Numerous changes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
neilt6 2:bbfc18022ee5 1 /* NeatGUI Library
neilt6 2:bbfc18022ee5 2 * Copyright (c) 2014 Neil Thiessen
neilt6 2:bbfc18022ee5 3 *
neilt6 2:bbfc18022ee5 4 * Licensed under the Apache License, Version 2.0 (the "License");
neilt6 2:bbfc18022ee5 5 * you may not use this file except in compliance with the License.
neilt6 2:bbfc18022ee5 6 * You may obtain a copy of the License at
neilt6 2:bbfc18022ee5 7 *
neilt6 2:bbfc18022ee5 8 * http://www.apache.org/licenses/LICENSE-2.0
neilt6 2:bbfc18022ee5 9 *
neilt6 2:bbfc18022ee5 10 * Unless required by applicable law or agreed to in writing, software
neilt6 2:bbfc18022ee5 11 * distributed under the License is distributed on an "AS IS" BASIS,
neilt6 2:bbfc18022ee5 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
neilt6 2:bbfc18022ee5 13 * See the License for the specific language governing permissions and
neilt6 2:bbfc18022ee5 14 * limitations under the License.
neilt6 2:bbfc18022ee5 15 */
neilt6 2:bbfc18022ee5 16
neilt6 2:bbfc18022ee5 17 #ifndef PROGRESS_BAR_H
neilt6 2:bbfc18022ee5 18 #define PROGRESS_BAR_H
neilt6 2:bbfc18022ee5 19
neilt6 2:bbfc18022ee5 20 #include "mbed.h"
neilt6 2:bbfc18022ee5 21 #include "Control.h"
neilt6 2:bbfc18022ee5 22 #include "Font.h"
neilt6 2:bbfc18022ee5 23
neilt6 2:bbfc18022ee5 24 /** ProgressBar class.
neilt6 2:bbfc18022ee5 25 * Used to a percentage as a bar.
neilt6 2:bbfc18022ee5 26 */
neilt6 2:bbfc18022ee5 27 class ProgressBar : public Control
neilt6 2:bbfc18022ee5 28 {
neilt6 2:bbfc18022ee5 29 public:
neilt6 2:bbfc18022ee5 30 /** Create a ProgressBar object with the specified size, position, and font
neilt6 2:bbfc18022ee5 31 *
neilt6 2:bbfc18022ee5 32 * @param x The X coordinate of the ProgressBar.
neilt6 2:bbfc18022ee5 33 * @param y The Y coordinate of the ProgressBar.
neilt6 2:bbfc18022ee5 34 * @param w The width of the ProgressBar.
neilt6 2:bbfc18022ee5 35 * @param h The height of the ProgressBar.
neilt6 2:bbfc18022ee5 36 * @param fnt The font to draw text with.
neilt6 2:bbfc18022ee5 37 */
neilt6 2:bbfc18022ee5 38 ProgressBar(int x, int y, int w, int h, Font *fnt);
neilt6 2:bbfc18022ee5 39
neilt6 2:bbfc18022ee5 40 /** Get the current value of the ProgressBar
neilt6 2:bbfc18022ee5 41 *
neilt6 2:bbfc18022ee5 42 * @returns The current value as a percentage (0.0 to 1.0).
neilt6 2:bbfc18022ee5 43 */
neilt6 2:bbfc18022ee5 44 float value();
neilt6 2:bbfc18022ee5 45
neilt6 2:bbfc18022ee5 46 /** Set the value of the ProgressBar
neilt6 2:bbfc18022ee5 47 *
neilt6 2:bbfc18022ee5 48 * @param v The new progress bar value as a percentage (0.0 to 1.0).
neilt6 2:bbfc18022ee5 49 */
neilt6 2:bbfc18022ee5 50 void value(float v);
neilt6 2:bbfc18022ee5 51
neilt6 2:bbfc18022ee5 52 /** Paint the ProgressBar on the specified canvas
neilt6 2:bbfc18022ee5 53 *
neilt6 2:bbfc18022ee5 54 * @param canvas Pointer to the canvas to paint on.
neilt6 2:bbfc18022ee5 55 */
neilt6 2:bbfc18022ee5 56 virtual void paint(Canvas* canvas);
neilt6 2:bbfc18022ee5 57
neilt6 2:bbfc18022ee5 58 protected:
neilt6 2:bbfc18022ee5 59 //Internal variables
neilt6 2:bbfc18022ee5 60 float m_Value;
neilt6 2:bbfc18022ee5 61 };
neilt6 2:bbfc18022ee5 62
neilt6 2:bbfc18022ee5 63 #endif