~unity-team/unity/trunk

« back to all changes in this revision

Viewing changes to dash/previews/SocialPreviewContent.cpp

  • Committer: Tarmac
  • Author(s): Chris Townsend
  • Date: 2013-06-12 00:18:43 UTC
  • mfrom: (3367.1.1 unity)
  • Revision ID: tarmac-20130612001843-3jlvqqgyua3ao69c
Add support to close social previews by clicking anywhere in the preview bubble. Fixes: https://bugs.launchpad.net/bugs/1190007.

Approved by PS Jenkins bot, Brandon Schaefer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
130
130
{
131
131
  dash::previews::Style const& style = dash::previews::Style::Instance();
132
132
 
 
133
  auto on_mouse_down = [&](int x, int y, unsigned long button_flags, unsigned long key_flags) { this->preview_container_.OnMouseDown(x, y, button_flags, key_flags); };
 
134
 
133
135
  text_ = new StaticCairoText("", false, NUX_TRACKER_LOCATION);
134
136
  text_->SetLines(-8);
135
137
  text_->SetFont(style.content_font());
136
138
  text_->SetLineSpacing(5);
137
139
  text_->SetTextEllipsize(StaticCairoText::NUX_ELLIPSIZE_MIDDLE);
 
140
  text_->mouse_click.connect(on_mouse_down);
138
141
 
139
142
  nux::Layout* layout = new nux::Layout();
140
143
  layout->AddView(text_.GetPointer(), 1);
 
144
 
 
145
  mouse_click.connect(on_mouse_down);
 
146
 
141
147
  SetLayout(layout);
142
148
 
143
149
  cr_bubble_.reset(new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &SocialPreviewContent::RedrawBubble), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)));