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

Side by Side Diff: chrome/views/combo_box.cc

Issue 42013: Slight code change to make some global variables const. (Closed) Base URL: svn://svn.chromium.org/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
« no previous file with comments | « chrome/views/chrome_menu.cc ('k') | chrome/views/event.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/views/combo_box.h" 5 #include "chrome/views/combo_box.h"
6 6
7 #include "base/gfx/native_theme.h" 7 #include "base/gfx/native_theme.h"
8 #include "base/gfx/rect.h" 8 #include "base/gfx/rect.h"
9 #include "chrome/common/gfx/chrome_canvas.h" 9 #include "chrome/common/gfx/chrome_canvas.h"
10 #include "chrome/common/gfx/chrome_font.h" 10 #include "chrome/common/gfx/chrome_font.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 GetComboBoxInfo(hwnd, &cbi); 44 GetComboBoxInfo(hwnd, &cbi);
45 gfx::Rect rect_item(cbi.rcItem); 45 gfx::Rect rect_item(cbi.rcItem);
46 gfx::Rect rect_button(cbi.rcButton); 46 gfx::Rect rect_button(cbi.rcButton);
47 gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize( 47 gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize(
48 gfx::NativeTheme::MENULIST); 48 gfx::NativeTheme::MENULIST);
49 49
50 // The padding value of '3' is the xy offset from the corner of the control 50 // The padding value of '3' is the xy offset from the corner of the control
51 // to the corner of rcItem. It does not seem to be queryable from the theme. 51 // to the corner of rcItem. It does not seem to be queryable from the theme.
52 // It is consistent on all versions of Windows from 2K to Vista, and is 52 // It is consistent on all versions of Windows from 2K to Vista, and is
53 // invariant with respect to the combobox border size. We could conceivably 53 // invariant with respect to the combobox border size. We could conceivably
54 // get this number from rect_item.x, but it seems fragile to depend on positio n 54 // get this number from rect_item.x, but it seems fragile to depend on
55 // here, inside of the layout code. 55 // position here, inside of the layout code.
56 const int kItemOffset = 3; 56 const int kItemOffset = 3;
57 int item_to_button_distance = std::max(kItemOffset - border.width(), 0); 57 int item_to_button_distance = std::max(kItemOffset - border.width(), 0);
58 58
59 // The cx computation can be read as measuring from left to right. 59 // The cx computation can be read as measuring from left to right.
60 int pref_width = std::max(kItemOffset + content_width_ + 60 int pref_width = std::max(kItemOffset + content_width_ +
61 kComboboxExtraPaddingX + 61 kComboboxExtraPaddingX +
62 item_to_button_distance + rect_button.width() + 62 item_to_button_distance + rect_button.width() +
63 border.width(), kMinComboboxWidth); 63 border.width(), kMinComboboxWidth);
64 // The two arguments to ::max below should be typically be equal. 64 // The two arguments to ::max below should be typically be equal.
65 int pref_height = std::max(rect_item.height() + 2 * kItemOffset, 65 int pref_height = std::max(rect_item.height() + 2 * kItemOffset,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // CB_SELECTSTRING does). 158 // CB_SELECTSTRING does).
159 ::SendMessage(hwnd, CB_SETCURSEL, selected_item_, 0); 159 ::SendMessage(hwnd, CB_SETCURSEL, selected_item_, 0);
160 } 160 }
161 161
162 int ComboBox::GetSelectedItem() { 162 int ComboBox::GetSelectedItem() {
163 return selected_item_; 163 return selected_item_;
164 } 164 }
165 165
166 } // namespace views 166 } // namespace views
167 167
OLDNEW
« no previous file with comments | « chrome/views/chrome_menu.cc ('k') | chrome/views/event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698