1 // Copyright (c) 2010 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.
5 #ifndef PDF_THUMBNAIL_CONTROL_H_
6 #define PDF_THUMBNAIL_CONTROL_H_
11 #include "pdf/control.h"
12 #include "pdf/pdf_engine.h"
13 #include "ppapi/cpp/input_event.h"
15 namespace chrome_pdf
{
17 class NumberImageGenerator
;
19 class ThumbnailControl
: public Control
{
21 enum ThumbnailEventIds
{
22 EVENT_ID_THUMBNAIL_SELECTED
= 100,
25 explicit ThumbnailControl();
26 virtual ~ThumbnailControl();
28 // Sets current position of the thumnail control.
29 void SetPosition(int position
, int total
, bool invalidate
);
33 virtual bool CreateThumbnailControl(
34 uint32 id
, const pp::Rect
& rc
,
35 bool visible
, Owner
* owner
, PDFEngine
* engine
,
36 NumberImageGenerator
* number_image_generator
);
39 virtual void Show(bool visible
, bool invalidate
);
40 virtual void Paint(pp::ImageData
* image_data
, const pp::Rect
& rc
);
41 virtual bool HandleEvent(const pp::InputEvent
& event
);
42 virtual void OnTimerFired(uint32 timer_id
);
44 virtual void ResetEngine(PDFEngine
* engine
);
55 pp::Rect visible_rect_
;
56 std::vector
<PageInfo
> visible_pages_
;
57 std::map
<int, pp::ImageData
*> image_cache_
;
61 uint32 sliding_timer_id_
;
62 NumberImageGenerator
* number_image_generator_
;
65 } // namespace chrome_pdf
67 #endif // PDF_THUMBNAIL_CONTROL_H_