send screen names to ESP Insights
Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file Common.h
|
||||
* @brief Common definitions and types for the INSA component
|
||||
* @details This header file contains shared enumerations, type definitions, and
|
||||
* @details This header file contains shared enumerations, type definitions, and
|
||||
* callback function types used throughout the INSA component system.
|
||||
* It provides the foundation for button handling and event management.
|
||||
* @author System Control Team
|
||||
@@ -16,19 +16,19 @@
|
||||
* @enum ButtonType
|
||||
* @brief Enumeration defining the different types of buttons available in the system
|
||||
* @details This enumeration represents all possible button types that can be handled
|
||||
* by the system's input management. NONE represents no button pressed or
|
||||
* by the system's input management. NONE represents no button pressed or
|
||||
* an invalid button state, while the other values correspond to specific
|
||||
* directional and action buttons.
|
||||
*/
|
||||
enum class ButtonType
|
||||
{
|
||||
NONE, ///< No button pressed or invalid button state
|
||||
UP, ///< Up directional button for navigation
|
||||
DOWN, ///< Down directional button for navigation
|
||||
LEFT, ///< Left directional button for navigation
|
||||
RIGHT, ///< Right directional button for navigation
|
||||
NONE, ///< No button pressed or invalid button state
|
||||
UP, ///< Up directional button for navigation
|
||||
DOWN, ///< Down directional button for navigation
|
||||
LEFT, ///< Left directional button for navigation
|
||||
RIGHT, ///< Right directional button for navigation
|
||||
SELECT, ///< Select/confirm button for accepting choices
|
||||
BACK ///< Back/cancel button for returning to previous state
|
||||
BACK ///< Back/cancel button for returning to previous state
|
||||
};
|
||||
|
||||
// Forward declaration of MenuItem to avoid circular dependency
|
||||
@@ -40,13 +40,13 @@ class MenuItem;
|
||||
* @details This function type is used to define callback functions that handle
|
||||
* button press events. The callback receives information about which
|
||||
* button was pressed and any additional context data.
|
||||
*
|
||||
*
|
||||
* @param MenuItem menu item for the specific action
|
||||
* @param ButtonType The type of button that was pressed
|
||||
*
|
||||
*
|
||||
* @note The first parameter can be used to distinguish between multiple instances
|
||||
* of the same button type or to pass additional event-specific data.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* @code
|
||||
* ButtonCallback myCallback = [](const MenuItem& item, ButtonType type) {
|
||||
@@ -59,5 +59,37 @@ class MenuItem;
|
||||
*/
|
||||
typedef std::function<void(MenuItem, ButtonType)> ButtonCallback;
|
||||
|
||||
/**
|
||||
* @def IMPLEMENT_GET_NAME
|
||||
* @brief Macro to implement getName() method using __FILE__
|
||||
* @details Extracts the class name from the source filename automatically.
|
||||
* Use this macro in .cpp files to implement Widget::getName().
|
||||
* @param ClassName The class name for the method scope (e.g., MainMenu)
|
||||
*/
|
||||
#define IMPLEMENT_GET_NAME(ClassName) \
|
||||
const char *ClassName::getName() const \
|
||||
{ \
|
||||
static const char *cachedName = nullptr; \
|
||||
if (!cachedName) \
|
||||
{ \
|
||||
const char *file = __FILE__; \
|
||||
const char *lastSlash = file; \
|
||||
for (const char *p = file; *p; ++p) \
|
||||
{ \
|
||||
if (*p == '/' || *p == '\\') \
|
||||
lastSlash = p + 1; \
|
||||
} \
|
||||
static char buffer[64]; \
|
||||
size_t i = 0; \
|
||||
for (; lastSlash[i] && lastSlash[i] != '.' && i < sizeof(buffer) - 1; ++i) \
|
||||
{ \
|
||||
buffer[i] = lastSlash[i]; \
|
||||
} \
|
||||
buffer[i] = '\0'; \
|
||||
cachedName = buffer; \
|
||||
} \
|
||||
return cachedName; \
|
||||
}
|
||||
|
||||
// Include MenuItem.h after the typedef to avoid circular dependency
|
||||
#include "data/MenuItem.h"
|
||||
Reference in New Issue
Block a user