1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
10 #include "base/basictypes.h"
11 #include "ppapi/c/dev/pp_cursor_type_dev.h"
12 #include "ppapi/cpp/rect.h"
20 namespace chrome_pdf
{
22 const uint32 kInvalidControlId
= 0;
29 virtual void OnEvent(uint32 control_id
, uint32 event_id
, void* data
) = 0;
30 virtual void Invalidate(uint32 control_id
, const pp::Rect
& rc
) = 0;
31 virtual uint32
ScheduleTimer(uint32 control_id
, uint32 timeout_ms
) = 0;
32 virtual void SetEventCapture(uint32 control_id
, bool set_capture
) = 0;
33 virtual void SetCursor(uint32 control_id
,
34 PP_CursorType_Dev cursor_type
) = 0;
35 virtual pp::Instance
* GetInstance() = 0;
40 virtual bool Create(uint32 id
, const pp::Rect
& rc
,
41 bool visible
, Owner
* owner
);
43 virtual void Paint(pp::ImageData
* image_data
, const pp::Rect
& rc
) {}
44 virtual bool HandleEvent(const pp::InputEvent
& event
);
45 virtual void OnTimerFired(uint32 timer_id
) {}
46 virtual void EventCaptureReleased() {}
48 // Paint control into multiple destination rects.
49 virtual void PaintMultipleRects(pp::ImageData
* image_data
,
50 const std::list
<pp::Rect
>& rects
);
52 virtual void Show(bool visible
, bool invalidate
);
53 virtual void AdjustTransparency(uint8 transparency
, bool invalidate
);
54 virtual void MoveBy(const pp::Point
& offset
, bool invalidate
);
55 virtual void SetRect(const pp::Rect
& rc
, bool invalidate
);
57 void MoveTo(const pp::Point
& origin
, bool invalidate
);
59 uint32
id() const { return id_
; }
60 const pp::Rect
& rect() const { return rc_
; }
61 bool visible() const { return visible_
; }
62 Owner
* owner() { return owner_
; }
63 uint8
transparency() const { return transparency_
; }
73 typedef Control::Owner ControlOwner
;
75 } // namespace chrome_pdf
77 #endif // PDF_CONTROL_H_