summaryrefslogtreecommitdiff
path: root/dash/previews
diff options
authorNick Dedekind <nicholas.dedekind@gmail.com>2012-07-06 13:15:14 +0100
committerNick Dedekind <nicholas.dedekind@gmail.com>2012-07-06 13:15:14 +0100
commitdc057e2abd8d2ca2123f6bcdafaaeb0d5ab03352 (patch)
treea93b1c7c9ced8ffab5fb50fd86d1b335464f3cb0 /dash/previews
parent12c9d638cad745c1a8314b6d3893a6a0637662eb (diff)
Fixed action button sizing issues and multi-line description text.
(bzr r2419.4.12)
Diffstat (limited to 'dash/previews')
-rw-r--r--dash/previews/ActionButton.cpp16
-rw-r--r--dash/previews/ApplicationPreview.cpp18
-rw-r--r--dash/previews/Standalone.cpp2
3 files changed, 24 insertions, 12 deletions
diff --git a/dash/previews/ActionButton.cpp b/dash/previews/ActionButton.cpp
index 4026ae97c..817f07085 100644
--- a/dash/previews/ActionButton.cpp
+++ b/dash/previews/ActionButton.cpp
@@ -21,11 +21,14 @@
#include "unity-shared/DashStyle.h"
#include "ActionButton.h"
+#include <NuxCore/Logger.h>
namespace
{
const int kMinButtonHeight = 30;
const int kMinButtonWidth = 48;
+
+nux::logging::Logger logger("unity.dash.actionbutton");
}
namespace unity
@@ -37,6 +40,8 @@ ActionButton::ActionButton(std::string const& label, NUX_FILE_LINE_DECL)
: nux::Button(NUX_FILE_LINE_PARAM)
, label_(label)
{
+ SetLayoutPadding(2, 11, 2, 11);
+ Button::SetLabel(label);
Init();
}
@@ -44,12 +49,11 @@ ActionButton::~ActionButton()
{
}
-
void ActionButton::Init()
{
InitTheme();
SetAcceptKeyNavFocusOnMouseDown(false);
- SetAcceptKeyNavFocusOnMouseEnter(true);
+ SetAcceptKeyNavFocusOnMouseEnter(false);
key_nav_focus_change.connect([&] (nux::Area*, bool, nux::KeyNavDirection)
{
@@ -81,7 +85,11 @@ void ActionButton::InitTheme()
void ActionButton::RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state)
{
- Style::Instance().Button(cr, faked_state, label_, -1, Alignment::CENTER, true);
+ int font_size = -1;
+ Style::Instance().Button(cr, faked_state, label_, font_size, Alignment::CENTER, true);
+
+ if (GetLabelFontSize() != font_size)
+ SetLabelFontSize(font_size);
}
void ActionButton::RedrawFocusOverlay(nux::Geometry const& geom, cairo_t* cr)
@@ -147,7 +155,7 @@ void ActionButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
texxform,
nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
- if (HasKeyboardFocus())
+ if (IsMouseInside() || HasKeyboardFocus())
{
GfxContext.QRP_1Tex(geo.x,
geo.y,
diff --git a/dash/previews/ApplicationPreview.cpp b/dash/previews/ApplicationPreview.cpp
index 08cf66b94..98c4ec1de 100644
--- a/dash/previews/ApplicationPreview.cpp
+++ b/dash/previews/ApplicationPreview.cpp
@@ -105,8 +105,8 @@ void ApplicationPreview::SetupViews()
/////////////////////
// App Data Panel
nux::VLayout* full_data_layout = new nux::VLayout();
- full_data_layout->SetPadding(8);
- full_data_layout->SetSpaceBetweenChildren(8);
+ full_data_layout->SetPadding(10);
+ full_data_layout->SetSpaceBetweenChildren(12);
/////////////////////
// Main App Info
@@ -173,8 +173,11 @@ void ApplicationPreview::SetupViews()
app_description_ = new nux::StaticCairoText("");
app_description_->SetFont(style.app_description_font().c_str());
app_description_->SetTextAlignment(nux::StaticCairoText::NUX_ALIGN_TOP);
- app_description_->SetLines(10);
- app_description_->SetText("Description test\ntest this is a test\ntest2\ntest3\nplop1\ntest2\ntest3\nplop1");
+ app_description_->SetLines(-10);
+ app_description_->SetLineSpacing(1);
+ app_description_->SetMaximumWidth(400);
+ app_description_->SetText("Skype is a proprietary voice-over-Internet Protocol service and software application originally created by Niklas Zennström and Janus Friis in 2003, and owned by Microsoft since 2011. \
+The service allows users to communicate with peers by voice, video, and instant messaging over the Internet.");
/////////////////////
/////////////////////
@@ -185,20 +188,21 @@ void ApplicationPreview::SetupViews()
for (dash::Preview::ActionPtr action : preview_model_->GetActions())
{
- actions_layout->AddView(new ActionButton(action->display_name, NUX_TRACKER_LOCATION), 0);
+ actions_layout->AddView(new ActionButton(action->display_name, NUX_TRACKER_LOCATION), 0, nux::MINOR_POSITION_END, nux::MINOR_SIZE_MATCHCONTENT);
}
/////////////////////
full_data_layout->AddLayout(main_app_info, 0);
full_data_layout->AddView(app_description_, 0);
- full_data_layout->AddSpace(0, 1);
- full_data_layout->AddLayout(actions_layout, 0);
+ full_data_layout->AddLayout(actions_layout, 1);
/////////////////////
image_data_layout->AddView(app_image_, 1);
image_data_layout->AddLayout(full_data_layout, 1);
SetLayout(image_data_layout);
+
+ LOG_WARN(logger) << "Line Count" << app_description_->GetLineCount();
}
}
diff --git a/dash/previews/Standalone.cpp b/dash/previews/Standalone.cpp
index 31994923b..5ddfda344 100644
--- a/dash/previews/Standalone.cpp
+++ b/dash/previews/Standalone.cpp
@@ -113,7 +113,7 @@ int main(int argc, char **argv)
nux::NuxInitialize(0);
nux::logging::configure_logging(::getenv("UNITY_LOG_SEVERITY"));
- nux::logging::Logger("unity").SetLogLevel(nux::logging::Trace);
+ nux::logging::Logger("unity").SetLogLevel(nux::logging::Warning);
// The instances for the pseudo-singletons.
unity::Settings settings;
unity::dash::previews::Style panel_style;