2
* Copyright (C) 2010 Canonical Ltd
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.
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.
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/>.
16
* Authored by: Gordon Allott <gord.allott@canonical.com>
22
#include "NuxGraphics/GLThread.h"
23
#include "UBusMessages.h"
25
#include "PlacesView.h"
27
NUX_IMPLEMENT_OBJECT_TYPE (PlacesView);
29
PlacesView::PlacesView (NUX_FILE_LINE_DECL)
30
: nux::BaseWindow("", NUX_FILE_LINE_PARAM)
35
PlacesView::~PlacesView ()
40
long PlacesView::ProcessEvent(nux::IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
42
long ret = TraverseInfo;
45
nux::IEvent window_event = ievent;
46
nux::Geometry base = GetGeometry();
47
window_event.e_x_root = base.x;
48
window_event.e_y_root = base.y;
50
// The child layout get the Mouse down button only if the MouseDown happened inside the client view Area
51
nux::Geometry viewGeometry = GetGeometry();
53
if (ievent.e_event == nux::NUX_MOUSE_PRESSED)
55
if (!viewGeometry.IsPointInside (ievent.e_x - ievent.e_x_root, ievent.e_y - ievent.e_y_root) )
57
ProcEvInfo = nux::eDoNotProcess;
61
// hide if outside our window
62
if (ievent.e_event == nux::NUX_MOUSE_PRESSED)
64
if (!(GetGeometry ().IsPointInside (ievent.e_x, ievent.e_y)))
67
return nux::eMouseEventSolved;
74
void PlacesView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
76
nux::Color *color = new nux::Color (0.9, 0.3, 0.1, 1.0);
77
nux::GetPainter ().Paint2DQuadColor (GfxContext, GetGeometry (), *color);
81
void PlacesView::DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw)
86
void PlacesView::PostDraw (nux::GraphicsEngine &GfxContext, bool force_draw)
91
void PlacesView::ShowWindow (bool b, bool start_modal)
93
nux::BaseWindow::ShowWindow (b, start_modal);
96
void PlacesView::Show ()
101
// FIXME: ShowWindow shouldn't need to be called first
102
ShowWindow (true, false);
103
EnableInputWindow (true, 1);
108
void PlacesView::Hide ()
113
CaptureMouseDownAnyWhereElse (false);
114
ForceStopFocus (1, 1);
116
EnableInputWindow (false);
117
ShowWindow (false, false);
123
PlacesView::GetName ()
129
PlacesView::AddProperties (GVariantBuilder *builder)