Back to index

unity  6.0.0
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends
unity::indicator::AppmenuIndicator Class Reference

#include <AppmenuIndicator.h>

Inheritance diagram for unity::indicator::AppmenuIndicator:
Inheritance graph
[legend]
Collaboration diagram for unity::indicator::AppmenuIndicator:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::shared_ptr
< Indicator
Ptr
typedef std::list< Entry::PtrEntries

Public Member Functions

 AppmenuIndicator (std::string const &name)
virtual bool IsAppmenu () const
void ShowAppmenu (unsigned int xid, int x, int y, unsigned int timestamp) const
std::string const & name () const
void Sync (Entries const &new_entries)
Entry::Ptr GetEntry (std::string const &entry_id) const
Entries GetEntries () const

Public Attributes

sigc::signal< void, unsigned
int, int, int, unsigned int > 
on_show_appmenu
sigc::signal< void, Entry::Ptr
const & > 
on_entry_added
sigc::signal< void,
std::string const & > 
on_entry_removed
sigc::signal< void,
std::string const &, unsigned
int, int, int, unsigned int,
unsigned int > 
on_show_menu
sigc::signal< void,
std::string const &, unsigned
int > 
on_secondary_activate
sigc::signal< void,
std::string const &, int > 
on_scroll

Protected Member Functions

void OnEntryShowMenu (std::string const &entry_id, unsigned int xid, int x, int y, unsigned int button, unsigned int timestamp)
void OnEntrySecondaryActivate (std::string const &entry_id, unsigned int timestamp)
void OnEntryScroll (std::string const &entry_id, int delta)

Protected Attributes

Entries entries_
std::string name_
std::map< Entry::Ptr,
std::vector< sigc::connection > > 
entries_connections_

Friends

std::ostream & operator<< (std::ostream &out, Indicator const &i)

Detailed Description

Definition at line 30 of file AppmenuIndicator.h.


Member Typedef Documentation

typedef std::list<Entry::Ptr> unity::indicator::Indicator::Entries [inherited]

Definition at line 40 of file Indicator.h.

typedef std::shared_ptr<Indicator> unity::indicator::Indicator::Ptr [inherited]

Definition at line 39 of file Indicator.h.


Constructor & Destructor Documentation

Definition at line 27 of file AppmenuIndicator.cpp.

  : Indicator(name)
{}

Member Function Documentation

Definition at line 58 of file Indicator.cpp.

{
  return entries_;
}
Entry::Ptr unity::indicator::Indicator::GetEntry ( std::string const &  entry_id) const [inherited]

Definition at line 115 of file Indicator.cpp.

{
  for (auto entry : entries_)
    if (entry->id() == entry_id)
      return entry;

  return Entry::Ptr();
}

Here is the caller graph for this function:

virtual bool unity::indicator::AppmenuIndicator::IsAppmenu ( ) const [inline, virtual]

Reimplemented from unity::indicator::Indicator.

Definition at line 35 of file AppmenuIndicator.h.

{ return true; }
std::string const & unity::indicator::Indicator::name ( ) const [inherited]

Definition at line 53 of file Indicator.cpp.

{
  return name_;
}

Here is the caller graph for this function:

void unity::indicator::Indicator::OnEntryScroll ( std::string const &  entry_id,
int  delta 
) [protected, inherited]

Definition at line 136 of file Indicator.cpp.

{
  on_scroll.emit(entry_id, delta);
}

Here is the caller graph for this function:

void unity::indicator::Indicator::OnEntrySecondaryActivate ( std::string const &  entry_id,
unsigned int  timestamp 
) [protected, inherited]

Definition at line 130 of file Indicator.cpp.

{
  on_secondary_activate.emit(entry_id, timestamp);
}

Here is the caller graph for this function:

void unity::indicator::Indicator::OnEntryShowMenu ( std::string const &  entry_id,
unsigned int  xid,
int  x,
int  y,
unsigned int  button,
unsigned int  timestamp 
) [protected, inherited]

Definition at line 124 of file Indicator.cpp.

{
  on_show_menu.emit(entry_id, xid, x, y, button, timestamp);
}

Here is the caller graph for this function:

void unity::indicator::AppmenuIndicator::ShowAppmenu ( unsigned int  xid,
int  x,
int  y,
unsigned int  timestamp 
) const

Definition at line 31 of file AppmenuIndicator.cpp.

{
  on_show_appmenu.emit(xid, x, y, timestamp);
}
void unity::indicator::Indicator::Sync ( Indicator::Entries const &  new_entries) [inherited]

Definition at line 63 of file Indicator.cpp.

{
  Entries to_rm;

  if (entries_.size() == 0)
  {
    to_rm = entries_;
  }
  else
  {
    for (auto entry : entries_)
    {
      if (std::find(new_entries.begin(), new_entries.end(), entry) == new_entries.end())
      {
        to_rm.push_back(entry);
      }
    }
  }

  for (auto entry : to_rm) {
    for (auto conn : entries_connections_[entry])
      conn.disconnect();

    entries_connections_[entry].clear();

    on_entry_removed.emit(entry->id());
    entries_.remove(entry);
  }

  for (auto new_entry : new_entries)
  {
    if (GetEntry(new_entry->id()))
      continue;

    // Just add the new entry, and connect it up.
    sigc::connection conn;
    std::vector<sigc::connection>& new_entry_connections = entries_connections_[new_entry];

    conn = new_entry->on_show_menu.connect(sigc::mem_fun(this, &Indicator::OnEntryShowMenu));
    new_entry_connections.push_back(conn);

    conn = new_entry->on_secondary_activate.connect(sigc::mem_fun(this, &Indicator::OnEntrySecondaryActivate));
    new_entry_connections.push_back(conn);

    conn = new_entry->on_scroll.connect(sigc::mem_fun(this, &Indicator::OnEntryScroll));
    entries_.push_back(new_entry);
    new_entry_connections.push_back(conn);

    on_entry_added.emit(new_entry);
  }
}

Here is the call graph for this function:


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
Indicator const &  i 
) [friend, inherited]

Definition at line 141 of file Indicator.cpp.

{
  out << "<Indicator " << i.name() << std::endl;
  for (auto entry : i.entries_)
  {
    out << "\t" << entry << std::endl;
  }
  out << "\t>" << std::endl;
  return out;
}

Member Data Documentation

Definition at line 65 of file Indicator.h.

std::map<Entry::Ptr, std::vector<sigc::connection> > unity::indicator::Indicator::entries_connections_ [protected, inherited]

Definition at line 67 of file Indicator.h.

std::string unity::indicator::Indicator::name_ [protected, inherited]

Definition at line 66 of file Indicator.h.

sigc::signal<void, Entry::Ptr const&> unity::indicator::Indicator::on_entry_added [inherited]

Definition at line 54 of file Indicator.h.

sigc::signal<void, std::string const&> unity::indicator::Indicator::on_entry_removed [inherited]

Definition at line 55 of file Indicator.h.

sigc::signal<void, std::string const&, int> unity::indicator::Indicator::on_scroll [inherited]

Definition at line 58 of file Indicator.h.

sigc::signal<void, std::string const&, unsigned int> unity::indicator::Indicator::on_secondary_activate [inherited]

Definition at line 57 of file Indicator.h.

sigc::signal<void, unsigned int, int, int, unsigned int> unity::indicator::AppmenuIndicator::on_show_appmenu

Definition at line 39 of file AppmenuIndicator.h.

sigc::signal<void, std::string const&, unsigned int, int, int, unsigned int, unsigned int> unity::indicator::Indicator::on_show_menu [inherited]

Definition at line 56 of file Indicator.h.


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