~3v1n0/unity/light-shortcuts

« back to all changes in this revision

Viewing changes to dash/DashView.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
 
/*
2
 
 * Copyright (C) 2010 Canonical Ltd
3
 
 *
4
 
 * This program is free software: you can redistribute it and/or modify
5
 
 * it under the terms of the GNU General Public License version 3 as
6
 
 * published by the Free Software Foundation.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful,
9
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
 * GNU General Public License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU General Public License
14
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 *
16
 
 * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
17
 
 */
18
 
 
19
 
#ifndef UNITY_DASH_VIEW_H_
20
 
#define UNITY_DASH_VIEW_H_
21
 
 
22
 
#include <Nux/Nux.h>
23
 
#include <Nux/PaintLayer.h>
24
 
#include <Nux/View.h>
25
 
#include <Nux/VLayout.h>
26
 
 
27
 
#include <UnityCore/FilesystemLenses.h>
28
 
#include <UnityCore/HomeLens.h>
29
 
#include <UnityCore/GLibSource.h>
30
 
 
31
 
#include "ApplicationStarter.h"
32
 
#include "LensBar.h"
33
 
#include "LensView.h"
34
 
#include "previews/PreviewContainer.h"
35
 
#include "PreviewStateMachine.h"
36
 
#include "UnityCore/Preview.h"
37
 
 
38
 
#include "unity-shared/BackgroundEffectHelper.h"
39
 
#include "unity-shared/BGHash.h"
40
 
#include "unity-shared/Introspectable.h"
41
 
#include "unity-shared/OverlayRenderer.h"
42
 
#include "unity-shared/SearchBar.h"
43
 
#include "unity-shared/UBusWrapper.h"
44
 
#include "unity-shared/OverlayWindowButtons.h"
45
 
 
46
 
 
47
 
namespace na = nux::animation;
48
 
 
49
 
namespace unity
50
 
{
51
 
namespace dash
52
 
{
53
 
 
54
 
class DashLayout;
55
 
 
56
 
class DashView : public nux::View, public unity::debug::Introspectable
57
 
{
58
 
  NUX_DECLARE_OBJECT_TYPE(DashView, nux::View);
59
 
  typedef std::map<std::string, nux::ObjectPtr<LensView>> LensViews;
60
 
 
61
 
public:
62
 
   DashView(Lenses::Ptr const& lenses, ApplicationStarter::Ptr const& application_starter);
63
 
  ~DashView();
64
 
 
65
 
  void AboutToShow();
66
 
  void AboutToHide();
67
 
  void Relayout();
68
 
  void DisableBlur();
69
 
  void OnActivateRequest(GVariant* args);
70
 
  void SetMonitorOffset(int x, int y);
71
 
 
72
 
  bool IsCommandLensOpen() const;
73
 
 
74
 
  std::string const GetIdForShortcutActivation(std::string const& shortcut) const;
75
 
  std::vector<char> GetAllShortcuts();
76
 
 
77
 
  nux::View* default_focus() const;
78
 
 
79
 
  nux::Geometry const& GetContentGeometry() const;
80
 
 
81
 
protected:
82
 
  void ProcessDndEnter();
83
 
 
84
 
  virtual Area* FindKeyFocusArea(unsigned int key_symbol,
85
 
    unsigned long x11_key_code,
86
 
    unsigned long special_keys_state);
87
 
 
88
 
private:
89
 
  void SetupViews();
90
 
  void SetupUBusConnections();
91
 
  void OnBGColorChanged(GVariant *data);
92
 
  nux::Geometry GetBestFitGeometry(nux::Geometry const& for_geo);
93
 
 
94
 
  void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);
95
 
  void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw);
96
 
  virtual long PostLayoutManagement (long LayoutResult);
97
 
  nux::Area* FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type);
98
 
 
99
 
  // Dash animations
100
 
  void DrawDashSplit(nux::GraphicsEngine& graphics_engine, nux::Geometry& split_clip);
101
 
  void DrawPreviewContainer(nux::GraphicsEngine& graphics_engine);
102
 
  void DrawPreviewResultTextures(nux::GraphicsEngine& gfx_context, bool force_draw);
103
 
  void DrawPreview(nux::GraphicsEngine& gfx_context, bool force_draw);
104
 
  void StartPreviewAnimation();
105
 
  void EndPreviewAnimation();
106
 
 
107
 
  void BuildPreview(Preview::Ptr model);
108
 
  void ClosePreview();
109
 
  void OnPreviewAnimationFinished();
110
 
  void OnMouseButtonDown(int x, int y, unsigned long button, unsigned long key);
111
 
  void OnBackgroundColorChanged(GVariant* args);
112
 
  void OnSearchChanged(std::string const& search_string);
113
 
  void OnLiveSearchReached(std::string const& search_string);
114
 
  void OnLensAdded(Lens::Ptr& lens);
115
 
  void OnLensBarActivated(std::string const& id);
116
 
  void OnSearchFinished(Lens::Hints const& hints, glib::Error const& error);
117
 
  void OnGlobalSearchFinished(Lens::Hints const& hints, glib::Error const& error);
118
 
  void OnAppsGlobalSearchFinished(Lens::Ptr const& lens);
119
 
  void OnUriActivated(ResultView::ActivateType type, std::string const& uri, GVariant* data, std::string const& unique_id);
120
 
  void OnUriActivatedReply(std::string const& uri, HandledType type, Lens::Hints const&);
121
 
  bool DoFallbackActivation(std::string const& uri);
122
 
  bool LaunchApp(std::string const& appname);
123
 
  void OnEntryActivated();
124
 
  std::string AnalyseLensURI(std::string const& uri);
125
 
  void UpdateLensFilter(std::string lens, std::string filter, std::string value);
126
 
  void UpdateLensFilterValue(Filter::Ptr filter, std::string value);
127
 
  void EnsureLensesInitialized();
128
 
 
129
 
  bool AcceptKeyNavFocus();
130
 
  bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character);
131
 
  std::string GetName() const;
132
 
  void AddProperties(GVariantBuilder* builder);
133
 
 
134
 
  nux::Area* KeyNavIteration(nux::KeyNavDirection direction);
135
 
 
136
 
  UBusManager ubus_manager_;
137
 
  Lenses::Ptr lenses_;
138
 
  HomeLens::Ptr home_lens_;
139
 
  LensViews lens_views_;
140
 
 
141
 
  ApplicationStarter::Ptr application_starter_;
142
 
 
143
 
  // View related
144
 
  PreviewStateMachine preview_state_machine_;
145
 
  previews::PreviewContainer::Ptr preview_container_;
146
 
  bool preview_displaying_;
147
 
  std::string stored_activated_unique_id_;
148
 
  dash::previews::Navigation preview_navigation_mode_;
149
 
 
150
 
  nux::VLayout* layout_;
151
 
  DashLayout* content_layout_;
152
 
  nux::View* content_view_;
153
 
  nux::HLayout* search_bar_layout_;
154
 
  SearchBar* search_bar_;
155
 
  nux::VLayout* lenses_layout_;
156
 
  LensBar* lens_bar_;
157
 
 
158
 
  nux::ObjectPtr<LensView> home_view_;
159
 
  nux::ObjectPtr<LensView> active_lens_view_;
160
 
  nux::ObjectPtr<LensView> preview_lens_view_;
161
 
 
162
 
  // Drawing related
163
 
  nux::Geometry content_geo_;
164
 
  OverlayRenderer renderer_;
165
 
 
166
 
  std::string last_activated_uri_;
167
 
  guint64 last_activated_timestamp_;
168
 
  bool search_in_progress_;
169
 
  bool activate_on_finish_;
170
 
 
171
 
  bool visible_;
172
 
 
173
 
  glib::Source::UniquePtr searching_timeout_;
174
 
  glib::Source::UniquePtr hide_message_delay_;
175
 
 
176
 
  nux::ObjectPtr<nux::IOpenGLBaseTexture> dash_view_copy_;
177
 
  nux::ObjectPtr<nux::IOpenGLBaseTexture> search_view_copy_;
178
 
  nux::ObjectPtr<nux::IOpenGLBaseTexture> filter_view_copy_;
179
 
  nux::ObjectPtr<nux::IOpenGLBaseTexture> layout_copy_;
180
 
 
181
 
  int opening_column_x_;
182
 
  int opening_row_y_;
183
 
  int opening_column_width_;
184
 
  int opening_row_height_;
185
 
 
186
 
  nux::Color background_color_;
187
 
 
188
 
  std::unique_ptr<na::AnimateValue<float>> split_animation_;
189
 
  float animate_split_value_;
190
 
 
191
 
  std::unique_ptr<na::AnimateValue<float>> preview_container_animation_;
192
 
  float animate_preview_container_value_;
193
 
 
194
 
  std::unique_ptr<na::AnimateValue<float>> preview_animation_;
195
 
  float animate_preview_value_;
196
 
 
197
 
  nux::ObjectPtr<OverlayWindowButtons> overlay_window_buttons_;
198
 
};
199
 
 
200
 
 
201
 
}
202
 
}
203
 
#endif