// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
/*
* Copyright (C) 2011 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* Authored by: Jason Smith
*/
#ifndef SWITCHERMODEL_H
#define SWITCHERMODEL_H
#include
#include "AbstractLauncherIcon.h"
#include "LauncherModel.h"
#include "unity-shared/Introspectable.h"
#include
#include
namespace unity
{
namespace switcher
{
class SwitcherModel : public debug::Introspectable, public sigc::trackable
{
public:
typedef boost::shared_ptr Ptr;
typedef std::vector Base;
typedef Base::iterator iterator;
typedef Base::reverse_iterator reverse_iterator;
nux::Property detail_selection;
nux::Property detail_selection_index;
nux::Property only_detail_on_viewport;
// Icons are owned externally and assumed valid for life of switcher.
// When AbstractLauncherIcon is complete, it will be passed as a shared pointer and this
// will no longer be a worry.
SwitcherModel(std::vector icons);
virtual ~SwitcherModel();
iterator begin();
iterator end();
reverse_iterator rbegin();
reverse_iterator rend();
launcher::AbstractLauncherIcon::Ptr at(unsigned int index);
int Size();
launcher::AbstractLauncherIcon::Ptr Selection();
int SelectionIndex();
launcher::AbstractLauncherIcon::Ptr LastSelection();
int LastSelectionIndex();
std::vector DetailXids ();
Window DetailSelectionWindow ();
void Next();
void Prev();
void NextDetail();
void PrevDetail();
void Select(launcher::AbstractLauncherIcon::Ptr selection);
void Select(unsigned int index);
sigc::signal selection_changed;
protected:
// Introspectable methods
std::string GetName() const;
void AddProperties(GVariantBuilder* builder);
private:
static bool CompareWindowsByActive (guint32 first, guint32 second);
Base _inner;
unsigned int _index;
unsigned int _last_index;
launcher::AbstractLauncherIcon::Ptr _last_active_icon;
};
}
}
#endif // SWITCHERMODEL_H