summaryrefslogtreecommitdiff
path: root/NxWidgets/nxwm/include
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-07-16 11:11:55 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-07-16 11:11:55 -0600
commit789172023edd1e4d082824983cb4ac8c59d00b95 (patch)
treee8d88c24026c15cd19094464bffc823e19407480 /NxWidgets/nxwm/include
parent8e932634ac53d6ac42d60d805ccee4e2e285aa72 (diff)
downloadnuttx-789172023edd1e4d082824983cb4ac8c59d00b95.tar.gz
nuttx-789172023edd1e4d082824983cb4ac8c59d00b95.tar.bz2
nuttx-789172023edd1e4d082824983cb4ac8c59d00b95.zip
NxWM::CMediaPlayer: Fix of state related bugs + Size if CLabel is increased (in preparation for becoming a CListBox)
Diffstat (limited to 'NxWidgets/nxwm/include')
-rw-r--r--NxWidgets/nxwm/include/cmediaplayer.hxx28
-rw-r--r--NxWidgets/nxwm/include/nxwmconfig.hxx12
2 files changed, 35 insertions, 5 deletions
diff --git a/NxWidgets/nxwm/include/cmediaplayer.hxx b/NxWidgets/nxwm/include/cmediaplayer.hxx
index 6d803b537..bf4ff61f4 100644
--- a/NxWidgets/nxwm/include/cmediaplayer.hxx
+++ b/NxWidgets/nxwm/include/cmediaplayer.hxx
@@ -117,6 +117,7 @@ namespace NxWM
enum EMediaPlayerState m_state; /**< Media player current state */
enum EMediaPlayerState m_prevState; /**< Media player previous state */
enum EPendingRelease m_pending; /**< Pending image release event */
+ unsigned int m_level; /**< Current volume level */
/**
* Cached constructor parameters.
@@ -148,6 +149,7 @@ namespace NxWM
NXWidgets::CRlePaletteBitmap *m_pauseBitmap; /**< Bitmap for the pause control */
NXWidgets::CRlePaletteBitmap *m_rewindBitmap; /**< Bitmap for the rewind control */
NXWidgets::CRlePaletteBitmap *m_fforwardBitmap; /**< Bitmap for the fast forward control */
+ NXWidgets::CRlePaletteBitmap *m_volumeBitmap; /**< Volume control grip bitmap */
/**
* Calculator geometry. This stuff does not really have to be retained
@@ -156,7 +158,6 @@ namespace NxWM
struct nxgl_size_s m_windowSize; /**< The size of the media player window */
struct nxgl_size_s m_textSize; /**< The size of the media player textbox */
- struct nxgl_point_s m_textPos; /**< The position of the media player textbox */
/**
* Select the geometry of the media player given the current window size.
@@ -185,6 +186,15 @@ namespace NxWM
void close(void);
/**
+ * Redraw all widgets. Called from redraw() and also on any state
+ * change.
+ *
+ * @param state The new state to enter.
+ */
+
+ void redrawWidgets(void);
+
+ /**
* Transition to a new media player state.
*
* @param state The new state to enter.
@@ -193,8 +203,14 @@ namespace NxWM
void setMediaPlayerState(enum EMediaPlayerState state);
/**
- * Handle a widget action event. This includes a image pre/release
- * release events and volume slider change events.
+ * Set the new volume level based on the position of the volume slider.
+ */
+
+ void setVolumeLevel(void);
+
+ /**
+ * Handle a widget action event. For this application, that means image
+ * pre-release events.
*
* @param e The event data.
*/
@@ -216,6 +232,12 @@ namespace NxWM
void handleReleaseOutsideEvent(const NXWidgets::CWidgetEventArgs &e);
+ /**
+ * Handle changes in the volume level.
+ */
+
+ void handleValueChangeEvent(const NXWidgets::CWidgetEventArgs &e);
+
public:
/**
* CMediaPlayer constructor
diff --git a/NxWidgets/nxwm/include/nxwmconfig.hxx b/NxWidgets/nxwm/include/nxwmconfig.hxx
index c6781bcd5..40689c0f5 100644
--- a/NxWidgets/nxwm/include/nxwmconfig.hxx
+++ b/NxWidgets/nxwm/include/nxwmconfig.hxx
@@ -1,7 +1,7 @@
/****************************************************************************
* NxWidgets/nxwm/include/nxwmconfig.hxx
*
- * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -628,12 +628,20 @@
* Default: CONFIG_NXWM_DEFAULT_FONTID
*/
+#ifndef CONFIG_NXWM_MEDIAPLAYER_MEDIAPATH
+# define CONFIG_NXWM_MEDIAPLAYER_MEDIAPATH "/mnt/sdcard"
+#endif
+
#ifndef CONFIG_NXWM_MEDIAPLAYER_BACKGROUNDCOLOR
# define CONFIG_NXWM_MEDIAPLAYER_BACKGROUNDCOLOR CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR
#endif
#ifndef CONFIG_NXWM_MEDIAPLAYER_XSPACING
-# define CONFIG_NXWM_MEDIAPLAYER_XSPACING 16
+# define CONFIG_NXWM_MEDIAPLAYER_XSPACING 12
+#endif
+
+#ifndef CONFIG_NXWM_MEDIAPLAYER_YSPACING
+# define CONFIG_NXWM_MEDIAPLAYER_YSPACING 8
#endif
#ifndef CONFIG_NXWM_MEDIAPLAYER_ICON