| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 #include <stddef.h> | 6 #include <stddef.h> |
| 7 | 7 |
| 8 #include "base/feature_list.h" | |
| 9 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 10 | 9 |
| 11 namespace cocoa_l10n_util { | 10 namespace cocoa_l10n_util { |
| 12 | 11 |
| 13 // Compare function for -[NSArray sortedArrayUsingFunction:context:] that | 12 // Compare function for -[NSArray sortedArrayUsingFunction:context:] that |
| 14 // sorts the views in Y order bottom up. |context| is ignored. | 13 // sorts the views in Y order bottom up. |context| is ignored. |
| 15 NSInteger CompareFrameY(id view1, id view2, void* context); | 14 NSInteger CompareFrameY(id view1, id view2, void* context); |
| 16 | 15 |
| 17 // Helper for tweaking views. If view is a: | 16 // Helper for tweaking views. If view is a: |
| 18 // checkbox, radio group or label: it gets a forced wrap at current size | 17 // checkbox, radio group or label: it gets a forced wrap at current size |
| 19 // editable field: left as is | 18 // editable field: left as is |
| 20 // anything else: do +[GTMUILocalizerAndLayoutTweaker sizeToFitView:] | 19 // anything else: do +[GTMUILocalizerAndLayoutTweaker sizeToFitView:] |
| 21 NSSize WrapOrSizeToFit(NSView* view); | 20 NSSize WrapOrSizeToFit(NSView* view); |
| 22 | 21 |
| 23 // Walks views in top-down order, wraps each to their current width, and moves | 22 // Walks views in top-down order, wraps each to their current width, and moves |
| 24 // the latter ones down to prevent overlaps. Returns the vertical delta in view | 23 // the latter ones down to prevent overlaps. Returns the vertical delta in view |
| 25 // coordinates. | 24 // coordinates. |
| 26 CGFloat VerticallyReflowGroup(NSArray* views); | 25 CGFloat VerticallyReflowGroup(NSArray* views); |
| 27 | 26 |
| 28 // Like |base::ReplaceStringPlaceholders(const base::string16&, | 27 // Like |base::ReplaceStringPlaceholders(const base::string16&, |
| 29 // const base::string16&, size_t*)|, but for a NSString formatString. | 28 // const base::string16&, size_t*)|, but for a NSString formatString. |
| 30 NSString* ReplaceNSStringPlaceholders(NSString* formatString, | 29 NSString* ReplaceNSStringPlaceholders(NSString* formatString, |
| 31 const base::string16& a, | 30 const base::string16& a, |
| 32 size_t* offset); | 31 size_t* offset); |
| 33 | 32 |
| 34 // Generates a tooltip string for a given URL and title. | 33 // Generates a tooltip string for a given URL and title. |
| 35 NSString* TooltipForURLAndTitle(NSString* url, NSString* title); | 34 NSString* TooltipForURLAndTitle(NSString* url, NSString* title); |
| 36 | 35 |
| 37 extern const base::Feature kExperimentalMacRTL; | |
| 38 // Returns whether both: | |
| 39 // 1) Experimental Mac RTL support is enabled via the ExperimentalMacRTL | |
| 40 // feature; | |
| 41 // 2) The browser UI is in RTL mode. | |
| 42 // If ExperimentalMacRTL becomes the default, this function can be replaced with | |
| 43 // uses of base::i18n::IsRTL(). | |
| 44 bool ShouldDoExperimentalRTLLayout(); | |
| 45 | |
| 46 // Returns true if ShouldDoExperimentalRTLLayout() is true and the OS is | |
| 47 // 10.12 or above. macOS 10.12 is the first OS where the native stoplight | |
| 48 // buttons are reversed in RTL, so manually reversing them in previous | |
| 49 // OSes would make Chrome stick out. | |
| 50 bool ShouldFlipWindowControlsInRTL(); | |
| 51 | |
| 52 } // namespace cocoa_l10n_util | 36 } // namespace cocoa_l10n_util |
| OLD | NEW |