~amaranth/+junk/nux-pkg

« back to all changes in this revision

Viewing changes to Nux/BaseWindow.cpp

  • Committer: Didier Roche
  • Date: 2011-07-04 15:30:29 UTC
  • mfrom: (159.101.37 nux)
  • mto: This revision was merged to the branch mainline in revision 251.
  • Revision ID: didier.roche@canonical.com-20110704153029-4es95dij4bif1gwd
Tags: upstream-1.0.4
ImportĀ upstreamĀ versionĀ 1.0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
  */
46
46
 
47
47
  BaseWindow::BaseWindow (const TCHAR *WindowName, NUX_FILE_LINE_DECL)
48
 
    :   View (NUX_FILE_LINE_PARAM)
49
 
    ,   _opacity (1.0f)
 
48
    : View (NUX_FILE_LINE_PARAM)
 
49
    , _paint_layer(new ColorLayer(Color(0xFF707070)))
 
50
    , _opacity (1.0f)
50
51
  {
51
52
    _name = WindowName;
52
53
    _child_need_redraw = true;
71
72
 
72
73
    SetMinimumSize (1, 1);
73
74
    SetGeometry(Geometry(100, 100, 320, 200));
74
 
 
75
 
    _paint_layer = new ColorLayer(Color(0xFF707070));
76
 
    //_background_texture = GetWindow ()->GetGpuDevice ()->CreateSystemCapableDeviceTexture(1, 1, 1, BITFMT_R8G8B8A8);
77
75
  }
78
76
 
79
77
  BaseWindow::~BaseWindow()
92
90
    // The weak reference count is probably 2: one reference in m_WindowList and another in m_WindowToTextureMap.
93
91
    // Reference the object here to avoid it being destroy when the call from UnRegisterWindow returns;
94
92
    GetWindowCompositor().UnRegisterWindow (this);
95
 
 
96
 
    NUX_SAFE_DELETE (_paint_layer);
97
93
  }
98
94
 
99
95
  long BaseWindow::ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
136
132
    base.SetY (0);
137
133
    GfxContext.PushClippingRectangle (base);
138
134
 
139
 
    GetPainter().PushDrawLayer(GfxContext, base, _paint_layer);
 
135
    GetPainter().PushDrawLayer(GfxContext, base, _paint_layer.get());
140
136
 
141
137
    GetPainter().PopBackground();
142
138
    GfxContext.PopClippingRectangle();
151
147
    base.SetY (0);
152
148
 
153
149
 
154
 
    GetPainter().PushLayer(GfxContext, base, _paint_layer);
 
150
    GetPainter().PushLayer(GfxContext, base, _paint_layer.get());
155
151
 
156
152
    if (m_layout)
157
153
    {
480
476
  void BaseWindow::SetBackgroundLayer (AbstractPaintLayer *layer)
481
477
  {
482
478
    NUX_RETURN_IF_NULL (layer);
483
 
    NUX_SAFE_DELETE (_paint_layer);
484
 
    _paint_layer = layer->Clone();
 
479
    _paint_layer.reset(layer->Clone());
485
480
  }
486
481
 
487
482
  void BaseWindow::SetBackgroundColor (const Color &color)
488
483
  {
489
 
    if (_paint_layer)
490
 
      NUX_SAFE_DELETE(_paint_layer);
491
 
 
492
 
    _paint_layer = new ColorLayer(color);
 
484
    _paint_layer.reset(new ColorLayer(color));
493
485
  }
494
486
 
495
487
  void BaseWindow::PushHigher (BaseWindow* floating_view)