~ubuntu-branches/ubuntu/wily/unity/wily

55.928.4 by Neil Jagdish Patel
Clean up standalone tests, start dash view, more fixes
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>
55.928.6 by Neil Jagdish Patel
more dash view stuff, nothing visible yet
23
#include <Nux/PaintLayer.h>
55.928.4 by Neil Jagdish Patel
Clean up standalone tests, start dash view, more fixes
24
#include <Nux/View.h>
55.928.5 by Neil Jagdish Patel
Remove a lot of unneeded code
25
#include <Nux/VLayout.h>
55.928.4 by Neil Jagdish Patel
Clean up standalone tests, start dash view, more fixes
26
#include <UnityCore/FilesystemLenses.h>
55.1359.3 by Mikkel Kamstrup Erlandsen
WIP Start implementing a HomeLens class in UnityCore that extends the Lens class. The plan is to use it to make home screen rendering use stock lens rendering mechanisms
27
#include <UnityCore/HomeLens.h>
55.1907.38 by Marco Trevisan (Treviño)
DashView: use glib::Timeout
28
#include <UnityCore/GLibSource.h>
55.928.4 by Neil Jagdish Patel
Clean up standalone tests, start dash view, more fixes
29
55.1866.1 by Gord Allott
panel and dash moved to subdirectories
30
#include "unity-shared/BackgroundEffectHelper.h"
55.1866.2 by Gord Allott
added hud
31
#include "unity-shared/SearchBar.h"
55.1866.1 by Gord Allott
panel and dash moved to subdirectories
32
#include "unity-shared/Introspectable.h"
55.927.31 by Neil Jagdish Patel
Fix another crash when results are removed
33
#include "LensBar.h"
55.928.11 by Neil Jagdish Patel
Some more lens view bits
34
#include "LensView.h"
55.1866.1 by Gord Allott
panel and dash moved to subdirectories
35
#include "unity-shared/UBusWrapper.h"
36
#include "unity-shared/OverlayRenderer.h"
55.928.4 by Neil Jagdish Patel
Clean up standalone tests, start dash view, more fixes
37
38
namespace unity
39
{
40
namespace dash
41
{
42
55.1459.6 by Andrea Azzarone
Implements filters key navigation.
43
class DashLayout;
44
55.1229.2 by Alex Launi
Move Introspectable and DebugDBusInterface into debug namespace
45
class DashView : public nux::View, public unity::debug::Introspectable
55.928.4 by Neil Jagdish Patel
Clean up standalone tests, start dash view, more fixes
46
{
55.928.5 by Neil Jagdish Patel
Remove a lot of unneeded code
47
  NUX_DECLARE_OBJECT_TYPE(DashView, nux::View);
55.928.11 by Neil Jagdish Patel
Some more lens view bits
48
  typedef std::map<std::string, LensView*> LensViews;
55.928.5 by Neil Jagdish Patel
Remove a lot of unneeded code
49
55.928.4 by Neil Jagdish Patel
Clean up standalone tests, start dash view, more fixes
50
public:
51
  DashView();
52
  ~DashView();
53
55.928.7 by Neil Jagdish Patel
more fixes
54
  void AboutToShow();
55.951.1 by Jason Smith
dramatically improve blur performance
55
  void AboutToHide();
55.928.9 by Neil Jagdish Patel
Lots of fixes
56
  void Relayout();
55.359.792 by Neil Jagdish Patel
Make standalone work again after blur rework
57
  void DisableBlur();
55.1002.1 by Neil Jagdish Patel
Change DashController to load lazily, clean up some bits and pieces
58
  void OnActivateRequest(GVariant* args);
55.1369.36 by Jason Smith
make overlay sheen render properly in multi-monitor
59
  void SetMonitorOffset(int x, int y);
55.928.9 by Neil Jagdish Patel
Lots of fixes
60
55.1028.1 by Didier Roche
bring back lenses shortcut activation. Seems there is still an issue on registering keybinding on first super invocation, but good enough for main cases (LP: #834078)
61
  std::string const GetIdForShortcutActivation(std::string const& shortcut) const;
62
  std::vector<char> GetAllShortcuts();
63
55.928.11 by Neil Jagdish Patel
Some more lens view bits
64
  nux::View* default_focus() const;
55.928.7 by Neil Jagdish Patel
more fixes
65
55.1109.1 by Robert Carr
DashView: Process DND events to close the Dash when we drag a DND object outside of the dash
66
protected:
67
  void ProcessDndEnter();
68
55.1125.1 by Jay Taoko
Fix key navigation problem. see bug #861251
69
  virtual Area* FindKeyFocusArea(unsigned int key_symbol,
70
    unsigned long x11_key_code,
71
    unsigned long special_keys_state);
72
55.928.4 by Neil Jagdish Patel
Clean up standalone tests, start dash view, more fixes
73
private:
55.928.6 by Neil Jagdish Patel
more dash view stuff, nothing visible yet
74
  void SetupViews();
75
  void SetupUBusConnections();
76
55.928.10 by Neil Jagdish Patel
some more progress
77
  nux::Geometry GetBestFitGeometry(nux::Geometry const& for_geo);
55.928.9 by Neil Jagdish Patel
Lots of fixes
78
55.928.4 by Neil Jagdish Patel
Clean up standalone tests, start dash view, more fixes
79
  void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);
80
  void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw);
55.1009.1 by Gord Allott
fix the bug with the relayout cycle going crazy
81
  virtual long PostLayoutManagement (long LayoutResult);
55.928.4 by Neil Jagdish Patel
Clean up standalone tests, start dash view, more fixes
82
55.927.38 by Neil Jagdish Patel
Close on click-outside
83
  void OnMouseButtonDown(int x, int y, unsigned long button, unsigned long key);
55.928.6 by Neil Jagdish Patel
more dash view stuff, nothing visible yet
84
  void OnBackgroundColorChanged(GVariant* args);
55.928.9 by Neil Jagdish Patel
Lots of fixes
85
  void OnSearchChanged(std::string const& search_string);
86
  void OnLiveSearchReached(std::string const& search_string);
55.928.11 by Neil Jagdish Patel
Some more lens view bits
87
  void OnLensAdded(Lens::Ptr& lens);
55.927.33 by Neil Jagdish Patel
Fixes to lensbar
88
  void OnLensBarActivated(std::string const& id);
55.1257.1 by Michal Hruby
Adapt to new libunity DBus API
89
  void OnSearchFinished(Lens::Hints const& hints);
90
  void OnGlobalSearchFinished(Lens::Hints const& hints);
55.1710.1 by Michal Hruby
Make sure applications can be started as soon as we get results from apps lens
91
  void OnAppsGlobalSearchFinished(Lens::Hints const& hints);
55.927.54 by Neil Jagdish Patel
Make activation work
92
  void OnUriActivated(std::string const& uri);
93
  void OnUriActivatedReply(std::string const& uri, HandledType type, Lens::Hints const&);
94
  bool DoFallbackActivation(std::string const& uri);
95
  bool LaunchApp(std::string const& appname);
55.975.12 by Neil Jagdish Patel
make activation work
96
  void OnEntryActivated();
55.1225.5 by Marco Biscaro
Created DashViewPrivate.h and moved the parse_lens_uri to it.
97
  std::string AnalyseLensURI(std::string const& uri);
55.993.5 by Neil Jagdish Patel
make the shortcut icons work
98
  void UpdateLensFilter(std::string lens, std::string filter, std::string value);
99
  void UpdateLensFilterValue(Filter::Ptr filter, std::string value);
55.1359.2 by Mikkel Kamstrup Erlandsen
Show default global search results instead of tiles in the home view. In order to get lenses up we initialize them when we're about to show.
100
  void EnsureLensesInitialized();
55.1009.1 by Gord Allott
fix the bug with the relayout cycle going crazy
101
55.928.6 by Neil Jagdish Patel
more dash view stuff, nothing visible yet
102
  bool AcceptKeyNavFocus();
103
  bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character);
55.1258.8 by Alex Launi
Convert debugging code from gchar* to std::string
104
  std::string GetName() const;
55.928.6 by Neil Jagdish Patel
more dash view stuff, nothing visible yet
105
  void AddProperties(GVariantBuilder* builder);
55.1061.1 by Gord Allott
darken layer added to the ui elements in dash mode
106
55.1037.1 by Robert Carr
Implement KeyNavIteration on DashView to allow switching through the lens bar with tab and left tab (shift-tab)
107
  nux::Area* KeyNavIteration(nux::KeyNavDirection direction);
55.928.6 by Neil Jagdish Patel
more dash view stuff, nothing visible yet
108
55.928.4 by Neil Jagdish Patel
Clean up standalone tests, start dash view, more fixes
109
private:
110
  UBusManager ubus_manager_;
111
  FilesystemLenses lenses_;
55.1359.10 by Mikkel Kamstrup Erlandsen
The big switch! Change the HomeView to a normal LensView backed by the new HomeLens class. Segfaults a plenty.
112
  HomeLens::Ptr home_lens_;
55.928.11 by Neil Jagdish Patel
Some more lens view bits
113
  LensViews lens_views_;
55.928.4 by Neil Jagdish Patel
Clean up standalone tests, start dash view, more fixes
114
55.928.6 by Neil Jagdish Patel
more dash view stuff, nothing visible yet
115
116
  // View related
55.928.4 by Neil Jagdish Patel
Clean up standalone tests, start dash view, more fixes
117
  nux::VLayout* layout_;
55.1459.6 by Andrea Azzarone
Implements filters key navigation.
118
  DashLayout* content_layout_;
55.1660.1 by Andrea Azzarone
Fixes dash layout bugs. Moves padding values in dash::style.
119
  nux::HLayout* search_bar_layout_;
55.928.8 by Neil Jagdish Patel
Some renaming of Places=>Dash and cleanup
120
  SearchBar* search_bar_;
55.927.32 by Neil Jagdish Patel
Fix more results view and group stuff, starting to look like dash again now
121
  nux::VLayout* lenses_layout_;
55.927.31 by Neil Jagdish Patel
Fix another crash when results are removed
122
  LensBar* lens_bar_;
55.928.9 by Neil Jagdish Patel
Lots of fixes
123
55.1359.10 by Mikkel Kamstrup Erlandsen
The big switch! Change the HomeView to a normal LensView backed by the new HomeLens class. Segfaults a plenty.
124
  LensView* home_view_;
55.927.34 by Neil Jagdish Patel
More fixes for searching etc
125
  LensView* active_lens_view_;
126
55.928.9 by Neil Jagdish Patel
Lots of fixes
127
  // Drawing related
128
  nux::Geometry content_geo_;
55.1328.3 by Gord Allott
integrated the OverlayRenderer class in to DashView
129
  OverlayRenderer renderer_;
55.927.54 by Neil Jagdish Patel
Make activation work
130
131
  std::string last_activated_uri_;
55.1231.3 by Michal Hruby
Add manual test
132
  // we're passing this back to g_* functions, so we'll keep the g* type
55.1231.1 by Michal Hruby
Delay activation of result if search is still in progress
133
  bool search_in_progress_;
134
  bool activate_on_finish_;
55.1009.1 by Gord Allott
fix the bug with the relayout cycle going crazy
135
55.993.5 by Neil Jagdish Patel
make the shortcut icons work
136
  bool visible_;
55.1907.38 by Marco Trevisan (Treviño)
DashView: use glib::Timeout
137
138
  glib::Source::UniquePtr searching_timeout_;
139
  glib::Source::UniquePtr hide_message_delay_;
55.928.4 by Neil Jagdish Patel
Clean up standalone tests, start dash view, more fixes
140
};
141
142
143
}
144
}
145
#endif