mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
*neutrino menu: fix 'memory ' of selected items in submenues
Add small helper class to manage missing values e.g. needed for deallocated widget objects. This class we can also use for other things in future! In this context I added a vector for 'selected' values needed for deeper and deallocated submenues. The identification of widgets working now with a new widget parameter named 'w_index'. setSelected() and getSelected() functions are still working, but are not needed, if we use an index -add define for default widget index -add new header file for enums -adapted many menu classes for this parameter Hope it' works fine. If you find any menu without a 'memory', please add an index. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1908 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
@@ -44,6 +44,10 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#define NO_WIDGET_ID -1
|
||||
|
||||
typedef int mn_widget_id_t;
|
||||
|
||||
struct menu_return
|
||||
{
|
||||
enum
|
||||
@@ -371,8 +375,22 @@ class CMenuOptionLanguageChooser : public CMenuItem
|
||||
int exec(CMenuTarget* parent);
|
||||
};
|
||||
|
||||
class CMenuGlobal
|
||||
{
|
||||
public:
|
||||
std::vector<int> v_selected;
|
||||
|
||||
CMenuGlobal();
|
||||
~CMenuGlobal();
|
||||
|
||||
static CMenuGlobal* getInstance();
|
||||
};
|
||||
|
||||
class CMenuWidget : public CMenuTarget
|
||||
{
|
||||
private:
|
||||
mn_widget_id_t widget_index;
|
||||
CMenuGlobal *m;
|
||||
protected:
|
||||
std::string nameString;
|
||||
neutrino_locale_t name;
|
||||
@@ -391,6 +409,7 @@ class CMenuWidget : public CMenuTarget
|
||||
int preselected;
|
||||
int selected;
|
||||
int iconOffset;
|
||||
|
||||
unsigned int item_start_y;
|
||||
unsigned int current_page;
|
||||
unsigned int total_pages;
|
||||
@@ -398,16 +417,16 @@ class CMenuWidget : public CMenuTarget
|
||||
bool from_wizard;
|
||||
bool fade;
|
||||
|
||||
void Init(const std::string & Icon, const int mwidth, const int mheight);
|
||||
void Init(const std::string & Icon, const int mwidth, const int mheight, const mn_widget_id_t &w_index);
|
||||
virtual void paintItems();
|
||||
public:
|
||||
CMenuWidget();
|
||||
/* TODO: mheight is not used anymore. remove if nobody misses it */
|
||||
/* mwidth (minimum width) in percent of screen width */
|
||||
CMenuWidget(const char* Name, const std::string & Icon = "", const int mwidth = 30, const int mheight = 576);
|
||||
CMenuWidget(const neutrino_locale_t Name, const std::string & Icon = "", const int mwidth = 30, const int mheight = 576);
|
||||
CMenuWidget(const char* Name, const std::string & Icon = "", const int mwidth = 30, const int mheight = 576, const mn_widget_id_t &w_index = NO_WIDGET_ID);
|
||||
CMenuWidget(const neutrino_locale_t Name, const std::string & Icon = "", const int mwidth = 30, const int mheight = 576, const mn_widget_id_t &w_index = NO_WIDGET_ID);
|
||||
~CMenuWidget();
|
||||
|
||||
|
||||
virtual void addItem(CMenuItem* menuItem, const bool defaultselected = false);
|
||||
|
||||
enum
|
||||
|
Reference in New Issue
Block a user