~ubuntu-branches/ubuntu/oneiric/nux/oneiric-proposed

« back to all changes in this revision

Viewing changes to Nux/Canvas.h

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2011-07-04 18:34:48 UTC
  • mfrom: (1.1.22 upstream)
  • Revision ID: james.westby@ubuntu.com-20110704183448-wzm2936r4xyob3d9
Tags: 1.0.4-0ubuntu1
* New upstream release.
* debian/rules:
  - bump shlib

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2011 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: Mirco Müller <mirco.mueller@canonical.com
 
17
 */
 
18
 
 
19
#ifndef CANVAS_H
 
20
#define CANVAS_H
 
21
 
 
22
#include <cairo.h>
 
23
 
 
24
#include "Nux/Nux.h"
 
25
#include "Nux/View.h"
 
26
 
 
27
namespace nux
 
28
{
 
29
  class Canvas : public View
 
30
  {
 
31
    public:
 
32
      Canvas (NUX_FILE_LINE_DECL);
 
33
      ~Canvas ();
 
34
 
 
35
      void Draw (GraphicsEngine& gfxContext, bool forceDraw);
 
36
      void DrawContent (GraphicsEngine& gfxContext, bool forceDraw);
 
37
      long ProcessEvent (IEvent& event,
 
38
                         long    traverseInfo,
 
39
                         long    processEventInfo);
 
40
      virtual void Paint ();
 
41
      void Invalidate ();
 
42
 
 
43
    protected:
 
44
      cairo_surface_t* GetCairoSurface ();
 
45
      cairo_t*         GetCairoContext ();
 
46
      int              GetLastWidth ();
 
47
      int              GetLastHeight ();
 
48
 
 
49
    private:
 
50
      void             PreLayoutManagement ();
 
51
      long             PostLayoutManagement (long layoutResult);
 
52
      void             Recreate ();
 
53
      NBitmapData*     GetBitmap ();
 
54
 
 
55
    private:
 
56
      cairo_t*         _cr;
 
57
      cairo_surface_t* _surface;
 
58
      int              _last_width;
 
59
      int              _last_height;
 
60
      bool             _invalid;
 
61
      BaseTexture*     _texture;
 
62
  };
 
63
}
 
64
 
 
65
#endif // CANVAS_H