1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
/*
* Copyright (C) 2010 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 <http://www.gnu.org/licenses/>.
*
* Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
*/
#ifndef UNITY_DASH_VIEW_H_
#define UNITY_DASH_VIEW_H_
#include <Nux/Nux.h>
#include <Nux/PaintLayer.h>
#include <Nux/View.h>
#include <Nux/VLayout.h>
#include <UnityCore/FilesystemLenses.h>
#include <UnityCore/HomeLens.h>
#include <UnityCore/GLibSource.h>
#include "unity-shared/BackgroundEffectHelper.h"
#include "unity-shared/SearchBar.h"
#include "unity-shared/Introspectable.h"
#include "LensBar.h"
#include "LensView.h"
#include "unity-shared/UBusWrapper.h"
#include "unity-shared/OverlayRenderer.h"
namespace unity
{
namespace dash
{
class DashLayout;
class DashView : public nux::View, public unity::debug::Introspectable
{
NUX_DECLARE_OBJECT_TYPE(DashView, nux::View);
typedef std::map<std::string, LensView*> LensViews;
public:
DashView();
~DashView();
void AboutToShow();
void AboutToHide();
void Relayout();
void DisableBlur();
void OnActivateRequest(GVariant* args);
void SetMonitorOffset(int x, int y);
std::string const GetIdForShortcutActivation(std::string const& shortcut) const;
std::vector<char> GetAllShortcuts();
nux::View* default_focus() const;
protected:
void ProcessDndEnter();
virtual Area* FindKeyFocusArea(unsigned int key_symbol,
unsigned long x11_key_code,
unsigned long special_keys_state);
private:
void SetupViews();
void SetupUBusConnections();
nux::Geometry GetBestFitGeometry(nux::Geometry const& for_geo);
void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);
void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw);
virtual long PostLayoutManagement (long LayoutResult);
void OnMouseButtonDown(int x, int y, unsigned long button, unsigned long key);
void OnBackgroundColorChanged(GVariant* args);
void OnSearchChanged(std::string const& search_string);
void OnLiveSearchReached(std::string const& search_string);
void OnLensAdded(Lens::Ptr& lens);
void OnLensBarActivated(std::string const& id);
void OnSearchFinished(Lens::Hints const& hints);
void OnGlobalSearchFinished(Lens::Hints const& hints);
void OnAppsGlobalSearchFinished(Lens::Hints const& hints);
void OnUriActivated(std::string const& uri);
void OnUriActivatedReply(std::string const& uri, HandledType type, Lens::Hints const&);
bool DoFallbackActivation(std::string const& uri);
bool LaunchApp(std::string const& appname);
void OnEntryActivated();
std::string AnalyseLensURI(std::string const& uri);
void UpdateLensFilter(std::string lens, std::string filter, std::string value);
void UpdateLensFilterValue(Filter::Ptr filter, std::string value);
void EnsureLensesInitialized();
bool AcceptKeyNavFocus();
bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character);
std::string GetName() const;
void AddProperties(GVariantBuilder* builder);
nux::Area* KeyNavIteration(nux::KeyNavDirection direction);
private:
UBusManager ubus_manager_;
FilesystemLenses lenses_;
HomeLens::Ptr home_lens_;
LensViews lens_views_;
// View related
nux::VLayout* layout_;
DashLayout* content_layout_;
nux::HLayout* search_bar_layout_;
SearchBar* search_bar_;
nux::VLayout* lenses_layout_;
LensBar* lens_bar_;
LensView* home_view_;
LensView* active_lens_view_;
// Drawing related
nux::Geometry content_geo_;
OverlayRenderer renderer_;
std::string last_activated_uri_;
// we're passing this back to g_* functions, so we'll keep the g* type
bool search_in_progress_;
bool activate_on_finish_;
bool visible_;
glib::Source::UniquePtr searching_timeout_;
glib::Source::UniquePtr hide_message_delay_;
};
}
}
#endif
|