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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_UTILITIES_H_ 6 #define CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_UTILITIES_H_ 7 8 #import <Cocoa/Cocoa.h> 9 10 // InfoBarUtilities provide helper functions to construct infobars with 11 // similar appearance. 12 namespace InfoBarUtilities { 13 14 // Move the |toMove| view |spacing| pixels before/after the |anchor| view. 15 // |after| signifies the side of |anchor| on which to place |toMove|. 16 void MoveControl(NSView* anchor, NSView* toMove, int spacing, bool after); 17 18 // Vertically center |toMove| in its container. 19 void VerticallyCenterView(NSView *toMove); 20 21 // Check that the control |before| is ordered visually before the |after| 22 // control. Also, check that there is space between them. 23 bool VerifyControlOrderAndSpacing(id before, id after); 24 25 // Creates a label control in the style we need for the infobar's labels 26 // within |bounds|. 27 NSTextField* CreateLabel(NSRect bounds); 28 29 // Adds an item with the specified properties to |menu|. 30 void AddMenuItem(NSMenu *menu, id target, SEL selector, NSString* title, 31 int tag, bool enabled, bool checked); 32 33 } // namespace InfoBarUtilities 34 35 #endif // CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_UTILITIES_H_ 36