summaryrefslogtreecommitdiffstats
path: root/views/controls/button/native_button_wrapper.h
blob: a4cbbc8cc2f9c3c80376bf7a557fc9a9b3e0b6f9 (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
// 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_

class ChromeFont;

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;

  // 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  // #ifndef VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_WRAPPER_H_