PaintEvent.h
1 /* Copyright (C) 2015 Marc Boris Duerner
2  Copyright (C) 2015 Laurentiu-Gheorghe Crisan
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  As a special exception, you may use this file as part of a free
10  software library without restriction. Specifically, if other files
11  instantiate templates or use macros or inline functions from this
12  file, or you compile this file and link it with other files to
13  produce an executable, this file does not by itself cause the
14  resulting executable to be covered by the GNU General Public
15  License. This exception does not however invalidate any other
16  reasons why the executable file might be covered by the GNU Library
17  General Public License.
18 
19  This library is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  Lesser General Public License for more details.
23 
24  You should have received a copy of the GNU Lesser General Public
25  License along with this library; if not, write to the Free Software
26  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
27  MA 02110-1301 USA
28 */
29 
30 #ifndef Pt_Forms_PaintEvent_h
31 #define Pt_Forms_PaintEvent_h
32 
33 #include <Pt/Forms/Api.h>
34 #include <Pt/Forms/Widget.h>
35 #include <Pt/Gfx/Rect.h>
36 #include <Pt/Types.h>
37 #include <Pt/Event.h>
38 
39 namespace Pt {
40 
41 namespace Forms {
42 
47 class PT_FORMS_API PaintEvent : public Pt::BasicEvent<PaintEvent>
48 {
49  public:
52  PaintEvent(Widget& widget, const Gfx::RectF& rect)
53  : _widgetId_( widget.id() )
54  , _widget(&widget)
55  , _rect( rect )
56  {
57  }
58 
61  virtual ~PaintEvent()
62  {
63  }
64 
68  {
69  return _widgetId_;
70  }
71 
74  Widget* widget() const
75  {
76  return _widget;
77  }
78 
81  const Gfx::RectF& rect() const
82  {
83  return _rect;
84  }
85 
88  void setRect(const Gfx::RectF& r)
89  {
90  _rect = r;
91  }
92 
93  private:
94  Pt::uint64_t _widgetId_;
95  Widget* _widget;
96  Gfx::RectF _rect;
97 };
98 
99 } // namespace
100 
101 } // namespace
102 
103 #endif
104 
Core module.
Definition: Allocator.h:33
virtual ~PaintEvent()
Destructor.
Definition: PaintEvent.h:61
Pt::uint64_t widgetId() const
Returns the target widget ID.
Definition: PaintEvent.h:67
PaintEvent(Widget &widget, const Gfx::RectF &rect)
Constructs an event for widget and dirty rectangle rect.
Definition: PaintEvent.h:52
const Gfx::RectF & rect() const
Returns the dirty rectangle in local coordinates.
Definition: PaintEvent.h:81
Reports a dirty rectangle that a widget must paint.
Definition: PaintEvent.h:48
Widget * widget() const
Returns the target widget.
Definition: PaintEvent.h:74
Common type of every visual Forms object.
Definition: Widget.h:105
void setRect(const Gfx::RectF &r)
Sets the dirty rectangle to r.
Definition: PaintEvent.h:88
Rect with floating-point coordinates.
Definition: Rect.h:47
uint_type uint64_t
Unsigned 64-bit integer type.
Definition: Api-Types.h:62