OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_VIEWS_RADIO_BUTTON_H__ | 5 #ifndef CHROME_VIEWS_RADIO_BUTTON_H__ |
6 #define CHROME_VIEWS_RADIO_BUTTON_H__ | 6 #define CHROME_VIEWS_RADIO_BUTTON_H__ |
7 | 7 |
8 #include "chrome/views/checkbox.h" | 8 #include "chrome/views/checkbox.h" |
9 | 9 |
10 namespace ChromeViews { | 10 namespace ChromeViews { |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 // Create a radio button with the provided label and group id. | 23 // Create a radio button with the provided label and group id. |
24 // The group id is used to identify all the other radio buttons which are in | 24 // The group id is used to identify all the other radio buttons which are in |
25 // mutual exclusion with this radio button. Note: RadioButton assumes that | 25 // mutual exclusion with this radio button. Note: RadioButton assumes that |
26 // all views with that group id are RadioButton. It is an error to give | 26 // all views with that group id are RadioButton. It is an error to give |
27 // that group id to another view subclass which is not a radio button or | 27 // that group id to another view subclass which is not a radio button or |
28 // a radio button subclass. | 28 // a radio button subclass. |
29 RadioButton(const std::wstring& label, int group_id); | 29 RadioButton(const std::wstring& label, int group_id); |
30 virtual ~RadioButton(); | 30 virtual ~RadioButton(); |
31 | 31 |
32 virtual void GetPreferredSize(CSize *out); | 32 virtual gfx::Size GetPreferredSize(); |
33 virtual void Layout(); | 33 virtual void Layout(); |
34 | 34 |
35 virtual std::string GetClassName() const; | 35 virtual std::string GetClassName() const; |
36 | 36 |
37 // Overridden to properly perform mutual exclusion. | 37 // Overridden to properly perform mutual exclusion. |
38 virtual void SetIsSelected(bool f); | 38 virtual void SetIsSelected(bool f); |
39 | 39 |
40 virtual View* GetSelectedViewForGroup(int group_id); | 40 virtual View* GetSelectedViewForGroup(int group_id); |
41 | 41 |
42 // When focusing a RadioButton with Tab/Shift-Tab, only the selected button | 42 // When focusing a RadioButton with Tab/Shift-Tab, only the selected button |
43 // from the group should be accessible. | 43 // from the group should be accessible. |
44 virtual bool IsGroupFocusTraversable() const { return false; } | 44 virtual bool IsGroupFocusTraversable() const { return false; } |
45 | 45 |
46 protected: | 46 protected: |
47 virtual HWND CreateNativeControl(HWND parent_container); | 47 virtual HWND CreateNativeControl(HWND parent_container); |
48 virtual LRESULT OnCommand(UINT code, int id, HWND source); | 48 virtual LRESULT OnCommand(UINT code, int id, HWND source); |
49 | 49 |
50 private: | 50 private: |
51 // Get the horizontal distance of the start of the text from the left of the | 51 // Get the horizontal distance of the start of the text from the left of the |
52 // control. | 52 // control. |
53 static int GetTextIndent(); | 53 static int GetTextIndent(); |
54 | 54 |
55 DISALLOW_EVIL_CONSTRUCTORS(RadioButton); | 55 DISALLOW_EVIL_CONSTRUCTORS(RadioButton); |
56 }; | 56 }; |
57 | 57 |
58 } | 58 } |
59 #endif // CHROME_VIEWS_RADIO_BUTTON_H__ | 59 #endif // CHROME_VIEWS_RADIO_BUTTON_H__ |
60 | 60 |
OLD | NEW |