blob: 3e50a461f07a88fc4a69f1f377e4d544d31bd3a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
// Copyright (c) 2009 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 VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_WRAPPER_H_
#define VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_WRAPPER_H_
#include "gfx/native_widget_types.h"
namespace views {
class Checkbox;
class NativeButton;
class RadioButton;
class View;
// A specialization of NativeControlWrapper that hosts a platform-native button.
class NativeButtonWrapper {
public:
// Updates the native button's label from the state stored in its associated
// NativeButton.
virtual void UpdateLabel() = 0;
// Updates the native button's label font from the state stored in its
// associated NativeButton.
virtual void UpdateFont() = 0;
// Updates the native button's enabled state from the state stored in its
// associated NativeButton.
virtual void UpdateEnabled() = 0;
// Updates the native button's default state from the state stored in its
// associated NativeButton.
virtual void UpdateDefault() = 0;
// Updates the native button's checked state from the state stored in its
// associated NativeCheckbox. Valid only for checkboxes and radio buttons.
virtual void UpdateChecked() {}
// Shows the pushed state for the button if |pushed| is true.
virtual void SetPushed(bool pushed) {};
// Retrieves the views::View that hosts the native control.
virtual View* GetView() = 0;
// Sets the focus to the button.
virtual void SetFocus() = 0;
// Returns true if the wrapped NativeButton supplies its own label, false if
// the caller needs to provide one.
virtual bool UsesNativeLabel() const = 0;
// Returns true if the wrapped NativeRadioButton supplies its own grouping
// mechanism, or false if the radio button needs to provide one.
virtual bool UsesNativeRadioButtonGroup() const = 0;
// Returns a handle to the underlying native view for testing.
virtual gfx::NativeView GetTestingHandle() const = 0;
// Return the width of the button. Used for fixed size buttons (checkboxes and
// radio buttons) only.
static int GetFixedWidth();
// Creates an appropriate NativeButtonWrapper for the platform.
static NativeButtonWrapper* CreateNativeButtonWrapper(NativeButton* button);
static NativeButtonWrapper* CreateCheckboxWrapper(Checkbox* checkbox);
static NativeButtonWrapper* CreateRadioButtonWrapper(
RadioButton* radio_button);
};
} // namespace views
#endif // VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_WRAPPER_H_
|