~jamespharaoh/ubuntu/oneiric/unity/fix-for-880672

« back to all changes in this revision

Viewing changes to .pc/debian-changes-4.8.2-0ubuntu4/plugins/unityshell/src/SwitcherController.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-08-19 18:53:28 UTC
  • Revision ID: james.westby@ubuntu.com-20110819185328-qaxk9eepjaghewu9
Tags: 4.8.2-0ubuntu4
Backport another trunk commit to fix an alt-tab segfault

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
 
2
/*
 
3
 * Copyright (C) 2011 Canonical Ltd
 
4
 *
 
5
 * This program is free software: you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License version 3 as
 
7
 * published by the Free Software Foundation.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
 *
 
17
 * Authored by: Jason Smith <jason.smith@canonical.com>
 
18
 */
 
19
 
 
20
#ifndef SWITCHERCONTROLLER_H
 
21
#define SWITCHERCONTROLLER_H
 
22
 
 
23
#include "SwitcherModel.h"
 
24
#include "SwitcherView.h"
 
25
 
 
26
#include <boost/shared_ptr.hpp>
 
27
#include <sigc++/sigc++.h>
 
28
 
 
29
#include <Nux/Nux.h>
 
30
#include <Nux/BaseWindow.h>
 
31
#include <Nux/WindowCompositor.h>
 
32
 
 
33
namespace unity
 
34
{
 
35
namespace switcher
 
36
{
 
37
 
 
38
class SwitcherController : public sigc::trackable
 
39
{
 
40
 
 
41
public:
 
42
  enum SortMode
 
43
  {
 
44
    LAUNCHER_ORDER,
 
45
    FOCUS_ORDER,
 
46
  };
 
47
 
 
48
  enum ShowMode
 
49
  {
 
50
    ALL,
 
51
    CURRENT_VIEWPORT,
 
52
  };
 
53
 
 
54
  SwitcherController();
 
55
  virtual ~SwitcherController();
 
56
 
 
57
  nux::Property<int> timeout_length;
 
58
 
 
59
  nux::Property<bool> detail_on_timeout;
 
60
  nux::Property<int>  detail_timeout_length;
 
61
 
 
62
  void Show(ShowMode show, SortMode sort, bool reverse, std::vector<AbstractLauncherIcon*> results);
 
63
  void Hide(bool accept_state=true);
 
64
 
 
65
  bool Visible();
 
66
 
 
67
  void Next();
 
68
  void Prev();
 
69
 
 
70
  void NextDetail();
 
71
  void PrevDetail();
 
72
 
 
73
  void SetDetail(bool detail);
 
74
 
 
75
  void SelectFirstItem();
 
76
 
 
77
  void SetWorkspace(nux::Geometry geo);
 
78
 
 
79
  SwitcherView * GetView ();
 
80
 
 
81
  LayoutWindowList ExternalRenderTargets ();
 
82
 
 
83
private:
 
84
  enum DetailMode
 
85
  {
 
86
    TAB_NEXT_WINDOW,
 
87
    TAB_NEXT_WINDOW_LOOP,
 
88
    TAB_NEXT_TILE,
 
89
  };
 
90
 
 
91
  void ConstructView();
 
92
 
 
93
  void OnModelSelectionChanged(AbstractLauncherIcon *icon);
 
94
 
 
95
  int WindowsRelatedToSelection();
 
96
 
 
97
  static void OnBackgroundUpdate (GVariant *data, SwitcherController *self);
 
98
 
 
99
  SwitcherModel::Ptr model_;
 
100
  SwitcherView* view_;
 
101
 
 
102
  nux::Geometry workarea_;
 
103
 
 
104
  nux::BaseWindow* view_window_;
 
105
 
 
106
  bool visible_;
 
107
  guint show_timer_;
 
108
  guint detail_timer_;
 
109
  nux::Color bg_color_;
 
110
  DetailMode detail_mode_;
 
111
 
 
112
  static gboolean OnShowTimer(gpointer data);
 
113
  static gboolean OnDetailTimer(gpointer data);
 
114
 
 
115
  static bool CompareSwitcherItemsPriority(AbstractLauncherIcon* first, AbstractLauncherIcon* second);
 
116
 
 
117
};
 
118
 
 
119
}
 
120
}
 
121
 
 
122
#endif // SWITCHERCONTROLLER_H
 
123