Back to index

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

#include <QuicklistView.h>

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

List of all members.

Public Types

typedef std::list
< Introspectable * > 
IntrospectableList

Public Member Functions

 QuicklistView ()
 ~QuicklistView ()
void SetText (std::string const &text)
void RemoveAllMenuItem ()
void AddMenuItem (QuicklistMenuItem *item)
void RenderQuicklistView ()
void ShowQuicklistWithTipAt (int anchor_tip_x, int anchor_tip_y)
virtual void ShowWindow (bool b, bool StartModal=false)
void Show ()
void Hide ()
int GetNumItems ()
QuicklistMenuItemGetNthItems (int index)
QuicklistMenuItemType GetNthType (int index)
int GetItemIndex (QuicklistMenuItem *item)
std::list< QuicklistMenuItem * > GetChildren ()
void SelectFirstItem ()
void TestMenuItems (DbusmenuMenuitem *root)
std::string GetName () const
void AddProperties (GVariantBuilder *builder)
IntrospectableList GetIntrospectableChildren ()
void EnableQuicklistForTesting (bool enable_testing)
virtual bool InspectKeyEvent (unsigned int eventType, unsigned int keysym, const char *character)
QuicklistMenuItemGetSelectedMenuItem ()
GVariant * Introspect ()
void AddChild (Introspectable *child)
void RemoveChild (Introspectable *child)
guint64 GetIntrospectionId () const

Public Attributes

sigc::signal< void > selection_change

Protected Member Functions

void Draw (nux::GraphicsEngine &gfxContext, bool forceDraw)
void DrawContent (nux::GraphicsEngine &gfxContext, bool forceDraw)
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'.

Protected Attributes

nux::ObjectPtr< nux::BaseTexture > texture_bg_
nux::ObjectPtr< nux::BaseTexture > texture_mask_
nux::ObjectPtr< nux::BaseTexture > texture_outline_
bool _use_blurred_background
bool _compute_blur_bkg

Private Member Functions

 NUX_DECLARE_OBJECT_TYPE (QuicklistView, unity::CairoBaseWindow)
void RecvCairoTextChanged (QuicklistMenuItem *item)
void RecvCairoTextColorChanged (QuicklistMenuItem *item)
void RecvItemMouseClick (QuicklistMenuItem *item, int x, int y)
void RecvItemMouseRelease (QuicklistMenuItem *item, int x, int y)
void RecvItemMouseEnter (QuicklistMenuItem *item)
void RecvItemMouseLeave (QuicklistMenuItem *item)
void RecvItemMouseDrag (QuicklistMenuItem *item, int x, int y)
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 RecvMouseClick (int x, int y, unsigned long button_flags, unsigned long key_flags)
void RecvMouseMove (int x, int y, int dx, int dy, 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 RecvMouseDownOutsideOfQuicklist (int x, int y, unsigned long button_flags, unsigned long key_flags)
void RecvKeyPressed (unsigned long eventType, unsigned long keysym, unsigned long state, const TCHAR *character, unsigned short keyCount)
void RecvStartFocus ()
void RecvEndFocus ()
void PreLayoutManagement ()
long PostLayoutManagement (long layoutResult)
void PositionChildLayout (float offsetX, float offsetY)
void LayoutWindowElements ()
void NotifyConfigurationChange (int width, int height)
void FillInDefaultItems ()
 A convenience function to fill in the default quicklist with some random items.
void CancelItemsPrelightStatus ()
void CheckAndEmitItemSignal (int x, int y)
 Check the mouse up event sent by an item. Detect the item where the mous is and emit the appropriate signal.
void ActivateItem (QuicklistMenuItem *item)
void SelectItem (int index)
bool IsMenuItemSelectable (int index)
void UpdateTexture ()

Private Attributes

int _anchorX
int _anchorY
std::string _labelText
int _top_size
bool _mouse_down
bool _enable_quicklist_for_testing
float _anchor_width
float _anchor_height
float _corner_radius
float _padding
float _left_padding_correction
float _bottom_padding_correction_normal
float _bottom_padding_correction_single_item
float _offset_correction
nux::HLayout * _hlayout
nux::VLayout * _vlayout
nux::VLayout * _item_layout
nux::SpaceLayout * _left_space
 Space from the left of the widget to the left of the text.
nux::SpaceLayout * _right_space
 Space from the right of the text to the right of the widget.
nux::SpaceLayout * _top_space
 Space from the left of the widget to the left of the text.
nux::SpaceLayout * _bottom_space
 Space from the right of the text to the right of the widget.
bool _cairo_text_has_changed
std::list< QuicklistMenuItem * > _item_list
int _current_item_index
IntrospectableList _introspectable_children

Detailed Description

Definition at line 41 of file QuicklistView.h.


Member Typedef Documentation

Definition at line 34 of file Introspectable.h.


Constructor & Destructor Documentation

Definition at line 56 of file QuicklistView.cpp.

  : _anchorX(0)
  , _anchorY(0)
  , _labelText("QuicklistView 1234567890")
  , _top_size(4)
  , _mouse_down(false)
  , _enable_quicklist_for_testing(false)
  , _anchor_width(10)
  , _anchor_height(18)
  , _corner_radius(4)
  , _padding(13)
  , _left_padding_correction(-1)
  , _bottom_padding_correction_normal(-2)
  , _bottom_padding_correction_single_item(-4)
  , _offset_correction(-1)
  , _cairo_text_has_changed(true)
  , _current_item_index(-1)
{
  SetGeometry(nux::Geometry(0, 0, 1, 1));

  _use_blurred_background = true;
  _compute_blur_bkg = true;

  _left_space = new nux::SpaceLayout(_padding +
                                     _anchor_width +
                                     _corner_radius +
                                     _left_padding_correction,
                                     _padding +
                                     _anchor_width +
                                     _corner_radius +
                                     _left_padding_correction,
                                     1, 1000);
  _right_space = new nux::SpaceLayout(_padding + _corner_radius,
                                      _padding + _corner_radius,
                                      1, 1000);
  _top_space = new nux::SpaceLayout(1, 1000,
                                    _padding + _corner_radius,
                                    _padding + _corner_radius);
  _bottom_space = new nux::SpaceLayout(1, 1000,
                                       _padding + _corner_radius,
                                       _padding + _corner_radius);

  _vlayout = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION);
  _vlayout->AddLayout(_top_space, 0);

  _item_layout     = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION);
  _vlayout->AddLayout(_item_layout, 0);

  _vlayout->AddLayout(_bottom_space, 0);
  _vlayout->SetMinimumWidth(140);

  _hlayout = new nux::HLayout(TEXT(""), NUX_TRACKER_LOCATION);
  _hlayout->AddLayout(_left_space, 0);
  _hlayout->AddLayout(_vlayout, 0, nux::eCenter, nux::eFull);
  _hlayout->AddLayout(_right_space, 0);

  SetWindowSizeMatchLayout(true);
  SetLayout(_hlayout);

  mouse_down_outside_pointer_grab_area.connect(sigc::mem_fun(this, &QuicklistView::RecvMouseDownOutsideOfQuicklist));
  mouse_down.connect(sigc::mem_fun(this, &QuicklistView::RecvMouseDown));
  mouse_up.connect(sigc::mem_fun(this, &QuicklistView::RecvMouseUp));
  mouse_click.connect(sigc::mem_fun(this, &QuicklistView::RecvMouseClick));
  mouse_move.connect(sigc::mem_fun(this, &QuicklistView::RecvMouseMove));
  mouse_drag.connect(sigc::mem_fun(this, &QuicklistView::RecvMouseDrag));
  key_down.connect(sigc::mem_fun(this, &QuicklistView::RecvKeyPressed));
  begin_key_focus.connect(sigc::mem_fun(this, &QuicklistView::RecvStartFocus));
  end_key_focus.connect(sigc::mem_fun(this, &QuicklistView::RecvEndFocus));

  SetAcceptKeyNavFocus(true);
}

Here is the call graph for this function:

Definition at line 317 of file QuicklistView.cpp.

{
  for (auto item : _item_list)
  {
    // Remove from introspection
    RemoveChild(item);
    item->UnReference();
  }

  _item_list.clear();
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 559 of file QuicklistView.cpp.

{
  if (item && item->_menuItem)
  {
    ubus_server_send_message(ubus_server_get_default(),
                             UBUS_PLACE_VIEW_CLOSE_REQUEST,
                             NULL);

    dbusmenu_menuitem_handle_event(item->_menuItem, "clicked", NULL, 0);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

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:

Definition at line 685 of file QuicklistView.cpp.

{
  if (item == 0)
    return;

  item->sigTextChanged.connect(sigc::mem_fun(this, &QuicklistView::RecvCairoTextChanged));
  item->sigColorChanged.connect(sigc::mem_fun(this, &QuicklistView::RecvCairoTextColorChanged));
  item->sigMouseClick.connect(sigc::mem_fun(this, &QuicklistView::RecvItemMouseClick));
  item->sigMouseReleased.connect(sigc::mem_fun(this, &QuicklistView::RecvItemMouseRelease));
  item->sigMouseEnter.connect(sigc::mem_fun(this, &QuicklistView::RecvItemMouseEnter));
  item->sigMouseLeave.connect(sigc::mem_fun(this, &QuicklistView::RecvItemMouseLeave));
  item->sigMouseDrag.connect(sigc::mem_fun(this, &QuicklistView::RecvItemMouseDrag));

  _item_list.push_back(item);
  item->Reference();
  // Add to introspection
  AddChild(item);

  _cairo_text_has_changed = true;
  nux::GetWindowThread()->QueueObjectLayout(this);
  NeedRedraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::QuicklistView::AddProperties ( GVariantBuilder *  builder) [virtual]

Implements unity::debug::Introspectable.

Definition at line 1347 of file QuicklistView.cpp.

{
  variant::BuilderWrapper(builder)
    .add(GetAbsoluteGeometry())
    .add("base_x", GetBaseX())
    .add("base_y", GetBaseY())
    .add("active", IsVisible());
}

Here is the call graph for this function:

Definition at line 585 of file QuicklistView.cpp.

{
  for (auto item : _item_list)
  {
    item->_prelight = false;
  }
}

Here is the caller graph for this function:

void unity::QuicklistView::CheckAndEmitItemSignal ( int  x,
int  y 
) [private]

Check the mouse up event sent by an item. Detect the item where the mous is and emit the appropriate signal.

Definition at line 540 of file QuicklistView.cpp.

{
  nux::Geometry geo;
  for (auto item : _item_list)
  {
    if (!item->GetVisible())
      continue;

    geo = item->GetGeometry();
    geo.width = _item_layout->GetBaseWidth();

    if (geo.IsPointInside(x, y))
    {
      // An action is performed: send the signal back to the application
      ActivateItem(item);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::QuicklistView::Draw ( nux::GraphicsEngine &  gfxContext,
bool  forceDraw 
) [protected]

Reimplemented from unity::CairoBaseWindow.

Definition at line 413 of file QuicklistView.cpp.

{
  CairoBaseWindow::Draw(gfxContext, forceDraw);

  nux::Geometry base(GetGeometry());
  base.x = 0;
  base.y = 0;

  gfxContext.PushClippingRectangle(base);

  for (auto item : _item_list)
  {
    if (item->GetVisible())
      item->ProcessDraw(gfxContext, forceDraw);
  }

  gfxContext.PopClippingRectangle();
}
void unity::QuicklistView::DrawContent ( nux::GraphicsEngine &  gfxContext,
bool  forceDraw 
) [protected]

Definition at line 432 of file QuicklistView.cpp.

{}
void unity::QuicklistView::EnableQuicklistForTesting ( bool  enable_testing)

Definition at line 330 of file QuicklistView.cpp.

{
  _enable_quicklist_for_testing = enable_testing;
}

A convenience function to fill in the default quicklist with some random items.

Definition at line 757 of file QuicklistView.cpp.

{
  return _item_list;
}

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:

Reimplemented from unity::debug::Introspectable.

Definition at line 1374 of file QuicklistView.cpp.

{
  _introspectable_children.clear();
  for (auto item: _item_list)
  {
    _introspectable_children.push_back(item);
  }
  return _introspectable_children;
}
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:

Definition at line 733 of file QuicklistView.cpp.

{
  int index = -1;

  for (auto it : _item_list)
  {
    ++index;

    if (it == item)
      return index;
  }

  return index;
}

Here is the caller graph for this function:

std::string unity::QuicklistView::GetName ( ) const [virtual]

Implements unity::debug::Introspectable.

Definition at line 1342 of file QuicklistView.cpp.

{
  return "Quicklist";
}

Definition at line 718 of file QuicklistView.cpp.

{
  if (index < (int)_item_list.size())
  {
    int i = 0;
    for (auto item : _item_list)
    {
      if (i++ == index)
        return item;
    }
  }

  return nullptr;
}

Here is the caller graph for this function:

Definition at line 748 of file QuicklistView.cpp.

{
  QuicklistMenuItem* item = GetNthItems(index);
  if (item)
    return item->GetItemType();

  return MENUITEM_TYPE_UNKNOWN;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 713 of file QuicklistView.cpp.

{
  return _item_list.size();
}

Here is the caller graph for this function:

Definition at line 1369 of file QuicklistView.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 394 of file QuicklistView.cpp.

{
  if (IsVisible() && !_enable_quicklist_for_testing)
  {
    CancelItemsPrelightStatus();
    CaptureMouseDownAnyWhereElse(false);
    UnGrabPointer();
    UnGrabKeyboard();
    //EnableInputWindow (false);
    ShowWindow(false);

    if (_current_item_index != -1)
    {
      selection_change.emit();
      _current_item_index = -1;
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool unity::QuicklistView::InspectKeyEvent ( unsigned int  eventType,
unsigned int  keysym,
const char *  character 
) [virtual]

Definition at line 1360 of file QuicklistView.cpp.

{
  // The Quicklist accepts all key inputs.
  return true;
}
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:

bool unity::QuicklistView::IsMenuItemSelectable ( int  index) [private]

Definition at line 165 of file QuicklistView.cpp.

{
  QuicklistMenuItem* menu_item = nullptr;

  if (index < 0)
    return false;

  menu_item = GetNthItems(index);
  if (!menu_item)
    return false;

  return menu_item->GetSelectable();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1287 of file QuicklistView.cpp.

{
}
void unity::QuicklistView::NotifyConfigurationChange ( int  width,
int  height 
) [private]

Definition at line 1291 of file QuicklistView.cpp.

{
}
void unity::QuicklistView::PositionChildLayout ( float  offsetX,
float  offsetY 
) [private]

Definition at line 1283 of file QuicklistView.cpp.

{
}
long unity::QuicklistView::PostLayoutManagement ( long  layoutResult) [private]

Definition at line 479 of file QuicklistView.cpp.

{
  long result = BaseWindow::PostLayoutManagement(LayoutResult);

  UpdateTexture();

  int x = _padding + _anchor_width + _corner_radius + _offset_correction;
  int y = _padding + _corner_radius + _offset_correction;

  for (auto item : _item_list)
  {
    if (!item->GetVisible())
      continue;

    item->SetBaseX(x);
    item->SetBaseY(y);

    y += item->GetBaseHeight();
  }

  // We must correct the width of line separators. The rendering of the separator can be smaller than the width of the
  // quicklist. The reason for that is, the quicklist width is determined by the largest entry it contains. That size is
  // only after MaxItemWidth is computed in QuicklistView::PreLayoutManagement.
  // The setting of the separator width is done here after the Layout cycle for this widget is over. The width of the separator
  // has bee set correctly during the layout cycle, but the cairo rendering still need to be adjusted.
  int separator_width = _item_layout->GetBaseWidth();

  for (auto item : _item_list)
  {
    if (item->GetVisible() && item->CairoSurfaceWidth() != separator_width)
    {
      // Compute textures of the item.
      item->UpdateTexture();
    }
  }

  return result;
}

Here is the call graph for this function:

Definition at line 435 of file QuicklistView.cpp.

{
  int MaxItemWidth = 0;
  int TotalItemHeight = 0;

  for (auto item : _item_list)
  {
    // Make sure item is in layout if it should be
    if (!item->GetVisible())
    {
      _item_layout->RemoveChildObject(item);
      continue;
    }
    else if (!item->GetParentObject())
      _item_layout->AddView(item, 1, nux::eCenter, nux::eFull);

    int  textWidth  = 0;
    int  textHeight = 0;
    item->GetTextExtents(textWidth, textHeight);
    if (textWidth > MaxItemWidth)
      MaxItemWidth = textWidth;
    TotalItemHeight += textHeight;
  }

  if (TotalItemHeight < _anchor_height)
  {
    _top_space->SetMinMaxSize(1, (_anchor_height - TotalItemHeight) / 2 + 1 + _padding + _corner_radius);
    _bottom_space->SetMinMaxSize(1, (_anchor_height - TotalItemHeight) / 2 + 1 +
                                     _padding + _corner_radius +
                                     _bottom_padding_correction_single_item);
  }
  else
  {
    _top_space->SetMinMaxSize(_padding + _corner_radius, _padding + _corner_radius);
    _bottom_space->SetMinMaxSize(_padding + _corner_radius - 2,
                                 _padding + _corner_radius +
                                 _bottom_padding_correction_normal);
  }

  _item_layout->SetMinimumWidth(MaxItemWidth);

  BaseWindow::PreLayoutManagement();
}

Definition at line 518 of file QuicklistView.cpp.

Here is the caller graph for this function:

Definition at line 523 of file QuicklistView.cpp.

{
  NeedRedraw();
}

Here is the caller graph for this function:

Definition at line 135 of file QuicklistView.cpp.

{
}

Here is the caller graph for this function:

void unity::QuicklistView::RecvItemMouseClick ( QuicklistMenuItem item,
int  x,
int  y 
) [private]

Definition at line 528 of file QuicklistView.cpp.

{
  _mouse_down = false;
  if (IsVisible() && item->GetEnabled())
  {
    // Check if the mouse was released over an item and emit the signal
    CheckAndEmitItemSignal(x + item->GetBaseX(), y + item->GetBaseY());

    Hide();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::QuicklistView::RecvItemMouseDrag ( QuicklistMenuItem item,
int  x,
int  y 
) [private]

Definition at line 593 of file QuicklistView.cpp.

{
  nux::Geometry geo;
  for (auto item : _item_list)
  {
    int item_index = GetItemIndex(item);

    if (!IsMenuItemSelectable(item_index))
      continue;

    geo = item->GetGeometry();
    geo.width = _item_layout->GetBaseWidth();

    if (geo.IsPointInside(x + item->GetBaseX(), y + item->GetBaseY()))
    {
      SelectItem(item_index);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 613 of file QuicklistView.cpp.

{
  int item_index = GetItemIndex(item);

  SelectItem(item_index);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 620 of file QuicklistView.cpp.

{
  int item_index = GetItemIndex(item);

  if (item_index < 0 || item_index == _current_item_index)
    SelectItem(-1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::QuicklistView::RecvItemMouseRelease ( QuicklistMenuItem item,
int  x,
int  y 
) [private]

Definition at line 571 of file QuicklistView.cpp.

{
  _mouse_down = false;


  if (IsVisible() && item->GetEnabled())
  {
    // Check if the mouse was released over an item and emit the signal
    CheckAndEmitItemSignal(x + item->GetBaseX(), y + item->GetBaseY());

    Hide();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::QuicklistView::RecvKeyPressed ( unsigned long  eventType,
unsigned long  keysym,
unsigned long  state,
const TCHAR *  character,
unsigned short  keyCount 
) [private]

Definition at line 180 of file QuicklistView.cpp.

{
  switch (key_sym)
  {
      // home or page up (highlight the first menu-hitem)
    case NUX_VK_PAGE_UP:
    case NUX_VK_HOME:
    {
      int num_items = GetNumItems();
      int target_index = -1;

      do
      {
        ++target_index;
      }
      while (!IsMenuItemSelectable(target_index) && target_index < num_items);

      if (target_index < num_items)
        SelectItem(target_index);

      break;
    }
      // end or page down (highlight the last menu-hitem)
    case NUX_VK_PAGE_DOWN:
    case NUX_VK_END:
    {
      int target_index = GetNumItems();

      do
      {
        --target_index;
      }
      while (!IsMenuItemSelectable(target_index) && target_index >= 0);

      if (target_index >= 0)
        SelectItem(target_index);

      break;
    }
      // up (highlight previous menu-item)
    case NUX_VK_UP:
    case NUX_KP_UP:
    {
      int target_index = _current_item_index;
      bool loop_back = false;

      if (target_index <= 0)
        target_index = GetNumItems();

      do
      {
        --target_index;

        // If the first item is not selectable, we must loop from the last one
        if (!loop_back && target_index == 0 && !IsMenuItemSelectable(target_index))
        {
          loop_back = true;
          target_index = GetNumItems() - 1;
        }
      }
      while (!IsMenuItemSelectable(target_index) && target_index >= 0);

      if (target_index >= 0)
        SelectItem(target_index);

      break;
    }

      // down (highlight next menu-item)
    case NUX_VK_DOWN:
    case NUX_KP_DOWN:
    {
      int target_index = _current_item_index;
      int num_items = GetNumItems();
      bool loop_back = false;

      if (target_index >= num_items - 1)
        target_index = -1;

      do
      {
        ++target_index;

        // If the last item is not selectable, we must loop from the first one
        if (!loop_back && target_index == num_items - 1 && !IsMenuItemSelectable(target_index))
        {
          loop_back = true;
          target_index = 0;
        }
      }
      while (!IsMenuItemSelectable(target_index) && target_index < num_items);

      if (target_index < num_items)
        SelectItem(target_index);

      break;
    }

      // left (close quicklist, go back to laucher key-nav)
    case NUX_VK_LEFT:
    case NUX_KP_LEFT:
      Hide();
      // inform Launcher we switch back to Launcher key-nav
      ubus_server_send_message(ubus_server_get_default(),
                               UBUS_QUICKLIST_END_KEY_NAV,
                               NULL);
      break;

      // esc (close quicklist, exit key-nav)
    case NUX_VK_ESCAPE:
      Hide();
      // inform UnityScreen we leave key-nav completely
      ubus_server_send_message(ubus_server_get_default(),
                               UBUS_LAUNCHER_END_KEY_NAV,
                               NULL);
      break;

      // <SPACE>, <RETURN> (activate selected menu-item)
    case NUX_VK_SPACE:
    case NUX_VK_ENTER:
    case NUX_KP_ENTER:
      if (IsMenuItemSelectable(_current_item_index))
      {
        ActivateItem(GetNthItems(_current_item_index));
        Hide();
      }
      break;

    default:
      break;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::QuicklistView::RecvMouseClick ( int  x,
int  y,
unsigned long  button_flags,
unsigned long  key_flags 
) [private]

Definition at line 645 of file QuicklistView.cpp.

{
  if (IsVisible())
  {
    Hide();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::QuicklistView::RecvMouseDown ( int  x,
int  y,
unsigned long  button_flags,
unsigned long  key_flags 
) [private]

Definition at line 628 of file QuicklistView.cpp.

{
//     if (IsVisible ())
//     {
//       CaptureMouseDownAnyWhereElse (false);
//       UnGrabPointer ();
//       EnableInputWindow (false);
//       ShowWindow (false);
//     }
}

Here is the caller graph for this function:

void unity::QuicklistView::RecvMouseDownOutsideOfQuicklist ( int  x,
int  y,
unsigned long  button_flags,
unsigned long  key_flags 
) [private]

Definition at line 663 of file QuicklistView.cpp.

{
  Hide();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::QuicklistView::RecvMouseDrag ( int  x,
int  y,
int  dx,
int  dy,
unsigned long  button_flags,
unsigned long  key_flags 
) [private]

Definition at line 658 of file QuicklistView.cpp.

{

}

Here is the caller graph for this function:

void unity::QuicklistView::RecvMouseMove ( int  x,
int  y,
int  dx,
int  dy,
unsigned long  button_flags,
unsigned long  key_flags 
) [private]

Definition at line 653 of file QuicklistView.cpp.

{

}

Here is the caller graph for this function:

void unity::QuicklistView::RecvMouseUp ( int  x,
int  y,
unsigned long  button_flags,
unsigned long  key_flags 
) [private]

Definition at line 639 of file QuicklistView.cpp.

{
  // Check if the mouse was released over an item and emit the signal
  CheckAndEmitItemSignal(x, y);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 129 of file QuicklistView.cpp.

{
  PushToFront();
}

Here is the caller graph for this function:

Definition at line 668 of file QuicklistView.cpp.

{
  for (auto item : _item_list)
  {
    // Remove from introspection
    RemoveChild(item);
    item->UnReference();
  }


  _item_list.clear();

  _item_layout->Clear();
  _cairo_text_has_changed = true;
  nux::GetWindowThread()->QueueObjectLayout(this);
}

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:

Definition at line 708 of file QuicklistView.cpp.

{

}

Definition at line 762 of file QuicklistView.cpp.

{
  SelectItem(0);
}

Here is the call graph for this function:

void unity::QuicklistView::SelectItem ( int  index) [private]

Definition at line 140 of file QuicklistView.cpp.

{
  CancelItemsPrelightStatus();
  int target_item = -1;

  if (IsMenuItemSelectable(index))
  {
    QuicklistMenuItem* menu_item = GetNthItems(index);

    if (menu_item)
    {
      target_item = index;
      menu_item->_prelight = true;
    }
  }

  if (_current_item_index != target_item)
  {
    _current_item_index = target_item;
    selection_change.emit();
    QueueDraw();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::QuicklistView::SetText ( std::string const &  text)

Definition at line 1295 of file QuicklistView.cpp.

{
  if (_labelText == text)
    return;

  _labelText = text;
  UpdateTexture();
}

Here is the call graph for this function:

Definition at line 378 of file QuicklistView.cpp.

{
  if (!IsVisible())
  {
    // FIXME: ShowWindow shouldn't need to be called first
    ShowWindow(true);
    PushToFront();
    //EnableInputWindow (true, "quicklist", false, true);
    //SetInputFocus ();
    GrabPointer();
    GrabKeyboard();
    QueueDraw();
    _compute_blur_bkg = true;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::QuicklistView::ShowQuicklistWithTipAt ( int  anchor_tip_x,
int  anchor_tip_y 
)

Definition at line 335 of file QuicklistView.cpp.

{
  _anchorX = anchor_tip_x;
  _anchorY = anchor_tip_y;

  if (!_enable_quicklist_for_testing)
  {
    if ((_item_list.size() != 0))
    {
      int offscreen_size = GetBaseY() +
                           GetBaseHeight() -
                           nux::GetWindowThread()->GetGraphicsDisplay().GetWindowHeight();

      if (offscreen_size > 0)
        _top_size = offscreen_size;
      else
        _top_size = 4;

      int x = _anchorX - _padding;
      int y = _anchorY - _anchor_height / 2 - _top_size - _corner_radius - _padding;

      SetBaseX(x);
      SetBaseY(y);
    }
    else
    {
      _top_size = 0;
      int x = _anchorX - _padding;
      int y = _anchorY - _anchor_height / 2 - _top_size - _corner_radius - _padding;

      SetBaseX(x);
      SetBaseY(y);
    }
  }

  Show();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::QuicklistView::ShowWindow ( bool  b,
bool  StartModal = false 
) [virtual]

Definition at line 373 of file QuicklistView.cpp.

Here is the caller graph for this function:

void unity::QuicklistView::TestMenuItems ( DbusmenuMenuitem *  root)

Definition at line 1304 of file QuicklistView.cpp.

{
  RemoveAllMenuItem();

  if (root == 0)
    return;

  GList* child = NULL;
  for (child = dbusmenu_menuitem_get_children(root); child != NULL; child = g_list_next(child))
  {
    const gchar* type = dbusmenu_menuitem_property_get((DbusmenuMenuitem*)child->data, DBUSMENU_MENUITEM_PROP_TYPE);
    const gchar* toggle_type = dbusmenu_menuitem_property_get((DbusmenuMenuitem*)child->data, DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE);

    if (g_strcmp0(type, DBUSMENU_CLIENT_TYPES_SEPARATOR) == 0)
    {
      QuicklistMenuItemSeparator* item = new QuicklistMenuItemSeparator((DbusmenuMenuitem*)child->data, NUX_TRACKER_LOCATION);
      AddMenuItem(item);
    }
    else if (g_strcmp0(toggle_type, DBUSMENU_MENUITEM_TOGGLE_CHECK) == 0)
    {
      QuicklistMenuItemCheckmark* item = new QuicklistMenuItemCheckmark((DbusmenuMenuitem*)child->data, NUX_TRACKER_LOCATION);
      AddMenuItem(item);
    }
    else if (g_strcmp0(toggle_type, DBUSMENU_MENUITEM_TOGGLE_RADIO) == 0)
    {
      QuicklistMenuItemRadio* item = new QuicklistMenuItemRadio((DbusmenuMenuitem*)child->data, NUX_TRACKER_LOCATION);
      AddMenuItem(item);
    }
    else //if (g_strcmp0 (type, DBUSMENU_MENUITEM_PROP_LABEL) == 0)
    {
      QuicklistMenuItemLabel* item = new QuicklistMenuItemLabel((DbusmenuMenuitem*)child->data, NUX_TRACKER_LOCATION);
      AddMenuItem(item);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1167 of file QuicklistView.cpp.

{
  if (!_cairo_text_has_changed)
    return;

  int size_above_anchor = -1; // equal to size below
  int width = GetBaseWidth();
  int height = GetBaseHeight();

  if (!_enable_quicklist_for_testing)
  {
    if (!_item_list.empty())
    {
      int offscreen_size = GetBaseY() +
                           height -
                           nux::GetWindowThread()->GetGraphicsDisplay().GetWindowHeight();

      if (offscreen_size > 0)
        _top_size = offscreen_size;
      else
        _top_size = 4;

      size_above_anchor = _top_size;
      int x = _anchorX - _padding;
      int y = _anchorY - _anchor_height / 2 - _top_size - _corner_radius - _padding;

      SetBaseX(x);
      SetBaseY(y);
    }
    else
    {
      _top_size = 0;
      size_above_anchor = -1;
      int x = _anchorX - _padding;
      int y = _anchorY - _anchor_height / 2 - _top_size - _corner_radius - _padding;

      SetBaseX(x);
      SetBaseY(y);
    }
  }

  float blur_coef         = 6.0f;

  nux::CairoGraphics cairo_bg(CAIRO_FORMAT_ARGB32, width, height);
  nux::CairoGraphics cairo_mask(CAIRO_FORMAT_ARGB32, width, height);
  nux::CairoGraphics cairo_outline(CAIRO_FORMAT_ARGB32, width, height);

  cairo_t* cr_bg      = cairo_bg.GetContext();
  cairo_t* cr_mask    = cairo_mask.GetContext();
  cairo_t* cr_outline = cairo_outline.GetContext();

  float   tint_color[4]    = {0.0f, 0.0f, 0.0f, 0.60f};
  float   hl_color[4]      = {1.0f, 1.0f, 1.0f, 0.35f};
  float   dot_color[4]     = {1.0f, 1.0f, 1.0f, 0.03f};
  float   shadow_color[4]  = {0.0f, 0.0f, 0.0f, 1.00f};
  float   outline_color[4] = {1.0f, 1.0f, 1.0f, 0.40f};
  float   mask_color[4]    = {1.0f, 1.0f, 1.0f, 1.00f};
//   float   anchor_width      = 10;
//   float   anchor_height     = 18;

  ql_tint_dot_hl(cr_bg,
                 width,
                 height,
                 width / 2.0f,
                 0,
                 nux::Max<float>(width / 1.6f, height / 1.6f),
                 tint_color,
                 hl_color,
                 dot_color);

  ql_compute_full_outline_shadow
  (
    cr_outline,
    cairo_outline.GetSurface(),
    width,
    height,
    _anchor_width,
    _anchor_height,
    size_above_anchor,
    _corner_radius,
    blur_coef,
    shadow_color,
    1.0f,
    _padding,
    outline_color);

  ql_compute_full_mask(
    cr_mask,
    cairo_mask.GetSurface(),
    width,
    height,
    _corner_radius,  // radius,
    16,             // shadow_radius,
    _anchor_width,   // anchor_width,
    _anchor_height,  // anchor_height,
    size_above_anchor,             // upper_size,
    true,           // negative,
    false,          // outline,
    1.0,            // line_width,
    _padding,        // padding_size,
    mask_color);

  cairo_destroy(cr_bg);
  cairo_destroy(cr_outline);
  cairo_destroy(cr_mask);

  texture_bg_ = texture_ptr_from_cairo_graphics(cairo_bg);
  texture_mask_ = texture_ptr_from_cairo_graphics(cairo_mask);
  texture_outline_ = texture_ptr_from_cairo_graphics(cairo_outline);

  _cairo_text_has_changed = false;

  // Request a redraw, so this area will be added to Compiz list of dirty areas.
  NeedRedraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 152 of file QuicklistView.h.

Definition at line 151 of file QuicklistView.h.

Definition at line 140 of file QuicklistView.h.

Definition at line 141 of file QuicklistView.h.

Definition at line 156 of file QuicklistView.h.

Definition at line 157 of file QuicklistView.h.

nux::SpaceLayout* unity::QuicklistView::_bottom_space [private]

Space from the right of the text to the right of the widget.

Definition at line 165 of file QuicklistView.h.

Definition at line 167 of file QuicklistView.h.

bool unity::CairoBaseWindow::_compute_blur_bkg [protected, inherited]

Definition at line 43 of file CairoBaseWindow.h.

Definition at line 153 of file QuicklistView.h.

Definition at line 172 of file QuicklistView.h.

Definition at line 149 of file QuicklistView.h.

nux::HLayout* unity::QuicklistView::_hlayout [private]

Definition at line 159 of file QuicklistView.h.

Definition at line 175 of file QuicklistView.h.

nux::VLayout* unity::QuicklistView::_item_layout [private]

Definition at line 161 of file QuicklistView.h.

Definition at line 169 of file QuicklistView.h.

std::string unity::QuicklistView::_labelText [private]

Definition at line 142 of file QuicklistView.h.

Definition at line 155 of file QuicklistView.h.

nux::SpaceLayout* unity::QuicklistView::_left_space [private]

Space from the left of the widget to the left of the text.

Definition at line 162 of file QuicklistView.h.

Definition at line 145 of file QuicklistView.h.

Definition at line 158 of file QuicklistView.h.

Definition at line 154 of file QuicklistView.h.

nux::SpaceLayout* unity::QuicklistView::_right_space [private]

Space from the right of the text to the right of the widget.

Definition at line 163 of file QuicklistView.h.

Definition at line 143 of file QuicklistView.h.

nux::SpaceLayout* unity::QuicklistView::_top_space [private]

Space from the left of the widget to the left of the text.

Definition at line 164 of file QuicklistView.h.

Definition at line 42 of file CairoBaseWindow.h.

nux::VLayout* unity::QuicklistView::_vlayout [private]

Definition at line 160 of file QuicklistView.h.

Definition at line 85 of file QuicklistView.h.

nux::ObjectPtr<nux::BaseTexture> unity::CairoBaseWindow::texture_bg_ [protected, inherited]

Definition at line 38 of file CairoBaseWindow.h.

nux::ObjectPtr<nux::BaseTexture> unity::CairoBaseWindow::texture_mask_ [protected, inherited]

Definition at line 39 of file CairoBaseWindow.h.

nux::ObjectPtr<nux::BaseTexture> unity::CairoBaseWindow::texture_outline_ [protected, inherited]

Definition at line 40 of file CairoBaseWindow.h.


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