summaryrefslogtreecommitdiff
path: root/NxWidgets/libnxwidgets/include
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-17 13:50:02 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-17 13:50:02 +0000
commit925415fbda596e6da11429a72f57f2574ce50844 (patch)
treeee651f9e8843afb0fdec7a023e3f377fbd596052 /NxWidgets/libnxwidgets/include
parentdbda56e617cfde1910ecf6091a76038f44dff65d (diff)
downloadnuttx-925415fbda596e6da11429a72f57f2574ce50844.tar.gz
nuttx-925415fbda596e6da11429a72f57f2574ce50844.tar.bz2
nuttx-925415fbda596e6da11429a72f57f2574ce50844.zip
Patches 7-9 from Petteri Aimonen
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5365 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets/libnxwidgets/include')
-rw-r--r--NxWidgets/libnxwidgets/include/cimage.hxx16
-rw-r--r--NxWidgets/libnxwidgets/include/cnxtimer.hxx55
2 files changed, 29 insertions, 42 deletions
diff --git a/NxWidgets/libnxwidgets/include/cimage.hxx b/NxWidgets/libnxwidgets/include/cimage.hxx
index 0fe275624..6093c5f33 100644
--- a/NxWidgets/libnxwidgets/include/cimage.hxx
+++ b/NxWidgets/libnxwidgets/include/cimage.hxx
@@ -73,7 +73,7 @@
/****************************************************************************
* Included Files
****************************************************************************/
-
+
#include <nuttx/config.h>
#include <stdint.h>
@@ -86,11 +86,11 @@
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
-
+
/****************************************************************************
* Implementation Classes
****************************************************************************/
-
+
#if defined(__cplusplus)
namespace NXWidgets
@@ -120,7 +120,7 @@ namespace NXWidgets
* @param port The CGraphicsPort to draw to.
* @see redraw()
*/
-
+
virtual void drawContents(CGraphicsPort *port);
/**
@@ -150,7 +150,7 @@ namespace NXWidgets
*/
virtual void onPreRelease(nxgl_coord_t x, nxgl_coord_t y);
-
+
/**
* Redraws the image.
*
@@ -202,6 +202,12 @@ namespace NXWidgets
virtual inline ~CImage() { }
/**
+ * Get pointer to the bitmap that this image contains.
+ */
+
+ inline FAR IBitmap *getBitmap() const { return m_bitmap; }
+
+ /**
* Insert the dimensions that this widget wants to have into the rect
* passed in as a parameter. All coordinates are relative to the
* widget's parent.
diff --git a/NxWidgets/libnxwidgets/include/cnxtimer.hxx b/NxWidgets/libnxwidgets/include/cnxtimer.hxx
index be6038dac..d4715b378 100644
--- a/NxWidgets/libnxwidgets/include/cnxtimer.hxx
+++ b/NxWidgets/libnxwidgets/include/cnxtimer.hxx
@@ -80,6 +80,8 @@
#include <stdbool.h>
#include <ctime>
+#include <nuttx/wqueue.h>
+
#include "cnxwidget.hxx"
/****************************************************************************
@@ -108,42 +110,18 @@ namespace NXWidgets
class CNxTimer : public CNxWidget
{
protected:
- FAR timer_t m_timerid; /**< POSIX timer */
+ struct work_s m_work; /**< Work queue entry */
uint32_t m_timeout; /**< The timeout value in milliseconds */
bool m_isRunning; /**< Indicates whether or not the timer is running */
bool m_isRepeater; /**< Indicates whether or not the timer repeats */
/**
- * The SIGALM signal handler that will be called when the timer goes off
- *
- * @param signo The signal number call caused the handler to run (SIGALM)
- */
-
- static void signalHandler(int signo);
-
- /**
- * Handle an expired timer
- */
-
- void handleTimerExpiration(void);
-
- /**
- * Convert a timespec to milliseconds
+ * Static function called from work queue when the timeout expires.
*
- * @param tp The pointer to the timespec to convert
- * @return The corresponding time in milliseconds
+ * @param arg Pointer to the CNxTimer instance.
*/
- uint32_t timespecToMilliseconds(FAR const struct timespec *tp);
-
- /**
- * Convert milliseconds to a timespec
- *
- * @param milliseconds The milliseconds to be converted
- * @param tp The pointer to the location to store the converted timespec
- */
-
- void millisecondsToTimespec(uint32_t milliseconds, FAR struct timespec *tp);
+ static void workQueueCallback(FAR void *arg);
/**
* Copy constructor is protected to prevent usage.
@@ -172,15 +150,6 @@ namespace NXWidgets
~CNxTimer(void);
/**
- * Return the time remaining on this timer.
- *
- * @return The number of milliseconds that this timer runs before
- * firing an event. Zero is returned if the timer is not running.
- */
-
- const uint32_t getTimeout(void);
-
- /**
* Resets the (running) timer to its initial timeout value. This
* call does nothing if the timer is not running.
*/
@@ -212,6 +181,18 @@ namespace NXWidgets
{
m_timeout = timeout;
}
+
+ /**
+ * Return the timeout of this timer.
+ *
+ * @return The number of milliseconds that this timer will run before
+ * firing an event.
+ */
+
+ inline uint32_t getTimeout(void) const
+ {
+ return m_timeout;
+ }
};
}