mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 07:51:11 +02:00
menue.cpp/h: modify move behavior of menu window for custom position
MENU_POS_PRESET is replaced with MENU_POS_CUSTOM. This allows
with methode setPos() to any position on screen without preset offset.
Old behavior is untouched.
Origin commit data
------------------
Branch: ni/coolstream
Commit: 8174f094e6
Author: Thilo Graf <dbt@novatux.de>
Date: 2022-03-27 (Sun, 27 Mar 2022)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -1380,6 +1380,7 @@ int CTestMenu::showTestMenu()
|
||||
w_test.addItem(new CMenuForwarder("Shell Window Test", true, NULL, this, "shellwindow"));
|
||||
// hardware
|
||||
CMenuWidget *w_hw = new CMenuWidget("Hardware Test", NEUTRINO_ICON_INFO, width, MN_WIDGET_ID_TESTMENU_HARDWARE);
|
||||
w_hw->setPos(20, 50);
|
||||
w_test.addItem(new CMenuForwarder(w_hw->getName(), true, NULL, w_hw));
|
||||
showHWTests(w_hw);
|
||||
|
||||
|
@@ -642,7 +642,7 @@ void CMenuWidget::Init(const std::string &NameString, const std::string &Icon, c
|
||||
//pos
|
||||
x = y = 0;
|
||||
height = 0;
|
||||
w_pos_mode = MENU_POS_PRESET;
|
||||
w_pos_mode = g_settings.menu_pos;
|
||||
|
||||
//caption and icon
|
||||
nameString = NameString;
|
||||
@@ -718,6 +718,13 @@ void CMenuWidget::move(int xoff, int yoff)
|
||||
offy = yoff;
|
||||
}
|
||||
|
||||
void CMenuWidget::setPos(int X, int Y)
|
||||
{
|
||||
x = X;
|
||||
y = Y;
|
||||
w_pos_mode = MENU_POS_CUSTOM;
|
||||
}
|
||||
|
||||
CMenuWidget::~CMenuWidget()
|
||||
{
|
||||
resetWidget(true);
|
||||
@@ -1489,32 +1496,34 @@ void CMenuWidget::setMenuPos(const int& menu_width)
|
||||
int y_old = y;
|
||||
|
||||
//configured/custom positions
|
||||
int menu_pos = w_pos_mode == MENU_POS_PRESET ? g_settings.menu_pos : w_pos_mode;
|
||||
int menu_pos = g_settings.menu_pos;
|
||||
if (w_pos_mode == MENU_POS_CUSTOM)
|
||||
menu_pos = MENU_POS_CUSTOM;
|
||||
|
||||
switch(menu_pos)
|
||||
{
|
||||
case MENU_POS_CUSTOM:
|
||||
x += DETAILSLINE_WIDTH;
|
||||
break;
|
||||
case MENU_POS_CENTER:
|
||||
x = offx + scr_x + ((scr_w - menu_width ) >> 1 );
|
||||
y = offy + scr_y + ((scr_h - real_h) >> 1 );
|
||||
//x += DETAILSLINE_WIDTH;
|
||||
break;
|
||||
|
||||
case MENU_POS_TOP_LEFT:
|
||||
y = offy + scr_y + OFFSET_INNER_MID;
|
||||
x = offx + scr_x + OFFSET_INNER_MID;
|
||||
x += g_settings.show_menu_hints_line ? DETAILSLINE_WIDTH : 0; //NI
|
||||
break;
|
||||
|
||||
case MENU_POS_TOP_RIGHT:
|
||||
y = offy + scr_y + OFFSET_INNER_MID;
|
||||
x = /*offx +*/ scr_x + scr_w - menu_width - OFFSET_INNER_MID;
|
||||
break;
|
||||
|
||||
case MENU_POS_BOTTOM_LEFT:
|
||||
y = /*offy +*/ scr_y + scr_h - real_h - OFFSET_INNER_MID;
|
||||
x = offx + scr_x + OFFSET_INNER_MID;
|
||||
x += g_settings.show_menu_hints_line ? DETAILSLINE_WIDTH : 0; //NI
|
||||
break;
|
||||
|
||||
case MENU_POS_BOTTOM_RIGHT:
|
||||
y = /*offy +*/ scr_y + scr_h - real_h - OFFSET_INNER_MID;
|
||||
x = /*offx +*/ scr_x + scr_w - menu_width - OFFSET_INNER_MID;
|
||||
|
@@ -652,6 +652,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals
|
||||
void initSelectable();
|
||||
int getSelected()const { return selected; };
|
||||
void move(int xoff, int yoff);
|
||||
void setPos(int X, int Y);
|
||||
int getHeight() {calcSize(); return full_height;}
|
||||
int getFullWidth() {calcSize(); return full_width;}
|
||||
int getWidth() {calcSize(); return full_width - DETAILSLINE_WIDTH;}
|
||||
@@ -670,7 +671,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals
|
||||
MENU_POS_BOTTOM_LEFT ,
|
||||
MENU_POS_BOTTOM_RIGHT ,
|
||||
|
||||
MENU_POS_PRESET
|
||||
MENU_POS_CUSTOM
|
||||
};
|
||||
void addKey(neutrino_msg_t key, CMenuTarget *menue, const std::string &action);
|
||||
void setFooter(const struct button_label *_fbutton_label, const int _fbutton_count, bool repaint = false);
|
||||
|
Reference in New Issue
Block a user