diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-07-17 12:14:04 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-07-17 12:14:04 -0600 |
commit | 854fad2518f8dae1a39be55223c31738dd56f42c (patch) | |
tree | f5c3af51af8224fbf0c7472a3109464fdeb7f793 /NxWidgets/nxwm/src | |
parent | 1b928ea22fbe5e63c5fbfd9a9051eb40512a6665 (diff) | |
download | nuttx-854fad2518f8dae1a39be55223c31738dd56f42c.tar.gz nuttx-854fad2518f8dae1a39be55223c31738dd56f42c.tar.bz2 nuttx-854fad2518f8dae1a39be55223c31738dd56f42c.zip |
NxWM::CMediaPlayer: Now calculates the volume slider height from the grip image height
Diffstat (limited to 'NxWidgets/nxwm/src')
-rw-r--r-- | NxWidgets/nxwm/src/cmediaplayer.cxx | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/NxWidgets/nxwm/src/cmediaplayer.cxx b/NxWidgets/nxwm/src/cmediaplayer.cxx index caaeffed3..0c4831076 100644 --- a/NxWidgets/nxwm/src/cmediaplayer.cxx +++ b/NxWidgets/nxwm/src/cmediaplayer.cxx @@ -698,15 +698,21 @@ bool CMediaPlayer::createPlayer(void) // Create the Volume control - uint32_t volumeControlX = (9 * m_windowSize.w) >> 8; + uint32_t volumeControlX = (9 * (uint32_t)m_windowSize.w) >> 8; + nxgl_coord_t volumeControlW = (nxgl_coord_t)(m_windowSize.w - 2 * volumeControlX); + nxgl_coord_t volumeControlH = m_volumeBitmap->getHeight() - 4; + + // Don't let the height of the volume control get too small + + if (volumeControlH < CONFIG_NXWM_MEDIAPLAYER_MINVOLUMEHEIGHT) + { + volumeControlH = CONFIG_NXWM_MEDIAPLAYER_MINVOLUMEHEIGHT; + } m_volume = new NXWidgets:: - CGlyphSliderHorizontal(control, - (nxgl_coord_t)volumeControlX, - volumeTop, - (nxgl_coord_t)(m_windowSize.w - 2 * volumeControlX), - m_volumeBitmap->getHeight() + 4, m_volumeBitmap, - MKRGB(63, 90,192)); + CGlyphSliderHorizontal(control, (nxgl_coord_t)volumeControlX, volumeTop, + volumeControlW, volumeControlH, m_volumeBitmap, + CONFIG_NXWM_MEDIAPLAYER_VOLUMECOLOR); if (!m_volume) { |