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.
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
{
17 EVENT_ID_BUTTON_CLICKED
,
18 EVENT_ID_BUTTON_STATE_CHANGED
,
30 BUTTON_PRESSED_STICKY
,
35 virtual bool CreateButton(uint32 id
,
36 const pp::Point
& origin
,
38 Control::Owner
* delegate
,
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
);
55 void OnButtonClicked();
57 const pp::ImageData
& GetCurrentImage();
58 void ChangeState(ButtonState new_state
, bool force
);
64 pp::ImageData normal_
;
65 pp::ImageData highlighted_
;
66 pp::ImageData pressed_
;
69 } // namespace chrome_pdf
71 #endif // PDF_BUTTON_H_