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