~unity-team/nuxplayground/nuxplayground.fix-nstring

« back to all changes in this revision

Viewing changes to src/view-canvas/MovableView.cpp

  • Committer: Jay Taoko
  • Date: 2012-10-01 04:49:15 UTC
  • mfrom: (22.1.9 nuxplayground)
  • Revision ID: jay.taoko@canonical.com-20121001044915-etvjty9kz0pgav03
* Removing NString.* Fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include "Nux/Nux.h"
22
22
#include "Nux/Layout.h"
23
23
#include "MovableView.h"
 
24
#include "NuxGraphics/ImageSurface.h"
 
25
#include "NuxGraphics/GLTextureResourceManager.h"
24
26
 
25
27
/*
26
28
  MovableView:
70
72
  end_key_focus.connect(sigc::mem_fun(this, &MovableView::OnEndKeyFocus));
71
73
  object_destroyed.connect(sigc::mem_fun(this, &MovableView::OnObjectDestroyed));
72
74
 
73
 
  size_grip_ = new InputArea(NUX_TRACKER_LOCATION);
 
75
  size_grip_ = new BasicView(NUX_TRACKER_LOCATION);
74
76
  size_grip_->SetParentObject(this);
75
77
  size_grip_->mouse_down.connect(sigc::mem_fun(this, &MovableView::RecvSizeGripMouseDown));
76
78
  size_grip_->mouse_drag.connect(sigc::mem_fun(this, &MovableView::RecvSizeGripMouseDrag));
77
79
 
78
80
 
 
81
  NTextureData bitmap_data;
 
82
  bitmap_data.AllocateCheckBoardTexture(16, 16, 1, Color(0xFF44FF44), Color(0xFF666666), 8, 8);
 
83
  Texture2D checkboad_texture_;
 
84
  checkboad_texture_.Update(&bitmap_data);
 
85
 
 
86
  nux::TexCoordXForm texxform;
 
87
 
 
88
  texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
 
89
  texxform.uwrap = nux::TEXWRAP_REPEAT;
 
90
  texxform.vwrap = nux::TEXWRAP_REPEAT;
 
91
  nux::ROPConfig rop;
 
92
 
 
93
  bkg_layer_ = new nux::TextureLayer(checkboad_texture_.GetDeviceTexture(), texxform, nux::color::White, true, rop);
79
94
}
80
95
 
81
96
MovableView::~MovableView()
204
219
    }
205
220
  }
206
221
 
207
 
  target_area = GetLayout()->FindAreaUnderMouse(mouse_position, event_type);
 
222
  if (GetLayout())
 
223
  {
 
224
    target_area = GetLayout()->FindAreaUnderMouse(mouse_position, event_type);
 
225
  }
208
226
 
209
227
  if (target_area)
210
228
    return target_area;
217
235
void MovableView::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
218
236
{
219
237
  nux::Geometry geo = GetGeometry();
220
 
  graphics_engine.QRP_Color(geo.x, geo.y, geo.width, geo.height, color::Red);
 
238
  //graphics_engine.QRP_Color(geo.x, geo.y, geo.width, geo.height, color::Black);
 
239
 
 
240
  GetPainter().PushDrawLayer(graphics_engine, geo, bkg_layer_);
 
241
 
 
242
  GetPainter().PopBackground();
221
243
 
222
244
  if (has_focus_)
223
245
    graphics_engine.QRP_Color(geo.x, geo.y, 20, 20, with_key_focus_color_);  
 
246
}
 
247
 
 
248
void MovableView::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw)
 
249
{
 
250
  graphics_engine.PushClippingRectangle(GetGeometry());
 
251
  GetPainter().PushLayer(graphics_engine, GetGeometry(), bkg_layer_);
 
252
 
 
253
  if (GetLayout())
 
254
  {
 
255
    GetLayout()->ProcessDraw(graphics_engine, force_draw);
 
256
  }
224
257
 
225
258
  Geometry SizeGripGeo = size_grip_->GetGeometry();
226
259
  int x0 = SizeGripGeo.x + NODE_HANDLE_WIDTH;
229
262
  int y1 = y0 + NODE_HANDLE_HEIGHT;
230
263
  int x2 = x0;
231
264
  int y2 = y0 + NODE_HANDLE_HEIGHT;
 
265
 
232
266
  GetPainter().Draw2DTriangleColor(graphics_engine, x0, y0, x1, y1, x2, y2, Color(0xFF666666));
233
 
}
234
267
 
235
 
void MovableView::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw)
236
 
{
237
 
  GetLayout()->ProcessDraw(graphics_engine, force_draw);
 
268
  GetPainter().PopBackground();
 
269
  graphics_engine.PopClippingRectangle();
238
270
}
239
271
 
240
272
void MovableView::OnMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags)