Back to index

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

#include <PanelTitlebarGrabAreaView.h>

Inheritance diagram for unity::PanelTitlebarGrabArea:
Inheritance graph
[legend]
Collaboration diagram for unity::PanelTitlebarGrabArea:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::list
< Introspectable * > 
IntrospectableList

Public Member Functions

 PanelTitlebarGrabArea ()
 ~PanelTitlebarGrabArea ()
void SetGrabbed (bool enabled)
bool IsGrabbed ()
GVariant * Introspect ()
void AddChild (Introspectable *child)
void RemoveChild (Introspectable *child)
virtual IntrospectableList GetIntrospectableChildren ()
guint64 GetIntrospectionId () const

Public Attributes

sigc::signal< void, int, int > lower_request
sigc::signal< void, int, int > activate_request
sigc::signal< void, int, int > restore_request
sigc::signal< void, int, int > grab_started
sigc::signal< void, int, int > grab_move
sigc::signal< void, int, int > grab_end

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 OnMouseDown (int x, int y, unsigned long button_flags, unsigned long)
void OnMouseUp (int x, int y, unsigned long button_flags, unsigned long)
void OnGrabMove (int x, int y, int, int, unsigned long button_flags, unsigned long)

Private Attributes

Cursor grab_cursor_
bool grab_started_
nux::Point mouse_down_point_
unsigned int mouse_down_button_
glib::Source::UniquePtr mouse_down_timer_

Detailed Description

Definition at line 34 of file PanelTitlebarGrabAreaView.h.


Member Typedef Documentation

Definition at line 34 of file Introspectable.h.


Constructor & Destructor Documentation

Definition at line 40 of file PanelTitlebarGrabAreaView.cpp.

  : InputArea(NUX_TRACKER_LOCATION)
  , grab_cursor_(None)
  , grab_started_(false)
  , mouse_down_button_(0)
{
  EnableDoubleClick(true);

  mouse_down.connect(sigc::mem_fun(this, &PanelTitlebarGrabArea::OnMouseDown));
  mouse_up.connect(sigc::mem_fun(this, &PanelTitlebarGrabArea::OnMouseUp));
  mouse_drag.connect(sigc::mem_fun(this, &PanelTitlebarGrabArea::OnGrabMove));

  mouse_double_click.connect([&] (int x, int y, unsigned long button_flags, unsigned long)
  {
    if (nux::GetEventButton(button_flags) == 1)
      restore_request.emit(x, y);
  });
}

Here is the call graph for this function:

Definition at line 59 of file PanelTitlebarGrabAreaView.cpp.

{
  if (grab_cursor_)
    XFreeCursor(nux::GetGraphicsDisplay()->GetX11Display(), grab_cursor_);
}

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::PanelTitlebarGrabArea::AddProperties ( GVariantBuilder *  builder) [protected, virtual]

Implements unity::debug::Introspectable.

Definition at line 178 of file PanelTitlebarGrabAreaView.cpp.

{
  unity::variant::BuilderWrapper(builder)
  .add(GetAbsoluteGeometry())
  .add("grabbed", IsGrabbed());
}

Here is the call 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::PanelTitlebarGrabArea::GetName ( ) const [protected, virtual]

Implements unity::debug::Introspectable.

Definition at line 172 of file PanelTitlebarGrabAreaView.cpp.

{
  return "GrabArea";
}
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 86 of file PanelTitlebarGrabAreaView.cpp.

{
  return (grab_cursor_ != None);
}

Here is the caller graph for this function:

void unity::PanelTitlebarGrabArea::OnGrabMove ( int  x,
int  y,
int  ,
int  ,
unsigned long  button_flags,
unsigned  long 
) [private]

Definition at line 144 of file PanelTitlebarGrabAreaView.cpp.

{
  if (mouse_down_button_ != 1)
    return;

  if (mouse_down_timer_)
  {
    if (abs(mouse_down_point_.x - x) <= MOUSE_MOVEMENT_TOLERANCE &&
        abs(mouse_down_point_.y - y) <= MOUSE_MOVEMENT_TOLERANCE)
    {
      return;
    }

    mouse_down_timer_.reset();
  }

  if (!grab_started_)
  {
    grab_started.emit(x, y);
    grab_started_ = true;
  }
  else
  {
    grab_move.emit(x, y);
  }
}

Here is the caller graph for this function:

void unity::PanelTitlebarGrabArea::OnMouseDown ( int  x,
int  y,
unsigned long  button_flags,
unsigned  long 
) [private]

Definition at line 91 of file PanelTitlebarGrabAreaView.cpp.

{
  mouse_down_button_ = nux::GetEventButton(button_flags);

  if (mouse_down_button_ == 2)
  {
    lower_request.emit(x, y);
  }
  else if (mouse_down_button_ == 1)
  {
    mouse_down_point_.x = x;
    mouse_down_point_.y = y;

    mouse_down_timer_.reset(new glib::Timeout(MOUSE_DOWN_TIMEOUT));
    mouse_down_timer_->Run([&] () {
      if (!grab_started_)
      {
        nux::Point const& mouse = nux::GetGraphicsDisplay()->GetMouseScreenCoord();
        nux::Geometry const& geo = GetAbsoluteGeometry();
        grab_started.emit(mouse.x - geo.x, mouse.y - geo.y);
        grab_started_ = true;
      }

      mouse_down_timer_.reset();
      return false;
    });
  }
}

Here is the caller graph for this function:

void unity::PanelTitlebarGrabArea::OnMouseUp ( int  x,
int  y,
unsigned long  button_flags,
unsigned  long 
) [private]

Definition at line 120 of file PanelTitlebarGrabAreaView.cpp.

{
  int button = nux::GetEventButton(button_flags);

  if (button == 1)
  {
    if (mouse_down_timer_)
    {
      mouse_down_timer_.reset();
      activate_request.emit(x, y);
    }

    if (grab_started_)
    {
      grab_end.emit(x, y);
      grab_started_ = false;
    }
  }

  mouse_down_button_ = 0;
  mouse_down_point_.x = 0;
  mouse_down_point_.y = 0;
}

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:

Definition at line 65 of file PanelTitlebarGrabAreaView.cpp.

{
  auto display = nux::GetGraphicsDisplay()->GetX11Display();
  auto panel_window = static_cast<nux::BaseWindow*>(GetTopLevelViewWindow());

  if (!panel_window || !display)
    return;

  if (enabled && !grab_cursor_)
  {
    grab_cursor_ = XCreateFontCursor(display, XC_fleur);
    XDefineCursor(display, panel_window->GetInputWindowId(), grab_cursor_);
  }
  else if (!enabled && grab_cursor_)
  {
    XUndefineCursor(display, panel_window->GetInputWindowId());
    XFreeCursor(display, grab_cursor_);
    grab_cursor_ = None;
  }
}

Member Data Documentation

sigc::signal<void, int, int> unity::PanelTitlebarGrabArea::activate_request

Definition at line 47 of file PanelTitlebarGrabAreaView.h.

Definition at line 62 of file PanelTitlebarGrabAreaView.h.

sigc::signal<void, int, int> unity::PanelTitlebarGrabArea::grab_end

Definition at line 51 of file PanelTitlebarGrabAreaView.h.

sigc::signal<void, int, int> unity::PanelTitlebarGrabArea::grab_move

Definition at line 50 of file PanelTitlebarGrabAreaView.h.

sigc::signal<void, int, int> unity::PanelTitlebarGrabArea::grab_started

Definition at line 49 of file PanelTitlebarGrabAreaView.h.

Definition at line 63 of file PanelTitlebarGrabAreaView.h.

sigc::signal<void, int, int> unity::PanelTitlebarGrabArea::lower_request

Definition at line 46 of file PanelTitlebarGrabAreaView.h.

Definition at line 65 of file PanelTitlebarGrabAreaView.h.

Definition at line 64 of file PanelTitlebarGrabAreaView.h.

Definition at line 66 of file PanelTitlebarGrabAreaView.h.

sigc::signal<void, int, int> unity::PanelTitlebarGrabArea::restore_request

Definition at line 48 of file PanelTitlebarGrabAreaView.h.


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