~mial/ubuntu/oneiric/unity/bug-791810

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/DashSearchBar.cpp

  • Committer: Jay Taoko
  • Date: 2011-10-21 03:44:20 UTC
  • mfrom: (1721.1.4 unity-porting-nux20)
  • Revision ID: jay.taoko@canonical.com-20111021034420-ucz8y104ztr15944
Ported Unity to Nux 2.0

- The Button class in Nux no longer has properties. Refer to Nux API for more details on the signals and functions of that class

- ProcessEvent member functions have been removed (remnant of the former event architecture)

- Removed former Focus API

- ComputeLayout2 has been renamed ComputeContentSize

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
  spinner_ = new SearchBarSpinner();
72
72
  spinner_->SetMinMaxSize(icon->GetWidth(), icon->GetHeight());
73
73
  spinner_->mouse_click.connect(sigc::mem_fun(this, &SearchBar::OnClearClicked));
74
 
  spinner_->SetCanFocus(false);
75
74
  layout_->AddView(spinner_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
76
75
 
77
76
  hint_ = new nux::StaticCairoText(" ");
78
77
  hint_->SetTextColor(nux::Color(1.0f, 1.0f, 1.0f, 0.5f));
79
 
  hint_->SetCanFocus(false);
80
78
  hint_->SetMaximumWidth(570);
81
79
 
82
80
  pango_entry_ = new IMTextEntry();
83
81
  pango_entry_->sigTextChanged.connect(sigc::mem_fun(this, &SearchBar::OnSearchChanged));
84
 
  pango_entry_->SetCanFocus(true);
85
82
  pango_entry_->activated.connect([&]() { activated.emit(); });
86
83
  pango_entry_->cursor_moved.connect([&](int i) { QueueDraw(); });
87
84
  pango_entry_->mouse_down.connect(sigc::mem_fun(this, &SearchBar::OnMouseButtonDown));
95
92
  layered_layout_->SetActiveLayerN(1);
96
93
  layered_layout_->SetMinimumWidth(420);
97
94
  layered_layout_->SetMaximumWidth(645);
98
 
  layout_->AddView(layered_layout_, 1, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FIX);
 
95
  layout_->AddView(layered_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
99
96
 
100
97
  std::string filter_str = _("Filter results");
101
98
  filter_str+= "  ▸";
102
99
  show_filters_ = new nux::StaticCairoText(filter_str.c_str());
103
100
  show_filters_->SetVisible(false);
104
101
  show_filters_->SetTextColor(nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
105
 
  show_filters_->SetCanFocus(true);
106
102
  show_filters_->SetTextAlignment(nux::StaticCairoText::NUX_ALIGN_LEFT);
107
103
  show_filters_->mouse_click.connect([&] (int x, int y, unsigned long b, unsigned long k) { showing_filters = !showing_filters; });
108
104
  layout_->AddView(show_filters_, 0, nux::MINOR_POSITION_RIGHT, nux::MINOR_SIZE_FIX);
212
208
  show_filters_->SetText(filter_str.c_str());
213
209
}
214
210
 
215
 
long SearchBar::ProcessEvent(nux::IEvent& ievent, long TraverseInfo,
216
 
                                   long ProcessEventInfo)
217
 
{
218
 
  long ret = TraverseInfo;
219
 
  ret = layout_->ProcessEvent(ievent, ret, ProcessEventInfo);
220
 
 
221
 
  return ret;
222
 
}
223
 
 
224
211
void SearchBar::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
225
212
{
226
213
  nux::Geometry geo = GetGeometry();