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

Side by Side Diff: chrome/views/controls/button/native_button.cc

Issue 42582: Making the enabled and visible states work in native buttons (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "chrome/views/controls/button/native_button.h" 5 #include "chrome/views/controls/button/native_button.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/common/l10n_util.h" 8 #include "chrome/common/l10n_util.h"
9 9
10 namespace views { 10 namespace views {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return sz; 111 return sz;
112 } 112 }
113 113
114 void NativeButton::Layout() { 114 void NativeButton::Layout() {
115 if (native_wrapper_) { 115 if (native_wrapper_) {
116 native_wrapper_->GetView()->SetBounds(0, 0, width(), height()); 116 native_wrapper_->GetView()->SetBounds(0, 0, width(), height());
117 native_wrapper_->GetView()->Layout(); 117 native_wrapper_->GetView()->Layout();
118 } 118 }
119 } 119 }
120 120
121 void NativeButton::SetEnabled(bool flag) {
122 Button::SetEnabled(flag);
123 if (native_wrapper_)
124 native_wrapper_->UpdateEnabled();
125 }
126
121 void NativeButton::ViewHierarchyChanged(bool is_add, View* parent, 127 void NativeButton::ViewHierarchyChanged(bool is_add, View* parent,
122 View* child) { 128 View* child) {
123 if (is_add && !native_wrapper_ && GetWidget()) { 129 if (is_add && !native_wrapper_ && GetWidget()) {
124 CreateWrapper(); 130 CreateWrapper();
125 AddChildView(native_wrapper_->GetView()); 131 AddChildView(native_wrapper_->GetView());
126 } 132 }
127 } 133 }
128 134
129 std::string NativeButton::GetClassName() const { 135 std::string NativeButton::GetClassName() const {
130 return kViewClassName; 136 return kViewClassName;
(...skipping 13 matching lines...) Expand all
144 if (native_wrapper_) 150 if (native_wrapper_)
145 native_wrapper_->SetFocus(); 151 native_wrapper_->SetFocus();
146 } 152 }
147 153
148 //////////////////////////////////////////////////////////////////////////////// 154 ////////////////////////////////////////////////////////////////////////////////
149 // NativeButton, protected: 155 // NativeButton, protected:
150 156
151 void NativeButton::CreateWrapper() { 157 void NativeButton::CreateWrapper() {
152 native_wrapper_ = NativeButtonWrapper::CreateNativeButtonWrapper(this); 158 native_wrapper_ = NativeButtonWrapper::CreateNativeButtonWrapper(this);
153 native_wrapper_->UpdateLabel(); 159 native_wrapper_->UpdateLabel();
160 native_wrapper_->UpdateEnabled();
154 } 161 }
155 162
156 void NativeButton::InitBorder() { 163 void NativeButton::InitBorder() {
157 set_border(Border::CreateEmptyBorder(0, kButtonBorderHWidth, 0, 164 set_border(Border::CreateEmptyBorder(0, kButtonBorderHWidth, 0,
158 kButtonBorderHWidth)); 165 kButtonBorderHWidth));
159 } 166 }
160 167
161 } // namespace views 168 } // namespace views
OLDNEW
« no previous file with comments | « chrome/views/controls/button/native_button.h ('k') | chrome/views/controls/button/native_button_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698