~azzar1/unity/lp-1226116

« back to all changes in this revision

Viewing changes to standalone-clients/ui/TestTooltip.cpp

  • Committer: Daniel van Vugt
  • Date: 2012-03-14 06:24:18 UTC
  • mfrom: (2108 unity)
  • mto: This revision was merged to the branch mainline in revision 2146.
  • Revision ID: daniel.van.vugt@canonical.com-20120314062418-nprucpbr0m7qky5e
Merged latest lp:unity

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2012 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: Marco Trevisan (Treviño) <3v1n0@ubuntu.com>
 
17
 */
 
18
 
 
19
#include <glib.h>
 
20
#include <gtk/gtk.h>
 
21
 
 
22
#include "Nux/Nux.h"
 
23
#include "Nux/VLayout.h"
 
24
#include "Nux/WindowThread.h"
 
25
 
 
26
#include "Tooltip.h"
 
27
 
 
28
#define WIN_WIDTH  200
 
29
#define WIN_HEIGHT 75
 
30
 
 
31
using namespace unity;
 
32
 
 
33
void
 
34
ThreadWidgetInit (nux::NThread* thread,
 
35
                  void*         initData)
 
36
{
 
37
  Tooltip* ttip = new Tooltip();
 
38
  ttip->SetText("Unity Tooltip");
 
39
  ttip->ShowTooltipWithTipAt(15, 30);
 
40
 
 
41
  nux::ColorLayer background(nux::Color (0x772953));
 
42
  static_cast<nux::WindowThread*>(thread)->SetWindowBackgroundPaintLayer(&background);
 
43
}
 
44
 
 
45
int
 
46
main (int argc, char **argv)
 
47
{
 
48
  nux::WindowThread* wt = NULL;
 
49
 
 
50
  gtk_init(&argc, &argv);
 
51
  nux::NuxInitialize(0);
 
52
 
 
53
  wt = nux::CreateGUIThread(TEXT ("Unity visual Tooltip test"),
 
54
                            WIN_WIDTH,
 
55
                            WIN_HEIGHT,
 
56
                            0,
 
57
                            &ThreadWidgetInit,
 
58
                            NULL);
 
59
 
 
60
  wt->Run(NULL);
 
61
  delete wt;
 
62
 
 
63
  return 0;
 
64
}