mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 23:13:13 +02:00
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.
This commit is contained in:
@@ -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)
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user