OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef PDF_PAGE_INDICATOR_H_ |
| 6 #define PDF_PAGE_INDICATOR_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "pdf/control.h" |
| 12 #include "pdf/fading_control.h" |
| 13 #include "ppapi/cpp/image_data.h" |
| 14 #include "ppapi/cpp/point.h" |
| 15 #include "ppapi/cpp/rect.h" |
| 16 |
| 17 namespace chrome_pdf { |
| 18 |
| 19 class NumberImageGenerator; |
| 20 |
| 21 const uint32 kPageIndicatorScrollFadeTimeoutMs = 240; |
| 22 const uint32 kPageIndicatorInitialFadeTimeoutMs = 960; |
| 23 const uint32 kPageIndicatorSplashTimeoutMs = 2000; |
| 24 |
| 25 class PageIndicator : public FadingControl { |
| 26 public: |
| 27 PageIndicator(); |
| 28 virtual ~PageIndicator(); |
| 29 virtual bool CreatePageIndicator( |
| 30 uint32 id, |
| 31 bool visible, |
| 32 Control::Owner* delegate, |
| 33 NumberImageGenerator* number_image_generator, |
| 34 bool always_visible); |
| 35 |
| 36 void Configure(const pp::Point& origin, const pp::ImageData& background); |
| 37 |
| 38 int current_page() const { return current_page_; } |
| 39 void set_current_page(int current_page); |
| 40 |
| 41 virtual void Splash(); |
| 42 void Splash(uint32 splash_timeout, uint32 page_timeout); |
| 43 |
| 44 // Returns the y position where the page indicator should be drawn given the |
| 45 // position of the scrollbar and the total document height and the plugin |
| 46 // height. |
| 47 int GetYPosition( |
| 48 int vertical_scrollbar_y, int document_height, int plugin_height); |
| 49 |
| 50 // Control interface. |
| 51 virtual void Paint(pp::ImageData* image_data, const pp::Rect& rc); |
| 52 virtual void OnTimerFired(uint32 timer_id); |
| 53 |
| 54 // FadingControl interface. |
| 55 virtual void OnFadeInComplete(); |
| 56 |
| 57 private: |
| 58 void ResetFadeOutTimer(); |
| 59 |
| 60 int current_page_; |
| 61 pp::ImageData background_; |
| 62 NumberImageGenerator* number_image_generator_; |
| 63 uint32 fade_out_timer_id_; |
| 64 uint32 splash_timeout_; |
| 65 uint32 fade_timeout_; |
| 66 |
| 67 bool always_visible_; |
| 68 }; |
| 69 |
| 70 } // namespace chrome_pdf |
| 71 |
| 72 #endif // PDF_PAGE_INDICATOR_H_ |
OLD | NEW |