summaryrefslogtreecommitdiff
path: root/dash
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2015-11-06 19:09:15 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2015-11-06 19:09:15 +0100
commite3a6651ba9c625c6595a1b5965292614068d63cb (patch)
tree9e2d850b5e066a10d54b14eadf5ea664072ec378 /dash
parent5607dfb840e1dcb4d9ab9cffe31753544580ab31 (diff)
PlacesGroup: some code cleanup
(bzr r4008.14.4)
Diffstat (limited to 'dash')
-rwxr-xr-xdash/PlacesGroup.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/dash/PlacesGroup.cpp b/dash/PlacesGroup.cpp
index f0ba9087f..6cd444aa7 100755
--- a/dash/PlacesGroup.cpp
+++ b/dash/PlacesGroup.cpp
@@ -49,14 +49,13 @@ namespace dash
{
namespace
{
-
-const nux::Color kExpandDefaultTextColor(1.0f, 1.0f, 1.0f, 0.5f);
-const float kExpandDefaultIconOpacity = 0.5f;
+const nux::Color EXPAND_DEFAULT_TEXT_COLOR(1.0f, 1.0f, 1.0f, 0.5f);
+const float EXPAND_DEFAULT_ICON_OPACITY = 0.5f;
// Category highlight
-const RawPixel kHighlightRightPadding = 7_em; // FIXME 10 - 3 because the scrollbar is not a real overlay scrollbar!
-const RawPixel kHighlightHeight = 24_em;
-const RawPixel kHighlightLeftPadding = 10_em;
+const RawPixel HIGHLIGHT_RIGHT_PADDING = 10_em;
+const RawPixel HIGHLIGHT_HEIGHT = 24_em;
+const RawPixel HIGHLIGHT_LEFT_PADDING = 10_em;
const RawPixel SPACE_BETWEEN_CHILDREN = 10_em;
const RawPixel TEXT_INTERNAL_MARGIN = 15_em;
const RawPixel EXPAND_INTERNAL_MARGIN = 8_em;
@@ -65,7 +64,6 @@ const double DEFAULT_SCALE = 1.0;
// Font
const char* const NAME_LABEL_FONT = "Ubuntu 13"; // 17px = 13
const char* const EXPANDER_LABEL_FONT = "Ubuntu 10"; // 13px = 10
-
}
class HeaderView : public nux::View
@@ -184,12 +182,12 @@ PlacesGroup::PlacesGroup(dash::StyleInterface& style)
_expand_label->SetLines(-1);
_expand_label->SetTextEllipsize(StaticCairoText::NUX_ELLIPSIZE_END);
_expand_label->SetTextAlignment(StaticCairoText::NUX_ALIGN_LEFT);
- _expand_label->SetTextColor(kExpandDefaultTextColor);
+ _expand_label->SetTextColor(EXPAND_DEFAULT_TEXT_COLOR);
_expand_label_layout->AddView(_expand_label, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
_expand_icon = new IconTexture(_style.GetGroupExpandIcon());
_expand_icon->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
- _expand_icon->SetOpacity(kExpandDefaultIconOpacity);
+ _expand_icon->SetOpacity(EXPAND_DEFAULT_ICON_OPACITY);
_expand_icon->SetVisible(false);
_expand_layout->AddView(_expand_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
@@ -466,9 +464,9 @@ long PlacesGroup::ComputeContentSize()
if (_cached_geometry.GetWidth() != geo.GetWidth())
{
_focus_layer.reset(_style.FocusOverlay(geo.width -
- kHighlightLeftPadding.CP(scale()) -
- kHighlightRightPadding.CP(scale()),
- kHighlightHeight.CP(scale())));
+ HIGHLIGHT_LEFT_PADDING.CP(scale()) -
+ HIGHLIGHT_RIGHT_PADDING.CP(scale()),
+ HIGHLIGHT_HEIGHT.CP(scale())));
_cached_geometry = geo;
}
return ret;
@@ -487,10 +485,10 @@ void PlacesGroup::Draw(nux::GraphicsEngine& graphics_engine,
{
nux::Geometry geo(_header_layout->GetGeometry());
geo.width = base.width -
- kHighlightRightPadding.CP(scale()) -
- kHighlightLeftPadding.CP(scale());
+ HIGHLIGHT_RIGHT_PADDING.CP(scale()) -
+ HIGHLIGHT_LEFT_PADDING.CP(scale());
- geo.x += kHighlightLeftPadding.CP(scale());
+ geo.x += HIGHLIGHT_LEFT_PADDING.CP(scale());
_focus_layer->SetGeometry(geo);
_focus_layer->Renderlayer(graphics_engine);
@@ -500,9 +498,9 @@ void PlacesGroup::Draw(nux::GraphicsEngine& graphics_engine,
{
nux::Geometry bg_geo = base;
int bg_width = _background_layer->GetDeviceTexture()->GetWidth();
- bg_geo.x = std::max(bg_geo.width - bg_width,0);
-
- bg_geo.width = std::min(bg_width, bg_geo.GetWidth()) + 1; // to render into a space left over by the scrollview
+ bg_geo.x = std::max(bg_geo.width - bg_width, 0);
+
+ bg_geo.width = std::min(bg_width, bg_geo.GetWidth()) + (1_em).CP(scale()); // to render into a space left over by the scrollview
bg_geo.height = _background->GetHeight();
_background_layer->SetGeometry(bg_geo);