diff options
| author | Jay Taoko <jay.taoko@canonical.com> | 2011-10-20 23:44:20 -0400 |
|---|---|---|
| committer | Jay Taoko <jay.taoko@canonical.com> | 2011-10-20 23:44:20 -0400 |
| commit | bd6f07d29c07568ac39ebc815a39e1fec3534199 (patch) | |
| tree | c2e87bc51ce1b51a66503a83037be7b89c48e398 | |
| parent | ab3dbb18ac6d85793d7c83443ec3fabe47003e72 (diff) | |
| parent | 694750f8aa078fefc8022dab020b2c5d4bd44dfc (diff) | |
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 (bzr r1722)
98 files changed, 225 insertions, 681 deletions
diff --git a/plugins/unityshell/src/Autopilot.cpp b/plugins/unityshell/src/Autopilot.cpp index 77ecd7f71..ef3fa007f 100644 --- a/plugins/unityshell/src/Autopilot.cpp +++ b/plugins/unityshell/src/Autopilot.cpp @@ -99,7 +99,7 @@ Autopilot::StartTest(const gchar* name) if (test_expiration_functor == NULL) { test_expiration_functor = new nux::TimerFunctor(); - test_expiration_functor->OnTimerExpired.connect(sigc::ptr_fun(&TestFinished)); + test_expiration_functor->time_expires.connect(sigc::ptr_fun(&TestFinished)); } args->name = g_strdup(name); diff --git a/plugins/unityshell/src/BackgroundEffectHelper.h b/plugins/unityshell/src/BackgroundEffectHelper.h index bcba4072f..f540dc3c6 100644 --- a/plugins/unityshell/src/BackgroundEffectHelper.h +++ b/plugins/unityshell/src/BackgroundEffectHelper.h @@ -23,7 +23,6 @@ #include "config.h" #include <Nux/Nux.h> -#include <Nux/ColorArea.h> #include <NuxGraphics/GLThread.h> namespace unity diff --git a/plugins/unityshell/src/DashController.cpp b/plugins/unityshell/src/DashController.cpp index 3f0202101..4330574f8 100644 --- a/plugins/unityshell/src/DashController.cpp +++ b/plugins/unityshell/src/DashController.cpp @@ -81,7 +81,6 @@ void DashController::SetupWindow() window_->SetConfigureNotifyCallback(&DashController::OnWindowConfigure, this); window_->ShowWindow(false); window_->SetOpacity(0.0f); - window_->SetFocused(true); window_->mouse_down_outside_pointer_grab_area.connect(sigc::mem_fun(this, &DashController::OnMouseDownOutsideWindow)); } @@ -255,7 +254,6 @@ void DashController::HideDash(bool restore) view_->AboutToHide(); window_->CaptureMouseDownAnyWhereElse(false); - window_->ForceStopFocus(1, 1); window_->EnableInputWindow(false, "Dash", true, false); visible_ = false; diff --git a/plugins/unityshell/src/DashSearchBar.cpp b/plugins/unityshell/src/DashSearchBar.cpp index 7b2ce4ad2..31eb182fe 100644 --- a/plugins/unityshell/src/DashSearchBar.cpp +++ b/plugins/unityshell/src/DashSearchBar.cpp @@ -71,17 +71,14 @@ SearchBar::SearchBar(NUX_FILE_LINE_DECL) spinner_ = new SearchBarSpinner(); spinner_->SetMinMaxSize(icon->GetWidth(), icon->GetHeight()); spinner_->mouse_click.connect(sigc::mem_fun(this, &SearchBar::OnClearClicked)); - spinner_->SetCanFocus(false); layout_->AddView(spinner_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); hint_ = new nux::StaticCairoText(" "); hint_->SetTextColor(nux::Color(1.0f, 1.0f, 1.0f, 0.5f)); - hint_->SetCanFocus(false); hint_->SetMaximumWidth(570); pango_entry_ = new IMTextEntry(); pango_entry_->sigTextChanged.connect(sigc::mem_fun(this, &SearchBar::OnSearchChanged)); - pango_entry_->SetCanFocus(true); pango_entry_->activated.connect([&]() { activated.emit(); }); pango_entry_->cursor_moved.connect([&](int i) { QueueDraw(); }); pango_entry_->mouse_down.connect(sigc::mem_fun(this, &SearchBar::OnMouseButtonDown)); @@ -95,14 +92,13 @@ SearchBar::SearchBar(NUX_FILE_LINE_DECL) layered_layout_->SetActiveLayerN(1); layered_layout_->SetMinimumWidth(420); layered_layout_->SetMaximumWidth(645); - layout_->AddView(layered_layout_, 1, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FIX); + layout_->AddView(layered_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX); std::string filter_str = _("Filter results"); filter_str+= " ▸"; show_filters_ = new nux::StaticCairoText(filter_str.c_str()); show_filters_->SetVisible(false); show_filters_->SetTextColor(nux::Color(1.0f, 1.0f, 1.0f, 1.0f)); - show_filters_->SetCanFocus(true); show_filters_->SetTextAlignment(nux::StaticCairoText::NUX_ALIGN_LEFT); show_filters_->mouse_click.connect([&] (int x, int y, unsigned long b, unsigned long k) { showing_filters = !showing_filters; }); layout_->AddView(show_filters_, 0, nux::MINOR_POSITION_RIGHT, nux::MINOR_SIZE_FIX); @@ -212,15 +208,6 @@ void SearchBar::OnShowingFiltersChanged(bool is_showing) show_filters_->SetText(filter_str.c_str()); } -long SearchBar::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, - long ProcessEventInfo) -{ - long ret = TraverseInfo; - ret = layout_->ProcessEvent(ievent, ret, ProcessEventInfo); - - return ret; -} - void SearchBar::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { nux::Geometry geo = GetGeometry(); diff --git a/plugins/unityshell/src/DashSearchBar.h b/plugins/unityshell/src/DashSearchBar.h index 4057e0863..ee64d3b62 100644 --- a/plugins/unityshell/src/DashSearchBar.h +++ b/plugins/unityshell/src/DashSearchBar.h @@ -69,7 +69,6 @@ private: void OnFontChanged(GtkSettings* settings, GParamSpec* pspec=NULL); void OnSearchHintChanged(); - long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo); void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/DashSearchBarSpinner.cpp b/plugins/unityshell/src/DashSearchBarSpinner.cpp index c692b32c1..3f294c0c0 100644 --- a/plugins/unityshell/src/DashSearchBarSpinner.cpp +++ b/plugins/unityshell/src/DashSearchBarSpinner.cpp @@ -57,12 +57,6 @@ SearchBarSpinner::~SearchBarSpinner() g_source_remove(_frame_timeout); } -long -SearchBarSpinner::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo) -{ - return PostProcessEvent2(ievent, TraverseInfo, ProcessEventInfo); -} - void SearchBarSpinner::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { diff --git a/plugins/unityshell/src/DashSearchBarSpinner.h b/plugins/unityshell/src/DashSearchBarSpinner.h index 31d5221fd..936a89c08 100644 --- a/plugins/unityshell/src/DashSearchBarSpinner.h +++ b/plugins/unityshell/src/DashSearchBarSpinner.h @@ -46,7 +46,6 @@ public: SearchBarSpinner(); ~SearchBarSpinner(); - long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo); void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/DashStyle.cpp b/plugins/unityshell/src/DashStyle.cpp index c8d8584bd..59e248e82 100644 --- a/plugins/unityshell/src/DashStyle.cpp +++ b/plugins/unityshell/src/DashStyle.cpp @@ -116,7 +116,7 @@ public: double height, Segment segment, Arrow arrow, - nux::State state); + nux::ButtonVisualState state); // Members cairo_font_options_t* default_font_options_; @@ -610,49 +610,49 @@ void DashStyle::Impl::Star(cairo_t* cr, double size) void DashStyle::Impl::SetDefaultValues() { // button-label - button_label_border_color_[nux::NUX_STATE_NORMAL] = nux::Color(0.53, 1.0, 0.66, 0.5); - button_label_border_color_[nux::NUX_STATE_ACTIVE] = nux::Color(1.0, 1.0, 1.0, 0.8); - button_label_border_color_[nux::NUX_STATE_PRELIGHT] = nux::Color(0.06, 0.13, 1.0, 0.5); - button_label_border_color_[nux::NUX_STATE_SELECTED] = nux::Color(0.07, 0.2, 0.33, 0.5); - button_label_border_color_[nux::NUX_STATE_INSENSITIVE] = nux::Color(0.39, 0.26, 0.12, 0.5); - - button_label_border_size_[nux::NUX_STATE_NORMAL] = 0.5; - button_label_border_size_[nux::NUX_STATE_ACTIVE] = 2.0; - button_label_border_size_[nux::NUX_STATE_PRELIGHT] = 0.5; - button_label_border_size_[nux::NUX_STATE_SELECTED] = 0.5; - button_label_border_size_[nux::NUX_STATE_INSENSITIVE] = 0.5; + button_label_border_color_[nux::VISUAL_STATE_NORMAL] = nux::Color(0.53, 1.0, 0.66, 0.5); + button_label_border_color_[nux::VISUAL_STATE_PRESSED] = nux::Color(1.0, 1.0, 1.0, 0.8); + button_label_border_color_[nux::VISUAL_STATE_PRELIGHT] = nux::Color(0.06, 0.13, 1.0, 0.5); + //button_label_border_color_[nux::NUX_STATE_SELECTED] = nux::Color(0.07, 0.2, 0.33, 0.5); + //button_label_border_color_[nux::NUX_STATE_INSENSITIVE] = nux::Color(0.39, 0.26, 0.12, 0.5); + + button_label_border_size_[nux::VISUAL_STATE_NORMAL] = 0.5; + button_label_border_size_[nux::VISUAL_STATE_PRESSED] = 2.0; + button_label_border_size_[nux::VISUAL_STATE_PRELIGHT] = 0.5; + //button_label_border_size_[nux::NUX_STATE_SELECTED] = 0.5; + //button_label_border_size_[nux::NUX_STATE_INSENSITIVE] = 0.5; button_label_text_size_ = 1.0; - button_label_text_color_[nux::NUX_STATE_NORMAL] = nux::color::White; - button_label_text_color_[nux::NUX_STATE_ACTIVE] = nux::color::Black; - button_label_text_color_[nux::NUX_STATE_PRELIGHT] = nux::color::White; - button_label_text_color_[nux::NUX_STATE_SELECTED] = nux::color::White; - button_label_text_color_[nux::NUX_STATE_INSENSITIVE] = nux::color::White; - - button_label_fill_color_[nux::NUX_STATE_NORMAL] = nux::color::Transparent; - button_label_fill_color_[nux::NUX_STATE_ACTIVE] = nux::color::Transparent; - button_label_fill_color_[nux::NUX_STATE_PRELIGHT] = nux::color::Transparent; - button_label_fill_color_[nux::NUX_STATE_SELECTED] = nux::color::Transparent; - button_label_fill_color_[nux::NUX_STATE_INSENSITIVE] = nux::color::Transparent; - - button_label_overlay_opacity_[nux::NUX_STATE_NORMAL] = 0.0; - button_label_overlay_opacity_[nux::NUX_STATE_ACTIVE] = 0.3; - button_label_overlay_opacity_[nux::NUX_STATE_PRELIGHT] = 0.0; - button_label_overlay_opacity_[nux::NUX_STATE_SELECTED] = 0.0; - button_label_overlay_opacity_[nux::NUX_STATE_INSENSITIVE] = 0.0; - - button_label_overlay_mode_[nux::NUX_STATE_NORMAL] = BlendMode::NORMAL; - button_label_overlay_mode_[nux::NUX_STATE_ACTIVE] = BlendMode::NORMAL; - button_label_overlay_mode_[nux::NUX_STATE_PRELIGHT] = BlendMode::NORMAL; - button_label_overlay_mode_[nux::NUX_STATE_SELECTED] = BlendMode::NORMAL; - button_label_overlay_mode_[nux::NUX_STATE_INSENSITIVE] = BlendMode::NORMAL; - - button_label_blur_size_[nux::NUX_STATE_NORMAL] = 0; - button_label_blur_size_[nux::NUX_STATE_ACTIVE] = 5; - button_label_blur_size_[nux::NUX_STATE_PRELIGHT] = 0; - button_label_blur_size_[nux::NUX_STATE_SELECTED] = 0; - button_label_blur_size_[nux::NUX_STATE_INSENSITIVE] = 0; + button_label_text_color_[nux::VISUAL_STATE_NORMAL] = nux::color::White; + button_label_text_color_[nux::VISUAL_STATE_PRESSED] = nux::color::Black; + button_label_text_color_[nux::VISUAL_STATE_PRELIGHT] = nux::color::White; + //button_label_text_color_[nux::NUX_STATE_SELECTED] = nux::color::White; + //button_label_text_color_[nux::NUX_STATE_INSENSITIVE] = nux::color::White; + + button_label_fill_color_[nux::VISUAL_STATE_NORMAL] = nux::color::Transparent; + button_label_fill_color_[nux::VISUAL_STATE_PRESSED] = nux::color::Transparent; + button_label_fill_color_[nux::VISUAL_STATE_PRELIGHT] = nux::color::Transparent; + //button_label_fill_color_[nux::NUX_STATE_SELECTED] = nux::color::Transparent; + //button_label_fill_color_[nux::NUX_STATE_INSENSITIVE] = nux::color::Transparent; + + button_label_overlay_opacity_[nux::VISUAL_STATE_NORMAL] = 0.0; + button_label_overlay_opacity_[nux::VISUAL_STATE_PRESSED] = 0.3; + button_label_overlay_opacity_[nux::VISUAL_STATE_PRELIGHT] = 0.0; + //button_label_overlay_opacity_[nux::NUX_STATE_SELECTED] = 0.0; + //button_label_overlay_opacity_[nux::NUX_STATE_INSENSITIVE] = 0.0; + + button_label_overlay_mode_[nux::VISUAL_STATE_NORMAL] = BlendMode::NORMAL; + button_label_overlay_mode_[nux::VISUAL_STATE_PRESSED] = BlendMode::NORMAL; + button_label_overlay_mode_[nux::VISUAL_STATE_PRELIGHT] = BlendMode::NORMAL; + //button_label_overlay_mode_[nux::NUX_STATE_SELECTED] = BlendMode::NORMAL; + //button_label_overlay_mode_[nux::NUX_STATE_INSENSITIVE] = BlendMode::NORMAL; + + button_label_blur_size_[nux::VISUAL_STATE_NORMAL] = 0; + button_label_blur_size_[nux::VISUAL_STATE_PRESSED] = 5; + button_label_blur_size_[nux::VISUAL_STATE_PRELIGHT] = 0; + //button_label_blur_size_[nux::NUX_STATE_SELECTED] = 0; + //button_label_blur_size_[nux::NUX_STATE_INSENSITIVE] = 0; // regular-text regular_text_color_ = nux::color::White; @@ -869,7 +869,7 @@ void DashStyle::Impl::RoundedRectSegment(cairo_t* cr, double height, Segment segment, Arrow arrow, - nux::State state) + nux::ButtonVisualState state) { double radius = cornerRadius / aspect; double arrow_w = radius / 1.5; @@ -884,7 +884,7 @@ void DashStyle::Impl::RoundedRectSegment(cairo_t* cr, // top-right cairo_line_to(cr, x + width, y); - if (arrow == Arrow::RIGHT && state == nux::NUX_STATE_ACTIVE) + if (arrow == Arrow::RIGHT && state == nux::VISUAL_STATE_PRESSED) { cairo_line_to(cr, x + width, y + height / 2.0 - arrow_h); cairo_line_to(cr, x + width - arrow_w, y + height / 2.0); @@ -925,7 +925,7 @@ void DashStyle::Impl::RoundedRectSegment(cairo_t* cr, // top-right cairo_line_to(cr, x + width, y); - if ((arrow == Arrow::RIGHT || arrow == Arrow::BOTH) && state == nux::NUX_STATE_ACTIVE) + if ((arrow == Arrow::RIGHT || arrow == Arrow::BOTH) && state == nux::VISUAL_STATE_PRESSED) { cairo_line_to(cr, x + width, y + height / 2.0 - arrow_h); cairo_line_to(cr, x + width - arrow_w, y + height / 2.0); @@ -938,7 +938,7 @@ void DashStyle::Impl::RoundedRectSegment(cairo_t* cr, // bottom-left cairo_line_to(cr, x, y + height); - if ((arrow == Arrow::LEFT || arrow == Arrow::BOTH) && state == nux::NUX_STATE_ACTIVE) + if ((arrow == Arrow::LEFT || arrow == Arrow::BOTH) && state == nux::VISUAL_STATE_PRESSED) { cairo_line_to(cr, x, y + height / 2.0 + arrow_h); cairo_line_to(cr, x + arrow_w, y + height / 2.0); @@ -978,7 +978,7 @@ void DashStyle::Impl::RoundedRectSegment(cairo_t* cr, // bottom-left cairo_line_to(cr, x, y + height); - if (arrow == Arrow::LEFT && state == nux::NUX_STATE_ACTIVE) + if (arrow == Arrow::LEFT && state == nux::VISUAL_STATE_PRESSED) { cairo_line_to(cr, x, y + height / 2.0 + arrow_h); cairo_line_to(cr, x + arrow_w, y + height / 2.0); @@ -1413,7 +1413,7 @@ void DashStyle::Impl::DrawOverlay(cairo_t* cr, cairo_set_operator(cr, old); } -bool DashStyle::Button(cairo_t* cr, nux::State state, std::string const& label) +bool DashStyle::Button(cairo_t* cr, nux::ButtonVisualState state, std::string const& label) { // sanity checks if (cairo_status(cr) != CAIRO_STATUS_SUCCESS) @@ -1457,7 +1457,7 @@ bool DashStyle::Button(cairo_t* cr, nux::State state, std::string const& label) return true; } -bool DashStyle::StarEmpty(cairo_t* cr, nux::State state) +bool DashStyle::StarEmpty(cairo_t* cr, nux::ButtonVisualState state) { // sanity checks if (cairo_status(cr) != CAIRO_STATUS_SUCCESS) @@ -1483,7 +1483,7 @@ bool DashStyle::StarEmpty(cairo_t* cr, nux::State state) return true; } -bool DashStyle::StarHalf(cairo_t* cr, nux::State state) +bool DashStyle::StarHalf(cairo_t* cr, nux::ButtonVisualState state) { // sanity checks if (cairo_status(cr) != CAIRO_STATUS_SUCCESS) @@ -1517,7 +1517,7 @@ bool DashStyle::StarHalf(cairo_t* cr, nux::State state) return true; } -bool DashStyle::StarFull(cairo_t* cr, nux::State state) +bool DashStyle::StarFull(cairo_t* cr, nux::ButtonVisualState state) { // sanity checks if (cairo_status(cr) != CAIRO_STATUS_SUCCESS) @@ -1542,7 +1542,7 @@ bool DashStyle::StarFull(cairo_t* cr, nux::State state) } bool DashStyle::MultiRangeSegment(cairo_t* cr, - nux::State state, + nux::ButtonVisualState state, std::string const& label, Arrow arrow, Segment segment) @@ -1599,7 +1599,7 @@ bool DashStyle::MultiRangeSegment(cairo_t* cr, } bool DashStyle::TrackViewNumber(cairo_t* cr, - nux::State state, + nux::ButtonVisualState state, std::string const& trackNumber) { // sanity checks @@ -1613,7 +1613,7 @@ bool DashStyle::TrackViewNumber(cairo_t* cr, } bool DashStyle::TrackViewPlay(cairo_t* cr, - nux::State state) + nux::ButtonVisualState state) { // sanity checks if (cairo_status(cr) != CAIRO_STATUS_SUCCESS) @@ -1626,7 +1626,7 @@ bool DashStyle::TrackViewPlay(cairo_t* cr, } bool DashStyle::TrackViewPause(cairo_t* cr, - nux::State state) + nux::ButtonVisualState state) { // sanity checks if (cairo_status(cr) != CAIRO_STATUS_SUCCESS) diff --git a/plugins/unityshell/src/DashStyle.h b/plugins/unityshell/src/DashStyle.h index 0d98e3bbf..162dd72d7 100644 --- a/plugins/unityshell/src/DashStyle.h +++ b/plugins/unityshell/src/DashStyle.h @@ -78,30 +78,30 @@ public: static DashStyle& Instance(); - virtual bool Button(cairo_t* cr, nux::State state, + virtual bool Button(cairo_t* cr, nux::ButtonVisualState state, std::string const& label); - virtual bool StarEmpty(cairo_t* cr, nux::State state); + virtual bool StarEmpty(cairo_t* cr, nux::ButtonVisualState state); - virtual bool StarHalf(cairo_t* cr, nux::State state); + virtual bool StarHalf(cairo_t* cr, nux::ButtonVisualState state); - virtual bool StarFull(cairo_t* cr, nux::State state); + virtual bool StarFull(cairo_t* cr, nux::ButtonVisualState state); virtual bool MultiRangeSegment(cairo_t* cr, - nux::State state, + nux::ButtonVisualState state, std::string const& label, Arrow arrow, Segment segment); virtual bool TrackViewNumber(cairo_t* cr, - nux::State state, + nux::ButtonVisualState state, std::string const& trackNumber); virtual bool TrackViewPlay(cairo_t* cr, - nux::State state); + nux::ButtonVisualState state); virtual bool TrackViewPause(cairo_t* cr, - nux::State state); + nux::ButtonVisualState state); virtual bool TrackViewProgress(cairo_t* cr); diff --git a/plugins/unityshell/src/DashView.cpp b/plugins/unityshell/src/DashView.cpp index 65548ec62..8c1363cf3 100644 --- a/plugins/unityshell/src/DashView.cpp +++ b/plugins/unityshell/src/DashView.cpp @@ -78,7 +78,6 @@ void DashView::AboutToShow() visible_ = true; bg_effect_helper_.enabled = true; search_bar_->text_entry()->SelectAll(); - search_bar_->text_entry()->SetFocused(true); } void DashView::AboutToHide() @@ -214,24 +213,6 @@ nux::Geometry DashView::GetBestFitGeometry(nux::Geometry const& for_geo) return nux::Geometry(0, 0, width, height); } -long DashView::ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info) -{ - long ret = traverse_info; - - if ((ievent.e_event == nux::NUX_KEYDOWN) && - (ievent.GetKeySym() == NUX_VK_ESCAPE)) - { - if (search_bar_->search_string == "") - ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST); - else - search_bar_->search_string = ""; - return ret; - } - - ret = layout_->ProcessEvent(ievent, traverse_info, event_info); - return ret; -} - void DashView::Draw(nux::GraphicsEngine& gfx_context, bool force_draw) { DashSettings* settings = DashSettings::GetDefault(); @@ -564,9 +545,6 @@ void DashView::OnActivateRequest(GVariant* args) home_view_->search_string = ""; lens_bar_->Activate(id); - // Reset focus - SetFocused(false); - SetFocused(true); if (id == "home.lens" || !visible_) ubus_manager_.SendMessage(UBUS_DASH_EXTERNAL_ACTIVATION); @@ -703,7 +681,6 @@ void DashView::OnLensBarActivated(std::string const& id) search_bar_->showing_filters = expanded; search_bar_->text_entry()->SelectAll(); - search_bar_->text_entry()->SetFocused(true); nux::GetWindowCompositor().SetKeyFocusArea(search_bar_->text_entry()); search_bar_->can_refine_search = view->can_refine_search(); diff --git a/plugins/unityshell/src/DashView.h b/plugins/unityshell/src/DashView.h index 21460c106..ad4b73b54 100644 --- a/plugins/unityshell/src/DashView.h +++ b/plugins/unityshell/src/DashView.h @@ -75,7 +75,6 @@ private: nux::Geometry GetBestFitGeometry(nux::Geometry const& for_geo); - long ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info); void Draw(nux::GraphicsEngine& gfx_context, bool force_draw); void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw); virtual long PostLayoutManagement (long LayoutResult); diff --git a/plugins/unityshell/src/FilterBar.cpp b/plugins/unityshell/src/FilterBar.cpp index c629fdb9c..11705d8b9 100644 --- a/plugins/unityshell/src/FilterBar.cpp +++ b/plugins/unityshell/src/FilterBar.cpp @@ -44,9 +44,8 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterBar); } void FilterBar::Init () { - nux::Layout *layout = new nux::VLayout (NUX_TRACKER_LOCATION); - layout->SetVerticalInternalMargin(12); - layout->SetVerticalExternalMargin(0); + nux::LinearLayout *layout = new nux::VLayout (NUX_TRACKER_LOCATION); + layout->SetSpaceBetweenChildren(12); SetLayout (layout); } @@ -79,11 +78,6 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterBar); } } - - long int FilterBar::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) { - return GetLayout()->ProcessEvent(ievent, TraverseInfo, ProcessEventInfo); - } - void FilterBar::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { nux::Geometry geo = GetGeometry(); diff --git a/plugins/unityshell/src/FilterBar.h b/plugins/unityshell/src/FilterBar.h index e0bdebf20..a770ace6c 100644 --- a/plugins/unityshell/src/FilterBar.h +++ b/plugins/unityshell/src/FilterBar.h @@ -44,7 +44,6 @@ namespace unity { void RemoveFilter (dash::Filter::Ptr filter); protected: - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/FilterBasicButton.cpp b/plugins/unityshell/src/FilterBasicButton.cpp index 92ff573ee..b201c6441 100644 --- a/plugins/unityshell/src/FilterBasicButton.cpp +++ b/plugins/unityshell/src/FilterBasicButton.cpp @@ -81,22 +81,22 @@ namespace unity { { if (prelight_ == NULL) { - prelight_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::State::NUX_STATE_PRELIGHT)); - active_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::State::NUX_STATE_ACTIVE)); - normal_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::State::NUX_STATE_NORMAL)); + prelight_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)); + active_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED)); + normal_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)); } // SetMinimumHeight(32); } - void FilterBasicButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::State faked_state) + void FilterBasicButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::ButtonVisualState faked_state) { DashStyle::Instance().Button(cr, faked_state, label_); } - long FilterBasicButton::ComputeLayout2 () + long FilterBasicButton::ComputeContentSize () { - long ret = nux::Button::ComputeLayout2(); + long ret = nux::Button::ComputeContentSize(); if (cached_geometry_ != GetGeometry()) { nux::Geometry geo = GetGeometry(); @@ -109,10 +109,6 @@ namespace unity { return ret; } - long int FilterBasicButton::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) { - return nux::Button::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo); - } - void FilterBasicButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { gPainter.PaintBackground(GfxContext, GetGeometry()); // set up our texture mode @@ -134,11 +130,11 @@ namespace unity { col); nux::BaseTexture *texture = normal_->GetTexture(); - if (active) + if (Active()) texture = active_->GetTexture(); - else if (state == nux::State::NUX_STATE_PRELIGHT) + else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT) texture = prelight_->GetTexture(); - else if (state == nux::State::NUX_STATE_ACTIVE) + else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED) { texture = active_->GetTexture(); } diff --git a/plugins/unityshell/src/FilterBasicButton.h b/plugins/unityshell/src/FilterBasicButton.h index 16ff5cde3..b7060b3dc 100644 --- a/plugins/unityshell/src/FilterBasicButton.h +++ b/plugins/unityshell/src/FilterBasicButton.h @@ -42,14 +42,13 @@ namespace unity { virtual ~FilterBasicButton(); protected: - virtual long ComputeLayout2(); - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); + virtual long ComputeContentSize(); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); void InitTheme (); - void RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::State faked_state); + void RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::ButtonVisualState faked_state); nux::CairoWrapper *prelight_; nux::CairoWrapper *active_; diff --git a/plugins/unityshell/src/FilterExpanderLabel.cpp b/plugins/unityshell/src/FilterExpanderLabel.cpp index 513fc2c37..6d33d8c14 100644 --- a/plugins/unityshell/src/FilterExpanderLabel.cpp +++ b/plugins/unityshell/src/FilterExpanderLabel.cpp @@ -113,10 +113,6 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterExpanderLabel); QueueRelayout(); } - long int FilterExpanderLabel::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) { - return GetLayout()->ProcessEvent(ievent, TraverseInfo, ProcessEventInfo); - } - void FilterExpanderLabel::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { nux::Geometry geo = GetGeometry(); diff --git a/plugins/unityshell/src/FilterExpanderLabel.h b/plugins/unityshell/src/FilterExpanderLabel.h index a88139ac1..0115e7cf7 100644 --- a/plugins/unityshell/src/FilterExpanderLabel.h +++ b/plugins/unityshell/src/FilterExpanderLabel.h @@ -45,7 +45,6 @@ namespace unity { nux::Property<bool> expanded; protected: - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); @@ -54,8 +53,8 @@ namespace unity { void BuildLayout (); void DoExpandChange (bool change); - nux::Layout* layout_; - nux::Layout* top_bar_layout_; + nux::LinearLayout* layout_; + nux::LinearLayout* top_bar_layout_; nux::Layout* contents_; nux::View* right_hand_contents_; nux::View* expander_graphic_; diff --git a/plugins/unityshell/src/FilterGenreButton.cpp b/plugins/unityshell/src/FilterGenreButton.cpp index bbedd59b8..9b9274b4e 100644 --- a/plugins/unityshell/src/FilterGenreButton.cpp +++ b/plugins/unityshell/src/FilterGenreButton.cpp @@ -28,8 +28,9 @@ namespace unity { FilterGenreButton::FilterGenreButton (const std::string label, NUX_FILE_LINE_DECL) : FilterBasicButton(label, NUX_FILE_LINE_PARAM) { InitTheme(); - active.changed.connect ([&] (bool is_active) { - bool tmp_active = active; + + state_change.connect ([&] (Button* button) { + bool tmp_active = Active(); if (filter_ != NULL) filter_->active = tmp_active; }); @@ -38,8 +39,9 @@ namespace unity { FilterGenreButton::FilterGenreButton (NUX_FILE_LINE_DECL) : FilterBasicButton(NUX_FILE_LINE_PARAM) { InitTheme(); - active.changed.connect ([&] (bool is_active) { - bool tmp_active = active; + + state_change.connect ([&] (Button* button) { + bool tmp_active = Active(); if (filter_ != NULL) filter_->active = tmp_active; }); @@ -51,9 +53,9 @@ namespace unity { filter_ = filter; bool tmp_active = filter_->active; - active = tmp_active; + SetActive(tmp_active); filter_->active.changed.connect ([&] (bool is_active) { - active = is_active; + SetActive(is_active); }); } @@ -62,10 +64,6 @@ namespace unity { return filter_; } - long int FilterGenreButton::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) { - return FilterBasicButton::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo); - } - void FilterGenreButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { FilterBasicButton::Draw(GfxContext, force_draw); } diff --git a/plugins/unityshell/src/FilterGenreButton.h b/plugins/unityshell/src/FilterGenreButton.h index de10d96af..4c13deb3f 100644 --- a/plugins/unityshell/src/FilterGenreButton.h +++ b/plugins/unityshell/src/FilterGenreButton.h @@ -41,7 +41,6 @@ namespace unity { dash::FilterOption::Ptr GetFilter(); protected: - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/FilterGenreWidget.cpp b/plugins/unityshell/src/FilterGenreWidget.cpp index 84c5b2666..dceb8aaca 100644 --- a/plugins/unityshell/src/FilterGenreWidget.cpp +++ b/plugins/unityshell/src/FilterGenreWidget.cpp @@ -49,17 +49,16 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterGenre); InitTheme(); all_button_ = new FilterBasicButton(_("All"), NUX_TRACKER_LOCATION); - all_button_->activated.connect(sigc::mem_fun(this, &FilterGenre::OnAllActivated)); - all_button_->label = _("All"); + all_button_->state_change.connect(sigc::mem_fun(this, &FilterGenre::OnAllActivated)); + all_button_->SetLabel(_("All")); PlacesStyle* style = PlacesStyle::GetDefault(); genre_layout_ = new nux::GridHLayout(NUX_TRACKER_LOCATION); genre_layout_->ForceChildrenSize(true); - genre_layout_->SetHeightMatchContent(true); - genre_layout_->SetVerticalInternalMargin (12); - genre_layout_->SetVerticalExternalMargin (12); - genre_layout_->SetHorizontalInternalMargin (10); + genre_layout_->MatchContentSize(true); + genre_layout_->SetSpaceBetweenChildren (10, 12); + genre_layout_->SetTopAndBottomPadding (12); genre_layout_->EnablePartialVisibility (false); genre_layout_->SetChildrenSize (style->GetTileWidth() - 12, 32); @@ -143,11 +142,6 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterGenre); // if they are, then set the all status to true } - - long int FilterGenre::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) { - return GetLayout()->ProcessEvent(ievent, TraverseInfo, ProcessEventInfo); - } - void FilterGenre::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { nux::Geometry geo = GetGeometry(); nux::Color col(0.2f, 0.2f, 0.2f, 0.2f); diff --git a/plugins/unityshell/src/FilterGenreWidget.h b/plugins/unityshell/src/FilterGenreWidget.h index 05ff2e1a8..14f958d76 100644 --- a/plugins/unityshell/src/FilterGenreWidget.h +++ b/plugins/unityshell/src/FilterGenreWidget.h @@ -52,7 +52,6 @@ namespace unity { nux::Property<bool> all_selected; protected: - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/FilterMultiRangeButton.cpp b/plugins/unityshell/src/FilterMultiRangeButton.cpp index 0143ec914..a56551635 100644 --- a/plugins/unityshell/src/FilterMultiRangeButton.cpp +++ b/plugins/unityshell/src/FilterMultiRangeButton.cpp @@ -34,8 +34,7 @@ namespace unity { , side_ (MULTI_RANGE_CENTER) { InitTheme(); - activated.connect (sigc::mem_fun(this, &FilterMultiRangeButton::OnActivated)); - active.changed.connect (sigc::mem_fun(this, &FilterMultiRangeButton::OnActiveChanged)); + state_change.connect (sigc::mem_fun(this, &FilterMultiRangeButton::OnActivated)); } FilterMultiRangeButton::FilterMultiRangeButton (NUX_FILE_LINE_DECL) @@ -47,8 +46,7 @@ namespace unity { , side_ (MULTI_RANGE_CENTER) { InitTheme(); - activated.connect (sigc::mem_fun(this, &FilterMultiRangeButton::OnActivated)); - active.changed.connect (sigc::mem_fun(this, &FilterMultiRangeButton::OnActiveChanged)); + state_change.connect (sigc::mem_fun(this, &FilterMultiRangeButton::OnActivated)); } FilterMultiRangeButton::~FilterMultiRangeButton() @@ -60,7 +58,7 @@ namespace unity { void FilterMultiRangeButton::OnActivated (nux::Area *area) { - bool tmp_active = active; + bool tmp_active = Active(); if (filter_ != NULL) filter_->active = tmp_active; } @@ -74,7 +72,7 @@ namespace unity { { filter_ = filter; bool tmp_active = filter_->active; - active = tmp_active; + SetActive(tmp_active); } dash::FilterOption::Ptr FilterMultiRangeButton::GetFilter() @@ -97,13 +95,13 @@ namespace unity { NeedRedraw(); } - long FilterMultiRangeButton::ComputeLayout2() + long FilterMultiRangeButton::ComputeContentSize() { if (prelight_ == NULL) { InitTheme(); } - long ret = nux::ToggleButton::ComputeLayout2(); + long ret = nux::ToggleButton::ComputeContentSize(); if (cached_geometry_ != GetGeometry()) { prelight_->Invalidate(GetGeometry()); @@ -119,15 +117,15 @@ namespace unity { { if (prelight_ == NULL) { - prelight_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::State::NUX_STATE_PRELIGHT)); - active_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::State::NUX_STATE_ACTIVE)); - normal_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::State::NUX_STATE_NORMAL)); + prelight_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)); + active_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED)); + normal_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)); } SetMinimumHeight(32); } - void FilterMultiRangeButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::State faked_state) + void FilterMultiRangeButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::ButtonVisualState faked_state) { std::string name = "10"; std::stringstream final; @@ -160,11 +158,6 @@ namespace unity { NeedRedraw(); } - - long int FilterMultiRangeButton::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) { - return nux::ToggleButton::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo); - } - void FilterMultiRangeButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { gPainter.PaintBackground(GfxContext, GetGeometry()); // set up our texture mode @@ -187,11 +180,11 @@ namespace unity { nux::BaseTexture *texture = normal_->GetTexture(); //FIXME - dashstyle does not give us a focused state yet, so ignore - //~ if (state == nux::State::NUX_STATE_PRELIGHT) + //~ if (state == nux::ButtonVisualState::NUX_VISUAL_STATE_PRELIGHT) //~ { //~ texture = prelight_->GetTexture(); //~ } - if (active) + if (Active()) { texture = active_->GetTexture(); } diff --git a/plugins/unityshell/src/FilterMultiRangeButton.h b/plugins/unityshell/src/FilterMultiRangeButton.h index ec4895e17..54f98ce29 100644 --- a/plugins/unityshell/src/FilterMultiRangeButton.h +++ b/plugins/unityshell/src/FilterMultiRangeButton.h @@ -61,8 +61,7 @@ namespace unity { void SetHasArrow (MultiRangeArrow arrow); //0 = left, 1 = both, 2 = right, -1 = none protected: - virtual long ComputeLayout2(); - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); + virtual long ComputeContentSize(); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); @@ -71,7 +70,7 @@ namespace unity { dash::FilterOption::Ptr filter_; void InitTheme (); - void RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::State faked_state); + void RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::ButtonVisualState faked_state); void OnActivated (nux::Area *area); void OnActiveChanged(bool value); diff --git a/plugins/unityshell/src/FilterMultiRangeWidget.cpp b/plugins/unityshell/src/FilterMultiRangeWidget.cpp index c6946757f..25126406c 100644 --- a/plugins/unityshell/src/FilterMultiRangeWidget.cpp +++ b/plugins/unityshell/src/FilterMultiRangeWidget.cpp @@ -41,8 +41,8 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterMultiRange); InitTheme(); all_button_ = new FilterBasicButton(_("All"), NUX_TRACKER_LOCATION); - all_button_->activated.connect(sigc::mem_fun(this, &FilterMultiRange::OnAllActivated)); - all_button_->label = _("All"); + all_button_->state_change.connect(sigc::mem_fun(this, &FilterMultiRange::OnAllActivated)); + all_button_->SetLabel(_("All")); layout_ = new nux::HLayout(NUX_TRACKER_LOCATION); layout_->SetVerticalExternalMargin (12); @@ -85,7 +85,7 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterMultiRange); FilterMultiRangeButton* button = (*it); dash::FilterOption::Ptr filter = button->GetFilter(); bool tmp_active = filter->active; - button->active = tmp_active; + button->SetActive(tmp_active); if (filter != NULL) { if (filter->active) @@ -173,10 +173,6 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterMultiRange); filter_->Clear(); } - long int FilterMultiRange::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) { - return GetLayout()->ProcessEvent(ievent, TraverseInfo, ProcessEventInfo); - } - void FilterMultiRange::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { nux::Geometry geo = GetGeometry(); nux::Color col(0.2f, 0.2f, 0.2f, 0.2f); diff --git a/plugins/unityshell/src/FilterMultiRangeWidget.h b/plugins/unityshell/src/FilterMultiRangeWidget.h index da20ec3b7..62d6676a0 100644 --- a/plugins/unityshell/src/FilterMultiRangeWidget.h +++ b/plugins/unityshell/src/FilterMultiRangeWidget.h @@ -50,7 +50,6 @@ namespace unity { nux::Property<bool> all_selected; protected: - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/FilterRatingsButton.cpp b/plugins/unityshell/src/FilterRatingsButton.cpp index 56c0870e7..5b5417321 100644 --- a/plugins/unityshell/src/FilterRatingsButton.cpp +++ b/plugins/unityshell/src/FilterRatingsButton.cpp @@ -83,21 +83,21 @@ namespace unity { { nux::Geometry geometry = GetGeometry(); geometry.width /= 5; - prelight_empty_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 0, nux::State::NUX_STATE_PRELIGHT)); - active_empty_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 0, nux::State::NUX_STATE_ACTIVE)); - normal_empty_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 0, nux::State::NUX_STATE_NORMAL)); + prelight_empty_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 0, nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)); + active_empty_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 0, nux::ButtonVisualState::VISUAL_STATE_PRESSED)); + normal_empty_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 0, nux::ButtonVisualState::VISUAL_STATE_NORMAL)); - prelight_half_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 1, nux::State::NUX_STATE_PRELIGHT)); - active_half_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 1, nux::State::NUX_STATE_ACTIVE)); - normal_half_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 1, nux::State::NUX_STATE_NORMAL)); + prelight_half_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 1, nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)); + active_half_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 1, nux::ButtonVisualState::VISUAL_STATE_PRESSED)); + normal_half_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 1, nux::ButtonVisualState::VISUAL_STATE_NORMAL)); - prelight_full_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 2, nux::State::NUX_STATE_PRELIGHT)); - active_full_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 2, nux::State::NUX_STATE_ACTIVE)); - normal_full_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 2, nux::State::NUX_STATE_NORMAL)); + prelight_full_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 2, nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)); + active_full_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 2, nux::ButtonVisualState::VISUAL_STATE_PRESSED)); + normal_full_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 2, nux::ButtonVisualState::VISUAL_STATE_NORMAL)); } } - void FilterRatingsButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, int type, nux::State faked_state) + void FilterRatingsButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, int type, nux::ButtonVisualState faked_state) { DashStyle& dash_style = DashStyle::Instance(); if (type == 0) @@ -117,9 +117,9 @@ namespace unity { } } - long FilterRatingsButton::ComputeLayout2 () + long FilterRatingsButton::ComputeContentSize () { - long ret = nux::Button::ComputeLayout2(); + long ret = nux::Button::ComputeContentSize(); if (cached_geometry_ != GetGeometry()) { nux::Geometry geometry = GetGeometry(); @@ -142,11 +142,6 @@ namespace unity { return ret; } - - long int FilterRatingsButton::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) { - return nux::Button::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo); - } - void FilterRatingsButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { int rating = 0; if (filter_ != NULL && filter_->filtering) @@ -190,27 +185,27 @@ namespace unity { nux::BaseTexture *texture = normal_empty_->GetTexture(); if (index < total_full_stars) { - if (state == nux::State::NUX_STATE_NORMAL) + if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_NORMAL) texture = normal_full_->GetTexture(); - else if (state == nux::State::NUX_STATE_PRELIGHT) + else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT) texture = prelight_full_->GetTexture(); - else if (state == nux::State::NUX_STATE_ACTIVE) + else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED) texture = active_full_->GetTexture(); } else if (index < total_full_stars + total_half_stars) { - if (state == nux::State::NUX_STATE_NORMAL) + if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_NORMAL) texture = normal_half_->GetTexture(); - else if (state == nux::State::NUX_STATE_PRELIGHT) + else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT) texture = prelight_half_->GetTexture(); - else if (state == nux::State::NUX_STATE_ACTIVE) + else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED) texture = active_half_->GetTexture(); } else { - if (state == nux::State::NUX_STATE_NORMAL) + if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_NORMAL) texture = normal_empty_->GetTexture(); - else if (state == nux::State::NUX_STATE_PRELIGHT) + else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT) texture = prelight_empty_->GetTexture(); - else if (state == nux::State::NUX_STATE_ACTIVE) + else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED) texture = active_empty_->GetTexture(); } diff --git a/plugins/unityshell/src/FilterRatingsButton.h b/plugins/unityshell/src/FilterRatingsButton.h index 5a7623467..1ccf52b2d 100644 --- a/plugins/unityshell/src/FilterRatingsButton.h +++ b/plugins/unityshell/src/FilterRatingsButton.h @@ -43,15 +43,14 @@ namespace unity { std::string GetFilterType (); protected: - virtual long ComputeLayout2 (); - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); + virtual long ComputeContentSize (); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); void InitTheme (); - void RecvMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags); + //void RecvMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags); void RecvMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags); void RecvMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags); void OnRatingsChanged (int rating); @@ -67,7 +66,7 @@ namespace unity { nux::CairoWrapper *normal_full_; nux::Geometry cached_geometry_; - void RedrawTheme (nux::Geometry const& geom, cairo_t *cr, int type, nux::State faked_state); + void RedrawTheme (nux::Geometry const& geom, cairo_t *cr, int type, nux::ButtonVisualState faked_state); dash::RatingsFilter::Ptr filter_; diff --git a/plugins/unityshell/src/FilterRatingsWidget.cpp b/plugins/unityshell/src/FilterRatingsWidget.cpp index b8c7a42d8..e30a59de0 100644 --- a/plugins/unityshell/src/FilterRatingsWidget.cpp +++ b/plugins/unityshell/src/FilterRatingsWidget.cpp @@ -42,8 +42,8 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterRatingsWidget); last_rating_ (0.0f) { any_button_ = new FilterBasicButton(_("All"), NUX_TRACKER_LOCATION); - any_button_->activated.connect(sigc::mem_fun(this, &FilterRatingsWidget::OnAnyButtonActivated)); - any_button_->label = _("All"); + any_button_->state_change.connect(sigc::mem_fun(this, &FilterRatingsWidget::OnAnyButtonActivated)); + any_button_->SetLabel(_("All")); SetRightHandView(any_button_); @@ -60,7 +60,7 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterRatingsWidget); void FilterRatingsWidget::OnAnyButtonActivated(nux::View *view) { - if (any_button_->active) + if (any_button_->Active()) { last_rating_ = filter_->rating; // we need to make sure the property changes, otherwise there'll be no @@ -78,11 +78,11 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterRatingsWidget); { if (new_rating <= 0.0f) { - any_button_->active = true; + any_button_->SetActive(true); } else { - any_button_->active = false; + any_button_->SetActive(false); } } @@ -100,11 +100,6 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterRatingsWidget); return "FilterRatingsWidget"; } - - long int FilterRatingsWidget::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) { - return GetLayout()->ProcessEvent(ievent, TraverseInfo, ProcessEventInfo); - } - void FilterRatingsWidget::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { nux::Geometry geo = GetGeometry(); diff --git a/plugins/unityshell/src/FilterRatingsWidget.h b/plugins/unityshell/src/FilterRatingsWidget.h index 68c0d29fb..e189a0714 100644 --- a/plugins/unityshell/src/FilterRatingsWidget.h +++ b/plugins/unityshell/src/FilterRatingsWidget.h @@ -51,7 +51,6 @@ namespace unity { nux::Property<int> rating; protected: - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/HomeView.cpp b/plugins/unityshell/src/HomeView.cpp index ce5877ba5..b456bc531 100644 --- a/plugins/unityshell/src/HomeView.cpp +++ b/plugins/unityshell/src/HomeView.cpp @@ -195,11 +195,6 @@ gboolean HomeView::FixRenderering(HomeView* self) return FALSE; } -long HomeView::ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info) -{ - return layout_->ProcessEvent(ievent, traverse_info, event_info); -} - void HomeView::Draw(nux::GraphicsEngine& gfx_context, bool force_draw) { nux::Geometry geo = GetGeometry(); diff --git a/plugins/unityshell/src/HomeView.h b/plugins/unityshell/src/HomeView.h index d3ef8f4f1..75c1ffaff 100644 --- a/plugins/unityshell/src/HomeView.h +++ b/plugins/unityshell/src/HomeView.h @@ -65,7 +65,6 @@ private: static gboolean FixRenderering(HomeView* self); - long ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info); void Draw(nux::GraphicsEngine& gfx_context, bool force_draw); void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw); diff --git a/plugins/unityshell/src/IMTextEntry.cpp b/plugins/unityshell/src/IMTextEntry.cpp index e47b383e9..7bc7a625b 100644 --- a/plugins/unityshell/src/IMTextEntry.cpp +++ b/plugins/unityshell/src/IMTextEntry.cpp @@ -50,7 +50,6 @@ IMTextEntry::IMTextEntry() CheckIMEnabled(); im_enabled ? SetupMultiIM() : SetupSimpleIM(); - FocusChanged.connect([&] (nux::Area*) { GetFocused() ? OnFocusIn() : OnFocusOut(); }); mouse_up.connect(sigc::mem_fun(this, &IMTextEntry::OnMouseButtonUp)); } diff --git a/plugins/unityshell/src/IconTexture.cpp b/plugins/unityshell/src/IconTexture.cpp index e108645fd..e9787c315 100644 --- a/plugins/unityshell/src/IconTexture.cpp +++ b/plugins/unityshell/src/IconTexture.cpp @@ -52,8 +52,6 @@ IconTexture::IconTexture(nux::BaseTexture* texture, guint width, guint height) _opacity(1.0f) { SetMinMaxSize(width, height); - SetCanFocus(false); - _can_pass_focus_to_composite_layout = false; _accept_key_nav_focus = false; } @@ -71,9 +69,6 @@ IconTexture::IconTexture(const char* icon_name, unsigned int size, bool defer_ic if (!g_strcmp0(_icon_name, "") == 0 && !defer_icon_loading) LoadIcon(); - - _can_pass_focus_to_composite_layout = false; - SetCanFocus(false); } IconTexture::~IconTexture() diff --git a/plugins/unityshell/src/Launcher.cpp b/plugins/unityshell/src/Launcher.cpp index bca3ef316..c04117297 100644 --- a/plugins/unityshell/src/Launcher.cpp +++ b/plugins/unityshell/src/Launcher.cpp @@ -2035,13 +2035,6 @@ void Launcher::OnIconNeedsRedraw(AbstractLauncherIcon* icon) EnsureAnimation(); } -long Launcher::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo) -{ - long ret = TraverseInfo; - ret = PostProcessEvent2(ievent, ret, ProcessEventInfo); - return ret; -} - void Launcher::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { @@ -2211,9 +2204,9 @@ void Launcher::PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw) void Launcher::PreLayoutManagement() { View::PreLayoutManagement(); - if (m_CompositionLayout) + if (view_layout_) { - m_CompositionLayout->SetGeometry(GetGeometry()); + view_layout_->SetGeometry(GetGeometry()); } } diff --git a/plugins/unityshell/src/Launcher.h b/plugins/unityshell/src/Launcher.h index 9fcac87d3..696409d53 100644 --- a/plugins/unityshell/src/Launcher.h +++ b/plugins/unityshell/src/Launcher.h @@ -109,7 +109,6 @@ public: nux::Property<Display*> display; - virtual long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/LensBar.cpp b/plugins/unityshell/src/LensBar.cpp index 03542bb8d..bcfa24b84 100644 --- a/plugins/unityshell/src/LensBar.cpp +++ b/plugins/unityshell/src/LensBar.cpp @@ -101,11 +101,6 @@ void LensBar::Activate(std::string id) } } -long LensBar::ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info) -{ - return layout_->ProcessEvent(ievent, traverse_info, event_info); -} - void LensBar::Draw(nux::GraphicsEngine& gfx_context, bool force_draw) { nux::Geometry geo = GetGeometry(); diff --git a/plugins/unityshell/src/LensBar.h b/plugins/unityshell/src/LensBar.h index 74ee20fbb..87bac3cfa 100644 --- a/plugins/unityshell/src/LensBar.h +++ b/plugins/unityshell/src/LensBar.h @@ -59,7 +59,6 @@ private: void SetupLayout(); void SetupHomeLens(); - long ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info); void Draw(nux::GraphicsEngine& gfx_context, bool force_draw); void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw); diff --git a/plugins/unityshell/src/LensView.cpp b/plugins/unityshell/src/LensView.cpp index 9fb805656..528451e13 100644 --- a/plugins/unityshell/src/LensView.cpp +++ b/plugins/unityshell/src/LensView.cpp @@ -359,11 +359,6 @@ void LensView::OnActiveChanged(bool is_active) lens_->active = is_active; } -long LensView::ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info) -{ - return layout_->ProcessEvent(ievent, traverse_info, event_info); -} - void LensView::Draw(nux::GraphicsEngine& gfx_context, bool force_draw) { nux::Geometry geo = GetGeometry(); diff --git a/plugins/unityshell/src/LensView.h b/plugins/unityshell/src/LensView.h index 479bd4a06..92b586f55 100644 --- a/plugins/unityshell/src/LensView.h +++ b/plugins/unityshell/src/LensView.h @@ -83,7 +83,6 @@ private: static gboolean FixRenderering(LensView* self); - virtual long ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info); virtual void Draw(nux::GraphicsEngine& gfx_context, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw); diff --git a/plugins/unityshell/src/PanelIndicatorsView.cpp b/plugins/unityshell/src/PanelIndicatorsView.cpp index f44acf917..50a32a086 100644 --- a/plugins/unityshell/src/PanelIndicatorsView.cpp +++ b/plugins/unityshell/src/PanelIndicatorsView.cpp @@ -102,16 +102,6 @@ PanelIndicatorsView::RemoveIndicator(indicator::Indicator::Ptr const& indicator) LOG_DEBUG(logger) << "IndicatorRemoved: " << indicator->name(); } -long -PanelIndicatorsView::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo) -{ - long ret = TraverseInfo; - - if (layout_) - ret = layout_->ProcessEvent(ievent, ret, ProcessEventInfo); - return ret; -} - void PanelIndicatorsView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { diff --git a/plugins/unityshell/src/PanelIndicatorsView.h b/plugins/unityshell/src/PanelIndicatorsView.h index e7da7b766..bd1ce4328 100644 --- a/plugins/unityshell/src/PanelIndicatorsView.h +++ b/plugins/unityshell/src/PanelIndicatorsView.h @@ -61,7 +61,6 @@ public: bool ActivateIfSensitive(); void GetGeometryForSync(indicator::EntryLocationMap& locations); - virtual long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void QueueDraw(); diff --git a/plugins/unityshell/src/PanelMenuView.cpp b/plugins/unityshell/src/PanelMenuView.cpp index 992738d08..f17900a53 100644 --- a/plugins/unityshell/src/PanelMenuView.cpp +++ b/plugins/unityshell/src/PanelMenuView.cpp @@ -215,51 +215,6 @@ PanelMenuView::FullRedraw() NeedRedraw(); } -long -PanelMenuView::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo) -{ - long ret = TraverseInfo; - nux::Geometry geo = GetAbsoluteGeometry(); - nux::Geometry geo_buttons = _window_buttons->GetAbsoluteGeometry(); - - if (!_we_control_active) - return _panel_titlebar_grab_area->OnEvent(ievent, ret, ProcessEventInfo); - - if (geo.IsPointInside(ievent.e_x, ievent.e_y) && !(_is_maximized && geo_buttons.IsPointInside(ievent.e_x, ievent.e_y))) - { - if (_is_inside != true) - { - if (_is_grabbed) - _is_grabbed = false; - else - _is_inside = true; - FullRedraw(); - } - } - else - { - if (_is_inside != false) - { - _is_inside = false; - FullRedraw(); - } - } - - if (_is_maximized || _places_showing) - { - if (_window_buttons) - ret = _window_buttons->ProcessEvent(ievent, ret, ProcessEventInfo); - if (_panel_titlebar_grab_area) - ret = _panel_titlebar_grab_area->OnEvent(ievent, ret, ProcessEventInfo); - } - ret = _panel_titlebar_grab_area->OnEvent(ievent, ret, ProcessEventInfo); - - if (!_is_own_window) - ret = _menu_layout->ProcessEvent(ievent, ret, ProcessEventInfo); - - return ret; -} - nux::Area* PanelMenuView::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type) { @@ -315,7 +270,7 @@ long PanelMenuView::PostLayoutManagement(long LayoutResult) old_window_buttons_w = _window_buttons->GetContentWidth(); _window_buttons->SetGeometry(geo.x + _padding, geo.y, old_window_buttons_w, geo.height); - _window_buttons->ComputeLayout2(); + _window_buttons->ComputeContentSize(); new_window_buttons_w = _window_buttons->GetContentWidth(); /* Explicitly set the size and position of the widgets */ @@ -324,7 +279,7 @@ long PanelMenuView::PostLayoutManagement(long LayoutResult) old_menu_area_w = _menu_layout->GetContentWidth(); _menu_layout->SetGeometry(geo.x, geo.y, old_menu_area_w, geo.height); - _menu_layout->ComputeLayout2(); + _menu_layout->ComputeContentSize(); new_menu_area_w = _menu_layout->GetContentWidth(); geo.x += new_menu_area_w; diff --git a/plugins/unityshell/src/PanelMenuView.h b/plugins/unityshell/src/PanelMenuView.h index d61f50a5d..36c484adf 100644 --- a/plugins/unityshell/src/PanelMenuView.h +++ b/plugins/unityshell/src/PanelMenuView.h @@ -57,7 +57,6 @@ public: void FullRedraw(); - virtual long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual long PostLayoutManagement(long LayoutResult); diff --git a/plugins/unityshell/src/PanelTray.cpp b/plugins/unityshell/src/PanelTray.cpp index 155d1c22a..5052b833a 100644 --- a/plugins/unityshell/src/PanelTray.cpp +++ b/plugins/unityshell/src/PanelTray.cpp @@ -275,10 +275,4 @@ PanelTray::AddProperties(GVariantBuilder* builder) } -long -PanelTray::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo) -{ - return TraverseInfo; -} - } // namespace unity diff --git a/plugins/unityshell/src/PanelTray.h b/plugins/unityshell/src/PanelTray.h index aeddf0f9d..d23ba31b9 100644 --- a/plugins/unityshell/src/PanelTray.h +++ b/plugins/unityshell/src/PanelTray.h @@ -42,7 +42,6 @@ public: ~PanelTray(); void Draw(nux::GraphicsEngine& gfx_content, bool force_draw); - long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo); void Sync(); unsigned int xid (); diff --git a/plugins/unityshell/src/PanelView.cpp b/plugins/unityshell/src/PanelView.cpp index 36712dc95..46359acb7 100644 --- a/plugins/unityshell/src/PanelView.cpp +++ b/plugins/unityshell/src/PanelView.cpp @@ -216,14 +216,6 @@ void PanelView::AddProperties(GVariantBuilder* builder) .add(GetGeometry()); } -long -PanelView::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo) -{ - long ret = TraverseInfo; - ret = _layout->ProcessEvent(ievent, ret, ProcessEventInfo); - return ret; -} - void PanelView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { @@ -443,7 +435,7 @@ void PanelView::OnObjectAdded(indicator::Indicator::Ptr const& proxy) _layout->SetContentDistribution(nux::eStackLeft); - ComputeChildLayout(); + ComputeContentSize(); NeedRedraw(); } @@ -460,14 +452,14 @@ void PanelView::OnObjectRemoved(indicator::Indicator::Ptr const& proxy) _layout->SetContentDistribution(nux::eStackLeft); - ComputeChildLayout(); + ComputeContentSize(); NeedRedraw(); } void PanelView::OnIndicatorViewUpdated(PanelIndicatorEntryView* view) { _needs_geo_sync = true; - ComputeChildLayout(); + ComputeContentSize(); } void PanelView::OnMenuPointerMoved(int x, int y) diff --git a/plugins/unityshell/src/PanelView.h b/plugins/unityshell/src/PanelView.h index bc94395c8..9af341c51 100644 --- a/plugins/unityshell/src/PanelView.h +++ b/plugins/unityshell/src/PanelView.h @@ -47,7 +47,6 @@ public: PanelView(NUX_FILE_LINE_PROTO); ~PanelView(); - long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo); void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/PlacesGroup.cpp b/plugins/unityshell/src/PlacesGroup.cpp index 5b2d788d8..10ddd6861 100644 --- a/plugins/unityshell/src/PlacesGroup.cpp +++ b/plugins/unityshell/src/PlacesGroup.cpp @@ -257,7 +257,7 @@ void PlacesGroup::Refresh() { RefreshLabel(); - ComputeChildLayout(); + ComputeContentSize(); QueueDraw(); } @@ -278,27 +278,13 @@ PlacesGroup::OnIdleRelayout(PlacesGroup* self) self->QueueDraw(); self->_group_layout->QueueDraw(); self->GetChildView()->QueueDraw(); - self->ComputeChildLayout(); + self->ComputeContentSize(); self->_idle_id = 0; - - if (self->GetFocused()) - { - self->SetFocused(false); // unset focus on all children - self->SetFocused(true); // set focus on first child - } } return FALSE; } -long -PlacesGroup::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo) -{ - long ret = TraverseInfo; - ret = _group_layout->ProcessEvent(ievent, TraverseInfo, ProcessEventInfo); - return ret; -} - void PlacesGroup::Draw(nux::GraphicsEngine& GfxContext, bool forceDraw) { diff --git a/plugins/unityshell/src/PlacesGroup.h b/plugins/unityshell/src/PlacesGroup.h index 16beceea3..cfd5dfaad 100644 --- a/plugins/unityshell/src/PlacesGroup.h +++ b/plugins/unityshell/src/PlacesGroup.h @@ -69,7 +69,6 @@ protected: private: void Refresh(); - long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo); void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); void PostDraw (nux::GraphicsEngine &GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/PlacesHomeView.cpp b/plugins/unityshell/src/PlacesHomeView.cpp index 8e7c50e25..3b6808d0d 100644 --- a/plugins/unityshell/src/PlacesHomeView.cpp +++ b/plugins/unityshell/src/PlacesHomeView.cpp @@ -99,10 +99,9 @@ PlacesHomeView::PlacesHomeView() _layout->ForceChildrenSize(true); _layout->SetChildrenSize(style->GetHomeTileWidth(), style->GetHomeTileHeight()); _layout->EnablePartialVisibility(false); - _layout->SetHeightMatchContent(true); - _layout->SetHorizontalExternalMargin(32); - _layout->SetVerticalInternalMargin(32); - _layout->SetHorizontalInternalMargin(32); + _layout->MatchContentSize(true); + _layout->SetLeftAndRightPadding(32); + _layout->SetSpaceBetweenChildren(32, 32); _layout->SetMinMaxSize((style->GetHomeTileWidth() * 4) + (32 * 5), (style->GetHomeTileHeight() * 2) + 32); diff --git a/plugins/unityshell/src/PlacesTile.cpp b/plugins/unityshell/src/PlacesTile.cpp index a6002c143..423a29366 100644 --- a/plugins/unityshell/src/PlacesTile.cpp +++ b/plugins/unityshell/src/PlacesTile.cpp @@ -47,7 +47,6 @@ PlacesTile::PlacesTile(NUX_FILE_LINE_DECL, const void* id) : mouse_leave.connect(sigc::mem_fun(this, &PlacesTile::RecvMouseLeave)); OnKeyNavFocusChange.connect(sigc::mem_fun(this, &PlacesTile::OnFocusChanged)); OnKeyNavFocusActivate.connect(sigc::mem_fun(this, &PlacesTile::OnFocusActivated)); - _can_pass_focus_to_composite_layout = false; } PlacesTile::~PlacesTile() @@ -182,12 +181,6 @@ PlacesTile::UpdateBackground() rop); } -long -PlacesTile::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo) -{ - return PostProcessEvent2(ievent, TraverseInfo, ProcessEventInfo); -} - nux::Area* PlacesTile::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type) { diff --git a/plugins/unityshell/src/PlacesTile.h b/plugins/unityshell/src/PlacesTile.h index 3fa5e62ef..86fa26e84 100644 --- a/plugins/unityshell/src/PlacesTile.h +++ b/plugins/unityshell/src/PlacesTile.h @@ -48,7 +48,6 @@ protected: private: void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); - long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo); void RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags); void RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags); diff --git a/plugins/unityshell/src/PreviewApplications.cpp b/plugins/unityshell/src/PreviewApplications.cpp index 533d386e0..df9891d8d 100644 --- a/plugins/unityshell/src/PreviewApplications.cpp +++ b/plugins/unityshell/src/PreviewApplications.cpp @@ -89,7 +89,7 @@ namespace unity { // create the action buttons PreviewBasicButton* primary_button = new PreviewBasicButton(preview_->primary_action_name.c_str(), NUX_TRACKER_LOCATION); //FIXME - add secondary action when we have the backend for it - primary_button->activated.connect ([&] (nux::View *view) { UriActivated.emit (preview_->primary_action_uri); }); + primary_button->state_change.connect ([&] (nux::View *view) { UriActivated.emit (preview_->primary_action_uri); }); button_container->AddLayout (new nux::SpaceLayout(6,6,6,6), 0); button_container->AddView (primary_button, 1); button_container->AddLayout (new nux::SpaceLayout(6,6,6,6), 0); @@ -147,9 +147,9 @@ namespace unity { SetLayout(large_container); } - long PreviewApplications::ComputeLayout2 () + long PreviewApplications::ComputeContentSize () { - return PreviewBase::ComputeLayout2(); + return PreviewBase::ComputeContentSize(); g_debug ("layout recomputing"); description->SetBaseWidth((GetGeometry().width / 2) - 16 - 12 ); description->SetMaximumWidth((GetGeometry().width / 2) - 16 - 12 ); @@ -169,10 +169,6 @@ namespace unity { GfxContent.PopClippingRectangle(); } - long int PreviewApplications::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) { - return PreviewBase::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo); - } - void PreviewApplications::PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw) { PreviewBase::PostDraw(GfxContext, force_draw); } diff --git a/plugins/unityshell/src/PreviewApplications.h b/plugins/unityshell/src/PreviewApplications.h index 545a0aaf0..3ac27a116 100644 --- a/plugins/unityshell/src/PreviewApplications.h +++ b/plugins/unityshell/src/PreviewApplications.h @@ -42,8 +42,7 @@ namespace unity { virtual void SetPreview(dash::Preview::Ptr preview); protected: - virtual long ComputeLayout2(); - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); + virtual long ComputeContentSize(); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/PreviewBase.cpp b/plugins/unityshell/src/PreviewBase.cpp index c5b94b846..c055bd2b7 100644 --- a/plugins/unityshell/src/PreviewBase.cpp +++ b/plugins/unityshell/src/PreviewBase.cpp @@ -38,9 +38,9 @@ namespace unity { { } - long PreviewBase::ComputeLayout2() + long PreviewBase::ComputeContentSize() { - return nux::View::ComputeLayout2(); + return nux::View::ComputeContentSize(); } void PreviewBase::Draw (nux::GraphicsEngine &GfxContext, bool force_draw) @@ -58,10 +58,6 @@ namespace unity { GfxContent.PopClippingRectangle(); } - long int PreviewBase::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) { - return PostProcessEvent2 (ievent, TraverseInfo, ProcessEventInfo); - } - void PreviewBase::PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw) { nux::View::PostDraw(GfxContext, force_draw); diff --git a/plugins/unityshell/src/PreviewBase.h b/plugins/unityshell/src/PreviewBase.h index 67d93ceae..17a19eb1e 100644 --- a/plugins/unityshell/src/PreviewBase.h +++ b/plugins/unityshell/src/PreviewBase.h @@ -42,8 +42,7 @@ namespace unity { sigc::signal<void, std::string> UriActivated; protected: - virtual long ComputeLayout2(); - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); + virtual long ComputeContentSize(); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/PreviewBasicButton.cpp b/plugins/unityshell/src/PreviewBasicButton.cpp index cf9685686..b7725c511 100644 --- a/plugins/unityshell/src/PreviewBasicButton.cpp +++ b/plugins/unityshell/src/PreviewBasicButton.cpp @@ -71,20 +71,20 @@ namespace unity { { if (prelight_ == NULL) { - prelight_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &PreviewBasicButton::RedrawTheme), nux::State::NUX_STATE_PRELIGHT)); - active_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &PreviewBasicButton::RedrawTheme), nux::State::NUX_STATE_ACTIVE)); - normal_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &PreviewBasicButton::RedrawTheme), nux::State::NUX_STATE_NORMAL)); + prelight_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &PreviewBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)); + active_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &PreviewBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED)); + normal_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &PreviewBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)); } } - void PreviewBasicButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::State faked_state) + void PreviewBasicButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::ButtonVisualState faked_state) { - DashStyle::Instance().Button(cr, faked_state, label); + DashStyle::Instance().Button(cr, faked_state, GetLabel()); } - long PreviewBasicButton::ComputeLayout2 () + long PreviewBasicButton::ComputeContentSize () { - long ret = nux::Button::ComputeLayout2(); + long ret = nux::Button::ComputeContentSize(); if (cached_geometry_ != GetGeometry()) { prelight_->Invalidate(GetGeometry()); @@ -96,10 +96,6 @@ namespace unity { return ret; } - long int PreviewBasicButton::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) { - return nux::Button::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo); - } - void PreviewBasicButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { gPainter.PaintBackground(GfxContext, GetGeometry()); @@ -123,9 +119,9 @@ namespace unity { col); nux::BaseTexture *texture = normal_->GetTexture(); - if (state == nux::State::NUX_STATE_PRELIGHT) + if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT) texture = prelight_->GetTexture(); - else if (state == nux::State::NUX_STATE_ACTIVE) + else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED) { texture = active_->GetTexture(); } diff --git a/plugins/unityshell/src/PreviewBasicButton.h b/plugins/unityshell/src/PreviewBasicButton.h index 20a0a7d23..f4addd76a 100644 --- a/plugins/unityshell/src/PreviewBasicButton.h +++ b/plugins/unityshell/src/PreviewBasicButton.h @@ -40,15 +40,14 @@ namespace unity { virtual ~PreviewBasicButton(); protected: - virtual long ComputeLayout2 (); - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); + virtual long ComputeContentSize (); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); private: void InitTheme (); - void RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::State faked_state); + void RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::ButtonVisualState faked_state); nux::CairoWrapper *prelight_; nux::CairoWrapper *active_; diff --git a/plugins/unityshell/src/PreviewGeneric.cpp b/plugins/unityshell/src/PreviewGeneric.cpp index 96c15e99a..5b45961ee 100644 --- a/plugins/unityshell/src/PreviewGeneric.cpp +++ b/plugins/unityshell/src/PreviewGeneric.cpp @@ -89,7 +89,7 @@ namespace unity { if (preview_->tertiary_action_name.empty() == false) { PreviewBasicButton* tertiary_button = new PreviewBasicButton(preview_->tertiary_action_name.c_str(), NUX_TRACKER_LOCATION); - tertiary_button->activated.connect ([&] (nux::View *view) { UriActivated.emit (preview_->tertiary_action_uri); }); + tertiary_button->state_change.connect ([&] (nux::View *view) { UriActivated.emit (preview_->tertiary_action_uri); }); button_container->AddLayout (new nux::SpaceLayout(6,6,6,6), 0); button_container->AddView (tertiary_button, 1); } @@ -97,7 +97,7 @@ namespace unity { if (preview_->secondary_action_name.empty() == false) { PreviewBasicButton* secondary_button = new PreviewBasicButton(preview_->secondary_action_name.c_str(), NUX_TRACKER_LOCATION); - secondary_button->activated.connect ([&] (nux::View *view) { UriActivated.emit (preview_->secondary_action_uri); }); + secondary_button->state_change.connect ([&] (nux::View *view) { UriActivated.emit (preview_->secondary_action_uri); }); button_container->AddLayout (new nux::SpaceLayout(6,6,6,6), 0); button_container->AddView (secondary_button, 1); } @@ -105,7 +105,7 @@ namespace unity { if (preview_->primary_action_name.empty() == false) { PreviewBasicButton* primary_button = new PreviewBasicButton(preview_->primary_action_name.c_str(), NUX_TRACKER_LOCATION); - primary_button->activated.connect ([&] (nux::View *view) { UriActivated.emit (preview_->primary_action_uri); }); + primary_button->state_change.connect ([&] (nux::View *view) { UriActivated.emit (preview_->primary_action_uri); }); button_container->AddLayout (new nux::SpaceLayout(6,6,6,6), 0); button_container->AddView (primary_button, 1); } @@ -151,10 +151,6 @@ namespace unity { GfxContent.PopClippingRectangle(); } - long int PreviewGeneric::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) { - return PreviewBase::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo); - } - void PreviewGeneric::PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw) { PreviewBase::PostDraw(GfxContext, force_draw); } diff --git a/plugins/unityshell/src/PreviewGeneric.h b/plugins/unityshell/src/PreviewGeneric.h index bed58d5b9..b2cd864e8 100644 --- a/plugins/unityshell/src/PreviewGeneric.h +++ b/plugins/unityshell/src/PreviewGeneric.h @@ -41,7 +41,6 @@ namespace unity { virtual void SetPreview(dash::Preview::Ptr preview); protected: - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/PreviewMusic.cpp b/plugins/unityshell/src/PreviewMusic.cpp index e92cf959b..5d831a4fd 100644 --- a/plugins/unityshell/src/PreviewMusic.cpp +++ b/plugins/unityshell/src/PreviewMusic.cpp @@ -114,7 +114,7 @@ namespace unity { PreviewBasicButton* primary_button = new PreviewBasicButton(preview_->primary_action_name.c_str(), NUX_TRACKER_LOCATION); //FIXME - add secondary action when we have the backend for it - primary_button->activated.connect ([&] (nux::View *view) { UriActivated.emit (preview_->primary_action_uri); }); + primary_button->state_change.connect ([&] (nux::View *view) { UriActivated.emit (preview_->primary_action_uri); }); nux::HLayout *large_container = new nux::HLayout(NUX_TRACKER_LOCATION); @@ -177,10 +177,6 @@ namespace unity { GfxContent.PopClippingRectangle(); } - long int PreviewMusicAlbum::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) { - return PreviewBase::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo); - } - void PreviewMusicAlbum::PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw) { PreviewBase::PostDraw(GfxContext, force_draw); } diff --git a/plugins/unityshell/src/PreviewMusic.h b/plugins/unityshell/src/PreviewMusic.h index 78e707781..87754a2bc 100644 --- a/plugins/unityshell/src/PreviewMusic.h +++ b/plugins/unityshell/src/PreviewMusic.h @@ -41,7 +41,6 @@ namespace unity { virtual void SetPreview(dash::Preview::Ptr preview); protected: - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/PreviewMusicTrack.cpp b/plugins/unityshell/src/PreviewMusicTrack.cpp index f500cc314..9ca85ef9d 100644 --- a/plugins/unityshell/src/PreviewMusicTrack.cpp +++ b/plugins/unityshell/src/PreviewMusicTrack.cpp @@ -106,7 +106,7 @@ namespace unity { PreviewBasicButton* primary_button = new PreviewBasicButton(preview_->primary_action_name.c_str(), NUX_TRACKER_LOCATION); //FIXME - add secondary action when we have the backend for it - primary_button->activated.connect ([&] (nux::View *view) { UriActivated.emit (preview_->primary_action_uri); }); + primary_button->state_change.connect ([&] (nux::View *view) { UriActivated.emit (preview_->primary_action_uri); }); nux::HLayout *large_container = new nux::HLayout(NUX_TRACKER_LOCATION); @@ -164,10 +164,6 @@ namespace unity { GfxContent.PopClippingRectangle(); } - long int PreviewMusicTrack::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) { - return PreviewBase::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo); - } - void PreviewMusicTrack::PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw) { PreviewBase::PostDraw(GfxContext, force_draw); } diff --git a/plugins/unityshell/src/PreviewMusicTrack.h b/plugins/unityshell/src/PreviewMusicTrack.h index b94a0a85f..9b19a8ce8 100644 --- a/plugins/unityshell/src/PreviewMusicTrack.h +++ b/plugins/unityshell/src/PreviewMusicTrack.h @@ -41,7 +41,6 @@ namespace unity { virtual void SetPreview(dash::Preview::Ptr preview); protected: - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/PreviewMusicTrackWidget.cpp b/plugins/unityshell/src/PreviewMusicTrackWidget.cpp index ba87c4a73..c62062e9d 100644 --- a/plugins/unityshell/src/PreviewMusicTrackWidget.cpp +++ b/plugins/unityshell/src/PreviewMusicTrackWidget.cpp @@ -83,7 +83,7 @@ namespace unity { //FIXME - use a button subclass for absolute renderering play_button_ = new nux::Button(number_.c_str()); - play_button_->activated.connect ([&] (nux::View *view) { + play_button_->state_change.connect ([&] (nux::View *view) { if (track_is_active) { is_paused = !is_paused; @@ -110,12 +110,6 @@ namespace unity { SetLayout(track_layout); } - - - long int PreviewMusicTrackWidget::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) { - return PostProcessEvent2 (ievent, TraverseInfo, ProcessEventInfo);; - } - void PreviewMusicTrackWidget::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { } diff --git a/plugins/unityshell/src/PreviewMusicTrackWidget.h b/plugins/unityshell/src/PreviewMusicTrackWidget.h index 386d30dc6..2870c5386 100644 --- a/plugins/unityshell/src/PreviewMusicTrackWidget.h +++ b/plugins/unityshell/src/PreviewMusicTrackWidget.h @@ -44,7 +44,6 @@ namespace unity { sigc::signal<void, std::string> UriActivated; protected: - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/QuicklistMenuItem.cpp b/plugins/unityshell/src/QuicklistMenuItem.cpp index c586c97e1..d9263fb28 100644 --- a/plugins/unityshell/src/QuicklistMenuItem.cpp +++ b/plugins/unityshell/src/QuicklistMenuItem.cpp @@ -150,18 +150,6 @@ QuicklistMenuItem::PostLayoutManagement(long layoutResult) return result; } -long -QuicklistMenuItem::ProcessEvent(nux::IEvent& event, - long traverseInfo, - long processEventInfo) -{ - long result = traverseInfo; - - result = nux::View::PostProcessEvent2(event, result, processEventInfo); - return result; - -} - void QuicklistMenuItem::Draw(nux::GraphicsEngine& gfxContext, bool forceDraw) diff --git a/plugins/unityshell/src/QuicklistMenuItem.h b/plugins/unityshell/src/QuicklistMenuItem.h index 152950539..2a8aa5199 100644 --- a/plugins/unityshell/src/QuicklistMenuItem.h +++ b/plugins/unityshell/src/QuicklistMenuItem.h @@ -63,10 +63,6 @@ public: long PostLayoutManagement(long layoutResult); - long ProcessEvent(nux::IEvent& event, - long traverseInfo, - long processEventInfo); - void Draw(nux::GraphicsEngine& gfxContext, bool forceDraw); diff --git a/plugins/unityshell/src/QuicklistMenuItemCheckmark.cpp b/plugins/unityshell/src/QuicklistMenuItemCheckmark.cpp index 79a66efae..c19cd9546 100644 --- a/plugins/unityshell/src/QuicklistMenuItemCheckmark.cpp +++ b/plugins/unityshell/src/QuicklistMenuItemCheckmark.cpp @@ -130,17 +130,6 @@ QuicklistMenuItemCheckmark::PostLayoutManagement(long layoutResult) return result; } -long -QuicklistMenuItemCheckmark::ProcessEvent(nux::IEvent& event, - long traverseInfo, - long processEventInfo) -{ - long result = traverseInfo; - - result = nux::View::PostProcessEvent2(event, result, processEventInfo); - return result; -} - void QuicklistMenuItemCheckmark::Draw(nux::GraphicsEngine& gfxContext, bool forceDraw) diff --git a/plugins/unityshell/src/QuicklistMenuItemCheckmark.h b/plugins/unityshell/src/QuicklistMenuItemCheckmark.h index dd8428cd4..94a300286 100644 --- a/plugins/unityshell/src/QuicklistMenuItemCheckmark.h +++ b/plugins/unityshell/src/QuicklistMenuItemCheckmark.h @@ -47,8 +47,6 @@ protected: long PostLayoutManagement(long layoutResult); - long ProcessEvent(nux::IEvent& event, long traverseInfo, long processEventInfo); - void Draw(nux::GraphicsEngine& gfxContext, bool forceDraw); void DrawContent(nux::GraphicsEngine& gfxContext, bool forceDraw); diff --git a/plugins/unityshell/src/QuicklistMenuItemLabel.cpp b/plugins/unityshell/src/QuicklistMenuItemLabel.cpp index b0d8d2902..e6c5b6456 100644 --- a/plugins/unityshell/src/QuicklistMenuItemLabel.cpp +++ b/plugins/unityshell/src/QuicklistMenuItemLabel.cpp @@ -119,17 +119,6 @@ QuicklistMenuItemLabel::PostLayoutManagement(long layoutResult) return result; } -long -QuicklistMenuItemLabel::ProcessEvent(nux::IEvent& event, - long traverseInfo, - long processEventInfo) -{ - long result = traverseInfo; - - result = nux::View::PostProcessEvent2(event, result, processEventInfo); - return result; -} - void QuicklistMenuItemLabel::Draw(nux::GraphicsEngine& gfxContext, bool forceDraw) diff --git a/plugins/unityshell/src/QuicklistMenuItemLabel.h b/plugins/unityshell/src/QuicklistMenuItemLabel.h index 9f1888480..9fc104050 100644 --- a/plugins/unityshell/src/QuicklistMenuItemLabel.h +++ b/plugins/unityshell/src/QuicklistMenuItemLabel.h @@ -47,8 +47,6 @@ protected: long PostLayoutManagement(long layoutResult); - long ProcessEvent(nux::IEvent& event, long traverseInfo, long processEventInfo); - void Draw(nux::GraphicsEngine& gfxContext, bool forceDraw); void DrawContent(nux::GraphicsEngine& gfxContext, bool forceDraw); diff --git a/plugins/unityshell/src/QuicklistMenuItemRadio.cpp b/plugins/unityshell/src/QuicklistMenuItemRadio.cpp index 7ece35699..f9f916a7f 100644 --- a/plugins/unityshell/src/QuicklistMenuItemRadio.cpp +++ b/plugins/unityshell/src/QuicklistMenuItemRadio.cpp @@ -130,17 +130,6 @@ QuicklistMenuItemRadio::PostLayoutManagement(long layoutResult) return result; } -long -QuicklistMenuItemRadio::ProcessEvent(nux::IEvent& event, - long traverseInfo, - long processEventInfo) -{ - long result = traverseInfo; - - result = nux::View::PostProcessEvent2(event, result, processEventInfo); - return result; -} - void QuicklistMenuItemRadio::Draw(nux::GraphicsEngine& gfxContext, bool forceDraw) diff --git a/plugins/unityshell/src/QuicklistMenuItemRadio.h b/plugins/unityshell/src/QuicklistMenuItemRadio.h index 161c34498..c84354ffc 100644 --- a/plugins/unityshell/src/QuicklistMenuItemRadio.h +++ b/plugins/unityshell/src/QuicklistMenuItemRadio.h @@ -45,10 +45,6 @@ protected: long PostLayoutManagement(long layoutResult); - long ProcessEvent(nux::IEvent& event, - long traverseInfo, - long processEventInfo); - void Draw(nux::GraphicsEngine& gfxContext, bool forceDraw); diff --git a/plugins/unityshell/src/QuicklistMenuItemSeparator.cpp b/plugins/unityshell/src/QuicklistMenuItemSeparator.cpp index d6469c53e..08d26a016 100644 --- a/plugins/unityshell/src/QuicklistMenuItemSeparator.cpp +++ b/plugins/unityshell/src/QuicklistMenuItemSeparator.cpp @@ -97,18 +97,6 @@ QuicklistMenuItemSeparator::PostLayoutManagement(long layoutResult) return result; } -long -QuicklistMenuItemSeparator::ProcessEvent(nux::IEvent& event, - long traverseInfo, - long processEventInfo) -{ - long result = traverseInfo; - - result = nux::View::PostProcessEvent2(event, result, processEventInfo); - return result; - -} - void QuicklistMenuItemSeparator::Draw(nux::GraphicsEngine& gfxContext, bool forceDraw) diff --git a/plugins/unityshell/src/QuicklistMenuItemSeparator.h b/plugins/unityshell/src/QuicklistMenuItemSeparator.h index bf1157bb1..e882e67d2 100644 --- a/plugins/unityshell/src/QuicklistMenuItemSeparator.h +++ b/plugins/unityshell/src/QuicklistMenuItemSeparator.h @@ -46,8 +46,6 @@ protected: long PostLayoutManagement(long layoutResult); - long ProcessEvent(nux::IEvent& event, long traverseInfo, long processEventInfo); - void Draw(nux::GraphicsEngine& gfxContext, bool forceDraw); void DrawContent(nux::GraphicsEngine& gfxContext, bool forceDraw); diff --git a/plugins/unityshell/src/QuicklistView.cpp b/plugins/unityshell/src/QuicklistView.cpp index 9725735f0..6e446a671 100644 --- a/plugins/unityshell/src/QuicklistView.cpp +++ b/plugins/unityshell/src/QuicklistView.cpp @@ -353,7 +353,6 @@ void QuicklistView::Hide() { CancelItemsPrelightStatus(); CaptureMouseDownAnyWhereElse(false); - ForceStopFocus(1, 1); UnGrabPointer(); UnGrabKeyboard(); //EnableInputWindow (false); @@ -361,61 +360,6 @@ void QuicklistView::Hide() } } -long QuicklistView::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo) -{ - long ret = TraverseInfo; - long ProcEvInfo = 0; - - nux::IEvent window_event = ievent; - nux::Geometry base = GetGeometry(); - window_event.e_x_root = base.x; - window_event.e_y_root = base.y; - - // The child layout get the Mouse down button only if the MouseDown happened inside the client view Area - nux::Geometry viewGeometry = GetGeometry(); - - if (ievent.e_event == nux::NUX_MOUSE_PRESSED) - { - if (!viewGeometry.IsPointInside(ievent.e_x - ievent.e_x_root, ievent.e_y - ievent.e_y_root)) - { - ProcEvInfo = nux::eDoNotProcess; - } - } - - // We choose to test the quicklist items ourselves instead of processing them as it is usual in nux. - // This is meant to be easier since the quicklist has a atypical way of working. - if (m_layout) - { - ret = m_layout->ProcessEvent(window_event, ret, ProcEvInfo); - } - - // The quicklist itself does not process the evvent. Instead we do some analysis of the event - // to detect the user action and perform the correct operation. - if (ievent.e_event == nux::NUX_MOUSE_PRESSED) - { - if (GetGeometry().IsPointInside(ievent.e_x, ievent.e_y)) - { - _mouse_down = true; - } - else - { - _mouse_down = false; - Hide(); - return nux::eMouseEventSolved; - } - } - else if ((ievent.e_event == nux::NUX_MOUSE_RELEASED) && _mouse_down) - { - _mouse_down = false; - Hide(); - return nux::eMouseEventSolved; - } - - ret = OnEvent(ievent, ret, ProcessEventInfo); - - return ret; -} - void QuicklistView::Draw(nux::GraphicsEngine& gfxContext, bool forceDraw) { // Get the geometry of the QuicklistView on the display @@ -806,7 +750,6 @@ void QuicklistView::RecvMouseDown(int x, int y, unsigned long button_flags, unsi // if (IsVisible ()) // { // CaptureMouseDownAnyWhereElse (false); -// ForceStopFocus (1, 1); // UnGrabPointer (); // EnableInputWindow (false); // ShowWindow (false); diff --git a/plugins/unityshell/src/QuicklistView.h b/plugins/unityshell/src/QuicklistView.h index 2adbd83dd..26d12c5b1 100644 --- a/plugins/unityshell/src/QuicklistView.h +++ b/plugins/unityshell/src/QuicklistView.h @@ -58,10 +58,6 @@ public: ~QuicklistView(); - long ProcessEvent(nux::IEvent& iEvent, - long traverseInfo, - long processEventInfo); - void Draw(nux::GraphicsEngine& gfxContext, bool forceDraw); diff --git a/plugins/unityshell/src/ResultView.cpp b/plugins/unityshell/src/ResultView.cpp index b42eb2280..b63be1f1b 100644 --- a/plugins/unityshell/src/ResultView.cpp +++ b/plugins/unityshell/src/ResultView.cpp @@ -74,11 +74,6 @@ ResultView::~ResultView() renderer_->UnReference(); } -long int ResultView::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) -{ - return TraverseInfo; -} - void ResultView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { @@ -145,7 +140,7 @@ void ResultView::SetPreview(PreviewBase* preview, Result& related_result) preview_layout_->Reference(); //FIXME - replace with nicer button subclass widgets nux::Button* left_arrow = new nux::Button("previous", NUX_TRACKER_LOCATION); - left_arrow->activated.connect([&](nux::View * view) + left_arrow->state_change.connect([&](nux::View * view) { ResultList::reverse_iterator it; std::string next_uri; @@ -167,7 +162,7 @@ void ResultView::SetPreview(PreviewBase* preview, Result& related_result) }); nux::Button* right_arrow = new nux::Button("next", NUX_TRACKER_LOCATION); - right_arrow->activated.connect([&](nux::View * view) + right_arrow->state_change.connect([&](nux::View * view) { ResultList::iterator it; std::string next_uri; @@ -204,9 +199,9 @@ void ResultView::SetPreview(PreviewBase* preview, Result& related_result) } } -long ResultView::ComputeLayout2() +long ResultView::ComputeContentSize() { - return View::ComputeLayout2(); + return View::ComputeContentSize(); } diff --git a/plugins/unityshell/src/ResultView.h b/plugins/unityshell/src/ResultView.h index 85f4ac619..3d288d937 100644 --- a/plugins/unityshell/src/ResultView.h +++ b/plugins/unityshell/src/ResultView.h @@ -61,9 +61,8 @@ public: protected: virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); - virtual long ComputeLayout2(); + virtual long ComputeContentSize(); // properties nux::Layout* preview_layout_; diff --git a/plugins/unityshell/src/ResultViewGrid.cpp b/plugins/unityshell/src/ResultViewGrid.cpp index a3e995881..6799de5b0 100644 --- a/plugins/unityshell/src/ResultViewGrid.cpp +++ b/plugins/unityshell/src/ResultViewGrid.cpp @@ -321,11 +321,6 @@ void ResultViewGrid::PositionPreview() } } -long int ResultViewGrid::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) -{ - return TraverseInfo; -} - bool ResultViewGrid::InspectKeyEvent(unsigned int eventType, unsigned int keysym, const char* character) { nux::KeyNavDirection direction = nux::KEY_NAV_NONE; @@ -536,11 +531,11 @@ void ResultViewGrid::OnOnKeyNavFocusChange(nux::Area *area) NeedRedraw(); } -long ResultViewGrid::ComputeLayout2() +long ResultViewGrid::ComputeContentSize() { SizeReallocate(); QueueLazyLoad(); - long ret = ResultView::ComputeLayout2(); + long ret = ResultView::ComputeContentSize(); return ret; } diff --git a/plugins/unityshell/src/ResultViewGrid.h b/plugins/unityshell/src/ResultViewGrid.h index 79c48061c..b1ccdd458 100644 --- a/plugins/unityshell/src/ResultViewGrid.h +++ b/plugins/unityshell/src/ResultViewGrid.h @@ -71,9 +71,8 @@ protected: void OnKeyDown(unsigned long event_type, unsigned long event_keysym, unsigned long event_state, const TCHAR* character, unsigned short key_repeat_count); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);; - virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); - virtual long ComputeLayout2(); + virtual long ComputeContentSize(); private: typedef std::tuple <int, int> ResultListBounds; diff --git a/plugins/unityshell/src/StaticCairoText.cpp b/plugins/unityshell/src/StaticCairoText.cpp index 08fc5bb28..72f307eb6 100644 --- a/plugins/unityshell/src/StaticCairoText.cpp +++ b/plugins/unityshell/src/StaticCairoText.cpp @@ -53,14 +53,12 @@ StaticCairoText::StaticCairoText(const TCHAR* text, _need_new_extent_cache = true; _pre_layout_width = 0; _pre_layout_height = 0; - _can_pass_focus_to_composite_layout = false; SetMinimumSize(1, 1); _ellipsize = NUX_ELLIPSIZE_END; _align = NUX_ALIGN_LEFT; _valign = NUX_ALIGN_TOP; _fontstring = NULL; - SetCanFocus(false); _accept_key_nav_focus = false; } @@ -160,17 +158,6 @@ long StaticCairoText::PostLayoutManagement(long layoutResult) return result; } -long -StaticCairoText::ProcessEvent(IEvent& event, - long traverseInfo, - long processEventInfo) -{ - long ret = traverseInfo; - - ret = PostProcessEvent2(event, ret, processEventInfo); - return ret; -} - void StaticCairoText::Draw(GraphicsEngine& gfxContext, bool forceDraw) diff --git a/plugins/unityshell/src/StaticCairoText.h b/plugins/unityshell/src/StaticCairoText.h index 37addefcf..5ce069d24 100644 --- a/plugins/unityshell/src/StaticCairoText.h +++ b/plugins/unityshell/src/StaticCairoText.h @@ -66,10 +66,6 @@ public: long PostLayoutManagement(long layoutResult); - long ProcessEvent(IEvent& event, - long traverseInfo, - long processEventInfo); - void Draw(GraphicsEngine& gfxContext, bool forceDraw); diff --git a/plugins/unityshell/src/SwitcherView.cpp b/plugins/unityshell/src/SwitcherView.cpp index 2c8481f8e..8bb8b062b 100644 --- a/plugins/unityshell/src/SwitcherView.cpp +++ b/plugins/unityshell/src/SwitcherView.cpp @@ -173,11 +173,6 @@ SwitcherModel::Ptr SwitcherView::GetModel() return model_; } -long SwitcherView::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo) -{ - return TraverseInfo; -} - void SwitcherView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { return; diff --git a/plugins/unityshell/src/SwitcherView.h b/plugins/unityshell/src/SwitcherView.h index 68173a0b4..050a26785 100644 --- a/plugins/unityshell/src/SwitcherView.h +++ b/plugins/unityshell/src/SwitcherView.h @@ -69,7 +69,6 @@ public: nux::Property<nux::Color> background_color; protected: - long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo); void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/plugins/unityshell/src/Tooltip.cpp b/plugins/unityshell/src/Tooltip.cpp index 302a0e27d..8a9756ba9 100644 --- a/plugins/unityshell/src/Tooltip.cpp +++ b/plugins/unityshell/src/Tooltip.cpp @@ -107,15 +107,6 @@ Area* Tooltip::FindAreaUnderMouse(const Point& mouse_position, NuxEventType even return 0; } -long Tooltip::ProcessEvent(IEvent& ievent, long TraverseInfo, long ProcessEventInfo) -{ - long ret = TraverseInfo; - - _tooltip_text->ProcessEvent(ievent, ret, ProcessEventInfo); - - return ret; -} - void Tooltip::ShowTooltipWithTipAt(int anchor_tip_x, int anchor_tip_y) { _anchorX = anchor_tip_x; diff --git a/plugins/unityshell/src/Tooltip.h b/plugins/unityshell/src/Tooltip.h index b73aae51f..7c05ba6c7 100644 --- a/plugins/unityshell/src/Tooltip.h +++ b/plugins/unityshell/src/Tooltip.h @@ -66,10 +66,6 @@ public: ~Tooltip(); - long ProcessEvent(IEvent& iEvent, - long traverseInfo, - long processEventInfo); - void Draw(GraphicsEngine& gfxContext, bool forceDraw); diff --git a/plugins/unityshell/src/WindowButtons.cpp b/plugins/unityshell/src/WindowButtons.cpp index 74e45fb3d..1001a33bf 100644 --- a/plugins/unityshell/src/WindowButtons.cpp +++ b/plugins/unityshell/src/WindowButtons.cpp @@ -325,21 +325,21 @@ WindowButtons::WindowButtons() but = new WindowButton(PanelStyle::WINDOW_BUTTON_CLOSE); AddView(but, 0, nux::eCenter, nux::eFix); - but->activated.connect(sigc::mem_fun(this, &WindowButtons::OnCloseClicked)); + but->state_change.connect(sigc::mem_fun(this, &WindowButtons::OnCloseClicked)); but->mouse_enter.connect(lambda_enter); but->mouse_leave.connect(lambda_leave); but->mouse_move.connect(lambda_moved); but = new WindowButton(PanelStyle::WINDOW_BUTTON_MINIMIZE); AddView(but, 0, nux::eCenter, nux::eFix); - but->activated.connect(sigc::mem_fun(this, &WindowButtons::OnMinimizeClicked)); + but->state_change.connect(sigc::mem_fun(this, &WindowButtons::OnMinimizeClicked)); but->mouse_enter.connect(lambda_enter); but->mouse_leave.connect(lambda_leave); but->mouse_move.connect(lambda_moved); but = new WindowButton(PanelStyle::WINDOW_BUTTON_UNMAXIMIZE); AddView(but, 0, nux::eCenter, nux::eFix); - but->activated.connect(sigc::mem_fun(this, &WindowButtons::OnRestoreClicked)); + but->state_change.connect(sigc::mem_fun(this, &WindowButtons::OnRestoreClicked)); but->mouse_enter.connect(lambda_enter); but->mouse_leave.connect(lambda_leave); but->mouse_move.connect(lambda_moved); diff --git a/plugins/unityshell/src/nux-area-accessible.cpp b/plugins/unityshell/src/nux-area-accessible.cpp index c7d72a015..af8710857 100644 --- a/plugins/unityshell/src/nux-area-accessible.cpp +++ b/plugins/unityshell/src/nux-area-accessible.cpp @@ -261,8 +261,9 @@ nux_area_accessible_ref_state_set(AtkObject* obj) atk_state_set_add_state(state_set, ATK_STATE_SHOWING); } - if (area->CanFocus()) - atk_state_set_add_state(state_set, ATK_STATE_FOCUSABLE); + // FIXME CanFocus is no longer part of Nux API +// if (area->CanFocus()) +// atk_state_set_add_state(state_set, ATK_STATE_FOCUSABLE); if (area->HasKeyFocus()) atk_state_set_add_state(state_set, ATK_STATE_FOCUSED); @@ -335,7 +336,7 @@ static gboolean nux_area_accessible_grab_focus(AtkComponent* component) { nux::Object* nux_object = NULL; - nux::Area* area = NULL; + //nux::Area* area = NULL; g_return_val_if_fail(NUX_IS_AREA_ACCESSIBLE(component), FALSE); @@ -343,9 +344,7 @@ nux_area_accessible_grab_focus(AtkComponent* component) if (nux_object == NULL) /* defunct */ return FALSE; - area = dynamic_cast<nux::Area*>(nux_object); - - area->SetFocused(TRUE); + //area = dynamic_cast<nux::Area*>(nux_object); /* FIXME: SetFocused doesn't return if the force was succesful or not, we suppose that this is the case like in cally and gail */ @@ -539,7 +538,7 @@ check_focus(NuxAreaAccessible* self) area = dynamic_cast<nux::Area*>(nux_object); - if (area->GetFocused()) + if (nux::GetWindowCompositor().GetKeyFocusArea() == area) focus_in = TRUE; if (self->priv->focused != focus_in) diff --git a/tests/TestDashStyle.cpp b/tests/TestDashStyle.cpp index bd72c1866..eff201bd4 100644 --- a/tests/TestDashStyle.cpp +++ b/tests/TestDashStyle.cpp @@ -26,8 +26,8 @@ namespace unity DashStyleO(); ~DashStyleO(); - bool ScrollbarVert (cairo_t* cr, nux::State state); - bool TrackView (cairo_t* cr, nux::State state); + bool ScrollbarVert (cairo_t* cr, nux::ButtonVisualState state); + bool TrackView (cairo_t* cr, nux::ButtonVisualState state); }; class DashStyleP : public DashStyle @@ -36,8 +36,8 @@ namespace unity DashStyleP(); ~DashStyleP(); - bool ScrollbarVert (cairo_t* cr, nux::State state); - bool TrackView (cairo_t* cr, nux::State state); + bool ScrollbarVert (cairo_t* cr, nux::ButtonVisualState state); + bool TrackView (cairo_t* cr, nux::ButtonVisualState state); }; DashStyleO::DashStyleO () @@ -48,7 +48,7 @@ namespace unity { } - bool DashStyleO::ScrollbarVert (cairo_t* cr, nux::State state) + bool DashStyleO::ScrollbarVert (cairo_t* cr, nux::ButtonVisualState state) { cairo_set_source_rgba (cr, 0.0, 1.0, 0.0, 1.0); cairo_paint (cr); @@ -56,7 +56,7 @@ namespace unity return true; } - bool DashStyleO::TrackView (cairo_t* cr, nux::State state) + bool DashStyleO::TrackView (cairo_t* cr, nux::ButtonVisualState state) { cairo_set_source_rgba (cr, 0.0, 1.0, 1.0, 1.0); cairo_paint (cr); @@ -72,7 +72,7 @@ namespace unity { } - bool DashStyleP::ScrollbarVert (cairo_t* cr, nux::State state) + bool DashStyleP::ScrollbarVert (cairo_t* cr, nux::ButtonVisualState state) { cairo_set_source_rgba (cr, 1.0, 0.0, 0.0, 1.0); cairo_paint (cr); @@ -80,7 +80,7 @@ namespace unity return true; } - bool DashStyleP::TrackView (cairo_t* cr, nux::State state) + bool DashStyleP::TrackView (cairo_t* cr, nux::ButtonVisualState state) { cairo_set_source_rgba (cr, 1.0, 1.0, 0.0, 1.0); cairo_paint (cr); @@ -115,40 +115,40 @@ int main (int argc, cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/empty.png"); // render some elements from different styles to PNG-images - pDashStyle->Button (cr, nux::NUX_STATE_NORMAL, "Play"); + pDashStyle->Button (cr, nux::VISUAL_STATE_NORMAL, "Play"); cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/button-normal.png"); wipe (cr); - pDashStyle->Button (cr, nux::NUX_STATE_ACTIVE, "Pause"); + pDashStyle->Button (cr, nux::VISUAL_STATE_PRESSED, "Pause"); cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/button-active.png"); wipe (cr); - pDashStyle->Button (cr, nux::NUX_STATE_PRELIGHT, "Record"); + pDashStyle->Button (cr, nux::VISUAL_STATE_PRELIGHT, "Record"); cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/button-prelight.png"); wipe (cr); - pDashStyle->Button (cr, nux::NUX_STATE_SELECTED, "Rewind"); - cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/button-selected.png"); - wipe (cr); + //pDashStyle->Button (cr, nux::NUX_STATE_SELECTED, "Rewind"); + //cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/button-selected.png"); + //wipe (cr); - pDashStyle->Button (cr, nux::NUX_STATE_INSENSITIVE, "Forward"); - cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/button-insensitive.png"); - wipe (cr); + //pDashStyle->Button (cr, nux::NUX_STATE_INSENSITIVE, "Forward"); + //cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/button-insensitive.png"); + //wipe (cr); - pDashStyle->StarEmpty (cr, nux::NUX_STATE_NORMAL); + pDashStyle->StarEmpty (cr, nux::VISUAL_STATE_NORMAL); cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/star-empty.png"); wipe (cr); - pDashStyle->StarHalf (cr, nux::NUX_STATE_NORMAL); + pDashStyle->StarHalf (cr, nux::VISUAL_STATE_NORMAL); cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/star-half.png"); wipe (cr); - pDashStyle->StarFull (cr, nux::NUX_STATE_NORMAL); + pDashStyle->StarFull (cr, nux::VISUAL_STATE_NORMAL); cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/star-full.png"); wipe (cr); pDashStyle->MultiRangeSegment (cr, - nux::NUX_STATE_NORMAL, + nux::VISUAL_STATE_NORMAL, "100KB", unity::DashStyle::Arrow::LEFT, unity::DashStyle::Segment::LEFT); @@ -156,7 +156,7 @@ int main (int argc, wipe (cr); pDashStyle->MultiRangeSegment (cr, - nux::NUX_STATE_ACTIVE, + nux::VISUAL_STATE_PRESSED, "10GB", unity::DashStyle::Arrow::LEFT, unity::DashStyle::Segment::MIDDLE); @@ -164,7 +164,7 @@ int main (int argc, wipe (cr); pDashStyle->MultiRangeSegment (cr, - nux::NUX_STATE_ACTIVE, + nux::VISUAL_STATE_PRESSED, "1MB", unity::DashStyle::Arrow::BOTH, unity::DashStyle::Segment::MIDDLE); @@ -172,7 +172,7 @@ int main (int argc, wipe (cr); pDashStyle->MultiRangeSegment (cr, - nux::NUX_STATE_ACTIVE, + nux::VISUAL_STATE_PRESSED, "1TB", unity::DashStyle::Arrow::RIGHT, unity::DashStyle::Segment::MIDDLE); @@ -180,22 +180,22 @@ int main (int argc, wipe (cr); pDashStyle->MultiRangeSegment (cr, - nux::NUX_STATE_ACTIVE, + nux::VISUAL_STATE_PRESSED, "100KB", unity::DashStyle::Arrow::LEFT, unity::DashStyle::Segment::RIGHT); cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/multirange-right.png"); wipe (cr); - pDashStyle->TrackViewNumber (cr, nux::NUX_STATE_NORMAL, "42"); + pDashStyle->TrackViewNumber (cr, nux::VISUAL_STATE_NORMAL, "42"); cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/track-view-number-normal.png"); wipe (cr); - pDashStyle->TrackViewPlay (cr, nux::NUX_STATE_NORMAL); + pDashStyle->TrackViewPlay (cr, nux::VISUAL_STATE_NORMAL); cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/track-view-play-normal.png"); wipe (cr); - pDashStyle->TrackViewPause (cr, nux::NUX_STATE_NORMAL); + pDashStyle->TrackViewPause (cr, nux::VISUAL_STATE_NORMAL); cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/track-view-pause-normal.png"); wipe (cr); diff --git a/tests/TestFilterBar.cpp b/tests/TestFilterBar.cpp index 60255a81d..067958a6f 100644 --- a/tests/TestFilterBar.cpp +++ b/tests/TestFilterBar.cpp @@ -38,7 +38,7 @@ public: static void InitWindowThread (nux::NThread* thread, void* InitData); void Init (); - nux::Layout *layout; + nux::LinearLayout *layout; private: @@ -60,8 +60,6 @@ void TestRunner::Init () layout->AddView (filterbar, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); - layout->SetFocused (true); - filterbar->AddFilter (NULL); filterbar->AddFilter (NULL); filterbar->AddFilter (NULL); diff --git a/tests/TestFilters.cpp b/tests/TestFilters.cpp index 543962794..416267075 100644 --- a/tests/TestFilters.cpp +++ b/tests/TestFilters.cpp @@ -74,8 +74,6 @@ void TestRunner::Init () layout->AddView(genre, 0, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL); layout->AddView(multi_range, 0, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL); - layout->SetFocused (true); - nux::GetGraphicsThread()->SetLayout (layout); } diff --git a/tests/TestPreviewApplications.cpp b/tests/TestPreviewApplications.cpp index 5b13c8377..1bb32d772 100644 --- a/tests/TestPreviewApplications.cpp +++ b/tests/TestPreviewApplications.cpp @@ -77,7 +77,6 @@ void TestRunner::Init () layout = new nux::VLayout(NUX_TRACKER_LOCATION); layout->AddView (preview_view, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); - layout->SetFocused (true); nux::GetGraphicsThread()->SetLayout (layout); } diff --git a/tests/TestPreviewGeneric.cpp b/tests/TestPreviewGeneric.cpp index 2dfdb6988..bce18eb18 100644 --- a/tests/TestPreviewGeneric.cpp +++ b/tests/TestPreviewGeneric.cpp @@ -82,7 +82,6 @@ void TestRunner::Init () layout = new nux::VLayout(NUX_TRACKER_LOCATION); layout->AddView (preview_view, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); - layout->SetFocused (true); nux::GetGraphicsThread()->SetLayout (layout); } diff --git a/tests/TestPreviewMusic.cpp b/tests/TestPreviewMusic.cpp index 0039e8008..29562feea 100644 --- a/tests/TestPreviewMusic.cpp +++ b/tests/TestPreviewMusic.cpp @@ -82,7 +82,6 @@ void TestRunner::Init () layout = new nux::VLayout(NUX_TRACKER_LOCATION); layout->AddView (preview_view, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); - layout->SetFocused (true); nux::GetGraphicsThread()->SetLayout (layout); } diff --git a/tests/TestSwitcher.cpp b/tests/TestSwitcher.cpp index 620e331fe..57ad7e7b0 100644 --- a/tests/TestSwitcher.cpp +++ b/tests/TestSwitcher.cpp @@ -141,10 +141,9 @@ void ThreadWidgetInit(nux::NThread* thread, void* InitData) view->GetView ()->render_boxes = true; - nux::CheckBox* flipping_check = new nux::CheckBox(TEXT("Enable Automatic Flipping"), NUX_TRACKER_LOCATION); + nux::CheckBox* flipping_check = new nux::CheckBox(TEXT("Enable Automatic Flipping"), false, NUX_TRACKER_LOCATION); flipping_check->SetMaximumWidth(250); - flipping_check->SetMaximumHeight(30); - flipping_check->active.changed.connect (sigc::ptr_fun (OnFlippingChanged)); + flipping_check->state_change.connect (sigc::ptr_fun (OnFlippingChanged)); layout->AddView(flipping_check, 1, nux::eRight, nux::eFull); @@ -261,15 +260,15 @@ void ThreadWidgetInit(nux::NThread* thread, void* InitData) control_buttons_layout->SetHorizontalInternalMargin (10); nux::Button* prev_button = new nux::Button ("Previous", NUX_TRACKER_LOCATION); - prev_button->activated.connect (sigc::ptr_fun (OnPreviousClicked)); + prev_button->state_change.connect (sigc::ptr_fun (OnPreviousClicked)); control_buttons_layout->AddView(prev_button, 1, nux::eLeft, nux::eFull); nux::Button* next_button = new nux::Button ("Next", NUX_TRACKER_LOCATION); - next_button->activated.connect (sigc::ptr_fun (OnNextClicked)); + next_button->state_change.connect (sigc::ptr_fun (OnNextClicked)); control_buttons_layout->AddView(next_button, 1, nux::eRight, nux::eFull); nux::Button* detail_button = new nux::Button ("Detail", NUX_TRACKER_LOCATION); - detail_button->activated.connect (sigc::ptr_fun (OnDetailClicked)); + detail_button->state_change.connect (sigc::ptr_fun (OnDetailClicked)); control_buttons_layout->AddView(detail_button, 1, nux::eRight, nux::eFull); layout->AddView(control_buttons_layout, 1, nux::eRight, nux::eFull); diff --git a/tests/standalone_dash.cpp b/tests/standalone_dash.cpp index bb8a92b46..1213bcf52 100644 --- a/tests/standalone_dash.cpp +++ b/tests/standalone_dash.cpp @@ -64,7 +64,6 @@ void TestRunner::Init () view->DisableBlur(); view->SetMinMaxSize(WIDTH, HEIGHT); layout->AddView (view, 1, nux::MINOR_POSITION_CENTER); - layout->SetFocused (true); layout->SetMinMaxSize(WIDTH, HEIGHT); view->AboutToShow(); |
