~3v1n0/unity/light-shortcuts

« back to all changes in this revision

Viewing changes to launcher/LauncherHideMachine.h

  • Committer: Marco Trevisan (Treviño)
  • Date: 2013-04-26 12:41:09 UTC
  • Revision ID: mail@3v1n0.net-20130426124109-t3b2shjah2omiqa2
Unity: Remove all the views, but the Shortcuts

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 LAUNCHERHIDEMACHINE
21
 
#define LAUNCHERHIDEMACHINE
22
 
 
23
 
#include <sigc++/sigc++.h>
24
 
#include <string>
25
 
#include <UnityCore/GLibSource.h>
26
 
 
27
 
#include "Decaymulator.h"
28
 
 
29
 
namespace unity
30
 
{
31
 
namespace launcher
32
 
{
33
 
 
34
 
class LauncherHideMachine : public sigc::trackable
35
 
{
36
 
public:
37
 
  typedef enum
38
 
  {
39
 
    HIDE_NEVER,
40
 
    AUTOHIDE,
41
 
    DODGE_WINDOWS,
42
 
    DODGE_ACTIVE_WINDOW,
43
 
  } HideMode;
44
 
 
45
 
  typedef enum
46
 
  {
47
 
    DEFAULT                = 0,
48
 
    LAUNCHER_HIDDEN        = 1 << 0,
49
 
    MOUSE_OVER_LAUNCHER    = 1 << 1,
50
 
    QUICKLIST_OPEN         = 1 << 2,
51
 
    EXTERNAL_DND_ACTIVE    = 1 << 3,
52
 
    INTERNAL_DND_ACTIVE    = 1 << 4,
53
 
    TRIGGER_BUTTON_SHOW    = 1 << 5,
54
 
    DND_PUSHED_OFF         = 1 << 6,
55
 
    MOUSE_MOVE_POST_REVEAL = 1 << 7,
56
 
    VERTICAL_SLIDE_ACTIVE  = 1 << 8,
57
 
    KEY_NAV_ACTIVE         = 1 << 9,
58
 
    PLACES_VISIBLE         = 1 << 10,
59
 
    SCALE_ACTIVE           = 1 << 11,
60
 
    EXPO_ACTIVE            = 1 << 12,
61
 
    MT_DRAG_OUT            = 1 << 13,
62
 
    REVEAL_PRESSURE_PASS   = 1 << 14,
63
 
    LAUNCHER_PULSE         = 1 << 15,
64
 
    LOCK_HIDE              = 1 << 16,
65
 
    SHORTCUT_KEYS_VISIBLE  = 1 << 17
66
 
  } HideQuirk;
67
 
 
68
 
  nux::Property<int> reveal_pressure;
69
 
  nux::Property<int> edge_decay_rate;
70
 
  nux::Property<float> reveal_progress;
71
 
 
72
 
  LauncherHideMachine();
73
 
 
74
 
  void     SetMode(HideMode mode);
75
 
  HideMode GetMode() const;
76
 
 
77
 
  void AddRevealPressure(int pressure);
78
 
 
79
 
  void SetQuirk(HideQuirk quirk, bool active);
80
 
  bool GetQuirk(HideQuirk quirk, bool allow_partial = true) const;
81
 
 
82
 
  bool ShouldHide() const;
83
 
 
84
 
  sigc::signal<void, bool> should_hide_changed;
85
 
 
86
 
  std::string DebugHideQuirks() const;
87
 
 
88
 
private:
89
 
  void EnsureHideState(bool skip_delay);
90
 
  void SetShouldHide(bool value, bool skip_delay);
91
 
  bool EmitShouldHideChanged();
92
 
 
93
 
  void OnDecayRateChanged (int value);
94
 
 
95
 
  ui::Decaymulator decaymulator_;
96
 
  HideMode  _mode;
97
 
  HideQuirk _quirks;
98
 
  bool      _should_hide;
99
 
  bool      _latest_emit_should_hide;
100
 
 
101
 
  glib::Source::UniquePtr _hide_delay_timeout;
102
 
  glib::Source::UniquePtr _hide_changed_emit_idle;
103
 
};
104
 
 
105
 
} // namespace launcher
106
 
} // namespace unity
107
 
 
108
 
#endif