Cleanup UserManager dependency of CloudExternalDataPolicyObserver.
[chromium-blink-merge.git] / pdf / button.h
blobfa2517d62b695e42c2c8216bdf6bae5f9620bdf0
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_BUTTON_H_
6 #define PDF_BUTTON_H_
8 #include "pdf/control.h"
9 #include "ppapi/cpp/image_data.h"
10 #include "ppapi/cpp/rect.h"
12 namespace chrome_pdf {
14 class Button : public Control {
15 public:
16 enum ButtonEventIds {
17 EVENT_ID_BUTTON_CLICKED,
18 EVENT_ID_BUTTON_STATE_CHANGED,
21 enum ButtonStyle {
22 BUTTON_CLICKABLE,
23 BUTTON_STATE
26 enum ButtonState {
27 BUTTON_NORMAL,
28 BUTTON_HIGHLIGHTED,
29 BUTTON_PRESSED,
30 BUTTON_PRESSED_STICKY,
33 Button();
34 virtual ~Button();
35 virtual bool CreateButton(uint32 id,
36 const pp::Point& origin,
37 bool visible,
38 Control::Owner* delegate,
39 ButtonStyle style,
40 const pp::ImageData& face_normal,
41 const pp::ImageData& face_highlighted,
42 const pp::ImageData& face_pressed);
44 virtual void Paint(pp::ImageData* image_data, const pp::Rect& rc);
45 virtual bool HandleEvent(const pp::InputEvent& event);
46 virtual void OnEventCaptureReleased();
47 virtual void Show(bool visible, bool invalidate);
48 virtual void AdjustTransparency(uint8 transparency, bool invalidate);
50 ButtonState state() const { return state_; }
51 bool IsPressed() const { return state() == BUTTON_PRESSED_STICKY; }
52 void SetPressedState(bool pressed);
54 private:
55 void OnButtonClicked();
57 const pp::ImageData& GetCurrentImage();
58 void ChangeState(ButtonState new_state, bool force);
60 ButtonStyle style_;
61 ButtonState state_;
62 bool is_pressed_;
64 pp::ImageData normal_;
65 pp::ImageData highlighted_;
66 pp::ImageData pressed_;
69 } // namespace chrome_pdf
71 #endif // PDF_BUTTON_H_