Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Side by Side Diff: chrome/views/native_button.h

Issue 6043: Added dangerous download prompting. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_NATIVE_BUTTON_H__ 5 #ifndef CHROME_VIEWS_NATIVE_BUTTON_H__
6 #define CHROME_VIEWS_NATIVE_BUTTON_H__ 6 #define CHROME_VIEWS_NATIVE_BUTTON_H__
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gfx/size.h" 10 #include "base/gfx/size.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // technologies (ATs) use to determine what behavior to expect from a given 73 // technologies (ATs) use to determine what behavior to expect from a given
74 // control. 74 // control.
75 bool GetAccessibleRole(VARIANT* role); 75 bool GetAccessibleRole(VARIANT* role);
76 76
77 // Returns a brief, identifying string, containing a unique, readable name. 77 // Returns a brief, identifying string, containing a unique, readable name.
78 bool GetAccessibleName(std::wstring* name); 78 bool GetAccessibleName(std::wstring* name);
79 79
80 // Assigns an accessible string name. 80 // Assigns an accessible string name.
81 void SetAccessibleName(const std::wstring& name); 81 void SetAccessibleName(const std::wstring& name);
82 82
83 // Sets whether the min size of this button should follow the Windows
84 // guidelines. Default is true. Set this to false if you want slim buttons.
85 void set_enforce_dlu_min_size(bool value) { enforce_dlu_min_size_ = value; }
86
83 protected: 87 protected:
84 88
85 virtual HWND CreateNativeControl(HWND parent_container); 89 virtual HWND CreateNativeControl(HWND parent_container);
86 90
87 // Sub-classes can call this method to cause the native button to reflect 91 // Sub-classes can call this method to cause the native button to reflect
88 // the current state 92 // the current state
89 virtual void UpdateNativeButton(); 93 virtual void UpdateNativeButton();
90 94
91 // Sub-classes must override this method to properly configure the native 95 // Sub-classes must override this method to properly configure the native
92 // button given the current state 96 // button given the current state
93 virtual void ConfigureNativeButton(HWND hwnd); 97 virtual void ConfigureNativeButton(HWND hwnd);
94 98
95 // Overridden from NativeControl so we can activate the button when Enter is 99 // Overridden from NativeControl so we can activate the button when Enter is
96 // pressed. 100 // pressed.
97 virtual bool NotifyOnKeyDown() const; 101 virtual bool NotifyOnKeyDown() const;
98 virtual bool OnKeyDown(int virtual_key_code); 102 virtual bool OnKeyDown(int virtual_key_code);
99 103
100 private: 104 private:
101 NativeButton() {} 105 NativeButton() {}
102 106
103 // Initializes the button. If |is_default| is true, this appears like the 107 // Initializes the button. If |is_default| is true, this appears like the
104 // "default" button, and will register Enter as its keyboard accelerator. 108 // "default" button, and will register Enter as its keyboard accelerator.
105 void Init(const std::wstring& label, bool is_default); 109 void Init(const std::wstring& label, bool is_default);
106 110
107 void Clicked(); 111 void Clicked();
108 112
113 // Whether the button preferred size should follow the Microsoft layout
114 // guidelines. Default is true.
115 bool enforce_dlu_min_size_;
116
109 std::wstring label_; 117 std::wstring label_;
110 ChromeFont font_; 118 ChromeFont font_;
111 Listener* listener_; 119 Listener* listener_;
112 120
113 CSize padding_; 121 CSize padding_;
114 122
115 // True if the button should be rendered to appear like the "default" button 123 // True if the button should be rendered to appear like the "default" button
116 // in the containing dialog box. Default buttons register Enter as their 124 // in the containing dialog box. Default buttons register Enter as their
117 // accelerator. 125 // accelerator.
118 bool is_default_; 126 bool is_default_;
119 127
120 // Minimum size, in dlus (see SetMinSizeFromDLUs). 128 // Minimum size, in dlus (see SetMinSizeFromDLUs).
121 gfx::Size min_dlu_size_; 129 gfx::Size min_dlu_size_;
122 130
123 // Storage of strings needed for accessibility. 131 // Storage of strings needed for accessibility.
124 std::wstring accessible_name_; 132 std::wstring accessible_name_;
125 133
126 DISALLOW_EVIL_CONSTRUCTORS(NativeButton); 134 DISALLOW_EVIL_CONSTRUCTORS(NativeButton);
127 }; 135 };
128 136
129 } 137 }
130 138
131 #endif // CHROME_VIEWS_NATIVE_BUTTON_H__ 139 #endif // CHROME_VIEWS_NATIVE_BUTTON_H__
132 140
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698