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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Display.h Source File

Display.h

00001 /* NeatGUI Library
00002  * Copyright (c) 2013 Neil Thiessen
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef DISPLAY_H
00018 #define DISPLAY_H
00019 
00020 #include "mbed.h"
00021 #include "Canvas.h"
00022 
00023 /** Display abstract class.
00024  *  Used as a base class for Display objects with 2D drawing capabilites.
00025  */
00026 class Display : public Canvas
00027 {
00028 public:
00029     /** Represents the state of the Display
00030      */
00031     enum State {
00032         NOT_INITIALIZED,    /**< Display has not been initialized yet */
00033         DISPLAY_OFF,        /**< Display is initialized and turned off */
00034         DISPLAY_ON          /**< Display is initialized and turned on */
00035     };
00036 
00037     /** Create a Display object with the specified width and height
00038      *
00039      * @param w The display width.
00040      * @param h The display height.
00041      */
00042     Display(int w, int h);
00043 
00044     /** Probe for the display controller and initialize it if present
00045      *
00046      * @returns
00047      *   'true' if the device exists on the bus,
00048      *   'false' if the device doesn't exist on the bus.
00049      */
00050     virtual bool open() = 0;
00051 
00052     /** flush any writes to the Display
00053      */
00054     virtual void flush();
00055 
00056     /** Get the current state of the Display
00057      *
00058      * @returns The current state as a State enum.
00059      */
00060     virtual Display::State state();
00061 
00062     /** Set the state of the Display
00063      *
00064      * @param mode The new state as a State enum.
00065      */
00066     virtual void state(State s);
00067 
00068 protected:
00069     Display::State m_State;
00070 };
00071 
00072 #endif