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

Side by Side Diff: ui/base/layout.h

Issue 93863005: ui: Rename ui_export.h to ui_base_export.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: UI_BASE_IMPLEMENTATION Created 6 years, 11 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 | « ui/base/l10n/time_format.h ('k') | ui/base/models/button_menu_item_model.h » ('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) 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_BASE_LAYOUT_H_ 5 #ifndef UI_BASE_LAYOUT_H_
6 #define UI_BASE_LAYOUT_H_ 6 #define UI_BASE_LAYOUT_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "ui/base/ui_export.h" 11 #include "ui/base/ui_base_export.h"
12 #include "ui/gfx/native_widget_types.h" 12 #include "ui/gfx/native_widget_types.h"
13 13
14 namespace ui { 14 namespace ui {
15 15
16 enum DisplayLayout { 16 enum DisplayLayout {
17 // The typical layout for e.g. Windows, Mac and Linux. 17 // The typical layout for e.g. Windows, Mac and Linux.
18 LAYOUT_DESKTOP, 18 LAYOUT_DESKTOP,
19 19
20 // Layout optimized for touch. Used e.g. for Windows 8 Metro mode. 20 // Layout optimized for touch. Used e.g. for Windows 8 Metro mode.
21 LAYOUT_TOUCH, 21 LAYOUT_TOUCH,
22 }; 22 };
23 23
24 // Returns the display layout that should be used. This could be used 24 // Returns the display layout that should be used. This could be used
25 // e.g. to tweak hard-coded padding that's layout specific, or choose 25 // e.g. to tweak hard-coded padding that's layout specific, or choose
26 // the .pak file of theme resources to load. 26 // the .pak file of theme resources to load.
27 // WARNING: this is deprecated and will be nuked as soon as aura is the default 27 // WARNING: this is deprecated and will be nuked as soon as aura is the default
28 // on windows. 28 // on windows.
29 UI_EXPORT DisplayLayout GetDisplayLayout(); 29 UI_BASE_EXPORT DisplayLayout GetDisplayLayout();
30 30
31 // Supported UI scale factors for the platform. This is used as an index 31 // Supported UI scale factors for the platform. This is used as an index
32 // into the array |kScaleFactorScales| which maps the enum value to a float. 32 // into the array |kScaleFactorScales| which maps the enum value to a float.
33 // SCALE_FACTOR_NONE is used for density independent resources such as 33 // SCALE_FACTOR_NONE is used for density independent resources such as
34 // string, html/js files or an image that can be used for any scale factors 34 // string, html/js files or an image that can be used for any scale factors
35 // (such as wallpapers). 35 // (such as wallpapers).
36 enum ScaleFactor { 36 enum ScaleFactor {
37 SCALE_FACTOR_NONE = 0, 37 SCALE_FACTOR_NONE = 0,
38 SCALE_FACTOR_100P, 38 SCALE_FACTOR_100P,
39 SCALE_FACTOR_125P, 39 SCALE_FACTOR_125P,
40 SCALE_FACTOR_133P, 40 SCALE_FACTOR_133P,
41 SCALE_FACTOR_140P, 41 SCALE_FACTOR_140P,
42 SCALE_FACTOR_150P, 42 SCALE_FACTOR_150P,
43 SCALE_FACTOR_180P, 43 SCALE_FACTOR_180P,
44 SCALE_FACTOR_200P, 44 SCALE_FACTOR_200P,
45 SCALE_FACTOR_300P, 45 SCALE_FACTOR_300P,
46 46
47 NUM_SCALE_FACTORS // This always appears last. 47 NUM_SCALE_FACTORS // This always appears last.
48 }; 48 };
49 49
50 // Changes the value of GetSupportedScaleFactors() to |scale_factors|. 50 // Changes the value of GetSupportedScaleFactors() to |scale_factors|.
51 // Use ScopedSetSupportedScaleFactors for unit tests as not to affect the 51 // Use ScopedSetSupportedScaleFactors for unit tests as not to affect the
52 // state of other tests. 52 // state of other tests.
53 UI_EXPORT void SetSupportedScaleFactors( 53 UI_BASE_EXPORT void SetSupportedScaleFactors(
54 const std::vector<ScaleFactor>& scale_factors); 54 const std::vector<ScaleFactor>& scale_factors);
55 55
56 // Returns a vector with the scale factors which are supported by this 56 // Returns a vector with the scale factors which are supported by this
57 // platform, in ascending order. 57 // platform, in ascending order.
58 UI_EXPORT const std::vector<ScaleFactor>& GetSupportedScaleFactors(); 58 UI_BASE_EXPORT const std::vector<ScaleFactor>& GetSupportedScaleFactors();
59 59
60 // Returns the float scale value for |scale_factor|. 60 // Returns the float scale value for |scale_factor|.
61 UI_EXPORT float GetImageScale(ScaleFactor scale_factor); 61 UI_BASE_EXPORT float GetImageScale(ScaleFactor scale_factor);
62 62
63 // Returns the supported ScaleFactor which most closely matches |scale|. 63 // Returns the supported ScaleFactor which most closely matches |scale|.
64 // Converting from float to ScaleFactor is inefficient and should be done as 64 // Converting from float to ScaleFactor is inefficient and should be done as
65 // little as possible. 65 // little as possible.
66 // TODO(oshima): Make ScaleFactor a class and remove this. 66 // TODO(oshima): Make ScaleFactor a class and remove this.
67 UI_EXPORT ScaleFactor GetSupportedScaleFactor(float image_scale); 67 UI_BASE_EXPORT ScaleFactor GetSupportedScaleFactor(float image_scale);
68 68
69 // Returns the ScaleFactor used by |view|. 69 // Returns the ScaleFactor used by |view|.
70 UI_EXPORT ScaleFactor GetScaleFactorForNativeView(gfx::NativeView view); 70 UI_BASE_EXPORT ScaleFactor GetScaleFactorForNativeView(gfx::NativeView view);
71 71
72 // Returns true if |scale_factor| is supported by this platform. 72 // Returns true if |scale_factor| is supported by this platform.
73 UI_EXPORT bool IsScaleFactorSupported(ScaleFactor scale_factor); 73 UI_BASE_EXPORT bool IsScaleFactorSupported(ScaleFactor scale_factor);
74 74
75 // Returns the scale factor closest to |scale| from the full list of factors. 75 // Returns the scale factor closest to |scale| from the full list of factors.
76 // Note that it does NOT rely on the list of supported scale factors. 76 // Note that it does NOT rely on the list of supported scale factors.
77 // Finding the closest match is inefficient and shouldn't be done frequently. 77 // Finding the closest match is inefficient and shouldn't be done frequently.
78 UI_EXPORT ScaleFactor FindClosestScaleFactorUnsafe(float scale); 78 UI_BASE_EXPORT ScaleFactor FindClosestScaleFactorUnsafe(float scale);
79 79
80 namespace test { 80 namespace test {
81 // Class which changes the value of GetSupportedScaleFactors() to 81 // Class which changes the value of GetSupportedScaleFactors() to
82 // |new_scale_factors| for the duration of its lifetime. 82 // |new_scale_factors| for the duration of its lifetime.
83 class UI_EXPORT ScopedSetSupportedScaleFactors { 83 class UI_BASE_EXPORT ScopedSetSupportedScaleFactors {
84 public: 84 public:
85 explicit ScopedSetSupportedScaleFactors( 85 explicit ScopedSetSupportedScaleFactors(
86 const std::vector<ui::ScaleFactor>& new_scale_factors); 86 const std::vector<ui::ScaleFactor>& new_scale_factors);
87 ~ScopedSetSupportedScaleFactors(); 87 ~ScopedSetSupportedScaleFactors();
88 88
89 private: 89 private:
90 std::vector<ui::ScaleFactor>* original_scale_factors_; 90 std::vector<ui::ScaleFactor>* original_scale_factors_;
91 91
92 DISALLOW_COPY_AND_ASSIGN(ScopedSetSupportedScaleFactors); 92 DISALLOW_COPY_AND_ASSIGN(ScopedSetSupportedScaleFactors);
93 }; 93 };
94 94
95 } // namespace test 95 } // namespace test
96 96
97 } // namespace ui 97 } // namespace ui
98 98
99 #endif // UI_BASE_LAYOUT_H_ 99 #endif // UI_BASE_LAYOUT_H_
OLDNEW
« no previous file with comments | « ui/base/l10n/time_format.h ('k') | ui/base/models/button_menu_item_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698