mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 17:31:11 +02:00
CComponentsWindow: rework constructors, add CComponentsWindowMax
Member initVarWindow() now used with parameters, so it's possible
to remove multiple code in constructors, but some class must be
renamed to CComponentsWindowMax.
Origin commit data
------------------
Branch: ni/coolstream
Commit: 21e0321c53
Author: Thilo Graf <dbt@novatux.de>
Date: 2014-01-24 (Fri, 24 Jan 2014)
Origin message was:
------------------
CComponentsWindow: rework constructors, add CComponentsWindowMax
Member initVarWindow() now used with parameters, so it's possible
to remove multiple code in constructors, but some class must be
renamed to CComponentsWindowMax.
------------------
This commit was generated by Migit
This commit is contained in:
@@ -38,109 +38,74 @@ using namespace std;
|
||||
CComponentsWindow::CComponentsWindow()
|
||||
{
|
||||
initVarWindow();
|
||||
|
||||
initCCWItems();
|
||||
}
|
||||
|
||||
CComponentsWindow::CComponentsWindow(const std::string& caption, const char* iconname)
|
||||
{
|
||||
initVarWindow();
|
||||
|
||||
ccw_caption = caption;
|
||||
ccw_icon_name = iconname;
|
||||
|
||||
initCCWItems();
|
||||
}
|
||||
|
||||
CComponentsWindow::CComponentsWindow(neutrino_locale_t locale_caption, const char* iconname)
|
||||
{
|
||||
initVarWindow();
|
||||
|
||||
ccw_caption = g_Locale->getText(locale_caption);
|
||||
ccw_icon_name = iconname;
|
||||
|
||||
initCCWItems();
|
||||
}
|
||||
|
||||
CComponentsWindow::CComponentsWindow( const int x_pos, const int y_pos, const int w, const int h,
|
||||
CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
|
||||
neutrino_locale_t locale_caption,
|
||||
const char* iconname,
|
||||
const string& iconname,
|
||||
bool has_shadow,
|
||||
fb_pixel_t color_frame,
|
||||
fb_pixel_t color_body,
|
||||
fb_pixel_t color_shadow)
|
||||
{
|
||||
initVarWindow();
|
||||
|
||||
x = x_pos;
|
||||
y = y_pos;
|
||||
width = w;
|
||||
height = h;
|
||||
shadow = has_shadow;
|
||||
col_frame = color_frame;
|
||||
col_body = color_body;
|
||||
col_shadow = color_shadow;
|
||||
|
||||
ccw_caption = g_Locale->getText(locale_caption);
|
||||
ccw_icon_name = iconname;
|
||||
|
||||
initCCWItems();
|
||||
string s_caption = locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : "";
|
||||
initVarWindow(x_pos, y_pos, w, h, s_caption, iconname, has_shadow, color_frame, color_body, color_shadow);
|
||||
}
|
||||
|
||||
CComponentsWindow::CComponentsWindow( const int x_pos, const int y_pos, const int w, const int h,
|
||||
const std::string& caption,
|
||||
const char* iconname,
|
||||
CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
|
||||
const string& caption,
|
||||
const string& iconname,
|
||||
bool has_shadow,
|
||||
fb_pixel_t color_frame,
|
||||
fb_pixel_t color_body,
|
||||
fb_pixel_t color_shadow)
|
||||
{
|
||||
initVarWindow();
|
||||
|
||||
x = x_pos;
|
||||
y = y_pos;
|
||||
width = w;
|
||||
height = h;
|
||||
shadow = has_shadow;
|
||||
col_frame = color_frame;
|
||||
col_body = color_body;
|
||||
col_shadow = color_shadow;
|
||||
|
||||
ccw_caption = caption;;
|
||||
ccw_icon_name = iconname;
|
||||
|
||||
initCCWItems();
|
||||
initVarWindow(x_pos, y_pos, w, h, caption, iconname, has_shadow, color_frame, color_body, color_shadow);
|
||||
}
|
||||
|
||||
CComponentsWindow::~CComponentsWindow()
|
||||
{
|
||||
#ifdef DEBUG_CC
|
||||
printf("[~CComponentsWindow] [%s - %d] delete...\n", __func__, __LINE__);
|
||||
#endif
|
||||
}
|
||||
CComponentsWindowMax::CComponentsWindowMax(const string& caption, const string& iconname)
|
||||
:CComponentsWindow(0, 0, 0, 0, caption, iconname){};
|
||||
|
||||
void CComponentsWindow::initVarWindow()
|
||||
CComponentsWindowMax::CComponentsWindowMax(neutrino_locale_t locale_caption, const string& iconname)
|
||||
:CComponentsWindow(0, 0, 0, 0, locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : "", iconname){};
|
||||
|
||||
void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
|
||||
const string& caption,
|
||||
const string& iconname,
|
||||
bool has_shadow,
|
||||
fb_pixel_t color_frame,
|
||||
fb_pixel_t color_body,
|
||||
fb_pixel_t color_shadow)
|
||||
{
|
||||
//CComponentsForm
|
||||
cc_item_type = CC_ITEMTYPE_FRM_WINDOW;
|
||||
|
||||
//using current screen settings for default dimensions
|
||||
width = frameBuffer->getScreenWidth();
|
||||
height = frameBuffer->getScreenHeight();
|
||||
x=getScreenStartX(width);
|
||||
y=getScreenStartY(height);
|
||||
//using current screen settings for default dimensions, do centering if default values == 0
|
||||
width = w == 0 ? frameBuffer->getScreenWidth(true) : w;
|
||||
height = h == 0 ? frameBuffer->getScreenHeight(true) : h;
|
||||
x = x_pos == (CC_CENTERED || 0) ? getScreenStartX(width)/2 - width/2 : x_pos;
|
||||
y = y_pos == (CC_CENTERED || 0) ? getScreenStartY(height)/2 - height/2 : y_pos;
|
||||
|
||||
ccw_caption = caption;
|
||||
ccw_icon_name = iconname;
|
||||
#ifdef DEBUG_CC
|
||||
printf("[CComponentsWindow] [%s - %d] icon name = %s\n", __func__, __LINE__, ccw_icon_name.c_str());
|
||||
#endif
|
||||
shadow = has_shadow;
|
||||
col_frame = color_frame;
|
||||
col_body = color_body;
|
||||
col_shadow = color_shadow;
|
||||
|
||||
ccw_head = NULL;
|
||||
ccw_body = NULL;
|
||||
ccw_footer = NULL;
|
||||
ccw_caption = "";
|
||||
ccw_icon_name = NULL;
|
||||
|
||||
ccw_buttons = 0; //no header buttons
|
||||
ccw_show_footer = true;
|
||||
ccw_show_header = true;
|
||||
ccw_align_mode = CTextBox::NO_AUTO_LINEBREAK;
|
||||
|
||||
setShadowOnOff(true);
|
||||
initCCWItems();
|
||||
}
|
||||
|
||||
void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text, const int& align_mode)
|
||||
@@ -163,7 +128,7 @@ void CComponentsWindow::initHeader()
|
||||
// ccw_head->setPos(0, 0);
|
||||
ccw_head->setIcon(ccw_icon_name);
|
||||
ccw_head->setCaption(ccw_caption, ccw_align_mode);
|
||||
ccw_head->initCCItems();
|
||||
// ccw_head->initCCItems();
|
||||
ccw_head->setDefaultButtons(ccw_buttons);
|
||||
}
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ class CComponentsWindow : public CComponentsForm
|
||||
///property: alignment mode for header caption
|
||||
int ccw_align_mode;
|
||||
///property: icon name in header, see also getHeaderObject()
|
||||
const char* ccw_icon_name;
|
||||
std::string ccw_icon_name;
|
||||
///property: assigned default icon buttons in header, see also getHeaderObject()
|
||||
int ccw_buttons;
|
||||
///property: value = true, let show footer, see showFooter()
|
||||
@@ -82,44 +82,40 @@ class CComponentsWindow : public CComponentsForm
|
||||
///initialze all window objects at once
|
||||
void initCCWItems();
|
||||
///initialize all attributes
|
||||
void initVarWindow();
|
||||
void initVarWindow( const int& x_pos = CC_CENTERED, const int& y_pos = CC_CENTERED, const int& w = 0, const int& h = 0,
|
||||
const std::string& caption = "",
|
||||
const std::string& iconname = "",
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
|
||||
public:
|
||||
enum
|
||||
{
|
||||
CC_WINDOW_ITEM_HEADER = 0
|
||||
};
|
||||
///simple constructor for CComponentsWindow
|
||||
///simple constructor for CComponentsWindow, this shows a window over full screen
|
||||
CComponentsWindow();
|
||||
|
||||
///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string
|
||||
CComponentsWindow( const int x_pos, const int y_pos, const int w, const int h,
|
||||
const std::string& caption,
|
||||
const char* iconname = NULL,
|
||||
///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string, x_pos or y_pos = 0 will center window
|
||||
CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
|
||||
const std::string& caption = "",
|
||||
const std::string& iconname = "",
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
|
||||
///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption from locales
|
||||
CComponentsWindow( const int x_pos, const int y_pos, const int w, const int h,
|
||||
neutrino_locale_t locale_caption,
|
||||
const char* iconname = NULL,
|
||||
///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption from locales, x_pos or y_pos = 0 will center window
|
||||
CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
|
||||
neutrino_locale_t locale_text = NONEXISTANT_LOCALE,
|
||||
const std::string& iconname = "",
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
|
||||
///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, position of window is general centered and bound
|
||||
///to current screen settings, this shows a window over full screen
|
||||
CComponentsWindow(const std::string& caption, const char* iconname = NULL);
|
||||
|
||||
///simple constructor for CComponentsWindow, provides parameters for caption from locales and icon, position of window is general centered and bound
|
||||
///to current screen settings, this shows a window over full screen
|
||||
CComponentsWindow(neutrino_locale_t locale_caption, const char* iconname = NULL);
|
||||
|
||||
~CComponentsWindow();
|
||||
|
||||
///add item to body object, also usable is addCCItem() to add items to the windo object
|
||||
void addWindowItem(CComponentsItem* cc_Item);
|
||||
|
||||
@@ -137,7 +133,7 @@ class CComponentsWindow : public CComponentsForm
|
||||
void setWindowCaptionAlignment(const int& align_mode){ccw_align_mode = align_mode;};
|
||||
|
||||
///set icon name in header, see also getHeaderObject()
|
||||
void setWindowIcon(const char* iconname){ccw_icon_name = iconname;};
|
||||
void setWindowIcon(const std::string& iconname){ccw_icon_name = iconname;};
|
||||
|
||||
///set default header icon buttons, see also getHeaderObject()
|
||||
void setWindowHeaderButtons(const int& buttons){ccw_buttons = buttons;};
|
||||
@@ -157,4 +153,16 @@ class CComponentsWindow : public CComponentsForm
|
||||
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||
};
|
||||
|
||||
class CComponentsWindowMax : public CComponentsWindow
|
||||
{
|
||||
public:
|
||||
///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, position of window is general centered and bound
|
||||
///to current screen settings, this shows a window over full screen
|
||||
CComponentsWindowMax(const std::string& caption, const std::string& iconname = "");
|
||||
|
||||
///simple constructor for CComponentsWindow, provides parameters for caption from locales and icon, position of window is general centered and bound
|
||||
///to current screen settings, this shows a window over full screen
|
||||
CComponentsWindowMax(neutrino_locale_t locale_caption, const std::string& iconname = "");
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -181,7 +181,7 @@ void CImageInfo::ShowWindow()
|
||||
{
|
||||
CComponentsFooter *footer = NULL;
|
||||
if (cc_win == NULL){
|
||||
cc_win = new CComponentsWindow(LOCALE_IMAGEINFO_HEAD, NEUTRINO_ICON_INFO);
|
||||
cc_win = new CComponentsWindowMax(LOCALE_IMAGEINFO_HEAD, NEUTRINO_ICON_INFO);
|
||||
cc_win->setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT);
|
||||
footer = cc_win->getFooterObject();
|
||||
footer->setColorBody(COL_INFOBAR_SHADOW_PLUS_1);
|
||||
|
@@ -64,7 +64,7 @@ class CImageInfo : public CMenuTarget
|
||||
void ShowWindow();
|
||||
void ScrollLic(bool scrollDown);
|
||||
|
||||
CComponentsWindow *cc_win;
|
||||
CComponentsWindowMax *cc_win;
|
||||
CComponentsForm *cc_info;
|
||||
CComponentsPIP *cc_tv;
|
||||
CComponentsInfoBox *cc_lic;
|
||||
|
Reference in New Issue
Block a user