mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 08:21:12 +02:00
CComponentsItem: move/rename doCenter()to base class CComponentsItem
So it's possible to use this method for all cc-items. setCenterPos() comes now with parameter 'along_mode' (CC_ALONG_X, CC_ALONG_Y). So it's possible to center in x or y direction. As default are both directions predefined.
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
||||||
|
|
||||||
Copyright (C) 2013, M. Liebmann 'micha-bbg'
|
Copyright (C) 2013, M. Liebmann 'micha-bbg'
|
||||||
Copyright (C) 2013, Thilo Graf 'dbt'
|
Copyright (C) 2013-2014, Thilo Graf 'dbt'
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ CBuildInfo::CBuildInfo() : CComponentsWindow(0, 0, 700, 500, LOCALE_BUILDINFO_ME
|
|||||||
//init all var members
|
//init all var members
|
||||||
void CBuildInfo::initVarBuildInfo()
|
void CBuildInfo::initVarBuildInfo()
|
||||||
{
|
{
|
||||||
doCenter();
|
setCenterPos();
|
||||||
|
|
||||||
font = NULL;
|
font = NULL;
|
||||||
setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT);
|
setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT);
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
||||||
|
|
||||||
Classes for generic GUI-related components.
|
Classes for generic GUI-related components.
|
||||||
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
|
Copyright (C) 2012-2014, Thilo Graf 'dbt'
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -294,6 +294,9 @@ class CComponentsItem : public CComponents
|
|||||||
///set x and y position as percent value from current parent or screen dimensions at once
|
///set x and y position as percent value from current parent or screen dimensions at once
|
||||||
///Note: position of bound components (items) means position related within parent form, not for screen!
|
///Note: position of bound components (items) means position related within parent form, not for screen!
|
||||||
virtual void setPosP(const uint8_t& xpos_percent, const uint8_t& ypos_percent);
|
virtual void setPosP(const uint8_t& xpos_percent, const uint8_t& ypos_percent);
|
||||||
|
|
||||||
|
///do center item on screen or within a parent form, parameter along_mode assigns direction of centering
|
||||||
|
virtual void setCenterPos(int along_mode = CC_ALONG_X | CC_ALONG_Y);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -29,7 +29,6 @@
|
|||||||
#include <global.h>
|
#include <global.h>
|
||||||
#include <neutrino.h>
|
#include <neutrino.h>
|
||||||
#include "cc_frm_window.h"
|
#include "cc_frm_window.h"
|
||||||
#include <driver/screen_max.h>
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@@ -146,11 +145,6 @@ void CComponentsWindow::initWindowPos()
|
|||||||
y = frameBuffer->getScreenY();
|
y = frameBuffer->getScreenY();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsWindow::doCenter(){
|
|
||||||
x = cc_parent ? cc_parent->getWidth() - width/2 : getScreenStartX(width);
|
|
||||||
y = cc_parent ? cc_parent->getHeight() - height/2 : getScreenStartY(height);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text, const int& align_mode)
|
void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text, const int& align_mode)
|
||||||
{
|
{
|
||||||
ccw_caption = g_Locale->getText(locale_text);
|
ccw_caption = g_Locale->getText(locale_text);
|
||||||
|
@@ -90,8 +90,6 @@ class CComponentsWindow : public CComponentsForm
|
|||||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||||
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
|
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
|
||||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||||
///allow centering of window on screen, mostly senseful for window object without parent
|
|
||||||
void doCenter();
|
|
||||||
///initialize width and height
|
///initialize width and height
|
||||||
void initWindowSize();
|
void initWindowSize();
|
||||||
///initialize position
|
///initialize position
|
||||||
|
@@ -182,3 +182,11 @@ void CComponentsItem::setPosP(const uint8_t& xpos_percent, const uint8_t& ypos_p
|
|||||||
setXPosP(xpos_percent);
|
setXPosP(xpos_percent);
|
||||||
setYPosP(ypos_percent);
|
setYPosP(ypos_percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CComponentsItem::setCenterPos(int along_mode)
|
||||||
|
{
|
||||||
|
if (along_mode & CC_ALONG_X)
|
||||||
|
x = cc_parent ? cc_parent->getWidth() - width/2 : getScreenStartX(width);
|
||||||
|
if (along_mode & CC_ALONG_Y)
|
||||||
|
y = cc_parent ? cc_parent->getHeight() - height/2 : getScreenStartY(height);
|
||||||
|
}
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
||||||
|
|
||||||
Classes for generic GUI-related components.
|
Classes for generic GUI-related components.
|
||||||
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
|
Copyright (C) 2012-2014, Thilo Graf 'dbt'
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -110,6 +110,13 @@ enum
|
|||||||
CC_ALIGN_VER_CENTER = 32
|
CC_ALIGN_VER_CENTER = 32
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//item centering modes, see also CComponentsItem::setCenterPos()
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
CC_ALONG_X = 1,
|
||||||
|
CC_ALONG_Y = 2
|
||||||
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
CC_ITEMBOX_ICON,
|
CC_ITEMBOX_ICON,
|
||||||
|
Reference in New Issue
Block a user