2
* Copyright (C) 2012 - Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License, as
6
* published by the Free Software Foundation; either version 2.1 or 3.0
9
* This program is distributed in the hope that it will be useful, but
10
* WITHOUT ANY WARRANTY; without even the implied warranties of
11
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
12
* PURPOSE. See the applicable version of the GNU Lesser General Public
13
* License for more details.
15
* You should have received a copy of both the GNU Lesser General Public
16
* License along with this program. If not, see <http://www.gnu.org/licenses/>
18
* Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
22
#include <Nux/KineticScrollView.h>
23
#include <Nux/HLayout.h>
24
#include <Nux/VLayout.h>
26
#include "TestButton.h"
30
View *CreateKineticScrollView()
32
VLayout *layout = new VLayout (NUX_TRACKER_LOCATION);
35
for (int i = 0; i < 100; i++)
37
sprintf(buffer, "TestButton %d", i+1);
38
Button *button = new TestButton(buffer, NUX_TRACKER_LOCATION);
39
button->SetMinimumHeight(50);
41
layout->AddView(button, 1, eLeft, eFull);
44
KineticScrollView *kinetic_scroll_view = new KineticScrollView(NUX_TRACKER_LOCATION);
45
kinetic_scroll_view->SetLayout(layout);
46
kinetic_scroll_view->SetScrollableDirections(ScrollableDirectionsVertical);
48
return kinetic_scroll_view;
51
void UserInterfaceInitialization(NThread* /* thread */, void* /* InitData */)
54
HLayout* mainLayout = new HLayout(NUX_TRACKER_LOCATION);
55
mainLayout->AddView(CreateKineticScrollView(), 1, eCenter, eFull);
57
GetWindowThread()->SetLayout(mainLayout);
64
WindowThread* window_thread = CreateGUIThread(
65
"KineticScrollView Example", 640, 300, 0, &UserInterfaceInitialization, 0);
67
// Start the main loop.
68
window_thread->Run(NULL);