~mc-return/unity/unity.merge-fix1069243-update-manual-tests

« back to all changes in this revision

Viewing changes to unity-shared/TextInput.cpp

  • Committer: MC Return
  • Date: 2012-12-30 13:37:37 UTC
  • mfrom: (2849.2.159 trunk)
  • Revision ID: mc.return@gmx.net-20121230133737-9othnsjk2felbx53
MergedĀ latestĀ lp:unity

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 * Authored by: Manuel de la Pena <manuel.delapena@canonical.com>
18
18
 */
19
19
 
20
 
#include "config.h"
21
 
 
22
 
#include <Nux/Nux.h>
23
 
#include <Nux/HLayout.h>
24
 
#include <Nux/VLayout.h>
25
 
#include <NuxCore/Logger.h>
26
 
 
27
 
#include <UnityCore/Variant.h>
28
 
 
29
 
#include <glib/gi18n-lib.h>
30
 
 
31
20
#include "TextInput.h"
32
 
#include "CairoTexture.h"
33
21
 
34
22
namespace
35
23
{
51
39
 
52
40
}
53
41
 
54
 
namespace
55
 
{
56
 
 
57
 
nux::logging::Logger logger("unity");
58
 
 
59
 
class ExpanderView : public nux::View
60
 
{
61
 
public:
62
 
  ExpanderView(NUX_FILE_LINE_DECL)
63
 
   : nux::View(NUX_FILE_LINE_PARAM)
64
 
  {
65
 
    SetAcceptKeyNavFocusOnMouseDown(false);
66
 
    SetAcceptKeyNavFocusOnMouseEnter(true);
67
 
  }
68
 
 
69
 
protected:
70
 
  void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
71
 
  {}
72
 
 
73
 
  void DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw)
74
 
  {
75
 
    if (GetLayout())
76
 
      GetLayout()->ProcessDraw(graphics_engine, force_draw);
77
 
  }
78
 
 
79
 
  bool AcceptKeyNavFocus()
80
 
  {
81
 
    return true;
82
 
  }
83
 
 
84
 
  nux::Area* FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type)
85
 
  {
86
 
    bool mouse_inside = TestMousePointerInclusionFilterMouseWheel(mouse_position, event_type);
87
 
 
88
 
    if (mouse_inside == false)
89
 
      return nullptr;
90
 
 
91
 
    return this;
92
 
  }
93
 
};
94
 
 
95
 
}
96
 
 
97
42
namespace unity
98
43
{
99
44
 
 
45
nux::logging::Logger logger("unity.dash.textinput");
 
46
 
100
47
NUX_IMPLEMENT_OBJECT_TYPE(TextInput);
101
48
 
102
49
TextInput::TextInput(NUX_FILE_LINE_DECL)
119
66
 
120
67
  nux::HLayout* hint_layout = new nux::HLayout(NUX_TRACKER_LOCATION);
121
68
 
122
 
  hint_ = new nux::StaticCairoText(" ");
 
69
  hint_ = new StaticCairoText(" ");
123
70
  hint_->SetTextColor(nux::Color(1.0f, 1.0f, 1.0f, 0.5f));
124
71
  hint_->SetFont(HINT_LABEL_DEFAULT_FONT.c_str());
125
72
  hint_layout->AddView(hint_,  0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);