summaryrefslogtreecommitdiff
path: root/xfa_test/pdf/fading_controls.h
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2014-10-28 23:03:33 -0700
committerBo Xu <bo_xu@foxitsoftware.com>2014-11-03 11:10:11 -0800
commitfdc00a7042d912aafaabddae4d9c84199921ef23 (patch)
tree32ab8ac91cc68d2cd15b9168782a71b3f3f5e7b9 /xfa_test/pdf/fading_controls.h
parente9b38fa38de2c95d8260be31c57d9272c4d127ed (diff)
downloadpdfium-fdc00a7042d912aafaabddae4d9c84199921ef23.tar.xz
Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
Diffstat (limited to 'xfa_test/pdf/fading_controls.h')
-rw-r--r--xfa_test/pdf/fading_controls.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/xfa_test/pdf/fading_controls.h b/xfa_test/pdf/fading_controls.h
new file mode 100644
index 0000000000..532464b473
--- /dev/null
+++ b/xfa_test/pdf/fading_controls.h
@@ -0,0 +1,84 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PDF_FADING_CONTROLS_H_
+#define PDF_FADING_CONTROLS_H_
+
+#include <list>
+
+#include "pdf/control.h"
+
+namespace chrome_pdf {
+
+class FadingControls : public Control,
+ public ControlOwner {
+ public:
+ enum FadingState {
+ NONE,
+ FADING_IN,
+ FADING_OUT
+ };
+
+ FadingControls();
+ virtual ~FadingControls();
+ virtual bool CreateFadingControls(
+ uint32 id, const pp::Rect& rc, bool visible,
+ Control::Owner* delegate, uint8 transparency);
+
+ // Control interface.
+ virtual void Paint(pp::ImageData* image_data, const pp::Rect& rc);
+ virtual bool HandleEvent(const pp::InputEvent& event);
+ virtual void OnTimerFired(uint32 timer_id);
+ virtual void EventCaptureReleased();
+ virtual void MoveBy(const pp::Point& offset, bool invalidate);
+
+ // ControlOwner interface.
+ virtual void OnEvent(uint32 control_id, uint32 event_id, void* data);
+ virtual void Invalidate(uint32 control_id, const pp::Rect& rc);
+ virtual uint32 ScheduleTimer(uint32 control_id, uint32 timeout_ms);
+ virtual void SetEventCapture(uint32 control_id, bool set_capture);
+ virtual void SetCursor(uint32 control_id, PP_CursorType_Dev cursor_type);
+ virtual pp::Instance* GetInstance();
+
+ // FadingControls interface
+ // This function takes ownership of the control, and will destoy it
+ // when control is destroyed.
+ // Input control MUST be located inside FadingControls boundaries, and has
+ // this instance of FadingControls as a delegate.
+ virtual bool AddControl(Control* control);
+ virtual void RemoveControl(uint32 control_id);
+ virtual Control* GetControl(uint32 id);
+ virtual pp::Rect GetControlsRect();
+
+ // Expand/Shrink area which triggers inner control appearance to the left.
+ virtual bool ExpandLeft(int offset);
+
+ // Fade-in, then show controls for time_ms, and then fade-out. Any mouse
+ // event in this control area will interrupt splash mode.
+ virtual void Splash(uint32 time_ms);
+
+ uint8 current_transparency() const { return current_transparency_; }
+
+ private:
+ bool NotifyControls(const pp::InputEvent& event);
+ void FadeIn();
+ void FadeOut();
+ void OnFadingComplete();
+ void CancelSplashMode();
+
+ std::list<Control*> controls_;
+ FadingState state_;
+ uint8 current_transparency_;
+ uint32 fading_timer_id_;
+ uint32 current_capture_control_;
+ uint32 fading_timeout_;
+ uint32 alpha_shift_;
+ bool splash_;
+ uint32 splash_timeout_;
+};
+
+} // namespace chrome_pdf
+
+#endif // PDF_FADING_CONTROLS_H_
+