Back to index

unity  6.0.0
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
unity::shortcut::Controller Class Reference

#include <ShortcutController.h>

Inheritance diagram for unity::shortcut::Controller:
Inheritance graph
[legend]
Collaboration diagram for unity::shortcut::Controller:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::shared_ptr
< Controller
Ptr
typedef std::list
< Introspectable * > 
IntrospectableList

Public Member Functions

 Controller (std::list< AbstractHint::Ptr > &hints)
bool Show ()
void Hide ()
bool Visible ()
bool IsEnabled ()
void SetAdjustment (int x, int y)
void SetEnabled (bool enabled)
GVariant * Introspect ()
void AddChild (Introspectable *child)
void RemoveChild (Introspectable *child)
virtual IntrospectableList GetIntrospectableChildren ()
guint64 GetIntrospectionId () const

Protected Member Functions

std::string GetName () const
void AddProperties (GVariantBuilder *builder)
virtual std::string GetChildsName () const
 Please don't override this unless you really need to. The only valid reason is if you have a property that simply must be called 'Children'.

Private Member Functions

void ConstructView ()
void EnsureView ()
void OnBackgroundUpdate (GVariant *data)
void OnFadeInUpdated (double opacity)
void OnFadeInEnded ()
void OnFadeOutUpdated (double opacity)
void OnFadeOutEnded ()
bool OnShowTimer ()

Private Attributes

View::Ptr view_
Model::Ptr model_
nux::Geometry workarea_
nux::ObjectPtr< nux::BaseWindow > view_window_
nux::HLayout * main_layout_
bool visible_
bool enabled_
nux::Color bg_color_
Animator fade_in_animator_
Animator fade_out_animator_
glib::Source::UniquePtr show_timer_
UBusManager ubus_manager_

Detailed Description

Definition at line 42 of file ShortcutController.h.


Member Typedef Documentation

Definition at line 34 of file Introspectable.h.

typedef std::shared_ptr<Controller> unity::shortcut::Controller::Ptr

Definition at line 45 of file ShortcutController.h.


Constructor & Destructor Documentation

Definition at line 34 of file ShortcutController.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 78 of file Introspectable.cpp.

{
  _children.push_back(child);
  child->_parents.push_back(this);
}

Here is the caller graph for this function:

void unity::shortcut::Controller::AddProperties ( GVariantBuilder *  builder) [protected, virtual]

Implements unity::debug::Introspectable.

Definition at line 216 of file ShortcutController.cpp.

{
  unity::variant::BuilderWrapper(builder)
  .add("timeout_duration", SUPER_TAP_DURATION + FADE_DURATION)
  .add("enabled", IsEnabled())
  .add("about_to_show", (Visible() && !fade_out_animator_.IsRunning() && view_window_ && view_window_->GetOpacity() != 1.0f))
  .add("about_to_hide", (Visible() && !fade_in_animator_.IsRunning() && view_window_ && view_window_->GetOpacity() != 1.0f))
  .add("visible", (Visible() && view_window_ && view_window_->GetOpacity() == 1.0f));
}

Here is the call graph for this function:

Definition at line 138 of file ShortcutController.cpp.

{
  view_ = View::Ptr(new View());
  AddChild(view_.GetPointer());
  view_->SetModel(model_);
  view_->background_color = bg_color_;

  if (!view_window_)
  {
    main_layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
    main_layout_->SetVerticalExternalMargin(0);
    main_layout_->SetHorizontalExternalMargin(0);

    view_window_ = new nux::BaseWindow("ShortcutHint");
    view_window_->SetLayout(main_layout_);
    view_window_->SetBackgroundColor(nux::Color(0x00000000));
  }

  main_layout_->AddView(view_.GetPointer());

  view_->SetupBackground(false);
  view_window_->SetOpacity(0.0);
  view_window_->ShowWindow(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 163 of file ShortcutController.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string unity::debug::Introspectable::GetChildsName ( ) const [protected, virtual, inherited]

Please don't override this unless you really need to. The only valid reason is if you have a property that simply must be called 'Children'.

Definition at line 92 of file Introspectable.cpp.

{
  return "Children";
}

Here is the caller graph for this function:

Introspectable::IntrospectableList unity::debug::Introspectable::GetIntrospectableChildren ( ) [virtual, inherited]

Reimplemented in unity::hud::View, unity::launcher::LauncherModel, unity::QuicklistView, and unity::dash::ResultView.

Definition at line 41 of file Introspectable.cpp.

{
  return _children;
}

Here is the caller graph for this function:

guint64 unity::debug::Introspectable::GetIntrospectionId ( ) const [inherited]

Definition at line 97 of file Introspectable.cpp.

{
  return _id;
}

Here is the caller graph for this function:

std::string unity::shortcut::Controller::GetName ( ) const [protected, virtual]

Implements unity::debug::Introspectable.

Definition at line 211 of file ShortcutController.cpp.

{
  return "ShortcutController";
}

Definition at line 177 of file ShortcutController.cpp.

{
  if (!visible_)
    return;

  visible_ = false;
  show_timer_.reset();

  if (view_window_)
  {
    view_->SetupBackground(false);
    fade_in_animator_.Stop();
    fade_out_animator_.Start(1.0 - view_window_->GetOpacity());
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

GVariant * unity::debug::Introspectable::Introspect ( ) [inherited]

Definition at line 47 of file Introspectable.cpp.

{
  GVariantBuilder  builder;
  GVariantBuilder  child_builder;
  gint             n_children = 0;

  g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}"));
  g_variant_builder_add(&builder, "{sv}", "id", g_variant_new_uint64(_id));

  AddProperties(&builder);

  g_variant_builder_init(&child_builder, G_VARIANT_TYPE("as"));

  auto children = GetIntrospectableChildren();
  for (auto it = children.begin(); it != children.end(); it++)
  {
    if ((*it)->GetName() != "")
    {
      g_variant_builder_add(&child_builder, "s", (*it)->GetName().c_str());
      n_children++;
    }
  }

  GVariant* child_results = g_variant_builder_end(&child_builder);

  if (n_children > 0)
    g_variant_builder_add(&builder, "{sv}", GetChildsName().c_str(), child_results);
  return g_variant_builder_end(&builder);
}

Here is the call graph for this function:

Definition at line 198 of file ShortcutController.cpp.

{
  return enabled_;
}

Here is the caller graph for this function:

void unity::shortcut::Controller::OnBackgroundUpdate ( GVariant *  data) [private]

Definition at line 91 of file ShortcutController.cpp.

{
  gdouble red, green, blue, alpha;
  g_variant_get(data, "(dddd)", &red, &green, &blue, &alpha);
  bg_color_ = nux::Color(red, green, blue, alpha);

  if (view_)
    view_->background_color = bg_color_;
}

Here is the caller graph for this function:

Definition at line 74 of file ShortcutController.cpp.

{
  view_window_->SetOpacity(1.0);
}

Here is the caller graph for this function:

void unity::shortcut::Controller::OnFadeInUpdated ( double  opacity) [private]

Definition at line 69 of file ShortcutController.cpp.

{
  view_window_->SetOpacity(opacity);
}

Here is the caller graph for this function:

Definition at line 85 of file ShortcutController.cpp.

{
  view_window_->SetOpacity(0.0);
}

Here is the caller graph for this function:

void unity::shortcut::Controller::OnFadeOutUpdated ( double  opacity) [private]

Definition at line 79 of file ShortcutController.cpp.

{
  double opacity = CLAMP(1.0f - progress, 0.0f, 1.0f);
  view_window_->SetOpacity(opacity);
}

Here is the caller graph for this function:

Definition at line 115 of file ShortcutController.cpp.

{
  if (!enabled_)
    return false;

  EnsureView();

  nux::Geometry geo;
  if (!view_->GetBaseGeometry(geo))
    return false;

  view_window_->SetGeometry(geo);

  if (visible_)
  {
    view_->SetupBackground(true);
    fade_out_animator_.Stop();
    fade_in_animator_.Start(view_window_->GetOpacity());
  }

  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 85 of file Introspectable.cpp.

{
  _children.remove(child);
  child->_parents.remove(this);
}

Here is the caller graph for this function:

void unity::shortcut::Controller::SetAdjustment ( int  x,
int  y 
)

Definition at line 169 of file ShortcutController.cpp.

{
  EnsureView();

  view_->SetAdjustment(x, y);
}

Here is the call graph for this function:

Definition at line 203 of file ShortcutController.cpp.

{
  enabled_ = enabled;
}

Definition at line 101 of file ShortcutController.cpp.

{
  if (enabled_)
  {
    show_timer_.reset(new glib::Timeout(SUPER_TAP_DURATION, sigc::mem_fun(this, &Controller::OnShowTimer)));
    model_->Fill();
    visible_ = true;

    return true;
  }

  return false;
}

Here is the call graph for this function:

Definition at line 193 of file ShortcutController.cpp.

{
  return visible_;
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 85 of file ShortcutController.h.

Definition at line 84 of file ShortcutController.h.

Definition at line 87 of file ShortcutController.h.

Definition at line 88 of file ShortcutController.h.

Definition at line 81 of file ShortcutController.h.

Definition at line 77 of file ShortcutController.h.

Definition at line 90 of file ShortcutController.h.

Definition at line 91 of file ShortcutController.h.

Definition at line 76 of file ShortcutController.h.

nux::ObjectPtr<nux::BaseWindow> unity::shortcut::Controller::view_window_ [private]

Definition at line 80 of file ShortcutController.h.

Definition at line 83 of file ShortcutController.h.

nux::Geometry unity::shortcut::Controller::workarea_ [private]

Definition at line 79 of file ShortcutController.h.


The documentation for this class was generated from the following files: