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

Side by Side Diff: ui/views/controls/combobox/native_combobox_views.h

Issue 9839034: views: Refactor the way we get the combo box font. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: order Created 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_VIEWS_H_ 5 #ifndef UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_VIEWS_H_
6 #define UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_VIEWS_H_ 6 #define UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_VIEWS_H_
7 #pragma once 7 #pragma once
8 8
9 #include "ui/views/controls/combobox/native_combobox_wrapper.h" 9 #include "ui/views/controls/combobox/native_combobox_wrapper.h"
10 #include "ui/views/controls/menu/menu_delegate.h" 10 #include "ui/views/controls/menu/menu_delegate.h"
11 #include "ui/views/view.h" 11 #include "ui/views/view.h"
12 12
13 namespace gfx { 13 namespace gfx {
14 class Canvas; 14 class Canvas;
15 class Font; 15 class Font;
16 } 16 }
17 17
18 namespace views { 18 namespace views {
19 19
20 class KeyEvent;
21 class FocusableBorder; 20 class FocusableBorder;
22 class MenuRunner; 21 class MenuRunner;
23 22
24 // A views/skia only implementation of NativeComboboxWrapper. 23 // A views/skia only implementation of NativeComboboxWrapper.
25 // No platform specific code is used. 24 // No platform specific code is used.
26 class NativeComboboxViews : public views::View, 25 class NativeComboboxViews : public views::View,
27 public NativeComboboxWrapper, 26 public NativeComboboxWrapper,
28 public views::MenuDelegate { 27 public views::MenuDelegate {
29 public: 28 public:
29 static const char kViewClassName[];
30
30 explicit NativeComboboxViews(Combobox* parent); 31 explicit NativeComboboxViews(Combobox* parent);
31 virtual ~NativeComboboxViews(); 32 virtual ~NativeComboboxViews();
32 33
33 // views::View overrides: 34 // views::View overrides:
34 virtual bool OnMousePressed(const views::MouseEvent& mouse_event) OVERRIDE; 35 virtual bool OnMousePressed(const views::MouseEvent& mouse_event) OVERRIDE;
35 virtual bool OnMouseDragged(const views::MouseEvent& mouse_event) OVERRIDE; 36 virtual bool OnMouseDragged(const views::MouseEvent& mouse_event) OVERRIDE;
36 virtual bool OnKeyPressed(const views::KeyEvent& key_event) OVERRIDE; 37 virtual bool OnKeyPressed(const views::KeyEvent& key_event) OVERRIDE;
37 virtual bool OnKeyReleased(const views::KeyEvent& key_event) OVERRIDE; 38 virtual bool OnKeyReleased(const views::KeyEvent& key_event) OVERRIDE;
38 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 39 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
39 virtual void OnFocus() OVERRIDE; 40 virtual void OnFocus() OVERRIDE;
(...skipping 13 matching lines...) Expand all
53 virtual void HandleFocus() OVERRIDE; 54 virtual void HandleFocus() OVERRIDE;
54 virtual void HandleBlur() OVERRIDE; 55 virtual void HandleBlur() OVERRIDE;
55 virtual gfx::NativeView GetTestingHandle() const OVERRIDE; 56 virtual gfx::NativeView GetTestingHandle() const OVERRIDE;
56 57
57 // MenuDelegate overrides: 58 // MenuDelegate overrides:
58 virtual bool IsItemChecked(int id) const OVERRIDE; 59 virtual bool IsItemChecked(int id) const OVERRIDE;
59 virtual bool IsCommandEnabled(int id) const OVERRIDE; 60 virtual bool IsCommandEnabled(int id) const OVERRIDE;
60 virtual void ExecuteCommand(int id) OVERRIDE; 61 virtual void ExecuteCommand(int id) OVERRIDE;
61 virtual bool GetAccelerator(int id, ui::Accelerator* accelerator) OVERRIDE; 62 virtual bool GetAccelerator(int id, ui::Accelerator* accelerator) OVERRIDE;
62 63
63 // class name of internal
64 static const char kViewClassName[];
65
66 private: 64 private:
67 // Returns the Combobox's font.
68 const gfx::Font& GetFont() const;
69
70 // Given bounds within our View, this helper routine mirrors the bounds if 65 // Given bounds within our View, this helper routine mirrors the bounds if
71 // necessary. 66 // necessary.
72 void AdjustBoundsForRTLUI(gfx::Rect* rect) const; 67 void AdjustBoundsForRTLUI(gfx::Rect* rect) const;
73 68
74 // Draw the selected value of the drop down list 69 // Draw the selected value of the drop down list
75 void PaintText(gfx::Canvas* canvas); 70 void PaintText(gfx::Canvas* canvas);
76 71
77 // Show the drop down list 72 // Show the drop down list
78 void ShowDropDownMenu(); 73 void ShowDropDownMenu();
79 74
(...skipping 18 matching lines...) Expand all
98 // The maximum dimensions of the content in the dropdown 93 // The maximum dimensions of the content in the dropdown
99 int content_width_; 94 int content_width_;
100 int content_height_; 95 int content_height_;
101 96
102 DISALLOW_COPY_AND_ASSIGN(NativeComboboxViews); 97 DISALLOW_COPY_AND_ASSIGN(NativeComboboxViews);
103 }; 98 };
104 99
105 } // namespace views 100 } // namespace views
106 101
107 #endif // UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_VIEWS_H_ 102 #endif // UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_VIEWS_H_
OLDNEW
« no previous file with comments | « ui/views/controls/combobox/combobox.cc ('k') | ui/views/controls/combobox/native_combobox_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698