widget/menu: add member 'type_name' to CMenuItem class

This makes it easier to distinguish the object type. Normally,
type queries would be done using typeid-operation or dynamic_cast,
but we usually have RTTI disabled in the Makefiles. Presumably,
this is to avoid unnecessarily increasing the size of the binaries.
The type information defined by this member is currently only defined
in the CMenuItem class, so all subclasses are also equipped with it.
An exception is the CMenuSeparator class. If further definitions are
necessary in the subclasses, they can be retrofitted as needed.


Origin commit data
------------------
Branch: ni/coolstream
Commit: 2cd470cd59
Author: Thilo Graf <dbt@novatux.de>
Date: 2023-02-19 (Sun, 19 Feb 2023)



------------------
This commit was generated by Migit
This commit is contained in:
2023-02-19 22:33:10 +01:00
committed by vanhofen
parent 08ec035090
commit 5365a394be
2 changed files with 3 additions and 0 deletions

View File

@@ -68,6 +68,7 @@ CMenuItem::CMenuItem(bool Active, neutrino_msg_t DirectKey, const char * const I
active = current_active = Active;
directKey = DirectKey;
isStatic = IsStatic;
type_name = "CMenuItem";
if (IconName && *IconName)
iconName = IconName;
@@ -2512,6 +2513,7 @@ void CMenuSeparator::init(const int& Type, const neutrino_locale_t& lText, const
type = Type;
name = lText;
nameString = sText;
type_name = "CMenuSeparator";
}
int CMenuSeparator::getHeight(void)

View File

@@ -134,6 +134,7 @@ class CMenuItem : public CComponentsSignals
void handleOptionIcon(const std::string& str_option);
const char* getValName(const neutrino_locale_t& Option, const char* ValName);
public:
std::string type_name;
int height;
bool active, current_active;
bool marked;