summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NxWidgets/Kconfig23
-rw-r--r--NxWidgets/libnxwidgets/include/cglyphsliderhorizontal.hxx11
-rw-r--r--NxWidgets/libnxwidgets/include/cnxwidget.hxx2
-rw-r--r--NxWidgets/libnxwidgets/src/cglyphsliderhorizontal.cxx48
-rw-r--r--NxWidgets/libnxwidgets/src/cnxwidget.cxx28
-rw-r--r--NxWidgets/nxwm/include/nxwmconfig.hxx8
-rw-r--r--nuttx/configs/sama5d4-ek/nxwm/defconfig2
7 files changed, 90 insertions, 32 deletions
diff --git a/NxWidgets/Kconfig b/NxWidgets/Kconfig
index 34a96e89d..ec56d09a2 100644
--- a/NxWidgets/Kconfig
+++ b/NxWidgets/Kconfig
@@ -1153,6 +1153,29 @@ config NXWM_MEDIAPLAYER_VOLUMESTEP
---help---
This increment in volume, up or down, when the volume bar is clicked.
+config NXWM_MEDIAPLAYER_MINVOLUMEHEIGHT
+ int "Minimum Player Volume Minimum Height"
+ default 6
+ ---help---
+ The height of the slider is automatically calculated from the height
+ of the grip image. However, we will not let the height of the grip
+ get smaller than this value.
+
+ NOTE: This width includes the size of the slider upper and lower
+ borders.
+
+config NXWM_MEDIAPLAYER_CUSTOM_COLORS
+ bool "Select Custom Media Player Colors"
+ default n
+
+if NXWM_MEDIAPLAYER_CUSTOM_COLORS
+
+ config NXWM_MEDIAPLAYER_VOLUMECOLOR
+ hex "Media Volume Slide Color
+ default 0x0
+
+endif # NXWM_MEDIAPLAYER_CUSTOM_COLORS
+
config NXWM_MEDIAPLAYER_BORDERS
bool "Media Player Button Borders"
default n
diff --git a/NxWidgets/libnxwidgets/include/cglyphsliderhorizontal.hxx b/NxWidgets/libnxwidgets/include/cglyphsliderhorizontal.hxx
index 354a097ac..6d23237b7 100644
--- a/NxWidgets/libnxwidgets/include/cglyphsliderhorizontal.hxx
+++ b/NxWidgets/libnxwidgets/include/cglyphsliderhorizontal.hxx
@@ -174,16 +174,19 @@ namespace NXWidgets
/**
* Constructor.
*
- * @param pWidgetControl The widget control instance for the window.
+ * @param control The widget control instance for the window.
* @param x The x coordinate of the slider, relative to its parent.
* @param y The y coordinate of the slider, relative to its parent.
* @param width The width of the slider.
- * @param height The height of the slider.
+ * @param thickness The thickness of the slider.
+ * @param gripBitmap The slider grip image
+ * @param fillColor The color to use when filling the grip
+ * @param fill True: The grip will be filled with fillColor
*/
- CGlyphSliderHorizontal(CWidgetControl *pWidgetControl,
+ CGlyphSliderHorizontal(CWidgetControl *control,
nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width,
- nxgl_coord_t height, IBitmap *pGripBitmap,
+ nxgl_coord_t thickness, IBitmap *gripBitmap,
nxwidget_pixel_t fillColor, bool fill = true);
/**
diff --git a/NxWidgets/libnxwidgets/include/cnxwidget.hxx b/NxWidgets/libnxwidgets/include/cnxwidget.hxx
index 543c0b24b..a67938d48 100644
--- a/NxWidgets/libnxwidgets/include/cnxwidget.hxx
+++ b/NxWidgets/libnxwidgets/include/cnxwidget.hxx
@@ -170,7 +170,7 @@ namespace NXWidgets
protected:
CWidgetControl *m_widgetControl; /**< The controlling widget for the display */
- CRect m_rect; /**< Rectange bounding the widget. */
+ CRect m_rect; /**< Rectangle bounding the widget. */
// Dragging variables
diff --git a/NxWidgets/libnxwidgets/src/cglyphsliderhorizontal.cxx b/NxWidgets/libnxwidgets/src/cglyphsliderhorizontal.cxx
index da7150ef7..0d6238a39 100644
--- a/NxWidgets/libnxwidgets/src/cglyphsliderhorizontal.cxx
+++ b/NxWidgets/libnxwidgets/src/cglyphsliderhorizontal.cxx
@@ -79,6 +79,7 @@
#include <cstdint>
#include <cstdbool>
+#include "ibitmap.hxx"
#include "cwidgetcontrol.hxx"
#include "cglyphsliderhorizontal.hxx"
#include "cglyphsliderhorizontalgrip.hxx"
@@ -98,20 +99,24 @@ using namespace NXWidgets;
/**
* Constructor.
*
- * @param pWidgetControl The controlling widget for the display
+ * @param control The widget control instance for the window.
* @param x The x coordinate of the slider, relative to its parent.
* @param y The y coordinate of the slider, relative to its parent.
* @param width The width of the slider.
- * @param height The height of the slider.
+ * @param thickness The thickness of the slider.
+ * @param gripBitmap The slider grip image
+ * @param fillColor The color to use when filling the grip
+ * @param fill True: The grip will be filled with fillColor
*/
-CGlyphSliderHorizontal::CGlyphSliderHorizontal(CWidgetControl * pWidgetControl,
- nxgl_coord_t x, nxgl_coord_t y,
- nxgl_coord_t width, nxgl_coord_t height,
- IBitmap * pGripBitmap,
- nxwidget_pixel_t fillColor, bool fill)
-:CNxWidget(pWidgetControl, x, y, width, height, WIDGET_DRAGGABLE)
+CGlyphSliderHorizontal::CGlyphSliderHorizontal(CWidgetControl *control,
+ nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width,
+ nxgl_coord_t thickness, IBitmap *gripBitmap,
+ nxwidget_pixel_t fillColor, bool fill)
+:CNxWidget(control, x, y, width, thickness, WIDGET_DRAGGABLE)
{
+ // Initialize state data
+
m_minimumValue = 0;
m_maximumValue = 0;
m_contentSize = 0;
@@ -120,22 +125,39 @@ CGlyphSliderHorizontal::CGlyphSliderHorizontal(CWidgetControl * pWidgetControl,
m_pageSize = 1;
m_fillColor = fillColor;
m_fill = fill;
- m_barThickness = 8;
+ m_barThickness = thickness;
+
+ // Correct the height of the widget. The widget height was initially set
+ // to the thickness of the grip. But the grip image is normally a little
+ // taller than the slider is thick.
+ //
+ // Do use the resize method here; we are not ready for the resize events.
+
+ nxgl_coord_t gripHeight = gripBitmap->getHeight() + 4;
+ if (gripHeight > thickness)
+ {
+ // Reset the widget height to the height of the grip image
+
+ m_rect.setHeight(gripHeight);
+ }
+
+ // Set widget attributes
m_flags.permeable = false;
m_flags.borderless = false;
m_flags.doubleClickable = false;
- // Create grip
+ // Set the "gutter" width
CRect rect;
getClientRect(rect);
m_gutterWidth = rect.getWidth();
- // Create grip
+ // Create the grip
- m_grip = new CGlyphSliderHorizontalGrip(pWidgetControl, x, y,
- width, height, pGripBitmap);
+ m_grip = new CGlyphSliderHorizontalGrip(control, x, y,
+ gripBitmap->getWidth() + 4,
+ gripHeight, gripBitmap);
m_grip->setBorderless(true);
m_grip->addWidgetEventHandler(this);
addWidget(m_grip);
diff --git a/NxWidgets/libnxwidgets/src/cnxwidget.cxx b/NxWidgets/libnxwidgets/src/cnxwidget.cxx
index c0c406dde..6d6ddb7b8 100644
--- a/NxWidgets/libnxwidgets/src/cnxwidget.cxx
+++ b/NxWidgets/libnxwidgets/src/cnxwidget.cxx
@@ -158,10 +158,10 @@ CNxWidget::CNxWidget(CWidgetControl *pWidgetControl,
// Dragging values
- m_grabPointX = 0;
- m_grabPointY = 0;
- m_newX = 0;
- m_newY = 0;
+ m_grabPointX = 0;
+ m_grabPointY = 0;
+ m_newX = 0;
+ m_newY = 0;
// Set initial flag values
@@ -177,24 +177,24 @@ CNxWidget::CNxWidget(CWidgetControl *pWidgetControl,
// Set hierarchy pointers
- m_parent = (CNxWidget *)NULL;
- m_focusedChild = (CNxWidget *)NULL;
+ m_parent = (CNxWidget *)NULL;
+ m_focusedChild = (CNxWidget *)NULL;
// Double-click
clock_gettime(CLOCK_REALTIME, &m_lastClickTime);
- m_lastClickX = 0;
- m_lastClickY = 0;
- m_doubleClickBounds = DOUBLE_CLICK_BOUNDS;
+ m_lastClickX = 0;
+ m_lastClickY = 0;
+ m_doubleClickBounds = DOUBLE_CLICK_BOUNDS;
// Set border size to 1 line
- m_borderSize.top = 1;
- m_borderSize.right = 1;
- m_borderSize.bottom = 1;
- m_borderSize.left = 1;
+ m_borderSize.top = 1;
+ m_borderSize.right = 1;
+ m_borderSize.bottom = 1;
+ m_borderSize.left = 1;
- m_widgetEventHandlers = new CWidgetEventHandlerList(this);
+ m_widgetEventHandlers = new CWidgetEventHandlerList(this);
}
/**
diff --git a/NxWidgets/nxwm/include/nxwmconfig.hxx b/NxWidgets/nxwm/include/nxwmconfig.hxx
index 7a4c4ff8d..4160fbae7 100644
--- a/NxWidgets/nxwm/include/nxwmconfig.hxx
+++ b/NxWidgets/nxwm/include/nxwmconfig.hxx
@@ -648,6 +648,14 @@
# define CONFIG_NXWM_MEDIAPLAYER_VOLUMESTEP 5
#endif
+#ifndef CONFIG_NXWM_MEDIAPLAYER_MINVOLUMEHEIGHT
+# define CONFIG_NXWM_MEDIAPLAYER_MINVOLUMEHEIGHT 6
+#endif
+
+#ifndef CONFIG_NXWM_MEDIAPLAYER_VOLUMECOLOR
+# define CONFIG_NXWM_MEDIAPLAYER_VOLUMECOLOR MKRGB(63,90,192)
+#endif
+
#ifndef CONFIG_NXWM_MEDIAPLAYER_ICON
# define CONFIG_NXWM_MEDIAPLAYER_ICON NxWM::g_mediaplayerBitmap
#endif
diff --git a/nuttx/configs/sama5d4-ek/nxwm/defconfig b/nuttx/configs/sama5d4-ek/nxwm/defconfig
index 01ede6c98..83318652b 100644
--- a/nuttx/configs/sama5d4-ek/nxwm/defconfig
+++ b/nuttx/configs/sama5d4-ek/nxwm/defconfig
@@ -1410,6 +1410,8 @@ CONFIG_NXWM_MEDIAPLAYER=y
CONFIG_NXWM_MEDIAPLAYER_MEDIAPATH="/mnt/sdcard"
CONFIG_NXWM_MEDIAPLAYER_XSPACING=12
CONFIG_NXWM_MEDIAPLAYER_YSPACING=16
+CONFIG_NXWM_MEDIAPLAYER_VOLUMESTEP=5
+# CONFIG_NXWM_MEDIAPLAYER_CUSTOM_COLORS is not set
# CONFIG_NXWM_MEDIAPLAYER_BORDERS is not set
#